-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP Add control for None and URL GH-117
- Loading branch information
1 parent
4530f58
commit e8a9b82
Showing
2 changed files
with
88 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
<%@ Control Language="C#" CodeBehind="UrlControlWrapper.ascx.cs" Inherits="R7.Documents.Controls.UrlControlWrapper" %> | ||
<%@ Register TagPrefix="dnn" TagName="Url" Src="~/controls/DnnUrlControl.ascx" %> | ||
<dnn:Url id="ctlUrl" runat="server" | ||
UrlType="F" | ||
ShowTabs="true" IncludeActiveTab="true" | ||
ShowNone="True" ShowNewWindow="True" | ||
ShowSecure="True" ShowDatabase="True" /> | ||
|
||
<div style="float:left"> | ||
<div>None? <asp:CheckBox id="chkNone" runat="server" /></div> | ||
<div>URL: <asp:TextBox id="txtUrl" runat="server" /></div> | ||
|
||
<dnn:Url id="ctlUrl" runat="server" | ||
UrlType="F" | ||
ShowUrls="false" | ||
ShowTabs="true" IncludeActiveTab="true" | ||
ShowNone="false" ShowNewWindow="True" | ||
ShowSecure="True" ShowDatabase="True" /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System.Web.UI; | ||
using System.Web.UI.WebControls; | ||
using DotNetNuke.Common; | ||
using DotNetNuke.Entities.Tabs; | ||
using DotNetNuke.Web.UI.WebControls; | ||
|
||
namespace R7.Documents.Controls | ||
{ | ||
public class UrlControlWrapper : UserControl | ||
{ | ||
#region Controls | ||
|
||
protected DnnUrlControl ctlUrl; | ||
protected CheckBox chkNone; | ||
protected TextBox txtUrl; | ||
|
||
#endregion | ||
|
||
public string Url | ||
{ | ||
get => GetUrl (); | ||
set => SetUrl (value); | ||
} | ||
|
||
string GetUrl () | ||
{ | ||
if (chkNone.Checked) { | ||
return string.Empty; | ||
} | ||
|
||
if (!string.IsNullOrEmpty (txtUrl.Text)) { | ||
return txtUrl.Text; | ||
} | ||
|
||
return ctlUrl.Url; | ||
} | ||
|
||
void SetUrl(string url) | ||
{ | ||
if (string.IsNullOrEmpty (url)) { | ||
chkNone.Checked = true; | ||
ctlUrl.Url = string.Empty; | ||
ctlUrl.UrlType = "N"; | ||
txtUrl.Text = string.Empty; | ||
return; | ||
} | ||
|
||
var urlType = Globals.GetURLType (url); | ||
if (urlType == TabType.File || urlType == TabType.Tab) { | ||
ctlUrl.Url = url; | ||
txtUrl.Text = string.Empty; | ||
chkNone.Checked = false; | ||
return; | ||
} | ||
|
||
ctlUrl.Url = string.Empty; | ||
ctlUrl.UrlType = "N"; | ||
txtUrl.Text = url; | ||
chkNone.Checked = false; | ||
} | ||
|
||
public bool NewWindow { | ||
get => ctlUrl.NewWindow; | ||
set => ctlUrl.NewWindow = value; | ||
} | ||
|
||
public bool Log => ctlUrl.Log; | ||
|
||
public bool Track => ctlUrl.Track; | ||
|
||
public string UrlType => ctlUrl.UrlType; | ||
|
||
public DnnUrlControl BaseUrlControl => ctlUrl; | ||
} | ||
} | ||
|