From 47c0c0c451e13dd1932cf84e51a22c8e0e13677c Mon Sep 17 00:00:00 2001 From: Trevor Robinson Date: Fri, 22 Nov 2024 10:53:46 +0100 Subject: [PATCH] [SmarterMail100] Added a Default Domain Host name and dropped InheritDefaultLimits from provider settings --- SolidCP/Database/update_db.sql | 7 ++ .../SmarterMail100.cs | 34 +++++---- .../SmarterMail100x_Settings.ascx | 10 ++- .../SmarterMail100x_Settings.ascx.cs | 4 +- .../SmarterMail100x_Settings.ascx.designer.cs | 71 +++++++++++-------- 5 files changed, 76 insertions(+), 50 deletions(-) diff --git a/SolidCP/Database/update_db.sql b/SolidCP/Database/update_db.sql index e7063cf61..2cb6f9897 100644 --- a/SolidCP/Database/update_db.sql +++ b/SolidCP/Database/update_db.sql @@ -20338,4 +20338,11 @@ BEGIN INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (1902, N'RecordMinimumTTL', N'3600') INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (1903, N'RecordMinimumTTL', N'3600') END +GO + +--SmarterMail100 Support for new options +IF NOT EXISTS (SELECT * FROM [dbo].[ServiceDefaultProperties] WHERE [ProviderID] = '67' AND [PropertyName] = N'DomainHostName') +BEGIN +INSERT [dbo].[ServiceDefaultProperties] ([ProviderID], [PropertyName], [PropertyValue]) VALUES (67, N'DefaultDomainHostName', N'mail.[DOMAIN_NAME]') +END GO \ No newline at end of file diff --git a/SolidCP/Sources/SolidCP.Providers.Mail.SmarterMail100/SmarterMail100.cs b/SolidCP/Sources/SolidCP.Providers.Mail.SmarterMail100/SmarterMail100.cs index d8248516a..e0f032891 100644 --- a/SolidCP/Sources/SolidCP.Providers.Mail.SmarterMail100/SmarterMail100.cs +++ b/SolidCP/Sources/SolidCP.Providers.Mail.SmarterMail100/SmarterMail100.cs @@ -71,16 +71,6 @@ protected bool ImportDomainAdmin } } - protected bool InheritDomainDefaultLimits - { - get - { - bool res; - bool.TryParse(ProviderSettings[Constants.InheritDomainDefaultLimits], out res); - return res; - } - } - protected bool EnableDomainAdministrators { get @@ -118,10 +108,16 @@ protected string ServiceUrl { get { return ProviderSettings["ServiceUrl"]; } } - #endregion - #region Constants - public const string SYSTEM_DOMAIN_ADMIN = "system.domain.admin"; + protected string DefaultDomainHostName + { + get { return ProviderSettings["DefaultDomainHostName"]; } + } + + #endregion + + #region Constants + public const string SYSTEM_DOMAIN_ADMIN = "system.domain.admin"; public const string SYSTEM_CATCH_ALL = "system.catch.all"; #endregion @@ -557,12 +553,20 @@ public void CreateDomain(MailDomain domain) { try { + string domainHostname = "mail." + domain.Name; + + + if (DefaultDomainHostName.Length > 0) + { + domainHostname = DefaultDomainHostName.ToLower().Replace("[domain_name]", domain.Name); + } + var domainDataArray = new { name = domain.Name, path = DomainsPath + "\\" + domain.Name, - hostname = "mail." + domain.Name, - isEnabled = domain.Enabled.ToString(), + hostname = domainHostname, + isEnabled = domain.Enabled.ToString(), userLimit = domain.MaxDomainUsers, domainAliasCount = domain.MaxDomainAliases, listLimit = domain.MaxLists, diff --git a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx index 3623bd9c0..4e7feed08 100644 --- a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx +++ b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx @@ -53,11 +53,15 @@ - + - - + + + + + + diff --git a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx.cs b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx.cs index 41440ec80..a018d2b9a 100644 --- a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx.cs +++ b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx.cs @@ -90,9 +90,9 @@ public void BindSettings(StringDictionary settings) ViewState["PWD"] = settings["AdminPassword"]; rowPassword.Visible = ((string)ViewState["PWD"]) != ""; cbImportDomainAdmin.Checked = Utils.ParseBool(settings[Constants.ImportDomainAdmin], false); - cbInheritDefaultLimits.Checked = Utils.ParseBool(settings[Constants.InheritDomainDefaultLimits], false); cbEnableDomainAdmin.Checked = Utils.ParseBool(settings[Constants.EnableDomainAdministrators], false); chkSEEnable.Checked = Utils.ParseBool(settings["EnableMailFilter"], false); + txtDefaultDomainHostName.Text = settings["DefaultDomainHostName"]; } public void SaveSettings(StringDictionary settings) @@ -103,9 +103,9 @@ public void SaveSettings(StringDictionary settings) settings["AdminUsername"] = txtUsername.Text.Trim(); settings["AdminPassword"] = (txtPassword.Text.Length > 0) ? txtPassword.Text : (string)ViewState["PWD"]; settings[Constants.ImportDomainAdmin] = cbImportDomainAdmin.Checked.ToString(); - settings[Constants.InheritDomainDefaultLimits] = cbInheritDefaultLimits.Checked.ToString(); settings[Constants.EnableDomainAdministrators] = cbEnableDomainAdmin.Checked.ToString(); settings["EnableMailFilter"] = chkSEEnable.Checked.ToString(); + settings["DefaultDomainHostName"] = txtDefaultDomainHostName.Text.Trim(); } protected void gvSEDestinations_RowCommand(object sender, GridViewCommandEventArgs e) diff --git a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx.designer.cs b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx.designer.cs index b5ac061ff..1714f2e8a 100644 --- a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx.designer.cs +++ b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_Settings.ascx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace SolidCP.Portal.ProviderControls { - - - public partial class SmarterMail100x_Settings { - +namespace SolidCP.Portal.ProviderControls +{ + + + public partial class SmarterMail100x_Settings + { + /// /// lblServiceUrl control. /// @@ -20,7 +22,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblServiceUrl; - + /// /// txtServiceUrl control. /// @@ -29,7 +31,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtServiceUrl; - + /// /// lblPublicIP control. /// @@ -38,7 +40,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblPublicIP; - + /// /// ipAddress control. /// @@ -47,7 +49,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::SolidCP.Portal.SelectIPAddress ipAddress; - + /// /// lblDomainsPath control. /// @@ -56,7 +58,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblDomainsPath; - + /// /// txtDomainsFolder control. /// @@ -65,7 +67,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtDomainsFolder; - + /// /// lblAdminLogin control. /// @@ -74,7 +76,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblAdminLogin; - + /// /// txtUsername control. /// @@ -83,7 +85,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtUsername; - + /// /// rowPassword control. /// @@ -92,7 +94,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlTableRow rowPassword; - + /// /// lblCurrPassword control. /// @@ -101,7 +103,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblCurrPassword; - + /// /// lblAdminPassword control. /// @@ -110,7 +112,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblAdminPassword; - + /// /// txtPassword control. /// @@ -119,7 +121,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtPassword; - + /// /// cbImportDomainAdmin control. /// @@ -128,25 +130,34 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbImportDomainAdmin; - + /// - /// cbInheritDefaultLimits control. + /// cbEnableDomainAdmin control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.CheckBox cbInheritDefaultLimits; - + protected global::System.Web.UI.WebControls.CheckBox cbEnableDomainAdmin; + /// - /// cbEnableDomainAdmin control. + /// lblDefaultDomainHostName control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.CheckBox cbEnableDomainAdmin; - + protected global::System.Web.UI.WebControls.Label lblDefaultDomainHostName; + + /// + /// txtDefaultDomainHostName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDefaultDomainHostName; + /// /// SeDiv control. /// @@ -155,7 +166,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl SeDiv; - + /// /// lblRouteFromSE control. /// @@ -164,7 +175,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblRouteFromSE; - + /// /// chkSEEnable control. /// @@ -173,7 +184,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox chkSEEnable; - + /// /// GeneralUpdatePanel control. /// @@ -182,7 +193,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel; - + /// /// gvSEDestinations control. /// @@ -191,7 +202,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.GridView gvSEDestinations; - + /// /// tbSEDestinations control. /// @@ -200,7 +211,7 @@ public partial class SmarterMail100x_Settings { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox tbSEDestinations; - + /// /// bntAddSEDestination control. ///