public void SetFlag( RankFlags flag, bool value ) { if ( value ) m_Flags |= flag; else m_Flags &= ~flag; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } if (this.Request.QueryString.GetFirstOrDefault("r") == null) { return; } var rankId = this.Request.QueryString.GetFirstOrDefaultAs <int>("r"); var rank = this.GetRepository <Rank>().GetById(rankId); var flags = new RankFlags(rank.Flags); this.Name.Text = rank.Name; this.IsStart.Checked = flags.IsStart; this.IsLadder.Checked = flags.IsLadder; this.MinPosts.Text = rank.MinPosts.ToString(); this.PMLimit.Text = rank.PMLimit.ToString(); this.Style.Text = rank.Style; this.RankPriority.Text = rank.SortOrder.ToString(); this.UsrAlbums.Text = rank.UsrAlbums.ToString(); this.UsrAlbumImages.Text = rank.UsrAlbumImages.ToString(); this.UsrSigChars.Text = rank.UsrSigChars.ToString(); this.UsrSigBBCodes.Text = rank.UsrSigBBCodes; this.UsrSigHTMLTags.Text = rank.UsrSigHTMLTags; this.Description.Text = rank.Description; this.DataBind(); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.IsPostBack) { this.BindData(); if (this.Request.QueryString.GetFirstOrDefault("r") != null) { var rankId = this.Request.QueryString.GetFirstOrDefaultAs <int>("r"); var rank = this.GetRepository <Rank>() .GetSingle(r => r.ID == rankId); var flags = new RankFlags(rank.Flags); this.Name.Text = rank.Name; this.IsStart.Checked = flags.IsStart; this.IsLadder.Checked = flags.IsLadder; this.MinPosts.Text = rank.MinPosts.ToString(); this.PMLimit.Text = rank.PMLimit.ToString(); this.Style.Text = rank.Style; this.RankPriority.Text = rank.SortOrder.ToString(); this.UsrAlbums.Text = rank.UsrAlbums.ToString(); this.UsrAlbumImages.Text = rank.UsrAlbumImages.ToString(); this.UsrSigChars.Text = rank.UsrSigChars.ToString(); this.UsrSigBBCodes.Text = rank.UsrSigBBCodes; this.UsrSigHTMLTags.Text = rank.UsrSigHTMLTags; this.Description.Text = rank.Description; var item = this.RankImage.Items.FindByText(rank.RankImage); if (item != null) { item.Selected = true; this.Preview.Src = "{0}{1}/{2}".FormatWith( YafForumInfo.ForumClientFileRoot, YafBoardFolders.Current.Ranks, rank.RankImage); } else { this.Preview.Src = YafForumInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry } } else { this.Preview.Src = YafForumInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry } } this.RankImage.Attributes["onchange"] = "getElementById('{2}').src='{0}{1}/' + this.value".FormatWith( YafForumInfo.ForumClientFileRoot, YafBoardFolders.Current.Ranks, this.Preview.ClientID); }
public void SetFlag(RankFlags flag, bool value) { if (value) { Flags |= flag; } else { Flags &= ~flag; } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.IsPostBack) { this.BindData(); if (this.Request.QueryString.GetFirstOrDefault("r") != null) { using ( var dt = LegacyDb.rank_list( this.PageContext.PageBoardID, this.Request.QueryString.GetFirstOrDefault("r"))) { var row = dt.Rows[0]; var flags = new RankFlags(row["Flags"]); this.Name.Text = (string)row["Name"]; this.IsStart.Checked = flags.IsStart; this.IsLadder.Checked = flags.IsLadder; this.MinPosts.Text = row["MinPosts"].ToString(); this.PMLimit.Text = row["PMLimit"].ToString(); this.Style.Text = row["Style"].ToString(); this.RankPriority.Text = row["SortOrder"].ToString(); this.UsrAlbums.Text = row["UsrAlbums"].ToString(); this.UsrAlbumImages.Text = row["UsrAlbumImages"].ToString(); this.UsrSigChars.Text = row["UsrSigChars"].ToString(); this.UsrSigBBCodes.Text = row["UsrSigBBCodes"].ToString(); this.UsrSigHTMLTags.Text = row["UsrSigHTMLTags"].ToString(); this.Description.Text = row["Description"].ToString(); var item = this.RankImage.Items.FindByText(row["RankImage"].ToString()); if (item != null) { item.Selected = true; this.Preview.Src = "{0}{1}/{2}".FormatWith( YafForumInfo.ForumClientFileRoot, YafBoardFolders.Current.Ranks, row["RankImage"]); } else { this.Preview.Src = YafForumInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry } } } else { this.Preview.Src = YafForumInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry } } this.RankImage.Attributes["onchange"] = "getElementById('{2}').src='{0}{1}/' + this.value".FormatWith( YafForumInfo.ForumClientFileRoot, YafBoardFolders.Current.Ranks, this.Preview.ClientID); }
/// <summary> /// The page_ load. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); this.PageLinks.AddLink("Administration", YafBuildLink.GetLink(ForumPages.admin_admin)); this.PageLinks.AddLink("Ranks", string.Empty); BindData(); if (Request.QueryString.GetFirstOrDefault("r") != null) { using (DataTable dt = DB.rank_list(PageContext.PageBoardID, Request.QueryString.GetFirstOrDefault("r"))) { DataRow row = dt.Rows[0]; var flags = new RankFlags(row["Flags"]); this.Name.Text = (string)row["Name"]; this.IsStart.Checked = flags.IsStart; this.IsLadder.Checked = flags.IsLadder; this.MinPosts.Text = row["MinPosts"].ToString(); this.PMLimit.Text = row["PMLimit"].ToString(); this.Style.Text = row["Style"].ToString(); this.RankPriority.Text = row["SortOrder"].ToString(); this.UsrAlbums.Text = row["UsrAlbums"].ToString(); this.UsrAlbumImages.Text = row["UsrAlbumImages"].ToString(); this.UsrSigChars.Text = row["UsrSigChars"].ToString(); this.UsrSigBBCodes.Text = row["UsrSigBBCodes"].ToString(); this.UsrSigHTMLTags.Text = row["UsrSigHTMLTags"].ToString(); this.Description.Text = row["Description"].ToString(); ListItem item = this.RankImage.Items.FindByText(row["RankImage"].ToString()); if (item != null) { item.Selected = true; this.Preview.Src = "{0}{1}/{2}".FormatWith(YafForumInfo.ForumClientFileRoot, YafBoardFolders.Current.Ranks, row["RankImage"]); // path corrected } else { this.Preview.Src = "{0}images/spacer.gif".FormatWith(YafForumInfo.ForumClientFileRoot); } } } else { this.Preview.Src = "{0}images/spacer.gif".FormatWith(YafForumInfo.ForumClientFileRoot); } } this.RankImage.Attributes["onchange"] = "getElementById('{2}_ctl01_Preview').src='{0}{1}/' + this.value".FormatWith(YafForumInfo.ForumClientFileRoot, YafBoardFolders.Current.Ranks, this.Parent.ID); }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum)); PageLinks.AddLink("Administration", YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.admin_admin)); PageLinks.AddLink("Ranks", ""); BindData(); if (Request.QueryString ["r"] != null) { using (DataTable dt = YAF.Classes.Data.DB.rank_list(PageContext.PageBoardID, Request.QueryString ["r"])) { DataRow row = dt.Rows [0]; RankFlags flags = new RankFlags(row ["Flags"]); Name.Text = ( string )row ["Name"]; IsStart.Checked = flags.IsStart; IsLadder.Checked = flags.IsLadder; MinPosts.Text = row ["MinPosts"].ToString(); ListItem item = RankImage.Items.FindByText(row ["RankImage"].ToString()); if (item != null) { item.Selected = true; Preview.Src = String.Format("{0}images/ranks/{1}", YafForumInfo.ForumRoot, row ["RankImage"]); //path corrected } else { Preview.Src = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot); } } } else { Preview.Src = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot); } } RankImage.Attributes ["onchange"] = String.Format( "getElementById('{1}_ctl01_Preview').src='{0}images/ranks/' + this.value", YafForumInfo.ForumRoot, this.Parent.ID ); }
protected void Page_Load( object sender, System.EventArgs e ) { if ( !IsPostBack ) { PageLinks.AddLink( PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.forum ) ); PageLinks.AddLink( "Administration", YAF.Classes.Utils.YafBuildLink.GetLink( YAF.Classes.Utils.ForumPages.admin_admin ) ); PageLinks.AddLink( "Ranks", "" ); BindData(); if ( Request.QueryString ["r"] != null ) { using ( DataTable dt = YAF.Classes.Data.DB.rank_list( PageContext.PageBoardID, Request.QueryString ["r"] ) ) { DataRow row = dt.Rows [0]; RankFlags flags = new RankFlags( row ["Flags"] ); Name.Text = ( string ) row ["Name"]; IsStart.Checked = flags.IsStart; IsLadder.Checked = flags.IsLadder; MinPosts.Text = row ["MinPosts"].ToString(); ListItem item = RankImage.Items.FindByText( row ["RankImage"].ToString() ); if ( item != null ) { item.Selected = true; Preview.Src = String.Format( "{0}images/ranks/{1}", YafForumInfo.ForumRoot, row ["RankImage"] ); //path corrected } else { Preview.Src = String.Format( "{0}images/spacer.gif", YafForumInfo.ForumRoot ); } } } else { Preview.Src = String.Format( "{0}images/spacer.gif", YafForumInfo.ForumRoot ); } } RankImage.Attributes ["onchange"] = String.Format( "getElementById('{1}_ctl01_Preview').src='{0}images/ranks/' + this.value", YafForumInfo.ForumRoot, this.Parent.ID ); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { this.PageContext.PageElements.RegisterJsBlockStartup( nameof(JavaScriptBlocks.FormValidatorJs), JavaScriptBlocks.FormValidatorJs(this.Save.ClientID)); if (this.IsPostBack) { return; } if (!this.Request.QueryString.Exists("r")) { return; } var rankId = this.Request.QueryString.GetFirstOrDefaultAs <int>("r"); var rank = this.GetRepository <Rank>().GetById(rankId); var flags = new RankFlags(rank.Flags); this.Name.Text = rank.Name; this.IsStart.Checked = flags.IsStart; this.IsLadder.Checked = flags.IsLadder; this.MinPosts.Text = rank.MinPosts.ToString(); this.PMLimit.Text = rank.PMLimit.ToString(); this.Style.Text = rank.Style; this.RankPriority.Text = rank.SortOrder.ToString(); this.UsrAlbums.Text = rank.UsrAlbums.ToString(); this.UsrAlbumImages.Text = rank.UsrAlbumImages.ToString(); this.UsrSigChars.Text = rank.UsrSigChars.ToString(); this.UsrSigBBCodes.Text = rank.UsrSigBBCodes; this.UsrSigHTMLTags.Text = rank.UsrSigHTMLTags; this.Description.Text = rank.Description; this.DataBind(); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.IsPostBack) { this.BindData(); if (this.Request.QueryString.GetFirstOrDefault("r") != null) { var rankId = this.Request.QueryString.GetFirstOrDefaultAs <int>("r"); var rank = this.GetRepository <Rank>() .GetSingle(r => r.ID == rankId); var flags = new RankFlags(rank.Flags); this.Name.Text = rank.Name; this.IsStart.Checked = flags.IsStart; this.IsLadder.Checked = flags.IsLadder; this.MinPosts.Text = rank.MinPosts.ToString(); this.PMLimit.Text = rank.PMLimit.ToString(); this.Style.Text = rank.Style; this.RankPriority.Text = rank.SortOrder.ToString(); this.UsrAlbums.Text = rank.UsrAlbums.ToString(); this.UsrAlbumImages.Text = rank.UsrAlbumImages.ToString(); this.UsrSigChars.Text = rank.UsrSigChars.ToString(); this.UsrSigBBCodes.Text = rank.UsrSigBBCodes; this.UsrSigHTMLTags.Text = rank.UsrSigHTMLTags; this.Description.Text = rank.Description; var item = this.RankImage.Items.FindByText(rank.RankImage); if (item != null) { item.Selected = true; } } } }
public bool GetFlag( RankFlags flag ) { return ( (m_Flags & flag) != 0 ); }
public RankDefinition( TextDefinition name, int rank, RankFlags flags ) { m_Name = name; m_Rank = rank; m_Flags = flags; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.IsPostBack) { this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.GetText("ADMIN_ADMIN", "Administration"), YafBuildLink.GetLink(ForumPages.admin_admin)); this.PageLinks.AddLink( this.GetText("ADMIN_RANKS", "TITLE"), YafBuildLink.GetLink(ForumPages.admin_ranks)); // current page label (no link) this.PageLinks.AddLink(this.GetText("ADMIN_EDITRANK", "TITLE"), string.Empty); this.Page.Header.Title = "{0} - {1} - {2}".FormatWith( this.GetText("ADMIN_ADMIN", "Administration"), this.GetText("ADMIN_RANKS", "TITLE"), this.GetText("ADMIN_EDITRANK", "TITLE")); this.Save.Text = this.GetText("COMMON", "SAVE"); this.Cancel.Text = this.GetText("COMMON", "CANCEL"); this.BindData(); if (this.Request.QueryString.GetFirstOrDefault("r") != null) { using ( DataTable dt = LegacyDb.rank_list( this.PageContext.PageBoardID, this.Request.QueryString.GetFirstOrDefault("r"))) { DataRow row = dt.Rows[0]; var flags = new RankFlags(row["Flags"]); this.Name.Text = (string)row["Name"]; this.IsStart.Checked = flags.IsStart; this.IsLadder.Checked = flags.IsLadder; this.MinPosts.Text = row["MinPosts"].ToString(); this.PMLimit.Text = row["PMLimit"].ToString(); this.Style.Text = row["Style"].ToString(); this.RankPriority.Text = row["SortOrder"].ToString(); this.UsrAlbums.Text = row["UsrAlbums"].ToString(); this.UsrAlbumImages.Text = row["UsrAlbumImages"].ToString(); this.UsrSigChars.Text = row["UsrSigChars"].ToString(); this.UsrSigBBCodes.Text = row["UsrSigBBCodes"].ToString(); this.UsrSigHTMLTags.Text = row["UsrSigHTMLTags"].ToString(); this.Description.Text = row["Description"].ToString(); ListItem item = this.RankImage.Items.FindByText(row["RankImage"].ToString()); if (item != null) { item.Selected = true; this.Preview.Src = "{0}{1}/{2}".FormatWith( YafForumInfo.ForumClientFileRoot, YafBoardFolders.Current.Ranks, row["RankImage"]); } else { this.Preview.Src = YafForumInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry } } } else { this.Preview.Src = YafForumInfo.GetURLToContent("images/spacer.gif"); // use spacer.gif for Description Entry } } this.RankImage.Attributes["onchange"] = "getElementById('{2}_ctl01_Preview').src='{0}{1}/' + this.value".FormatWith( YafForumInfo.ForumClientFileRoot, YafBoardFolders.Current.Ranks, this.Parent.ID); }
/// <summary> /// Saves or adds a New Rank /// </summary> /// <param name="repository"> /// The repository. /// </param> /// <param name="rankId"> /// The rank Id. /// </param> /// <param name="boardId"> /// The board Id. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="flags"> /// The flags. /// </param> /// <param name="minPosts"> /// The min posts. /// </param> /// <param name="messagesLimit"> /// The private message limit. /// </param> /// <param name="style"> /// The style. /// </param> /// <param name="sortOrder"> /// The sort order. /// </param> /// <param name="description"> /// The description. /// </param> /// <param name="signatureChars"> /// Defines number of allowed characters in user signature. /// </param> /// <param name="signatureBBCodes"> /// Defines comma separated BBCodes allowed for a rank, i.e in a user signature /// </param> /// <param name="signatureHTMLTags"> /// Defines comma separated tags allowed for a rank, i.e in a user signature /// </param> /// <param name="userAlbums"> /// Defines allowed number of albums. /// </param> /// <param name="userAlbumImages"> /// Defines number of images allowed for an album. /// </param> public static void Save( this IRepository <Rank> repository, [CanBeNull] int?rankId, [NotNull] int boardId, [NotNull] string name, [NotNull] RankFlags flags, [CanBeNull] int?minPosts, [NotNull] int messagesLimit, [CanBeNull] string style, [NotNull] short sortOrder, [CanBeNull] string description, [CanBeNull] int signatureChars, [CanBeNull] string signatureBBCodes, [CanBeNull] string signatureHTMLTags, [NotNull] int userAlbums, [NotNull] int userAlbumImages) { CodeContracts.VerifyNotNull(repository); if (!flags.IsLadder) { minPosts = null; } if (flags.IsLadder && !minPosts.HasValue) { minPosts = 0; } if (rankId.HasValue) { repository.UpdateOnly( () => new Rank { Name = name, Flags = flags.BitValue, MinPosts = minPosts, PMLimit = messagesLimit, Style = style, SortOrder = sortOrder, Description = description, UsrSigChars = signatureChars, UsrSigBBCodes = signatureBBCodes, UsrSigHTMLTags = signatureHTMLTags, UsrAlbums = userAlbums, UsrAlbumImages = userAlbumImages }, g => g.ID == rankId.Value); repository.FireUpdated(rankId); } else { rankId = repository.Insert( new Rank { Name = name, BoardID = boardId, Flags = flags.BitValue, MinPosts = minPosts, PMLimit = messagesLimit, Style = style, SortOrder = sortOrder, Description = description, UsrSigChars = signatureChars, UsrSigBBCodes = signatureBBCodes, UsrSigHTMLTags = signatureHTMLTags, UsrAlbums = userAlbums, UsrAlbumImages = userAlbumImages }); repository.FireNew(rankId); } if (style.IsSet()) { BoardContext.Current.Get <IRaiseEvent>().Raise(new UpdateUserStylesEvent(boardId)); } }
public RankDefinition(TextDefinition name, int rank, RankFlags flags) { m_Name = name; m_Rank = rank; m_Flags = flags; }
public bool GetFlag(RankFlags flag) { return ((m_Flags & flag) != 0); }
public RankDefinition(TextDefinition name, int rank, RankFlags flags) { Name = name; Rank = rank; Flags = flags; }
public bool GetFlag(RankFlags flag) => (Flags & flag) != 0;