public string GetDiscussionPreview(string html) { return(HtmlUtility.GetFull(html)); }
private static void NotifyFeed(Feed feed, bool isEdit, FeedType type) { var initatorInterceptor = new InitiatorInterceptor(new DirectRecipient(feed.Creator, "")); try { NewsNotifyClient.NotifyClient.AddInterceptor(initatorInterceptor); var replyToTag = GetReplyToTag(feed, null); if (type == FeedType.Poll && feed is FeedPoll) { NewsNotifyClient.NotifyClient.SendNoticeAsync( NewsConst.NewFeed, null, null, new TagValue(NewsConst.TagFEED_TYPE, "poll"), new TagValue(NewsConst.TagAnswers, ((FeedPoll)feed).Variants.ConvertAll(v => v.Name)), new TagValue(NewsConst.TagCaption, feed.Caption), new TagValue(NewsConst.TagText, HtmlUtility.GetFull(feed.Text)), new TagValue(NewsConst.TagDate, feed.Date.ToShortString()), new TagValue(NewsConst.TagURL, CommonLinkUtility.GetFullAbsolutePath( "~/products/community/modules/news/?docid=" + feed.Id)), new TagValue(NewsConst.TagUserName, DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID)), new TagValue(NewsConst.TagUserUrl, CommonLinkUtility.GetFullAbsolutePath( CommonLinkUtility.GetUserProfile(SecurityContext.CurrentAccount.ID))), replyToTag ); } else { NewsNotifyClient.NotifyClient.SendNoticeAsync( NewsConst.NewFeed, null, null, new TagValue(NewsConst.TagFEED_TYPE, "feed"), new TagValue(NewsConst.TagCaption, feed.Caption), new TagValue(NewsConst.TagText, HtmlUtility.GetFull(feed.Text)), new TagValue(NewsConst.TagDate, feed.Date.ToShortString()), new TagValue(NewsConst.TagURL, CommonLinkUtility.GetFullAbsolutePath( "~/products/community/modules/news/?docid=" + feed.Id)), new TagValue(NewsConst.TagUserName, DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID)), new TagValue(NewsConst.TagUserUrl, CommonLinkUtility.GetFullAbsolutePath( CommonLinkUtility.GetUserProfile(SecurityContext.CurrentAccount.ID))), replyToTag ); } // subscribe to new comments var subsciber = NewsNotifySource.Instance.GetSubscriptionProvider(); var me = (IDirectRecipient)NewsNotifySource.Instance.GetRecipientsProvider().GetRecipient(SecurityContext.CurrentAccount.ID.ToString()); if (me != null && !subsciber.IsUnsubscribe(me, NewsConst.NewComment, feed.Id.ToString(CultureInfo.InvariantCulture))) { subsciber.Subscribe(NewsConst.NewComment, feed.Id.ToString(CultureInfo.InvariantCulture), me); } } finally { NewsNotifyClient.NotifyClient.RemoveInterceptor(initatorInterceptor.Name); } }
private void FillSelectedPage(List <Post> posts, BlogsEngine engine) { var currentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID); if (posts == null || posts.Count == 0) { var emptyScreenControl = new EmptyScreenControl { ImgSrc = WebImageSupplier.GetAbsoluteWebPath("blog_icon.png", ASC.Blogs.Core.Constants.ModuleId), Header = BlogsResource.EmptyScreenBlogCaption, Describe = BlogsResource.EmptyScreenBlogText }; if (CommunitySecurity.CheckPermissions(new PersonalBlogSecObject(currentUser), ASC.Blogs.Core.Constants.Action_AddPost) && string.IsNullOrEmpty(UserID) && string.IsNullOrEmpty(Search)) { emptyScreenControl.ButtonHTML = String.Format("<a class='link underline blue plus' href='addblog.aspx'>{0}</a>", BlogsResource.EmptyScreenBlogLink); } placeContent.Controls.Add(emptyScreenControl); return; } placeContent.Controls.Add(new Literal { Text = "<div>" }); var post_with_comments = engine.GetPostsCommentsCount(posts); if (!String.IsNullOrEmpty(UserID)) { var post = post_with_comments[0].Item1; var st = new StringBuilder(); st.Append("<div class=\"BlogsHeaderBlock header-with-menu\" style=\"margin-bottom:16px;\">"); st.Append("<span class=\"header\">" + CoreContext.UserManager.GetUsers(post.UserID).DisplayUserName() + "</span>"); st.Append("</div>"); placeContent.Controls.Add(new Literal { Text = st.ToString() }); } for (var i = 0; i < post_with_comments.Count; i++) { var post = post_with_comments[i].Item1; var commentCount = post_with_comments[i].Item2; var sb = new StringBuilder(); var user = CoreContext.UserManager.GetUsers(post.UserID); sb.Append("<div class=\"container-list\">"); sb.Append("<div class=\"header-list\">"); sb.Append("<div class=\"avatar-list\">"); sb.Append("<a href=\"viewblog.aspx?blogid=" + post.ID.ToString() + "\">" + ImageHTMLHelper.GetHTMLUserAvatar(user.ID) + "</a>"); sb.Append("</div><div class=\"describe-list\">"); sb.Append("<div class=\"title-list\">"); sb.Append("<a href=\"viewblog.aspx?blogid=" + post.ID.ToString() + "\">" + HttpUtility.HtmlEncode(post.Title) + "</a>"); sb.Append("</div>"); sb.Append("<div class=\"info-list\">"); sb.Append("<span class=\"caption-list\">" + BlogsResource.PostedTitle + ":</span>"); sb.Append(user.RenderCustomProfileLink("name-list", "link")); sb.Append("</div>"); if (String.IsNullOrEmpty(UserID)) { sb.Append("<div class=\"info-list\">"); sb.Append("<a class=\"link gray-text\" href=\"" + VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath) + "?userid=" + post.UserID + "\">" + BlogsResource.AllRecordsOfTheAutor + "</a>"); sb.Append("</div>"); } sb.Append("<div class=\"date-list\">"); sb.AppendFormat("{0}<span class=\"time-list\">{1}</span>", post.Datetime.ToString("d"), post.Datetime.ToString("t")); sb.Append("</div></div></div>"); sb.Append("<div class=\"content-list\">"); sb.Append(HtmlUtility.GetFull(post.Content, false)); sb.Append("<div id=\"postIndividualLink\" class=\"display-none\">viewblog.aspx?blogid=" + post.ID.ToString() + "</div>"); sb.Append("<div class=\"comment-list\">"); sb.Append("<a href=\"viewblog.aspx?blogid=" + post.ID + "#comments\">" + BlogsResource.CommentsTitle + ": " + commentCount.ToString() + "</a>"); if (!currentUser.IsOutsider()) { sb.Append("<a href=\"viewblog.aspx?blogid=" + post.ID + "#addcomment\">" + BlogsResource.CommentsAddButtonTitle + "</a>"); } sb.Append("</div></div></div>"); placeContent.Controls.Add(new Literal { Text = sb.ToString() }); } placeContent.Controls.Add(new Literal { Text = "</div>" }); }
public string GetPreviewFull(string html) { return(HtmlUtility.GetFull(html)); }
private void ShowBlogDetails(Post post) { if (post == null) { return; } var sb = new StringBuilder(); var user = CoreContext.UserManager.GetUsers(post.UserID); if (IsPreview) { sb.Append("<div style='margin-bottom: 20px'>"); sb.Append("<div id=\"previewTitle\" class='containerHeaderBlock' style='padding: 0 8px;'>" + HttpUtility.HtmlEncode(post.Title) + "</div>"); } else { sb.Append("<div>"); } sb.Append("<table class='MainBlogsTable' cellspacing='0' cellpadding='8' border='0'>"); sb.Append("<tr>"); sb.Append("<td valign='top' class='avatarContainer'>"); sb.Append("<div>" + ImageHTMLHelper.GetHTMLUserAvatar(post.UserID) + "</div>"); sb.Append("</td>"); sb.Append("<td valign='top'>"); sb.Append("<div class=\"author-title describe-text\">" + BlogsResource.PostedTitle + ":</div>"); sb.Append("<div class=\"author-name\">"); sb.AppendFormat("<a class='linkMedium' href=\"{0}\">{1}</a>", user.GetUserProfilePageURL(), user.DisplayUserName()); sb.Append("</div>"); sb.Append("<div>"); sb.AppendFormat("<a class='linkMedium gray-text' href='{0}?userid={1}'>{2}</a>", VirtualPathUtility.ToAbsolute(ASC.Blogs.Core.Constants.BaseVirtualPath), user.ID, BlogsResource.AllRecordsOfTheAutor); sb.Append("</div>"); sb.Append("<div class='describe-text' style='margin-top:10px'>"); sb.AppendFormat("{0}<span style='margin-left:20px'>{1}</span>", post.Datetime.ToString("d"), post.Datetime.ToString("t")); sb.Append("</div>"); if (!IsPreview) { sb.Append("<div id=\"blogActionsMenuPanel\" class=\"studio-action-panel\">"); sb.Append("<ul class=\"dropdown-content\">"); if (CommunitySecurity.CheckPermissions(post, ASC.Blogs.Core.Constants.Action_EditRemovePost)) { sb.Append("<li><a class=\"dropdown-item\" href=\"editblog.aspx?blogid=" + Request.QueryString["blogid"] + "\" >" + BlogsResource.EditBlogLink + "</a></li>"); sb.Append("<li><a class=\"dropdown-item\" onclick=\"javascript:return confirm('" + BlogsResource.ConfirmRemovePostMessage + "');\" href=\"editblog.aspx?blogid=" + Request.QueryString["blogid"] + "&action=delete\" >" + BlogsResource.DeleteBlogLink + "</a></li>"); } sb.Append("</ul>"); sb.Append("</div>"); } sb.Append("</td></tr></table>"); sb.Append("<div id='previewBody' class='longWordsBreak ContentMainBlog'>"); sb.Append(HtmlUtility.GetFull(post.Content)); sb.Append("</div>"); if (!IsPreview) { sb.Append("<div class='clearFix'>"); if (post.TagList.Count > 0) { sb.Append("<div class=\"text-medium-describe TagsMainBlog\">"); sb.Append("<img class=\"TagsImgMainBlog\" src=\"" + WebImageSupplier.GetAbsoluteWebPath("tags.png", BlogsSettings.ModuleID) + "\">"); var j = 0; foreach (var tag in post.TagList) { if (j != 0) { sb.Append(", "); } j++; sb.Append("<a style='margin-left:5px;' class=\"linkMedium gray-text\" href=\"./?tagname=" + HttpUtility.UrlEncode(tag.Content) + "\">" + HttpUtility.HtmlEncode(tag.Content) + "</a>"); } sb.Append("</div>"); } sb.Append("</div>"); } sb.Append("</div>"); ltrContent.Text = sb.ToString(); }
public string GetPreview(string htmltext) { return(HtmlUtility.GetFull(htmltext)); }
public static string GetOneCommentHtml( CommentInfo comment, bool odd, Func <string, string> userProfileLink, string jsObjName, string editCommentLink, string responseCommentLink, string removeCommentLink, string inactiveMessage, string confirmRemoveCommentMessage, string javaScriptRemoveCommentFunctionName, string PID) { var sb = new StringBuilder(); sb.Append("<div class='blockComments " + (odd ? OddClass : EvenClass) + "' id=\"comment_" + comment.CommentID + "\" style='" + (odd ? OddStyle : EvenStyle) + " padding: 8px 5px 8px 15px;'><a name=\"" + comment.CommentID + "\"></a>"); if (comment.Inactive) { sb.AppendFormat("<div style=\"padding:10px;\">{0}</div>", inactiveMessage); } else { sb.Append("<table width='100%' cellpadding=\"0\" style='table-layout:fixed;' cellspacing=\"0\" border=\"0\" >"); sb.Append("<tr><td valign=\"top\" width='90'>"); sb.Append(comment.UserAvatar); sb.Append("</td><td valign=\"top\"><div style=\"min-height:55px;\"><div>"); sb.Append("<a style=\"margin-left:10px;\" class=\"link bold\" href=\"" + userProfileLink(comment.UserID.ToString()) + "\">" + comment.UserFullName + "</a>"); sb.Append(" "); sb.Append("<span class=\"text-medium-describe\" style='padding-left:5px;'>" + (String.IsNullOrEmpty(comment.TimeStampStr) ? comment.TimeStamp.ToLongDateString() : comment.TimeStampStr) + "</span>"); sb.Append("</div>"); if (!string.IsNullOrEmpty(comment.UserPost)) { sb.AppendFormat("<div style=\"padding-top:2px;padding-left:10px;\" class='describe-text'>{0}</div>", comment.UserPost.HtmlEncode()); } sb.AppendFormat("<div id='content_{0}' style='padding-top:8px;padding-left:10px;' class='longWordsBreak'>", comment.CommentID); sb.Append(HtmlUtility.GetFull(comment.CommentBody)); sb.Append("</div>"); if (comment.Attachments != null && comment.Attachments.Count > 0) { sb.Append("<div id='attacments_" + comment.CommentID + "' style=\"padding-top:10px;padding-left:15px;\">"); var k = 0; foreach (var attach in comment.Attachments) { if (k != 0) { sb.Append(", "); } sb.Append("<a class=\"linkDescribe\" href=\"" + attach.FilePath + "\">" + attach.FileName.HtmlEncode() + "</a>"); sb.Append("<input name='attacment_name_" + comment.CommentID + "' type='hidden' value='" + attach.FileName + "' />"); sb.Append("<input name='attacment_path_" + comment.CommentID + "' type='hidden' value='" + attach.FilePath + "' />"); k++; } sb.Append("</div>"); } sb.Append("</div>"); sb.Append("<div clas='clearFix' style=\"margin: 10px 0px 0px 10px; height:19px;\" >"); var drowSplitter = false; if (comment.IsResponsePermissions) { sb.AppendFormat("<div style='float:left;'><a class=\"link dotline gray\" id=\"response_{0}\" href=\"javascript:void(0);\" onclick=\"javascript:CommentsManagerObj.ResponseToComment(this, '{0}');return false;\" >{1}</a></div>", comment.CommentID, responseCommentLink); } sb.Append("<div style='float:right;'>"); if (comment.IsEditPermissions) { sb.AppendFormat("<div style='float:right;'><a class=\"link dotline gray\" id=\"edit_{0}\" href=\"javascript:void(0);\" onclick=\"javascript:CommentsManagerObj.EditComment(this, '{0}');return false;\" >{1}</a>", comment.CommentID, editCommentLink); drowSplitter = true; } if (comment.IsEditPermissions) { if (drowSplitter) { sb.Append("<span class=\"text-medium-describe splitter\"> </span>"); } sb.AppendFormat( "<a class=\"link dotline gray\" id=\"remove_{0}\" href=\"javascript:void(0);\" onclick=\"javascript:AjaxPro.onLoading = function(b){{}}; " + "StudioConfirm.OpenDialog('', function() {{{3}('{0}'," + (String.IsNullOrEmpty(PID) ? "" : "'" + PID + "' ,") + "CommentsManagerObj.callbackRemove)}}); return false;\" >{1}</a>", comment.CommentID, removeCommentLink, confirmRemoveCommentMessage, javaScriptRemoveCommentFunctionName); } sb.Append("</div>"); sb.Append("</div>"); sb.Append("</td></tr></table>"); } sb.Append("</div>"); return(sb.ToString()); }