/// <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) { this.WasMentioned.Text = this.GetText("WAS_MENTIONED"); this.ReceivedThanks.Text = this.GetText("RECEIVED_THANKS"); this.WasQuoted.Text = this.GetText("WAS_QUOTED"); if (this.IsPostBack) { return; } this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); var previousPageSize = this.Get <ISession>().UserActivityPageSize; if (previousPageSize.HasValue) { // look for value previously selected var sinceItem = this.PageSize.Items.FindByValue(previousPageSize.Value.ToString()); // and select it if found if (sinceItem != null) { this.PageSize.SelectedIndex = this.PageSize.Items.IndexOf(sinceItem); } } this.BindData(); }
/// <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) { // do it only once, not on post-backs if (this.IsPostBack) { return; } this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); var ci = this.Get <ILocalization>().Culture; if (this.PageContext.BoardSettings.UseFarsiCalender && ci.IsFarsiCulture()) { this.SinceDate.Text = PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d"); this.ToDate.Text = PersianDateConverter.ToPersianDate(PersianDate.Now).ToString("d"); } else { this.SinceDate.Text = DateTime.UtcNow.AddDays(-this.PageContext.BoardSettings.EventLogMaxDays).ToString("yyyy-MM-dd"); this.SinceDate.TextMode = TextBoxMode.Date; this.ToDate.Text = DateTime.UtcNow.Date.ToString("yyyy-MM-dd"); this.ToDate.TextMode = TextBoxMode.Date; } // bind data to controls this.BindData(); }
/// <summary> /// The page_ load. /// </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.PageContext.ForumModeratorAccess) { BuildLink.AccessDenied(); } if (!this.PageContext.IsForumModerator || !this.PageContext.IsAdmin) { this.ModerateUsersHolder.Visible = false; } if (!this.IsPostBack) { var showMoved = this.Get <BoardSettings>().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.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); this.BindData(); }
/// <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) { this.CreatedTopic.Text = this.GetText("CREATED_TOPIC"); this.CreatedReply.Text = this.GetText("CREATED_REPLY"); this.GivenThanks.Text = this.GetText("GIVEN_THANKS"); if (this.IsPostBack) { return; } this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); var previousPageSize = this.Get <ISession>().UserActivityPageSize; if (previousPageSize.HasValue) { // look for value previously selected var sinceItem = this.PageSize.Items.FindByValue(previousPageSize.Value.ToString()); // and select it if found if (sinceItem != null) { this.PageSize.SelectedIndex = this.PageSize.Items.IndexOf(sinceItem); } } this.BindData(); }
/// <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) { // do it only once, not on post-backs if (this.IsPostBack) { return; } this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); var ci = this.Get <ILocalization>().Culture; if (this.PageContext.BoardSettings.UseFarsiCalender && ci.IsFarsiCulture()) { this.SinceDate.Text = PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d"); this.ToDate.Text = PersianDateConverter.ToPersianDate(PersianDate.Now).ToString("d"); } else { this.SinceDate.Text = DateTime.UtcNow.AddDays(-this.PageContext.BoardSettings.EventLogMaxDays).ToString( ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture); this.ToDate.Text = DateTime.UtcNow.Date.ToString( ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture); } this.ToDate.ToolTip = this.SinceDate.ToolTip = this.GetText("COMMON", "CAL_JQ_TT"); // bind data to controls this.BindData(); }
/// <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.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); this.PageSizeUnverified.DataSource = StaticDataHelper.PageEntries(); this.PageSizeUnverified.DataTextField = "Name"; this.PageSizeUnverified.DataValueField = "Value"; this.PageSizeUnverified.DataBind(); this.BoardStatsSelect.Visible = this.PageContext.User.UserFlags.IsHostAdmin; // bind data this.BindBoardsList(); this.BindData(); this.ShowUpgradeMessage(); }
/// <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(object sender, EventArgs e) { this.UserSearchName.Focus(); if (this.IsPostBack) { return; } this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); this.ViewState["SortNameField"] = 1; this.ViewState["SortRankNameField"] = 0; this.ViewState["SortJoinedField"] = 0; this.ViewState["SortNumPostsField"] = 0; this.ViewState["SortLastVisitField"] = 0; this.PageLinks.AddRoot().AddLink(this.GetText("TITLE")); this.NumPostDDL.Items.Add(new ListItem(this.GetText("MEMBERS", "NUMPOSTSEQUAL"), "1")); this.NumPostDDL.Items.Add(new ListItem(this.GetText("MEMBERS", "NUMPOSTSLESSOREQUAL"), "2")); this.NumPostDDL.Items.Add(new ListItem(this.GetText("MEMBERS", "NUMPOSTSMOREOREQUAL"), "3")); this.NumPostDDL.DataBind(); // get list of user ranks for filtering var ranks = this.GetRepository <Rank>().GetByBoardId().OrderBy(r => r.SortOrder).ToList(); ranks.Insert(0, new Rank { Name = this.GetText("ALL"), ID = 0 }); ranks.RemoveAll(r => r.Name == "Guest"); this.Ranks.DataSource = ranks; this.Ranks.DataTextField = "Name"; this.Ranks.DataValueField = "ID"; this.Ranks.DataBind(); // get list of user ranks for filtering var groups = this.GetRepository <Group>().GetByBoardId().OrderBy(r => r.SortOrder).ToList(); groups.Insert(0, new Group { Name = this.GetText("ALL"), ID = 0 }); groups.RemoveAll(r => r.Name == "Guests"); this.Group.DataSource = groups; this.Group.DataTextField = "Name"; this.Group.DataValueField = "ID"; this.Group.DataBind(); this.BindData(); }
/// <summary> /// Handles the Click event of the Search 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 Search_Click(object sender, EventArgs e) { this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); this.BindData(); }
/// <summary> /// The page_ load. /// </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; } if (Config.IsAnyPortal) { this.ImportUsers.Visible = false; this.SyncUsers.Visible = false; } // initialize since filter items this.InitSinceDropdown(); // set since filter to last item "All time" this.Since.SelectedIndex = this.Since.Items.Count - 1; // get list of user groups for filtering var groups = this.GetRepository <Group>().List(boardId: this.PageContext.PageBoardID); groups.Insert(0, new Group { Name = this.GetText("FILTER_NO"), ID = 0 }); this.group.DataTextField = "Name"; this.group.DataValueField = "ID"; this.group.DataSource = groups; this.group.DataBind(); // get list of user ranks for filtering var ranks = this.GetRepository <Rank>().GetByBoardId().OrderBy(r => r.SortOrder).ToList(); // add empty for for no filtering ranks.Insert(0, new Rank { Name = this.GetText("FILTER_NO"), ID = 0 }); this.rank.DataSource = ranks; this.rank.DataTextField = "Name"; this.rank.DataValueField = "ID"; this.rank.DataBind(); this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); this.PagerTop.PageSize = this.PageSize.SelectedValue.ToType <int>(); // Hide "New User" & Sync Button on DotNetNuke this.ImportAndSyncHolder.Visible = !Config.IsDotNetNuke; this.BindData(); }
/// <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; } this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); this.BindData(); }
/// <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) { // do it only once, not on post-backs if (this.IsPostBack) { return; } this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); // bind data to controls this.BindData(); }
/// <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.PageSizeTopics.DataSource = StaticDataHelper.PageEntries(); this.PageSizeTopics.DataTextField = "Name"; this.PageSizeTopics.DataValueField = "Value"; this.PageSizeTopics.DataBind(); this.PageSizeForums.DataSource = StaticDataHelper.PageEntries(); this.PageSizeForums.DataTextField = "Name"; this.PageSizeForums.DataValueField = "Value"; this.PageSizeForums.DataBind(); this.BindData(); this.DailyDigestRow.Visible = this.PageContext.BoardSettings.AllowDigestEmail; this.PMNotificationRow.Visible = this.PageContext.BoardSettings.AllowPMEmailNotification; var items = EnumHelper.EnumToDictionary <UserNotificationSetting>(); if (!this.PageContext.BoardSettings.AllowNotificationAllPostsAllTopics) { // remove it... items.Remove(UserNotificationSetting.AllTopics.ToInt()); } this.rblNotificationType.Items.AddRange( items.Select(x => new ListItem(this.GetText(x.Value), x.Key.ToString())).ToArray()); var setting = this.rblNotificationType.Items.FindByValue( this.PageContext.User.NotificationSetting.ToInt().ToString()) ?? this.rblNotificationType.Items.FindByValue(0.ToString()); if (setting != null) { setting.Selected = true; } // update the ui... this.UpdateSubscribeUi(this.PageContext.User.NotificationSetting); }
/// <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.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); try { this.PageSize.SelectedValue = this.PageBoardContext.PageUser.PageSize.ToString(); } catch (Exception) { this.PageSize.SelectedValue = "5"; } this.BindData(); }
/// <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) { this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); this.InitSinceDropdown(); int?previousSince = null; this.FilterHolder.Visible = true; switch (this.CurrentMode) { case TopicListMode.User: previousSince = this.Get <ISession>().UserTopicSince; this.Since.Items.Add(new ListItem(this.GetText("show_all"), "9999")); this.Since.SelectedIndex = this.Since.Items.Count - 1; break; case TopicListMode.Unread: previousSince = this.Get <ISession>().UnreadTopicSince; this.Since.Items.Clear(); this.Since.Items.Add(new ListItem(this.GetText("SHOW_UNREAD_ONLY"), "0")); this.Since.SelectedIndex = 0; this.FilterHolder.Visible = false; break; case TopicListMode.Active: previousSince = this.Get <ISession>().ActiveTopicSince; this.Since.SelectedIndex = 0; break; case TopicListMode.Unanswered: previousSince = this.Get <ISession>().UnansweredTopicSince; this.Since.Items.Add(new ListItem(this.GetText("show_all"), "9999")); this.Since.SelectedIndex = 2; break; case TopicListMode.Favorite: previousSince = this.Get <ISession>().FavoriteTopicSince; this.Since.Items.Add(new ListItem(this.GetText("show_all"), "9999")); this.Since.SelectedIndex = this.Since.Items.Count - 1; break; } // has user selected any "since" value before we can remember now? if (previousSince.HasValue) { // look for value previously selected var sinceItem = this.Since.Items.FindByValue(previousSince.Value.ToString()); // and select it if found if (sinceItem != null) { this.Since.SelectedIndex = this.Since.Items.IndexOf(sinceItem); } } } if (this.AutoDataBind) { this.BindData(); } }
/// <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) { // do it only once, not on post-backs if (this.IsPostBack) { return; } this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); var allItem = new ListItem(this.GetText("ALL"), "-1"); allItem.Attributes.Add( "data-content", $"<span class=\"select2-image-select-icon\"><i class=\"fas fa-filter fa-fw text-secondary\"></i> {this.GetText("ALL")}</span>"); this.Types.Items.Add(allItem); EnumExtensions.GetAllItems <EventLogTypes>().ForEach( type => { var icon = type switch { EventLogTypes.Error => "radiation", EventLogTypes.Warning => "exclamation-triangle", EventLogTypes.Information => "exclamation", EventLogTypes.Debug => "exclamation-triangle", EventLogTypes.Trace => "exclamation-triangle", EventLogTypes.SqlError => "exclamation-triangle", EventLogTypes.UserSuspended => "user-clock", EventLogTypes.UserUnsuspended => "user-check", EventLogTypes.LoginFailure => "user-injured", EventLogTypes.UserDeleted => "user-alt-slash", EventLogTypes.IpBanSet => "hand-paper", EventLogTypes.IpBanLifted => "slash", EventLogTypes.IpBanDetected => "hand-paper", EventLogTypes.SpamBotReported => "user-ninja", EventLogTypes.SpamBotDetected => "user-lock", EventLogTypes.SpamMessageReported => "flag", EventLogTypes.SpamMessageDetected => "shield-alt", _ => "exclamation-circle" }; var item = new ListItem { Value = type.ToInt().ToString(), Text = type.ToString() }; item.Attributes.Add( "data-content", $"<span class=\"select2-image-select-icon\"><i class=\"fas fa-{icon} fa-fw text-secondary\"></i> {type}</span>"); this.Types.Items.Add(item); }); var ci = this.Get <ILocalization>().Culture; if (this.PageContext.BoardSettings.UseFarsiCalender && ci.IsFarsiCulture()) { this.SinceDate.Text = PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d"); this.ToDate.Text = PersianDateConverter.ToPersianDate(PersianDate.Now).ToString("d"); } else { this.SinceDate.Text = DateTime.UtcNow.AddDays(-this.PageContext.BoardSettings.EventLogMaxDays).ToString( ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture); this.ToDate.Text = DateTime.UtcNow.Date.ToString( ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture); } this.ToDate.ToolTip = this.SinceDate.ToolTip = this.GetText("COMMON", "CAL_JQ_TT"); // bind data to controls this.BindData(); }
/// <summary> /// The bind data. /// </summary> private void BindData() { this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); var ds = this.Get <DataBroker>().BoardLayout( this.PageContext.PageBoardID, this.PageContext.PageUserID, this.PageContext.PageCategoryID, this.PageContext.PageForumID); if (ds.Tables["Forum"].HasRows()) { this.ForumList.DataSource = ds.Tables["Forum"].Rows; this.SubForums.Visible = true; } var baseSize = this.PageSize.SelectedValue.ToType <int>(); this.Pager.PageSize = baseSize; int?userId = this.PageContext.PageUserID; var dt = this.GetRepository <Topic>().AnnouncementsAsDataTable( this.PageContext.PageForumID, userId, null, System.DateTime.UtcNow, 0, 10, this.Get <BoardSettings>().UseStyledNicks, true, this.Get <BoardSettings>().UseReadTrackingByDatabase); if (dt != null) { dt = this.StyleTransformDataTable(dt); } this.Announcements.DataSource = dt; var pagerCurrentPageIndex = this.Pager.CurrentPageIndex; DataTable topicList; if (this.showTopicListSelected == 0) { topicList = this.GetRepository <Topic>().ListAsDataTable( this.PageContext.PageForumID, userId, DateTimeHelper.SqlDbMinTime(), System.DateTime.UtcNow, pagerCurrentPageIndex, baseSize, this.Get <BoardSettings>().UseStyledNicks, true, this.Get <BoardSettings>().UseReadTrackingByDatabase); if (topicList != null) { topicList = this.StyleTransformDataTable(topicList); } } else { int[] days = { 1, 2, 7, 14, 31, 2 * 31, 6 * 31, 356 }; var date = System.DateTime.UtcNow.AddDays(-days[this.showTopicListSelected]); topicList = this.GetRepository <Topic>().ListAsDataTable( this.PageContext.PageForumID, userId, date, System.DateTime.UtcNow, pagerCurrentPageIndex, baseSize, this.Get <BoardSettings>().UseStyledNicks, true, this.Get <BoardSettings>().UseReadTrackingByDatabase); if (topicList != null) { topicList = this.StyleTransformDataTable(topicList); } } this.TopicList.DataSource = topicList; this.DataBind(); // setup the show topic list selection after data binding this.ShowList.SelectedIndex = this.showTopicListSelected; this.Get <ISession>().ShowList = this.showTopicListSelected; if (topicList != null && topicList.HasRows()) { this.Pager.Count = topicList.AsEnumerable().First().Field <int>("TotalRows"); } if (this.Announcements.Items.Count == 0 && this.TopicList.Items.Count == 0) { this.NoPostsPlaceHolder.Visible = true; } else { this.NoPostsPlaceHolder.Visible = false; } }
/// <summary> /// The bind data. /// </summary> private void BindData() { this.PageSize.DataSource = StaticDataHelper.PageEntries(); this.PageSize.DataTextField = "Name"; this.PageSize.DataValueField = "Value"; this.PageSize.DataBind(); var forums = this.Get <DataBroker>().BoardLayout( this.PageContext.PageBoardID, this.PageContext.PageUserID, this.PageContext.PageCategoryID, this.PageContext.PageForumID); // Render Sub forum(s) if (forums.Item2.Any()) { this.ForumList.DataSource = forums; this.SubForums.Visible = true; } var baseSize = this.PageSize.SelectedValue.ToType <int>(); this.Pager.PageSize = baseSize; var list = this.GetRepository <Topic>().ListAnnouncementsPaged( this.PageContext.PageForumID, this.PageContext.PageUserID, DateTime.UtcNow, 0, 10, true, this.PageContext.BoardSettings.UseReadTrackingByDatabase); this.Announcements.DataSource = list; var pagerCurrentPageIndex = this.Pager.CurrentPageIndex; int[] days = { 1, 2, 7, 14, 31, 2 * 31, 6 * 31, 356 }; var topicList = this.GetRepository <Topic>().ListPaged( this.PageContext.PageForumID, this.PageContext.PageUserID, this.showTopicListSelected == 0 ? DateTimeHelper.SqlDbMinTime() : DateTime.UtcNow.AddDays(-days[this.showTopicListSelected]), DateTime.UtcNow, pagerCurrentPageIndex, baseSize, true, this.PageContext.BoardSettings.UseReadTrackingByDatabase); this.TopicList.DataSource = topicList; this.DataBind(); // setup the show topic list selection after data binding this.ShowList.SelectedIndex = this.showTopicListSelected; this.Get <ISession>().ShowList = this.showTopicListSelected; if (topicList != null && topicList.Any()) { this.Pager.Count = topicList.FirstOrDefault().TotalRows; } if (this.Announcements.Items.Count == 0 && this.TopicList.Items.Count == 0) { this.NoPostsPlaceHolder.Visible = true; } else { this.NoPostsPlaceHolder.Visible = false; } }