public string GetFirstPost(ForumTopic topic) { string result = topic.GetLatestPost().Content.StripHTML(); if (result.Length > GlobalConstants.SummaryMaxLength) { result = result.Substring(0, GlobalConstants.SummaryMaxLength) + "..."; } return result; }
/// <summary> /// Gets some pretty info for the topic, and lets the user browse directly to the last post in the topic /// </summary> /// <param name="topic"></param> /// <returns></returns> public string GetLastPostInfo(ForumTopic topic) { var latestPost = topic.GetLatestPost(); if (latestPost != null) { var createlatestpostlink = string.Concat("/getlatestpost.aspx?t=", topic.Id, "&p=", latestPost.Id); return string.Format(library.GetDictionaryItem("LastPostByLinkFormat"), createlatestpostlink, Helpers.GetPrettyDate(latestPost.CreatedOn.ToString()), latestPost.Owner.MemberLoginName); } return library.GetDictionaryItem("ErrorGettingLatestPost"); }
/// <summary> /// Maps an Umbraco Examine 'Topic' Search Result to the ForumTopic type /// </summary> /// <param name="nodetomap"></param> /// <returns></returns> public ForumTopic MapForumTopic(SearchResult nodetomap) { if (nodetomap == null) return null; var fCat = new ForumTopic { Id = nodetomap.Id, Url = library.NiceUrl(nodetomap.Id), Name = CheckFieldExists(nodetomap, "nodeName"), CreatedOn = Convert.ToDateTime(CheckFieldExists(nodetomap, "__Sort_createDate")), ParentId = CheckFieldExists(nodetomap, "parentID").ToInt32(), CategoryId = CheckFieldExists(nodetomap, "forumTopicParentCategoryID").ToInt32(), Owner = MembershipHelper.ReturnMember(CheckFieldExists(nodetomap, "forumTopicOwnedBy").ToInt32()), IsClosed = CheckFieldExists(nodetomap, "forumTopicClosed") == "1", IsSolved = CheckFieldExists(nodetomap, "forumTopicSolved") == "1", IsSticky = CheckFieldExists(nodetomap, "forumTopicIsSticky") == "1", SubscriberIds = Helpers.StringArrayToIntList(CheckFieldExists(nodetomap, "forumTopicSubscribedList")), SortOrder = CheckFieldExists(nodetomap, "sortOrder").ToInt32(), LastPostDate = Helpers.InternalDateFixer(CheckFieldExists(nodetomap, "__Sort_forumTopicLastPostDate")) }; return fCat; }
/// <summary> /// Maps an Umbraco 'Topic' Node to the ForumTopic type /// </summary> /// <param name="nodetomap"></param> /// <returns></returns> public ForumTopic MapForumTopic(INode nodetomap) { if (nodetomap == null) return null; var fCat = new ForumTopic { Id = nodetomap.Id, Url = library.NiceUrl(nodetomap.Id), Name = nodetomap.Name, CreatedOn = nodetomap.CreateDate, ParentId = nodetomap.Parent.Id, CategoryId = nodetomap.GetProperty("forumTopicParentCategoryID").Value.ToInt32(), Owner = MembershipHelper.ReturnMember(nodetomap.GetProperty("forumTopicOwnedBy").Value.ToInt32()), IsClosed = nodetomap.GetProperty("forumTopicClosed").Value == "1", IsSolved = nodetomap.GetProperty("forumTopicSolved").Value == "1", IsSticky = nodetomap.GetProperty("forumTopicIsSticky").Value == "1", SubscriberIds = Helpers.StringArrayToIntList(nodetomap.GetProperty("forumTopicSubscribedList").Value), LastPostDate = Helpers.InternalDateFixer(nodetomap.GetProperty("forumTopicLastPostDate").Value), SortOrder = nodetomap.SortOrder }; return fCat; }
public string GetFirstPost(ForumTopic topic) { return topic.GetFirstPost().Content; }
/// <summary> /// Populates properties for use throughout this page /// </summary> private void GetPublicProperties() { //First get parent topic and add to local variable ParentTopic = Mapper.MapForumTopic(Node.GetCurrent()); }
private void GetForumNodes() { Post = Mapper.MapForumPost(new Node(ChildPostNode.ToInt32())); Topic = Post.ParentTopic(); Category = Topic.ParentCategory(); }