Skip to content
This repository was archived by the owner on Aug 4, 2019. It is now read-only.

Commit eac3d81

Browse files
committed
FIXED #26 Uncaught ReferenceError: dnnpagesSelectBox is not defined
1 parent 075766f commit eac3d81

19 files changed

+202
-347
lines changed

CKEditor/plugins/dnnpages/plugin.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
icons: 'anchor,anchor-rtl,link,unlink', // %REMOVE_LINE_CORE%
88
hidpi: true, // %REMOVE_LINE_CORE%
99
onLoad: function() {
10-
CKEDITOR.scriptLoader.load(CKEDITOR.basePath + 'Tabs.ashx?PortalID=' + document.getElementById('CKDNNporid').value);
11-
1210
// Add the CSS styles for anchor placeholders.
1311
var iconPath = CKEDITOR.getUrl(this.path + 'images' + (CKEDITOR.env.hidpi ? '/hidpi' : '') + '/anchor.png'),
1412
baseStyle = 'background:url(' + iconPath + ') no-repeat %1 center;border:1px dotted #00f;background-size:16px;';
@@ -501,8 +499,8 @@
501499
else if (href && (urlMatch = href.match(urlRegex))) {
502500
var isLocalPage = false;
503501
// check for portal page
504-
for (var iPage = 0; iPage < dnnpagesSelectBox.length; iPage++) {
505-
if (dnnpagesSelectBox[iPage][1] == href) {
502+
for (var iPage = 0; iPage < editor.config.dnnPagesArray; iPage++) {
503+
if (editor.config.dnnPagesArray[iPage][1] == href) {
506504
isLocalPage = true;
507505
}
508506
}
@@ -852,15 +850,12 @@
852850
var dialogDefinition = ev.data.definition;
853851

854852
if (dialogName == 'link') {
855-
if (typeof (dnnpagesSelectBox) === 'undefined') {
856-
console.log('yes');
853+
if (typeof (ev.editor.config.dnnPagesArray) === 'undefined') {
857854
return;
858-
} else {
859-
console.log('no');
860855
}
861856

862-
for (var i = 0; i < dnnpagesSelectBox.length; i++) {
863-
dnnpagesSelectBox[i][0] = unescape(dnnpagesSelectBox[i][0]);
857+
for (var i = 0; i < ev.editor.config.dnnPagesArray.length; i++) {
858+
ev.editor.config.dnnPagesArray[i][0] = unescape(ev.editor.config.dnnPagesArray[i][0]);
864859
}
865860

866861
var editor = ev.editor;
@@ -1033,7 +1028,7 @@
10331028
label: editor.lang.dnnpages.localPageLabel,
10341029
id: 'localPage',
10351030
title: editor.lang.dnnpages.localPageTitle,
1036-
items: dnnpagesSelectBox,
1031+
items: editor.config.dnnPagesArray,
10371032
setup: function(data) {
10381033
if (data.localPage) {
10391034
this.setValue(data.localPage);

DNN 7/Install/CKReleaseNotes.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,17 @@
66
<title>CKEditor Provider Readme</title>
77
</head>
88
<body>
9-
<h1>CKEditor 4.8.0 Editor Provider 2.01.12 <small>For DNN® Platform 07.04.02 (or above)</small></h1>
9+
<h1>CKEditor 4.8.0 Editor Provider 2.01.13 <small>For DNN® Platform 07.04.02 (or above)</small></h1>
1010
<h4>What's New</h4>
1111
<div class="dnnFormMessage dnnFormSuccess">
1212
<ul>
13-
<li>Upgraded to CKEditor 4.8.0</li>
14-
<li>Added Support for the Upload Image Plugin</li>
13+
<li></li>
1514
</ul>
1615
</div>
1716
<h5>changes</h5>
1817
<div class="dnnFormMessage dnnFormInfo">
1918
<ul>
20-
<li></li>
19+
<li>FIXED #26 Uncaught ReferenceError: dnnpagesSelectBox is not defined</li>
2120
</ul>
2221
</div>
2322
</body>
0 Bytes
Binary file not shown.

DNN 7/Tabs.ashx

Lines changed: 0 additions & 1 deletion
This file was deleted.

DNN 7/Tabs.ashx.cs

Lines changed: 0 additions & 106 deletions
This file was deleted.

DNN 7/WatchersNET.CKEditor - DNN7.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,6 @@
149149
<Compile Include="Objects\UploadImage.cs" />
150150
<Compile Include="Objects\UploadSizeRoles.cs" />
151151
<Compile Include="Objects\WordCountConfig.cs" />
152-
<Compile Include="Tabs.ashx.cs">
153-
<DependentUpon>Tabs.ashx</DependentUpon>
154-
<SubType>ASPXCodeBehind</SubType>
155-
</Compile>
156152
<Compile Include="Utilities\AnchorFinder.cs" />
157153
<Compile Include="Browser\Browser.aspx.cs">
158154
<DependentUpon>Browser.aspx</DependentUpon>
@@ -297,7 +293,6 @@
297293
<None Include="Install\WatchersNET.CKHtmlEditorProvider.dnn">
298294
<SubType>Designer</SubType>
299295
</None>
300-
<Content Include="Tabs.ashx" />
301296
<None Include="packages.config" />
302297
</ItemGroup>
303298
<ItemGroup />

DNN 7/Web/CKEditorControl.cs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace WatchersNET.CKEditor.Web
2222
using System.IO;
2323
using System.Linq;
2424
using System.Text;
25+
using System.Text.RegularExpressions;
2526
using System.Threading;
2627
using System.Web;
2728
using System.Web.UI;
@@ -32,6 +33,7 @@ namespace WatchersNET.CKEditor.Web
3233
using DotNetNuke.Common.Utilities;
3334
using DotNetNuke.Entities.Modules;
3435
using DotNetNuke.Entities.Portals;
36+
using DotNetNuke.Entities.Tabs;
3537
using DotNetNuke.Framework.JavaScriptLibraries;
3638
using DotNetNuke.Framework.Providers;
3739
using DotNetNuke.Security;
@@ -429,6 +431,9 @@ var info in
429431
// Inject maxFileSize
430432
this._settings["maxFileSize"] = Utility.GetMaxUploadSize().ToString();
431433

434+
// Inject Tabs for the dnnpages plugin
435+
this._settings["dnnPagesArray"] = this.GetTabsArray();
436+
432437
HttpContext.Current.Session["CKDNNtabid"] = this._portalSettings.ActiveTab.TabID;
433438
HttpContext.Current.Session["CKDNNporid"] = this._portalSettings.PortalId;
434439

@@ -678,6 +683,62 @@ private static string SResXFile
678683
}
679684
}
680685

686+
687+
688+
/// <summary>
689+
/// Gets the tabs array.
690+
/// </summary>
691+
/// <returns>Returns the Tabs Array as String</returns>
692+
private string GetTabsArray()
693+
{
694+
// Generate Pages Array
695+
var pagesArray = new StringBuilder();
696+
697+
pagesArray.Append("[");
698+
699+
var domainName = string.Format("http://{0}", Globals.GetDomainName(HttpContext.Current.Request, true));
700+
701+
foreach (var tab in TabController.GetPortalTabs(
702+
this._portalSettings.PortalId, -1, false, null, true, false, true, true, true))
703+
{
704+
var tabUrl = PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", this._portalSettings.PortalId, false)
705+
&& !string.IsNullOrEmpty(tab.CultureCode)
706+
? Globals.FriendlyUrl(
707+
tab,
708+
string.Format("{0}&language={1}", Globals.ApplicationURL(tab.TabID), tab.CultureCode))
709+
: Globals.FriendlyUrl(tab, Globals.ApplicationURL(tab.TabID));
710+
711+
712+
tabUrl = Globals.ResolveUrl(Regex.Replace(tabUrl, domainName, "~", RegexOptions.IgnoreCase));
713+
714+
var tabName = Microsoft.JScript.GlobalObject.escape(tab.TabName);
715+
716+
if (tab.Level.Equals(0))
717+
{
718+
pagesArray.AppendFormat("new Array('| {0}','{1}'),", tabName, tabUrl);
719+
}
720+
else
721+
{
722+
var separator = new StringBuilder();
723+
724+
for (var index = 0; index < tab.Level; index++)
725+
{
726+
separator.Append("--");
727+
}
728+
729+
pagesArray.AppendFormat("new Array('|{0} {1}','{2}'),", separator, tabName, tabUrl);
730+
}
731+
}
732+
733+
if (pagesArray.ToString().EndsWith(","))
734+
{
735+
pagesArray.Remove(pagesArray.Length - 1, 1);
736+
}
737+
738+
pagesArray.Append("]");
739+
740+
return pagesArray.ToString();
741+
}
681742
#endregion
682743

683744
#region Public Methods

DNN 8/Install/CKReleaseNotes.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@
66
<title>CKEditor Provider Readme</title>
77
</head>
88
<body>
9-
<h1>CKEditor 4.8.0 Editor Provider 2.01.12 <small>For DNN® Platform 08.04.00 (or above)</small></h1>
9+
<h1>CKEditor 4.8.0 Editor Provider 2.01.13 <small>For DNN® Platform 08.04.00 (or above)</small></h1>
1010
<h4>What's New</h4>
1111
<div class="dnnFormMessage dnnFormSuccess">
1212
<ul>
13-
<li>Upgraded to CKEditor 4.8.0</li>
14-
<li>Added Support for the Upload Image Plugin</li>
13+
<li> </li>
1514
</ul>
1615
</div>
1716
<h5>changes</h5>
1817
<div class="dnnFormMessage dnnFormInfo">
1918
<ul>
20-
<li></li>
21-
</ul>
19+
<li>FIXED #26 Uncaught ReferenceError: dnnpagesSelectBox is not defined</li>
20+
</ul>
2221
</div>
2322
</body>
2423
</html>

DNN 8/Tabs.ashx

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)