From eac3d818271cae71f83f7219862ab213f19450da Mon Sep 17 00:00:00 2001 From: w8tcha Date: Sun, 4 Mar 2018 12:41:14 +0100 Subject: [PATCH] FIXED #26 Uncaught ReferenceError: dnnpagesSelectBox is not defined --- CKEditor/plugins/dnnpages/plugin.js | 17 ++-- DNN 7/Install/CKReleaseNotes.html | 7 +- DNN 7/Install/bin/WatchersNET.CKEditor.dll | Bin 296448 -> 296448 bytes DNN 7/Tabs.ashx | 1 - DNN 7/Tabs.ashx.cs | 106 --------------------- DNN 7/WatchersNET.CKEditor - DNN7.csproj | 5 - DNN 7/Web/CKEditorControl.cs | 61 ++++++++++++ DNN 8/Install/CKReleaseNotes.html | 9 +- DNN 8/Tabs.ashx | 1 - DNN 8/Tabs.ashx.cs | 98 ------------------- DNN 8/WatchersNET.CKEditor - DNN8.csproj | 5 - DNN 8/Web/CKEditorControl.cs | 62 ++++++++++++ DNN 9/Install/CKReleaseNotes.html | 7 +- DNN 9/Tabs.ashx | 1 - DNN 9/Tabs.ashx.cs | 98 ------------------- DNN 9/WatchersNET.CKEditor - DNN9.csproj | 5 - DNN 9/Web/CKEditorControl.cs | 60 ++++++++++++ GlobalAssemblyInfo.cs | 4 +- WatchersNET.CKEditor.sln | 2 +- 19 files changed, 202 insertions(+), 347 deletions(-) delete mode 100644 DNN 7/Tabs.ashx delete mode 100644 DNN 7/Tabs.ashx.cs delete mode 100644 DNN 8/Tabs.ashx delete mode 100644 DNN 8/Tabs.ashx.cs delete mode 100644 DNN 9/Tabs.ashx delete mode 100644 DNN 9/Tabs.ashx.cs diff --git a/CKEditor/plugins/dnnpages/plugin.js b/CKEditor/plugins/dnnpages/plugin.js index 94b3beb..92a4ef2 100644 --- a/CKEditor/plugins/dnnpages/plugin.js +++ b/CKEditor/plugins/dnnpages/plugin.js @@ -7,8 +7,6 @@ icons: 'anchor,anchor-rtl,link,unlink', // %REMOVE_LINE_CORE% hidpi: true, // %REMOVE_LINE_CORE% onLoad: function() { - CKEDITOR.scriptLoader.load(CKEDITOR.basePath + 'Tabs.ashx?PortalID=' + document.getElementById('CKDNNporid').value); - // Add the CSS styles for anchor placeholders. var iconPath = CKEDITOR.getUrl(this.path + 'images' + (CKEDITOR.env.hidpi ? '/hidpi' : '') + '/anchor.png'), baseStyle = 'background:url(' + iconPath + ') no-repeat %1 center;border:1px dotted #00f;background-size:16px;'; @@ -501,8 +499,8 @@ else if (href && (urlMatch = href.match(urlRegex))) { var isLocalPage = false; // check for portal page - for (var iPage = 0; iPage < dnnpagesSelectBox.length; iPage++) { - if (dnnpagesSelectBox[iPage][1] == href) { + for (var iPage = 0; iPage < editor.config.dnnPagesArray; iPage++) { + if (editor.config.dnnPagesArray[iPage][1] == href) { isLocalPage = true; } } @@ -852,15 +850,12 @@ var dialogDefinition = ev.data.definition; if (dialogName == 'link') { - if (typeof (dnnpagesSelectBox) === 'undefined') { - console.log('yes'); + if (typeof (ev.editor.config.dnnPagesArray) === 'undefined') { return; - } else { - console.log('no'); } - for (var i = 0; i < dnnpagesSelectBox.length; i++) { - dnnpagesSelectBox[i][0] = unescape(dnnpagesSelectBox[i][0]); + for (var i = 0; i < ev.editor.config.dnnPagesArray.length; i++) { + ev.editor.config.dnnPagesArray[i][0] = unescape(ev.editor.config.dnnPagesArray[i][0]); } var editor = ev.editor; @@ -1033,7 +1028,7 @@ label: editor.lang.dnnpages.localPageLabel, id: 'localPage', title: editor.lang.dnnpages.localPageTitle, - items: dnnpagesSelectBox, + items: editor.config.dnnPagesArray, setup: function(data) { if (data.localPage) { this.setValue(data.localPage); diff --git a/DNN 7/Install/CKReleaseNotes.html b/DNN 7/Install/CKReleaseNotes.html index c3f668a..ff8bca0 100644 --- a/DNN 7/Install/CKReleaseNotes.html +++ b/DNN 7/Install/CKReleaseNotes.html @@ -6,18 +6,17 @@ CKEditor Provider Readme -

CKEditor 4.8.0 Editor Provider 2.01.12 For DNN® Platform 07.04.02 (or above)

+

CKEditor 4.8.0 Editor Provider 2.01.13 For DNN® Platform 07.04.02 (or above)

What's New

changes
diff --git a/DNN 7/Install/bin/WatchersNET.CKEditor.dll b/DNN 7/Install/bin/WatchersNET.CKEditor.dll index 033f1a22ac96caf2ae06febe640b6f5c49891f6f..c16b5307acb40cd65a5e3e3f1f8087e8510aabd5 100644 GIT binary patch delta 48 zcmZqZ5o+iWn$W>4RNvRw-P+CA+Re1Jn|bRkfr@qVY#at^uJc$nFHfJCe0O`mZRQQD E0M0KH=>Px# delta 48 zcmV-00MGw`j1qv15|D@koCZOGi-n5;g^L2UivzXV5UtATt=m*KL8!pnV5$~utG7_w G1F)(AQWm%X diff --git a/DNN 7/Tabs.ashx b/DNN 7/Tabs.ashx deleted file mode 100644 index e16e237..0000000 --- a/DNN 7/Tabs.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ language="c#" Codebehind="Tabs.ashx.cs" Class="WatchersNET.CKEditor.Tabs" %> \ No newline at end of file diff --git a/DNN 7/Tabs.ashx.cs b/DNN 7/Tabs.ashx.cs deleted file mode 100644 index 39001ba..0000000 --- a/DNN 7/Tabs.ashx.cs +++ /dev/null @@ -1,106 +0,0 @@ -/* - * CKEditor Html Editor Provider for DNN - * ======== - * https://github.com/w8tcha/dnnckeditor - * Copyright (C) Ingo Herbote - * - * The software, this file and its contents are subject to the CKEditor Provider - * License. Please read the license.txt file before using, installing, copying, - * modifying or distribute this file or part of its contents. The contents of - * this file is part of the Source Code of the CKEditor Provider. - */ - -namespace WatchersNET.CKEditor -{ - #region - - using System.Text; - using System.Text.RegularExpressions; - using System.Web; - - using DotNetNuke.Common; - using DotNetNuke.Entities.Modules; - using DotNetNuke.Entities.Portals; - using DotNetNuke.Entities.Tabs; - - #endregion - - /// - /// Renders the Tab Java Script - /// - public class Tabs : PortalModuleBase, IHttpHandler - { - /// - /// Gets a value indicating whether another request can use the instance. - /// - /// true if the instance is reusable; otherwise, false. - public bool IsReusable - { - get - { - return false; - } - } - - - /// - /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the interface. - /// - /// An object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests. - public void ProcessRequest(HttpContext context) - { - var portalId = context.Request.QueryString["PortalID"] != null - ? int.Parse(context.Request.QueryString["PortalID"]) - : this.PortalSettings.PortalId; - - // Generate Pages Array - var pagesArray = new StringBuilder(); - - pagesArray.Append("var dnnpagesSelectBox = new Array("); - - var domainName = string.Format("http://{0}", Globals.GetDomainName(context.Request, true)); - - foreach (var tab in TabController.GetPortalTabs( - portalId, -1, false, null, true, false, true, true, true)) - { - var tabUrl = PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", portalId, false) - && !string.IsNullOrEmpty(tab.CultureCode) - ? Globals.FriendlyUrl( - tab, - string.Format("{0}&language={1}", Globals.ApplicationURL(tab.TabID), tab.CultureCode)) - : Globals.FriendlyUrl(tab, Globals.ApplicationURL(tab.TabID)); - - - tabUrl = Globals.ResolveUrl(Regex.Replace(tabUrl, domainName, "~", RegexOptions.IgnoreCase)); - - var tabName = Microsoft.JScript.GlobalObject.escape(tab.TabName); - - if (tab.Level.Equals(0)) - { - pagesArray.AppendFormat("new Array('| {0}','{1}'),", tabName, tabUrl); - } - else - { - var separator = new StringBuilder(); - - for (var index = 0; index < tab.Level; index++) - { - separator.Append("--"); - } - - pagesArray.AppendFormat("new Array('|{0} {1}','{2}'),", separator, tabName, tabUrl); - } - } - - if (pagesArray.ToString().EndsWith(",")) - { - pagesArray.Remove(pagesArray.Length - 1, 1); - } - - pagesArray.Append(");"); - - context.Response.ContentType = "text/javascript"; - context.Response.Write(pagesArray.ToString()); - } - } -} \ No newline at end of file diff --git a/DNN 7/WatchersNET.CKEditor - DNN7.csproj b/DNN 7/WatchersNET.CKEditor - DNN7.csproj index 77dae35..6189932 100644 --- a/DNN 7/WatchersNET.CKEditor - DNN7.csproj +++ b/DNN 7/WatchersNET.CKEditor - DNN7.csproj @@ -149,10 +149,6 @@ - - Tabs.ashx - ASPXCodeBehind - Browser.aspx @@ -297,7 +293,6 @@ Designer - diff --git a/DNN 7/Web/CKEditorControl.cs b/DNN 7/Web/CKEditorControl.cs index b954f8a..32d76f3 100644 --- a/DNN 7/Web/CKEditorControl.cs +++ b/DNN 7/Web/CKEditorControl.cs @@ -22,6 +22,7 @@ namespace WatchersNET.CKEditor.Web using System.IO; using System.Linq; using System.Text; + using System.Text.RegularExpressions; using System.Threading; using System.Web; using System.Web.UI; @@ -32,6 +33,7 @@ namespace WatchersNET.CKEditor.Web using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Portals; + using DotNetNuke.Entities.Tabs; using DotNetNuke.Framework.JavaScriptLibraries; using DotNetNuke.Framework.Providers; using DotNetNuke.Security; @@ -429,6 +431,9 @@ var info in // Inject maxFileSize this._settings["maxFileSize"] = Utility.GetMaxUploadSize().ToString(); + // Inject Tabs for the dnnpages plugin + this._settings["dnnPagesArray"] = this.GetTabsArray(); + HttpContext.Current.Session["CKDNNtabid"] = this._portalSettings.ActiveTab.TabID; HttpContext.Current.Session["CKDNNporid"] = this._portalSettings.PortalId; @@ -678,6 +683,62 @@ private static string SResXFile } } + + + /// + /// Gets the tabs array. + /// + /// Returns the Tabs Array as String + private string GetTabsArray() + { + // Generate Pages Array + var pagesArray = new StringBuilder(); + + pagesArray.Append("["); + + var domainName = string.Format("http://{0}", Globals.GetDomainName(HttpContext.Current.Request, true)); + + foreach (var tab in TabController.GetPortalTabs( + this._portalSettings.PortalId, -1, false, null, true, false, true, true, true)) + { + var tabUrl = PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", this._portalSettings.PortalId, false) + && !string.IsNullOrEmpty(tab.CultureCode) + ? Globals.FriendlyUrl( + tab, + string.Format("{0}&language={1}", Globals.ApplicationURL(tab.TabID), tab.CultureCode)) + : Globals.FriendlyUrl(tab, Globals.ApplicationURL(tab.TabID)); + + + tabUrl = Globals.ResolveUrl(Regex.Replace(tabUrl, domainName, "~", RegexOptions.IgnoreCase)); + + var tabName = Microsoft.JScript.GlobalObject.escape(tab.TabName); + + if (tab.Level.Equals(0)) + { + pagesArray.AppendFormat("new Array('| {0}','{1}'),", tabName, tabUrl); + } + else + { + var separator = new StringBuilder(); + + for (var index = 0; index < tab.Level; index++) + { + separator.Append("--"); + } + + pagesArray.AppendFormat("new Array('|{0} {1}','{2}'),", separator, tabName, tabUrl); + } + } + + if (pagesArray.ToString().EndsWith(",")) + { + pagesArray.Remove(pagesArray.Length - 1, 1); + } + + pagesArray.Append("]"); + + return pagesArray.ToString(); + } #endregion #region Public Methods diff --git a/DNN 8/Install/CKReleaseNotes.html b/DNN 8/Install/CKReleaseNotes.html index 14da930..390a51e 100644 --- a/DNN 8/Install/CKReleaseNotes.html +++ b/DNN 8/Install/CKReleaseNotes.html @@ -6,19 +6,18 @@ CKEditor Provider Readme -

CKEditor 4.8.0 Editor Provider 2.01.12 For DNN® Platform 08.04.00 (or above)

+

CKEditor 4.8.0 Editor Provider 2.01.13 For DNN® Platform 08.04.00 (or above)

What's New

    -
  • Upgraded to CKEditor 4.8.0
  • -
  • Added Support for the Upload Image Plugin
  • +
changes
    -
  • -
+
  • FIXED #26 Uncaught ReferenceError: dnnpagesSelectBox is not defined
  • +
    diff --git a/DNN 8/Tabs.ashx b/DNN 8/Tabs.ashx deleted file mode 100644 index e16e237..0000000 --- a/DNN 8/Tabs.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ language="c#" Codebehind="Tabs.ashx.cs" Class="WatchersNET.CKEditor.Tabs" %> \ No newline at end of file diff --git a/DNN 8/Tabs.ashx.cs b/DNN 8/Tabs.ashx.cs deleted file mode 100644 index c23268c..0000000 --- a/DNN 8/Tabs.ashx.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* - * CKEditor Html Editor Provider for DNN - * ======== - * https://github.com/w8tcha/dnnckeditor - * Copyright (C) Ingo Herbote - * - * The software, this file and its contents are subject to the CKEditor Provider - * License. Please read the license.txt file before using, installing, copying, - * modifying or distribute this file or part of its contents. The contents of - * this file is part of the Source Code of the CKEditor Provider. - */ - -namespace WatchersNET.CKEditor -{ - #region - - using System.Text; - using System.Text.RegularExpressions; - using System.Web; - - using DotNetNuke.Common; - using DotNetNuke.Entities.Modules; - using DotNetNuke.Entities.Portals; - using DotNetNuke.Entities.Tabs; - - #endregion - - /// - /// Renders the Tab Java Script - /// - public class Tabs : PortalModuleBase, IHttpHandler - { - /// - /// Gets a value indicating whether another request can use the instance. - /// - /// true if the instance is reusable; otherwise, false. - public bool IsReusable => false; - - /// - /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the interface. - /// - /// An object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests. - public void ProcessRequest(HttpContext context) - { - var portalId = context.Request.QueryString["PortalID"] != null - ? int.Parse(context.Request.QueryString["PortalID"]) - : this.PortalSettings.PortalId; - - // Generate Pages Array - var pagesArray = new StringBuilder(); - - pagesArray.Append("var dnnpagesSelectBox = new Array("); - - var domainName = string.Format("http://{0}", Globals.GetDomainName(context.Request, true)); - - foreach (var tab in TabController.GetPortalTabs( - portalId, -1, false, null, true, false, true, true, true)) - { - var tabUrl = PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", portalId, false) - && !string.IsNullOrEmpty(tab.CultureCode) - ? Globals.FriendlyUrl( - tab, - string.Format("{0}&language={1}", Globals.ApplicationURL(tab.TabID), tab.CultureCode)) - : Globals.FriendlyUrl(tab, Globals.ApplicationURL(tab.TabID)); - - tabUrl = Globals.ResolveUrl(Regex.Replace(tabUrl, domainName, "~", RegexOptions.IgnoreCase)); - - var tabName = Microsoft.JScript.GlobalObject.escape(tab.TabName); - - if (tab.Level.Equals(0)) - { - pagesArray.AppendFormat("new Array('| {0}','{1}'),", tabName, tabUrl); - } - else - { - var separator = new StringBuilder(); - - for (var index = 0; index < tab.Level; index++) - { - separator.Append("--"); - } - - pagesArray.AppendFormat("new Array('|{0} {1}','{2}'),", separator, tabName, tabUrl); - } - } - - if (pagesArray.ToString().EndsWith(",")) - { - pagesArray.Remove(pagesArray.Length - 1, 1); - } - - pagesArray.Append(");"); - - context.Response.ContentType = "text/javascript"; - context.Response.Write(pagesArray.ToString()); - } - } -} \ No newline at end of file diff --git a/DNN 8/WatchersNET.CKEditor - DNN8.csproj b/DNN 8/WatchersNET.CKEditor - DNN8.csproj index 1f9249a..a068a07 100644 --- a/DNN 8/WatchersNET.CKEditor - DNN8.csproj +++ b/DNN 8/WatchersNET.CKEditor - DNN8.csproj @@ -157,10 +157,6 @@ - - Tabs.ashx - ASPXCodeBehind - Browser.aspx @@ -313,7 +309,6 @@ Designer -
    diff --git a/DNN 8/Web/CKEditorControl.cs b/DNN 8/Web/CKEditorControl.cs index 937e675..e67dac8 100644 --- a/DNN 8/Web/CKEditorControl.cs +++ b/DNN 8/Web/CKEditorControl.cs @@ -22,6 +22,7 @@ namespace WatchersNET.CKEditor.Web using System.IO; using System.Linq; using System.Text; + using System.Text.RegularExpressions; using System.Threading; using System.Web; using System.Web.UI; @@ -32,6 +33,7 @@ namespace WatchersNET.CKEditor.Web using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Portals; + using DotNetNuke.Entities.Tabs; using DotNetNuke.Framework.JavaScriptLibraries; using DotNetNuke.Framework.Providers; using DotNetNuke.Security; @@ -428,6 +430,9 @@ var info in // Inject maxFileSize this._settings["maxFileSize"] = Utility.GetMaxUploadSize().ToString(); + // Inject Tabs for the dnnpages plugin + this._settings["dnnPagesArray"] = this.GetTabsArray(); + HttpContext.Current.Session["CKDNNtabid"] = this._portalSettings.ActiveTab.TabID; HttpContext.Current.Session["CKDNNporid"] = this._portalSettings.PortalId; @@ -661,6 +666,63 @@ private static bool HasMsAjax private static string SResXFile => Globals.ResolveUrl( string.Format("~/Providers/HtmlEditorProviders/CKEditor/{0}/Options.aspx.resx", Localization.LocalResourceDirectory)); + + + /// + /// Gets the tabs array. + /// + /// Returns the Tabs Array as String + private string GetTabsArray() + { + // Generate Pages Array + var pagesArray = new StringBuilder(); + + pagesArray.Append("["); + + var domainName = string.Format("http://{0}", Globals.GetDomainName(HttpContext.Current.Request, true)); + + foreach (var tab in TabController.GetPortalTabs( + this._portalSettings.PortalId, -1, false, null, true, false, true, true, true)) + { + var tabUrl = PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", this._portalSettings.PortalId, false) + && !string.IsNullOrEmpty(tab.CultureCode) + ? Globals.FriendlyUrl( + tab, + string.Format("{0}&language={1}", Globals.ApplicationURL(tab.TabID), tab.CultureCode)) + : Globals.FriendlyUrl(tab, Globals.ApplicationURL(tab.TabID)); + + + tabUrl = Globals.ResolveUrl(Regex.Replace(tabUrl, domainName, "~", RegexOptions.IgnoreCase)); + + var tabName = Microsoft.JScript.GlobalObject.escape(tab.TabName); + + if (tab.Level.Equals(0)) + { + pagesArray.AppendFormat("new Array('| {0}','{1}'),", tabName, tabUrl); + } + else + { + var separator = new StringBuilder(); + + for (var index = 0; index < tab.Level; index++) + { + separator.Append("--"); + } + + pagesArray.AppendFormat("new Array('|{0} {1}','{2}'),", separator, tabName, tabUrl); + } + } + + if (pagesArray.ToString().EndsWith(",")) + { + pagesArray.Remove(pagesArray.Length - 1, 1); + } + + pagesArray.Append("]"); + + return pagesArray.ToString(); + } + #endregion #region Public Methods diff --git a/DNN 9/Install/CKReleaseNotes.html b/DNN 9/Install/CKReleaseNotes.html index 7201f37..155845b 100644 --- a/DNN 9/Install/CKReleaseNotes.html +++ b/DNN 9/Install/CKReleaseNotes.html @@ -6,18 +6,17 @@ CKEditor Provider Readme -

    CKEditor 4.8.0 Editor Provider 2.01.12 For DNN® Platform 09.01.01 (or above)

    +

    CKEditor 4.8.0 Editor Provider 2.01.13 For DNN® Platform 09.01.01 (or above)

    What's New

      -
    • Upgraded to CKEditor 4.8.0
    • -
    • Added Support for the Upload Image Plugin
    • +
    changes
      -
    • +
    • FIXED #26 Uncaught ReferenceError: dnnpagesSelectBox is not defined
    diff --git a/DNN 9/Tabs.ashx b/DNN 9/Tabs.ashx deleted file mode 100644 index e16e237..0000000 --- a/DNN 9/Tabs.ashx +++ /dev/null @@ -1 +0,0 @@ -<%@ language="c#" Codebehind="Tabs.ashx.cs" Class="WatchersNET.CKEditor.Tabs" %> \ No newline at end of file diff --git a/DNN 9/Tabs.ashx.cs b/DNN 9/Tabs.ashx.cs deleted file mode 100644 index 109c835..0000000 --- a/DNN 9/Tabs.ashx.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* - * CKEditor Html Editor Provider for DNN - * ======== - * https://github.com/w8tcha/dnnckeditor - * Copyright (C) Ingo Herbote - * - * The software, this file and its contents are subject to the CKEditor Provider - * License. Please read the license.txt file before using, installing, copying, - * modifying or distribute this file or part of its contents. The contents of - * this file is part of the Source Code of the CKEditor Provider. - */ - -namespace WatchersNET.CKEditor -{ - #region - - using System.Text; - using System.Text.RegularExpressions; - using System.Web; - - using DotNetNuke.Common; - using DotNetNuke.Entities.Modules; - using DotNetNuke.Entities.Portals; - using DotNetNuke.Entities.Tabs; - - #endregion - - /// - /// Renders the Tab Java Script - /// - public class Tabs : PortalModuleBase, IHttpHandler - { - /// - /// Gets a value indicating whether another request can use the instance. - /// - /// true if the instance is reusable; otherwise, false. - public bool IsReusable => false; - - /// - /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the interface. - /// - /// An object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests. - public void ProcessRequest(HttpContext context) - { - var portalId = context.Request.QueryString["PortalID"] != null - ? int.Parse(context.Request.QueryString["PortalID"]) - : this.PortalSettings.PortalId; - - // Generate Pages Array - var pagesArray = new StringBuilder(); - - pagesArray.Append("var dnnpagesSelectBox = new Array("); - - var domainName = string.Format("http://{0}", Globals.GetDomainName(context.Request, true)); - - foreach (var tab in TabController.GetPortalTabs(portalId, -1, false, null, true, false, true, true, true)) - { - var tabUrl = - PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", portalId, false) - && !string.IsNullOrEmpty(tab.CultureCode) - ? Globals.FriendlyUrl( - tab, - string.Format("{0}&language={1}", Globals.ApplicationURL(tab.TabID), tab.CultureCode)) - : Globals.FriendlyUrl(tab, Globals.ApplicationURL(tab.TabID)); - - tabUrl = Globals.ResolveUrl(Regex.Replace(tabUrl, domainName, "~", RegexOptions.IgnoreCase)); - - var tabName = Microsoft.JScript.GlobalObject.escape(tab.TabName); - - if (tab.Level.Equals(0)) - { - pagesArray.AppendFormat("new Array('| {0}','{1}'),", tabName, tabUrl); - } - else - { - var separator = new StringBuilder(); - - for (var index = 0; index < tab.Level; index++) - { - separator.Append("--"); - } - - pagesArray.AppendFormat("new Array('|{0} {1}','{2}'),", separator, tabName, tabUrl); - } - } - - if (pagesArray.ToString().EndsWith(",")) - { - pagesArray.Remove(pagesArray.Length - 1, 1); - } - - pagesArray.Append(");"); - - context.Response.ContentType = "text/javascript"; - context.Response.Write(pagesArray.ToString()); - } - } -} \ No newline at end of file diff --git a/DNN 9/WatchersNET.CKEditor - DNN9.csproj b/DNN 9/WatchersNET.CKEditor - DNN9.csproj index b272d31..3ad8b9e 100644 --- a/DNN 9/WatchersNET.CKEditor - DNN9.csproj +++ b/DNN 9/WatchersNET.CKEditor - DNN9.csproj @@ -157,10 +157,6 @@ - - Tabs.ashx - ASPXCodeBehind - Browser.aspx @@ -313,7 +309,6 @@ Designer -
    diff --git a/DNN 9/Web/CKEditorControl.cs b/DNN 9/Web/CKEditorControl.cs index 937e675..9708880 100644 --- a/DNN 9/Web/CKEditorControl.cs +++ b/DNN 9/Web/CKEditorControl.cs @@ -22,6 +22,7 @@ namespace WatchersNET.CKEditor.Web using System.IO; using System.Linq; using System.Text; + using System.Text.RegularExpressions; using System.Threading; using System.Web; using System.Web.UI; @@ -32,6 +33,7 @@ namespace WatchersNET.CKEditor.Web using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Portals; + using DotNetNuke.Entities.Tabs; using DotNetNuke.Framework.JavaScriptLibraries; using DotNetNuke.Framework.Providers; using DotNetNuke.Security; @@ -428,6 +430,9 @@ var info in // Inject maxFileSize this._settings["maxFileSize"] = Utility.GetMaxUploadSize().ToString(); + // Inject Tabs for the dnnpages plugin + this._settings["dnnPagesArray"] = this.GetTabsArray(); + HttpContext.Current.Session["CKDNNtabid"] = this._portalSettings.ActiveTab.TabID; HttpContext.Current.Session["CKDNNporid"] = this._portalSettings.PortalId; @@ -661,6 +666,61 @@ private static bool HasMsAjax private static string SResXFile => Globals.ResolveUrl( string.Format("~/Providers/HtmlEditorProviders/CKEditor/{0}/Options.aspx.resx", Localization.LocalResourceDirectory)); + /// + /// Gets the tabs array. + /// + /// Returns the Tabs Array as String + private string GetTabsArray() + { + // Generate Pages Array + var pagesArray = new StringBuilder(); + + pagesArray.Append("["); + + var domainName = string.Format("http://{0}", Globals.GetDomainName(HttpContext.Current.Request, true)); + + foreach (var tab in TabController.GetPortalTabs( + this._portalSettings.PortalId, -1, false, null, true, false, true, true, true)) + { + var tabUrl = PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", this._portalSettings.PortalId, false) + && !string.IsNullOrEmpty(tab.CultureCode) + ? Globals.FriendlyUrl( + tab, + string.Format("{0}&language={1}", Globals.ApplicationURL(tab.TabID), tab.CultureCode)) + : Globals.FriendlyUrl(tab, Globals.ApplicationURL(tab.TabID)); + + + tabUrl = Globals.ResolveUrl(Regex.Replace(tabUrl, domainName, "~", RegexOptions.IgnoreCase)); + + var tabName = Microsoft.JScript.GlobalObject.escape(tab.TabName); + + if (tab.Level.Equals(0)) + { + pagesArray.AppendFormat("new Array('| {0}','{1}'),", tabName, tabUrl); + } + else + { + var separator = new StringBuilder(); + + for (var index = 0; index < tab.Level; index++) + { + separator.Append("--"); + } + + pagesArray.AppendFormat("new Array('|{0} {1}','{2}'),", separator, tabName, tabUrl); + } + } + + if (pagesArray.ToString().EndsWith(",")) + { + pagesArray.Remove(pagesArray.Length - 1, 1); + } + + pagesArray.Append("]"); + + return pagesArray.ToString(); + } + #endregion #region Public Methods diff --git a/GlobalAssemblyInfo.cs b/GlobalAssemblyInfo.cs index 4c593dd..ae3d31a 100644 --- a/GlobalAssemblyInfo.cs +++ b/GlobalAssemblyInfo.cs @@ -26,5 +26,5 @@ [assembly: ComVisible(false)] -[assembly: AssemblyVersion("2.01.12")] -[assembly: AssemblyFileVersion("2.01.1.2")] \ No newline at end of file +[assembly: AssemblyVersion("2.01.13")] +[assembly: AssemblyFileVersion("2.01.1.3")] \ No newline at end of file diff --git a/WatchersNET.CKEditor.sln b/WatchersNET.CKEditor.sln index ef2b396..a537b96 100644 --- a/WatchersNET.CKEditor.sln +++ b/WatchersNET.CKEditor.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26730.16 +VisualStudioVersion = 15.0.27130.2036 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DNN 7", "DNN 7", "{9EA2F6AC-913E-41BD-9A33-127E2F7B22FC}" EndProject