/// <summary> /// The render. /// </summary> /// <param name="writer"> /// The writer. /// </param> protected override void Render([NotNull] HtmlTextWriter writer) { var forumJump = this.Get <IDataCache>().GetOrSet( Constants.Cache.ForumJump.FormatWith( this.PageContext.User != null ? this.PageContext.PageUserID.ToString() : "Guest"), () => LegacyDb.forum_listall_sorted(this.PageContext.PageBoardID, this.PageContext.PageUserID), TimeSpan.FromMinutes(5)); writer.WriteLine( @"<select name=""{0}"" onchange=""{1}"" id=""{2}"" class=""custom-select"">".FormatWith( this.UniqueID, this.Page.ClientScript.GetPostBackClientHyperlink(this, this.ID), this.ClientID)); writer.WriteLine(@"<option value=""0"">{0}</option>", this.Get <YafBoardSettings>().Name); var forumId = this.PageContext.PageForumID; if (forumId <= 0) { writer.WriteLine("<option/>"); } foreach (DataRow row in forumJump.Rows) { writer.WriteLine( @"<option {2}value=""{0}""> {1}</option>".FormatWith( row["ForumID"], this.HtmlEncode(row["Title"]), Convert.ToString(row["ForumID"]) == forumId.ToString() ? @"selected=""selected"" " : string.Empty)); } writer.WriteLine("</select>"); }
/// <summary> /// The bind data. /// </summary> private void BindData() { this.NntpServerID.DataSource = LegacyDb.nntpserver_list(this.PageContext.PageBoardID, null); this.NntpServerID.DataValueField = "NntpServerID"; this.NntpServerID.DataTextField = "Name"; this.ForumID.DataSource = LegacyDb.forum_listall_sorted( this.PageContext.PageBoardID, this.PageContext.PageUserID); this.ForumID.DataValueField = "ForumID"; this.ForumID.DataTextField = "Title"; 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.Request.QueryString.GetFirstOrDefault("t") == null || !this.PageContext.ForumModeratorAccess) { YafBuildLink.AccessDenied(); } if (this.IsPostBack) { return; } if (this.PageContext.Settings.LockedForum == 0) { this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); } this.PageLinks.AddForum(this.PageContext.PageForumID); this.PageLinks.AddLink( this.PageContext.PageTopicName, YafBuildLink.GetLink(ForumPages.posts, "t={0}", this.PageContext.PageTopicID)); this.Move.Text = this.GetText("MOVE"); this.Move.ToolTip = "{0}: {1}".FormatWith(this.GetText("MOVE"), this.PageContext.PageTopicName); var showMoved = this.Get <YafBoardSettings>().ShowMoved; // Ederon : 7/14/2007 - by default, leave pointer is set on value defined on host level this.LeavePointer.Checked = showMoved; this.trLeaveLink.Visible = showMoved; this.trLeaveLinkDays.Visible = showMoved; if (showMoved) { this.LinkDays.Text = "1"; } this.ForumList.DataSource = LegacyDb.forum_listall_sorted( this.PageContext.PageBoardID, this.PageContext.PageUserID); this.DataBind(); var pageItem = this.ForumList.Items.FindByValue(this.PageContext.PageForumID.ToString()); if (pageItem != null) { pageItem.Selected = true; } }
/// <summary> /// Binds the data. /// </summary> /// <param name="forumId">The forum identifier.</param> public void BindData(int?forumId) { this.NntpServerID.DataSource = LegacyDb.nntpserver_list(this.PageContext.PageBoardID, null); this.NntpServerID.DataValueField = "NntpServerID"; this.NntpServerID.DataTextField = "Name"; this.NntpServerID.DataBind(); this.ForumID.DataSource = LegacyDb.forum_listall_sorted( this.PageContext.PageBoardID, this.PageContext.PageUserID); this.ForumID.DataValueField = "ForumID"; this.ForumID.DataTextField = "Title"; this.ForumID.DataBind(); this.ForumId = forumId; this.Title.LocalizedPage = "ADMIN_EDITNNTPSERVER"; this.Save.TextLocalizedPage = "ADMIN_NNTPFORUMS"; if (this.ForumId.HasValue) { // Edit var forum = this.GetRepository <NntpForum>().GetById(this.ForumId.Value); if (forum != null) { this.NntpServerID.Items.FindByValue(forum.NntpServerID.ToString()).Selected = true; this.GroupName.Text = forum.GroupName; this.ForumID.Items.FindByValue(forum.ForumID.ToString()).Selected = true; this.Active.Checked = forum.Active; this.DateCutOff.Text = forum.DateCutOff.ToString(); } this.Title.LocalizedTag = "TITLE_EDIT"; this.Save.TextLocalizedTag = "SAVE"; } else { // Add this.GroupName.Text = string.Empty; this.Active.Checked = false; this.DateCutOff.Text = string.Empty; this.Title.LocalizedTag = "TITLE"; this.Save.TextLocalizedTag = "NEW_FORUM"; } }
/// <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.Request.QueryString.GetFirstOrDefault("m") == null || !this.PageContext.ForumModeratorAccess) { YafBuildLink.AccessDenied(); } if (this.IsPostBack) { return; } this.PageLinks.AddRoot(); this.PageLinks.AddLink( this.PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", this.PageContext.PageCategoryID)); this.PageLinks.AddForum(this.PageContext.PageForumID); this.PageLinks.AddLink( this.PageContext.PageTopicName, YafBuildLink.GetLink(ForumPages.posts, "t={0}", this.PageContext.PageTopicID)); this.PageLinks.AddLink(this.GetText("MOVE_MESSAGE")); this.Move.Text = this.GetText("MOVE_MESSAGE"); this.Move.ToolTip = this.GetText("MOVE_TITLE"); this.CreateAndMove.Text = this.GetText("CREATE_TOPIC"); this.CreateAndMove.ToolTip = this.GetText("SPLIT_TITLE"); this.ForumList.DataSource = LegacyDb.forum_listall_sorted( this.PageContext.PageBoardID, this.PageContext.PageUserID); this.ForumList.DataTextField = "Title"; this.ForumList.DataValueField = "ForumID"; this.DataBind(); this.ForumList.Items.FindByValue(this.PageContext.PageForumID.ToString()).Selected = true; this.ForumList_SelectedIndexChanged(this.ForumList, e); }
/// <summary> /// Binds the data /// </summary> protected void BindData() { this.PagerTop.PageSize = this.Get <YafBoardSettings>().TopicsPerPage; var baseSize = this.Get <YafBoardSettings>().TopicsPerPage; var currentPageIndex = this.PagerTop.CurrentPageIndex; var topicList = LegacyDb.topic_list( this.PageContext.PageForumID, null, DateTimeHelper.SqlDbMinTime(), DateTime.UtcNow, currentPageIndex, baseSize, false, true, false); this.topiclist.DataSource = topicList; this.UserList.DataSource = LegacyDb.userforum_list(null, this.PageContext.PageForumID); if (topicList != null && topicList.HasRows()) { this.PagerTop.Count = topicList.AsEnumerable().First().Field <int>("TotalRows"); } this.ForumList.DataSource = LegacyDb.forum_listall_sorted( this.PageContext.PageBoardID, this.PageContext.PageUserID); this.DataBind(); var pageItem = this.ForumList.Items.FindByValue(this.PageContext.PageForumID.ToString()); if (pageItem != null) { pageItem.Selected = true; } }
/// <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="System.EventArgs"/> instance containing the event data. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } this.PageLinks.AddRoot(); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); this.btnSearch.Text = "{0}".FormatWith(this.GetText("btnsearch")); if (this.Get <IPermissions>().Check(this.PageContext.BoardSettings.ExternalSearchPermissions)) { // vzrus: If an exteranl search only - it should be disabled. YAF doesn't have a forum id as a token in post links. if (!this.Get <IPermissions>().Check(this.PageContext.BoardSettings.SearchPermissions)) { this.listForum.Enabled = false; } if (this.PageContext.BoardSettings.SearchEngine1.IsSet() && this.PageContext.BoardSettings.SearchEngine1Parameters.IsSet()) { this.btnSearchExt1.Visible = true; this.btnSearchExt1.Text = this.btnSearchExt1.ToolTip = this.GetText("btnsearch_external") .FormatWith(this.PageContext.BoardSettings.SearchEngine1Parameters.Split('^')[0]); } if (this.PageContext.BoardSettings.SearchEngine2.IsSet() && this.PageContext.BoardSettings.SearchEngine2Parameters.IsSet()) { this.btnSearchExt2.Visible = true; this.btnSearchExt2.Text = this.btnSearchExt2.ToolTip = this.GetText("btnsearch_external") .FormatWith(this.PageContext.BoardSettings.SearchEngine2Parameters.Split('^')[0]); } } if (this.Get <IPermissions>().Check(this.PageContext.BoardSettings.SearchPermissions)) { this.btnSearch.Visible = true; } // Load result dropdown this.listResInPage.Items.Add(new ListItem(this.GetText("result5"), "5")); this.listResInPage.Items.Add(new ListItem(this.GetText("result10"), "10")); this.listResInPage.Items.Add(new ListItem(this.GetText("result25"), "25")); this.listResInPage.Items.Add(new ListItem(this.GetText("result50"), "50")); // Load searchwhere dropdown // listSearchWhere.Items.Add( new ListItem( GetText( "posts" ), "0" ) ); // listSearchWhere.Items.Add( new ListItem( GetText( "postedby" ), "1" ) ); // Load listSearchFromWho dropdown this.listSearchFromWho.Items.Add(new ListItem(this.GetText("match_exact"), "2")); this.listSearchFromWho.Items.Add(new ListItem(this.GetText("match_any"), "1")); this.listSearchFromWho.Items.Add(new ListItem(this.GetText("match_all"), "0")); // Load listSearchWhat dropdown this.listSearchWhat.Items.Add(new ListItem(this.GetText("match_exact"), "2")); this.listSearchWhat.Items.Add(new ListItem(this.GetText("match_any"), "1")); this.listSearchWhat.Items.Add(new ListItem(this.GetText("match_all"), "0")); // Load TitleOnly dropdown this.TitleOnly.Items.Add(new ListItem(this.GetText("POST_AND_TITLE"), "0")); this.TitleOnly.Items.Add(new ListItem(this.GetText("TITLE_ONLY"), "1")); this.listSearchFromWho.SelectedIndex = 0; this.listSearchWhat.SelectedIndex = 2; // Load forum's combo // listForum.Items.Add( new ListItem( GetText( "allforums" ), "-1" ) ); // DataTable dt = YAF.Classes.Data.DB.forum_listread( PageContext.PageBoardID, PageContext.PageUserID, null, null, YafContext.Current.BoardSettings.UseStyledNicks ); // int nOldCat = 0; // for ( int i = 0; i < dt.Rows.Count; i++ ) // { // DataRow row = dt.Rows [i]; // if ( ( int ) row ["CategoryID"] != nOldCat ) // { // nOldCat = ( int ) row ["CategoryID"]; // listForum.Items.Add( new ListItem( ( string ) row ["Category"], "-1" ) ); // } // listForum.Items.Add( new ListItem( " - " + ( string ) row ["Forum"], row ["ForumID"].ToString() ) ); // } this.LoadingModal.Title = this.GetText("LOADING"); this.LoadingModal.MessageText = this.GetText("LOADING_SEARCH"); this.LoadingModal.Icon = YafForumInfo.GetURLToContent("images/loader.gif"); this.txtSearchStringWhat.Focus(); this.Page.Form.DefaultButton = this.btnSearch.UniqueID; this.listForum.DataSource = LegacyDb.forum_listall_sorted( this.PageContext.PageBoardID, this.PageContext.PageUserID); this.listForum.DataValueField = "ForumID"; this.listForum.DataTextField = "Title"; this.listForum.DataBind(); this.listForum.Items.Insert(0, new ListItem(this.GetText("allforums"), "0")); var doSearch = false; var searchString = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("search"); if (searchString.IsSet() && searchString.Length < 50) { this.txtSearchStringWhat.Text = this.Server.UrlDecode(searchString); doSearch = true; } var forumString = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("forum"); if (searchString.IsSet() && this.listForum.Enabled) { try { this.listForum.SelectedValue = this.Server.UrlDecode(forumString); } catch (Exception) { this.listForum.SelectedValue = "0"; } } var postedBy = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("postedby"); if (postedBy.IsSet() && postedBy.Length < 50) { this.txtSearchStringFromWho.Text = this.Server.UrlDecode(postedBy); doSearch = true; } // set the search box size via the max settings in the boardsettings. if (this.PageContext.BoardSettings.SearchStringMaxLength > 0) { this.txtSearchStringWhat.MaxLength = this.PageContext.BoardSettings.SearchStringMaxLength; this.txtSearchStringFromWho.MaxLength = this.PageContext.BoardSettings.SearchStringMaxLength; } if (doSearch) { this.SearchBindData(true); } }
/// <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="System.EventArgs"/> instance containing the event data. /// </param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } var doSearch = false; this.PageLinks.AddRoot(); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); // Load result dropdown this.listResInPage.Items.Add(new ListItem(this.GetText("result5"), "5")); this.listResInPage.Items.Add(new ListItem(this.GetText("result10"), "10")); this.listResInPage.Items.Add(new ListItem(this.GetText("result25"), "25")); this.listResInPage.Items.Add(new ListItem(this.GetText("result50"), "50")); // Load listSearchWhat dropdown this.listSearchWhat.Items.Add(new ListItem(this.GetText("match_exact"), "2")); this.listSearchWhat.Items.Add(new ListItem(this.GetText("match_any"), "1")); this.listSearchWhat.Items.Add(new ListItem(this.GetText("match_all"), "0")); // Load TitleOnly dropdown this.TitleOnly.Items.Add(new ListItem(this.GetText("POST_AND_TITLE"), "0")); this.TitleOnly.Items.Add(new ListItem(this.GetText("TITLE_ONLY"), "1")); this.listSearchWhat.SelectedIndex = 2; // Load forum's combo this.listForum.DataSource = LegacyDb.forum_listall_sorted( this.PageContext.PageBoardID, this.PageContext.PageUserID); this.listForum.DataValueField = "ForumID"; this.listForum.DataTextField = "Title"; this.listForum.DataBind(); this.listForum.Items.Insert(0, new ListItem(this.GetText("allforums"), "0")); // Handle search by url var searchString = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("search"); if (searchString.IsSet() && searchString.Length < 50) { this.searchInput.Text = this.Server.UrlDecode(searchString); doSearch = true; } var forumString = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("forum"); if (searchString.IsSet() && this.listForum.Enabled) { try { this.listForum.SelectedValue = this.Server.UrlDecode(forumString); } catch (Exception) { this.listForum.SelectedValue = "0"; } } var postedBy = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("postedby"); if (postedBy.IsSet() && postedBy.Length < 50) { this.txtSearchStringFromWho.Text = this.Server.UrlDecode(postedBy); doSearch = true; } if (doSearch) { YafContext.Current.PageElements.RegisterJsBlockStartup( "openModalJs", JavaScriptBlocks.DoSearchJs()); } }