diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs
index 3beef6e9968..f59e7ef0963 100644
--- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs
+++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs
@@ -2,94 +2,103 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
-namespace Dnn.PersonaBar.SiteSettings.Services
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Dynamic;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Text.RegularExpressions;
- using System.Threading;
- using System.Web;
- using System.Web.Http;
-
- using Dnn.PersonaBar.Library;
- using Dnn.PersonaBar.Library.Attributes;
- using Dnn.PersonaBar.SiteSettings.Services.Dto;
- using DotNetNuke.Abstractions;
- using DotNetNuke.Common;
- using DotNetNuke.Common.Lists;
- using DotNetNuke.Common.Utilities;
- using DotNetNuke.Entities.Controllers;
- using DotNetNuke.Entities.Host;
- using DotNetNuke.Entities.Icons;
- using DotNetNuke.Entities.Modules;
- using DotNetNuke.Entities.Portals;
- using DotNetNuke.Entities.Profile;
- using DotNetNuke.Entities.Tabs;
- using DotNetNuke.Entities.Urls;
- using DotNetNuke.Entities.Users;
- using DotNetNuke.Instrumentation;
- using DotNetNuke.Security.Roles;
- using DotNetNuke.Services.Exceptions;
- using DotNetNuke.Services.FileSystem;
- using DotNetNuke.Services.Installer.Packages;
- using DotNetNuke.Services.Localization;
- using DotNetNuke.Services.Personalization;
- using DotNetNuke.Services.Search.Internals;
- using DotNetNuke.UI.Internals;
- using DotNetNuke.UI.Skins;
- using DotNetNuke.Web.Api;
- using DotNetNuke.Web.UI.WebControls;
-
- using Constants = Dnn.PersonaBar.Library.Constants;
- using FileInfo = System.IO.FileInfo;
-
+namespace Dnn.PersonaBar.SiteSettings.Services
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Data;
+ using System.Dynamic;
+ using System.Globalization;
+ using System.IO;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Text.RegularExpressions;
+ using System.Threading;
+ using System.Web;
+ using System.Web.Http;
+
+ using Dnn.PersonaBar.Library;
+ using Dnn.PersonaBar.Library.Attributes;
+ using Dnn.PersonaBar.SiteSettings.Services.Dto;
+ using DotNetNuke.Abstractions;
+ using DotNetNuke.Common;
+ using DotNetNuke.Common.Lists;
+ using DotNetNuke.Common.Utilities;
+ using DotNetNuke.Entities.Controllers;
+ using DotNetNuke.Entities.Host;
+ using DotNetNuke.Entities.Icons;
+ using DotNetNuke.Entities.Modules;
+ using DotNetNuke.Entities.Portals;
+ using DotNetNuke.Entities.Profile;
+ using DotNetNuke.Entities.Tabs;
+ using DotNetNuke.Entities.Urls;
+ using DotNetNuke.Entities.Users;
+ using DotNetNuke.Instrumentation;
+ using DotNetNuke.Security.Roles;
+ using DotNetNuke.Services.Exceptions;
+ using DotNetNuke.Services.FileSystem;
+ using DotNetNuke.Services.Installer.Packages;
+ using DotNetNuke.Services.Localization;
+ using DotNetNuke.Services.Personalization;
+ using DotNetNuke.Services.Search.Internals;
+ using DotNetNuke.UI.Internals;
+ using DotNetNuke.UI.Skins;
+ using DotNetNuke.Web.Api;
+ using DotNetNuke.Web.UI.WebControls;
+
+ using Constants = Dnn.PersonaBar.Library.Constants;
+ using FileInfo = System.IO.FileInfo;
+
+ ///
+ /// Provides Web API methods for the Site Settings module to use.
+ ///
[MenuPermission(MenuName = Components.Constants.Constants.MenuName)]
public class SiteSettingsController : PersonaBarApiController
{
-
- // Field Boost Settings - they are scaled down by 10.
- private const int DefaultSearchTitleBoost = 50;
- private const string AuthFailureMessage = "Authorization has been denied for this request.";
- private const int DefaultSearchTagBoost = 40;
- private const int DefaultSearchContentBoost = 35;
- private const int DefaultSearchDescriptionBoost = 20;
- private const int DefaultSearchAuthorBoost = 15;
-
- // Field Bosst Setting Names
- private const string SearchTitleBoostSetting = "Search_Title_Boost";
- private const string SearchTagBoostSetting = "Search_Tag_Boost";
- private const string SearchContentBoostSetting = "Search_Content_Boost";
- private const string SearchDescriptionBoostSetting = "Search_Description_Boost";
- private const string SearchAuthorBoostSetting = "Search_Author_Boost";
-
- private const double DefaultMessagingThrottlingInterval = 0.5; // set default MessagingThrottlingInterval value to 30 seconds.
- private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SiteSettingsController));
- private readonly Components.SiteSettingsController _controller = new Components.SiteSettingsController();
-
- protected INavigationManager NavigationManager { get; }
-
- public SiteSettingsController(INavigationManager navigationManager)
- {
- this.NavigationManager = navigationManager;
- }
-
- #region Site Info API
+ // Field Boost Settings - they are scaled down by 10.
+ private const int DefaultSearchTitleBoost = 50;
+ private const string AuthFailureMessage = "Authorization has been denied for this request.";
+ private const int DefaultSearchTagBoost = 40;
+ private const int DefaultSearchContentBoost = 35;
+ private const int DefaultSearchDescriptionBoost = 20;
+ private const int DefaultSearchAuthorBoost = 15;
+
+ // Field Bosst Setting Names
+ private const string SearchTitleBoostSetting = "Search_Title_Boost";
+ private const string SearchTagBoostSetting = "Search_Tag_Boost";
+ private const string SearchContentBoostSetting = "Search_Content_Boost";
+ private const string SearchDescriptionBoostSetting = "Search_Description_Boost";
+ private const string SearchAuthorBoostSetting = "Search_Author_Boost";
+
+ private const double DefaultMessagingThrottlingInterval = 0.5; // set default MessagingThrottlingInterval value to 30 seconds.
+ private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SiteSettingsController));
+ private readonly Components.SiteSettingsController controller = new Components.SiteSettingsController();
+ private readonly INavigationManager navigationManager;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// A manager to provide navigation services.
+ public SiteSettingsController(INavigationManager navigationManager)
+ {
+ this.navigationManager = navigationManager;
+ }
+
+ ///
+ /// Provides navigation services.
+ ///
+ [Obsolete("Deprecated in v9.10.2, please use DI to register your own navigation manager. Schedule for removal in v11")]
+ protected INavigationManager NavigationManager => this.navigationManager;
/// GET: api/SiteSettings/GetPortalSettings
///
/// Gets site settings.
///
- ///
- ///
- /// site settings.
+ /// The ID of the portal to get the settings for.
+ /// The culture in which to get the settings in.
+ /// Localized site settings.
[HttpGet]
[AdvancedPermission(MenuName = Components.Constants.Constants.MenuName, Permission = Components.Constants.Constants.SiteInfoView)]
public HttpResponseMessage GetPortalSettings(int? portalId, string cultureCode)
@@ -109,7 +118,8 @@ public HttpResponseMessage GetPortalSettings(int? portalId, string cultureCode)
var language = LocaleController.Instance.GetLocale(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
@@ -135,16 +145,18 @@ public HttpResponseMessage GetPortalSettings(int? portalId, string cultureCode)
folderPath = logoFile.Folder,
fileId = logoFile.FileId,
folderId = logoFile.FolderId,
- } : null,
+ }
+ : null,
FavIcon = favIcon != null ? new FileDto()
{
fileName = favIcon.FileName,
folderPath = favIcon.Folder,
fileId = favIcon.FileId,
folderId = favIcon.FolderId,
- } : null,
+ }
+ : null,
new DnnFileUploadOptions().ValidationCode,
- IconSet = PortalController.GetPortalSetting("DefaultIconLocation", pid, "Sigma", cultureCode).Replace("icons/", ""),
+ IconSet = PortalController.GetPortalSetting("DefaultIconLocation", pid, "Sigma", cultureCode).Replace("icons/", string.Empty),
};
return this.Request.CreateResponse(HttpStatusCode.OK, new
{
@@ -168,7 +180,7 @@ public HttpResponseMessage GetPortalSettings(int? portalId, string cultureCode)
///
/// Gets culture list.
///
- ///
+ /// The ID of the portal for which to get the list of cultures.
/// Culture List.
[HttpGet]
[AdvancedPermission(MenuName = Components.Constants.Constants.MenuName, Permission = Components.Constants.Constants.SiteInfoView)]
@@ -211,13 +223,12 @@ public HttpResponseMessage GetCultureList(int? portalId)
}
}
-
/// POST: api/SiteSettings/UpdatePortalSettings
///
/// Updates site settings.
///
- ///
- ///
+ /// .
+ /// A success or error message.
[HttpPost]
[ValidateAntiForgeryToken]
[AdvancedPermission(MenuName = Components.Constants.Constants.MenuName, Permission = Components.Constants.Constants.SiteInfoView + "&" + Components.Constants.Constants.SiteInfoEdit)]
@@ -236,18 +247,19 @@ public HttpResponseMessage UpdatePortalSettings(UpdateSiteSettingsRequest reques
var language = LocaleController.Instance.GetLocale(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
var portalInfo = PortalController.Instance.GetPortal(pid, cultureCode);
portalInfo.PortalName = request.PortalName;
- if (request.LogoFile != null && request.LogoFile.fileId != Null.NullInteger && !String.IsNullOrEmpty(request.LogoFile.fileName))
+ if (request.LogoFile != null && request.LogoFile.fileId != Null.NullInteger && !string.IsNullOrEmpty(request.LogoFile.fileName))
{
portalInfo.LogoFile = FileManager.Instance.GetFile(request.LogoFile.fileId).RelativePath;
}
- else // Set LogoFile to blank when no file is specified.
+ else
{
portalInfo.LogoFile = string.Empty;
}
@@ -275,16 +287,12 @@ public HttpResponseMessage UpdatePortalSettings(UpdateSiteSettingsRequest reques
}
}
- #endregion
-
- #region Site Behavior API
-
/// GET: api/SiteSettings/GetDefaultPagesSettings
///
/// Gets default pages settings.
///
- ///
- ///
+ /// The ID of the portal for which to getting the settings for.
+ /// The culture code for which to get the page settings in.
/// default pages settings.
[HttpGet]
[DnnAuthorize(StaticRoles = Constants.AdminsRoleName)]
@@ -305,12 +313,17 @@ public HttpResponseMessage GetDefaultPagesSettings(int? portalId, string culture
var language = LocaleController.Instance.GetLocale(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
var portal = PortalController.Instance.GetPortal(pid, cultureCode);
- var portalSettings = new PortalSettings(portal);
+ var localizedPortalSettings = PortalController.Instance.GetPortalSettings(portal.PortalID, cultureCode);
+
+ int redirectAfterLoginTabId = int.TryParse(localizedPortalSettings["Redirect_AfterLogin"], out redirectAfterLoginTabId) ? redirectAfterLoginTabId : -1;
+ int redirectAfterLogoutTabId = int.TryParse(localizedPortalSettings["Redirect_AfterLogout"], out redirectAfterLogoutTabId) ? redirectAfterLogoutTabId : -1;
+ int redirectAfterRegistrationTabId = int.TryParse(localizedPortalSettings["Redirect_AfterRegistration"], out redirectAfterRegistrationTabId) ? redirectAfterRegistrationTabId : -1;
return this.Request.CreateResponse(HttpStatusCode.OK, new
{
@@ -338,13 +351,13 @@ public HttpResponseMessage GetDefaultPagesSettings(int? portalId, string culture
TermsTabName = this.TabSanitizer(portal.TermsTabId, pid)?.TabName,
PrivacyTabId = this.TabSanitizer(portal.PrivacyTabId, pid)?.TabID,
PrivacyTabName = this.TabSanitizer(portal.PrivacyTabId, pid)?.TabName,
- RedirectAfterLoginTabId = this.TabSanitizer(portalSettings.Registration.RedirectAfterLogin, pid)?.TabID,
- RedirectAfterLoginTabName = this.TabSanitizer(portalSettings.Registration.RedirectAfterLogin, pid)?.TabName,
- RedirectAfterLogoutTabId = this.TabSanitizer(portalSettings.Registration.RedirectAfterLogout, pid)?.TabID,
- RedirectAfterLogoutTabName = this.TabSanitizer(portalSettings.Registration.RedirectAfterLogout, pid)?.TabName,
- RedirectAfterRegistrationTabId = this.TabSanitizer(portalSettings.Registration.RedirectAfterRegistration, pid)?.TabID,
- RedirectAfterRegistrationTabName = this.TabSanitizer(portalSettings.Registration.RedirectAfterRegistration, pid)?.TabName,
- portalSettings.PageHeadText,
+ RedirectAfterLoginTabId = this.TabSanitizer(redirectAfterLoginTabId, pid)?.TabID,
+ RedirectAfterLoginTabName = this.TabSanitizer(redirectAfterLoginTabId, pid)?.TabName,
+ RedirectAfterLogoutTabId = this.TabSanitizer(redirectAfterLogoutTabId, pid)?.TabID,
+ RedirectAfterLogoutTabName = this.TabSanitizer(redirectAfterLogoutTabId, pid)?.TabName,
+ RedirectAfterRegistrationTabId = this.TabSanitizer(redirectAfterRegistrationTabId, pid)?.TabID,
+ RedirectAfterRegistrationTabName = this.TabSanitizer(redirectAfterRegistrationTabId, pid)?.TabName,
+ PageHeadText = localizedPortalSettings["PageHeadText"],
},
});
}
@@ -378,7 +391,8 @@ public HttpResponseMessage UpdateDefaultPagesSettings(UpdateDefaultPagesSettings
var language = LocaleController.Instance.GetLocale(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
@@ -394,10 +408,10 @@ public HttpResponseMessage UpdateDefaultPagesSettings(UpdateDefaultPagesSettings
portalInfo.TermsTabId = this.ValidateTabId(request.TermsTabId, pid);
portalInfo.PrivacyTabId = this.ValidateTabId(request.PrivacyTabId, pid);
PortalController.Instance.UpdatePortalInfo(portalInfo);
-
- PortalController.UpdatePortalSetting(pid, "Redirect_AfterLogin", this.ValidateTabId(request.RedirectAfterLoginTabId, pid).ToString(), false, cultureCode);
- PortalController.UpdatePortalSetting(pid, "Redirect_AfterLogout", this.ValidateTabId(request.RedirectAfterLogoutTabId, pid).ToString(), false, cultureCode);
- PortalController.UpdatePortalSetting(pid, "Redirect_AfterRegistration", this.ValidateTabId(request.RedirectAfterRegistrationTabId, pid).ToString(), false, cultureCode);
+
+ PortalController.UpdatePortalSetting(pid, "Redirect_AfterLogin", this.ValidateTabId(request.RedirectAfterLoginTabId, pid).ToString(), false, cultureCode);
+ PortalController.UpdatePortalSetting(pid, "Redirect_AfterLogout", this.ValidateTabId(request.RedirectAfterLogoutTabId, pid).ToString(), false, cultureCode);
+ PortalController.UpdatePortalSetting(pid, "Redirect_AfterRegistration", this.ValidateTabId(request.RedirectAfterRegistrationTabId, pid).ToString(), false, cultureCode);
PortalController.UpdatePortalSetting(pid, "PageHeadText", string.IsNullOrEmpty(request.PageHeadText) ? "false" : request.PageHeadText);
return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
@@ -442,7 +456,7 @@ public HttpResponseMessage GetMessagingSettings(int? portalId)
AllowAttachments = PortalController.GetPortalSettingAsBoolean("MessagingAllowAttachments", pid, false),
ProfanityFilters = PortalController.GetPortalSettingAsBoolean("MessagingProfanityFilters", pid, false),
IncludeAttachments = PortalController.GetPortalSettingAsBoolean("MessagingIncludeAttachments", pid, false),
- SendEmail = PortalController.GetPortalSetting("MessagingSendEmail", pid, "YES") == "YES"
+ SendEmail = PortalController.GetPortalSetting("MessagingSendEmail", pid, "YES") == "YES",
},
});
}
@@ -527,7 +541,7 @@ public HttpResponseMessage GetProfileSettings(int? portalId)
v => new
{
label = v.ToString(),
- value = (int)v
+ value = (int)v,
}).ToList(),
});
}
@@ -561,6 +575,7 @@ public HttpResponseMessage UpdateProfileSettings(UpdateProfileSettingsRequest re
{
PortalController.UpdatePortalSetting(pid, FriendlyUrlSettings.RedirectOldProfileUrlSetting, request.RedirectOldProfileUrl ? "Y" : "N", false);
}
+
PortalController.UpdatePortalSetting(pid, FriendlyUrlSettings.VanityUrlPrefixSetting, request.VanityUrlPrefix, false);
PortalController.UpdatePortalSetting(pid, "Profile_DefaultVisibility", request.ProfileDefaultVisibility.ToString(), false);
PortalController.UpdatePortalSetting(pid, "Profile_DisplayVisibility", request.ProfileDisplayVisibility.ToString(), true);
@@ -641,7 +656,7 @@ public HttpResponseMessage GetProfileProperty(int? propertyId, int? portalId)
var profileProperty = ProfileController.GetPropertyDefinition(propertyId ?? -1, pid);
var listController = new ListController();
- var cultureList = Localization.LoadCultureInListItems(this.GetCultureDropDownType(pid), Thread.CurrentThread.CurrentUICulture.Name, "", false);
+ var cultureList = Localization.LoadCultureInListItems(this.GetCultureDropDownType(pid), Thread.CurrentThread.CurrentUICulture.Name, string.Empty, false);
var response = new
{
@@ -661,7 +676,8 @@ public HttpResponseMessage GetProfileProperty(int? propertyId, int? portalId)
profileProperty.Visible,
profileProperty.ViewOrder,
DefaultVisibility = (int)profileProperty.DefaultVisibility,
- } : null,
+ }
+ : null,
UserVisibilityOptions = Enum.GetValues(typeof(UserVisibilityMode)).Cast().Select(
v => new
{
@@ -680,7 +696,7 @@ public HttpResponseMessage GetProfileProperty(int? propertyId, int? portalId)
Icon = Globals.ResolveUrl(
string.IsNullOrEmpty(c.Value)
? "~/images/Flags/none.gif"
- : $"~/images/Flags/{c.Value}.gif")
+ : $"~/images/Flags/{c.Value}.gif"),
}),
};
return this.Request.CreateResponse(HttpStatusCode.OK, response);
@@ -696,11 +712,11 @@ public HttpResponseMessage GetProfileProperty(int? propertyId, int? portalId)
///
/// Gets profile property localization.
///
- ///
- ///
- ///
- ///
- /// profile property.
+ /// The ID of the portal for which to get the profile properties for.
+ /// The name of the property to get.
+ /// The category of the property to get.
+ /// The culture code in which to get the category in.
+ /// Profile property.
[HttpGet]
[DnnAuthorize(StaticRoles = Constants.AdminsRoleName)]
public HttpResponseMessage GetProfilePropertyLocalization(int? portalId, string cultureCode, string propertyName, string propertyCategory)
@@ -718,7 +734,8 @@ public HttpResponseMessage GetProfilePropertyLocalization(int? portalId, string
var language = LocaleController.Instance.GetLocale(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
@@ -729,11 +746,11 @@ public HttpResponseMessage GetProfilePropertyLocalization(int? portalId, string
PropertyLocalization = new
{
Language = cultureCode,
- PropertyName = Localization.GetString("ProfileProperties_" + propertyName, resourceFile, cultureCode) ?? "",
- PropertyHelp = Localization.GetString("ProfileProperties_" + propertyName + ".Help", resourceFile, cultureCode) ?? "",
- PropertyRequired = Localization.GetString("ProfileProperties_" + propertyName + ".Required", resourceFile, cultureCode) ?? "",
- PropertyValidation = Localization.GetString("ProfileProperties_" + propertyName + ".Validation", resourceFile, cultureCode) ?? "",
- CategoryName = Localization.GetString("ProfileProperties_" + propertyCategory + ".Header", resourceFile, cultureCode) ?? ""
+ PropertyName = Localization.GetString("ProfileProperties_" + propertyName, resourceFile, cultureCode) ?? string.Empty,
+ PropertyHelp = Localization.GetString("ProfileProperties_" + propertyName + ".Help", resourceFile, cultureCode) ?? string.Empty,
+ PropertyRequired = Localization.GetString("ProfileProperties_" + propertyName + ".Required", resourceFile, cultureCode) ?? string.Empty,
+ PropertyValidation = Localization.GetString("ProfileProperties_" + propertyName + ".Validation", resourceFile, cultureCode) ?? string.Empty,
+ CategoryName = Localization.GetString("ProfileProperties_" + propertyCategory + ".Header", resourceFile, cultureCode) ?? string.Empty,
},
};
return this.Request.CreateResponse(HttpStatusCode.OK, response);
@@ -767,12 +784,21 @@ public HttpResponseMessage UpdateProfilePropertyLocalization(UpdateProfileProper
var language = LocaleController.Instance.GetLocale(pid, request.Language);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), request.Language));
}
- this._controller.SaveLocalizedKeys(pid, request.PropertyName, request.PropertyCategory, request.Language, request.PropertyNameString,
- request.PropertyHelpString, request.PropertyRequiredString, request.PropertyValidationString, request.CategoryNameString);
+ this.controller.SaveLocalizedKeys(
+ pid,
+ request.PropertyName,
+ request.PropertyCategory,
+ request.Language,
+ request.PropertyNameString,
+ request.PropertyHelpString,
+ request.PropertyRequiredString,
+ request.PropertyValidationString,
+ request.CategoryNameString);
DataCache.ClearCache();
return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
@@ -825,7 +851,8 @@ public HttpResponseMessage AddProfileProperty(UpdateProfilePropertyRequest reque
var propertyId = ProfileController.AddPropertyDefinition(property);
if (propertyId < Null.NullInteger)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("DuplicateName", Components.Constants.Constants.LocalResourcesFile)));
}
else
@@ -1021,7 +1048,8 @@ public HttpResponseMessage GetUrlMappingSettings(int? portalId)
var portalAliasMappingModes = new List>
{
- new KeyValuePair(Localization.GetString("Canonical", Components.Constants.Constants.LocalResourcesFile),
+ new KeyValuePair(
+ Localization.GetString("Canonical", Components.Constants.Constants.LocalResourcesFile),
"CANONICALURL"),
new KeyValuePair(Localization.GetString("Redirect", Components.Constants.Constants.LocalResourcesFile), "REDIRECT"),
new KeyValuePair(Localization.GetString("None", Components.Constants.Constants.LocalResourcesFile), "NONE"),
@@ -1163,7 +1191,7 @@ public HttpResponseMessage GetSiteAlias(int portalAliasId)
BrowserType = alias.BrowserType.ToString(),
alias.Skin,
alias.IsPrimary,
- alias.CultureCode
+ alias.CultureCode,
},
};
return this.Request.CreateResponse(HttpStatusCode.OK, response);
@@ -1205,7 +1233,8 @@ public HttpResponseMessage AddSiteAlias(UpdateSiteAliasRequest request)
var aliases = PortalAliasController.Instance.GetPortalAliases();
if (aliases.Contains(strAlias))
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("DuplicateAlias", Components.Constants.Constants.LocalResourcesFile)));
}
@@ -1225,8 +1254,9 @@ public HttpResponseMessage AddSiteAlias(UpdateSiteAliasRequest request)
}
else
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
- string.Format(Localization.GetString("InvalidAlias", Components.Constants.Constants.LocalResourcesFile)));
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
+ string.Format(Localization.GetString("InvalidAlias", Components.Constants.Constants.LocalResourcesFile)));
}
return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
@@ -1284,14 +1314,16 @@ public HttpResponseMessage UpdateSiteAlias(UpdateSiteAliasRequest request)
}
else
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidAlias", Components.Constants.Constants.LocalResourcesFile)));
}
}
else
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
- string.Format(Localization.GetString("InvalidAlias", Components.Constants.Constants.LocalResourcesFile)));
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
+ string.Format(Localization.GetString("InvalidAlias", Components.Constants.Constants.LocalResourcesFile)));
}
return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
@@ -1390,17 +1422,17 @@ public HttpResponseMessage GetListInfo(string listName, int? portalId)
}
var listController = new ListController();
- var entries = listController.GetListEntryInfoItems(listName, "", pid);
+ var entries = listController.GetListEntryInfoItems(listName, string.Empty, pid);
var response = new
{
Success = true,
- listController.GetListInfo(listName, "", pid)?.EnableSortOrder,
+ listController.GetListInfo(listName, string.Empty, pid)?.EnableSortOrder,
Entries = entries.Select(t => new
{
t.EntryID,
t.Text,
t.Value,
- t.SortOrder
+ t.SortOrder,
}),
};
return this.Request.CreateResponse(HttpStatusCode.OK, response);
@@ -1590,7 +1622,7 @@ public HttpResponseMessage GetPrivacySettings(int? portalId)
DataConsentConsentRedirectName = this.TabSanitizer(portalSettings.DataConsentConsentRedirect, pid)?.TabName,
DataConsentUserDeleteAction = (int)portalSettings.DataConsentUserDeleteAction,
this.PortalSettings.DataConsentDelay,
- this.PortalSettings.DataConsentDelayMeasurement
+ this.PortalSettings.DataConsentDelayMeasurement,
},
});
}
@@ -1626,6 +1658,7 @@ public HttpResponseMessage UpdatePrivacySettings(UpdatePrivacySettingsRequest re
{
HostController.Instance.Update("CheckUpgrade", request.CheckUpgrade ? "Y" : "N", false);
}
+
PortalController.UpdatePortalSetting(pid, "DataConsentActive", request.DataConsentActive.ToString(), false);
PortalController.UpdatePortalSetting(pid, "DataConsentConsentRedirect", this.ValidateTabId(request.DataConsentConsentRedirect, pid).ToString(), false);
PortalController.UpdatePortalSetting(pid, "DataConsentUserDeleteAction", request.DataConsentUserDeleteAction.ToString(), false);
@@ -1660,6 +1693,7 @@ public HttpResponseMessage ResetTermsAgreement(ResetTermsAgreementRequest reques
{
return this.Request.CreateErrorResponse(HttpStatusCode.Unauthorized, AuthFailureMessage);
}
+
UserController.ResetTermsAgreement(pid);
PortalController.UpdatePortalSetting(pid, "DataConsentTermsLastChange", DateTime.Now.ToString("O", CultureInfo.InvariantCulture), true);
return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
@@ -1671,10 +1705,6 @@ public HttpResponseMessage ResetTermsAgreement(ResetTermsAgreementRequest reques
}
}
- #endregion
-
- #region Search Settings API
-
/// GET: api/SiteSettings/GetBasicSearchSettings
///
/// Gets basic search settings.
@@ -1701,7 +1731,7 @@ public HttpResponseMessage GetBasicSearchSettings()
SearchStatistics searchStatistics = this.GetSearchStatistics();
if (searchStatistics != null)
{
- settings.SearchIndexDbSize = ((searchStatistics.IndexDbSize / 1024f) / 1024f).ToString("N") + " MB";
+ settings.SearchIndexDbSize = (searchStatistics.IndexDbSize / 1024f / 1024f).ToString("N") + " MB";
settings.SearchIndexLastModifedOn = DateUtils.CalculateDateForDisplay(searchStatistics.LastModifiedOn);
settings.SearchIndexTotalActiveDocuments = searchStatistics.TotalActiveDocuments.ToString(CultureInfo.InvariantCulture);
settings.SearchIndexTotalDeletedDocuments = searchStatistics.TotalDeletedDocuments.ToString(CultureInfo.InvariantCulture);
@@ -1711,7 +1741,7 @@ public HttpResponseMessage GetBasicSearchSettings()
{
Success = true,
Settings = settings,
- SearchCustomAnalyzers = this._controller.GetAvailableAnalyzers(),
+ SearchCustomAnalyzers = this.controller.GetAvailableAnalyzers(),
};
return this.Request.CreateResponse(HttpStatusCode.OK, response);
}
@@ -1737,18 +1767,21 @@ public HttpResponseMessage UpdateBasicSearchSettings(UpdateBasicSearchSettingsRe
{
if (request.MinWordLength == Null.NullInteger || request.MinWordLength == 0)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
- string.Format(Localization.GetString("valIndexWordMinLengthRequired.Error", Components.Constants.Constants.LocalResourcesFile)));
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
+ string.Format(Localization.GetString("valIndexWordMinLengthRequired.Error", Components.Constants.Constants.LocalResourcesFile)));
}
else if (request.MaxWordLength == Null.NullInteger || request.MaxWordLength == 0)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
- string.Format(Localization.GetString("valIndexWordMaxLengthRequired.Error", Components.Constants.Constants.LocalResourcesFile)));
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
+ string.Format(Localization.GetString("valIndexWordMaxLengthRequired.Error", Components.Constants.Constants.LocalResourcesFile)));
}
else if (request.MinWordLength >= request.MaxWordLength)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
- string.Format(Localization.GetString("valIndexWordMaxLengthRequired.Error", Components.Constants.Constants.LocalResourcesFile)));
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
+ string.Format(Localization.GetString("valIndexWordMaxLengthRequired.Error", Components.Constants.Constants.LocalResourcesFile)));
}
var oldMinLength = HostController.Instance.GetInteger("Search_MinKeyWordLength", 3);
@@ -1775,6 +1808,7 @@ public HttpResponseMessage UpdateBasicSearchSettings(UpdateBasicSearchSettingsRe
if (!oldAnalyzer.Equals(newAnalyzer))
{
HostController.Instance.Update("Search_CustomAnalyzer", newAnalyzer);
+
// force the app restart to use new analyzer.
Config.Touch();
}
@@ -1865,7 +1899,6 @@ public HttpResponseMessage PortalSearchReindex(int? portalId)
///
/// Gets portals.
///
- ///
/// List of portals.
[HttpGet]
[RequireHost]
@@ -1915,10 +1948,12 @@ public HttpResponseMessage GetSynonymsGroups(int? portalId, string cultureCode)
{
return this.Request.CreateErrorResponse(HttpStatusCode.Unauthorized, AuthFailureMessage);
}
+
var language = LocaleController.Instance.GetLocaleOrCurrent(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
@@ -1931,7 +1966,7 @@ public HttpResponseMessage GetSynonymsGroups(int? portalId, string cultureCode)
SynonymsGroups = groups.Select(g => new
{
g.SynonymsGroupId,
- g.SynonymsTags
+ g.SynonymsTags,
}),
};
return this.Request.CreateResponse(HttpStatusCode.OK, response);
@@ -1969,7 +2004,8 @@ public HttpResponseMessage AddSynonymsGroup(UpdateSynonymsGroupRequest request)
var language = LocaleController.Instance.GetLocale(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
@@ -1977,13 +2013,15 @@ public HttpResponseMessage AddSynonymsGroup(UpdateSynonymsGroupRequest request)
var synonymsGroupId = SearchHelper.Instance.AddSynonymsGroup(request.SynonymsTags, pid, cultureCode, out duplicateWord);
if (synonymsGroupId > 0)
{
- return this.Request.CreateResponse(HttpStatusCode.OK,
+ return this.Request.CreateResponse(
+ HttpStatusCode.OK,
new { Success = true, Id = synonymsGroupId });
}
else
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "[" + duplicateWord + "] " +
- string.Format(Localization.GetString("SynonymsTagDuplicated", Components.Constants.Constants.LocalResourcesFile)));
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
+ $"[{duplicateWord}] {string.Format(Localization.GetString("SynonymsTagDuplicated", Components.Constants.Constants.LocalResourcesFile))}");
}
}
catch (Exception exc)
@@ -2019,26 +2057,29 @@ public HttpResponseMessage UpdateSynonymsGroup(UpdateSynonymsGroupRequest reques
var language = LocaleController.Instance.GetLocale(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
if (request.SynonymsGroupID != null)
{
string duplicateWord;
- var synonymsGroupId = SearchHelper.Instance.UpdateSynonymsGroup(request.SynonymsGroupID.Value,
- request.SynonymsTags, pid, cultureCode, out duplicateWord);
+ var synonymsGroupId = SearchHelper.Instance.UpdateSynonymsGroup(
+ request.SynonymsGroupID.Value,
+ request.SynonymsTags,
+ pid,
+ cultureCode,
+ out duplicateWord);
if (synonymsGroupId > 0)
{
return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
}
else
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, "[" + duplicateWord + "] " +
- string.Format(
- Localization.GetString(
- "SynonymsTagDuplicated",
- Components.Constants.Constants.LocalResourcesFile)));
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
+ $"[{duplicateWord}] {string.Format(Localization.GetString("SynonymsTagDuplicated", Components.Constants.Constants.LocalResourcesFile))}");
}
}
else
@@ -2107,10 +2148,12 @@ public HttpResponseMessage GetIgnoreWords(int? portalId, string cultureCode)
{
return this.Request.CreateErrorResponse(HttpStatusCode.Unauthorized, AuthFailureMessage);
}
+
var language = LocaleController.Instance.GetLocaleOrCurrent(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
@@ -2158,7 +2201,8 @@ public HttpResponseMessage AddIgnoreWords(UpdateIgnoreWordsRequest request)
var language = LocaleController.Instance.GetLocale(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
@@ -2198,7 +2242,8 @@ public HttpResponseMessage UpdateIgnoreWords(UpdateIgnoreWordsRequest request)
var language = LocaleController.Instance.GetLocale(pid, cultureCode);
if (language == null)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.BadRequest,
string.Format(Localization.GetString("InvalidLocale.ErrorMessage", Components.Constants.Constants.LocalResourcesFile), cultureCode));
}
@@ -2244,10 +2289,6 @@ public HttpResponseMessage DeleteIgnoreWords(UpdateIgnoreWordsRequest request)
}
}
- #endregion
-
- #region Language Settings API
-
/// GET: api/SiteSettings/GetLanguageSettings
///
/// Gets language settings.
@@ -2263,7 +2304,8 @@ public HttpResponseMessage GetLanguageSettings(int? portalId)
var pid = portalId ?? this.PortalId;
if (!this.UserInfo.IsSuperUser && pid != this.PortalId)
{
- return this.Request.CreateErrorResponse(HttpStatusCode.Unauthorized,
+ return this.Request.CreateErrorResponse(
+ HttpStatusCode.Unauthorized,
"Authorization has been denied for this request.");
}
@@ -2273,7 +2315,8 @@ public HttpResponseMessage GetLanguageSettings(int? portalId)
var languageDisplayModes = new List>
{
new KeyValuePair(Localization.GetString("NativeName", Components.Constants.Constants.LocalResourcesFile), "NATIVE"),
- new KeyValuePair(Localization.GetString("EnglishName", Components.Constants.Constants.LocalResourcesFile),
+ new KeyValuePair(
+ Localization.GetString("EnglishName", Components.Constants.Constants.LocalResourcesFile),
"ENGLISH"),
};
@@ -2433,7 +2476,7 @@ public HttpResponseMessage GetLanguages(int? portalId)
TranslatedStatus = this.GetTranslatedStatus(portalSettings, l.Code),
Active = this.IsLanguagePublished(pid, l.Code),
IsLocalized = this.IsLocalized(portalSettings, l.Code),
- PublishedPages = this.GetPublishedLocalizedPages(pid, l.Code)
+ PublishedPages = this.GetPublishedLocalizedPages(pid, l.Code),
}),
});
}
@@ -2452,7 +2495,7 @@ public HttpResponseMessage GetLanguages(int? portalId)
l.NativeName,
l.EnglishName,
Enabled = this.IsLanguageEnabled(pid, l.Code),
- IsDefault = l.Code == portalSettings.DefaultLanguage
+ IsDefault = l.Code == portalSettings.DefaultLanguage,
}),
});
}
@@ -2514,7 +2557,7 @@ public HttpResponseMessage GetLanguage(int? portalId, int? languageId)
{
NativeName = Localization.GetString("System_Default", Components.Constants.Constants.LocalResourcesFile),
EnglishName = Localization.GetString("System_Default", Components.Constants.Constants.LocalResourcesFile),
- Name = "",
+ Name = string.Empty,
Icon = Globals.ResolveUrl("~/images/Flags/none.gif"),
});
@@ -2532,18 +2575,19 @@ public HttpResponseMessage GetLanguage(int? portalId, int? languageId)
CanEnableDisable = this.CanEnableDisable(portalSettings, language.Code),
IsDefault = language.Code == portalSettings.DefaultLanguage,
Roles = PortalController.GetPortalSetting($"DefaultTranslatorRoles-{language.Code}", pid, "Administrators"),
- } : new
+ }
+ : new
{
PortalId = pid,
LanguageId = Null.NullInteger,
- NativeName = "",
- EnglishName = "",
- Code = "",
- Fallback = "",
+ NativeName = string.Empty,
+ EnglishName = string.Empty,
+ Code = string.Empty,
+ Fallback = string.Empty,
Enabled = false,
CanEnableDisable = false,
IsDefault = false,
- Roles = "",
+ Roles = string.Empty,
},
SupportedFallbacks = fallbacks,
});
@@ -2589,7 +2633,7 @@ public HttpResponseMessage GetAllLanguages()
Icon = Globals.ResolveUrl(
string.IsNullOrEmpty(c.Name)
? "~/images/Flags/none.gif"
- : $"~/images/Flags/{c.Name}.gif")
+ : $"~/images/Flags/{c.Name}.gif"),
}),
});
}
@@ -2694,8 +2738,8 @@ public HttpResponseMessage UpdateLanguage(UpdateLanguageRequest request)
if (request.LanguageId != null)
{
var language = LocaleController.Instance.GetLocale(request.LanguageId.Value) ??
- (LocaleController.Instance.GetLocale(request.Code) ??
- new Locale { Code = request.Code });
+ LocaleController.Instance.GetLocale(request.Code) ??
+ new Locale { Code = request.Code };
if (this.UserInfo.IsSuperUser)
{
language.Fallback = request.Fallback;
@@ -2729,7 +2773,7 @@ public HttpResponseMessage UpdateLanguage(UpdateLanguageRequest request)
if (LocaleController.Instance.GetLocales(pid).Count == 2)
{
- redirectUrl = this.NavigationManager.NavigateURL();
+ redirectUrl = this.navigationManager.NavigateURL();
}
}
else
@@ -2739,13 +2783,17 @@ public HttpResponseMessage UpdateLanguage(UpdateLanguageRequest request)
// if the disable language is current language, should redirect to default language.
if (
- request.Code.Equals(Thread.CurrentThread.CurrentUICulture.ToString(),
+ request.Code.Equals(
+ Thread.CurrentThread.CurrentUICulture.ToString(),
StringComparison.OrdinalIgnoreCase) ||
LocaleController.Instance.GetLocales(pid).Count == 1)
{
- redirectUrl = this.NavigationManager.NavigateURL(this.PortalSettings.ActiveTab.TabID,
+ redirectUrl = this.navigationManager.NavigateURL(
+ this.PortalSettings.ActiveTab.TabID,
this.PortalSettings.ActiveTab.IsSuperTab,
- this.PortalSettings, "", defaultLocale.Code);
+ this.PortalSettings,
+ string.Empty,
+ defaultLocale.Code);
}
// delete the tabs in this language
@@ -2756,7 +2804,7 @@ public HttpResponseMessage UpdateLanguage(UpdateLanguageRequest request)
}
}
- return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true, RedirectUrl = pid == this.PortalId ? redirectUrl : "" });
+ return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true, RedirectUrl = pid == this.PortalId ? redirectUrl : string.Empty });
}
else
{
@@ -2802,7 +2850,7 @@ public HttpResponseMessage VerifyLanguageResourceFiles()
{
tableMissing.Add(
ResourceFile(file.Key.ToString(), locale.Code)
- .Replace(HttpContext.Current.Server.MapPath("~"), ""));
+ .Replace(HttpContext.Current.Server.MapPath("~"), string.Empty));
}
else
{
@@ -2815,9 +2863,10 @@ public HttpResponseMessage VerifyLanguageResourceFiles()
}
catch
{
- tableError.Add(file.Key.ToString().Replace(HttpContext.Current.Server.MapPath("~"), ""));
+ tableError.Add(file.Key.ToString().Replace(HttpContext.Current.Server.MapPath("~"), string.Empty));
dsDef = null;
}
+
try
{
dsRes.ReadXml(ResourceFile(file.Key.ToString(), locale.Code));
@@ -2826,7 +2875,7 @@ public HttpResponseMessage VerifyLanguageResourceFiles()
{
if (locale.Text != Localization.SystemLocale)
{
- tableError.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), ""));
+ tableError.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), string.Empty));
dsRes = null;
}
}
@@ -2849,7 +2898,7 @@ public HttpResponseMessage VerifyLanguageResourceFiles()
}
catch
{
- tableDuplicate.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), ""));
+ tableDuplicate.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), string.Empty));
}
// Check for missing entries in localized file
@@ -2860,7 +2909,7 @@ public HttpResponseMessage VerifyLanguageResourceFiles()
}
catch
{
- tableEntries.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), ""));
+ tableEntries.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), string.Empty));
}
finally
{
@@ -2875,7 +2924,7 @@ public HttpResponseMessage VerifyLanguageResourceFiles()
}
catch
{
- tableObsolete.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), ""));
+ tableObsolete.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), string.Empty));
}
finally
{
@@ -2886,7 +2935,7 @@ public HttpResponseMessage VerifyLanguageResourceFiles()
var resFile = new FileInfo(ResourceFile(file.Key.ToString(), locale.Code));
if (((FileInfo)file.Value).LastWriteTime > resFile.LastWriteTime)
{
- tableOld.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), ""));
+ tableOld.Add(ResourceFile(file.Key.ToString(), locale.Code).Replace(HttpContext.Current.Server.MapPath("~"), string.Empty));
}
}
}
@@ -2924,6 +2973,7 @@ public HttpResponseMessage VerifyLanguageResourceFiles()
///
/// Gets module list by type.
///
+ /// The type of extension to get such as Module, Provider or AuthSystem.
/// list of modules.
[HttpGet]
[RequireHost]
@@ -2948,11 +2998,13 @@ DesktopModuleInfo objDm in
else
{
modules.Add(
- new KeyValuePair(objDm.FriendlyName + " [" + objDm.Version + "]",
+ new KeyValuePair(
+ objDm.FriendlyName + " [" + objDm.Version + "]",
objDm.DesktopModuleID));
}
}
}
+
break;
case "Provider":
modules.AddRange(PackageController.Instance.GetExtensionPackages(Null.NullInteger, p => p.PackageType == "Provider").Select(objPackage => Null.IsNull(objPackage.Version) ? new KeyValuePair(objPackage.FriendlyName, objPackage.PackageID) : new KeyValuePair(objPackage.FriendlyName + " [" + Globals.FormatVersion(objPackage.Version) + "]", objPackage.PackageID)).Cast