Example #1
0
        public void bindSettings( BlogSetting s )
        {
            Dictionary<String, String> dic = new Dictionary<string, string>();

            String chk = "checked=\"checked\"";

            set( "s.AllowComment", s.AllowComment == 1 ? chk : "" );
            set( "s.AllowAnonymousComment", s.AllowAnonymousComment == 1 ? chk : "" );
            set( "s.IsShowStats", s.IsShowStats == 1 ? chk : "" );

            set( "s.PerPageBlogs", dropList( "PerPageBlogs", 3, 20, s.PerPageBlogs ) );
            set( "s.StickyCount", dropList( "StickyCount", 1, 20, s.StickyCount ) );

            set( "s.NewBlogCount", dropList( "NewBlogCount", 3, 20, s.NewBlogCount ) );
            set( "s.NewCommentCount", dropList( "NewCommentCount", 3, 20, s.NewCommentCount ) );
            set( "s.RssCount", dropList( "RssCount", 5, 20, s.RssCount ) );

            set( "s.ListModeFull", s.ListMode == BlogListMode.Full ? chk : "" );
            set( "s.ListModeAbstract", s.ListMode == BlogListMode.Abstract ? chk : "" );

            String[] options = new String[] {
                "100", "200", "300", "500", "600", "800", "1000", "1200", "1500", "2000", "3000"
            };
            radioList( "blogSetting.ListAbstractLength", options, s.ListAbstractLength );
        }
Example #2
0
        private void bindPostOne( IBlock listBlock, BlogPost post, BlogSetting s )
        {
            String status = string.Empty;
            if (post.IsTop == 1) status = "<span class=\"lblTop\">[" + lang( "sticky" ) + "]</span>";
               // if (post.IsPick == 1) status = status + "<span class=\"lblTop\">[" + lang( "picked" ) + "]</span>";

            listBlock.Set( "blogpost.Status", status );
            listBlock.Set( "blogpost.Title", post.Title );
            listBlock.Set( "blogpost.Url", alink.ToAppData( post ) );

            String body = s.ListMode == BlogListMode.Full ? post.Content : strUtil.ParseHtml( post.Content, 300 );
            listBlock.Set( "blogpost.Body", body );

            listBlock.Set( "author", ctx.owner.obj.Name );
            listBlock.Set( "authroUrl", Link.ToMember( ctx.owner.obj ) );
            listBlock.Set( "blogpost.CreateTime", post.Created.ToShortTimeString() );
            listBlock.Set( "blogpost.CreateDate", post.Created.ToShortDateString() );
            listBlock.Set( "blogpost.Hits", post.Hits );
            listBlock.Set( "blogpost.ReplyCount", post.Replies );
            listBlock.Set( "blogpost.EditUrl", to(new Admin.PostController().Edit, post.Id));
            if (ctx.viewer.IsLogin && (ctx.viewer.Id == ctx.owner.Id))
            {
                listBlock.Set("EditUrlStyle", "");

            }
            else
            {
                listBlock.Set("EditUrlStyle", "display:none");

            }
        }
Example #3
0
        private void bindPostOne( IBlock listBlock, BlogPost post, BlogSetting s ) {

            String status = string.Empty;
            if (post.IsTop == 1) status = "<span class=\"lblTop\">[" + lang( "sticky" ) + "]</span>";
            if (post.IsPick == 1) status = status + "<span class=\"lblTop\">[" + lang( "picked" ) + "]</span>";
            if (post.AttachmentCount > 0) {
                status = status + string.Format( "<span><img src=\"{0}\"/></span>", strUtil.Join( sys.Path.Img, "attachment.gif" ) );
            }

            String postLink = alink.ToAppData( post );

            listBlock.Set( "blogpost.Status", status );
            listBlock.Set( "blogpost.Title", post.Title );
            listBlock.Set( "blogpost.Url", postLink );

            String body = s.ListMode == BlogListMode.Full ? post.Content : strUtil.ParseHtml( post.Content, s.ListAbstractLength );
            listBlock.Set( "blogpost.Body", body );
            listBlock.Set( "author", ctx.owner.obj.Name );
            listBlock.Set( "authroUrl", Link.ToMember( ctx.owner.obj ) );
            listBlock.Set( "blogpost.CreateTime", post.Created.ToShortTimeString() );
            listBlock.Set( "blogpost.CreateDate", post.Created.ToShortDateString() );
            listBlock.Set( "blogpost.Hits", post.Hits );

            String replies = post.Replies > 0 ?
                string.Format( "<a href=\"{0}\">{1}(<span class=\"blogItemReviews\">{2}</span>)</a>", postLink + "#comments", lang( "comment" ), post.Replies ) :
                string.Format( "<a href=\"{0}\">发表评论</a>", postLink + "#comments" );
            listBlock.Set( "blogpost.ReplyCount", replies );


            listBlock.Set( "blogpost.CategoryName", post.Category.Name );
            listBlock.Set( "blogpost.CategoryLink", to( new CategoryController().Show, post.Category.Id ) );

            String tags = post.Tag.List.Count > 0 ? "tag:" + post.Tag.HtmlString : "";
            listBlock.Set( "blogpost.TagList", tags );
        }
Example #4
0
 private void bindPosts( DataPage<BlogPost> results, BlogSetting s ) {
     IBlock listBlock = getBlock( "bloglist" );
     foreach (BlogPost post in results.Results) {
         bindPostOne( listBlock, post, s );
         listBlock.Next();
     }
 }
Example #5
0
 private void bindTopPosts( BlogSetting s, IBlock block ) {
     List<BlogPost> top = postService.GetTop( ctx.app.Id, s.StickyCount );
     foreach (BlogPost post in top) {
         bindPostOne( block, post, s );
         block.Next();
     }
 }
Example #6
0
        public BlogSetting GetSettingsObj()
        {
            if (strUtil.IsNullOrEmpty(this.Settings))
            {
                return(new BlogSetting());
            }
            BlogSetting s = Json.Deserialize <BlogSetting>(this.Settings);

            s.SetDefaultValue();
            return(s);
        }
Example #7
0
        public BlogSetting GetSettingsObj()
        {
            if (strUtil.IsNullOrEmpty(this.Settings))
            {
                return(new BlogSetting());
            }
            BlogSetting s = JSON.ToObject <BlogSetting>(this.Settings);

            s.SetDefaultValue();
            return(s);
        }
Example #8
0
        public void bindSettings( BlogSetting s )
        {
            Dictionary<String, String> dic = new Dictionary<string, string>();

            String chk = "checked=\"checked\"";

            set( "s.AllowComment", s.AllowComment == 1 ? chk : "" );
            set( "s.AllowAnonymousComment", s.AllowAnonymousComment == 1 ? chk : "" );
            set( "s.IsShowStats", s.IsShowStats == 1 ? chk : "" );

            set( "s.PerPageBlogs", dropList( "PerPageBlogs", 3, 20, s.PerPageBlogs ) );
            set( "s.StickyCount", dropList( "StickyCount", 1, 20, s.StickyCount ) );

            set( "s.NewBlogCount", dropList( "NewBlogCount", 3, 20, s.NewBlogCount ) );
            set( "s.NewCommentCount", dropList( "NewCommentCount", 3, 20, s.NewCommentCount ) );
            set( "s.RssCount", dropList( "RssCount", 5, 20, s.RssCount ) );

            set( "s.ListModeFull", s.ListMode == BlogListMode.Full ? chk : "" );
            set( "s.ListModeAbstract", s.ListMode == BlogListMode.Abstract ? chk : "" );
        }