예제 #1
0
    public void LoadData()
    {
        if (node != null)
        {
            string layoutText = String.Empty;

            // get template info
            pti = PageTemplateInfoProvider.GetPageTemplateInfo(node.GetUsedPageTemplateId());
            if ((pti == null) && (DocumentContext.CurrentPageInfo != null) && (DocumentContext.CurrentPageInfo.UsedPageTemplateInfo != null))
            {
                pti = DocumentContext.CurrentPageInfo.UsedPageTemplateInfo;
            }

            if (pti != null)
            {
                PageTemplateLayoutTypeEnum type = PageTemplateLayoutTypeEnum.PageTemplateLayout;
                // Try get device layout
                object layoutObject = PageTemplateDeviceLayoutInfoProvider.GetLayoutObject(pti, DeviceContext.CurrentDeviceProfile, out type);
                layoutText = pti.PageTemplateLayout;

                // Set layout text with dependence on current layout type
                switch (type)
                {
                // Shared layouts
                case PageTemplateLayoutTypeEnum.SharedLayout:
                case PageTemplateLayoutTypeEnum.DeviceSharedLayout:
                case PageTemplateLayoutTypeEnum.SharedLayoutMapped:
                    layoutText = (layoutObject as LayoutInfo).LayoutCode;
                    break;

                // Custom device layout
                case PageTemplateLayoutTypeEnum.DeviceLayout:
                    layoutText = (layoutObject as PageTemplateDeviceLayoutInfo).LayoutCode;
                    break;
                }
            }
            ltlLayoutCode.Text = HTMLHelper.EnsureHtmlLineEndings(HTMLHelper.HighlightHTML(layoutText));
            ltlLayoutCode.Text = RegexHelper.GetRegex("[ ](?![^<>]*>)").Replace(ltlLayoutCode.Text, "&nbsp;");

            // Load node data
            if (!RequestHelper.IsPostBack())
            {
                txtBodyCss.Text      = node.NodeBodyElementAttributes;
                txtBodyScripts.Value = node.NodeBodyScripts;
                txtDocType.Text      = node.NodeDocType;
                txtHeadTags.Value    = node.NodeHeadTags;
            }
        }

        lblAfterDocType.Text  = HighlightHTML("<html>") + "<br />" + AddSpaces(1) + HighlightHTML("<head>");
        lblAfterHeadTags.Text = AddSpaces(1) + HighlightHTML("</head>");
        lblAfterLayout.Text   = AddSpaces(1) + HighlightHTML("</body>") + "<br />" + HighlightHTML("</html>");
        lblBodyEnd.Text       = HighlightHTML(">");
        lblBodyStart.Text     = AddSpaces(1) + HighlightHTML("<body " + HttpUtility.HtmlDecode(mBody));
    }
예제 #2
0
 /// <summary>
 /// Highlight HTML.
 /// </summary>
 /// <param name="inputHtml">Input HTML</param>
 public string HighlightHTML(string inputHtml)
 {
     return(HTMLHelper.HighlightHTML(inputHtml));
 }