Exemplo n.º 1
0
        public void bindSettings( ContentSetting s )
        {
            String chk = "checked=\"checked\"";

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

            set( "s.ListPostPerPage", dropList( "ListPostPerPage", 3, 100, s.ListPostPerPage ) );
            set( "s.ListPicPerPage", dropList( "ListPicPerPage", 3, 100, s.ListPicPerPage ) );
            set( "s.ListVideoPerPage", dropList( "ListVideoPerPage", 3, 100, s.ListVideoPerPage ) );

            set( "s.RankPosts", dropList( "RankPosts", 3, 20, s.RankPosts ) );
            set( "s.RankPics", dropList( "RankPics", 1, 20, s.RankPics ) );
            set( "s.RankVideos", dropList( "RssCount", 1, 20, s.RankVideos ) );

            set( "s.CacheSeconds", dropList( "CacheSeconds", 0, 600, s.CacheSeconds ) );
            set( "s.SummaryLength", dropList( "SummaryLength", 50, 600, s.SummaryLength ) );

            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add( "简单列表", ArticleListMode.TitleOnly.ToString() );
            dic.Add( "摘要列表", ArticleListMode.Summary.ToString() );

            dropList( "contentSetting.ArticleListMode", dic, s.ArticleListMode.ToString() );
        }
Exemplo n.º 2
0
        public ContentSetting GetSettingsObj()
        {
            if (strUtil.IsNullOrEmpty(this.Settings))
            {
                return(new ContentSetting());
            }
            ContentSetting s = JSON.ToObject <ContentSetting>(this.Settings);

            s.SetDefaultValue();
            return(s);
        }
Exemplo n.º 3
0
        public ContentSetting GetSettingsObj()
        {
            if (strUtil.IsNullOrEmpty(this.Settings))
            {
                return(new ContentSetting());
            }
            ContentSetting s = Json.Deserialize <ContentSetting>(this.Settings);

            s.SetDefaultValue();
            return(s);
        }
Exemplo n.º 4
0
        private void bindPostList( ContentSection section, DataPage<ContentPost> posts, ContentSetting setting ) {
            set( "section.Name", section.Title );
            IBlock block = getBlock( "list" );
            foreach (ContentPost post in posts.Results) {

                BinderUtils.bindPostSingle( block, post, ctx );

                if (setting.ArticleListMode == ArticleListMode.Summary) {
                    block.Set( "post.Summary", post.GetSummary( setting.SummaryLength ) );
                }

                block.Next();
            }
        }
Exemplo n.º 5
0
        public String GetStaticDir()
        {
            ContentSetting s = this.GetSettingsObj();

            return(s.StaticDir);
        }
Exemplo n.º 6
0
 private void bindListCommon( int sectionId, ContentSection section, ContentSetting s,
     DataPage<ContentPost> posts )
 {
     Page.Title = section.Title;
     if (s.ArticleListMode == ArticleListMode.Summary) view( "ListSummary" );
     bindPostList( section, posts, s );
 }