Skip to content

Commit 6ab91ca

Browse files
committed
Resolve deprecation errors
Also update related markup files to use encoding bee-stings
1 parent 68ae548 commit 6ab91ca

11 files changed

Lines changed: 80 additions & 46 deletions

File tree

DNN Platform/Admin Modules/Dnn.Modules.Console/Settings.ascx.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,16 @@ private void TabsItemDataBound(object sender, RepeaterItemEventArgs e)
260260

261261
visibilityDropDown.Items.Clear();
262262

263-
visibilityDropDown.AddItem(this.LocalizeString("AllUsers"), "AllUsers");
263+
visibilityDropDown.AddItem(this.LocalizeText("AllUsers"), "AllUsers");
264264
if (this.modeList.SelectedValue == "Profile")
265265
{
266-
visibilityDropDown.AddItem(this.LocalizeString("Friends"), "Friends");
267-
visibilityDropDown.AddItem(this.LocalizeString("User"), "User");
266+
visibilityDropDown.AddItem(this.LocalizeText("Friends"), "Friends");
267+
visibilityDropDown.AddItem(this.LocalizeText("User"), "User");
268268
}
269269
else
270270
{
271-
visibilityDropDown.AddItem(this.LocalizeString("Owner"), "Owner");
272-
visibilityDropDown.AddItem(this.LocalizeString("Members"), "Members");
271+
visibilityDropDown.AddItem(this.LocalizeText("Owner"), "Owner");
272+
visibilityDropDown.AddItem(this.LocalizeText("Members"), "Members");
273273
}
274274

275275
tabLabel.Text = tab.TabName;
Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
<%@ Control Language="C#" AutoEventWireup="false" CodeBehind="DataConsent.ascx.cs" Inherits="DotNetNuke.Modules.Admin.Users.DataConsent" %>
2-
<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
3-
<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls" %>
42
<div class="dnnForm dnnPasswordReset dnnClear">
53
<div>
64
<asp:CheckBox runat="server" ID="chkAgree" />
7-
<%= String.Format(DotNetNuke.Services.Localization.Localization.GetString("DataConsent", LocalResourceFile),
8-
PortalSettings.Current.TermsTabId == Null.NullInteger ? DotNetNuke.Common.Globals.NavigateURL(PortalSettings.Current.ActiveTab.TabID, "Terms") : DotNetNuke.Common.Globals.NavigateURL(PortalSettings.Current.TermsTabId),
9-
PortalSettings.Current.PrivacyTabId == Null.NullInteger ? DotNetNuke.Common.Globals.NavigateURL(PortalSettings.Current.ActiveTab.TabID, "Privacy") : DotNetNuke.Common.Globals.NavigateURL(PortalSettings.Current.PrivacyTabId)) %>
5+
<%: DataConsentHtml %>
106
</div>
117
<asp:Panel runat="server" ID="pnlNoAgreement">
128
</asp:Panel>
139
<ul class="dnnActions dnnClear">
14-
<li>
15-
<asp:Button ID="cmdSubmit" CssClass="dnnPrimaryAction" runat="server" resourcekey="cmdSubmit" /></li>
16-
<li>
17-
<asp:Button ID="cmdCancel" CssClass="dnnSecondaryAction" runat="server" resourcekey="cmdCancel" /></li>
18-
<li>
19-
<asp:Button ID="cmdDeleteMe" CssClass="dnnSecondaryAction" runat="server" resourcekey="cmdDeleteMe" /></li>
10+
<li><asp:Button ID="cmdSubmit" CssClass="dnnPrimaryAction" runat="server" resourcekey="cmdSubmit" /></li>
11+
<li><asp:Button ID="cmdCancel" CssClass="dnnSecondaryAction" runat="server" resourcekey="cmdCancel" /></li>
12+
<li><asp:Button ID="cmdDeleteMe" CssClass="dnnSecondaryAction" runat="server" resourcekey="cmdDeleteMe" /></li>
2013
</ul>
2114
</div>

DNN Platform/Website/DesktopModules/Admin/Security/DataConsent.ascx.cs

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,45 @@ namespace DotNetNuke.Modules.Admin.Users
55
{
66
using System;
77
using System.Web;
8-
using System.Web.UI;
98

9+
using DotNetNuke.Abstractions;
10+
using DotNetNuke.Common.Utilities;
1011
using DotNetNuke.Entities.Modules;
1112
using DotNetNuke.Entities.Portals;
1213
using DotNetNuke.Entities.Users;
1314
using DotNetNuke.Security;
14-
using DotNetNuke.Services.Log.EventLog;
15+
using DotNetNuke.Services.Localization;
16+
17+
using Microsoft.Extensions.DependencyInjection;
1518

1619
/// <summary>A control which handles a user's consent to the site's usage of their data.</summary>
1720
public partial class DataConsent : UserModuleBase
1821
{
22+
private readonly INavigationManager navigationManager;
23+
24+
/// <summary>Initializes a new instance of the <see cref="DataConsent"/> class.</summary>
25+
[Obsolete("Deprecated in DotNetNuke 10.0.2. Please use overload with INavigationManager. Scheduled removal in v12.0.0.")]
26+
public DataConsent()
27+
: this(null)
28+
{
29+
}
30+
31+
/// <summary>Initializes a new instance of the <see cref="DataConsent"/> class.</summary>
32+
/// <param name="navigationManager">The navigation manager.</param>
33+
public DataConsent(INavigationManager navigationManager)
34+
{
35+
this.navigationManager = navigationManager ?? Common.Globals.GetCurrentServiceProvider().GetRequiredService<INavigationManager>();
36+
}
37+
38+
/// <summary>A function which handles the <see cref="DataConsent.DataConsentCompleted"/> event.</summary>
39+
/// <param name="sender">The event sender.</param>
40+
/// <param name="e">The event arguments.</param>
1941
public delegate void DataConsentEventHandler(object sender, DataConsentEventArgs e);
2042

43+
/// <summary>An event which is triggered when the user takes a data consent action.</summary>
2144
public event DataConsentEventHandler DataConsentCompleted;
2245

46+
/// <summary>The options a user can take from the data consent screen.</summary>
2347
public enum DataConsentStatus
2448
{
2549
/// <summary>Consented.</summary>
@@ -35,24 +59,46 @@ public enum DataConsentStatus
3559
FailedToRemoveAccount = 3,
3660
}
3761

62+
/// <summary>Gets the confirmation text to display when a user chooses for their account to be deleted.</summary>
3863
public string DeleteMeConfirmString
3964
{
4065
get
4166
{
4267
switch (this.PortalSettings.DataConsentUserDeleteAction)
4368
{
4469
case PortalSettings.UserDeleteAction.Manual:
45-
return this.LocalizeString("ManualDelete.Confirm");
70+
return this.LocalizeText("ManualDelete.Confirm");
4671
case PortalSettings.UserDeleteAction.DelayedHardDelete:
47-
return this.LocalizeString("DelayedHardDelete.Confirm");
72+
return this.LocalizeText("DelayedHardDelete.Confirm");
4873
case PortalSettings.UserDeleteAction.HardDelete:
49-
return this.LocalizeString("HardDelete.Confirm");
74+
return this.LocalizeText("HardDelete.Confirm");
5075
}
5176

5277
return string.Empty;
5378
}
5479
}
5580

81+
/// <summary>Gets the HTML to display with the statement agreeing to the terms and privacy policies.</summary>
82+
protected IHtmlString DataConsentHtml
83+
{
84+
get
85+
{
86+
var termsUrl = this.PortalSettings.TermsTabId == Null.NullInteger
87+
? this.navigationManager.NavigateURL(this.TabId, "Terms")
88+
: this.navigationManager.NavigateURL(this.PortalSettings.TermsTabId);
89+
var privacyUrl = this.PortalSettings.PrivacyTabId == Null.NullInteger
90+
? this.navigationManager.NavigateURL(this.TabId, "Privacy")
91+
: this.navigationManager.NavigateURL(this.PortalSettings.PrivacyTabId);
92+
var dataConsentHtml = string.Format(
93+
Localization.GetString("DataConsent"),
94+
termsUrl,
95+
privacyUrl);
96+
return new HtmlString(dataConsentHtml);
97+
}
98+
}
99+
100+
/// <summary>Called when any data consent action is completed.</summary>
101+
/// <param name="e">The details of the action.</param>
56102
public void OnDataConsentComplete(DataConsentEventArgs e)
57103
{
58104
this.DataConsentCompleted?.Invoke(this, e);
@@ -128,16 +174,10 @@ private void CmdDeleteMe_Click(object sender, EventArgs e)
128174
}
129175
}
130176

131-
/// <summary>
132-
/// The DataConsentEventArgs class provides a customised EventArgs class for
133-
/// the DataConsent Event.
134-
/// </summary>
177+
/// <summary>The DataConsentEventArgs class provides a customised EventArgs class for the <see cref="DataConsent.DataConsentCompleted"/> Event.</summary>
135178
public class DataConsentEventArgs
136179
{
137-
/// <summary>
138-
/// Initializes a new instance of the <see cref="DataConsentEventArgs"/> class.
139-
/// Constructs a new DataConsentEventArgs.
140-
/// </summary>
180+
/// <summary>Initializes a new instance of the <see cref="DataConsentEventArgs"/> class.</summary>
141181
/// <param name="status">The Data Consent Status.</param>
142182
public DataConsentEventArgs(DataConsentStatus status)
143183
{

DNN Platform/Website/DesktopModules/Admin/Security/Membership.ascx.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ public override void DataBind()
196196

197197
this.lastLockoutDate.Value = this.UserMembership.LastLockoutDate.Year > 2000
198198
? (object)this.UserMembership.LastLockoutDate
199-
: this.LocalizeString("Never");
199+
: this.LocalizeText("Never");
200200

201201
// ReSharper disable SpecifyACultureInStringConversionExplicitly
202-
this.lockedOut.Value = this.LocalizeString(this.UserMembership.LockedOut.ToString());
203-
this.approved.Value = this.LocalizeString(this.UserMembership.Approved.ToString());
204-
this.updatePassword.Value = this.LocalizeString(this.UserMembership.UpdatePassword.ToString());
205-
this.isDeleted.Value = this.LocalizeString(this.UserMembership.IsDeleted.ToString());
202+
this.lockedOut.Value = this.LocalizeText(this.UserMembership.LockedOut.ToString());
203+
this.approved.Value = this.LocalizeText(this.UserMembership.Approved.ToString());
204+
this.updatePassword.Value = this.LocalizeText(this.UserMembership.UpdatePassword.ToString());
205+
this.isDeleted.Value = this.LocalizeText(this.UserMembership.IsDeleted.ToString());
206206

207207
// show the user folder path without default parent folder, and only visible to admin.
208208
this.userFolder.Visible = this.UserInfo.IsInRole(this.PortalSettings.AdministratorRoleName);

DNN Platform/Website/DesktopModules/Admin/Security/ProfileDefinitions.ascx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<asp:TemplateColumn HeaderText="DataType">
2121
<ItemStyle Width="60px"></ItemStyle>
2222
<ItemTemplate>
23-
<asp:label id="lblDataType" runat="server" Text='<%# DisplayDataType((DotNetNuke.Entities.Profile.ProfilePropertyDefinition)Container.DataItem) %>'></asp:label>
23+
<asp:label id="lblDataType" runat="server" Text='<%#: DisplayDataType((DotNetNuke.Entities.Profile.ProfilePropertyDefinition)Container.DataItem) %>'></asp:label>
2424
</ItemTemplate>
2525
</asp:TemplateColumn>
2626
<dnn:textcolumn DataField="Length" HeaderText="Length" Width="50px" />
@@ -29,7 +29,7 @@
2929
<asp:TemplateColumn HeaderText="DefaultVisibility">
3030
<ItemStyle Width="100px"></ItemStyle>
3131
<ItemTemplate>
32-
<asp:label id="lbDefaultVisibility" runat="server" Text='<%# DisplayDefaultVisibility((DotNetNuke.Entities.Profile.ProfilePropertyDefinition)Container.DataItem) %>'></asp:label>
32+
<asp:label id="lbDefaultVisibility" runat="server" Text='<%#: DisplayDefaultVisibility((DotNetNuke.Entities.Profile.ProfilePropertyDefinition)Container.DataItem) %>'></asp:label>
3333
</ItemTemplate>
3434
</asp:TemplateColumn>
3535
<dnn:checkboxcolumn DataField="Required" HeaderText="Required" AutoPostBack="True" />

DNN Platform/Website/DesktopModules/Admin/Security/ProfileDefinitions.ascx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public string DisplayDefaultVisibility(ProfilePropertyDefinition definition)
162162
string retValue = Null.NullString;
163163
if (!string.IsNullOrEmpty(definition.DefaultVisibility.ToString()))
164164
{
165-
retValue = this.LocalizeString(definition.DefaultVisibility.ToString()) ?? definition.DefaultVisibility.ToString();
165+
retValue = this.LocalizeText(definition.DefaultVisibility.ToString()) ?? definition.DefaultVisibility.ToString();
166166
}
167167

168168
return retValue;

DNN Platform/Website/DesktopModules/Admin/Security/Register.ascx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ private void UserAuthenticated(object sender, UserAuthenticatedEventArgs e)
911911
}
912912
else
913913
{
914-
this.AddLocalizedModuleMessage(this.LocalizeString("NoEmail"), ModuleMessage.ModuleMessageType.RedError, true);
914+
this.AddLocalizedModuleMessage(this.LocalizeText("NoEmail"), ModuleMessage.ModuleMessageType.RedError, true);
915915
foreach (DnnFormItemBase formItem in this.userForm.Items)
916916
{
917917
formItem.Visible = formItem.DataField == "Email";

DNN Platform/Website/DesktopModules/Admin/Security/User.ascx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ private void CmdUpdate_Click(object sender, EventArgs e)
563563
var usersWithSameDisplayName = (System.Collections.Generic.List<UserInfo>)MembershipProvider.Instance().GetUsersBasicSearch(this.PortalId, 0, 2, "DisplayName", true, "DisplayName", this.User.DisplayName);
564564
if (usersWithSameDisplayName.Any(user => user.UserID != this.User.UserID))
565565
{
566-
UI.Skins.Skin.AddModuleMessage(this, this.LocalizeString("DisplayNameNotUnique"), UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
566+
UI.Skins.Skin.AddModuleMessage(this, this.LocalizeText("DisplayNameNotUnique"), UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
567567
return;
568568
}
569569
}

DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<%@ Control Language="C#" Inherits="DotNetNuke.Modules.Admin.Authentication.DNN.Login" AutoEventWireup="false" CodeBehind="Login.ascx.cs" %>
22
<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls"%>
33
<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls.Internal" Assembly="DotNetNuke.Web" %>
4+
<%@ Import Namespace="DotNetNuke.Common.Utilities" %>
45
<div class="dnnForm dnnLoginService dnnClear">
56
<div class="dnnFormItem">
67
<div class="dnnLabel">
@@ -44,7 +45,7 @@
4445
/*globals jQuery, window, Sys */
4546
(function ($, Sys) {
4647
const disabledActionClass = "dnnDisabledAction";
47-
const actionLinks = $('a[id^="dnn_ctr<%=ModuleId > Null.NullInteger ? ModuleId.ToString() : ""%>_Login_Login_DNN"]');
48+
const actionLinks = $('a[id^="dnn_ctr<%:ModuleId > Null.NullInteger ? ModuleId.ToString() : ""%>_Login_Login_DNN"]');
4849
function isActionDisabled($el) {
4950
return $el && $el.hasClass(disabledActionClass);
5051
}
@@ -76,7 +77,7 @@
7677
$(document).ready(function () {
7778
$(document).on('keydown', '.dnnLoginService', function (e) {
7879
if ($(e.target).is('input:text,input:password') && e.keyCode === 13) {
79-
var $loginButton = $('#dnn_ctr<%=ModuleId > Null.NullInteger ? ModuleId.ToString() : ""%>_Login_Login_DNN_cmdLogin');
80+
var $loginButton = $('#dnn_ctr<%:ModuleId > Null.NullInteger ? ModuleId.ToString() : ""%>_Login_Login_DNN_cmdLogin');
8081
if (isActionDisabled($loginButton)) {
8182
return false;
8283
}

DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ protected override void OnLoad(EventArgs e)
221221
useEmailAsUserName = !registrationFields.Contains("Username");
222222
}
223223

224-
this.plUsername.Text = this.LocalizeString(useEmailAsUserName ? "Email" : "Username");
224+
this.plUsername.Text = this.LocalizeText(useEmailAsUserName ? "Email" : "Username");
225225
this.divCaptcha1.Visible = this.UseCaptcha;
226226
this.divCaptcha2.Visible = this.UseCaptcha;
227227
}

0 commit comments

Comments
 (0)