From 4530f58b44d8649e685c0cfeec6e38bd1c6d5402 Mon Sep 17 00:00:00 2001 From: roman-yagodin Date: Fri, 19 Feb 2021 14:51:39 +0300 Subject: [PATCH] Wrap DnnUrlControl into custom control GH-117 --- R7.Documents.Dnn/Controls/UrlControlWrapper.ascx | 7 +++++++ R7.Documents.Dnn/EditDocuments.ascx | 11 +++-------- R7.Documents.Dnn/EditDocuments.ascx.controls.cs | 3 ++- R7.Documents.Dnn/EditDocuments.ascx.cs | 2 +- R7.Documents.Dnn/R7.Documents.Dnn.csproj | 5 +++++ 5 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 R7.Documents.Dnn/Controls/UrlControlWrapper.ascx diff --git a/R7.Documents.Dnn/Controls/UrlControlWrapper.ascx b/R7.Documents.Dnn/Controls/UrlControlWrapper.ascx new file mode 100644 index 0000000..f54dda4 --- /dev/null +++ b/R7.Documents.Dnn/Controls/UrlControlWrapper.ascx @@ -0,0 +1,7 @@ +<%@ Control Language="C#" CodeBehind="UrlControlWrapper.ascx.cs" Inherits="R7.Documents.Controls.UrlControlWrapper" %> +<%@ Register TagPrefix="dnn" TagName="Url" Src="~/controls/DnnUrlControl.ascx" %> + diff --git a/R7.Documents.Dnn/EditDocuments.ascx b/R7.Documents.Dnn/EditDocuments.ascx index c13d19e..4d78cd2 100644 --- a/R7.Documents.Dnn/EditDocuments.ascx +++ b/R7.Documents.Dnn/EditDocuments.ascx @@ -1,8 +1,8 @@ <%@ Control Language="C#" AutoEventWireup="false" CodeBehind="EditDocuments.ascx.cs" Inherits="R7.Documents.EditDocuments" %> -<%@ Register TagPrefix="dnn" TagName="URL" Src="~/controls/DnnUrlControl.ascx" %> <%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %> <%@ Register TagPrefix="dnn" TagName="Tracking" Src="~/controls/URLTrackingControl.ascx" %> <%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> +<%@ Register TagPrefix="r7docs" TagName="Url" Src="~/DesktopModules/R7.Documents/R7.Documents.Dnn/Controls/UrlControlWrapper.ascx" %> <%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web.Deprecated" %> <%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %> @@ -26,13 +26,8 @@
-
- -
-
+ +
10 diff --git a/R7.Documents.Dnn/EditDocuments.ascx.controls.cs b/R7.Documents.Dnn/EditDocuments.ascx.controls.cs index 8fb46cf..3c33c1d 100644 --- a/R7.Documents.Dnn/EditDocuments.ascx.controls.cs +++ b/R7.Documents.Dnn/EditDocuments.ascx.controls.cs @@ -1,6 +1,7 @@ using System.Web.UI.WebControls; using DotNetNuke.UI.UserControls; using DotNetNuke.Web.UI.WebControls; +using R7.Documents.Controls; namespace R7.Documents { @@ -8,7 +9,7 @@ public partial class EditDocuments { protected TextBox txtTitle; protected RequiredFieldValidator valName; - protected DnnUrlControl ctlUrl; + protected UrlControlWrapper ctlUrl; protected TextBox txtCategory; protected TextBox txtDescription; protected CheckBox chkForceDownload; diff --git a/R7.Documents.Dnn/EditDocuments.ascx.cs b/R7.Documents.Dnn/EditDocuments.ascx.cs index fb9a67d..78e4c24 100644 --- a/R7.Documents.Dnn/EditDocuments.ascx.cs +++ b/R7.Documents.Dnn/EditDocuments.ascx.cs @@ -251,7 +251,7 @@ void LoadNewDocument () txtSortIndex.Text = ((CalculateSortIndex () ?? 0) + 10).ToString (); if (IsFirstLoad) { - SelectFolder (ctlUrl, Settings.DefaultFolder ?? FolderHistory.GetLastFolderId (Request, PortalId)); + SelectFolder (ctlUrl.BaseUrlControl, Settings.DefaultFolder ?? FolderHistory.GetLastFolderId (Request, PortalId)); } ctlUrl.NewWindow = DocumentsConfig.Instance.NewWindow; diff --git a/R7.Documents.Dnn/R7.Documents.Dnn.csproj b/R7.Documents.Dnn/R7.Documents.Dnn.csproj index e476d63..45fb476 100644 --- a/R7.Documents.Dnn/R7.Documents.Dnn.csproj +++ b/R7.Documents.Dnn/R7.Documents.Dnn.csproj @@ -113,6 +113,7 @@ + @@ -153,6 +154,10 @@ + + ASPXCodeBehind + UrlControlWrapper.ascx + ViewDocuments.ascx