public ForumTopicWrapperFull(Topic topic,IEnumerable<Post> posts) : base(topic) { if (topic.Type==TopicType.Poll) { //TODO: Deal with polls } Posts = posts.Where(x=>x.IsApproved).Select(x => new ForumTopicPostWrapper(x)).ToList(); }
public ForumTopicWrapper(Topic topic) { Id = topic.ID; Title = topic.Title; Created = (ApiDateTime)topic.CreateDate; Text = ASC.Common.Utils.HtmlUtil.GetText(topic.RecentPostText, 160); Updated = (ApiDateTime)topic.RecentPostCreateDate; UpdatedBy = EmployeeWraper.Get(topic.RecentPostAuthorID); Status = topic.Status; Type = topic.Type; Tags = topic.Tags.Where(x => x.IsApproved).Select(x => x.Name).ToList(); ThreadTitile = topic.ThreadTitle; }
internal void TopicSticky(Topic topic) { UserActivityPublisher.Publish(this.GetType(), new ForumUserActivity() { ModuleID = _settings.ModuleID, ProductID = _settings.ProductID, URL = _settings.LinkProvider.PostList(topic.ID), ActionType = UserActivityConstants.ActivityActionType, ContentID = topic.ID.ToString(), BusinessValue = UserActivityConstants.NormalActivity, ActionText = (topic.Sticky ? Resources.ForumUCResource.TopicStickyActionText : Resources.ForumUCResource.TopicClearStickyActionText), Title = topic.Title, ContainerID = topic.ThreadID.ToString() }); }
private static Topic GetTagsForTopics(int tenantID, Topic topic) { var topics = new List<Topic> {topic}; return GetTagsForTopics(tenantID, topics)[0]; }
public static void SetTopicVisit(Topic topic) { if (topic.RecentPostID > 0) { ThreadVisitInfo tvi = ThreadVisitInfo.GetThreadVisitInfo(topic.ThreadID); if (tvi != null) tvi.TopicViewRecentPostIDs[topic.ID] = topic.RecentPostID; } SetThreadVisit(topic.TenantID, topic.ThreadID); DbManager.Connection.CreateCommand(@"update forum_topic set view_count = view_count+1 where id = @topicID and TenantID = @tid") .AddParameter("topicID", topic.ID) .AddParameter("tid", CoreContext.TenantManager.GetCurrentTenant().TenantId) .ExecuteNonQuery(); }
public string GetTopicImage(Topic topic) { var isNew = topic.IsNew(); if (!topic.Sticky) { if (topic.Type == TopicType.Informational && isNew && topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("top_new_closed.png", Settings.ImageItemID); else if (topic.Type == TopicType.Informational && isNew && !topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("top_new.png", Settings.ImageItemID); else if (topic.Type == TopicType.Informational && !isNew && topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("top_closed.png", Settings.ImageItemID); else if (topic.Type == TopicType.Informational && !isNew && !topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("top.png", Settings.ImageItemID); else if (topic.Type == TopicType.Poll && isNew && topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("poll_new_closed.png", Settings.ImageItemID); else if (topic.Type == TopicType.Poll && isNew && !topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("poll_new.png", Settings.ImageItemID); else if (topic.Type == TopicType.Poll && !isNew && topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("poll_closed.png", Settings.ImageItemID); else if (topic.Type == TopicType.Poll && !isNew && !topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("poll.png", Settings.ImageItemID); } else { if (topic.Type == TopicType.Informational && isNew && topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("top_new_closed_sticky.png", Settings.ImageItemID); else if (topic.Type == TopicType.Informational && isNew && !topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("top_new_sticky.png", Settings.ImageItemID); else if (topic.Type == TopicType.Informational && !isNew && topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("top_closed_sticky.png", Settings.ImageItemID); else if (topic.Type == TopicType.Informational && !isNew && !topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("top_sticky.png", Settings.ImageItemID); else if (topic.Type == TopicType.Poll && isNew && topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("poll_new_closed_sticky.png", Settings.ImageItemID); else if (topic.Type == TopicType.Poll && isNew && !topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("poll_new_sticky.png", Settings.ImageItemID); else if (topic.Type == TopicType.Poll && !isNew && topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("poll_closed_sticky.png", Settings.ImageItemID); else if (topic.Type == TopicType.Poll && !isNew && !topic.Closed) return WebImageSupplier.GetAbsoluteWebPath("poll_sticky.png", Settings.ImageItemID); } return ""; }
internal void EditTopic(Topic topic) { UserActivityPublisher.Publish(this.GetType(), new ForumUserActivity() { ModuleID = _settings.ModuleID, ProductID = _settings.ProductID, URL = _settings.LinkProvider.PostList(topic.ID), ActionType = UserActivityConstants.ActivityActionType, ContentID = topic.ID.ToString(), BusinessValue = UserActivityConstants.SmallContent, ActionText = Resources.ForumUCResource.TopicEditActionText, Title = topic.Title, ContainerID = topic.ThreadID.ToString() }); }