diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailAccount.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailAccount.cs index 6f1d0ada..0208da80 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailAccount.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailAccount.cs @@ -199,5 +199,31 @@ namespace WebsitePanel.Providers.Mail public string ResponderExpirationDate { get; set; } #endregion - } + + #region IceWarp + + public int IceWarpAccountType { get; set; } + public int IceWarpAccountState { get; set; } + public int IceWarpRespondType { get; set; } + + public bool RespondOnlyBetweenDates { get; set; } // Added this because Calendar Control used did not allow null values + public DateTime RespondFrom { get; set; } + public DateTime RespondTo { get; set; } + public string RespondWithReplyFrom { get; set; } + public int RespondPeriodInDays { get; set; } + + public bool DeleteOlder { get; set; } + public int DeleteOlderDays { get; set; } + public bool ForwardOlder { get; set; } + public int ForwardOlderDays { get; set; } + public string ForwardOlderTo { get; set; } + + public int MaxMessageSizeMegaByte { get; set; } + public int MegaByteSendLimit { get; set; } + public int NumberSendLimit { get; set; } + + public string FullName { get; set; } + + #endregion + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailDomain.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailDomain.cs index 343e8cb6..a452d66d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailDomain.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailDomain.cs @@ -365,5 +365,17 @@ namespace WebsitePanel.Providers.Mail #endregion - } + + #region IceWarp + + public int MegaByteSendLimit { get; set; } + public int NumberSendLimit { get; set; } + + public int DefaultUserQuotaInMB { get; set; } + public int DefaultUserMaxMessageSizeMegaByte { get; set; } + public int DefaultUserMegaByteSendLimit { get; set; } + public int DefaultUserNumberSendLimit { get; set; } + + #endregion + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailEnums.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailEnums.cs index ac7f6c8b..f39b05f1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailEnums.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailEnums.cs @@ -67,4 +67,42 @@ namespace WebsitePanel.Providers.Mail #endregion + #region IceWarp + + public enum IceWarpListMembersSource + { + MembersInFile = 0, + AllDomainUsers = 1, + AllDomainAdmins = 3 + } + + public enum IceWarpListFromAndReplyToHeader + { + NoChange = 0, + SetToSender = 1, + SetToValue = 2 + } + + public enum IceWarpListOriginator + { + Blank = 0, + Sender = 1, + Owner = 2 + } + + [Flags] + public enum IceWarpListDefaultRights + { + Receive = 1, + Post = 2, + Digest = 4 + } + + public enum IceWarpListConfirmSubscription + { + None = 0, + User = 1, + Owner = 2 + } + #endregion } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailList.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailList.cs index 99422f1f..be8f3dd2 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailList.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Mail/MailList.cs @@ -280,5 +280,26 @@ namespace WebsitePanel.Providers.Mail set { requireSmtpAuthentication = value; } } #endregion + + #region IceWarp + + public IceWarpListMembersSource MembersSource { get; set; } + public IceWarpListFromAndReplyToHeader FromHeader { get; set; } + public IceWarpListFromAndReplyToHeader ReplyToHeader { get; set; } + public bool SetReceipientsToToHeader { get; set; } + public IceWarpListOriginator Originator { get; set; } + public IceWarpListDefaultRights DefaultRights { get; set; } + public int MaxMembers { get; set; } + public bool SendToSender { get; set; } + public int MaxMessagesPerMinute { get; set; } + public IceWarpListConfirmSubscription ConfirmSubscription { get; set; } + public bool CommandsInSubject { get; set; } + public bool DisableWhichCommand { get; set; } + public bool DisableReviewCommand { get; set; } + public bool DisableVacationCommand { get; set; } + public string CommandPassword { get; set; } + public bool SuppressCommandResponses { get; set; } + + #endregion } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs new file mode 100644 index 00000000..fddc478d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs @@ -0,0 +1,1530 @@ +using System; +using System.IO; +using System.Net.Mail; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using Microsoft.Win32; +using WebsitePanel.Providers.Utils; +using WebsitePanel.Server.Utils; + +namespace WebsitePanel.Providers.Mail +{ + public class IceWarp : HostingServiceProviderBase, IMailServer + { + protected const string API_PROGID = "IceWarpServer.APIObject"; + protected const string DOMAIN_PROGID = "IceWarpServer.DomainObject"; + protected const string ACCOUNT_PROGID = "IceWarpServer.AccountObject"; + + private dynamic _currentApiObject = null; + + #region IceWarp Enums + + protected enum IceWarpErrorCode + { + S_OK = 0, + E_FAILURE = -1, // Function failure + E_LICENSE = -2, // Insufficient license + E_PARAMS = -3, // Size of parameters too short + E_PATH = -4, // Settings file does not exist + E_CONFIG = -5, // Configuration not found + E_PASSWORD = -6, // Password policy + E_CONFLICT = -7, // Item already exists + E_INVALID = -8, // Invalid mailbox / alias characters + E_PASSWORDCHARS = -9, // Invalid password characters + E_MIGRATION_IN_PROGRESS = -10 // User migration in progress + } + + protected enum IceWarpAccountType + { + User = 0, + MailingList = 1, + Executable = 2, + Notification = 3, + StaticRoute = 4, + Catalog = 5, + ListServer = 6, + UserGroup = 7 + } + + protected enum IceWarpUnknownUsersType + { + Reject = 0, + ForwardToAddress = 1, + Delete = 2 + } + + #endregion + + #region Protected Properties + + protected string MailPath + { + get + { + var apiObject = GetApiObject(); + return apiObject.GetProperty("C_System_Storage_Dir_MailPath"); + } + } + + protected string Version + { + get + { + var apiObject = GetApiObject(); + return apiObject.GetProperty("C_Version"); + } + } + + protected string BindIpAddress + { + get + { + var apiObject = GetApiObject(); + var adresses = ((object) apiObject.GetProperty("C_System_Services_BindIPAddress")); + return adresses == null ? "" : adresses.ToString().Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); + } + } + + protected bool UseDomainDiskQuota + { + get + { + var apiObject = GetApiObject(); + return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_UseDiskQuota")); + } + } + + protected bool UseDomainLimits + { + get + { + var apiObject = GetApiObject(); + return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_UseDomainLimits")); + } + } + + protected bool UseUserLimits + { + get + { + var apiObject = GetApiObject(); + return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_UseUserLimits")); + } + } + + protected bool OverrideGlobal + { + get + { + var apiObject = GetApiObject(); + return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_OverrideGlobal")); + } + } + + protected int MaxMessageSizeInMB + { + get + { + var apiObject = GetApiObject(); + return Convert.ToInt32((object) apiObject.GetProperty("C_Mail_SMTP_Delivery_MaxMsgSize"))/1024/1024; + } + } + + protected int WarnMailboxUsage + { + get + { + var apiObject = GetApiObject(); + return Convert.ToInt32((object)apiObject.GetProperty("C_Accounts_Global_Domains_WarnMailboxUsage")); + } + } + + protected int WarnDomainSize + { + get + { + var apiObject = GetApiObject(); + return Convert.ToInt32((object)apiObject.GetProperty("C_Accounts_Global_Domains_WarnDomainSize")); + } + } + + + private void SaveApiSetting(dynamic apiObject) + { + if (!apiObject.Save()) + { + throw new Exception("Cannot save Api Object: " + GetErrorMessage(apiObject.LastErr)); + } + } + + #endregion + + #region Protected Methods + + protected static string GetErrorMessage(int errorCode) + { + switch ((IceWarpErrorCode) errorCode) + { + case IceWarpErrorCode.S_OK: + return "OK"; + case IceWarpErrorCode.E_FAILURE: + return "Function failure"; + case IceWarpErrorCode.E_LICENSE: + return "Insufficient license"; + case IceWarpErrorCode.E_PARAMS: + return "Size of parameters too short"; + case IceWarpErrorCode.E_PATH: + return "Settings file does not exist"; + case IceWarpErrorCode.E_CONFIG: + return "Configuration not found"; + case IceWarpErrorCode.E_PASSWORD: + return "IceWarp password policy denies use of this account"; + case IceWarpErrorCode.E_CONFLICT: + return "Item already exists"; + case IceWarpErrorCode.E_INVALID: + return "Invalid charcters in mailbox or alias"; + case IceWarpErrorCode.E_PASSWORDCHARS: + return "Invalid characters in password"; + case IceWarpErrorCode.E_MIGRATION_IN_PROGRESS: + return "User mgiration in progress"; + default: + return ""; + } + } + + protected object CreateObject(string progId) + { + var associatedType = Type.GetTypeFromProgID(progId); + + if (associatedType == null) + { + throw new Exception("Cannot get type of " + progId); + } + + try + { + var obj = Activator.CreateInstance(associatedType); + if (obj == null) + { + throw new Exception("Unable to create COM interface"); + } + + return obj; + } + catch (Exception ex) + { + throw new Exception("Unable to create COM interface", ex); + } + } + + protected dynamic GetApiObject() + { + if (_currentApiObject != null) return _currentApiObject; + + _currentApiObject = CreateObject(API_PROGID); + if (_currentApiObject == null) + { + throw new Exception("Returned COM is not of appropriate type"); + } + + return _currentApiObject; + } + + protected dynamic GetDomainObject() + { + var obj = CreateObject(DOMAIN_PROGID); + if (obj == null) + { + throw new Exception("Returned COM is not of appropriate type"); + } + + return obj; + } + + protected dynamic GetDomainObject(string domainName) + { + var obj = GetDomainObject(); + if (!obj.Open(domainName)) + { + throw new Exception("Cannot open domain " + domainName + ": " + GetErrorMessage(obj.LastErr)); + } + + return obj; + } + + protected dynamic GetAccountObject() + { + var obj = CreateObject(ACCOUNT_PROGID); + if (obj == null) + { + throw new Exception("Returned COM is not of appropriate type"); + } + + return obj; + } + + protected dynamic GetAccountObject(string accountName) + { + var obj = GetAccountObject(); + if (!obj.Open(accountName)) + { + throw new Exception("Cannot open account " + accountName + ": " + GetErrorMessage(obj.LastErr)); + } + + return obj; + } + + protected void SaveDomain(dynamic domain) + { + if (!domain.Save()) + { + throw new ArgumentException("Could not save domain:" + GetErrorMessage(domain.LastErr)); + } + } + + protected void SaveAccount(dynamic account, string accountTypeName = "account") + { + if (!account.Save()) + { + throw new ArgumentException("Could not save " + accountTypeName + ":" + GetErrorMessage(account.LastErr)); + } + } + + + protected string GetEmailUser(string email) + { + if (string.IsNullOrWhiteSpace(email)) + { + return string.Empty; + } + + try + { + return new MailAddress(email).User; + } + catch + { + return email.Contains('@') ? email.Substring(0, email.IndexOf('@')) : string.Empty; + } + } + + protected string GetEmailDomain(string email) + { + if (string.IsNullOrWhiteSpace(email)) + { + return string.Empty; + } + + try + { + return new MailAddress(email).Host; + } + catch + { + return email.Contains('@') ? email.Substring(email.IndexOf('@') + 1) : string.Empty; + } + } + + protected void CheckIfDomainExists(string domainName) + { + if (string.IsNullOrWhiteSpace(domainName) || !DomainExists(domainName)) + { + throw new ArgumentException("Specified domain does not exist!"); + } + } + + protected int GetDomainCount() + { + var apiObject = GetApiObject(); + return apiObject.GetDomainCount(); + } + + protected T[] GetItems(string domainName, IceWarpAccountType itemType, Func mailAccountCreator) + { + var mailAccounts = new List(); + + var accountObject = GetAccountObject(); + if (accountObject.FindInitQuery(domainName, "(U_Type = " + (int)itemType + ")")) + { + while (accountObject.FindNext()) + { + mailAccounts.Add(mailAccountCreator(accountObject)); + } + } + + return mailAccounts.ToArray(); + } + + #endregion + + #region IHostingServiceProvier methods + + public override SettingPair[] GetProviderDefaultSettings() + { + var settings = new [] + { + new SettingPair("UseDomainDiskQuota", UseDomainDiskQuota.ToString()), + new SettingPair("UseDomainLimits", UseDomainLimits.ToString()), + new SettingPair("UseUserLimits", UseUserLimits.ToString()), + new SettingPair("OverrideGlobal", OverrideGlobal.ToString()), + new SettingPair("WarnMailboxUsage", WarnMailboxUsage.ToString()), + new SettingPair("WarnDomainSize", WarnDomainSize.ToString()), + new SettingPair("MaxMessageSize", MaxMessageSizeInMB.ToString()), + new SettingPair("ServerIpAddress", BindIpAddress) + }; + + return settings; + } + + public override string[] Install() + { + SaveProviderSettingsToService(); + return base.Install(); + } + + protected void SaveProviderSettingsToService() + { + var apiObject = GetApiObject(); + apiObject.SetProperty("C_Accounts_Global_Domains_UseDiskQuota", ProviderSettings["UseDomainDiskQuota"]); + apiObject.SetProperty("C_Accounts_Global_Domains_UseDomainLimits", ProviderSettings["UseDomainLimits"]); + apiObject.SetProperty("C_Accounts_Global_Domains_UseUserLimits", ProviderSettings["UseUserLimits"]); + apiObject.SetProperty("C_Accounts_Global_Domains_OverrideGlobal", ProviderSettings["OverrideGlobal"]); + apiObject.SetProperty("C_Accounts_Global_Domains_WarnMailboxUsage", ProviderSettings["WarnMailboxUsage"]); + apiObject.SetProperty("C_Accounts_Global_Domains_WarnDomainSize", ProviderSettings["WarnDomainSize"]); + + apiObject.SetProperty("C_Mail_SMTP_Delivery_MaxMsgSize", Convert.ToInt32(ProviderSettings["MaxMessageSize"])*1024*1024); + apiObject.SetProperty("C_Mail_SMTP_Delivery_LimitMsgSize", Convert.ToInt32(ProviderSettings["MaxMessageSize"]) > 0); + + SaveApiSetting(apiObject); + } + + public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled) + { + foreach (var item in items.OfType()) + { + try + { + // enable/disable mail domain + if (DomainExists(item.Name)) + { + var mailDomain = GetDomain(item.Name); + mailDomain.Enabled = enabled; + UpdateDomain(mailDomain); + } + } + catch (Exception ex) + { + Log.WriteError(String.Format("Error switching '{0}' IceWarp domain", item.Name), ex); + } + } + } + + public override void DeleteServiceItems(ServiceProviderItem[] items) + { + foreach (var item in items.OfType()) + { + try + { + // delete mail domain + DeleteDomain(item.Name); + } + catch (Exception ex) + { + Log.WriteError(String.Format("Error deleting '{0}' IceWarp domain", item.Name), ex); + } + } + } + + public override ServiceProviderItemDiskSpace[] GetServiceItemsDiskSpace(ServiceProviderItem[] items) + { + var itemsDiskspace = new List(); + + // update items with diskspace + foreach (var item in items.OfType()) + { + try + { + Log.WriteStart(String.Format("Calculating mail account '{0}' size", item.Name)); + // calculate disk space + var accountObject = GetAccountObject(item.Name); + var size = Convert.ToInt64((object)accountObject.GetProperty("U_MailboxSize")); + + var diskspace = new ServiceProviderItemDiskSpace {ItemId = item.Id, DiskSpace = size}; + itemsDiskspace.Add(diskspace); + Log.WriteEnd(String.Format("Calculating mail account '{0}' size", item.Name)); + } + catch (Exception ex) + { + Log.WriteError(ex); + } + } + return itemsDiskspace.ToArray(); + } + + public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since) + { + var itemsBandwidth = new ServiceProviderItemBandwidth[items.Length]; + + // update items with diskspace + for (int i = 0; i < items.Length; i++) + { + ServiceProviderItem item = items[i]; + + // create new bandwidth object + itemsBandwidth[i] = new ServiceProviderItemBandwidth + { + ItemId = item.Id, + Days = new DailyStatistics[0] + }; + + if (item is MailDomain) + { + try + { + // get daily statistics + itemsBandwidth[i].Days = GetDailyStatistics(since, item.Name); + } + catch (Exception ex) + { + Log.WriteError(ex); + System.Diagnostics.Debug.WriteLine(ex); + } + } + } + + return itemsBandwidth; + } + + public DailyStatistics[] GetDailyStatistics(DateTime since, string maildomainName) + { + var days = new List(); + var today = DateTime.Today; + + try + { + var api = GetApiObject(); + + for (var date = since; date < today; date = date.AddDays(1)) + { + var stats = api.GetUserStatistics(date.ToString("yyyy\"/\"MM\"/\"dd"), date.ToString("yyyy\"/\"MM\"/\"dd"), maildomainName); + + var statsBuffer = Encoding.ASCII.GetBytes(stats); + var mailSentField = 0; + var mailReceivedField = 0; + + var ms = new MemoryStream(statsBuffer); + var reader = new StreamReader(ms); + while (reader.Peek() != -1) + { + var line = reader.ReadLine(); + var fields = line.Split(','); + + switch (line[0]) + { + case '[': + for (var j = 1; j < fields.Length; j++) + { + if (fields[j] == "[Received Amount]") mailReceivedField = j; + if (fields[j] == "[Sent Amount]") mailSentField = j; + } + break; + case '*': + var dailyStats = new DailyStatistics + { + Year = date.Year, + Month = date.Month, + Day = date.Day, + BytesSent = line[mailSentField], + BytesReceived = line[mailReceivedField] + }; + days.Add(dailyStats); + continue; + } + } + reader.Close(); + ms.Close(); + } + } + catch (Exception ex) + { + Log.WriteError("Could not get IceWarp domain statistics", ex); + } + + return days.ToArray(); + } + + #endregion + + public override bool IsInstalled() + { + string version; + + var key32Bit = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\IceWarp\IceWarp Server"); + if (key32Bit != null) + { + version = key32Bit.GetValue("Version").ToString(); + } + else + { + var key64Bit = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\IceWarp\IceWarp Server"); + if (key64Bit != null) + { + version = key64Bit.GetValue("Version").ToString(); + } + else + { + return false; + } + } + + if (string.IsNullOrEmpty(version)) + { + return false; + } + + // Checking for version 10.4.0 (released 2012-03-21) or newer + // This version introduced L_ListFile_Contents, G_ListFile_Contents and M_ListFileContents that is the latest API variable used by this provider + var split = version.Split(new[] {'.'}); + var majorVersion = Convert.ToInt32(split[0]); + var minVersion = Convert.ToInt32(split[1]); + + return majorVersion >= 11 || majorVersion >= 10 && minVersion >= 4; + } + + #region Domains + + public bool DomainExists(string domainName) + { + var api = GetApiObject(); + return api.GetDomainIndex(domainName) >= 0; + } + + public string[] GetDomains() + { + var api = GetApiObject(); + return api.GetDomainList().Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries).ToArray(); + } + + public MailDomain GetDomain(string domainName) + { + var domain = GetDomainObject(domainName); + + var mailDomain = new MailDomain + { + Name = domain.Name, + PostmasterAccount = domain.GetProperty("D_AdminEmail"), + CatchAllAccount = domain.GetProperty("D_UnknownForwardTo"), + Enabled = Convert.ToBoolean((object) domain.GetProperty("D_DisableLogin")), + MaxDomainSizeInMB = Convert.ToInt32((object) domain.GetProperty("D_DiskQuota"))/1024, + MaxDomainUsers = Convert.ToInt32((object) domain.GetProperty("D_AccountNumber")), + MegaByteSendLimit = Convert.ToInt32((object) domain.GetProperty("D_VolumeLimit"))/1024, + NumberSendLimit = Convert.ToInt32((object) domain.GetProperty("D_NumberLimit")), + DefaultUserQuotaInMB = Convert.ToInt32((object) domain.GetProperty("D_UserMailbox"))/1024, + DefaultUserMaxMessageSizeMegaByte = Convert.ToInt32((object) domain.GetProperty("D_UserMsg"))/1024, + DefaultUserMegaByteSendLimit = Convert.ToInt32((object) domain.GetProperty("D_UserMB")), + DefaultUserNumberSendLimit = Convert.ToInt32((object) domain.GetProperty("D_UserNumber")) + }; + + return mailDomain; + } + + public void CreateDomain(MailDomain domain) + { + if (string.IsNullOrWhiteSpace(domain.Name)) + { + throw new ArgumentNullException("domain.Name"); + } + + var domainObject = GetDomainObject(); + + if (!domainObject.New(domain.Name)) + { + throw new ApplicationException("Failed to create domain: " + GetErrorMessage(domainObject.LastErr)); + } + + SaveDomain(domainObject); + + UpdateDomain(domain); + } + + public void UpdateDomain(MailDomain domain) + { + var domainObject = GetDomainObject(domain.Name); + + domainObject.SetProperty("D_AdminEmail", string.IsNullOrEmpty(domain.PostmasterAccount) ? "" : domain.PostmasterAccount); + + if (string.IsNullOrEmpty(domain.CatchAllAccount)) + { + domainObject.SetProperty("D_UnknownForwardTo", ""); + domainObject.SetProperty("D_UnknownUsersType", IceWarpUnknownUsersType.Reject); + } + else + { + domainObject.SetProperty("D_UnknownForwardTo", domain.CatchAllAccount); + domainObject.SetProperty("D_UnknownUsersType", IceWarpUnknownUsersType.ForwardToAddress); + } + + domainObject.SetProperty("D_DisableLogin", !domain.Enabled); + domainObject.SetProperty("D_DiskQuota", domain.MaxDomainSizeInMB*1024); + domainObject.SetProperty("D_AccountNumber", domain.MaxDomainUsers); + domainObject.SetProperty("D_VolumeLimit", domain.MegaByteSendLimit*1024); + domainObject.SetProperty("D_NumberLimit", domain.NumberSendLimit); + + domainObject.SetProperty("D_UserMailbox", domain.DefaultUserQuotaInMB*1024); + domainObject.SetProperty("D_UserMsg", domain.DefaultUserMaxMessageSizeMegaByte*1024); + domainObject.SetProperty("D_UserMB", domain.DefaultUserMegaByteSendLimit); + domainObject.SetProperty("D_UserNumber", domain.DefaultUserNumberSendLimit); + + SaveDomain(domainObject); + } + + public void DeleteDomain(string domainName) + { + var domainObject = GetDomainObject(domainName); + + if (domainObject.Delete()) + { + throw new Exception("Could not delete domain"); + } + } + + #endregion + + #region Domain alieses + + public bool DomainAliasExists(string domainName, string aliasName) + { + if (!DomainExists(aliasName)) + { + return false; + } + + var domainObject = GetDomainObject(aliasName); + + return Convert.ToInt32((object) domainObject.GetProperty("D_Type")) == 2 && string.Compare(domainObject.GetProperty("D_DomainValue").ToString(), domainName, true) == 0; + } + + public string[] GetDomainAliases(string domainName) + { + var aliasList = new List(); + + var apiObject = GetApiObject(); + + var domainCount = apiObject.GetDomainCount(); + + for (var i = 0; i < domainCount; i++) + { + var aliasName = apiObject.GetDomain(i); + if (DomainAliasExists(domainName, aliasName)) + { + aliasList.Add(aliasName); + } + } + + return aliasList.ToArray(); + } + + public void AddDomainAlias(string domainName, string aliasName) + { + var mailDomain = new MailDomain {Name = aliasName}; + CreateDomain(mailDomain); + var domainObject = GetDomainObject(aliasName); + + domainObject.SetProperty("D_Type", 2); + domainObject.SetProperty("D_DomainValue", domainName); + SaveDomain(domainObject); + } + + public void DeleteDomainAlias(string domainName, string aliasName) + { + DeleteDomain(aliasName); + } + + #endregion + + #region Accounts + + public bool AccountExists(string mailboxName) + { + var accountObject = GetAccountObject(); + + return accountObject.Open(mailboxName) && Convert.ToInt32((object) accountObject.GetProperty("U_Type")) == (int) IceWarpAccountType.User; + } + + protected class IceWarpResponderContent + { + public string From { get; set; } + public string To { get; set; } + public string Subject { get; set; } + public string Content { get; set; } + } + + private static IceWarpResponderContent ParseResponderContent(string responderContent) + { + var result = new IceWarpResponderContent(); + + if (string.IsNullOrWhiteSpace(responderContent)) + { + return result; + } + + var re = new Regex(@"\$\$(set\w*) (.*)\$\$\n"); + var matches = re.Matches(responderContent); + + foreach (Match match in matches) + { + if (match.Groups[1].Value == "setsubject") + { + result.Subject = match.Groups[2].Value; + } + + if (match.Groups[1].Value == "setactualto") + { + result.To = match.Groups[2].Value; + } + + if (match.Groups[1].Value == "setactualfrom") + { + result.From = match.Groups[2].Value; + } + } + + result.Content = re.Replace(responderContent, ""); + + return result; + } + + protected static MailAccount CreateMailAccountFromAccountObject(dynamic accountObject) + { + var mailAccount = new MailAccount + { + Name = accountObject.EmailAddress, + FullName = accountObject.GetProperty("U_Name"), + Enabled = Convert.ToInt32((object) accountObject.GetProperty("U_AccountDisabled")) == 0, + ForwardingEnabled = !string.IsNullOrWhiteSpace(accountObject.GetProperty("U_ForwardTo")) || string.IsNullOrWhiteSpace(accountObject.GetProperty("U_RemoteAddress")) && Convert.ToBoolean((object) accountObject.GetProperty("U_UseRemoteAddress")), + IsDomainAdmin = Convert.ToBoolean((object) accountObject.GetProperty("U_DomainAdmin")), + MaxMailboxSize = Convert.ToInt32((object) accountObject.GetProperty("U_MaxBoxSize"))/1024, + Password = accountObject.GetProperty("U_Password"), + ResponderEnabled = Convert.ToInt32((object) accountObject.GetProperty("U_Respond")) > 0, + QuotaUsed = Convert.ToInt64((object) accountObject.GetProperty("U_MailBoxSize")), + MaxMessageSizeMegaByte = Convert.ToInt32((object) accountObject.GetProperty("U_MaxMessageSize"))/1024, + MegaByteSendLimit = Convert.ToInt32((object) accountObject.GetProperty("U_MegabyteSendLimit")), + NumberSendLimit = Convert.ToInt32((object) accountObject.GetProperty("U_NumberSendLimit")), + DeleteOlder = Convert.ToBoolean((object) accountObject.GetProperty("U_DeleteOlder")), + DeleteOlderDays = Convert.ToInt32((object) accountObject.GetProperty("U_DeleteOlderDays")), + ForwardOlder = Convert.ToBoolean((object) accountObject.GetProperty("U_ForwardOlder")), + ForwardOlderDays = Convert.ToInt32((object) accountObject.GetProperty("U_ForwardOlderDays")), + ForwardOlderTo = accountObject.GetProperty("U_ForwardOlderTo"), + IceWarpAccountState = Convert.ToInt32((object) accountObject.GetProperty("U_AccountDisabled")), + IceWarpAccountType = Convert.ToInt32((object) accountObject.GetProperty("U_AccountType")), + IceWarpRespondType = Convert.ToInt32((object) accountObject.GetProperty("U_Respond")) + }; + + if (mailAccount.ForwardingEnabled) + { + mailAccount.ForwardingAddresses = new string[] {accountObject.GetProperty("U_ForwardTo") + accountObject.GetProperty("U_RemoteAddress")}; + mailAccount.DeleteOnForward = Convert.ToInt32(accountObject.GetProperty("U_UseRemoteAddress")) == 1; + mailAccount.RetainLocalCopy = !mailAccount.DeleteOnForward; + } + + if (mailAccount.ResponderEnabled) + { + var respondFromValue = accountObject.GetProperty("U_RespondBetweenFrom"); + var respondToValue = accountObject.GetProperty("U_RespondBetweenTo"); + DateTime respondFrom; + DateTime respondTo; + mailAccount.RespondOnlyBetweenDates = false; + var fromDateParsed = DateTime.TryParse(respondFromValue, out respondFrom); + + if (DateTime.TryParse(respondToValue, out respondTo) && fromDateParsed) + { + mailAccount.RespondOnlyBetweenDates = true; + mailAccount.RespondFrom = respondFrom; + mailAccount.RespondTo = respondTo; + } + + mailAccount.RespondPeriodInDays = Convert.ToInt32((object) accountObject.GetProperty("U_RespondPeriod")); + var responderContent = ParseResponderContent(accountObject.GetProperty("U_ResponderContent")); + mailAccount.ResponderMessage = responderContent.Content; + mailAccount.ResponderSubject = responderContent.Subject; + mailAccount.RespondWithReplyFrom = responderContent.From; + } + + return mailAccount; + } + + public MailAccount[] GetAccounts(string domainName) + { + return GetItems(domainName, IceWarpAccountType.User, CreateMailAccountFromAccountObject); + } + + public MailAccount GetAccount(string mailboxName) + { + var accountObject = GetAccountObject(mailboxName); + return CreateMailAccountFromAccountObject(accountObject); + } + + public void CreateAccount(MailAccount mailbox) + { + var accountObject = GetAccountObject(); + + var emailParts = new MailAddress(mailbox.Name); + if (!accountObject.CanCreateMailbox(emailParts.User, emailParts.User, mailbox.Password, emailParts.Host)) + { + throw new Exception("Cannot create account: " + GetErrorMessage(accountObject.LastErr)); + } + + if (accountObject.New(mailbox.Name)) + { + accountObject.Save(); + } + + UpdateAccount(mailbox); + } + + public void UpdateAccount(MailAccount mailbox) + { + var accountObject = GetAccountObject(mailbox.Name); + + accountObject.SetProperty("U_Name", mailbox.FullName); + accountObject.SetProperty("U_AccountDisabled", mailbox.IceWarpAccountState); + accountObject.SetProperty("U_DomainAdmin", mailbox.IsDomainAdmin); + accountObject.SetProperty("U_Password", mailbox.Password); + accountObject.SetProperty("U_MaxBoxSize", mailbox.MaxMailboxSize); + accountObject.SetProperty("U_MaxMessageSize", mailbox.MaxMessageSizeMegaByte*1024); + accountObject.SetProperty("U_MegabyteSendLimit", mailbox.MegaByteSendLimit); + accountObject.SetProperty("U_NumberSendLimit", mailbox.NumberSendLimit); + accountObject.SetProperty("U_AccountType", mailbox.IceWarpAccountType); + accountObject.SetProperty("U_Respond", mailbox.IceWarpRespondType); + + accountObject.SetProperty("U_DeleteOlder", mailbox.DeleteOlder); + accountObject.SetProperty("U_DeleteOlderDays", mailbox.DeleteOlderDays); + accountObject.SetProperty("U_ForwardOlder", mailbox.ForwardOlder); + accountObject.SetProperty("U_ForwardOlderDays", mailbox.ForwardOlderDays); + accountObject.SetProperty("U_ForwardOlderTo", mailbox.ForwardOlderTo); + + // Set initial defalt values for forwarding + accountObject.SetProperty("U_RemoteAddress", null); + accountObject.SetProperty("U_ForwardTo", null); + accountObject.SetProperty("U_UseRemoteAddress", false); + + if (mailbox.ForwardingEnabled) + { + if (mailbox.DeleteOnForward) + { + accountObject.SetProperty("U_RemoteAddress", string.Join(";", mailbox.ForwardingAddresses)); + accountObject.SetProperty("U_UseRemoteAddress", true); + } + else + { + accountObject.SetProperty("U_ForwardTo", string.Join(";", mailbox.ForwardingAddresses)); + } + } + + + if (mailbox.IceWarpRespondType > 0) + { + if (mailbox.RespondOnlyBetweenDates) + { + accountObject.SetProperty("U_RespondBetweenFrom", mailbox.RespondFrom.ToShortDateString()); + accountObject.SetProperty("U_RespondBetweenTo", mailbox.RespondTo.ToShortDateString()); + } + else + { + accountObject.SetProperty("U_RespondBetweenFrom", null); + accountObject.SetProperty("U_RespondBetweenTo", null); + } + + accountObject.SetProperty("U_RespondPeriod", mailbox.RespondPeriodInDays); + + var responderContent = ""; + if (!string.IsNullOrWhiteSpace(mailbox.RespondWithReplyFrom)) + { + responderContent += "$$setactualfrom " + mailbox.RespondWithReplyFrom + "$$\n"; + } + if (!string.IsNullOrWhiteSpace(mailbox.ResponderSubject)) + { + responderContent += "$$setsubject " + mailbox.ResponderSubject + "$$\n"; + } + + accountObject.SetProperty("U_ResponderContent", responderContent + mailbox.ResponderMessage); + } + + SaveAccount(accountObject); + } + + public void DeleteAccount(string mailboxName) + { + var accountObject = GetAccountObject(mailboxName); + if (!accountObject.Delete()) + { + throw new Exception("Cannot delete account: " + GetErrorMessage(accountObject.LastErr)); + } + } + + #endregion + + #region Mail aliases + + public bool MailAliasExists(string mailAliasName) + { + var accountObject = GetAccountObject(); + + return accountObject.Open(mailAliasName); + } + + protected IEnumerable GetAliasListFromAccountObject(dynamic accountObject) + { + return SplitStringProperty(accountObject, "U_EmailAlias", ';'); + } + + protected string GetForwardToAddressFromAccountObject(dynamic accountObject) + { + var forwardTo = accountObject.EmailAddress; + var remoteAddress = accountObject.GetProperty("U_RemoteAddress"); + if (!string.IsNullOrWhiteSpace(remoteAddress)) + { + forwardTo = remoteAddress; + } + + return forwardTo; + } + + public MailAlias[] GetMailAliases(string domainName) + { + var aliasList = new List(); + + var accountObject = GetAccountObject(); + + if (accountObject.FindInitQuery(domainName, "U_Type=" + (int)IceWarpAccountType.User)) + { + while (accountObject.FindNext()) + { + var forwardTo = GetForwardToAddressFromAccountObject(accountObject); + var aliases = GetAliasListFromAccountObject(accountObject) as IEnumerable; + aliasList.AddRange(aliases.Where(a => a != forwardTo).Select(alias => new MailAlias {Name = alias + "@" + domainName, ForwardTo = forwardTo + "@" + domainName})); + } + + accountObject.FindDone(); + } + + return aliasList.ToArray(); + } + + public MailAlias GetMailAlias(string mailAliasName) + { + var accountObject = GetAccountObject(mailAliasName); + + var forwardTo = GetForwardToAddressFromAccountObject(accountObject); + + return new MailAlias {ForwardTo = forwardTo, Name = mailAliasName}; + } + + public void CreateMailAlias(MailAlias mailAlias) + { + // If not forwardto-address exists or is in another domain, create a new account with remoteaddress + if (!GetEmailDomain(mailAlias.Name).Equals(GetEmailDomain(mailAlias.ForwardTo), StringComparison.InvariantCultureIgnoreCase) || !AccountExists(mailAlias.ForwardTo)) + { + mailAlias.ForwardingEnabled = true; + mailAlias.DeleteOnForward = true; + mailAlias.ForwardingAddresses = new[] {mailAlias.ForwardTo}; + mailAlias.Password = GetRandomPassword(); + CreateAccount(mailAlias); + } + // else open account and add alias to list + else + { + var accountOject = GetAccountObject(mailAlias.ForwardTo); + var aliases = GetAliasListFromAccountObject(accountOject).ToList(); + aliases.Add(GetEmailUser(mailAlias.Name)); + accountOject.SetProperty("U_EmailAlias", string.Join(";", aliases)); + + SaveAccount(accountOject, "account when creating mail alias"); + } + } + + private string GetRandomPassword() + { + var apiObject = GetApiObject(); + var minLength = apiObject.GetProperty("C_Accounts_Policies_Pass_MinLength"); + var digits = apiObject.GetProperty("C_Accounts_Policies_Pass_Digits"); + var nonAlphaNum = apiObject.GetProperty("C_Accounts_Policies_Pass_NonAlphaNum"); + var alpha = apiObject.GetProperty("C_Accounts_Policies_Pass_Alpha"); + + return "asdfghjk12345678"; + // TODO: Generateapassword using password policy from icewarp installation. Is there a imple way + } + + public void UpdateMailAlias(MailAlias mailAlias) + { + // Delete alias based on mailAlias.Name + DeleteMailAlias(mailAlias.Name); + + // Recreate alias + CreateMailAlias(mailAlias); + } + + public void DeleteMailAlias(string mailAliasName) + { + // Find account where alias exists + var accountObject = GetAccountObject(mailAliasName); + + // Check if it has any other aliases + var otherAliases = ((IEnumerable)GetAliasListFromAccountObject(accountObject)).Where(a => a != GetEmailUser(mailAliasName)).ToArray(); + if (otherAliases.Any()) + { + accountObject.SetProperty("U_EmailAlias", string.Join(";", otherAliases)); + SaveAccount(accountObject, "account during alias delete"); + } + // If no other aliases, this should be an account with a remote address and then we should delete the account + else + { + DeleteAccount(mailAliasName); + } + } + + #endregion + + #region Groups + + public bool GroupExists(string groupName) + { + var accountObject = GetAccountObject(); + + return accountObject.Open(groupName) && Convert.ToInt32(accountObject.GetProperty("U_Type")) == 7; + } + + public MailGroup[] GetGroups(string domainName) + { + return GetItems(domainName, IceWarpAccountType.UserGroup, CreateMailGroupFromAccountObject); + } + + protected MailGroup CreateMailGroupFromAccountObject(dynamic accountObject) + { + var mailGroup = new MailGroup + { + Name = accountObject.EmailAddress, + Enabled = Convert.ToInt32((object) accountObject.GetProperty("U_AccountDisabled")) == 0, + GroupName = accountObject.GetProperty("G_Name"), + Members = ((IEnumerable)SplitFileContents(accountObject, "G_ListFile_Contents")).ToArray() + }; + + return mailGroup; + } + + public MailGroup GetGroup(string groupName) + { + var accountObject = GetAccountObject(groupName); + return CreateMailGroupFromAccountObject(accountObject); + } + + public void CreateGroup(MailGroup @group) + { + var accountObject = GetAccountObject(); + + if (accountObject.New(group.Name)) + { + accountObject.SetProperty("U_Type", 7); + accountObject.SetProperty("G_GroupwareMailDelivery", false); + SaveAccount(accountObject, "group account"); + } + else + { + throw new ApplicationException("Failed to create group: " + GetErrorMessage(accountObject.LastErr)); + } + + UpdateGroup(group); + } + + public void UpdateGroup(MailGroup @group) + { + var accountObject = GetAccountObject(group.Name); + + accountObject.SetProperty("G_Name", group.GroupName); + accountObject.SetProperty("U_AccountDisabled", group.Enabled ? 0 : 2); + accountObject.SetProperty("G_ListFile_Contents", string.Join("\n", group.Members)); + + SaveAccount(accountObject, "group"); + } + + public void DeleteGroup(string groupName) + { + var accountObject = GetAccountObject(groupName); + if (!accountObject.Delete()) + { + throw new Exception("Cannot delete group: " + GetErrorMessage(accountObject.LastErr)); + } + } + + #endregion + + #region Lists + + public bool ListExists(string maillistName) + { + var accountObject = GetAccountObject(); + + return accountObject.Open(maillistName) && (IceWarpAccountType) Enum.Parse(typeof (IceWarpAccountType), ((object) accountObject.GetProperty("U_Type")).ToString()) == IceWarpAccountType.MailingList; + } + + public MailList[] GetLists(string domainName) + { + return GetItems(domainName, IceWarpAccountType.MailingList, CreateMailListFromAccountObject); + } + + protected IEnumerable SplitStringProperty(dynamic accountObject, string propertyName, char separator) + { + var value = (object) accountObject.GetProperty(propertyName); + return value == null ? new String[] {} : value.ToString().Split(new[] {separator}, StringSplitOptions.RemoveEmptyEntries); + } + + protected IEnumerable SplitFileContents(dynamic accountObject, string propertyName) + { + return SplitStringProperty(accountObject, propertyName, '\n'); + } + + protected MailList CreateMailListFromAccountObject(dynamic accountObject) + { + // IceWarp has separate settings for list server and mailing list. Together they have all the info we need for a WSP MailList + // From an accountObject of type list server, we can fetch the mailing lists associated with it + // So, first we search and find the list server account that is associated with this mailing list account. + var listServerAccountObject = FindMatchingListServerAccount(accountObject.EmailAddress, true); + + var mailList = new MailList + { + //From mailing list account + Name = accountObject.EmailAddress, + Description = accountObject.GetProperty("M_Name"), + ModeratorAddress = accountObject.GetProperty("M_OwnerAddress"), + MembersSource = (IceWarpListMembersSource) Enum.Parse(typeof (IceWarpListMembersSource), ((object) accountObject.GetProperty("M_SendAllLists")).ToString()), + Members = ((IEnumerable)SplitFileContents(accountObject, "M_ListFile_Contents")).Select(m => m.TrimEnd(new[] {';', '0', '1', '2'})).ToArray(), + SetReceipientsToToHeader = Convert.ToBoolean((object) accountObject.GetProperty("M_SeparateTo")), + SubjectPrefix = accountObject.GetProperty("M_AddToSubject"), + Originator = (IceWarpListOriginator) Enum.Parse(typeof (IceWarpListOriginator), ((object) accountObject.GetProperty("M_ListSender")).ToString()), + PostingMode = Convert.ToBoolean((object) accountObject.GetProperty("M_MembersOnly")) ? PostingMode.MembersCanPost : PostingMode.AnyoneCanPost, + PasswordProtection = (PasswordProtection) Enum.Parse(typeof (PasswordProtection), ((object) accountObject.GetProperty("M_Moderated")).ToString()), + Password = accountObject.GetProperty("M_ModeratedPassword"), + DefaultRights = (IceWarpListDefaultRights) Enum.Parse(typeof (IceWarpListDefaultRights), ((object) accountObject.GetProperty("M_DefaultRights")).ToString()), + MaxMessageSizeEnabled = Convert.ToBoolean((object) accountObject.GetProperty("M_MaxList")), + MaxMessageSize = Convert.ToInt32((object) accountObject.GetProperty("M_MaxListSize")), + MaxMembers = Convert.ToInt32((object) accountObject.GetProperty("M_MaxMembers")), + SendToSender = Convert.ToBoolean((object) accountObject.GetProperty("M_SendToSender")), + DigestMode = Convert.ToBoolean((object) accountObject.GetProperty("M_DigestConfirmed")), + MaxMessagesPerMinute = Convert.ToInt32((object) accountObject.GetProperty("M_ListBatch")), + SendSubscribe = Convert.ToBoolean((object) accountObject.GetProperty("M_NotifyJoin")), + SendUnsubscribe = Convert.ToBoolean((object) accountObject.GetProperty("M_NotifyLeave")), + + // From list server account + ConfirmSubscription = (IceWarpListConfirmSubscription) Enum.Parse(typeof (IceWarpListConfirmSubscription), ((object) listServerAccountObject.GetProperty("L_DigestConfirmed")).ToString()), + CommandsInSubject = Convert.ToBoolean((object) listServerAccountObject.GetProperty("L_ListSubject")), + DisableSubscribecommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_JoinR")), + AllowUnsubscribe = Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_LeaveR")), + DisableListcommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_ListsR")), + DisableWhichCommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_WhichR")), + DisableReviewCommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_ReviewR")), + DisableVacationCommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_VacationR")), + Moderated = Convert.ToBoolean((object) listServerAccountObject.GetProperty("L_Moderated")), + CommandPassword = listServerAccountObject.GetProperty("L_ModeratedPassword"), + SuppressCommandResponses = Convert.ToBoolean((object) listServerAccountObject.GetProperty("L_MaxList")) + }; + + + // This is how I get values for from and replyto header values. TODO: There must be a better way, but I don't see the pattern right now... + var ss = Convert.ToInt32((object) accountObject.GetProperty("M_SetSender")); + var sv = Convert.ToInt32((object) accountObject.GetProperty("M_SetValue")); + var vm = Convert.ToBoolean((object) accountObject.GetProperty("M_ValueMode")); + var value = accountObject.GetProperty("M_HeaderValue"); + + switch (ss) + { + case 0: + switch (sv) + { + case 0: + mailList.FromHeader = IceWarpListFromAndReplyToHeader.NoChange; + mailList.ReplyToHeader = IceWarpListFromAndReplyToHeader.NoChange; + break; + case 1: + if (vm) + { + mailList.FromHeader = IceWarpListFromAndReplyToHeader.NoChange; + mailList.ReplyToHeader = IceWarpListFromAndReplyToHeader.SetToValue; + mailList.ListReplyToAddress = value; + } + else + { + mailList.FromHeader = IceWarpListFromAndReplyToHeader.SetToValue; + mailList.ReplyToHeader = IceWarpListFromAndReplyToHeader.NoChange; + mailList.ListFromAddress = value; + } + break; + case 2: + mailList.FromHeader = IceWarpListFromAndReplyToHeader.SetToValue; + mailList.ReplyToHeader = IceWarpListFromAndReplyToHeader.SetToValue; + var values = value.Split('|'); + mailList.ListFromAddress = values[0]; + mailList.ListReplyToAddress = values[1]; + break; + } + break; + case 1: + switch (sv) + { + case 0: + mailList.FromHeader = IceWarpListFromAndReplyToHeader.SetToSender; + mailList.ReplyToHeader = IceWarpListFromAndReplyToHeader.NoChange; + break; + case 1: + if (vm) + { + mailList.FromHeader = IceWarpListFromAndReplyToHeader.SetToSender; + mailList.ReplyToHeader = IceWarpListFromAndReplyToHeader.SetToValue; + mailList.ListReplyToAddress = value; + } + else + { + mailList.FromHeader = IceWarpListFromAndReplyToHeader.SetToValue; + mailList.ReplyToHeader = IceWarpListFromAndReplyToHeader.SetToSender; + mailList.ListFromAddress = value; + } + + break; + } + break; + case 2: + mailList.FromHeader = IceWarpListFromAndReplyToHeader.SetToSender; + mailList.ReplyToHeader = IceWarpListFromAndReplyToHeader.SetToSender; + break; + } + + return mailList; + } + + public MailList GetList(string maillistName) + { + var accountObject = GetAccountObject(maillistName); + return CreateMailListFromAccountObject(accountObject); + } + + public void CreateList(MailList maillist) + { + if (string.IsNullOrWhiteSpace(maillist.Name)) + { + throw new ArgumentNullException("maillist.Name"); + } + + var accountObject = GetAccountObject(); + + if (!accountObject.New(maillist.Name)) + { + throw new ApplicationException("Failed to create mailing list: " + GetErrorMessage(accountObject.LastErr)); + } + + accountObject.SetProperty("U_Type", IceWarpAccountType.MailingList); + + SaveAccount(accountObject, "mailing list"); + + UpdateList(maillist); + } + + protected dynamic FindMatchingListServerAccount(string mailingListName, bool createListServerAccountIfNeeded) + { + var listServerAccountObject = GetAccountObject(); + var forceCreatelistServerAccountObject = false; + var listServerAccountFound = false; + + if (listServerAccountObject.FindInitQuery(GetEmailDomain(mailingListName), "U_Type=" + (int)IceWarpAccountType.ListServer)) + { + while (listServerAccountObject.FindNext()) + { + var lists = ((IEnumerable)SplitFileContents(listServerAccountObject, "L_ListFile_Contents")).ToList(); + if (lists.Contains(mailingListName)) + { + listServerAccountFound = true; + + // If this list server account is responsible for more than one mailing list, force creation of a new one. + if (lists.Count() > 1) + { + forceCreatelistServerAccountObject = true; + listServerAccountObject.SetProperty("L_ListFile_Contents", string.Join("\n", lists.Remove(mailingListName))); + SaveAccount(listServerAccountObject, "list server account "); + } + break; + } + } + } + + // If no list server was found that was responsible for this mailing list, create one + if (forceCreatelistServerAccountObject || !listServerAccountFound && createListServerAccountIfNeeded) + { + // Create list server account + if (!listServerAccountObject.New("srv" + mailingListName)) + { + throw new Exception("Cannot create listserver account to associate with mailing list." + GetErrorMessage(listServerAccountObject.LastErr)); + } + + listServerAccountObject.SetProperty("U_Type", IceWarpAccountType.ListServer); + listServerAccountObject.SetProperty("L_SendAllLists", 0); + listServerAccountObject.SetProperty("L_ListFile_Contents", mailingListName + "\n"); + + SaveAccount(listServerAccountObject, "listserver account to associate with mailing list"); + } + + return !listServerAccountFound ? null : listServerAccountObject; + } + + public void UpdateList(MailList maillist) + { + var accountObject = GetAccountObject(maillist.Name); + var listServerAccountObject = FindMatchingListServerAccount(maillist.Name, true); + + accountObject.SetProperty("M_Name", maillist.Description); + accountObject.SetProperty("M_OwnerAddress", maillist.ModeratorAddress); + accountObject.SetProperty("M_SendAllLists", maillist.MembersSource); + accountObject.SetProperty("L_ListFile_Contents", string.Join(";0;\n", maillist.Members) + ";0;\n"); // 0 means that the members will have the default rights + // TODO: Create some way to manage list member rights. As it is now, all members will loose rights that is set using some other tool + + var setSender = 0; + var setValue = 0; + var valueMode = false; + var value = ""; + + switch (maillist.FromHeader) + { + case IceWarpListFromAndReplyToHeader.NoChange: + switch (maillist.ReplyToHeader) + { + case IceWarpListFromAndReplyToHeader.NoChange: + break; + case IceWarpListFromAndReplyToHeader.SetToSender: + setSender = 1; + break; + case IceWarpListFromAndReplyToHeader.SetToValue: + setSender = 1; + valueMode = true; + value = maillist.ListReplyToAddress; + break; + } + break; + case IceWarpListFromAndReplyToHeader.SetToSender: + switch (maillist.ReplyToHeader) + { + case IceWarpListFromAndReplyToHeader.NoChange: + setSender = 1; + valueMode = true; + break; + case IceWarpListFromAndReplyToHeader.SetToSender: + setSender = 2; + valueMode = true; + break; + case IceWarpListFromAndReplyToHeader.SetToValue: + setSender = 1; + setValue = 1; + valueMode = true; + value = maillist.ListReplyToAddress; + break; + } + break; + case IceWarpListFromAndReplyToHeader.SetToValue: + switch (maillist.ReplyToHeader) + { + case IceWarpListFromAndReplyToHeader.NoChange: + setValue = 1; + value = maillist.ListFromAddress; + break; + case IceWarpListFromAndReplyToHeader.SetToSender: + setSender = 1; + setValue = 1; + value = maillist.ListFromAddress; + break; + case IceWarpListFromAndReplyToHeader.SetToValue: + setValue = 2; + value = maillist.ListFromAddress + "|" + maillist.ListReplyToAddress; + break; + } + break; + } + + accountObject.SetProperty("M_SetSender", setSender); + accountObject.SetProperty("M_SetValue", setValue); + accountObject.SetProperty("M_ValueMode", valueMode); + accountObject.SetProperty("M_HeaderValue", value); + accountObject.SetProperty("M_SeparateTo", maillist.SetReceipientsToToHeader); + accountObject.SetProperty("M_AddToSubject", maillist.SubjectPrefix); + accountObject.SetProperty("M_ListSender", maillist.Originator); + accountObject.SetProperty("M_MembersOnly", maillist.PostingMode == PostingMode.MembersCanPost); + accountObject.SetProperty("M_Moderated", maillist.PasswordProtection); + accountObject.SetProperty("M_ModeratedPassword", maillist.Password); + accountObject.SetProperty("M_DefaultRights", maillist.DefaultRights); + accountObject.SetProperty("M_MaxList", maillist.MaxMessageSizeEnabled); + accountObject.SetProperty("M_MaxListSize", maillist.MaxMessageSize); + accountObject.SetProperty("M_MaxMembers", maillist.MaxMembers); + accountObject.SetProperty("M_SendToSender", maillist.SendToSender); + accountObject.SetProperty("M_DigestConfirmed", maillist.DigestMode); + accountObject.SetProperty("M_ListBatch", maillist.MaxMessagesPerMinute); + accountObject.SetProperty("M_NotifyJoin", maillist.SendSubscribe); + accountObject.SetProperty("M_NotifyLeave", maillist.SendUnsubscribe); + + SaveAccount(accountObject, "mailing list account"); + + listServerAccountObject.SetProperty("L_Name", maillist.Description); + listServerAccountObject.SetProperty("L_OwnerAddress", maillist.ModeratorAddress); + listServerAccountObject.SetProperty("L_SendAllLists", 0); + listServerAccountObject.SetProperty("L_DigestConfirmed", maillist.ConfirmSubscription); + listServerAccountObject.SetProperty("L_ListSubject", maillist.CommandsInSubject); + listServerAccountObject.SetProperty("M_JoinR", !maillist.DisableSubscribecommand); + listServerAccountObject.SetProperty("M_LeaveR", maillist.AllowUnsubscribe); + listServerAccountObject.SetProperty("M_ListsR", !maillist.DisableListcommand); + listServerAccountObject.SetProperty("M_WhichR", !maillist.DisableWhichCommand); + listServerAccountObject.SetProperty("M_ReviewR", !maillist.DisableReviewCommand); + listServerAccountObject.SetProperty("M_VacationR", !maillist.DisableVacationCommand); + listServerAccountObject.SetProperty("L_Moderated", maillist.Moderated); + listServerAccountObject.SetProperty("L_ModeratedPassword", maillist.CommandPassword); + listServerAccountObject.SetProperty("L_ListSender", maillist.Originator); + listServerAccountObject.SetProperty("L_MaxList", maillist.SuppressCommandResponses); + + SaveAccount(accountObject, "listserver account associated with mailing list"); + } + + public void DeleteList(string maillistName) + { + var accountObject = GetAccountObject(maillistName); + var listServerAccountObject = FindMatchingListServerAccount(maillistName, false); + + if (accountObject.Delete()) + { + // If there is no matching list server account, we are done + if (listServerAccountObject == null) + { + return; + } + + var lists = ((IEnumerable)SplitFileContents(listServerAccountObject, "L_ListFile_Contents")).ToList(); + + if (lists.Count() == 1) + { + if (!listServerAccountObject.Delete()) + { + throw new Exception("Deleted mail list, but list server account remains: " + GetErrorMessage(listServerAccountObject.LastErr)); + } + } + else + { + listServerAccountObject.SetProperty("L_ListFile_Contents", string.Join("\n", lists.Remove(maillistName))); + if (!listServerAccountObject.Save()) + { + throw new Exception("Deleted mail list, but associated list server account could not be updated: " + GetErrorMessage(listServerAccountObject.LastErr)); + } + } + } + else + { + throw new Exception("Cannot delete mail list: " + GetErrorMessage(accountObject.LastErr)); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/Properties/AssemblyInfo.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..ddbeeac5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WebsitePanel.Providers.Mail.IceWarp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebsitePanel.Providers.Mail.IceWarp")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a1d6862c-a090-4043-9db3-591ca690da83")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/WebsitePanel.Providers.Mail.IceWarp.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/WebsitePanel.Providers.Mail.IceWarp.csproj new file mode 100644 index 00000000..5fa14af7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/WebsitePanel.Providers.Mail.IceWarp.csproj @@ -0,0 +1,64 @@ + + + + + Debug + AnyCPU + {95EA2D6E-278C-4A74-97DB-946362C4DEEA} + Library + Properties + WebsitePanel.Providers.Mail.IceWarp + WebsitePanel.Providers.Mail.IceWarp + v4.0 + 512 + + + + true + full + false + ..\WebsitePanel.Server\bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + {684C932A-6C75-46AC-A327-F3689D89EB42} + WebsitePanel.Providers.Base + + + {E91E52F3-9555-4D00-B577-2B1DBDD87CA7} + WebsitePanel.Server.Utils + + + + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailAccountsEditAccount.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailAccountsEditAccount.ascx.cs index 7facf242..1ddef607 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailAccountsEditAccount.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailAccountsEditAccount.ascx.cs @@ -188,36 +188,40 @@ namespace WebsitePanel.Portal item.Password = passwordControl.Password; item.MaxMailboxSize = Utils.ParseInt(txtMailBoxSizeLimit.Text); - //checking if account name is different from existing e-mail lists - MailList[] lists = ES.Services.MailServers.GetMailLists(PanelSecurity.PackageId, true); - foreach (MailList list in lists) + // Only check for conflicting names if creating new item + if (PanelRequest.ItemID == 0) { - if (item.Name == list.Name) + //checking if account name is different from existing e-mail lists + MailList[] lists = ES.Services.MailServers.GetMailLists(PanelSecurity.PackageId, true); + foreach (MailList list in lists) { - ShowWarningMessage("MAIL_ACCOUNT_NAME"); - return; + if (item.Name == list.Name) + { + ShowWarningMessage("MAIL_ACCOUNT_NAME"); + return; + } } - } - //checking if account name is different from existing e-mail groups - MailGroup[] mailgroups = ES.Services.MailServers.GetMailGroups(PanelSecurity.PackageId, true); - foreach (MailGroup group in mailgroups) - { - if (item.Name == group.Name) + //checking if account name is different from existing e-mail groups + MailGroup[] mailgroups = ES.Services.MailServers.GetMailGroups(PanelSecurity.PackageId, true); + foreach (MailGroup group in mailgroups) { - ShowWarningMessage("MAIL_ACCOUNT_NAME"); - return; + if (item.Name == group.Name) + { + ShowWarningMessage("MAIL_ACCOUNT_NAME"); + return; + } } - } - //checking if account name is different from existing forwardings - MailAlias[] forwardings = ES.Services.MailServers.GetMailForwardings(PanelSecurity.PackageId, true); - foreach (MailAlias forwarding in forwardings) - { - if (item.Name == forwarding.Name) + //checking if account name is different from existing forwardings + MailAlias[] forwardings = ES.Services.MailServers.GetMailForwardings(PanelSecurity.PackageId, true); + foreach (MailAlias forwarding in forwardings) { - ShowWarningMessage("MAIL_ACCOUNT_NAME"); - return; + if (item.Name == forwarding.Name) + { + ShowWarningMessage("MAIL_ACCOUNT_NAME"); + return; + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditAccount.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditAccount.ascx.resx new file mode 100644 index 00000000..946cd8c0 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditAccount.ascx.resx @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Change password + + + + + + Enable delete of older messages + + + + + + Delete Message on Forward + + + + + + Domain Administrator + + + + + + Only respond between these dates + + + + + + Disabled (Login) + + + Disabled (Login, Receive) + + + Disabled (Tarpitting) + + + Enabled + + + Respond always (can cause loop) + + + Disabled + + + Respond once + + + Respond once in period + + + Account state: + + + + + + Account type: + + + + + + Delete older than (days): + + + + + + Forward older than (days): + + + + + + Forward to: + + + + + + Forward mail to address: + + + + + + Full Name: + + + + + + Message: + + + + + + Responder type: + + + + + + Respond period in days: + + + + + + Respond with reply from: + + + + + + Subject: + + + + + + Respond days must be between 0 and 63 days + + + + + + + + + Autoresponder + + + Mail Forwarding + + + Respond from: + + + Respond To: + + + 0 means unlimited + + + Handle older mails + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditDomain.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditDomain.ascx.resx new file mode 100644 index 00000000..3182ec47 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditDomain.ascx.resx @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Catch-All Account: + + + + + + Send out messages limit (#/Day): + + + + + + Send out data limit per day, MB: + + + + + + Domain Disk Space, MB: + + + + + + Max users: + + + + + + Postmaster Account: + + + + + + <Not Selected> + + + + + + None, reject mail for unknown users + + + + + + 0 means unlimited + + + Default user max message size, MB: + + + Default user send out data limit per day, MB: + + + Default user send out messages limit (#/Day): + + + Default user quota, MB: + + + Limits + + + Value must be zero or greater + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditGroup.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditGroup.ascx.resx new file mode 100644 index 00000000..e1dc6f01 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditGroup.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Group e-mails: + + + + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditList.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditList.ascx.resx new file mode 100644 index 00000000..3f411abc --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_EditList.ascx.resx @@ -0,0 +1,478 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + List Additional Options + + + Allow command in subject + + + + + + DigestMailingList + + + + + + Enable Lists command + + + + + + Enable Review command + + + + + + Enable join (subscribe) command + + + + + + Enable leave (unsubscribe) command + + + + + + Enable Vacation/No vacation command + + + + + + Enable Which command + + + + + + Moderated listserver + + + + + + Enabled + + + Reply To List + + + Notify owner of join + + + + + + Send to sender + + + + + + Notify owner of leave + + + + + + Set recipient to To header + + + + + + Enabled + + + Suppress command responses + + + + + + No confirmation + + + Owner confirmed + + + User confirmed + + + Moderator should be within mail domain where Mail List is located + + + + + + + + + Anyone + + + Members Only + + + + + + List + + + Moderator + + + Sender + + + Digest and receive + + + Digest, receive and post + + + Post only + + + Receive only + + + Receive and post + + + No change + + + Set to sender + + + Set to value + + + Enable Unsubscribe from Subject: + + + Enable Digest Mode: + + + Enable LIST Command: + + + Enable SUBSCRIBE Command: + + + Command password: + + + + + + Subscription: + + + + + + Default Rights: + + + + + + List Description: + + + + + + From Header: + + + + + + From Header Value: + + + + + + List From Address: + + + List Options: + + + List Reply To Address: + + + List To Address: + + + Max members count: + + + + + + Max Message Size, kB: + + + + + + Max # of messages to send out in 1 minute: + + + + + + Max Recipients per Message: + + + Mailing List Members: + + + Members Source: + + + + + + Moderation is Enabled: + + + List Moderator: + + + + + + Originator: + + + + + + Password Protection: + + + + + + Posting mode: + + + + + + Posting password: + + + + + + Subscribers Reply To: + + + Reply-To Header: + + + + + + Reply-To Header Value: + + + + + + Subject Prefix: + + + + + + Send Subscribe Email: + + + Send Unsubscribe Email: + + + Blank + + + Owner + + + Sender + + + Client Moderated + + + Not password protected + + + Server Moderated + + + <Choose a moderator> + + + All Domain Admins + + + All Domain Users + + + From members list on this page + + + 0 means unlimited + + + Message + + + Options + + + Security + + + Value must be zero or greater + . + + + Value must be zero or greater + + + Value must be zero or greater + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_Settings.ascx.resx new file mode 100644 index 00000000..9b5d5338 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IceWarp_Settings.ascx.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Domain Template Name: + + + + + + Public IP Address: + + + + + + + + + + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx new file mode 100644 index 00000000..4d4122d3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx @@ -0,0 +1,208 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="IceWarp_EditAccount.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.IceWarp_EditAccount" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> +<%@ Register TagPrefix="wsp" TagName="Calendar" Src="../UserControls/CalendarControl.ascx" %> + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + +
+ + + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + +
+ +
+ + +
+ + +
+ + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + + + +
+ + + +
+ +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+ + +
+ + + +
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.cs new file mode 100644 index 00000000..f047b103 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.cs @@ -0,0 +1,141 @@ +// Copyright (c) 2014, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class IceWarp_EditAccount : WebsitePanelControlBase, IMailEditAccountControl + { + protected void Page_Load(object sender, EventArgs e) + { + // Hide some form items when creating a new account + passwordRow.Visible = (PanelRequest.ItemID > 0); + secAutoresponder.Visible = (PanelRequest.ItemID > 0); + secForwarding.Visible = (PanelRequest.ItemID > 0); + secOlderMails.Visible = (PanelRequest.ItemID > 0); + } + + public void BindItem(MailAccount item) + { + txtFullName.Text = item.FullName; + Utils.SelectListItem(ddlAccountType, item.IceWarpAccountType); + Utils.SelectListItem(ddlAccountState, item.IceWarpAccountState); + Utils.SelectListItem(ddlRespondType, item.IceWarpRespondType); + chkRespondOnlyBetweenDates.Checked = item.RespondOnlyBetweenDates; + + // Set respond dates to something useful if they are null in IceWarp + if (item.RespondFrom == DateTime.MinValue) + { + item.RespondFrom = DateTime.Today; + } + if (item.RespondTo == DateTime.MinValue) + { + item.RespondTo = DateTime.Today.AddDays(21); + } + calRespondFrom.SelectedDate = item.RespondFrom; + calRespondTo.SelectedDate = item.RespondTo; + + chkRespondOnlyBetweenDates_CheckedChanged(this, null); + + txtRespondPeriodInDays.Text = item.RespondPeriodInDays.ToString(); + txtRespondWithReplyFrom.Text = item.RespondWithReplyFrom; + txtSubject.Text = item.ResponderSubject; + txtMessage.Text = item.ResponderMessage; + txtForward.Text = item.ForwardingAddresses != null ? String.Join("; ", item.ForwardingAddresses) : ""; + cbDeleteOnForward.Checked = item.DeleteOnForward; + cbDomainAdmin.Visible = item.IsDomainAdminEnabled; + cbDomainAdmin.Checked = item.IsDomainAdmin; + + ddlRespondType_SelectedIndexChanged(this, null); + + cbForwardOlder.Checked = item.ForwardOlder; + txtForwardOlderDays.Text = item.ForwardOlderDays.ToString(); + txtForwardOlderTo.Text = item.ForwardOlderTo; + cbForwardOlder_CheckedChanged(this, null); + + cbDeleteOlder.Checked = item.DeleteOlder; + txtDeleteOlderDays.Text = item.DeleteOlderDays.ToString(); + cbDeleteOlder_CheckedChanged(this, null); + } + + public void SaveItem(MailAccount item) + { + item.FullName = txtFullName.Text; + item.IceWarpAccountType = Convert.ToInt32(ddlAccountType.SelectedValue); + item.IceWarpAccountState = Convert.ToInt32(ddlAccountState.SelectedValue); + item.IceWarpRespondType = Convert.ToInt32(ddlRespondType.SelectedValue); + if (!string.IsNullOrWhiteSpace(txtRespondPeriodInDays.Text)) + { + item.RespondPeriodInDays = Convert.ToInt32(txtRespondPeriodInDays.Text); + } + item.RespondOnlyBetweenDates = chkRespondOnlyBetweenDates.Checked; + item.RespondFrom = calRespondFrom.SelectedDate; + item.RespondTo = calRespondTo.SelectedDate; + item.RespondWithReplyFrom = txtRespondWithReplyFrom.Text; + item.ResponderSubject = txtSubject.Text; + item.ResponderMessage = txtMessage.Text; + item.ForwardingEnabled = !string.IsNullOrWhiteSpace(txtForward.Text); + item.ForwardingAddresses = Utils.ParseDelimitedString(txtForward.Text, ';', ' ', ','); + item.DeleteOnForward = cbDeleteOnForward.Checked; + item.ChangePassword = cbChangePassword.Checked; + item.ChangePassword = cbChangePassword.Checked; + item.IsDomainAdmin = cbDomainAdmin.Checked; + + item.DeleteOlder = cbDeleteOlder.Checked; + item.DeleteOlderDays = Convert.ToInt32(txtDeleteOlderDays.Text); + + item.ForwardOlder = cbForwardOlder.Checked; + item.ForwardOlderDays = Convert.ToInt32(txtForwardOlderDays.Text); + item.ForwardOlderTo = txtForwardOlderTo.Text; + } + + protected void ddlRespondType_SelectedIndexChanged(object sender, EventArgs e) + { + RespondPeriod.Visible = ddlRespondType.SelectedValue == "3"; + RespondEnabled.Visible = Convert.ToInt32(ddlRespondType.SelectedValue) > 0; + } + + protected void cbForwardOlder_CheckedChanged(object sender, EventArgs e) + { + ForwardOlderEnabled.Visible = cbForwardOlder.Checked; + } + + protected void cbDeleteOlder_CheckedChanged(object sender, EventArgs e) + { + DeleteOlderEnabled.Visible = cbDeleteOlder.Checked; + } + + protected void chkRespondOnlyBetweenDates_CheckedChanged(object sender, EventArgs e) + { + RespondFrom.Visible = chkRespondOnlyBetweenDates.Checked; + RespondTo.Visible = chkRespondOnlyBetweenDates.Checked; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.designer.cs new file mode 100644 index 00000000..8478febf --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.designer.cs @@ -0,0 +1,474 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class IceWarp_EditAccount { + + /// + /// passwordRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow passwordRow; + + /// + /// cbChangePassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbChangePassword; + + /// + /// cbDomainAdmin control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDomainAdmin; + + /// + /// lblAccountType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblAccountType; + + /// + /// ddlAccountType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlAccountType; + + /// + /// lblAccountState control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblAccountState; + + /// + /// ddlAccountState control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlAccountState; + + /// + /// lblFullName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblFullName; + + /// + /// txtFullName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtFullName; + + /// + /// secAutoresponder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secAutoresponder; + + /// + /// AutoresponderPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel AutoresponderPanel; + + /// + /// AutoresponderUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel AutoresponderUpdatePanel; + + /// + /// lblResponderEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblResponderEnabled; + + /// + /// ddlRespondType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlRespondType; + + /// + /// RespondPeriod control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl RespondPeriod; + + /// + /// lblRespondPeriodInDays control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblRespondPeriodInDays; + + /// + /// txtRespondPeriodInDays control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtRespondPeriodInDays; + + /// + /// RespondPeriodInDaysValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator RespondPeriodInDaysValidator; + + /// + /// RespondEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl RespondEnabled; + + /// + /// chkRespondOnlyBetweenDates control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkRespondOnlyBetweenDates; + + /// + /// RespondFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow RespondFrom; + + /// + /// lblRespondFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblRespondFrom; + + /// + /// calRespondFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CalendarControl calRespondFrom; + + /// + /// RespondTo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow RespondTo; + + /// + /// lblRespondTo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblRespondTo; + + /// + /// calRespondTo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CalendarControl calRespondTo; + + /// + /// lblSubject control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSubject; + + /// + /// txtSubject control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSubject; + + /// + /// lblRespondWithReplyFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblRespondWithReplyFrom; + + /// + /// txtRespondWithReplyFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtRespondWithReplyFrom; + + /// + /// lblMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMessage; + + /// + /// txtMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMessage; + + /// + /// secForwarding control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secForwarding; + + /// + /// ForwardingPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel ForwardingPanel; + + /// + /// lblForwardTo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblForwardTo; + + /// + /// txtForward control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtForward; + + /// + /// cbDeleteOnForward control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDeleteOnForward; + + /// + /// secOlderMails control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secOlderMails; + + /// + /// OlderMailsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel OlderMailsPanel; + + /// + /// DeleteOlderUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel DeleteOlderUpdatePanel; + + /// + /// cbDeleteOlder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDeleteOlder; + + /// + /// DeleteOlderEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl DeleteOlderEnabled; + + /// + /// lblDeleteOlderDays control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDeleteOlderDays; + + /// + /// txtDeleteOlderDays control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDeleteOlderDays; + + /// + /// ForwardOlderUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel ForwardOlderUpdatePanel; + + /// + /// cbForwardOlder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbForwardOlder; + + /// + /// ForwardOlderEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl ForwardOlderEnabled; + + /// + /// lblForwardOlderDays control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblForwardOlderDays; + + /// + /// txtForwardOlderDays control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtForwardOlderDays; + + /// + /// lblForwardOlderTo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblForwardOlderTo; + + /// + /// txtForwardOlderTo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtForwardOlderTo; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx new file mode 100644 index 00000000..819a0b43 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx @@ -0,0 +1,133 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="IceWarp_EditDomain.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.IceWarp_EditDomain" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> + + + + + + + + + + +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + +
+ + + + + +
+
+ +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.cs new file mode 100644 index 00000000..c4e36d44 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.cs @@ -0,0 +1,121 @@ +// Copyright (c) 2014, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class IceWarp_EditDomain : WebsitePanelControlBase, IMailEditDomainControl + { + private StringDictionary _serviceSettings; + + private StringDictionary ServiceSettings + { + get + { + if (_serviceSettings != null) + return _serviceSettings; + + _serviceSettings = new StringDictionary(); + var domain = ES.Services.MailServers.GetMailDomain(PanelRequest.ItemID); + + var settings = ES.Services.Servers.GetServiceSettings(domain.ServiceId); + + foreach (var settingPair in settings.Select(setting => setting.Split('='))) + { + _serviceSettings.Add(settingPair[0], settingPair[1]); + } + + return _serviceSettings; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + AdvancedSettingsPanel.Visible = PanelSecurity.EffectiveUser.Role == UserRole.Administrator; + MaxDomainDiskSpaceValidator.MaximumValue = int.MaxValue.ToString(); + MaxDomainUsersValidator.MaximumValue = int.MaxValue.ToString(); + txtLimitNumberValidator.MaximumValue = int.MaxValue.ToString(); + txtLimitVolumeValidator.MaximumValue = int.MaxValue.ToString(); + txtDefaultUserMaxMessageSizeMegaByteValidator.MaximumValue = int.MaxValue.ToString(); + txtDefaultUserMegaByteSendLimitValidator.MaximumValue = int.MaxValue.ToString(); + txtDefaultUserQuotaInMBValidator.MaximumValue = int.MaxValue.ToString(); + txtDefaultUserNumberSendLimitValidator.MaximumValue = int.MaxValue.ToString(); + } + + public void BindItem(MailDomain item) + { + // Hide/show controls when not enabled on service level + rowMaxDomainDiskSpace.Visible = ServiceSettings.ContainsKey("UseDomainDiskQuota") && Convert.ToBoolean(ServiceSettings["UseDomainDiskQuota"]); + rowDomainLimits.Visible = ServiceSettings.ContainsKey("UseDomainLimits") && Convert.ToBoolean(ServiceSettings["UseDomainLimits"]); + rowUserLimits.Visible = ServiceSettings.ContainsKey("UseUserLimits") && Convert.ToBoolean(ServiceSettings["UseUserLimits"]); + + txtMaxDomainDiskSpace.Text = item.MaxDomainSizeInMB.ToString(); + txtMaxDomainUsers.Text = item.MaxDomainUsers.ToString(); + txtLimitVolume.Text = item.MegaByteSendLimit.ToString(); + txtLimitNumber.Text = item.NumberSendLimit.ToString(); + txtDefaultUserQuotaInMB.Text = item.DefaultUserQuotaInMB.ToString(); + txtDefaultUserMaxMessageSizeMegaByte.Text = item.DefaultUserMaxMessageSizeMegaByte.ToString(); + txtDefaultUserMegaByteSendLimit.Text = item.DefaultUserMegaByteSendLimit.ToString(); + txtDefaultUserNumberSendLimit.Text = item.DefaultUserNumberSendLimit.ToString(); + + if (!IsPostBack) + { + var accounts = ES.Services.MailServers.GetMailAccounts(item.PackageId, false); + ddlCatchAllAccount.DataSource = accounts; + ddlCatchAllAccount.DataBind(); + ddlPostMasterAccount.DataSource = accounts; + ddlPostMasterAccount.DataBind(); + } + + Utils.SelectListItem(ddlCatchAllAccount, item.CatchAllAccount); + Utils.SelectListItem(ddlPostMasterAccount, item.PostmasterAccount); + + } + + public void SaveItem(MailDomain item) + { + item.CatchAllAccount = ddlCatchAllAccount.SelectedValue; + item.PostmasterAccount = ddlPostMasterAccount.SelectedValue; + item.MaxDomainSizeInMB = Convert.ToInt32(txtMaxDomainDiskSpace.Text); + item.MaxDomainUsers = Convert.ToInt32(txtMaxDomainUsers.Text); + item.NumberSendLimit = Convert.ToInt32(txtLimitNumber.Text); + item.MegaByteSendLimit = Convert.ToInt32(txtLimitVolume.Text); + item.DefaultUserQuotaInMB = Convert.ToInt32(txtDefaultUserQuotaInMB.Text); + item.DefaultUserMaxMessageSizeMegaByte = Convert.ToInt32(txtDefaultUserMaxMessageSizeMegaByte.Text); + item.DefaultUserMegaByteSendLimit = Convert.ToInt32(txtDefaultUserMegaByteSendLimit.Text); + item.DefaultUserNumberSendLimit = Convert.ToInt32(txtDefaultUserNumberSendLimit.Text); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.designer.cs new file mode 100644 index 00000000..a01d59d7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditDomain.ascx.designer.cs @@ -0,0 +1,393 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class IceWarp_EditDomain { + + /// + /// lblPostMaster control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPostMaster; + + /// + /// ddlPostMasterAccount control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPostMasterAccount; + + /// + /// lblCatchAll control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblCatchAll; + + /// + /// ddlCatchAllAccount control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlCatchAllAccount; + + /// + /// AdvancedSettingsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel AdvancedSettingsPanel; + + /// + /// secLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secLimits; + + /// + /// LimitsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel LimitsPanel; + + /// + /// rowMaxDomainDiskSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowMaxDomainDiskSpace; + + /// + /// lblMaxDomainDiskSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxDomainDiskSpace; + + /// + /// txtMaxDomainDiskSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMaxDomainDiskSpace; + + /// + /// MaxDomainDiskSpaceValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator MaxDomainDiskSpaceValidator; + + /// + /// MaxDomainDiskSpaceRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator MaxDomainDiskSpaceRequiredValidator; + + /// + /// lblMaxDomainUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxDomainUsers; + + /// + /// txtMaxDomainUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMaxDomainUsers; + + /// + /// MaxDomainUsersValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator MaxDomainUsersValidator; + + /// + /// MaxDomainUsersRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator MaxDomainUsersRequiredValidator; + + /// + /// rowDomainLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl rowDomainLimits; + + /// + /// lblLimitVolume control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblLimitVolume; + + /// + /// txtLimitVolume control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtLimitVolume; + + /// + /// txtLimitVolumeValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator txtLimitVolumeValidator; + + /// + /// txtLimitVolumeRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtLimitVolumeRequiredValidator; + + /// + /// lblLimitNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblLimitNumber; + + /// + /// txtLimitNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtLimitNumber; + + /// + /// txtLimitNumberValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator txtLimitNumberValidator; + + /// + /// txtLimitNumberRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtLimitNumberRequiredValidator; + + /// + /// rowUserLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl rowUserLimits; + + /// + /// lblDefaultUserQuotaInMB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDefaultUserQuotaInMB; + + /// + /// txtDefaultUserQuotaInMB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDefaultUserQuotaInMB; + + /// + /// txtDefaultUserQuotaInMBValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator txtDefaultUserQuotaInMBValidator; + + /// + /// txtDefaultUserQuotaInMBRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtDefaultUserQuotaInMBRequiredValidator; + + /// + /// lblDefaultUserMaxMessageSizeMegaByte control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDefaultUserMaxMessageSizeMegaByte; + + /// + /// txtDefaultUserMaxMessageSizeMegaByte control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDefaultUserMaxMessageSizeMegaByte; + + /// + /// txtDefaultUserMaxMessageSizeMegaByteValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator txtDefaultUserMaxMessageSizeMegaByteValidator; + + /// + /// txtDefaultUserMaxMessageSizeMegaByteRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtDefaultUserMaxMessageSizeMegaByteRequiredValidator; + + /// + /// lblDefaultUserMegaByteSendLimit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDefaultUserMegaByteSendLimit; + + /// + /// txtDefaultUserMegaByteSendLimit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDefaultUserMegaByteSendLimit; + + /// + /// txtDefaultUserMegaByteSendLimitValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator txtDefaultUserMegaByteSendLimitValidator; + + /// + /// txtDefaultUserMegaByteSendLimitRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtDefaultUserMegaByteSendLimitRequiredValidator; + + /// + /// lblDefaultUserNumberSendLimit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDefaultUserNumberSendLimit; + + /// + /// txtDefaultUserNumberSendLimit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDefaultUserNumberSendLimit; + + /// + /// txtDefaultUserNumberSendLimitValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator txtDefaultUserNumberSendLimitValidator; + + /// + /// txtDefaultUserNumberSendLimitRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtDefaultUserNumberSendLimitRequiredValidator; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditForwarding.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditForwarding.ascx new file mode 100644 index 00000000..af5ce729 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditForwarding.ascx @@ -0,0 +1 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="IceWarp_EditForwarding.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.IceWarp_EditForwarding" %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditForwarding.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditForwarding.ascx.cs new file mode 100644 index 00000000..4fb7c1db --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditForwarding.ascx.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2014, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class IceWarp_EditForwarding : WebsitePanelControlBase, IMailEditForwardingControl + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + public void BindItem(MailAlias item) + { + + } + + public void SaveItem(MailAlias item) + { + + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditForwarding.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditForwarding.ascx.designer.cs new file mode 100644 index 00000000..d27ff92d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditForwarding.ascx.designer.cs @@ -0,0 +1,15 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class IceWarp_EditForwarding { + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditGroup.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditGroup.ascx new file mode 100644 index 00000000..7afa035e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditGroup.ascx @@ -0,0 +1,12 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="IceWarp_EditGroup.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.IceWarp_EditGroup" %> +<%@ Register TagPrefix="dnc" TagName="EditItemsList" Src="../MailEditItems.ascx" %> + + + + + +
+ + + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditGroup.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditGroup.ascx.cs new file mode 100644 index 00000000..f9df0a44 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditGroup.ascx.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2014, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class IceWarp_EditGroup : WebsitePanelControlBase, IMailEditGroupControl + { + protected void Page_Load(object sender, EventArgs e) + { + } + + public void BindItem(MailGroup item) + { + mailEditItems.Items = item.Members; + } + + public void SaveItem(MailGroup item) + { + item.Members = mailEditItems.Items; + } + } + +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditGroup.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditGroup.ascx.designer.cs new file mode 100644 index 00000000..1c962862 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditGroup.ascx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class IceWarp_EditGroup { + + /// + /// lblGroupMembers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblGroupMembers; + + /// + /// mailEditItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.MailEditItems mailEditItems; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditList.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditList.ascx new file mode 100644 index 00000000..e210565a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditList.ascx @@ -0,0 +1,319 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="IceWarp_EditList.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.IceWarp_EditList" %> +<%@ Register TagPrefix="dnc" TagName="EditItemsList" Src="../MailEditItems.ascx" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> + + + + + + + + + + + +
+ + + +
+ + + + +
+ + + + + + + + + + + +
+ + + + + + + +
+ + + +
+
+
+
+ + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + +
+ + + + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + +
+ +
+ + + +
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Anyone + MembersOnly + +
+ + + + + + + +
+ + + +
+ +
+ + + +
+ + + + + + + + + +
+ + + + + + +
+ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditList.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditList.ascx.cs new file mode 100644 index 00000000..857eebbd --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditList.ascx.cs @@ -0,0 +1,162 @@ +// Copyright (c) 2014, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using WebsitePanel.Providers.Mail; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class IceWarp_EditList : WebsitePanelControlBase, IMailEditListControl + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + var moderators = ES.Services.MailServers.GetMailAccounts(PanelSecurity.PackageId, true); + ddlListModerators.DataSource = moderators; + ddlListModerators.DataBind(); + } + + txtMaxMembersValidator.MaximumValue = int.MaxValue.ToString(); + txtMaxMessageSizeValidator.MaximumValue = int.MaxValue.ToString(); + txtMaxMessagesPerMinuteValidator.MaximumValue = int.MaxValue.ToString(); + } + + public void BindItem(MailList item) + { + txtDescription.Text = item.Description; + if (!String.IsNullOrEmpty(item.ModeratorAddress)) + { + ddlListModerators.SelectedValue = item.ModeratorAddress; + } + ddlMembersSource.SelectedValue = item.MembersSource.ToString(); + mailEditItems.Items = item.Members; + ddlFromHeaderAction.SelectedValue = item.FromHeader.ToString(); + ddlReplyToHeaderAction.SelectedValue = item.ReplyToHeader.ToString(); + txtFromHeaderValue.Text = item.ListFromAddress; + txtReplyToHeaderValue.Text = item.ListReplyToAddress; + txtSubjectPrefix.Text = item.SubjectPrefix; + ddllblOriginator.SelectedValue = item.Originator.ToString(); + ddlPostingMode.SelectedValue = item.PostingMode.ToString(); + ddlPasswordProtection.SelectedValue = item.PasswordProtection.ToString(); + txtPassword.Text = item.Password; + ddlDefaultRights.SelectedValue = ((int) item.DefaultRights).ToString(); + txtMaxMessageSize.Text = item.MaxMessageSize.ToString(); + txtMaxMembers.Text = item.MaxMembers.ToString(); + chkSendToSender.Checked = item.SendToSender; + chkDigestMailingList.Checked = item.DigestMode; + txtMaxMessagesPerMinute.Text = item.MaxMessagesPerMinute.ToString(); + chkSendSubscribe.Checked = item.SendSubscribe; + chkSendUnSubscribe.Checked = item.SendUnsubscribe; + ddlConfirmSubscription.SelectedValue = item.ConfirmSubscription.ToString(); + chkCommandInSubject.Checked = item.CommandsInSubject; + chkEnableSubscribe.Checked = !item.DisableSubscribecommand; + chkEnableUnsubscribe.Checked = item.AllowUnsubscribe; + chkEnableLists.Checked = !item.DisableListcommand; + chkEnableWhich.Checked = !item.DisableWhichCommand; + chkEnableReview.Checked = !item.DisableReviewCommand; + chkEnableVacation.Checked = !item.DisableVacationCommand; + chkModerated.Checked = item.Moderated; + txtCommandPassword.Text = item.CommandPassword; + chkSuppressCommandResponses.Checked = item.SuppressCommandResponses; + + ddlMembersSource_SelectedIndexChanged(this, null); + ddlFromHeaderAction_SelectedIndexChanged(this, null); + ddlReplyToHeaderAction_SelectedIndexChanged(this, null); + chkModerated_CheckedChanged(this, null); + ddlPasswordProtection_SelectedIndexChanged(this, null); + } + + public void SaveItem(MailList item) + { + item.Description = txtDescription.Text; + item.ModeratorAddress = ddlListModerators.SelectedValue; + item.MembersSource = (IceWarpListMembersSource)Enum.Parse(typeof (IceWarpListMembersSource), ddlMembersSource.SelectedValue); + item.Members = mailEditItems.Items; + item.FromHeader = (IceWarpListFromAndReplyToHeader)Enum.Parse(typeof (IceWarpListFromAndReplyToHeader), ddlFromHeaderAction.SelectedValue); + item.ReplyToHeader = (IceWarpListFromAndReplyToHeader)Enum.Parse(typeof (IceWarpListFromAndReplyToHeader), ddlReplyToHeaderAction.SelectedValue); + item.ListFromAddress = txtFromHeaderValue.Text; + item.ListReplyToAddress = txtReplyToHeaderValue.Text; + item.SubjectPrefix = txtSubjectPrefix.Text; + item.Originator = (IceWarpListOriginator)Enum.Parse(typeof (IceWarpListOriginator), ddllblOriginator.SelectedValue); + item.PostingMode = (PostingMode)Enum.Parse(typeof (PostingMode), ddlPostingMode.SelectedValue); + item.PasswordProtection = (PasswordProtection)Enum.Parse(typeof (PasswordProtection), ddlPasswordProtection.SelectedValue); + item.Password = txtPassword.Text; + item.DefaultRights = (IceWarpListDefaultRights)Enum.Parse(typeof (IceWarpListDefaultRights), ddlDefaultRights.SelectedValue); + item.MaxMessageSize = Convert.ToInt32(txtMaxMessageSize.Text); + item.MaxMembers = Convert.ToInt32(txtMaxMembers.Text); + item.SendToSender = chkSendToSender.Checked; + item.DigestMode = chkDigestMailingList.Checked; + item.MaxMessagesPerMinute = Convert.ToInt32(txtMaxMessagesPerMinute.Text); + item.SendSubscribe = chkSendSubscribe.Checked; + item.SendUnsubscribe = chkSendUnSubscribe.Checked; + item.ConfirmSubscription = (IceWarpListConfirmSubscription)Enum.Parse(typeof (IceWarpListConfirmSubscription), ddlConfirmSubscription.SelectedValue); + item.CommandsInSubject = chkCommandInSubject.Checked; + item.DisableSubscribecommand = !chkEnableSubscribe.Checked; + item.AllowUnsubscribe = chkEnableUnsubscribe.Checked; + item.DisableListcommand = !chkEnableLists.Checked; + item.DisableWhichCommand = !chkEnableWhich.Checked; + item.DisableReviewCommand = !chkEnableReview.Checked; + item.DisableVacationCommand = !chkEnableVacation.Checked; + item.Moderated = chkModerated.Checked; + item.CommandPassword = txtCommandPassword.Text; + item.SuppressCommandResponses = chkSuppressCommandResponses.Checked; + } + + + protected void ddlMembersSource_SelectedIndexChanged(object sender, EventArgs e) + { + MembersRow.Visible = (IceWarpListMembersSource) Enum.Parse(typeof (IceWarpListMembersSource), ddlMembersSource.SelectedValue) == IceWarpListMembersSource.MembersInFile; + } + + protected void ddlFromHeaderAction_SelectedIndexChanged(object sender, EventArgs e) + { + var setToValueChoosen = (IceWarpListFromAndReplyToHeader) Enum.Parse(typeof (IceWarpListFromAndReplyToHeader), ddlFromHeaderAction.SelectedValue) == IceWarpListFromAndReplyToHeader.SetToValue; + rowFromHeaderValue.Visible = setToValueChoosen; + //reqValFromHeaderValue.Enabled = setToValueChoosen; + } + + protected void ddlReplyToHeaderAction_SelectedIndexChanged(object sender, EventArgs e) + { + var setToValueChoosen = (IceWarpListFromAndReplyToHeader) Enum.Parse(typeof (IceWarpListFromAndReplyToHeader), ddlReplyToHeaderAction.SelectedValue) == IceWarpListFromAndReplyToHeader.SetToValue; + rowReplyToHeaderValue.Visible = setToValueChoosen; + //reqValReplyToHeaderValue.Enabled = setToValueChoosen; + } + + protected void chkModerated_CheckedChanged(object sender, EventArgs e) + { + rowCommandPassword.Visible = chkModerated.Checked; + } + + protected void ddlPasswordProtection_SelectedIndexChanged(object sender, EventArgs e) + { + rowPostingPassword.Visible = ddlPasswordProtection.SelectedValue == "NoProtection"; + } + } +} + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditList.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditList.ascx.designer.cs new file mode 100644 index 00000000..18260bf4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditList.ascx.designer.cs @@ -0,0 +1,708 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class IceWarp_EditList { + + /// + /// MainPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel MainPanel; + + /// + /// lblDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDescription; + + /// + /// txtDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDescription; + + /// + /// lblModeratorAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblModeratorAddress; + + /// + /// ddlListModerators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlListModerators; + + /// + /// reqValModerator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator reqValModerator; + + /// + /// MembersUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel MembersUpdatePanel; + + /// + /// lblMembersSource control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMembersSource; + + /// + /// ddlMembersSource control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlMembersSource; + + /// + /// MembersRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow MembersRow; + + /// + /// lblMembers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMembers; + + /// + /// mailEditItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.MailEditItems mailEditItems; + + /// + /// Message control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel Message; + + /// + /// MessagePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel MessagePanel; + + /// + /// FromHeaderUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel FromHeaderUpdatePanel; + + /// + /// lblFromHeader control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblFromHeader; + + /// + /// ddlFromHeaderAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlFromHeaderAction; + + /// + /// rowFromHeaderValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowFromHeaderValue; + + /// + /// lblFromHeaderValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblFromHeaderValue; + + /// + /// txtFromHeaderValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtFromHeaderValue; + + /// + /// reqValFromHeaderValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator reqValFromHeaderValue; + + /// + /// ReplyToHeaderUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel ReplyToHeaderUpdatePanel; + + /// + /// lblReplyToHeader control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblReplyToHeader; + + /// + /// ddlReplyToHeaderAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlReplyToHeaderAction; + + /// + /// rowReplyToHeaderValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowReplyToHeaderValue; + + /// + /// lblReplyToHeaderValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblReplyToHeaderValue; + + /// + /// txtReplyToHeaderValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtReplyToHeaderValue; + + /// + /// reqValReplyToHeaderValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator reqValReplyToHeaderValue; + + /// + /// chkSetRecipientToToHeader control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkSetRecipientToToHeader; + + /// + /// lblSubjectPrefix control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSubjectPrefix; + + /// + /// txtSubjectPrefix control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSubjectPrefix; + + /// + /// lblOriginator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblOriginator; + + /// + /// ddllblOriginator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddllblOriginator; + + /// + /// Security control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel Security; + + /// + /// SecurityPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SecurityPanel; + + /// + /// lblPostingMode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPostingMode; + + /// + /// ddlPostingMode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPostingMode; + + /// + /// lblPasswordProtection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPasswordProtection; + + /// + /// ddlPasswordProtection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPasswordProtection; + + /// + /// rowPostingPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowPostingPassword; + + /// + /// lblPostingPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPostingPassword; + + /// + /// txtPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPassword; + + /// + /// ModeratedUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel ModeratedUpdatePanel; + + /// + /// chkModerated control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkModerated; + + /// + /// rowCommandPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowCommandPassword; + + /// + /// lblCommandPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblCommandPassword; + + /// + /// txtCommandPassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCommandPassword; + + /// + /// lblDefaultRights control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDefaultRights; + + /// + /// ddlDefaultRights control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlDefaultRights; + + /// + /// lblMaxMessageSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxMessageSize; + + /// + /// txtMaxMessageSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMaxMessageSize; + + /// + /// txtMaxMessageSizeValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator txtMaxMessageSizeValidator; + + /// + /// txtMaxMessageSizeRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtMaxMessageSizeRequiredValidator; + + /// + /// lblMaxMembers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxMembers; + + /// + /// txtMaxMembers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMaxMembers; + + /// + /// txtMaxMembersValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator txtMaxMembersValidator; + + /// + /// txtMaxMembersRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtMaxMembersRequiredValidator; + + /// + /// Options control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel Options; + + /// + /// OptionsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel OptionsPanel; + + /// + /// chkSendToSender control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkSendToSender; + + /// + /// chkDigestMailingList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkDigestMailingList; + + /// + /// lblMaxMessagesPerMinute control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxMessagesPerMinute; + + /// + /// txtMaxMessagesPerMinute control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMaxMessagesPerMinute; + + /// + /// txtMaxMessagesPerMinuteValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RangeValidator txtMaxMessagesPerMinuteValidator; + + /// + /// txtMaxMessagesPerMinuteRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator txtMaxMessagesPerMinuteRequiredValidator; + + /// + /// chkSendSubscribe control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkSendSubscribe; + + /// + /// chkSendUnSubscribe control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkSendUnSubscribe; + + /// + /// lblConfirmSubscription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblConfirmSubscription; + + /// + /// ddlConfirmSubscription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlConfirmSubscription; + + /// + /// chkCommandInSubject control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkCommandInSubject; + + /// + /// chkEnableSubscribe control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableSubscribe; + + /// + /// chkEnableUnsubscribe control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableUnsubscribe; + + /// + /// chkEnableLists control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableLists; + + /// + /// chkEnableWhich control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableWhich; + + /// + /// chkEnableReview control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableReview; + + /// + /// chkEnableVacation control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableVacation; + + /// + /// chkSuppressCommandResponses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkSuppressCommandResponses; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_Settings.ascx new file mode 100644 index 00000000..d603cc96 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_Settings.ascx @@ -0,0 +1,61 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="IceWarp_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.IceWarp_Settings" %> +<%@ Register Src="../UserControls/SelectIPAddress.ascx" TagName="SelectIPAddress" TagPrefix="uc1" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + +
+ +
+ +
+ +
+ +
+ + + + + +
+ + + + + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_Settings.ascx.cs new file mode 100644 index 00000000..9f5ca335 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_Settings.ascx.cs @@ -0,0 +1,71 @@ +// Copyright (c) 2014, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Collections.Specialized; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class IceWarp_Settings : WebsitePanelControlBase, IHostingServiceProviderSettings + { + + public void BindSettings(StringDictionary settings) + { + ipAddress.AddressId = (settings["ServerIpAddress"] != null) ? Utils.ParseInt(settings["ServerIpAddress"], 0) : 0; + cbUseDomainDiskQuota.Checked = Convert.ToBoolean(settings["UseDomainDiskQuota"]); + cbUseDomainLimits.Checked = Convert.ToBoolean(settings["UseDomainLimits"]); + cbUseUserLimits.Checked = Convert.ToBoolean(settings["UseUserLimits"]); + cbOverrideGlobal.Checked = Convert.ToBoolean(settings["OverrideGlobal"]); + txtWarnMailboxUsage.Text = settings["WarnMailboxUsage"]; + txtWarnDomainSize.Text = settings["WarnDomainSize"]; + txtMaxMessageSizeInMB.Text = settings["MaxMessageSize"]; + } + + public void SaveSettings(StringDictionary settings) + { + settings["ServerIpAddress"] = ipAddress.AddressId.ToString(); + settings["UseDomainDiskQuota"] = cbUseDomainDiskQuota.Checked.ToString(); + settings["UseDomainLimits"] = cbUseDomainLimits.Checked.ToString(); + settings["UseUserLimits"] = cbUseUserLimits.Checked.ToString(); + settings["OverrideGlobal"] = cbOverrideGlobal.Checked.ToString(); + settings["WarnMailboxUsage"] = txtWarnMailboxUsage.Text; + settings["WarnDomainSize"] = txtWarnDomainSize.Text; + settings["MaxMessageSize"] = txtMaxMessageSizeInMB.Text; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_Settings.ascx.designer.cs new file mode 100644 index 00000000..7348a746 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_Settings.ascx.designer.cs @@ -0,0 +1,141 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class IceWarp_Settings { + + /// + /// lblPublicIP control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPublicIP; + + /// + /// ipAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.SelectIPAddress ipAddress; + + /// + /// lblMaxMessageSizeInMB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxMessageSizeInMB; + + /// + /// txtMaxMessageSizeInMB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMaxMessageSizeInMB; + + /// + /// Label1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label Label1; + + /// + /// cbUseDomainDiskQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbUseDomainDiskQuota; + + /// + /// cbUseDomainLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbUseDomainLimits; + + /// + /// cbUseUserLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbUseUserLimits; + + /// + /// cbOverrideGlobal control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbOverrideGlobal; + + /// + /// lblWarnDomainSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblWarnDomainSize; + + /// + /// txtWarnDomainSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtWarnDomainSize; + + /// + /// lblWarnMailboxUsage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblWarnMailboxUsage; + + /// + /// txtWarnMailboxUsage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtWarnMailboxUsage; + + /// + /// RequiredFieldValidator1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; + } +}