public static XPathNodeIterator Comment(int commentID) { XmlDocument xd = new XmlDocument(); Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentID); return c.ToXml(xd).CreateNavigator().Select("."); }
public static int CommentPageNumber(int commentId, int itemsPerPage) { Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentId); int position = c.Position - 1; return (int)(position / itemsPerPage); }
public static string DeleteComment(int commentId) { int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; if (User.GetCurrent() != null || Xslt.IsMemberInGroup("admin", _currentMember)) { Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentId); c.Delete(); return "true"; } return "false"; }
public static string EditComment(int commentId, int itemsPerPage) { int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0; Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentId); if (c.Editable(_currentMember)) { string body = HttpContext.Current.Request["body"]; c.Body = body; c.Save(); return Xslt.NiceCommentUrl(c.TopicId, c.Id, itemsPerPage); } return ""; }
public static string NiceCommentUrl(int topicId, int commentId, int itemsPerPage) { string url = NiceTopicUrl(topicId); if (!string.IsNullOrEmpty(url)) { Businesslogic.Comment c = new uForum.Businesslogic.Comment(commentId); int position = c.Position - 1; int page = (int)(position / itemsPerPage); url += "?p=" + page.ToString() + "#comment" + c.Id.ToString(); } return url; }