Пример #1
0
        public virtual void NoPass(long id)
        {
            target(SaveNoPass, id);
            ContentTempPost p = tempPostService.GetById(id);

            bind("post", p);
        }
Пример #2
0
        public void Pass(int id)
        {
            target(SavePass, id);
            ContentTempPost p = tempPostService.GetById(id);

            bind("post", p);
        }
Пример #3
0
        private void sendNoPassMsg(String desc, ContentTempPost p)
        {
            string title = string.Format("您投递的 “{0}” 没有通过审核", p.Title);
            String msg   = string.Format("对不起,您投递的 “{0}” 没有通过审核", p.Title) + "<br/>审核说明:" + desc;

            msgService.SiteSend(title, msg, p.Creator);
        }
Пример #4
0
        private ContentPost passSinglePost(ContentTempPost p)
        {
            ContentPost post = tempPostService.GetBySubmitPost(p, ctx.owner.obj);

            postService.Insert(post, p.TagList);

            tempPostService.Delete(p);

            sendPassNotification(post);
            return(post);
        }
Пример #5
0
        private static bool articleExist(SpiderArticle spiderArticle)
        {
            logger.Info("articleExist=" + spiderArticle.Url);
            ContentPost post = ContentPost.find("OutUrl=:url").set("url", spiderArticle.Url).first();

            if (post != null)
            {
                return(true);
            }
            return(ContentTempPost.find("SourceLink=:url").set("url", spiderArticle.Url).first() != null);
        }
Пример #6
0
 private bool hasViewPermission(ContentTempPost p)
 {
     if (hasAdminPermission())
     {
         return(true);
     }
     if (ctx.viewer.obj.Id == p.Creator.Id)
     {
         return(true);
     }
     return(false);
 }
Пример #7
0
        public void Delete(int id)
        {
            ContentTempPost p = tpostService.GetById(id);

            if (p == null)
            {
                echoError(lang("exDataNotFound"));
                return;
            }

            tpostService.Delete(p);

            redirect();
        }
Пример #8
0
        public virtual void SaveNoPass(long id)
        {
            String          desc = ctx.Post("msg");
            ContentTempPost p    = tempPostService.GetById(id);

            if (p == null)
            {
                echoError(lang("exDataNotFound"));
                return;
            }
            tempPostService.NoPass(p);

            sendNoPassMsg(desc, p);

            echoToParentPart(lang("opok"));
        }
Пример #9
0
        private void saveTempPost(int sectionId, Type postType)
        {
            ContentTempPost post = new ContentTempPost();

            post.Creator   = (User)ctx.viewer.obj;
            post.OwnerId   = ctx.owner.Id;
            post.OwnerType = ctx.owner.obj.GetType().FullName;
            post.AppId     = ctx.app.Id;
            post.SectionId = sectionId;

            post.Title = ctx.Post("Title");
            if (postType != null)
            {
                post.TypeName = postType.FullName;
            }

            post.Author     = ctx.Post("Author");
            post.SourceLink = ctx.Post("SourceLink");
            post.Content    = ctx.PostHtml("Content");
            post.Summary    = ctx.Post("Summary");
            post.ImgLink    = sys.Path.GetPhotoRelative(ctx.Post("ImgLink"));
            post.TagList    = ctx.Post("TagList");

            post.Ip = ctx.Ip;

            if (strUtil.IsNullOrEmpty(post.Title))
            {
                errors.Add(lang("exTitle"));
            }

            if (strUtil.IsNullOrEmpty(post.Content) && strUtil.IsNullOrEmpty(post.SourceLink))
            {
                errors.Add(alang("exContentLink"));
            }

            if (ctx.HasErrors)
            {
                return;
            }


            tempPostService.Insert(post);

            echoRedirect("投递成功", to(new MyListController().Index));
        }
Пример #10
0
        public void Show(int id)
        {
            ContentTempPost p = tempPostService.GetById(id);

            if (p == null)
            {
                echo(lang("exDataNotFound"));
                return;
            }

            if (hasViewPermission(p) == false)
            {
                echo("对不起,你没有查看的权限");
                return;
            }

            bind("p", p);
        }
Пример #11
0
        private void passPosts(string ids)
        {
            int[] arrId = cvt.ToIntArray(ids);
            if (arrId.Length == 0)
            {
                return;
            }
            foreach (int id in arrId)
            {
                ContentTempPost p = tempPostService.GetById(id);
                if (p == null)
                {
                    continue;
                }

                passSinglePost(p);
            }
        }
Пример #12
0
        public virtual void SavePass(long id)
        {
            String          msg = ctx.Post("msg");
            ContentTempPost p   = tempPostService.GetById(id);

            if (p == null)
            {
                echoError(lang("exDataNotFound"));
                return;
            }

            ContentPost post = passSinglePost(p);
            String      lnk  = alink.ToAppData(post);

            HtmlHelper.SetPostToContext(ctx, post);

            echoToParentPart(lang("opok"));
        }
Пример #13
0
        private static int importToTemp(SpiderArticle art, SpiderImport item, ContentSection section, ContentApp app)
        {
            ContentTempPost post = new ContentTempPost();

            post.Creator   = item.Creator;
            post.OwnerId   = app.OwnerId;
            post.OwnerType = app.OwnerType;
            post.AppId     = app.Id;
            post.SectionId = section.Id;

            post.Title      = art.Title;
            post.SourceLink = art.Url;
            post.Content    = art.Body;

            post.insert();

            return(post.Id);
        }
Пример #14
0
        public void SaveNoPass(int id)
        {
            String          msg = ctx.Post("msg");
            ContentTempPost p   = tempPostService.GetById(id);

            if (p == null)
            {
                echoError(lang("exDataNotFound"));
                return;
            }
            tempPostService.NoPass(p);

            string title = string.Format("您投递的 “{0}” 没有通过审核", p.Title);

            msg = string.Format("对不起,您投递的 “{0}” 没有通过审核", p.Title) + "<br/>审核说明:" + msg;
            sendMsg(title, msg, p.Creator);

            echoToParentPart(lang("opok"));
        }
        public ContentPost GetBySubmitPost(ContentTempPost p, IMember owner)
        {
            ContentPost post = new ContentPost();

            post.Creator    = p.Creator;
            post.CreatorUrl = p.Creator.Url;
            post.OwnerId    = owner.Id;
            post.OwnerType  = owner.GetType().FullName;
            post.OwnerUrl   = owner.Url;
            post.AppId      = p.AppId;

            ContentSection section = new ContentSection();

            section.Id       = p.SectionId;
            post.PageSection = section;

            post.Title    = p.Title;
            post.TypeName = p.TypeName;


            post.Author     = p.Author;
            post.SourceLink = p.SourceLink;
            post.Content    = p.Content;
            post.Summary    = strUtil.CutString(p.Summary, 250);
            post.ImgLink    = p.ImgLink;

            if (typeof(ContentVideo).FullName.Equals(post.TypeName))
            {
                post.CategoryId = PostCategory.Video;
            }
            else if (strUtil.HasText(post.ImgLink))
            {
                post.CategoryId = PostCategory.Img;
                post.Width      = 100;
                post.Height     = 85;
            }

            post.Ip = p.Ip;

            return(post);
        }
Пример #16
0
        public void SavePass(int id)
        {
            String          msg = ctx.Post("msg");
            ContentTempPost p   = tempPostService.GetById(id);

            if (p == null)
            {
                echoError(lang("exDataNotFound"));
                return;
            }

            ContentPost post = passSinglePost(p);
            String      lnk  = alink.ToAppData(post);

            string title = string.Format("你投递的 “{0}” 通过审核", p.Title);

            msg = string.Format("谢谢您的投递,你的 “<a href=\"{0}\">{1}</a>” 已通过审核。", lnk, p.Title) + "<br/>审核说明:" + msg;
            sendMsg(title, msg, p.Creator);

            echoToParentPart(lang("opok"));
        }
        public ContentPost GetBySubmitPost( ContentTempPost p, IMember owner )
        {
            ContentPost post = new ContentPost();

            post.Creator = p.Creator;
            post.CreatorUrl = p.Creator.Url;
            post.OwnerId = owner.Id;
            post.OwnerType = owner.GetType().FullName;
            post.OwnerUrl = owner.Url;
            post.AppId = p.AppId;

            ContentSection section = new ContentSection();
            section.Id = p.SectionId;
            post.PageSection = section;

            post.Title = p.Title;
            post.TypeName = p.TypeName;

            post.Author = p.Author;
            post.SourceLink = p.SourceLink;
            post.Content = p.Content;
            post.Summary = strUtil.CutString( p.Summary, 250 );
            post.ImgLink = p.ImgLink;

            if (typeof( ContentVideo ).FullName.Equals( post.TypeName )) {
                post.CategoryId = PostCategory.Video;
            }
            else if (strUtil.HasText( post.ImgLink )) {
                post.CategoryId = PostCategory.Img;
                post.Width = 100;
                post.Height = 85;
            }

            post.Ip = p.Ip;

            return post;
        }
Пример #18
0
        private void passPosts(string ids)
        {
            int[] arrId = cvt.ToIntArray(ids);
            if (arrId.Length == 0)
            {
                return;
            }

            List <ContentPost> xList = new List <ContentPost>();

            foreach (int id in arrId)
            {
                ContentTempPost p = tempPostService.GetById(id);
                if (p == null)
                {
                    continue;
                }

                ContentPost x = passSinglePost(p);
                xList.Add(x);
            }

            HtmlHelper.SetPostListToContext(ctx, xList);
        }
Пример #19
0
        private void saveTempPost( long sectionId, Type postType ) {

            ContentTempPost post = new ContentTempPost();
            post.Creator = (User)ctx.viewer.obj;
            post.OwnerId = ctx.owner.Id;
            post.OwnerType = ctx.owner.obj.GetType().FullName;
            post.AppId = ctx.app.Id;
            post.SectionId = sectionId;

            post.Title = ctx.Post( "Title" );
            if (postType != null)
                post.TypeName = postType.FullName;

            post.Author = ctx.Post( "Author" );
            post.SourceLink = ctx.Post( "SourceLink" );
            post.Content = ctx.PostHtml( "Content" );
            post.Summary = ctx.Post( "Summary" );
            post.ImgLink = sys.Path.GetPhotoRelative( ctx.Post( "ImgLink" ) );
            post.TagList = ctx.Post( "TagList" );

            post.Ip = ctx.Ip;

            if (strUtil.IsNullOrEmpty( post.Title ))
                errors.Add( lang( "exTitle" ) );

            if (strUtil.IsNullOrEmpty( post.Content ) && strUtil.IsNullOrEmpty( post.SourceLink ))
                errors.Add( alang( "exContentLink" ) );

            if (ctx.HasErrors) return;


            tempPostService.Insert( post );

            echoRedirect( "投递成功", to( new MyListController().Index ) );

        }
Пример #20
0
 private bool hasViewPermission( ContentTempPost p ) {
     if (hasAdminPermission()) return true;
     if (ctx.viewer.obj.Id == p.Creator.Id) return true;
     return false;
 }
 public void NoPass( ContentTempPost p )
 {
     p.Status = PostSubmitStatus.Deleted;
     p.update( "Status" );
 }
        public int GetSubmitCount(int creatorId, IMember owner, int appId)
        {
            String condition = string.Format("CreatorId={0} and AppId={1} and OwnerId={2} and OwnerType='{3}' ", creatorId, appId, owner.Id, owner.GetType().FullName);

            return(ContentTempPost.count(condition));
        }
 public void Delete( ContentTempPost post )
 {
     post.delete();
 }
 public void Delete(ContentTempPost post)
 {
     post.delete();
 }
Пример #25
0
        private ContentPost passSinglePost( ContentTempPost p ) {
            ContentPost post = tempPostService.GetBySubmitPost( p, ctx.owner.obj );
            postService.Insert( post, p.TagList );

            tempPostService.Delete( p );

            sendPassNotification( post );
            return post;
        }
 public void NoPass(ContentTempPost p)
 {
     p.Status = PostSubmitStatus.Deleted;
     p.update("Status");
 }
 public void NoPass(string ids)
 {
     ContentTempPost.updateBatch("set Status=" + PostSubmitStatus.Deleted, "Id in (" + ids + ")");
 }
Пример #28
0
 public virtual ContentTempPost GetById(long id)
 {
     return(ContentTempPost.findById(id));
 }
 public Result Insert( ContentTempPost post )
 {
     return post.insert();
 }
Пример #30
0
        public virtual int CountByCreator(long creatorId, IMember owner, long appId)
        {
            String condition = string.Format("CreatorId={0} and AppId={1} and OwnerId={2} and OwnerType='{3}' ", creatorId, appId, owner.Id, owner.GetType().FullName);

            return(ContentTempPost.count(condition));
        }
 public Result Insert(ContentTempPost post)
 {
     return(post.insert());
 }
        public DataPage <ContentTempPost> GetByCreator(int creatorId, IMember owner, int appId)
        {
            String condition = string.Format("CreatorId={0} and AppId={1} and OwnerId={2} and OwnerType='{3}' ", creatorId, appId, owner.Id, owner.GetType().FullName);

            return(ContentTempPost.findPage(condition));
        }
Пример #33
0
        private static int importToTemp( SpiderArticle art, SpiderImport item, ContentSection section, ContentApp app )
        {
            ContentTempPost post = new ContentTempPost();
            post.Creator = item.Creator;
            post.OwnerId = app.OwnerId;
            post.OwnerType = app.OwnerType;
            post.AppId = app.Id;
            post.SectionId = section.Id;

            post.Title = art.Title;
            post.SourceLink = art.Url;
            post.Content = art.Body;

            post.insert();

            return post.Id;
        }
        public DataPage <ContentTempPost> GetPage(IMember owner, int appId)
        {
            String condition = string.Format("AppId={0} and OwnerId={1} and OwnerType='{2}' and Status={3}", appId, owner.Id, owner.GetType().FullName, PostSubmitStatus.Normal);

            return(ContentTempPost.findPage(condition));
        }
 public ContentTempPost GetById(int id)
 {
     return(ContentTempPost.findById(id));
 }
Пример #36
0
 private void sendNoPassMsg( String desc, ContentTempPost p ) {
     string title = string.Format( "您投递的 “{0}” 没有通过审核", p.Title );
     String msg = string.Format( "对不起,您投递的 “{0}” 没有通过审核", p.Title ) + "<br/>审核说明:" + desc;
     msgService.SiteSend( title, msg, p.Creator );
 }
Пример #37
0
        public virtual int GetSubmitCount(IMember owner, long appId)
        {
            String condition = string.Format("AppId={0} and OwnerId={1} and OwnerType='{2}' and Status={3}", appId, owner.Id, owner.GetType().FullName, PostSubmitStatus.Normal);

            return(ContentTempPost.count(condition));
        }