//-------------------------------------------------------------------------------------------------------- public void Create() { ContentPost post = ContentValidator.SetValue(ctx); ContentValidator.ValidateTitleBody(post, ctx); String sectionIds = ctx.PostIdList("postSection"); if (strUtil.IsNullOrEmpty(sectionIds)) { errors.Add("请选择区块"); } int[] arrAttachmentIds = cvt.ToIntArray(ctx.PostIdList("attachmentIds")); // 图片默认值处理 if (strUtil.HasText(post.ImgLink)) { if (post.Width <= 0) { post.Width = 100; post.Height = 85; } } if (ctx.HasErrors) { echoError(); return; } // 处理远程图片 if (ctx.PostIsCheck("isDowloadPic") == 1) { post.Content = wojilu.Net.PageLoader.ProcessPic(post.Content, ""); } postService.Insert(post, sectionIds, ctx.Post("TagList")); attachService.UpdateAtachments(arrAttachmentIds, post); if (ctx.GetInt("fromList") > 0) { echoRedirectPart(lang("opok"), to(List, 0), 1); } else { echoToParentPart(lang("opok")); } HtmlHelper.SetPostToContext(ctx, post); }
public void Create(int sectionId) { ContentPost post = ContentValidator.SetValue(ctx); ContentPoll poll = new PollValidator <ContentPoll>().Validate(ctx); if (errors.HasErrors) { echoError(); return; } pollService.CreatePoll(sectionId, poll, post, ctx.Post("TagList")); echoToParentPart(lang("opok")); HtmlHelper.SetPostToContext(ctx, post); }