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.SetValueBySection(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.SetValueBySection(sectionService.GetById(sectionId, ctx.app.Id), ctx);

            ContentValidator.ValidateTitleBody(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 virtual void Create(long sectionId)
        {
            ContentSection section = sectionService.GetById(sectionId, ctx.app.Id);

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

            if (strUtil.IsNullOrEmpty(post.Title))
            {
                post.Title = section.Title + " " + DateTime.Now.ToShortDateString();
            }

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

                postService.Insert(post, null);

                echoToParentPart(lang("opok"));
                HtmlHelper.SetPostToContext(ctx, post);
            }
        }
Esempio n. 4
0
        public virtual void Create(long sectionId)
        {
            ContentPost post = ContentValidator.SetValueBySection(sectionService.GetById(sectionId, ctx.app.Id), ctx);

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

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

            ContentValidator.ValidateTalk(post, ctx);
            if (errors.HasErrors)
            {
                run(Add, sectionId);
            }
            else
            {
                post.CategoryId = PostCategory.Talk;
                post.Title      = strUtil.SubString(post.Content, 20);

                postService.Insert(post, ctx.Post("TagList"));

                echoToParentPart(lang("opok"));
                HtmlHelper.SetPostToContext(ctx, post);
            }
        }
Esempio n. 6
0
        public void CreateListInfo(int sectionId)
        {
            ContentPost post = ContentValidator.SetValueBySection(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);
                HtmlHelper.SetPostToContext(ctx, post);
            }
        }