protected void rptrLatestPosts_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var forumPost = e.Item.DataItem as ForumPost; var hlTopic = e.Item.FindControl("hlTopic") as HyperLink; if (hlTopic != null) { ForumTopic forumTopic = forumPost.Topic; if (forumTopic != null) { hlTopic.Text = Server.HtmlEncode(forumTopic.Subject); hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumPost.TopicId); } } var lblPosted = e.Item.FindControl("lblPosted") as Label; if (lblPosted != null) { lblPosted.Text = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn).ToString("f"); } var lblPost = e.Item.FindControl("lblPost") as Label; if (lblPost != null) { lblPost.Text = ForumManager.FormatPostText(forumPost.Text); } } }
protected string CreatePostPager(ForumTopic forumTopic) { int pageSize = 10; if (ForumManager.PostsPageSize > 0) { pageSize = ForumManager.PostsPageSize; } string queryStringParam = "p"; string result = string.Empty; int NumToDisplay = 4; int PageCount = (int)Math.Ceiling((double)forumTopic.NumPosts / pageSize); if (PageCount > 1) { if (PageCount > NumToDisplay) { result += createLink(SEOHelper.GetForumTopicUrl(forumTopic), "1"); result += " ... "; bool first = true; for (int i = (PageCount - (NumToDisplay - 1)); i < PageCount; i++) { int iPost = i + 1; if (first) { first = false; } else { result += ", "; } result += createLink(SEOHelper.GetForumTopicUrl(forumTopic, queryStringParam, iPost), iPost.ToString()); } } else { bool first = true; for (int i = 0; i < PageCount; i++) { int iPost = i + 1; if (first) { first = false; } else { result += ", "; } result += createLink(SEOHelper.GetForumTopicUrl(forumTopic, queryStringParam, iPost), iPost.ToString()); } } } return(result); }
protected void btnDelete_Click(object sender, EventArgs e) { int forumPostId = 0; int.TryParse(lblForumPostId.Text, out forumPostId); var forumPost = ForumManager.GetPostById(forumPostId); if (forumPost != null) { var forumTopic = forumPost.Topic; if (!ForumManager.IsUserAllowedToDeletePost(NopContext.Current.User, forumPost)) { string loginURL = SEOHelper.GetLoginPageUrl(true); Response.Redirect(loginURL); } ForumManager.DeletePost(forumPost.ForumPostId); string url = string.Empty; //get topic one more time because it can be deleted forumTopic = ForumManager.GetTopicById(forumPost.TopicId); if (forumTopic != null) { url = SEOHelper.GetForumTopicUrl(forumTopic.ForumTopicId); } else { url = SEOHelper.GetForumMainUrl(); } Response.Redirect(url); } }
protected void gvLP_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ForumPost forumPost = (ForumPost)e.Row.DataItem; HyperLink hlTopic = e.Row.FindControl("hlTopic") as HyperLink; if (hlTopic != null) { ForumTopic forumTopic = forumPost.Topic; if (forumTopic != null) { hlTopic.Text = Server.HtmlEncode(forumTopic.Subject); hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumPost.TopicId); } } Label lblPosted = e.Row.FindControl("lblPosted") as Label; if (lblPosted != null) { lblPosted.Text = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn, DateTimeKind.Utc).ToString("f"); } Label lblPost = e.Row.FindControl("lblPost") as Label; if (lblPost != null) { lblPost.Text = ForumManager.FormatPostText(forumPost.Text); } } }
public void BindData() { if (forumPost != null) { //post date string dateStr = string.Empty; if (this.ForumService.RelativeDateTimeFormattingEnabled) { dateStr = forumPost.CreatedOn.RelativeFormat(true, "f"); } else { dateStr = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn, DateTimeKind.Utc).ToString("f"); } lblLastPostDate.Text = dateStr; //topic var forumTopic = forumPost.Topic; if (forumTopic != null) { hlTopic.Text = Server.HtmlEncode(forumTopic.StripTopicSubject()); hlTopic.ToolTip = Server.HtmlEncode(forumTopic.Subject); hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumTopic); } //customer var customer = forumPost.User; if (customer != null) { if (this.CustomerService.AllowViewingProfiles && !customer.IsGuest) { hlUser.Text = Server.HtmlEncode(customer.FormatUserName(true)); hlUser.NavigateUrl = SEOHelper.GetUserProfileUrl(customer.CustomerId); lblUser.Visible = false; } else { lblUser.Text = Server.HtmlEncode(customer.FormatUserName(true)); hlUser.Visible = false; } } pnlPostInfo.Visible = true; pnlNoPost.Visible = false; } else { pnlPostInfo.Visible = false; pnlNoPost.Visible = true; } }
protected void gvLP_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ForumPost forumPost = (ForumPost)e.Row.DataItem; //topic info HyperLink hlTopic = e.Row.FindControl("hlTopic") as HyperLink; if (hlTopic != null) { ForumTopic forumTopic = forumPost.Topic; if (forumTopic != null) { hlTopic.Text = Server.HtmlEncode(forumTopic.Subject); hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumPost.TopicId); } } //post date Label lblPosted = e.Row.FindControl("lblPosted") as Label; if (lblPosted != null) { string dateStr = string.Empty; if (this.ForumService.RelativeDateTimeFormattingEnabled) { dateStr = forumPost.CreatedOn.RelativeFormat(true, "f"); } else { dateStr = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn, DateTimeKind.Utc).ToString("f"); } lblPosted.Text = dateStr; } //forum post Label lblPost = e.Row.FindControl("lblPost") as Label; if (lblPost != null) { lblPost.Text = forumPost.FormatPostText(); } } }
protected void rptrTopics_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var forumTopic = e.Item.DataItem as ForumTopic; var customer = forumTopic.User; var hlTopic = e.Item.FindControl("hlTopic") as HyperLink; if (hlTopic != null) { hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumTopic); hlTopic.Text = Server.HtmlEncode(forumTopic.Subject); } var hlTopicStarter = e.Item.FindControl("hlTopicStarter") as HyperLink; if (hlTopicStarter != null) { if (customer != null && CustomerManager.AllowViewingProfiles && !customer.IsGuest) { hlTopicStarter.Text = Server.HtmlEncode(CustomerManager.FormatUserName(customer, true)); hlTopicStarter.NavigateUrl = SEOHelper.GetUserProfileUrl(customer.CustomerId); } else { hlTopicStarter.Visible = false; } } var lblTopicStarter = e.Item.FindControl("lblTopicStarter") as Label; if (lblTopicStarter != null) { if (customer != null && (!CustomerManager.AllowViewingProfiles || customer.IsGuest)) { lblTopicStarter.Text = Server.HtmlEncode(CustomerManager.FormatUserName(customer, true)); } else { lblTopicStarter.Visible = false; } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { var forumTopic = this.ForumService.GetTopicById(this.ForumTopicId); if (forumTopic == null) { Response.Redirect(SEOHelper.GetForumMainUrl()); } this.ForumService.MoveTopic(forumTopic.ForumTopicId, ctrlForumSelector.SelectedForumId); string topicURL = SEOHelper.GetForumTopicUrl(forumTopic); Response.Redirect(topicURL); } catch (Exception exc) { pnlError.Visible = true; lErrorMessage.Text = Server.HtmlEncode(exc.Message); } }
protected void btnCancel_Click(object sender, EventArgs e) { try { var forumTopic = this.ForumService.GetTopicById(this.ForumTopicId); if (forumTopic != null) { string topicUrl = SEOHelper.GetForumTopicUrl(forumTopic); Response.Redirect(topicUrl); } else { Response.Redirect(SEOHelper.GetForumMainUrl()); } } catch (Exception exc) { pnlError.Visible = true; lErrorMessage.Text = Server.HtmlEncode(exc.Message); } }
protected string GetForumTopicLink(ForumSubscription subscription) { if (subscription == null) { return(String.Empty); } Forum forum = subscription.Forum; if (forum != null) { return(SEOHelper.GetForumUrl(forum)); } ForumTopic topic = subscription.Topic; if (topic != null) { return(SEOHelper.GetForumTopicUrl(topic)); } return(String.Empty); }
public void BindData() { if (forumPost != null) { lblLastPostDate.Text = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn, DateTimeKind.Utc).ToString("f"); var forumTopic = forumPost.Topic; if (forumTopic != null) { hlTopic.Text = Server.HtmlEncode(ForumManager.StripTopicSubject(forumTopic.Subject)); hlTopic.ToolTip = Server.HtmlEncode(forumTopic.Subject); hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumTopic); } var customer = forumPost.User; if (customer != null) { if (CustomerManager.AllowViewingProfiles && !customer.IsGuest) { hlUser.Text = Server.HtmlEncode(CustomerManager.FormatUserName(customer, true)); hlUser.NavigateUrl = SEOHelper.GetUserProfileUrl(customer.CustomerId); lblUser.Visible = false; } else { lblUser.Text = Server.HtmlEncode(CustomerManager.FormatUserName(customer, true)); hlUser.Visible = false; } } pnlPostInfo.Visible = true; pnlNoPost.Visible = false; } else { pnlPostInfo.Visible = false; pnlNoPost.Visible = true; } }
public void BindData() { hlHome.NavigateUrl = CommonHelper.GetStoreLocation(); hlForumsHome.NavigateUrl = SEOHelper.GetForumMainUrl(); //topic var forumTopic = ForumManager.GetTopicById(this.ForumTopicId); if (forumTopic != null) { hlForumTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumTopic); hlForumTopic.Text = Server.HtmlEncode(forumTopic.Subject); } else { phForumTopic.Visible = false; } //forum Forum forum = null; if (forumTopic != null) { forum = ForumManager.GetForumById(forumTopic.ForumId); } else { forum = ForumManager.GetForumById(this.ForumId); } if (forum != null) { hlForum.NavigateUrl = SEOHelper.GetForumUrl(forum); hlForum.Text = Server.HtmlEncode(forum.Name); } else { phForum.Visible = false; } //forum group ForumGroup forumGroup = null; if (forum != null) { forumGroup = ForumManager.GetForumGroupById(forum.ForumGroupId); } else { forumGroup = ForumManager.GetForumGroupById(this.ForumGroupId); } if (forumGroup != null) { hlForumGroup.NavigateUrl = SEOHelper.GetForumGroupUrl(forumGroup); hlForumGroup.Text = Server.HtmlEncode(forumGroup.Name); } else { phForumTopic.Visible = false; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { string text = string.Empty; switch (this.ForumService.ForumEditor) { case EditorTypeEnum.SimpleTextBox: { text = txtTopicBodySimple.Text.Trim(); } break; case EditorTypeEnum.BBCodeEditor: { text = txtTopicBodyBBCode.Text.Trim(); } break; case EditorTypeEnum.HtmlEditor: { text = txtTopicBodyHtml.Value; } break; default: break; } string subject = txtTopicTitle.Text; var topicType = ForumTopicTypeEnum.Normal; bool subscribe = cbSubscribe.Checked; string IPAddress = NopContext.Current.UserHostAddress; DateTime nowDT = DateTime.UtcNow; if (this.ForumService.IsUserAllowedToSetTopicPriority(NopContext.Current.User)) { topicType = (ForumTopicTypeEnum)Enum.ToObject(typeof(ForumTopicTypeEnum), int.Parse(ddlPriority.SelectedItem.Value)); } text = text.Trim(); if (String.IsNullOrEmpty(text)) { throw new NopException(GetLocaleResourceString("Forum.TextCannotBeEmpty")); } if (this.AddTopic) { #region Adding topic var forum = this.ForumService.GetForumById(this.ForumId); if (forum == null) { Response.Redirect(SEOHelper.GetForumMainUrl()); } if (!this.ForumService.IsUserAllowedToCreateTopic(NopContext.Current.User, forum)) { string loginURL = SEOHelper.GetLoginPageUrl(true); Response.Redirect(loginURL); } subject = subject.Trim(); if (String.IsNullOrEmpty(subject)) { throw new NopException(GetLocaleResourceString("Forum.TopicSubjectCannotBeEmpty")); } //forum topic var forumTopic = new ForumTopic() { ForumId = forum.ForumId, UserId = NopContext.Current.User.CustomerId, TopicTypeId = (int)topicType, Subject = subject, CreatedOn = nowDT, UpdatedOn = nowDT }; this.ForumService.InsertTopic(forumTopic, true); //forum post var forumPost = new ForumPost() { TopicId = forumTopic.ForumTopicId, UserId = NopContext.Current.User.CustomerId, Text = text, IPAddress = IPAddress, CreatedOn = nowDT, UpdatedOn = nowDT }; this.ForumService.InsertPost(forumPost, false); //update forum topic forumTopic.NumPosts = 1; forumTopic.LastPostId = forumPost.ForumPostId; forumTopic.LastPostUserId = forumPost.UserId; forumTopic.LastPostTime = forumPost.CreatedOn; forumTopic.UpdatedOn = nowDT; this.ForumService.UpdateTopic(forumTopic); //subscription if (this.ForumService.IsUserAllowedToSubscribe(NopContext.Current.User)) { if (subscribe) { var forumSubscription = new ForumSubscription() { SubscriptionGuid = Guid.NewGuid(), UserId = NopContext.Current.User.CustomerId, TopicId = forumTopic.ForumTopicId, CreatedOn = nowDT }; this.ForumService.InsertSubscription(forumSubscription); } } string topicURL = SEOHelper.GetForumTopicUrl(forumTopic); Response.Redirect(topicURL); #endregion } else if (this.EditTopic) { #region Editing topic var forumTopic = this.ForumService.GetTopicById(this.ForumTopicId); if (forumTopic == null) { Response.Redirect(SEOHelper.GetForumMainUrl()); } if (!this.ForumService.IsUserAllowedToEditTopic(NopContext.Current.User, forumTopic)) { string loginURL = SEOHelper.GetLoginPageUrl(true); Response.Redirect(loginURL); } subject = subject.Trim(); if (String.IsNullOrEmpty(subject)) { throw new NopException(GetLocaleResourceString("Forum.TopicSubjectCannotBeEmpty")); } //forum topic forumTopic.TopicTypeId = (int)topicType; forumTopic.Subject = subject; forumTopic.UpdatedOn = nowDT; this.ForumService.UpdateTopic(forumTopic); //forum post var firstPost = forumTopic.FirstPost; if (firstPost != null) { firstPost.Text = text; firstPost.UpdatedOn = nowDT; this.ForumService.UpdatePost(firstPost); } else { //error (not possible) firstPost = new ForumPost() { TopicId = forumTopic.ForumTopicId, UserId = forumTopic.UserId, Text = text, IPAddress = IPAddress, UpdatedOn = nowDT }; this.ForumService.InsertPost(firstPost, false); } //subscription if (this.ForumService.IsUserAllowedToSubscribe(NopContext.Current.User)) { var forumSubscription = this.ForumService.GetAllSubscriptions(NopContext.Current.User.CustomerId, 0, forumTopic.ForumTopicId, 0, 1).FirstOrDefault(); if (subscribe) { if (forumSubscription == null) { forumSubscription = new ForumSubscription() { SubscriptionGuid = Guid.NewGuid(), UserId = NopContext.Current.User.CustomerId, TopicId = forumTopic.ForumTopicId, CreatedOn = nowDT }; this.ForumService.InsertSubscription(forumSubscription); } } else { if (forumSubscription != null) { this.ForumService.DeleteSubscription(forumSubscription.ForumSubscriptionId); } } } string topicURL = SEOHelper.GetForumTopicUrl(forumTopic); Response.Redirect(topicURL); #endregion } else if (this.AddPost) { #region Adding post var forumTopic = this.ForumService.GetTopicById(this.ForumTopicId); if (forumTopic == null) { Response.Redirect(SEOHelper.GetForumMainUrl()); } if (!this.ForumService.IsUserAllowedToCreatePost(NopContext.Current.User, forumTopic)) { string loginURL = SEOHelper.GetLoginPageUrl(true); Response.Redirect(loginURL); } //forum post var forumPost = new ForumPost() { TopicId = this.ForumTopicId, UserId = NopContext.Current.User.CustomerId, Text = text, IPAddress = IPAddress, CreatedOn = nowDT, UpdatedOn = nowDT }; this.ForumService.InsertPost(forumPost, true); //subscription if (this.ForumService.IsUserAllowedToSubscribe(NopContext.Current.User)) { var forumSubscription = this.ForumService.GetAllSubscriptions(NopContext.Current.User.CustomerId, 0, forumPost.TopicId, 0, 1).FirstOrDefault(); if (subscribe) { if (forumSubscription == null) { forumSubscription = new ForumSubscription() { SubscriptionGuid = Guid.NewGuid(), UserId = NopContext.Current.User.CustomerId, TopicId = forumPost.TopicId, CreatedOn = nowDT }; this.ForumService.InsertSubscription(forumSubscription); } } else { if (forumSubscription != null) { this.ForumService.DeleteSubscription(forumSubscription.ForumSubscriptionId); } } } int pageSize = 10; if (this.ForumService.PostsPageSize > 0) { pageSize = this.ForumService.PostsPageSize; } int pageIndex = this.ForumService.CalculateTopicPageIndex(forumPost.TopicId, pageSize, forumPost.ForumPostId); string topicURL = SEOHelper.GetForumTopicUrl(forumPost.TopicId, "p", pageIndex + 1, forumPost.ForumPostId); Response.Redirect(topicURL); #endregion } else if (this.EditPost) { #region Editing post var forumPost = this.ForumService.GetPostById(this.ForumPostId); if (forumPost == null) { Response.Redirect(SEOHelper.GetForumMainUrl()); } if (!this.ForumService.IsUserAllowedToEditPost(NopContext.Current.User, forumPost)) { string loginURL = SEOHelper.GetLoginPageUrl(true); Response.Redirect(loginURL); } forumPost.Text = text; forumPost.UpdatedOn = nowDT; this.ForumService.UpdatePost(forumPost); //subscription if (this.ForumService.IsUserAllowedToSubscribe(NopContext.Current.User)) { var forumSubscription = this.ForumService.GetAllSubscriptions(NopContext.Current.User.CustomerId, 0, forumPost.TopicId, 0, 1).FirstOrDefault(); if (subscribe) { if (forumSubscription == null) { forumSubscription = new ForumSubscription() { SubscriptionGuid = Guid.NewGuid(), UserId = NopContext.Current.User.CustomerId, TopicId = forumPost.TopicId, CreatedOn = nowDT }; this.ForumService.InsertSubscription(forumSubscription); } } else { if (forumSubscription != null) { this.ForumService.DeleteSubscription(forumSubscription.ForumSubscriptionId); } } } int pageSize = 10; if (this.ForumService.PostsPageSize > 0) { pageSize = this.ForumService.PostsPageSize; } int pageIndex = this.ForumService.CalculateTopicPageIndex(forumPost.TopicId, pageSize, forumPost.ForumPostId); string topicURL = SEOHelper.GetForumTopicUrl(forumPost.TopicId, "p", pageIndex + 1, forumPost.ForumPostId); Response.Redirect(topicURL); #endregion } } catch (Exception exc) { pnlError.Visible = true; lErrorMessage.Text = Server.HtmlEncode(exc.Message); } }
protected void rptrSearchResults_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var forumTopic = e.Item.DataItem as ForumTopic; var customer = forumTopic.User; var pnlTopicImage = e.Item.FindControl("pnlTopicImage") as Panel; if (pnlTopicImage != null) { switch (forumTopic.TopicType) { case ForumTopicTypeEnum.Normal: pnlTopicImage.CssClass = "post"; break; case ForumTopicTypeEnum.Sticky: pnlTopicImage.CssClass = "poststicky"; break; case ForumTopicTypeEnum.Announcement: pnlTopicImage.CssClass = "postannoucement"; break; default: pnlTopicImage.CssClass = "post"; break; } } var lblTopicType = e.Item.FindControl("lblTopicType") as Label; if (lblTopicType != null) { switch (forumTopic.TopicType) { case ForumTopicTypeEnum.Sticky: lblTopicType.Text = string.Format("[{0}]", GetLocaleResourceString("Forum.Sticky")); break; case ForumTopicTypeEnum.Announcement: lblTopicType.Text = string.Format("[{0}]", GetLocaleResourceString("Forum.Announcement")); break; default: lblTopicType.Visible = false; break; } } var hlTopic = e.Item.FindControl("hlTopic") as HyperLink; if (hlTopic != null) { hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumTopic.ForumTopicId); hlTopic.Text = Server.HtmlEncode(forumTopic.Subject); } var hlTopicStarter = e.Item.FindControl("hlTopicStarter") as HyperLink; if (hlTopicStarter != null) { if (customer != null && CustomerManager.AllowViewingProfiles && !customer.IsGuest) { hlTopicStarter.Text = Server.HtmlEncode(CustomerManager.FormatUserName(customer)); hlTopicStarter.NavigateUrl = SEOHelper.GetUserProfileUrl(customer.CustomerId); } else { hlTopicStarter.Visible = false; } } var lblTopicStarter = e.Item.FindControl("lblTopicStarter") as Label; if (lblTopicStarter != null) { if (customer != null && (!CustomerManager.AllowViewingProfiles || customer.IsGuest)) { lblTopicStarter.Text = Server.HtmlEncode(CustomerManager.FormatUserName(customer)); } else { lblTopicStarter.Visible = false; } } } }
protected void btnCancel_Click(object sender, EventArgs e) { try { if (this.AddTopic) { var forum = ForumManager.GetForumById(this.ForumId); if (forum != null) { string forumUrl = SEOHelper.GetForumUrl(forum); Response.Redirect(forumUrl); } else { Response.Redirect(SEOHelper.GetForumMainUrl()); } } else if (this.EditTopic) { var forumTopic = ForumManager.GetTopicById(this.ForumTopicId); if (forumTopic != null) { string topicUrl = SEOHelper.GetForumTopicUrl(forumTopic); Response.Redirect(topicUrl); } else { Response.Redirect(SEOHelper.GetForumMainUrl()); } } else if (this.AddPost) { var forumTopic = ForumManager.GetTopicById(this.ForumTopicId); if (forumTopic != null) { string topicUrl = SEOHelper.GetForumTopicUrl(forumTopic); Response.Redirect(topicUrl); } else { Response.Redirect(SEOHelper.GetForumMainUrl()); } } else if (this.EditPost) { var forumPost = ForumManager.GetPostById(this.ForumPostId); if (forumPost != null) { string topicUrl = SEOHelper.GetForumTopicUrl(forumPost.TopicId); Response.Redirect(topicUrl); } else { Response.Redirect(SEOHelper.GetForumMainUrl()); } } } catch (Exception exc) { pnlError.Visible = true; lErrorMessage.Text = Server.HtmlEncode(exc.Message); } }
protected void rptrTopics_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var forumTopic = e.Item.DataItem as ForumTopic; var customer = forumTopic.User; var pnlTopicImage = e.Item.FindControl("pnlTopicImage") as Panel; if (pnlTopicImage != null) { switch (forumTopic.TopicType) { case ForumTopicTypeEnum.Normal: pnlTopicImage.CssClass = "post"; break; case ForumTopicTypeEnum.Sticky: pnlTopicImage.CssClass = "poststicky"; break; case ForumTopicTypeEnum.Announcement: pnlTopicImage.CssClass = "postannoucement"; break; default: pnlTopicImage.CssClass = "post"; break; } } var lblTopicType = e.Item.FindControl("lblTopicType") as Label; if (lblTopicType != null) { switch (forumTopic.TopicType) { case ForumTopicTypeEnum.Sticky: lblTopicType.Text = string.Format("[{0}]", GetLocaleResourceString("Forum.Sticky")); break; case ForumTopicTypeEnum.Announcement: lblTopicType.Text = string.Format("[{0}]", GetLocaleResourceString("Forum.Announcement")); break; default: lblTopicType.Visible = false; break; } } var hlTopic = e.Item.FindControl("hlTopic") as HyperLink; if (hlTopic != null) { hlTopic.NavigateUrl = SEOHelper.GetForumTopicUrl(forumTopic); hlTopic.Text = Server.HtmlEncode(forumTopic.Subject); } var lPager = e.Item.FindControl("lPager") as Literal; if (lPager != null) { string postPager = CreatePostPager(forumTopic); if (!String.IsNullOrEmpty(postPager)) { string postPagerFinal = string.Format("<br /><span class=\"topicspager\">{0}</span>", string.Format(GetLocaleResourceString("Forum.Topics.GotoPostPager"), postPager)); lPager.Text = postPagerFinal; } else { lPager.Visible = false; } } var hlTopicStarter = e.Item.FindControl("hlTopicStarter") as HyperLink; if (hlTopicStarter != null) { if (customer != null && this.CustomerService.AllowViewingProfiles && !customer.IsGuest) { hlTopicStarter.Text = Server.HtmlEncode(customer.FormatUserName(true)); hlTopicStarter.NavigateUrl = SEOHelper.GetUserProfileUrl(customer.CustomerId); } else { hlTopicStarter.Visible = false; } } var lblTopicStarter = e.Item.FindControl("lblTopicStarter") as Label; if (lblTopicStarter != null) { if (customer != null && (!this.CustomerService.AllowViewingProfiles || customer.IsGuest)) { lblTopicStarter.Text = Server.HtmlEncode(customer.FormatUserName(true)); } else { lblTopicStarter.Visible = false; } } } }