Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Client Resources Manager for CKEditor Provider dialogs #5205

Merged
merged 6 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
<value>Relative URL - &lt;em&gt;'/Images/MyImage.jpg'&lt;/em&gt;</value>
</data>
<data name="Wait.Text" xml:space="preserve">
<value>Please Wait...</value>
<value>Please Wait</value>
</data>
<data name="WaitMessage.Text" xml:space="preserve">
<value>Loading Page and Parsing Anchors.</value>
Expand Down Expand Up @@ -393,7 +393,7 @@
<value>Uploaded file is bigger then the allowed file size.</value>
</data>
<data name="AddFiles.Text" xml:space="preserve">
<value>Add file(s)...</value>
<value>Add file(s)</value>
</data>
<data name="DropHere.Text" xml:space="preserve">
<value>Drop file(s) here</value>
Expand All @@ -414,7 +414,7 @@
<value>Created</value>
</data>
<data name="lblBrowserModus.Text" xml:space="preserve">
<value>Browser-Modus: {0}</value>
<value>Browser Mode: {0}</value>
</data>
<data name="Size.Text" xml:space="preserve">
<value>Size</value>
Expand All @@ -434,4 +434,7 @@
<data name="SortByDateDescending.Text" xml:space="preserve">
<value>Sort By Descending Date</value>
</data>
<data name="BrowserModus.Text" xml:space="preserve">
<value>Browser Mode: {0}</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<%@ Page language="c#" Codebehind="Browser.aspx.cs" AutoEventWireup="True" Inherits="DNNConnect.CKEditorProvider.Browser.Browser" %>
<%@ Register TagPrefix="dnn" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %>
<%@ Register TagPrefix="dnncrm" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>
<%@ Register TagPrefix="wnet" Namespace="DNNConnect.CKEditorProvider.Controls" Assembly="DNNConnect.CKEditorProvider" %>
<!DOCTYPE html>
<html lang="en">
<head>
<head runat="server">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="language" content="en" />
<title id="title" runat="server">DNNConnect.CKEditorProvider.FileBrowser</title>
<link rel="stylesheet" type="text/css" href="Browser.comb.min.css" />
<asp:Placeholder id="favicon" runat="server"></asp:Placeholder>
<script src="js/Browser.js" type="text/javascript"></script>
<asp:PlaceHolder runat="server" ID="ClientDependencyHeadCss" />
<asp:PlaceHolder runat="server" ID="ClientDependencyHeadJs" />
</head>
<body>
<form id="fBrowser" method="post" runat="server">
<asp:PlaceHolder ID="BodySCRIPTS" runat="server" />
<asp:ScriptManager ID="scriptManager1" runat="server"></asp:ScriptManager>
<div id="BrowserContainer">
<h1><asp:Label id="lblModus" runat="server"></asp:Label></h1>
Expand Down Expand Up @@ -374,6 +376,7 @@
</div>
</asp:Panel>
<!-- / Loading screen -->
<asp:PlaceHolder runat="server" ID="ClientResourcesFormBottom" />
</form>
<script type="text/javascript">
$(function() {
Expand Down Expand Up @@ -433,6 +436,14 @@
});
});
</script>

<asp:PlaceHolder runat="server" id="ClientResourceIncludes" />

<dnncrm:ClientResourceLoader runat="server" id="ClientResourceLoader">
<Paths>
<dnncrm:ClientResourcePath Name="SharedScripts" Path="~/Resources/Shared/Scripts/" />
</Paths>
</dnncrm:ClientResourceLoader>
</body>
</html>

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ClientDependency.Core, Version=1.9.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Dnn.ClientDependency.1.9.10\lib\net45\ClientDependency.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ApplicationBlocks.Data">
<HintPath>..\..\..\Components\DataAccessBlock\bin\Microsoft.ApplicationBlocks.Data.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -349,7 +352,9 @@
</ItemGroup>
<ItemGroup>
<Content Include="App_LocalResources\Browser.aspx.de-DE.resx" />
<Content Include="App_LocalResources\Browser.aspx.resx" />
<Content Include="App_LocalResources\Browser.aspx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="App_LocalResources\Options.aspx.de-DE.resx">
<SubType>Designer</SubType>
</Content>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<%@ Page language="c#" Codebehind="Options.aspx.cs" AutoEventWireup="True" Inherits="DNNConnect.CKEditorProvider.Options" %>
<%@ Register TagPrefix="dnncrm" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>

<!DOCTYPE html>
<html lang="en">
<head>
<head runat="server">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="language" content="en" />
<title>CKEditor Options</title>
<asp:PlaceHolder id="favicon" runat="server"></asp:PlaceHolder>
<asp:PlaceHolder runat="server" ID="ClientDependencyHeadCss" />
<asp:PlaceHolder runat="server" ID="ClientDependencyHeadJs" />
<script type="text/javascript">
var saveGroupName = '<%= DotNetNuke.Services.Localization.Localization.GetString("SaveGroupName.Text", this.ResXFile, this.LangCode) %>';
var deleteGroup = '<%= DotNetNuke.Services.Localization.Localization.GetString("DeleteGroup.Text", this.ResXFile, this.LangCode) %>';
Expand All @@ -22,7 +25,17 @@
</head>
<body>
<form id="ckOptionsForm" runat="server">
<asp:PlaceHolder id="phControls" runat="server"></asp:PlaceHolder>
</form>
<asp:PlaceHolder ID="BodySCRIPTS" runat="server" />
<asp:PlaceHolder id="phControls" runat="server" />
<asp:PlaceHolder runat="server" ID="ClientResourcesFormBottom" />
</form>

<asp:PlaceHolder runat="server" id="ClientResourceIncludes" />

<dnncrm:ClientResourceLoader runat="server" id="ClientResourceLoader">
<Paths>
<dnncrm:ClientResourcePath Name="SharedScripts" Path="~/Resources/Shared/Scripts/" />
</Paths>
</dnncrm:ClientResourceLoader>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace DNNConnect.CKEditorProvider
{
using System;
using System.Globalization;
using System.IO;
using System.Web;
using System.Web.UI.HtmlControls;

using DNNConnect.CKEditorProvider.Controls;
using DotNetNuke.Common;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Framework;
using DotNetNuke.Framework.JavaScriptLibraries;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.Web.Client.ClientResourceManagement;

/// <summary>
/// The options page.
Expand Down Expand Up @@ -71,57 +71,13 @@ protected string ResXFile
/// </param>
protected override void OnPreRender(EventArgs e)
{
var jqueryScriptLink = new HtmlGenericControl("script");

jqueryScriptLink.Attributes["type"] = "text/javascript";
jqueryScriptLink.Attributes["src"] = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";

this.favicon.Controls.Add(jqueryScriptLink);

var jqueryUiScriptLink = new HtmlGenericControl("script");

jqueryUiScriptLink.Attributes["type"] = "text/javascript";
jqueryUiScriptLink.Attributes["src"] = "//ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js";

this.favicon.Controls.Add(jqueryUiScriptLink);

var notificationScriptLink = new HtmlGenericControl("script");

notificationScriptLink.Attributes["type"] = "text/javascript";
notificationScriptLink.Attributes["src"] = this.ResolveUrl("js/jquery.notification.js");

this.favicon.Controls.Add(notificationScriptLink);

var optionsScriptLink = new HtmlGenericControl("script");

optionsScriptLink.Attributes["type"] = "text/javascript";
optionsScriptLink.Attributes["src"] = this.ResolveUrl("js/Options.js");

this.favicon.Controls.Add(optionsScriptLink);

var objCssLink = new HtmlGenericSelfClosing("link");

objCssLink.Attributes["rel"] = "stylesheet";
objCssLink.Attributes["type"] = "text/css";
objCssLink.Attributes["href"] = "//ajax.googleapis.com/ajax/libs/jqueryui/1/themes/blitzer/jquery-ui.css";

this.favicon.Controls.Add(objCssLink);

var notificationCssLink = new HtmlGenericSelfClosing("link");

notificationCssLink.Attributes["rel"] = "stylesheet";
notificationCssLink.Attributes["type"] = "text/css";
notificationCssLink.Attributes["href"] = this.ResolveUrl("css/jquery.notification.css");

this.favicon.Controls.Add(notificationCssLink);

var optionsCssLink = new HtmlGenericSelfClosing("link");

optionsCssLink.Attributes["rel"] = "stylesheet";
optionsCssLink.Attributes["type"] = "text/css";
optionsCssLink.Attributes["href"] = this.ResolveUrl("css/Options.css");

this.favicon.Controls.Add(optionsCssLink);
JavaScript.RequestRegistration(CommonJs.jQuery);
JavaScript.RequestRegistration(CommonJs.jQueryUI);
ClientResourceManager.RegisterScript(this.Page, this.ResolveUrl("js/jquery.notification.js"));
ClientResourceManager.RegisterScript(this.Page, this.ResolveUrl("js/Options.js"));
ClientResourceManager.RegisterStyleSheet(this.Page, "https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/blitzer/jquery-ui.css");
ClientResourceManager.RegisterStyleSheet(this.Page, this.ResolveUrl("css/jquery.notification.css"));
ClientResourceManager.RegisterStyleSheet(this.Page, this.ResolveUrl("css/Options.css"));

base.OnPreRender(e);
}
Expand Down Expand Up @@ -256,6 +212,9 @@ private PortalSettings GetPortalSettings()
private void InitializeComponent()
{
this.curPortalSettings = this.GetPortalSettings();

this.ClientResourceLoader.DataBind();
this.ClientResourceLoader.PreRender += (sender, args) => JavaScript.Register(this.Page);
}

/// <summary>
Expand Down
Loading