public void Create() { BlogPost data = new BlogPost(); BlogCategory category = new BlogCategory(); category.Id = ctx.PostInt("CategoryId"); data.Category = category; data.Title = ctx.Post("Title"); data.Abstract = ctx.Post("Abstract"); data.Content = ctx.PostHtml("Content"); if (category.Id <= 0) { errors.Add(lang("exUnCategoryTip")); } if (strUtil.IsNullOrEmpty(data.Content)) { errors.Add(lang("exContent")); } if (ctx.HasErrors) { echoError(); return; } if (ctx.PostIsCheck("saveContentPic") == 1) { data.Content = wojilu.Net.PageLoader.ProcessPic(data.Content, null); } if (strUtil.IsNullOrEmpty(data.Title)) { data.Title = getDefaultTitle(); } data.AccessStatus = (int)AccessStatusUtil.GetPostValue(ctx.PostInt("AccessStatus")); data.CommentCondition = cvt.ToInt(ctx.Post("IsCloseComment")); data.SaveStatus = 0; String tagStr = strUtil.SubString(ctx.Post("TagList"), 200); data.Tags = TagService.ResetRawTagString(tagStr); populatePost(data); // 附件处理 int[] ids = cvt.ToIntArray(ctx.Post("attachmentIds")); Result result = postService.Insert(data, ids); if (result.IsValid) { echoRedirectPart(lang("opok"), to(new MyListController().Index)); } else { echoError(result); } }
private void bindEditInfo(long postId, ContentPost post) { set("section.Name", post.SectionName); set("section.Id", post.SectionId); set("post.Author", post.Author); set("post.SourceLink", post.SourceLink); set("post.Style", post.Style); set("post.OrderId", post.OrderId); set("post.Content", post.Content); set("post.Created", post.Created); set("post.Hits", post.Hits); set("post.OrderId", post.OrderId); set("post.RedirectUrl", post.RedirectUrl); set("post.MetaKeywords", post.MetaKeywords); set("post.MetaDescription", post.MetaDescription); set("post.Summary", post.Summary); set("post.SourceLink", post.SourceLink); set("post.Style", post.Style); set("post.TagList", post.Tag.TextString); String val = AccessStatusUtil.GetRadioList(post.AccessStatus); set("post.AccessStatus", val); set("post.IsCloseComment", Html.CheckBox("IsCloseComment", lang("closeComment"), "1", cvt.ToBool(post.CommentCondition))); }
private void bindEditInfo(ContentPost post) { set("post.DeleteUrl", to(Delete, post.Id)); set("post.Author", post.Author); set("post.Title", post.Title); set("post.TitleHome", strUtil.EncodeTextarea(post.TitleHome)); set("post.Width", post.Width); set("post.Height", post.Height); editor("Content", post.Content, "250px"); set("post.Created", post.Created); set("post.Hits", post.Hits); set("post.OrderId", post.OrderId); set("post.RedirectUrl", post.RedirectUrl); set("post.MetaKeywords", post.MetaKeywords); set("post.MetaDescription", post.MetaDescription); set("post.Summary", post.Summary); set("post.SourceLink", post.SourceLink); set("post.Style", post.Style); set("post.TagList", post.Tag.TextString); String val = AccessStatusUtil.GetRadioList(post.AccessStatus); set("post.AccessStatus", val); set("post.IsCloseComment", Html.CheckBox("IsCloseComment", lang("closeComment"), "1", cvt.ToBool(post.CommentCondition))); radioList("PickStatus", PickStatus.GetPickStatus(), post.PickStatus.ToString()); }
private void bindEdit(BlogPost data, List <BlogCategory> categories) { dropList("CategoryId", categories, "Name=Id", data.Category.Id); set("data.Id", data.Id); set("data.Abstract", data.Abstract); set("data.TagList", data.Tag.TextString); set("data.Title", data.Title); set("Content", data.Content); set("data.AccessStatus", AccessStatusUtil.GetRadioList(data.AccessStatus)); set("data.IsCloseComment", Html.CheckBox("IsCloseComment", lang("closeComment"), "1", cvt.ToBool(data.CommentCondition))); }
public void SavePermission(int id) { Boolean isUserPrivacyClose = Component.IsClose(typeof(UserPrivacy)); if (isUserPrivacyClose) { echo("对不起,本功能已经停用"); return; } //--------------------------------------------------------- AccessStatus accs = AccessStatusUtil.GetPostValue(ctx.PostInt("AccessStatus")); IMemberApp app = userAppService.FindById(id, ctx.owner.Id); userAppService.UpdateAccessStatus(app, accs); echoToParentPart(lang("opok")); }
private void bindDraftEdit(BlogPost data) { List <BlogCategory> categories = categoryService.GetByApp(ctx.app.Id); dropList("CategoryId", categories, "Name=Id", data.Category.Id); set("data.Id", data.Id); set("data.Abstract", data.Abstract); set("data.TagList", data.Tag.TextString); set("data.Title", data.Title); set("Content", data.Content); set("data.AccessStatus", AccessStatusUtil.GetRadioList(data.AccessStatus)); set("data.IsCloseComment", Html.CheckBox("IsCloseComment", lang("closeComment"), "1", cvt.ToBool(data.CommentCondition))); set("draftActionUrl", to(SaveDraft)); }
public void EditPermission(int id) { Boolean isUserPrivacyClose = Component.IsClose(typeof(UserPrivacy)); if (isUserPrivacyClose) { echo("对不起,本功能已经停用"); return; } //--------------------------------------------------------- target(SavePermission, id); IMemberApp app = userAppService.FindById(id, ctx.owner.Id); AppInstaller info = getAppInfo(app.AppInfoId); bindAppInfo(info); set("app.FriendlyName", app.Name); set("app.AccessStatus", AccessStatusUtil.GetRadioList(app.AccessStatus)); }
public void Create() { BlogPost data = new BlogPost(); BlogCategory category = new BlogCategory(); category.Id = ctx.PostInt("CategoryId"); data.Category = category; data.Title = ctx.Post("Title"); data.Content = Regex.Replace(ctx.PostHtml("Content"), "font-size", "", RegexOptions.IgnoreCase); data.Abstract = ctx.Post("Abstract"); if (category.Id <= 0) { errors.Add(lang("exUnCategoryTip")); } if (strUtil.IsNullOrEmpty(data.Content)) { errors.Add(lang("exContent")); } if (ctx.HasErrors) { echoError(); return; } //if (ctx.PostIsCheck( "saveContentPic" ) == 1) { // // data.Content = wojilu.Net.PageLoader.ProcessPic( data.Content, null ); // data.IsPick = 1; //} //if (ctx.PostIsCheck("IsTop") == 1) //{ // //post.Content = wojilu.Net.PageLoader.ProcessPic( post.Content, null ); // data.IsTop = 1; //} if (ctx.PostIsCheck("IsRecommend") == 1) { //post.Content = wojilu.Net.PageLoader.ProcessPic( post.Content, null ); data.IsPic = 1; } if (strUtil.IsNullOrEmpty(data.Title)) { data.Title = getDefaultTitle(); } data.AccessStatus = (int)AccessStatusUtil.GetPostValue(ctx.PostInt("AccessStatus")); data.CommentCondition = cvt.ToInt(ctx.Post("IsCloseComment")); data.SaveStatus = 0; String tagStr = strUtil.SubString(ctx.Post("TagList"), 200); data.Tags = TagService.ResetRawTagString(tagStr); populatePost(data); Result result = postService.Insert(data); if (result.IsValid) { echoRedirectPart(lang("opok"), to(new MyListController().Index), 1); } else { echoError(result); } }