Пример #1
0
        /// <inheritdoc/>
        public string ThumbnailUrl(int moduleId, int fileId, int width, int height, string timestamp)
        {
            var tabId = TabController.CurrentPage.TabID;

            return
                ($"{ServicesFramework.GetServiceFrameworkRoot()}API/ResourceManager/Items/ThumbnailDownLoad?fileId={fileId}&width={width}&height={height}&timestamp={timestamp}&moduleId={moduleId}&tabId={tabId}");
        }
Пример #2
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));
        }
Пример #3
0
        public void RegisterAjaxScript()
        {
            ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
            RegisterAjaxAntiForgery();
            var path = ServicesFramework.GetServiceFrameworkRoot();

            if (String.IsNullOrEmpty(path))
            {
                return;
            }

            JavaScript.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn);
            ClientAPI.RegisterClientVariable(Page, "sf_siteRoot", path, /*overwrite*/ true);
            ClientAPI.RegisterClientVariable(Page, "sf_tabId", PortalSettings.Current.ActiveTab.TabID.ToString(CultureInfo.InvariantCulture), /*overwrite*/ true);

            string scriptPath;

            if (HttpContextSource.Current.IsDebuggingEnabled)
            {
                scriptPath = "~/js/Debug/dnn.servicesframework.js";
            }
            else
            {
                scriptPath = "~/js/dnn.servicesframework.js";
            }

            ClientResourceManager.RegisterScript(Page, scriptPath);
        }
Пример #4
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));
        }