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

Commit

Permalink
FIXED #26 Uncaught ReferenceError: dnnpagesSelectBox is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
w8tcha committed Mar 4, 2018
1 parent 075766f commit eac3d81
Show file tree
Hide file tree
Showing 19 changed files with 202 additions and 347 deletions.
17 changes: 6 additions & 11 deletions CKEditor/plugins/dnnpages/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;';
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions DNN 7/Install/CKReleaseNotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
<title>CKEditor Provider Readme</title>
</head>
<body>
<h1>CKEditor 4.8.0 Editor Provider 2.01.12 <small>For DNN® Platform 07.04.02 (or above)</small></h1>
<h1>CKEditor 4.8.0 Editor Provider 2.01.13 <small>For DNN® Platform 07.04.02 (or above)</small></h1>
<h4>What's New</h4>
<div class="dnnFormMessage dnnFormSuccess">
<ul>
<li>Upgraded to CKEditor 4.8.0</li>
<li>Added Support for the Upload Image Plugin</li>
<li></li>
</ul>
</div>
<h5>changes</h5>
<div class="dnnFormMessage dnnFormInfo">
<ul>
<li></li>
<li>FIXED #26 Uncaught ReferenceError: dnnpagesSelectBox is not defined</li>
</ul>
</div>
</body>
Expand Down
Binary file modified DNN 7/Install/bin/WatchersNET.CKEditor.dll
Binary file not shown.
1 change: 0 additions & 1 deletion DNN 7/Tabs.ashx

This file was deleted.

106 changes: 0 additions & 106 deletions DNN 7/Tabs.ashx.cs

This file was deleted.

5 changes: 0 additions & 5 deletions DNN 7/WatchersNET.CKEditor - DNN7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@
<Compile Include="Objects\UploadImage.cs" />
<Compile Include="Objects\UploadSizeRoles.cs" />
<Compile Include="Objects\WordCountConfig.cs" />
<Compile Include="Tabs.ashx.cs">
<DependentUpon>Tabs.ashx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Utilities\AnchorFinder.cs" />
<Compile Include="Browser\Browser.aspx.cs">
<DependentUpon>Browser.aspx</DependentUpon>
Expand Down Expand Up @@ -297,7 +293,6 @@
<None Include="Install\WatchersNET.CKHtmlEditorProvider.dnn">
<SubType>Designer</SubType>
</None>
<Content Include="Tabs.ashx" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
Expand Down
61 changes: 61 additions & 0 deletions DNN 7/Web/CKEditorControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -678,6 +683,62 @@ private static string SResXFile
}
}



/// <summary>
/// Gets the tabs array.
/// </summary>
/// <returns>Returns the Tabs Array as String</returns>
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
Expand Down
9 changes: 4 additions & 5 deletions DNN 8/Install/CKReleaseNotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
<title>CKEditor Provider Readme</title>
</head>
<body>
<h1>CKEditor 4.8.0 Editor Provider 2.01.12 <small>For DNN® Platform 08.04.00 (or above)</small></h1>
<h1>CKEditor 4.8.0 Editor Provider 2.01.13 <small>For DNN® Platform 08.04.00 (or above)</small></h1>
<h4>What's New</h4>
<div class="dnnFormMessage dnnFormSuccess">
<ul>
<li>Upgraded to CKEditor 4.8.0</li>
<li>Added Support for the Upload Image Plugin</li>
<li> </li>
</ul>
</div>
<h5>changes</h5>
<div class="dnnFormMessage dnnFormInfo">
<ul>
<li></li>
</ul>
<li>FIXED #26 Uncaught ReferenceError: dnnpagesSelectBox is not defined</li>
</ul>
</div>
</body>
</html>
1 change: 0 additions & 1 deletion DNN 8/Tabs.ashx

This file was deleted.

Loading

0 comments on commit eac3d81

Please sign in to comment.