Пример #1
0
        //--------------------------------------------------------------------------------------------------

        // 获取当前app首页的数据、排版布局、样式,存储为皮肤
        public void Snapshot()
        {
            ContentApp app = ctx.app.obj as ContentApp;

            PortalMockSkin s = new PortalMockSkin();

            s.Style    = app.Style;  // 样式
            s.Layout   = app.Layout; // 排版布局
            s.Sections = new List <PortalMockSection>();

            List <ContentSection> sections = sectionService.GetByApp(app.Id);

            foreach (ContentSection section in sections)
            {
                PortalMockSection ps = new PortalMockSection {
                    RowId            = section.RowId,
                    ColumnId         = section.ColumnId,
                    SectionType      = section.SectionType,
                    Title            = section.Title,
                    CustomTemplateId = section.CustomTemplateId,
                    ServiceId        = section.ServiceId,
                    ServiceParams    = section.ServiceParams,
                    TemplateId       = section.TemplateId
                };

                ps.Posts = populatePost(postService.GetBySection(section.Id, 20));
                s.Sections.Add(ps);
            }

            String json = Json.ToString(s, true);

            file.Write(PathHelper.Map("/content.json"), json);
        }
Пример #2
0
        //--------------------------------------------------------------------------------------------------
        // ��ȡ��ǰapp��ҳ�����ݡ��Ű沼�֡���ʽ���洢ΪƤ��
        public void Snapshot()
        {
            ContentApp app = ctx.app.obj as ContentApp;

            PortalMockSkin s = new PortalMockSkin();
            s.Style = app.Style; // ��ʽ
            s.Layout = app.Layout; // �Ű沼��
            s.Sections = new List<PortalMockSection>();

            List<ContentSection> sections = sectionService.GetByApp( app.Id );
            foreach (ContentSection section in sections) {
                PortalMockSection ps = new PortalMockSection {
                    RowId = section.RowId,
                    ColumnId = section.ColumnId,
                    SectionType = section.SectionType,
                    Title = section.Title,
                    CustomTemplateId = section.CustomTemplateId,
                    ServiceId = section.ServiceId,
                    ServiceParams = section.ServiceParams,
                    TemplateId = section.TemplateId
                };

                ps.Posts = populatePost( postService.GetBySection( section.Id, 20 ) );
                s.Sections.Add( ps );
            }

            String json = Json.ToString( s, true );
            file.Write( PathHelper.Map( "/content.json" ), json );
        }