예제 #1
0
        /// <summary>
        /// The page load event.
        /// </summary>
        /// <param name="sender">
        /// the sender.
        /// </param>
        /// <param name="e">
        /// the e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.PageContext.BoardSettings.EnableAlbum)
            {
                YafBuildLink.AccessDenied();
            }

            if (this.Request.QueryString.GetFirstOrDefault("u") == null || this.Request.QueryString.GetFirstOrDefault("a") == null)
            {
                YafBuildLink.AccessDenied();
            }

            var userId  = Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("u"));
            var albumId = Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("a"));

            // setup jQuery, LightBox and YAF JS...
            YafContext.Current.PageElements.RegisterJQuery();
            YafContext.Current.PageElements.RegisterJsResourceInclude("yafjs", "js/yaf.js");
            YafContext.Current.PageElements.RegisterJsBlock("toggleMessageJs", JavaScriptBlocks.ToggleMessageJs);

            // lightbox only need if the browser is not IE6...
            if (!UserAgentHelper.IsBrowserIE6())
            {
                YafContext.Current.PageElements.RegisterJsResourceInclude("lightboxjs", "js/jquery.lightbox.min.js");
                YafContext.Current.PageElements.RegisterCssIncludeResource("css/jquery.lightbox.css");
                YafContext.Current.PageElements.RegisterJsBlock("lightboxloadjs", JavaScriptBlocks.LightBoxLoadJs);
            }

            string displayName = this.PageContext.UserDisplayName.GetName((int)userId);

            // Generate the page links.
            this.PageLinks.Clear();
            this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
            this.PageLinks.AddLink(displayName, YafBuildLink.GetLink(ForumPages.profile, "u={0}", userId));
            this.PageLinks.AddLink(this.GetText("ALBUMS"), YafBuildLink.GetLink(ForumPages.albums, "u={0}", userId));
            this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty);

            // Set the title text.
            this.LocalizedLabel1.Param0 = !string.IsNullOrEmpty(displayName) ? this.Server.HtmlEncode(displayName) : this.Server.HtmlEncode(this.PageContext.User.UserName);
            this.LocalizedLabel1.Param1 = this.Server.HtmlEncode(DB.album_gettitle(albumId));

            // Initialize the Album Image List control.
            this.AlbumImageList1.UserID  = (int)userId;
            this.AlbumImageList1.AlbumID = (int)albumId;
        }
예제 #2
0
        /// <summary>
        ///   The page load event.
        /// </summary>
        /// <param name = "sender">
        ///   the sender.
        /// </param>
        /// <param name = "e">
        ///   the e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.PageContext.BoardSettings.EnableAlbum)
            {
                YafBuildLink.AccessDenied();
            }

            if (this.Request.QueryString.GetFirstOrDefault("u") == null)
            {
                YafBuildLink.AccessDenied();
            }

            // setup jQuery, LightBox and YAF JS...
            YafContext.Current.PageElements.RegisterJQuery();
            YafContext.Current.PageElements.RegisterJsResourceInclude("yafjs", "js/yaf.js");
            YafContext.Current.PageElements.RegisterJsBlock("toggleMessageJs", JavaScriptBlocks.ToggleMessageJs);

            // lightbox only need if the browser is not IE6...
            if (!UserAgentHelper.IsBrowserIE6())
            {
                YafContext.Current.PageElements.RegisterJsResourceInclude("lightboxjs", "js/jquery.lightbox.min.js");
                YafContext.Current.PageElements.RegisterCssIncludeResource("css/jquery.lightbox.css");
                YafContext.Current.PageElements.RegisterJsBlock("lightboxloadjs", JavaScriptBlocks.LightBoxLoadJs);
            }

            string displayName =
                UserMembershipHelper.GetDisplayNameFromID(
                    Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("u")));

            // Generate the Page Links.

            this.PageLinks.Clear();
            this.PageLinks.AddLink(this.PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
            this.PageLinks.AddLink(
                displayName.IsSet()
          ? displayName
          : UserMembershipHelper.GetUserNameFromID(
                    Security.StringToLongOrRedirect(this.Request.QueryString.GetFirstOrDefault("u"))),
                YafBuildLink.GetLink(ForumPages.profile, "u={0}", this.Request.QueryString.GetFirstOrDefault("u")));
            this.PageLinks.AddLink(this.GetText("ALBUMS"), string.Empty);

            // Initialize the Album List control.
            this.AlbumList1.UserID = this.Request.QueryString.GetFirstOrDefault("u").ToType <int>();
        }
예제 #3
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.PageContext.BoardSettings.EnableThanksMod)
            {
                Utility.RegisterTypeForAjax(typeof(ThankYou));

                string addThankBoxHTML =
                    "'<a class=\"yaflittlebutton\" href=\"javascript:addThanks(' + res.value.MessageID + ');\" onclick=\"this.blur();\" title=' + res.value.Title + '><span>' + res.value.Text + '</span></a>'";

                string removeThankBoxHTML =
                    "'<a class=\"yaflittlebutton\" href=\"javascript:removeThanks(' + res.value.MessageID + ');\" onclick=\"this.blur();\" title=' + res.value.Title + '><span>' + res.value.Text + '</span></a>'";

                YafContext.Current.PageElements.RegisterJsBlockStartup(
                    "addThanksJs", JavaScriptBlocks.addThanksJs(removeThankBoxHTML));
                YafContext.Current.PageElements.RegisterJsBlockStartup(
                    "removeThanksJs", JavaScriptBlocks.removeThanksJs(addThankBoxHTML));
                YafContext.Current.PageElements.RegisterJsBlockStartup(
                    "asynchCallFailedJs", JavaScriptBlocks.asynchCallFailedJs);
            }

            // Irkoo Service Enabled?
            if (YafContext.Current.BoardSettings.EnableIrkoo)
            {
                YafContext.Current.PageElements.RegisterJsBlockStartup("IrkooMethods", YafIrkoo.IrkJsCode());
            }

            this.PopMenu1.Visible = !this.IsGuest;
            if (this.PopMenu1.Visible)
            {
                this.PopMenu1.ItemClick += this.PopMenu1_ItemClick;
                this.PopMenu1.AddPostBackItem("userprofile", this.PageContext.Localization.GetText("POSTS", "USERPROFILE"));

                this.PopMenu1.AddPostBackItem("lastposts", this.PageContext.Localization.GetText("PROFILE", "SEARCHUSER"));

                if (YafContext.Current.BoardSettings.EnableThanksMod)
                {
                    this.PopMenu1.AddPostBackItem("viewthanks", this.PageContext.Localization.GetText("VIEWTHANKS", "TITLE"));
                }

                if (this.PageContext.IsAdmin)
                {
                    this.PopMenu1.AddPostBackItem("edituser", "Edit User (Admin)");
                }

                if (!this.PageContext.IsGuest)
                {
                    if (this.Get <YafUserIgnored>().IsIgnored(this.PostData.UserId))
                    {
                        this.PopMenu1.AddPostBackItem(
                            "toggleuserposts_show", this.PageContext.Localization.GetText("POSTS", "TOGGLEUSERPOSTS_SHOW"));
                    }
                    else
                    {
                        this.PopMenu1.AddPostBackItem(
                            "toggleuserposts_hide", this.PageContext.Localization.GetText("POSTS", "TOGGLEUSERPOSTS_HIDE"));
                    }
                }

                if (YafContext.Current.BoardSettings.EnableBuddyList &&
                    this.PageContext.PageUserID != (int)this.DataRow["UserID"])
                {
                    // Should we add the "Add Buddy" item?
                    if (!YafBuddies.IsBuddy((int)this.DataRow["UserID"], false) && !this.PageContext.IsGuest)
                    {
                        this.PopMenu1.AddPostBackItem("addbuddy", this.PageContext.Localization.GetText("BUDDY", "ADDBUDDY"));
                    }
                    else if (YafBuddies.IsBuddy((int)this.DataRow["UserID"], true) && !this.PageContext.IsGuest)
                    {
                        // Are the users approved buddies? Add the "Remove buddy" item.
                        this.PopMenu1.AddClientScriptItemWithPostback(
                            this.PageContext.Localization.GetText("BUDDY", "REMOVEBUDDY"),
                            "removebuddy",
                            "if (confirm('{0}')) {1}".FormatWith(this.PageContext.Localization.GetText("CP_EDITBUDDIES", "NOTIFICATION_REMOVE"), "{postbackcode}"));
                    }
                }

                this.PopMenu1.Attach(this.UserProfileLink);
            }

            // setup jQuery, LightBox and YAF JS...
            YafContext.Current.PageElements.RegisterJQuery();
            YafContext.Current.PageElements.RegisterJsResourceInclude("yafjs", "js/yaf.js");
            YafContext.Current.PageElements.RegisterJsBlock("toggleMessageJs", JavaScriptBlocks.ToggleMessageJs);

            // lightbox only need if the browser is not IE6...
            if (!UserAgentHelper.IsBrowserIE6())
            {
                YafContext.Current.PageElements.RegisterJsResourceInclude("lightboxjs", "js/jquery.lightbox.min.js");
                YafContext.Current.PageElements.RegisterCssIncludeResource("css/jquery.lightbox.css");
                YafContext.Current.PageElements.RegisterJsBlock("lightboxloadjs", JavaScriptBlocks.LightBoxLoadJs);
            }

            this.NameCell.ColSpan = int.Parse(this.GetIndentSpan());
        }