Skip to content

Commit

Permalink
[SmarterMail100] Added extra group options and fixing import bug when…
Browse files Browse the repository at this point in the history
… no target emails set. - Work sponsored by Enterprise Guardian Inc.

Tested with SmarterMail 100.0.9088.25586 (Nov 18, 2024)
  • Loading branch information
FuseCP-TRobinson committed Dec 15, 2024
1 parent b34c4f9 commit e9240eb
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 24 deletions.
34 changes: 33 additions & 1 deletion SolidCP/Sources/SolidCP.Providers.Base/Mail/MailGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1461,9 +1461,12 @@ public MailAlias[] GetMailAliases(string domainName)
mailAlias.Name = alias["name"].ToString() + "@" + domainName;

List<string> members = new List<string>();
foreach (string member in alias["targets"])
if (alias["targets"] != null)
{
members.Add(member);
foreach (string member in alias["targets"])
{
members.Add(member);
}
}


Expand Down Expand Up @@ -1650,13 +1653,16 @@ public MailGroup[] GetGroups(string domainName)
mailGroup.Name = alias["name"] + "@" + domainName;

List<string> members = new List<string>();
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);
Expand Down Expand Up @@ -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)
{
Expand All @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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" %>
<div class="form-group">
<asp:Label ID="lblGroupMembers" CssClass="control-label col-sm-2" runat="server" meta:resourcekey="lblGroupMembers" Text="Group e-mails:"></asp:Label>
<div class="input-group col-sm-8">
<table cellSpacing="0" cellPadding="3" width="100%">
<tr>
<td class="SubHead" width="600" nowrap>
<asp:Label ID="lblDisplayName" runat="server" meta:resourcekey="lblDisplayName" Text="Group DisplayName:"></asp:Label>
</td>
<td class="normal" width="100%">
<asp:TextBox ID="txtDisplayName" runat="server" Width="300px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="SubHead" vAlign="top" >
<asp:Label ID="lblGroupMembers" runat="server" meta:resourcekey="lblGroupMembers" Text="Group e-mails:"></asp:Label>
</td>
<td vAlign="top" >
<dnc:EditItemsList id="mailEditItems" runat="server"></dnc:EditItemsList>
</div>
</div>
</td>
</tr>
<tr>
<td class="SubHead">
<asp:Label ID="lblIncludeAllDomainUsers" runat="server" meta:resourcekey="lblIncludeAllDomainUsers" Text="Include all domain users:"></asp:Label>
</td>
<td class="normal">
<asp:CheckBox ID="chkIncludeAllDomainUsers" runat="server" meta:resourcekey="chkIncludeAllDomainUsers" />
</td>
</tr>
<tr>
<td class="SubHead">
<asp:Label ID="lblEnableGAL" runat="server" meta:resourcekey="lblEnableGAL" Text="Show in Global Address List:"></asp:Label>
</td>
<td class="normal">
<asp:CheckBox ID="chkEnableGAL" runat="server" meta:resourcekey="chkEnableGAL" />
</td>
</tr>
<tr>
<td class="SubHead">
<asp:Label ID="lblEnableChat" runat="server" meta:resourcekey="lblEnableChat" Text="Enable Group Chat:"></asp:Label>
</td>
<td class="normal">
<asp:CheckBox ID="chkEnableChat" runat="server" meta:resourcekey="chkEnableChat" />
</td>
</tr>
<tr>
<td class="SubHead">
<asp:Label ID="lblInternalOnly" runat="server" meta:resourcekey="lblInternalOnly" Text="Internal use only:"></asp:Label>
</td>
<td class="normal">
<asp:CheckBox ID="chkInternalOnly" runat="server" meta:resourcekey="chkInternalOnly" />
</td>
</tr>
</table>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e9240eb

Please sign in to comment.