From e9240eb78c807703aabf4628cae33cd86107691e Mon Sep 17 00:00:00 2001 From: Trevor Robinson Date: Sun, 15 Dec 2024 18:57:34 +0100 Subject: [PATCH] [SmarterMail100] Added extra group options and fixing import bug when no target emails set. - Work sponsored by Enterprise Guardian Inc. Tested with SmarterMail 100.0.9088.25586 (Nov 18, 2024) --- .../SolidCP.Providers.Base/Mail/MailGroup.cs | 34 +++++- .../SmarterMail100.cs | 46 ++++++-- .../SmarterMail100x_EditGroup.ascx | 54 ++++++++- .../SmarterMail100x_EditGroup.ascx.cs | 10 ++ ...SmarterMail100x_EditGroup.ascx.designer.cs | 104 +++++++++++++++++- 5 files changed, 224 insertions(+), 24 deletions(-) diff --git a/SolidCP/Sources/SolidCP.Providers.Base/Mail/MailGroup.cs b/SolidCP/Sources/SolidCP.Providers.Base/Mail/MailGroup.cs index 45a8e949c..b9ffd7276 100644 --- a/SolidCP/Sources/SolidCP.Providers.Base/Mail/MailGroup.cs +++ b/SolidCP/Sources/SolidCP.Providers.Base/Mail/MailGroup.cs @@ -42,6 +42,11 @@ public class MailGroup : ServiceProviderItem { private string[] members = new string[0]; private bool enabled; + private bool hidefromgal; + private bool enablechat; + private bool internalonly; + private bool includealldomainusers; + private string displayname; public MailGroup() { @@ -58,5 +63,32 @@ public string[] Members get { return this.members; } set { this.members = value; } } - } + + public bool HideFromGAL + { + get { return this.hidefromgal; } + set { this.hidefromgal = value; } + } + + public bool EnableChat + { + get { return this.enablechat; } + set { this.enablechat = value; } + } + public bool InternalOnly + { + get { return this.internalonly; } + set { this.internalonly = value; } + } + public bool IncludeAllDomainUsers + { + get { return this.includealldomainusers; } + set { this.includealldomainusers = value; } + } + public string DisplayName + { + get { return this.displayname; } + set { this.displayname = value; } + } + } } diff --git a/SolidCP/Sources/SolidCP.Providers.Mail.SmarterMail100/SmarterMail100.cs b/SolidCP/Sources/SolidCP.Providers.Mail.SmarterMail100/SmarterMail100.cs index 6dfd2f06a..abb208947 100644 --- a/SolidCP/Sources/SolidCP.Providers.Mail.SmarterMail100/SmarterMail100.cs +++ b/SolidCP/Sources/SolidCP.Providers.Mail.SmarterMail100/SmarterMail100.cs @@ -1461,9 +1461,12 @@ public MailAlias[] GetMailAliases(string domainName) mailAlias.Name = alias["name"].ToString() + "@" + domainName; List members = new List(); - foreach (string member in alias["targets"]) + if (alias["targets"] != null) { - members.Add(member); + foreach (string member in alias["targets"]) + { + members.Add(member); + } } @@ -1650,13 +1653,16 @@ public MailGroup[] GetGroups(string domainName) mailGroup.Name = alias["name"] + "@" + domainName; List members = new List(); - foreach (string member in alias["targets"]) - + if (alias["targets"] != null) { - members.Add(member); - } + foreach (string member in alias["targets"]) - if (members.ToArray().Length > 1) + { + members.Add(member); + } + } + + if (members.ToArray().Length != 1) { mailGroup.Members = members.ToArray(); groups.Add(mailGroup); @@ -1697,7 +1703,13 @@ public MailGroup GetGroup(string groupName) group.Name = groupName; group.Members = targetsString; group.Enabled = true; // by default - return group; + group.DisplayName = result["alias"]["displayName"]; + group.HideFromGAL = result["alias"]["hideFromGAL"]; + group.EnableChat = result["alias"]["enableForXmpp"]; + group.InternalOnly = result["alias"]["internalOnly"]; + group.IncludeAllDomainUsers = result["alias"]["includeAllDomainUsers"]; + + return group; } catch (Exception ex) { @@ -1712,8 +1724,13 @@ public void CreateGroup(MailGroup group) var aliasArray = new { name = GetAccountName(group.Name), - aliasTargetList = group.Members - }; + displayName = group.DisplayName, + aliasTargetList = group.Members, + hideFromGAL = group.HideFromGAL, + enableForXmpp = group.EnableChat, + internalOnly = group.InternalOnly, + includeAllDomainUsers = group.IncludeAllDomainUsers + }; var mailAliasPram = new { @@ -1760,8 +1777,13 @@ public void UpdateGroup(MailGroup group) var aliasArray = new { name = GetAccountName(group.Name), - aliasTargetList = group.Members - }; + displayName = group.DisplayName, + aliasTargetList = group.Members, + hideFromGAL = group.HideFromGAL, + enableForXmpp = group.EnableChat, + internalOnly = group.InternalOnly, + includeAllDomainUsers = group.IncludeAllDomainUsers + }; var mailAliasPram = new { diff --git a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx index 686556e11..0e26ee70c 100644 --- a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx +++ b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx @@ -1,8 +1,52 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SmarterMail100x_EditGroup.ascx.cs" Inherits="SolidCP.Portal.ProviderControls.SmarterMail100x_EditGroup" %> <%@ Register TagPrefix="dnc" TagName="EditItemsList" Src="../MailEditItems.ascx" %> -
- -
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + - - \ No newline at end of file +
+ + + +
+ + + +
+ + + +
+ + + +
\ No newline at end of file diff --git a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx.cs b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx.cs index 18ea21591..741a8ce1c 100644 --- a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx.cs +++ b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx.cs @@ -44,11 +44,21 @@ protected void Page_Load(object sender, EventArgs e) public void BindItem(MailGroup item) { mailEditItems.Items = item.Members; + chkEnableGAL.Checked = !item.HideFromGAL; + chkEnableChat.Checked = item.EnableChat; + chkInternalOnly.Checked = item.InternalOnly; + chkIncludeAllDomainUsers.Checked = item.IncludeAllDomainUsers; + txtDisplayName.Text = item.DisplayName; } public void SaveItem(MailGroup item) { item.Members = mailEditItems.Items; + item.HideFromGAL = !chkEnableGAL.Checked; + item.EnableChat = chkEnableChat.Checked; + item.InternalOnly = chkInternalOnly.Checked; + item.IncludeAllDomainUsers = chkIncludeAllDomainUsers.Checked; + item.DisplayName = txtDisplayName.Text; } } diff --git a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx.designer.cs b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx.designer.cs index d3057f3d7..1bcc35554 100644 --- a/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx.designer.cs +++ b/SolidCP/Sources/SolidCP.WebPortal/DesktopModules/SolidCP/ProviderControls/SmarterMail100x_EditGroup.ascx.designer.cs @@ -7,11 +7,31 @@ // //------------------------------------------------------------------------------ -namespace SolidCP.Portal.ProviderControls { - - - public partial class SmarterMail100x_EditGroup { - +namespace SolidCP.Portal.ProviderControls +{ + + + public partial class SmarterMail100x_EditGroup + { + + /// + /// lblDisplayName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDisplayName; + + /// + /// txtDisplayName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDisplayName; + /// /// lblGroupMembers control. /// @@ -20,7 +40,7 @@ public partial class SmarterMail100x_EditGroup { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblGroupMembers; - + /// /// mailEditItems control. /// @@ -29,5 +49,77 @@ public partial class SmarterMail100x_EditGroup { /// To modify move field declaration from designer file to code-behind file. /// protected global::SolidCP.Portal.MailEditItems mailEditItems; + + /// + /// lblIncludeAllDomainUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblIncludeAllDomainUsers; + + /// + /// chkIncludeAllDomainUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkIncludeAllDomainUsers; + + /// + /// lblEnableGAL control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblEnableGAL; + + /// + /// chkEnableGAL control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableGAL; + + /// + /// lblEnableChat control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblEnableChat; + + /// + /// chkEnableChat control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableChat; + + /// + /// lblInternalOnly control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblInternalOnly; + + /// + /// chkInternalOnly control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkInternalOnly; } }