Esempio n. 1
0
        public void SaveVideo(int sectionId)
        {
            if (shouldApprove(ctx.viewer.obj))
            {
                saveTempPost(sectionId, typeof(ContentVideo));
                if (ctx.HasErrors)
                {
                    echoError();
                }
                return;
            }

            ContentPost post = ContentValidator.Validate(sectionService.GetById(sectionId, ctx.app.Id), ctx);

            ContentValidator.ValidateVideo(post, ctx);

            if (ctx.HasErrors)
            {
                run(SubmitVideo, sectionId);
            }
            else
            {
                postService.Insert(post, ctx.Post("TagList"));

                echoRedirect("发布成功,谢谢", to(new ContentController().Index));
            }
        }
Esempio n. 2
0
        public void SavePost(int sectionId)
        {
            if (shouldApprove(ctx.viewer.obj))
            {
                saveTempPost(sectionId, null);
                if (ctx.HasErrors)
                {
                    echoError();
                }
                return;
            }

            ContentPost post = ContentValidator.Validate(sectionService.GetById(sectionId, ctx.app.Id), ctx);

            ContentValidator.ValidateArticle(post, ctx);

            if (strUtil.HasText(post.ImgLink))
            {
                post.CategoryId = PostCategory.Img;
                post.Width      = 100;
                post.Height     = 85;
            }

            if (ctx.HasErrors)
            {
                run(SubmitPost, sectionId);
            }
            else
            {
                postService.Insert(post, ctx.Post("TagList"));

                echoRedirect("发布成功,谢谢", to(new ContentController().Index));
            }
        }
Esempio n. 3
0
        //--------------------------------------------------------------------------------------------------------


        public void Create()
        {
            ContentPost post = ContentValidator.Validate(ctx);

            ContentValidator.ValidateArticle(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), 1);
            }
            else
            {
                echoToParentPart(lang("opok"));
            }
        }
Esempio n. 4
0
        public void Create(int sectionId)
        {
            ContentPost post = ContentValidator.Validate(sectionService.GetById(sectionId, ctx.app.Id), ctx);

            ContentValidator.ValidateVideo(post, ctx);
            if (ctx.HasErrors)
            {
                run(Add, sectionId);
            }
            else
            {
                postService.Insert(post, null);

                echoToParentPart(lang("opok"));
            }
        }
Esempio n. 5
0
        public void Create(int sectionId)
        {
            ContentPost post = ContentValidator.Validate(sectionService.GetById(sectionId, ctx.app.Id), ctx);

            if (strUtil.IsNullOrEmpty(post.Content))
            {
                errors.Add(lang("exContent"));
                run(Add, sectionId);
            }
            else
            {
                post.CategoryId = PostCategory.Notice;

                postService.Insert(post, null);

                echoToParentPart(lang("opok"));
            }
        }
Esempio n. 6
0
        public void CreateListInfo(int sectionId)
        {
            ContentPost post = ContentValidator.Validate(sectionService.GetById(sectionId, ctx.app.Id), ctx);

            if (strUtil.IsNullOrEmpty(post.Title))
            {
                errors.Add(lang("exTitle"));
                run(AddListInfo, sectionId);
            }
            else
            {
                post.CategoryId = PostCategory.Img;
                post.TypeName   = typeof(ContentImg).FullName;
                post.HasImgList = 1;

                postService.Insert(post, null);

                redirect(AddImgList, post.Id);
            }
        }