/// <summary> /// The setup buddy list. /// </summary> /// <param name="userID"> /// The user id. /// </param> /// <param name="userData"> /// The user data. /// </param> private void SetupBuddyList(int userID, [NotNull] CombinedUserDataHelper userData) { if (userID == this.PageContext.PageUserID) { this.lnkBuddy.Visible = false; } else if (YafBuddies.IsBuddy((int)userData.DBRow["userID"], true) && !this.PageContext.IsGuest) { this.lnkBuddy.Visible = true; this.lnkBuddy.Text = "({0})".FormatWith(this.PageContext.Localization.GetText("BUDDY", "REMOVEBUDDY")); this.lnkBuddy.CommandArgument = "removebuddy"; this.lnkBuddy.Attributes["onclick"] = String.Format( "return confirm('{0}')", this.PageContext.Localization.GetText("CP_EDITBUDDIES", "NOTIFICATION_REMOVE")); } else if (YafBuddies.IsBuddy((int)userData.DBRow["userID"], false)) { this.lnkBuddy.Visible = false; this.ltrApproval.Visible = true; } else { if (!this.PageContext.IsGuest) { this.lnkBuddy.Visible = true; this.lnkBuddy.Text = "({0})".FormatWith(this.PageContext.Localization.GetText("BUDDY", "ADDBUDDY")); this.lnkBuddy.CommandArgument = "addbuddy"; this.lnkBuddy.Attributes["onclick"] = string.Empty; } } this.BuddyList.CurrentUserID = userID; this.BuddyList.Mode = 1; }
/// <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()); }