private Post AddNewBlog(BlogsEngine engine) { Guid authorId = SecurityContext.CurrentAccount.ID; if (CommunitySecurity.CheckPermissions( new PersonalBlogSecObject(CoreContext.UserManager.GetUsers(authorId)), ASC.Blogs.Core.Constants.Action_AddPost)) { Post newPost = new Post(); newPost.Content = _mobileVer? (Request["mobiletext"] ?? "") : FCKeditor.Value; DateTime dateNow = ASC.Core.Tenants.TenantUtil.DateTimeNow(); newPost.Datetime = dateNow; newPost.Title = GetLimitedText(txtTitle.Text); newPost.UserID = authorId; newPost.TagList = new List <ASC.Blogs.Core.Domain.Tag>(); foreach (string tagName in txtTags.Text.Split(',')) { if (tagName != string.Empty && !IsExistsTagName(newPost, tagName)) { ASC.Blogs.Core.Domain.Tag tag = new ASC.Blogs.Core.Domain.Tag(); tag.Content = GetLimitedText(tagName.Trim()); newPost.TagList.Add(tag); } } var blog = engine.EnsurePersonalBlog(authorId); engine.SavePost(newPost, true, Request.Form["notify_comments"] == "on"); CommonControlsConfigurer.FCKEditingComplete("blogs", newPost.ID.ToString(), newPost.Content, false); return(newPost); } else { Response.Redirect("addblog.aspx"); return(null); } }
public void UpdatePost(Post post, BlogsEngine engine) { post.Title = GetLimitedText(txtTitle.Text); post.Content = (Request["blog_text"] ?? ""); post.TagList = new List<Tag>(); foreach (var tagName in txtTags.Text.Split(',')) { if (tagName == string.Empty || IsExistsTagName(post, tagName)) continue; var tag = new Tag(post) { Content = GetLimitedText(tagName.Trim()) }; post.TagList.Add(tag); } engine.SavePost(post, false, false); CommonControlsConfigurer.FCKEditingComplete("blogs", post.ID.ToString(), post.Content, true); Response.Redirect("viewblog.aspx?blogid=" + post.ID.ToString()); }
private Post AddNewBlog(BlogsEngine engine) { var authorId = SecurityContext.CurrentAccount.ID; if (CommunitySecurity.CheckPermissions( new PersonalBlogSecObject(CoreContext.UserManager.GetUsers(authorId)), Constants.Action_AddPost)) { var newPost = new Post { Content = (Request["mobiletext"] ?? "") }; var dateNow = ASC.Core.Tenants.TenantUtil.DateTimeNow(); newPost.Datetime = dateNow; newPost.Title = GetLimitedText(txtTitle.Text); newPost.UserID = authorId; newPost.TagList = new List<Tag>(); foreach (var tagName in txtTags.Text.Split(',')) { if (tagName == string.Empty || IsExistsTagName(newPost, tagName)) continue; var tag = new Tag { Content = GetLimitedText(tagName.Trim()) }; newPost.TagList.Add(tag); } engine.SavePost(newPost, true, Request.Form["notify_comments"] == "on"); CommonControlsConfigurer.FCKEditingComplete("blogs", newPost.ID.ToString(), newPost.Content, false); return newPost; } Response.Redirect("addblog.aspx"); return null; }
public void UpdatePost(Post post, BlogsEngine engine) { post.Title = GetLimitedText(txtTitle.Text); post.Content = _mobileVer ? (Request["mobiletext"]??"") : FCKeditor.Value; post.TagList = new List<Tag>(); foreach (string tagName in txtTags.Text.Split(',')) { if (tagName != string.Empty && !IsExistsTagName(post, tagName)) { Tag tag = new Tag(post); tag.Content = GetLimitedText(tagName.Trim()); post.TagList.Add(tag); } } engine.SavePost(post,false,false); CommonControlsConfigurer.FCKEditingComplete("blogs", post.ID.ToString(), post.Content, true); Response.Redirect("viewblog.aspx?blogid=" + post.ID.ToString()); }