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); } }
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")); }
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); } }