private void Page_Load(object sender, System.EventArgs e) { // If the user doesn't have any access rights to management stuff, the user should // be redirected to the default of the global system. if (!SessionAdapter.HasSystemActionRights()) { // doesn't have system rights. redirect. Response.Redirect("../Default.aspx", true); } // Check if the user has the right systemright if (!SessionAdapter.HasSystemActionRight(ActionRights.SystemManagement)) { // no, redirect to admin default page, since the user HAS access to the admin menu. Response.Redirect("Default.aspx", true); } if (!Page.IsPostBack) { // Read all the current existing forums and their section names. ForumsWithSectionNameTypedList forumsWithSectionNames = ForumGuiHelper.GetAllForumsWithSectionNames(); rpForums.DataSource = forumsWithSectionNames; rpForums.DataBind(); } }
public async Task <ActionResult <IEnumerable <ForumsWithSectionNameRow> > > GetForums() { if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement)) { return(RedirectToAction("Index", "Home")); } var forums = await ForumGuiHelper.GetAllForumsWithSectionNamesAsync(); return(Ok(forums)); }
public async Task <ActionResult> AdvancedSearch() { var allAccessibleForumIDs = this.HttpContext.Session.GetForumsWithActionRight(ActionRights.AccessForum).ToHashSet(); var allForumsWithSectionNames = await ForumGuiHelper.GetAllForumsWithSectionNamesAsync(); var viewData = new AdvancedSearchUIData() { NumberOfMessages = await MessageGuiHelper.GetTotalNumberOfMessagesAsync(), AllAccessibleForumsWithSectionName = allForumsWithSectionNames.Where(r => allAccessibleForumIDs.Contains(r.ForumID)).ToList() }; return(View(viewData)); }
/// <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> private void Page_Load(object sender, System.EventArgs e) { // this is necessary so the 'clever' IE will also understand what to do: the enter key will then submit the form. this.ClientScript.RegisterHiddenField("__EVENTTARGET", "btnSearch"); if (!Page.IsPostBack) { // clear tmp results in session SessionAdapter.AddSearchTermsAndResults(string.Empty, null); // Read all the current existing forums and their section names. ForumsWithSectionNameTypedList forumsWithSectionName = ForumGuiHelper.GetAllForumsWithSectionNames(); // Get a list of Forum IDs to which the user has access right. List <int> accessableForums = SessionAdapter.GetForumsWithActionRight(ActionRights.AccessForum); foreach (ForumsWithSectionNameRow currentRow in forumsWithSectionName) { // filter out forums the user doesn't have access rights for. if (accessableForums.Contains(currentRow.ForumID)) { // forum is accessable to the user ListItem newItem = new ListItem(String.Format("{0} - {1}", currentRow.SectionName, currentRow.ForumName), currentRow.ForumID.ToString()); newItem.Selected = true; lbxForums.Items.Add(newItem); } } // make listbox as high as # of forums, with a maximum of 15 and a minimum of 8 if (lbxForums.Items.Count <= 15) { if (lbxForums.Items.Count > 8) { lbxForums.Rows = lbxForums.Items.Count; } else { lbxForums.Rows = 8; } } else { lbxForums.Rows = 15; } lblNumberOfPosts.Text = MessageGuiHelper.GetTotalNumberOfMessages().ToString(); } }
/// <summary> /// Fills in the forum list based on the selected Section in cbxSections /// </summary> private void FillForumList() { // clear list first cbxForums.Items.Clear(); int currentSectionID = Convert.ToInt32(cbxSections.SelectedItem.Value); ForumCollection forums = ForumGuiHelper.GetAllForumsInSection(currentSectionID); cbxForums.DataSource = forums; cbxForums.DataTextField = "ForumName"; cbxForums.DataValueField = "ForumID"; cbxForums.DataBind(); cbxForums.Items[0].Selected = true; _forumID = Convert.ToInt32(cbxForums.SelectedItem.Value); }
private void Page_Load(object sender, System.EventArgs e) { // If the user doesn't have any access rights to management stuff, the user should // be redirected to the default of the global system. if (!SessionAdapter.HasSystemActionRights()) { // doesn't have system rights. redirect. Response.Redirect("../Default.aspx", true); } // Check if the user has the right systemright if (!SessionAdapter.HasSystemActionRight(ActionRights.SystemManagement)) { // no, redirect to admin default page, since the user HAS access to the admin menu. Response.Redirect("Default.aspx", true); } _sectionID = HnDGeneralUtils.TryConvertToInt(Request.QueryString["SectionID"]); if (!Page.IsPostBack) { // Get the section directly from the DB, instead from the in-memory cache SectionEntity section = SectionGuiHelper.GetSection(_sectionID); // Show results in the labels if (section != null) { // Section found // Get the forums in the section ForumCollection forums = ForumGuiHelper.GetAllForumsInSection(_sectionID); if (forums.Count > 0) { // section has forums. User is not able to delete the section. Show error message plus // disable delete button lblRuleError.Visible = true; btnDelete.Disabled = true; } lblSectionName.Text = section.SectionName; lblSectionDescription.Text = section.SectionDescription; } else { // the section doesn't exist anymore Response.Redirect("ModifyDeleteSection.aspx", true); } } }
private void Page_Load(object sender, System.EventArgs e) { // If the user doesn't have any access rights to management stuff, the user should // be redirected to the default of the global system. if (!SessionAdapter.HasSystemActionRights()) { // doesn't have system rights. redirect. Response.Redirect("../Default.aspx", true); } // Check if the user has the right systemright; if (!SessionAdapter.HasSystemActionRight(ActionRights.SystemManagement)) { // no, redirect to admin default page, since the user HAS access to the admin menu. Response.Redirect("Default.aspx", true); } _forumID = HnDGeneralUtils.TryConvertToInt(Request.QueryString["ForumID"]); if (!Page.IsPostBack) { // Get the forum try { ForumEntity forum = ForumGuiHelper.GetForum(_forumID); // Show results in the labels if (forum != null) { // the forum exists lblForumName.Text = forum.ForumName; lblForumDescription.Text = forum.ForumDescription; } else { // the forum doesn't exist anymore Response.Redirect("ModifyDeleteForum.aspx", true); } } catch (Exception ex) { // Bubble throw ex; } } }
/// <summary> /// Gets the forum entity with the passed in forumid from the cache. If it's not there, it will be loaded from the db and stored in the cache. /// </summary> /// <param name="forumID">The forum ID.</param> /// <returns>ForumEntity instance of the forum with id forumID</returns> /// <remarks>If forumID isn't found, null is returned. ForumEntity instances are cached indefinitely, until the forum is changed or when a message /// is added to a thread in the forum. The forum entities are cached per entity to make the per-entity requests for a forum faster. Bulk fetches /// for forum data isn't using this cache, it's fetching the data directly from the DB. This is ok, forumentity data isn't very volatile</remarks> public static ForumEntity GetForum(int forumID) { Cache activeCache = HttpRuntime.Cache; string keyToUse = ProduceCacheKey(CacheKeys.SingleForum, forumID); ForumEntity toReturn = (ForumEntity)activeCache[keyToUse]; if (toReturn == null) { toReturn = ForumGuiHelper.GetForum(forumID); if (toReturn != null) { // found, cache it activeCache.Insert(keyToUse, toReturn); } } return(toReturn); }
/// <summary> /// Gets the forum entity with the passed in forumid from the cache. If it's not there, it will be loaded from the db and stored in the cache. /// </summary> /// <param name="cache">The cache object this methods works on</param> /// <param name="forumId">The forum ID.</param> /// <returns>ForumEntity instance of the forum with id forumID</returns> /// <remarks>If forumID isn't found, null is returned. ForumEntity instances are cached indefinitely, until the forum is changed or when a message /// is added to a thread in the forum. The forum entities are cached per entity to make the per-entity requests for a forum faster. Bulk fetches /// for forum data isn't using this cache, it's fetching the data directly from the DB. This is ok, forumentity data isn't very volatile</remarks> public static async Task <ForumEntity> GetForumAsync(this IMemoryCache cache, int forumId) { var keyToUse = ProduceCacheKey(CacheKeys.SingleForum, forumId); var toReturn = cache.Get <ForumEntity>(keyToUse); if (toReturn == null) { toReturn = await ForumGuiHelper.GetForumAsync(forumId); if (toReturn != null) { // found, cache it cache.Set(keyToUse, toReturn); } } return(toReturn); }
public async Task <ActionResult> Index(int forumId = 0, int pageNo = 1) { // do forum security checks on authorized user. bool userHasAccess = this.HttpContext.Session.CanPerformForumActionRight(forumId, ActionRights.AccessForum); if (!userHasAccess) { // doesn't have access to this forum. redirect return(RedirectToAction("Index", "Home")); } var forum = await _cache.GetForumAsync(forumId); if (forum == null) { return(RedirectToAction("Index", "Home")); } var pageNoToUse = pageNo > 0 ? pageNo : 1; var systemData = await _cache.GetSystemDataAsync(); var pageSize = systemData.MinNumberOfThreadsToFetch; var threadRows = await ForumGuiHelper.GetAllThreadsInForumAggregatedDataAsync(forumId, pageNoToUse, pageSize, this.HttpContext.Session.CanPerformForumActionRight(forumId, ActionRights.ViewNormalThreadsStartedByOthers), this.HttpContext.Session.GetUserID()); var data = new ForumData { ForumDescription = forum.ForumDescription, ForumID = forumId, ForumName = forum.ForumName, HasRSSFeed = forum.HasRSSFeed, PageNo = pageNoToUse, SectionName = await _cache.GetSectionNameAsync(forum.SectionID), PageSize = pageSize, UserCanCreateThreads = this.HttpContext.Session.CanPerformForumActionRight(forumId, ActionRights.AddNormalThread) || this.HttpContext.Session.CanPerformForumActionRight(forumId, ActionRights.AddStickyThread), UserLastVisitDate = this.HttpContext.Session.GetLastVisitDate(), ThreadRows = threadRows, }; return(View(data)); }
public async Task <ActionResult> ManageRoleRights() { if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SecurityManagement)) { return(RedirectToAction("Index", "Home")); } var allRoles = await SecurityGuiHelper.GetAllRolesAsync(); var roleId = allRoles.FirstOrDefault()?.RoleID ?? 0; var allForumIds = await ForumGuiHelper.GetAllForumIdsAsync(); var forumId = allForumIds.FirstOrDefault(); return(await ManageRightsForForum(new ManageForumRoleRightsData() { RoleID = roleId, ForumID = forumId })); }
public async Task <ActionResult> EditForum(int forumId) { if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement)) { return(RedirectToAction("Index", "Home")); } var toEdit = await ForumGuiHelper.GetForumAsync(forumId); if (toEdit == null) { return(RedirectToAction("Index", "Home")); } var data = new AddEditForumData(toEdit); await ForumAdminController.FillDataSetsInModelObjectAsync(data); return(View("~/Views/Admin/EditForum.cshtml", data)); }
public async Task <ActionResult> Forums(int id = 0) { if (this.HttpContext.Session.IsAnonymousUser()) { return(RedirectToAction("Index", "Home")); } if (!(this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemWideThreadManagement) || this.HttpContext.Session.HasSystemActionRight(ActionRights.SystemManagement))) { return(RedirectToAction("Index", "Home")); } var modelData = new ForumSelectorData { Forums = await ForumGuiHelper.GetAllForumsInSectionAsync(id) }; return(PartialView("ForumSelector", modelData)); }
public async Task <ActionResult> Index(int forumId = 0) { this.Response.ContentType = "text/xml"; var forum = await _cache.GetForumAsync(forumId); if (forum == null) { return(View()); } var data = new RssForumData() { ForumUrl = "https://" + this.Request.Host.Host + ApplicationAdapter.GetVirtualRoot() + @"/Forum/" + forumId, SiteName = ApplicationAdapter.GetSiteName(), ForumName = forum.ForumName, ForumItems = await ForumGuiHelper.GetLastPostedMessagesInForumAsync(10, forumId) }; return(View(data)); }
public async Task <ActionResult> Index() { var accessableForums = this.HttpContext.Session.GetForumsWithActionRight(ActionRights.AccessForum); var forumsWithThreadsFromOthers = this.HttpContext.Session.GetForumsWithActionRight(ActionRights.ViewNormalThreadsStartedByOthers); var allSections = await _cache.GetAllSectionsAsync(); var model = new HomeData(); model.ForumDataPerDisplayedSection = await ForumGuiHelper.GetAllAvailableForumsAggregatedData(allSections, accessableForums, forumsWithThreadsFromOthers, this.HttpContext.Session.GetUserID()); // create a view on the sections to display and filter the view with a filter on sectionid: a sectionid must be part of the list of ids in the hashtable with per sectionid // aggregate forum data. model.SectionsFiltered = new EntityView2 <SectionEntity>(allSections, SectionFields.SectionID.In(model.ForumDataPerDisplayedSection.Keys.ToList())); model.NickName = this.HttpContext.Session.GetUserNickName(); model.UserLastVisitDate = this.HttpContext.Session.IsLastVisitDateValid() ? this.HttpContext.Session.GetLastVisitDate() : (DateTime?)null; model.IsAnonymousUser = this.HttpContext.Session.IsAnonymousUser(); return(View(model)); }
public async Task <ActionResult> ManageRightsForForum(ManageForumRoleRightsData data, string submitAction = "") { if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.SecurityManagement)) { return(RedirectToAction("Index", "Home")); } data.AvailableRoles = await SecurityGuiHelper.GetAllRolesAsync(); data.AvailableActionRights = await SecurityGuiHelper.GetAllActionRightsApplybleToAForumAsync(); data.AvailableForums = await ForumGuiHelper.GetAllForumsWithSectionNamesAsync(); switch (submitAction) { case "save": // save the data, then after this action, it'll reload the data and show it. data.LastActionResult = await SecurityManager.SaveForumActionRightsForForumRoleAsync(data.ActionRightsSet, data.RoleID, data.ForumID) ? "Save successful" : "Save failed"; break; case "cancel": return(RedirectToAction("Index", "Home")); default: // nothin' break; } // postback which should simply fill in the data and show the form var forumActionRightRolesForForumRole = await SecurityGuiHelper.GetForumActionRightRolesForForumRoleAsync(data.RoleID, data.ForumID); data.ActionRightsSet = forumActionRightRolesForForumRole.Select(r => r.ActionRightID).ToList(); return(View("~/Views/Admin/ManageRightsPerForum.cshtml", data)); }
/// <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> private void Page_Load(object sender, System.EventArgs e) { _siteName = HttpUtility.HtmlEncode(ApplicationAdapter.GetSiteName()); int forumID = HnDGeneralUtils.TryConvertToInt(Request.QueryString["ForumID"]); _forum = CacheManager.GetForum(forumID); if ((_forum != null) && _forum.HasRSSFeed) { _forumURL = "http://" + Request.Url.Host + ApplicationAdapter.GetVirtualRoot() + String.Format(@"Threads.aspx?ForumID={0}", forumID); // get the messages ForumMessagesTypedList messages = ForumGuiHelper.GetLastPostedMessagesInForum(10, forumID); rptRSS.DataSource = messages; rptRSS.DataBind(); Response.Cache.SetExpires(DateTime.Now.AddDays(7)); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetValidUntilExpires(true); Response.Cache.VaryByParams["ForumID"] = true; Response.Cache.AddValidationCallback(new HttpCacheValidateHandler(Validate), null); } }
private void Page_Load(object sender, System.EventArgs e) { // If the user doesn't have any access rights to management stuff, the user should // be redirected to the default of the global system. if (!SessionAdapter.HasSystemActionRights()) { // doesn't have system rights. redirect. Response.Redirect("../Default.aspx", true); } // Check if the user has the right systemright if (!SessionAdapter.HasSystemActionRight(ActionRights.SystemManagement)) { // no, redirect to admin default page, since the user HAS access to the admin menu. Response.Redirect("Default.aspx", true); } _forumID = HnDGeneralUtils.TryConvertToInt(Request.QueryString["ForumID"]); if (!Page.IsPostBack) { // read sections for the drop down list. SectionCollection sections = SectionGuiHelper.GetAllSections(); cbxSections.DataSource = sections; cbxSections.DataBind(); SupportQueueCollection supportQueues = CacheManager.GetAllSupportQueues(); cbxSupportQueues.DataSource = supportQueues; cbxSupportQueues.DataBind(); // Load the forum. ForumEntity forum = ForumGuiHelper.GetForum(_forumID); if (forum != null) { // forum found tbxForumDescription.Text = forum.ForumDescription; tbxForumName.Value = forum.ForumName; tbxOrderNo.Text = forum.OrderNo.ToString(); cbxSections.SelectedValue = forum.SectionID.ToString(); if (forum.DefaultSupportQueueID.HasValue) { cbxSupportQueues.SelectedValue = forum.DefaultSupportQueueID.Value.ToString(); } chkHasRSSFeed.Checked = forum.HasRSSFeed; cbxThreadListInterval.SelectedValue = forum.DefaultThreadListInterval.ToString(); tbxMaxAttachmentSize.Text = forum.MaxAttachmentSize.ToString(); tbxMaxNoOfAttachmentsPerMessage.Text = forum.MaxNoOfAttachmentsPerMessage.ToString(); if (forum.NewThreadWelcomeText != null) { tbxNewThreadWelcomeText.Text = forum.NewThreadWelcomeText; } } else { // not found Response.Redirect("Default.aspx", true); } } }
private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { this.Title += ApplicationAdapter.GetSiteName(); // first time loaded, fill in properties lblUserName.Text = SessionAdapter.GetUserNickName(); HttpContext hcCurrent = HttpContext.Current; DataTable bookmarkStatistics = null; // check if user is authenticated if (hcCurrent.Request.IsAuthenticated) { lblWelcomeTextLoggedIn.Visible = true; bookmarkStatistics = UserGuiHelper.GetBookmarkStatisticsAsDataTable(SessionAdapter.GetUserID()); } else { lblWelcomeTextNotLoggedIn.Visible = true; bookmarkStatistics = new DataTable(); } // check if the user has the action right to approve attachments on some forum. If so, show the # of attachments which need approval List <int> forumsWithApprovalRight = SessionAdapter.GetForumsWithActionRight(ActionRights.ApproveAttachment); bool canApproveAttachments = ((forumsWithApprovalRight != null) && (forumsWithApprovalRight.Count > 0)); if (canApproveAttachments) { int numberOfAttachmentsToApprove = MessageGuiHelper.GetTotalNumberOfAttachmentsToApprove( SessionAdapter.GetForumsWithActionRight(ActionRights.AccessForum), SessionAdapter.GetForumsWithActionRight(ActionRights.ApproveAttachment), SessionAdapter.GetForumsWithActionRight(ActionRights.ViewNormalThreadsStartedByOthers), SessionAdapter.GetUserID()); if (numberOfAttachmentsToApprove > 0) { phAttachmentsToApprove.Visible = true; phAttentionRemarks.Visible = true; } } if (SessionAdapter.HasSystemActionRight(ActionRights.QueueContentManagement)) { int numberOfThreadsInSupportQueues = SupportQueueGuiHelper.GetTotalNumberOfThreadsInSupportQueues( SessionAdapter.GetForumsWithActionRight(ActionRights.AccessForum)); if (numberOfThreadsInSupportQueues > 0) { phThreadsToSupport.Visible = true; phAttentionRemarks.Visible = true; } } DateTime lastVisitDate = SessionAdapter.GetLastVisitDate(); if (SessionAdapter.IsLastVisitDateValid()) { phLastVisitDate.Visible = true; lblLastVisitDate.Text = lastVisitDate.ToString("dd-MMM-yyyy HH:mm"); } // Get all sections which possibly can be displayed. Obtain this from the cache, as it's hardly changing data, and // this page is read a lot. _sectionsToDisplay = CacheManager.GetAllSections(); // Per section, create a view with all the forumdata and filter out the forums not visible for the current user. List <int> accessableForums = SessionAdapter.GetForumsWithActionRight(ActionRights.AccessForum); List <int> forumsWithThreadsFromOthers = SessionAdapter.GetForumsWithActionRight(ActionRights.ViewNormalThreadsStartedByOthers); _forumViewsPerDisplayedSection = ForumGuiHelper.GetAllAvailableForumsDataViews(_sectionsToDisplay, accessableForums, forumsWithThreadsFromOthers, SessionAdapter.GetUserID()); // filter out sections which do not have displayable forums for this user EntityView <SectionEntity> sectionsToUse = CreateFilteredSectionsCollection(); // show the sections with displayable forums, thus the displayable sections. rpSections.DataSource = sectionsToUse; rpSections.DataBind(); // get bookmarks and show them in the gui if ((bookmarkStatistics.Rows.Count <= 0) || ((bookmarkStatistics.Rows.Count == 1) && ((int)bookmarkStatistics.Rows[0][0] == 0))) { // no bookmarks yet lblAmountBookmarks.Text = "0"; lblAmountPostingsInBookmarks.Text = "0"; lblBookmarksLastPostingDate.Text = "Never"; imgIconBookmarkNoNewPosts.Visible = true; } else { lblAmountBookmarks.Text = bookmarkStatistics.Rows[0]["AmountThreads"].ToString(); lblAmountPostingsInBookmarks.Text = bookmarkStatistics.Rows[0]["AmountPostings"].ToString(); DateTime dateLastPosting = (DateTime)bookmarkStatistics.Rows[0]["LastPostingDate"]; lblBookmarksLastPostingDate.Text = dateLastPosting.ToString("dd-MMM-yyyy HH:mm"); if (dateLastPosting > lastVisitDate) { imgIconBookmarkNewPosts.Visible = true; } else { imgIconBookmarkNoNewPosts.Visible = true; } } DataTable activeThreadsStatistics = ThreadGuiHelper.GetActiveThreadsStatisticsAsDataTable(accessableForums, CacheManager.GetSystemData().HoursThresholdForActiveThreads, SessionAdapter.GetForumsWithActionRight(ActionRights.ViewNormalThreadsStartedByOthers), SessionAdapter.GetUserID()); if (activeThreadsStatistics != null) { if ((activeThreadsStatistics.Rows.Count <= 0) || ((activeThreadsStatistics.Rows.Count == 1) && ((int)activeThreadsStatistics.Rows[0][0] == 0))) { lblAmountActiveThreads.Text = "0"; lblAmountPostingsInActiveThreads.Text = "0"; lblActiveThreadsLastPostingDate.Text = "Never"; imgIconActiveThreadsNoNewPosts.Visible = true; } else { lblAmountActiveThreads.Text = activeThreadsStatistics.Rows[0]["AmountThreads"].ToString(); lblAmountPostingsInActiveThreads.Text = activeThreadsStatistics.Rows[0]["AmountPostings"].ToString(); DateTime dateLastPosting = (DateTime)activeThreadsStatistics.Rows[0]["LastPostingDate"]; lblActiveThreadsLastPostingDate.Text = dateLastPosting.ToString("dd-MMM-yyyy HH:mm"); if (dateLastPosting > lastVisitDate) { imgIconActiveThreadsNewPosts.Visible = true; } else { imgIconActiveThreadsNoNewPosts.Visible = true; } } } } RegisterCollapseExpandClientScript(); }
/// <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> private void Page_Load(object sender, System.EventArgs e) { int forumID = HnDGeneralUtils.TryConvertToInt(Request.QueryString["ForumID"]); bool userHasAccess = SessionAdapter.CanPerformForumActionRight(forumID, ActionRights.AccessForum); if (!userHasAccess) { // doesn't have access to this forum. redirect Response.Redirect("default.aspx"); } bool userCanCreateThreads = (SessionAdapter.CanPerformForumActionRight(forumID, ActionRights.AddNormalThread) || SessionAdapter.CanPerformForumActionRight(forumID, ActionRights.AddStickyThread)); // Controls are visible by default. Hide them when the user can't create threads on this forum if (!userCanCreateThreads) { lnkNewThreadBottom.Visible = false; lnkNewThreadTop.Visible = false; } // fill the page's content ForumEntity forum = CacheManager.GetForum(forumID); if (forum == null) { // not found. Response.Redirect("default.aspx"); } _forumName = forum.ForumName; if (!Page.IsPostBack) { cbxThreadListInterval.SelectedValue = forum.DefaultThreadListInterval.ToString(); string forumNameEncoded = HttpUtility.HtmlEncode(_forumName); lblForumName.Text = forumNameEncoded; lblForumName_Header.Text = HttpUtility.HtmlEncode(_forumName); lblForumDescription.Text = HttpUtility.HtmlEncode(forum.ForumDescription); lblSectionName.Text = CacheManager.GetSectionName(forum.SectionID); string newThreadURL = string.Format("{0}?ForumID={1}", lnkNewThreadTop.NavigateUrl, forumID); lnkNewThreadTop.NavigateUrl = newThreadURL; lnkNewThreadBottom.NavigateUrl = newThreadURL; if (forum.HasRSSFeed) { lnkForumRSS.NavigateUrl += string.Format("?ForumID={0}", forumID); } else { lnkForumRSS.Visible = false; litRssButtonSpacer.Visible = false; } } SystemDataEntity systemData = CacheManager.GetSystemData(); int postLimiter = HnDGeneralUtils.TryConvertToInt(cbxThreadListInterval.SelectedValue); DataView threadsView = ForumGuiHelper.GetAllThreadsInForumAsDataView(forumID, (ThreadListInterval)(byte)postLimiter, systemData.MinNumberOfThreadsToFetch, systemData.MinNumberOfNonStickyVisibleThreads, SessionAdapter.CanPerformForumActionRight(forumID, ActionRights.ViewNormalThreadsStartedByOthers), SessionAdapter.GetUserID()); rpThreads.DataSource = threadsView; rpThreads.DataBind(); threadsView.Dispose(); }
/// <summary> /// Handles the PerformSelect event of the _forumsDS control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs"/> instance containing the event data.</param> protected void _forumsDS_PerformSelect(object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs e) { int selectedSectionID = HnDGeneralUtils.TryConvertToInt(cbxSections.SelectedValue); _forumsDS.EntityCollection = ForumGuiHelper.GetAllForumsInSection(selectedSectionID); }