コード例 #1
0
ファイル: PageDesignHolder.cs プロジェクト: Epitomy/CMS
        public static IHtmlString Parse(PagePosition position, Site site)
        {
            if (position == null) { return null; }

            var view = position as ViewPosition;
            if (view != null) { return new PageDesignViewContent(view); }

            var module = position as ModulePosition;
            if (module != null) { return new PageDesignModuleContent(module); }

            var html = position as HtmlPosition;
            if (html != null) { return new PageDesignHtmlContent(html); }

            var folder = position as ContentPosition;
            if (folder != null) { return new PageDesignFolderContent(folder); }

            var htmlBlock = position as HtmlBlockPosition;
            if (htmlBlock != null)
            {
                var entry = htmlBlock.GetHtmlBlock(site);
                if (entry != null)
                {
                    return new PageDesignHtmlBlockContent(htmlBlock, entry.Body);
                }
            }

            return new HtmlString("");
        }
コード例 #2
0
        public PageDesignContent(PagePosition pos)
            : base()
        {
            if (pos == null) { throw new ArgumentNullException(); }

            if (string.IsNullOrEmpty(pos.PagePositionId))
            {
                //pos.PagePositionId = Guid.NewGuid().ToString();
                pos.PagePositionId = UniqueIdGenerator.GetInstance().GetBase32UniqueId(5);
            }

            this.Position = pos;

            //this.TagName = "li";

            this.ClassName = "pagedesign-content";

            this.Parameter.Add("Name", PageDesignContent.Code(this.ToString()));

            this.Parameter.Add("PagePositionId", PageDesignContent.Code(pos.PagePositionId));

            this.Parameter.Add("Order", pos.Order.ToString());

            this.Parameter.Add("Type", this.GetTypeKey());
        }