示例#1
0
        public bool AddHeaders()
        {
            var wrapLog = Log.Call <bool>();

            // ensure we only do this once
            if (MarkAddedAndReturnIfAlreadyDone())
            {
                return(wrapLog("already", false));
            }

            var pageId = PortalSettings.Current.ActiveTab.TabID.ToString(CultureInfo.InvariantCulture);
            var path   = ServicesFramework.GetServiceFrameworkRoot();

            if (string.IsNullOrEmpty(path))
            {
                return(wrapLog("no path", false));
            }

            var dnnVersion = DotNetNukeContext.Current.Application.Version.Major;
            var apiRoot    = path + (dnnVersion < 9
                ? $"desktopmodules/{ExtensionPlaceholder}/api/"
                : $"api/{ExtensionPlaceholder}/");

            var json = "{"
                       + $"\"page\": {pageId},"
                       + $"\"root\": \"{path}\","
                       + $"\"api\": \"{apiRoot}\","
                       + $"\"rvt\": \"{AntiForgeryToken()}\""
                       + "}";

            HtmlPage.AddMeta(MetaName, json);
            return(wrapLog("added", true));
        }
示例#2
0
        public bool AddHeaders()
        {
            var wrapLog = Log.Call <bool>();

            // ensure we only do this once
            if (MarkAddedAndReturnIfAlreadyDone())
            {
                return(wrapLog("already", false));
            }
            var siteRoot = ServicesFramework.GetServiceFrameworkRoot();

            if (string.IsNullOrEmpty(siteRoot))
            {
                return(wrapLog("no path", false));
            }

            var dnnVersion = DotNetNukeContext.Current.Application.Version.Major;
            var apiRoot    = siteRoot + (dnnVersion < 9
                ? $"desktopmodules/{InpageCms.ExtensionPlaceholder}/api/"
                : $"api/{InpageCms.ExtensionPlaceholder}/");

            var portal = PortalSettings.Current;
            var json   = InpageCms.JsApiJson(
                portal.ActiveTab.TabID,
                siteRoot,
                apiRoot,
                AntiForgeryToken(),
                VirtualPathUtility.ToAbsolute("~/desktopmodules/tosic_sexycontent/"));

            HtmlPage.AddMeta(InpageCms.MetaName, json);
            return(wrapLog("added", true));
        }