Esempio n. 1
0
        private string AddCofoundryDependencies(string html)
        {
            const string HEAD_TAG_END = "</head>";
            const string BODY_TAG_END = "</body>";

            var insertHeadIndex = html.IndexOf(HEAD_TAG_END, StringComparison.OrdinalIgnoreCase) - 1;

            if (insertHeadIndex > 0)
            {
                html = html.Substring(0, insertHeadIndex)
                       + Environment.NewLine + TAB
                       + Scripts.Render(VisualEditorRouteLibrary.Js.VisualEditor).ToString() + TAB
                       + Styles.Render(VisualEditorRouteLibrary.Css.VisualEditor).ToString()
                       + html.Substring(insertHeadIndex);
            }

            var insertBodyIndex = html.IndexOf(BODY_TAG_END, StringComparison.OrdinalIgnoreCase) - 1;

            if (insertBodyIndex > 0)
            {
                var responseJson = JsonConvert.SerializeObject(_pageResponseData);

                html = html.Substring(0, insertBodyIndex)
                       + Environment.NewLine + TAB
                       + string.Format("<script>var pageResponseData = {0}</script>", responseJson) + TAB
                       + RenderRazorViewToString(VisualEditorRouteLibrary.VisualEditorToolbarViewPath(), _pageResponseData)
                       + string.Format("<!-- SVG ICONS --><div style='{0}'>{1}</div><!-- END SVG ICONS -->", "display:none", RenderSvgToString())
                       + html.Substring(insertBodyIndex);
            }

            return(html);
        }
Esempio n. 2
0
 public AdminRouteLibrary()
 {
     Account         = new AccountRouteLibrary();
     Auth            = new AuthRouteLibrary();
     CustomEntities  = new CustomEntitiesRouteLibrary();
     Dashboard       = new DashboardRouteLibrary();
     Directories     = new DirectoriesRouteLibrary();
     Documents       = new DocumentsModuleRouteLibrary();
     Images          = new ImagesModuleRouteLibrary();
     Pages           = new PagesModuleRouteLibrary();
     PageTemplates   = new PageTemplatesRouteLibrary();
     Roles           = new RolesRouteLibrary();
     Settings        = new SettingsRouteLibrary();
     Setup           = new SetupRouteLibrary();
     Shared          = new SharedRouteLibrary();
     SharedAlternate = new SharedAlternateRouteLibrary();
     Users           = new UsersRouteLibrary();
     VisualEditor    = new VisualEditorRouteLibrary();
 }
        private string AddCofoundryDependencies(string html)
        {
            const string HEAD_TAG_END = "</head>";
            const string BODY_TAG_END = "</body>";

            var insertHeadIndex = html.IndexOf(HEAD_TAG_END, StringComparison.OrdinalIgnoreCase) - 1;

            if (insertHeadIndex > 0)
            {
                html = html.Substring(0, insertHeadIndex)
                       + Environment.NewLine + TAB
                       + Scripts.Render(VisualEditorRouteLibrary.Js.VisualEditor).ToString() + TAB
                       + Styles.Render(VisualEditorRouteLibrary.Css.VisualEditor).ToString()
                       + html.Substring(insertHeadIndex);
            }

            var insertBodyIndex = html.IndexOf(BODY_TAG_END, StringComparison.OrdinalIgnoreCase) - 1;

            if (insertBodyIndex > 0)
            {
                // When using IPageModuleWithParentPageData and referencing the parent page we get a
                // Self referencing loop error. Rather than set this globally we ignore this specifically here
                var settings = _jsonSerializerSettingsFactory.Create();
                settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

                var responseJson = JsonConvert.SerializeObject(_pageResponseData, settings);

                html = html.Substring(0, insertBodyIndex)
                       + Environment.NewLine + TAB
                       + string.Format("<script>var pageResponseData = {0}</script>", responseJson) + TAB
                       + RenderRazorViewToString(VisualEditorRouteLibrary.VisualEditorToolbarViewPath(), _pageResponseData)
                       + string.Format("<!-- SVG ICONS --><div style='{0}'>{1}</div><!-- END SVG ICONS -->", "display:none", RenderSvgToString())
                       + html.Substring(insertBodyIndex);
            }

            return(html);
        }