From 008fc296d5b80e0cbb3010e556974935ebbc8833 Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 29 Jul 2012 12:39:55 +0400 Subject: [PATCH] Policies extended with plan templates for Exchange and Lync Automated provisioning of plans added when template plans are defined Lync plan maintenance added Ability to disable editing of lync plans within hosting plans People picker adjusted for public folders, contact, and distribution liost --- WebsitePanel/Database/install_db.sql | 56 +++ WebsitePanel/Database/update_db.sql | 68 ++++ .../Packages/Quotas.cs | 4 +- .../Users/UserSettings.cs | 3 + .../LyncProxy.cs | 106 ++++-- .../Code/Data/DataProvider.cs | 12 + .../Code/HostedSolution/LyncController.cs | 5 + .../HostedSolution/OrganizationController.cs | 61 +++ .../esLync.asmx.cs | 6 + .../WebsitePanel_SharedResources.ascx.resx | 3 + ...ttingsExchangeMailboxPlansPolicy.ascx.resx | 216 +++++++++++ .../SettingsLyncUserPlansPolicy.ascx.resx | 192 ++++++++++ .../ExchangeContactGeneralSettings.ascx | 1 + .../ExchangeCreateDistributionList.ascx | 2 +- .../ExchangePublicFolderGeneralSettings.ascx | 2 +- .../LyncUserPlans.ascx.resx | 17 +- .../Lync/LyncAddLyncUserPlan.ascx.cs | 36 +- .../Lync/LyncAddLyncUserPlan.ascx.designer.cs | 29 -- .../WebsitePanel/Lync/LyncUserPlans.ascx | 39 ++ .../WebsitePanel/Lync/LyncUserPlans.ascx.cs | 67 +++- .../Lync/LyncUserPlans.ascx.designer.cs | 110 ++++-- .../SettingsExchangeMailboxPlansPolicy.ascx | 188 +++++++++ ...SettingsExchangeMailboxPlansPolicy.ascx.cs | 242 ++++++++++++ ...xchangeMailboxPlansPolicy.ascx.designer.cs | 357 ++++++++++++++++++ .../SettingsLyncUserPlansPolicy.ascx | 137 +++++++ .../SettingsLyncUserPlansPolicy.ascx.cs | 262 +++++++++++++ ...ttingsLyncUserPlansPolicy.ascx.designer.cs | 204 ++++++++++ .../UserAccountPolicySettings.ascx | 10 + ...UserAccountPolicySettings.ascx.designer.cs | 18 + .../WebsitePanel.Portal.Modules.csproj | 22 +- 30 files changed, 2357 insertions(+), 118 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeMailboxPlansPolicy.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsLyncUserPlansPolicy.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs diff --git a/WebsitePanel/Database/install_db.sql b/WebsitePanel/Database/install_db.sql index 3f2cb24a..a60cc0d3 100644 --- a/WebsitePanel/Database/install_db.sql +++ b/WebsitePanel/Database/install_db.sql @@ -3939,6 +3939,8 @@ INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDe GO INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (379, 41, 10, N'Lync.EVInternational', N'Allow International Calls', 1, 0, NULL) GO +INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (380, 41, 11, N'Lync.EnablePlansEditing', N'Enable Plans Editing', 1, 0, NULL) +GO INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (400, 20, 3, N'HostedSharePoint.UseSharedSSL', N'Use shared SSL Root', 1, 0, NULL) GO @@ -44774,6 +44776,15 @@ IF ((SELECT Count(*) FROM ExchangeMailboxPlans WHERE ItemId = @ItemID) = 0) BEGIN SET @IsDefault = 1 END +ELSE +BEGIN + IF @IsDefault = 1 + BEGIN + UPDATE ExchangeMailboxPlans SET IsDefault = 0 WHERE ItemID = @ItemID + END +END + + INSERT INTO ExchangeMailboxPlans ( @@ -45047,6 +45058,14 @@ IF ((SELECT Count(*) FROM LyncUserPlans WHERE ItemId = @ItemID) = 0) BEGIN SET @IsDefault = 1 END +ELSE +BEGIN + IF @IsDefault = 1 + BEGIN + UPDATE LyncUserPlans SET IsDefault = 0 WHERE ItemID = @ItemID + END +END + INSERT INTO LyncUserPlans @@ -45089,6 +45108,43 @@ GO +CREATE PROCEDURE [dbo].[GetLyncUsersByPlanId] +( + @ItemID int, + @PlanId int +) +AS + + SELECT + ea.AccountID, + ea.ItemID, + ea.AccountName, + ea.DisplayName, + ea.PrimaryEmailAddress, + ea.SamAccountName, + ou.LyncUserPlanId, + lp.LyncUserPlanName + FROM + ExchangeAccounts ea + INNER JOIN + LyncUsers ou + INNER JOIN + LyncUserPlans lp + ON + ou.LyncUserPlanId = lp.LyncUserPlanId + ON + ea.AccountID = ou.AccountID + WHERE + ea.ItemID = @ItemID AND + ou.LyncUserPlanId = @PlanId +GO + + + + + + + CREATE PROCEDURE [dbo].[CheckLyncUserExists] @AccountID int diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 1e76c264..f838087e 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -249,6 +249,14 @@ GO +IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'Lync.EnablePlansEditing') +BEGIN +INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (380, 41, 11, N'Lync.EnablePlansEditing', N'Enable Plans Editing', 1, 0, NULL) +END +GO + + + IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'Hosted Microsoft Exchange Server 2010 SP2') BEGIN INSERT [dbo].[Providers] ([ProviderId], [GroupId], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES(90, 12, N'Exchange2010SP2', N'Hosted Microsoft Exchange Server 2010 SP2', N'WebsitePanel.Providers.HostedSolution.Exchange2010SP2, WebsitePanel.Providers.HostedSolution', N'Exchange', 1) @@ -1935,6 +1943,14 @@ IF ((SELECT Count(*) FROM ExchangeMailboxPlans WHERE ItemId = @ItemID) = 0) BEGIN SET @IsDefault = 1 END +ELSE +BEGIN + IF @IsDefault = 1 + BEGIN + UPDATE ExchangeMailboxPlans SET IsDefault = 0 WHERE ItemID = @ItemID + END +END + INSERT INTO ExchangeMailboxPlans ( @@ -3171,6 +3187,42 @@ GO +IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'GetLyncUsersByPlanId') +BEGIN +EXEC sp_executesql N'CREATE PROCEDURE [dbo].[GetLyncUsersByPlanId] +( + @ItemID int, + @PlanId int +) +AS + + SELECT + ea.AccountID, + ea.ItemID, + ea.AccountName, + ea.DisplayName, + ea.PrimaryEmailAddress, + ea.SamAccountName, + ou.LyncUserPlanId, + lp.LyncUserPlanName + FROM + ExchangeAccounts ea + INNER JOIN + LyncUsers ou + INNER JOIN + LyncUserPlans lp + ON + ou.LyncUserPlanId = lp.LyncUserPlanId + ON + ea.AccountID = ou.AccountID + WHERE + ea.ItemID = @ItemID AND + ou.LyncUserPlanId = @PlanId' +END +GO + + + @@ -3198,6 +3250,14 @@ IF ((SELECT Count(*) FROM LyncUserPlans WHERE ItemId = @ItemID) = 0) BEGIN SET @IsDefault = 1 END +ELSE +BEGIN + IF @IsDefault = 1 + BEGIN + UPDATE LyncUserPlans SET IsDefault = 0 WHERE ItemID = @ItemID + END +END + INSERT INTO LyncUserPlans ( @@ -3254,6 +3314,14 @@ IF ((SELECT Count(*) FROM LyncUserPlans WHERE ItemId = @ItemID) = 0) BEGIN SET @IsDefault = 1 END +ELSE +BEGIN + IF @IsDefault = 1 + BEGIN + UPDATE LyncUserPlans SET IsDefault = 0 WHERE ItemID = @ItemID + END +END + INSERT INTO LyncUserPlans diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs index 3de5709c..2922d7c7 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs @@ -220,7 +220,7 @@ order by rg.groupOrder public const string LYNC_EVNATIONAL = "Lync.EVNational"; public const string LYNC_EVMOBILE = "Lync.EVMobile"; public const string LYNC_EVINTERNATIONAL = "Lync.EVInternational"; - - + public const string LYNC_ENABLEDPLANSEDITING = "Lync.EnablePlansEditing"; + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs index faacf9de..3c0c122b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs @@ -57,6 +57,9 @@ namespace WebsitePanel.EnterpriseServer public const string DISPLAY_PREFS = "DisplayPreferences"; public const string GRID_ITEMS = "GridItems"; + public const string DEFAULT_MAILBOXPLANS = "DefaultMailboxPlans"; + public const string DEFAULT_LYNCUSERPLANS = "DefaultLyncUserPlans"; + public int UserId; public string SettingsName; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/LyncProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/LyncProxy.cs index 596969e2..535c7a33 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/LyncProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/LyncProxy.cs @@ -1,32 +1,3 @@ -// Copyright (c) 2012, 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. - - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -51,7 +22,7 @@ namespace WebsitePanel.EnterpriseServer { using WebsitePanel.Providers.Common; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.ResultObjects; - + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] @@ -66,6 +37,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback GetLyncUsersPagedOperationCompleted; + private System.Threading.SendOrPostCallback GetLyncUsersByPlanIdOperationCompleted; + private System.Threading.SendOrPostCallback GetLyncUserCountOperationCompleted; private System.Threading.SendOrPostCallback GetLyncUserPlansOperationCompleted; @@ -102,6 +75,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event GetLyncUsersPagedCompletedEventHandler GetLyncUsersPagedCompleted; + /// + public event GetLyncUsersByPlanIdCompletedEventHandler GetLyncUsersByPlanIdCompleted; + /// public event GetLyncUserCountCompletedEventHandler GetLyncUserCountCompleted; @@ -279,6 +255,50 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetLyncUsersByPlanId", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public LyncUser[] GetLyncUsersByPlanId(int itemId, int planId) { + object[] results = this.Invoke("GetLyncUsersByPlanId", new object[] { + itemId, + planId}); + return ((LyncUser[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetLyncUsersByPlanId(int itemId, int planId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetLyncUsersByPlanId", new object[] { + itemId, + planId}, callback, asyncState); + } + + /// + public LyncUser[] EndGetLyncUsersByPlanId(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((LyncUser[])(results[0])); + } + + /// + public void GetLyncUsersByPlanIdAsync(int itemId, int planId) { + this.GetLyncUsersByPlanIdAsync(itemId, planId, null); + } + + /// + public void GetLyncUsersByPlanIdAsync(int itemId, int planId, object userState) { + if ((this.GetLyncUsersByPlanIdOperationCompleted == null)) { + this.GetLyncUsersByPlanIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetLyncUsersByPlanIdOperationCompleted); + } + this.InvokeAsync("GetLyncUsersByPlanId", new object[] { + itemId, + planId}, this.GetLyncUsersByPlanIdOperationCompleted, userState); + } + + private void OnGetLyncUsersByPlanIdOperationCompleted(object arg) { + if ((this.GetLyncUsersByPlanIdCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetLyncUsersByPlanIdCompleted(this, new GetLyncUsersByPlanIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetLyncUserCount", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public IntResult GetLyncUserCount(int itemId) { @@ -844,6 +864,32 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + public delegate void GetLyncUsersByPlanIdCompletedEventHandler(object sender, GetLyncUsersByPlanIdCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetLyncUsersByPlanIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetLyncUsersByPlanIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public LyncUser[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((LyncUser[])(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void GetLyncUserCountCompletedEventHandler(object sender, GetLyncUserCountCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs index b5cf0d89..ab9c9fd6 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs @@ -3192,6 +3192,18 @@ namespace WebsitePanel.EnterpriseServer "GetLyncUsers", sqlParams); } + + public static IDataReader GetLyncUsersByPlanId(int itemId, int planId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetLyncUsersByPlanId", + new SqlParameter("@ItemID", itemId), + new SqlParameter("@PlanId", planId) + ); + } + public static int GetLyncUsersCount(int itemId) { SqlParameter[] sqlParams = new SqlParameter[] diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs index a91d80f8..7bc57248 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs @@ -450,6 +450,11 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution return res; } + public static List GetLyncUsersByPlanId(int itemId, int planId) + { + return ObjectUtils.CreateListFromDataReader(DataProvider.GetLyncUsersByPlanId(itemId, planId)); + } + public static IntResult GetLyncUsersCount(int itemId) { IntResult res = TaskManager.StartResultTask("LYNC", "GET_LYNC_USERS_COUNT"); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs index b3856eba..4d1901d3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs @@ -40,6 +40,11 @@ using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.SharePoint; using WebsitePanel.Providers.Common; + +using System.IO; +using System.Xml; +using System.Xml.Serialization; + namespace WebsitePanel.EnterpriseServer { public class OrganizationController @@ -352,6 +357,62 @@ namespace WebsitePanel.EnterpriseServer PackageController.AddPackageItem(orgDomain); + + if (cntx.Quotas[Quotas.EXCHANGE2007_MAILBOXES] != null) + { + // 5) Create default mailbox plans + // load user info + UserInfo user = PackageController.GetPackageOwner(org.PackageId); + + // get settings + UserSettings userSettings = UserController.GetUserSettings(user.UserId, "ExchangeMailboxPlansPolicy"); + + if (!string.IsNullOrEmpty(userSettings[UserSettings.DEFAULT_MAILBOXPLANS])) + { + + List list = new List(); + + XmlSerializer serializer = new XmlSerializer(list.GetType()); + + StringReader reader = new StringReader(userSettings[UserSettings.DEFAULT_MAILBOXPLANS]); + + list = (List)serializer.Deserialize(reader); + + foreach (ExchangeMailboxPlan p in list) + { + ExchangeServerController.AddExchangeMailboxPlan(itemId, p); + } + } + } + + if (cntx.Quotas[Quotas.LYNC_USERS] != null) + { + // 5) Create default mailbox plans + // load user info + UserInfo user = PackageController.GetPackageOwner(org.PackageId); + + // get settings + UserSettings userSettings = UserController.GetUserSettings(user.UserId, "LyncUserPlansPolicy"); + + if (!string.IsNullOrEmpty(userSettings[UserSettings.DEFAULT_LYNCUSERPLANS])) + { + + List list = new List(); + + XmlSerializer serializer = new XmlSerializer(list.GetType()); + + StringReader reader = new StringReader(userSettings[UserSettings.DEFAULT_LYNCUSERPLANS]); + + list = (List)serializer.Deserialize(reader); + + foreach (LyncUserPlan p in list) + { + LyncController.AddLyncUserPlan(itemId, p); + } + } + } + + } catch (Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esLync.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esLync.asmx.cs index 56ba913b..bf9df2da 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esLync.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esLync.asmx.cs @@ -62,6 +62,12 @@ namespace WebsitePanel.EnterpriseServer return LyncController.GetLyncUsers(itemId, sortColumn, sortDirection, startRow, maximumRows); } + [WebMethod] + public List GetLyncUsersByPlanId(int itemId, int planId) + { + return LyncController.GetLyncUsersByPlanId(itemId, planId); + } + [WebMethod] public IntResult GetLyncUserCount(int itemId) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index f1e54acc..ee430246 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5161,4 +5161,7 @@ Specify a plan + + Enable Lync User Plans Editing + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeMailboxPlansPolicy.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeMailboxPlansPolicy.ascx.resx new file mode 100644 index 00000000..055532df --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsExchangeMailboxPlansPolicy.ascx.resx @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Add New Mailbox plan + + + Set Default Mailbox plan + + + ActiveSync + + + Hide from Addressbook + + + IMAP + + + MAPI + + + OWA/HTTP + + + POP3 + + + Mailbox plan + + + Default Mailbox plan + + + Select + + + No mailbox plans have been added yet. To add a new mailbox plan click "Add New Mailbox plan" button. + + + Select + + + days + + + Issue warning at: + + + KB + + + Keep deleted items for: + + + Mailbox size: + + + Maximum Receive Message Size: + + + Maximum Recipients: + + + Maximum Send Message Size: + + + Prohibit send at: + + + Prohibit send and receive at: + + + Add Mailbox plan + + + When the mailbox size exceeds the indicated amount: + + + Delete Item Retention + + + Mailbox Features + + + General + + + Mailbox plan + + + Quotas + + + Please enter correct mailboxplan + + + * + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsLyncUserPlansPolicy.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsLyncUserPlansPolicy.ascx.resx new file mode 100644 index 00000000..12ae3b42 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsLyncUserPlansPolicy.ascx.resx @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Add New Plan + + + Set Default Plan + + + Conferencing + + + Emergency Calls + + + Enterprise Voice + + + Federation + + + Instant Messaging + + + International Calls + + + Mobile Calls + + + Mobile Access + + + National Calls + + + None + + + Plan + + + Default plan + + + Select + + + No plans have been added yet. To add a new plan click "Add New plan" button. + + + Select + + + Maximum Conference Size + + + Conferencing Settings + + + Enterprise Voice Policy + + + Lync User Plan + + + Plan Features + + + Please enter correct plan + + + * + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx index 70f95376..6eaf323d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeContactGeneralSettings.ascx @@ -112,6 +112,7 @@ diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateDistributionList.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateDistributionList.ascx index 1bb8e494..97d153f6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateDistributionList.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateDistributionList.ascx @@ -47,8 +47,8 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/App_LocalResources/LyncUserPlans.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/App_LocalResources/LyncUserPlans.ascx.resx index 536a1d01..844f8e76 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/App_LocalResources/LyncUserPlans.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/App_LocalResources/LyncUserPlans.ascx.resx @@ -132,21 +132,30 @@ Delete Plan - - No plans have been added yet. To add a new plan click "Add New Plan" button. + + Plan Default Plan - - Plan + + No plans have been added yet. To add a new plan click "Add New Plan" button. <p> A plan is a template that defines the capabilities of a lync users </p> <p>The plan name needs to be unique. A plan cannot be modified. In case a lync user needs a plan with another characteristics, a new plan needs to be created and assigned to the lync user. A plan can only be deleted when the plan is not assigned to any lync users. </p> + + Source plan: + + + Target plan: + Lync User Plans + + Lync User plan maintenance + Lync User Plans diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs index 64b99076..0c208db5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2011, Outercurve Foundation. +// Copyright (c) 2012, Outercurve Foundation. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, @@ -33,17 +33,17 @@ using WebsitePanel.Providers.ResultObjects; namespace WebsitePanel.Portal.Lync { - public partial class LyncAddLyncUserPlan : WebsitePanelModuleBase - { - protected void Page_Load(object sender, EventArgs e) - { + public partial class LyncAddLyncUserPlan : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { if (!IsPostBack) { if (PanelRequest.GetInt("LyncUserPlanId") != 0) { Providers.HostedSolution.LyncUserPlan plan = ES.Services.Lync.GetLyncUserPlan(PanelRequest.ItemID, PanelRequest.GetInt("LyncUserPlanId")); - + txtPlan.Text = plan.LyncUserPlanName; chkIM.Checked = plan.IM; chkIM.Enabled = false; @@ -71,7 +71,7 @@ namespace WebsitePanel.Portal.Lync chkNone.Checked = true; break; } - + locTitle.Text = plan.LyncUserPlanName; this.DisableControls = true; @@ -108,7 +108,7 @@ namespace WebsitePanel.Portal.Lync } } - } + } protected void btnAdd_Click(object sender, EventArgs e) { @@ -120,7 +120,7 @@ namespace WebsitePanel.Portal.Lync try { Providers.HostedSolution.LyncUserPlan plan = new Providers.HostedSolution.LyncUserPlan(); - plan.LyncUserPlanName = txtPlan.Text; + plan.LyncUserPlanName = txtPlan.Text; plan.IsDefault = false; plan.IM = true; @@ -134,8 +134,22 @@ namespace WebsitePanel.Portal.Lync { plan.VoicePolicy = LyncVoicePolicyType.None; } + else + { + if (chkEmergency.Checked) + plan.VoicePolicy = LyncVoicePolicyType.Emergency; + else if (chkNational.Checked) + plan.VoicePolicy = LyncVoicePolicyType.National; + else if (chkMobile.Checked) + plan.VoicePolicy = LyncVoicePolicyType.Mobile; + else if (chkInternational.Checked) + plan.VoicePolicy = LyncVoicePolicyType.International; + else + plan.VoicePolicy = LyncVoicePolicyType.None; - int result = ES.Services.Lync.AddLyncUserPlan( PanelRequest.ItemID, + } + + int result = ES.Services.Lync.AddLyncUserPlan(PanelRequest.ItemID, plan); @@ -153,5 +167,5 @@ namespace WebsitePanel.Portal.Lync messageBox.ShowErrorMessage("LYNC_ADD_PLAN", ex); } } - } + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs index e8c9da1f..6ad8557f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs @@ -1,32 +1,3 @@ -// Copyright (c) 2012, 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. - - //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx index e91be256..6a9d2353 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx @@ -3,6 +3,8 @@ <%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> <%@ Register Src="../ExchangeServer/UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %> <%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> +<%@ Register Src="UserControls/LyncUserPlanSelector.ascx" TagName="LyncUserPlanSelector" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> @@ -63,6 +65,43 @@ Text="Set Default Plan" CssClass="Button1" OnClick="btnSetDefaultPlan_Click" /> + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + +
+
+
+ +
+ + +
+ +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.cs index 3137598d..b4456b9e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2011, Outercurve Foundation. +// Copyright (c) 2012, Outercurve Foundation. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, @@ -30,19 +30,37 @@ using System; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.ResultObjects; namespace WebsitePanel.Portal.Lync { public partial class LyncUserPlans : WebsitePanelModuleBase - { - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { BindPlans(); - } - } + txtStatus.Visible = false; + + if (PanelSecurity.LoggedUser.Role == UserRole.User) + { + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (cntx.Quotas.ContainsKey(Quotas.LYNC_ENABLEDPLANSEDITING)) + { + if (cntx.Quotas[Quotas.LYNC_ENABLEDPLANSEDITING].QuotaAllocatedValue != 1) + { + gvPlans.Columns[2].Visible = false; + btnAddPlan.Enabled = btnAddPlan.Visible = false; + } + } + } + + + } + + } public string GetPlanDisplayUrl(string LyncUserPlanId) { @@ -64,6 +82,8 @@ namespace WebsitePanel.Portal.Lync { btnSetDefaultPlan.Enabled = false; } + + btnSave.Enabled = (gvPlans.Rows.Count >= 1); } public string IsChecked(bool val) @@ -121,5 +141,34 @@ namespace WebsitePanel.Portal.Lync ShowErrorMessage("LYNC_SET_DEFAULT_PLAN", ex); } } - } + + protected void btnSave_Click(object sender, EventArgs e) + { + txtStatus.Visible = true; + + try + { + LyncUser[] Accounts = ES.Services.Lync.GetLyncUsersByPlanId(PanelRequest.ItemID, Convert.ToInt32(lyncUserPlanSelectorSource.planId)); + + foreach (LyncUser a in Accounts) + { + txtStatus.Text = "Completed"; + LyncUserResult result = ES.Services.Lync.SetUserLyncPlan(PanelRequest.ItemID, a.AccountID, Convert.ToInt32(lyncUserPlanSelectorTarget.planId)); + if (result.IsSuccess) + { + BindPlans(); + txtStatus.Text = "Error: " + a.DisplayName; + ShowErrorMessage("LYNC_FAILED_TO_STAMP"); + return; + } + } + + } + catch (Exception ex) + { + ShowErrorMessage("LYNC_FAILED_TO_STAMP", ex); + } + } + + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.designer.cs index 3cbae581..df06fccf 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUserPlans.ascx.designer.cs @@ -1,32 +1,3 @@ -// Copyright (c) 2012, 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. - - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -122,6 +93,87 @@ namespace WebsitePanel.Portal.Lync { /// protected global::System.Web.UI.WebControls.Button btnSetDefaultPlan; + /// + /// secMainTools control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secMainTools; + + /// + /// ToolsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel ToolsPanel; + + /// + /// tblMaintenance control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tblMaintenance; + + /// + /// lblSourcePlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize lblSourcePlan; + + /// + /// lyncUserPlanSelectorSource control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserPlanSelector lyncUserPlanSelectorSource; + + /// + /// lblTargetPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize lblTargetPlan; + + /// + /// lyncUserPlanSelectorTarget control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserPlanSelector lyncUserPlanSelectorTarget; + + /// + /// txtStatus control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtStatus; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + /// /// FormComments control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx new file mode 100644 index 00000000..9df47609 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx @@ -0,0 +1,188 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SettingsExchangeMailboxPlansPolicy.ascx.cs" Inherits="WebsitePanel.Portal.SettingsExchangeMailboxPlansPolicy" %> +<%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> +<%@ Register Src="ExchangeServer/UserControls/DaysBox.ascx" TagName="DaysBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> + + + + + + + + + + + + + <%# Eval("MailboxPlan")%> + + + + +
+ /> +
+
+
+ + +   + + +
+
+
+
+ +
+ + + + + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+
+
+ + + + + + + + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ + + + + + + + + + +
+ +
+
+
+ +
+ +
+ +
+ + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs new file mode 100644 index 00000000..c17886c6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.cs @@ -0,0 +1,242 @@ +// Copyright (c) 2012, 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.IO; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Xml; +using System.Xml.Serialization; + +using System.Collections.Generic; +using System.Collections.ObjectModel; + +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; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public partial class SettingsExchangeMailboxPlansPolicy : WebsitePanelControlBase, IUserSettingsEditorControl + { + + internal static List list; + + public void BindSettings(UserSettings settings) + { + + if (list == null) + list = new List(); + + if (!string.IsNullOrEmpty(settings[UserSettings.DEFAULT_MAILBOXPLANS])) + { + + XmlSerializer serializer = new XmlSerializer(list.GetType()); + + StringReader reader = new StringReader(settings[UserSettings.DEFAULT_MAILBOXPLANS]); + + list = (List)serializer.Deserialize(reader); + } + + gvMailboxPlans.DataSource = list; + gvMailboxPlans.DataBind(); + + if (gvMailboxPlans.Rows.Count <= 1) + { + btnSetDefaultMailboxPlan.Enabled = false; + } + else + btnSetDefaultMailboxPlan.Enabled = true; + } + + + + + + public string IsChecked(bool val) + { + return val ? "checked" : ""; + } + + + public void btnAddMailboxPlan_Click(object sender, EventArgs e) + { + int count = 0; + if (list != null) + { + foreach (ExchangeMailboxPlan p in list) + { + p.MailboxPlanId = count; + count++; + } + } + + + ExchangeMailboxPlan plan = new ExchangeMailboxPlan(); + plan.MailboxPlan = txtMailboxPlan.Text; + plan.MailboxSizeMB = mailboxSize.ValueKB; + if ((plan.MailboxSizeMB == 0)) plan.MailboxSizeMB = 1; + plan.MailboxPlanId = count; + plan.IsDefault = false; + plan.MaxRecipients = maxRecipients.ValueKB; + plan.MaxSendMessageSizeKB = maxSendMessageSizeKB.ValueKB; + plan.MaxReceiveMessageSizeKB = maxReceiveMessageSizeKB.ValueKB; + plan.EnablePOP = chkPOP3.Checked; + plan.EnableIMAP = chkIMAP.Checked; + plan.EnableOWA = chkOWA.Checked; + plan.EnableMAPI = chkMAPI.Checked; + plan.EnableActiveSync = chkActiveSync.Checked; + plan.IssueWarningPct = sizeIssueWarning.ValueKB; + if ((plan.IssueWarningPct == 0)) plan.IssueWarningPct = 100; + plan.ProhibitSendPct = sizeProhibitSend.ValueKB; + if ((plan.ProhibitSendPct == 0)) plan.ProhibitSendPct = 100; + plan.ProhibitSendReceivePct = sizeProhibitSendReceive.ValueKB; + if ((plan.ProhibitSendReceivePct == 0)) plan.ProhibitSendReceivePct = 100; + plan.KeepDeletedItemsDays = daysKeepDeletedItems.ValueDays; + plan.HideFromAddressBook = chkHideFromAddressBook.Checked; + + if (list == null) + list = new List(); + + list.Add(plan); + gvMailboxPlans.DataSource = list; + gvMailboxPlans.DataBind(); + + if (gvMailboxPlans.Rows.Count <= 1) + { + btnSetDefaultMailboxPlan.Enabled = false; + } + else + btnSetDefaultMailboxPlan.Enabled = true; + + } + + protected void gvMailboxPlan_RowCommand(object sender, GridViewCommandEventArgs e) + { + int mailboxPlanId = Utils.ParseInt(e.CommandArgument.ToString(), 0); + + switch (e.CommandName) + { + case "DeleteItem": + + foreach (ExchangeMailboxPlan p in list) + { + if (p.MailboxPlanId == mailboxPlanId) + { + list.Remove(p); + break; + } + } + + gvMailboxPlans.DataSource = list; + gvMailboxPlans.DataBind(); + + if (gvMailboxPlans.Rows.Count <= 1) + { + btnSetDefaultMailboxPlan.Enabled = false; + } + else + btnSetDefaultMailboxPlan.Enabled = true; + break; + + case "EditItem": + foreach (ExchangeMailboxPlan p in list) + { + if (p.MailboxPlanId == mailboxPlanId) + { + + txtMailboxPlan.Text = p.MailboxPlan; + mailboxSize.ValueKB = p.MailboxSizeMB; + maxRecipients.ValueKB = p.MaxRecipients; + maxSendMessageSizeKB.ValueKB = p.MaxSendMessageSizeKB; + maxReceiveMessageSizeKB.ValueKB = p.MaxReceiveMessageSizeKB; + chkPOP3.Checked = p.EnablePOP; + chkIMAP.Checked = p.EnableIMAP; + chkOWA.Checked = p.EnableOWA; + chkMAPI.Checked = p.EnableMAPI; + chkActiveSync.Checked = p.EnableActiveSync; + sizeIssueWarning.ValueKB = p.IssueWarningPct; + sizeProhibitSend.ValueKB = p.ProhibitSendPct; + sizeProhibitSendReceive.ValueKB = p.ProhibitSendReceivePct; + daysKeepDeletedItems.ValueDays = p.KeepDeletedItemsDays; + chkHideFromAddressBook.Checked = p.HideFromAddressBook; + + break; + } + } + + break; + } + } + + protected void btnSetDefaultMailboxPlan_Click(object sender, EventArgs e) + { + // get domain + int mailboxPlanId = Utils.ParseInt(Request.Form["DefaultMailboxPlan"], 0); + + + + foreach (ExchangeMailboxPlan p in list) + { + p.IsDefault = false; + } + + foreach (ExchangeMailboxPlan p in list) + { + if (p.MailboxPlanId == mailboxPlanId) + { + p.IsDefault = true; + break; + } + } + + gvMailboxPlans.DataSource = list; + gvMailboxPlans.DataBind(); + } + + public void SaveSettings(UserSettings settings) + { + XmlSerializer serializer = new XmlSerializer(list.GetType()); + + StringWriter writer = new StringWriter(); + + serializer.Serialize(writer, list); + + settings[UserSettings.DEFAULT_MAILBOXPLANS] = writer.ToString(); + } + + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.designer.cs new file mode 100644 index 00000000..483341e7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsExchangeMailboxPlansPolicy.ascx.designer.cs @@ -0,0 +1,357 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class SettingsExchangeMailboxPlansPolicy { + + /// + /// gvMailboxPlans control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvMailboxPlans; + + /// + /// btnSetDefaultMailboxPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSetDefaultMailboxPlan; + + /// + /// secMailboxPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secMailboxPlan; + + /// + /// MailboxPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel MailboxPlan; + + /// + /// txtMailboxPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMailboxPlan; + + /// + /// valRequireMailboxPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireMailboxPlan; + + /// + /// secMailboxFeatures control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secMailboxFeatures; + + /// + /// MailboxFeatures control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel MailboxFeatures; + + /// + /// chkPOP3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkPOP3; + + /// + /// chkIMAP control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkIMAP; + + /// + /// chkOWA control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkOWA; + + /// + /// chkMAPI control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkMAPI; + + /// + /// chkActiveSync control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkActiveSync; + + /// + /// secMailboxGeneral control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secMailboxGeneral; + + /// + /// MailboxGeneral control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel MailboxGeneral; + + /// + /// chkHideFromAddressBook control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkHideFromAddressBook; + + /// + /// secStorageQuotas control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secStorageQuotas; + + /// + /// StorageQuotas control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel StorageQuotas; + + /// + /// locMailboxSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMailboxSize; + + /// + /// mailboxSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SizeBox mailboxSize; + + /// + /// locMaxRecipients control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaxRecipients; + + /// + /// maxRecipients control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SizeBox maxRecipients; + + /// + /// locMaxSendMessageSizeKB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaxSendMessageSizeKB; + + /// + /// maxSendMessageSizeKB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SizeBox maxSendMessageSizeKB; + + /// + /// locMaxReceiveMessageSizeKB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaxReceiveMessageSizeKB; + + /// + /// maxReceiveMessageSizeKB control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SizeBox maxReceiveMessageSizeKB; + + /// + /// locWhenSizeExceeds control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locWhenSizeExceeds; + + /// + /// locIssueWarning control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locIssueWarning; + + /// + /// sizeIssueWarning control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SizeBox sizeIssueWarning; + + /// + /// locProhibitSend control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locProhibitSend; + + /// + /// sizeProhibitSend control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SizeBox sizeProhibitSend; + + /// + /// locProhibitSendReceive control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locProhibitSendReceive; + + /// + /// sizeProhibitSendReceive control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SizeBox sizeProhibitSendReceive; + + /// + /// secDeleteRetention control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secDeleteRetention; + + /// + /// DeleteRetention control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel DeleteRetention; + + /// + /// locKeepDeletedItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locKeepDeletedItems; + + /// + /// daysKeepDeletedItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.DaysBox daysKeepDeletedItems; + + /// + /// btnAddMailboxPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddMailboxPlan; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx new file mode 100644 index 00000000..26602358 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx @@ -0,0 +1,137 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SettingsLyncUserPlansPolicy.ascx.cs" Inherits="WebsitePanel.Portal.SettingsLyncUserPlansPolicy" %> +<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> + + + + + + + + + + + + + <%# Eval("LyncUserPlanName")%> + + + + +
+ /> +
+
+
+ + +   + + +
+
+
+
+ +
+ + + + + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.cs new file mode 100644 index 00000000..1ff83f72 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.cs @@ -0,0 +1,262 @@ +// Copyright (c) 2012, 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.IO; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Xml; +using System.Xml.Serialization; + +using System.Collections.Generic; +using System.Collections.ObjectModel; + +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; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public partial class SettingsLyncUserPlansPolicy : WebsitePanelControlBase, IUserSettingsEditorControl + { + + internal static List list; + + public void BindSettings(UserSettings settings) + { + + if (list == null) + list = new List(); + + if (!string.IsNullOrEmpty(settings[UserSettings.DEFAULT_LYNCUSERPLANS])) + { + + XmlSerializer serializer = new XmlSerializer(list.GetType()); + + StringReader reader = new StringReader(settings[UserSettings.DEFAULT_LYNCUSERPLANS]); + + list = (List)serializer.Deserialize(reader); + } + + gvPlans.DataSource = list; + gvPlans.DataBind(); + + if (gvPlans.Rows.Count <= 1) + { + btnSetDefaultPlan.Enabled = false; + } + else + btnSetDefaultPlan.Enabled = true; + } + + + + + + public string IsChecked(bool val) + { + return val ? "checked" : ""; + } + + + public void btnAddPlan_Click(object sender, EventArgs e) + { + int count = 0; + if (list != null) + { + foreach (LyncUserPlan p in list) + { + p.LyncUserPlanId = count; + count++; + } + } + + + LyncUserPlan plan = new LyncUserPlan(); + plan.LyncUserPlanName = txtPlan.Text; + plan.IsDefault = false; + + plan.IM = true; + plan.Mobility = chkMobility.Checked; + plan.Federation = chkFederation.Checked; + plan.Conferencing = chkConferencing.Checked; + + plan.EnterpriseVoice = chkEnterpriseVoice.Checked; + if (!plan.EnterpriseVoice) + { + plan.VoicePolicy = LyncVoicePolicyType.None; + } + else + { + if (chkEmergency.Checked) + plan.VoicePolicy = LyncVoicePolicyType.Emergency; + else if (chkNational.Checked) + plan.VoicePolicy = LyncVoicePolicyType.National; + else if (chkMobile.Checked) + plan.VoicePolicy = LyncVoicePolicyType.Mobile; + else if (chkInternational.Checked) + plan.VoicePolicy = LyncVoicePolicyType.International; + else + plan.VoicePolicy = LyncVoicePolicyType.None; + + } + + if (list == null) + list = new List(); + + list.Add(plan); + gvPlans.DataSource = list; + gvPlans.DataBind(); + + if (gvPlans.Rows.Count <= 1) + { + btnSetDefaultPlan.Enabled = false; + } + else + btnSetDefaultPlan.Enabled = true; + + } + + protected void gvPlan_RowCommand(object sender, GridViewCommandEventArgs e) + { + int planId = Utils.ParseInt(e.CommandArgument.ToString(), 0); + + switch (e.CommandName) + { + case "DeleteItem": + + foreach (LyncUserPlan p in list) + { + if (p.LyncUserPlanId == planId) + { + list.Remove(p); + break; + } + } + + gvPlans.DataSource = list; + gvPlans.DataBind(); + + if (gvPlans.Rows.Count <= 1) + { + btnSetDefaultPlan.Enabled = false; + } + else + btnSetDefaultPlan.Enabled = true; + break; + + case "EditItem": + foreach (LyncUserPlan plan in list) + { + if (plan.LyncUserPlanId == planId) + { + + txtPlan.Text = plan.LyncUserPlanName; + chkIM.Checked = plan.IM; + chkIM.Enabled = false; + chkFederation.Checked = plan.Federation; + chkConferencing.Checked = plan.Conferencing; + chkMobility.Checked = plan.Mobility; + chkEnterpriseVoice.Checked = plan.EnterpriseVoice; + switch (plan.VoicePolicy) + { + case LyncVoicePolicyType.None: + break; + case LyncVoicePolicyType.Emergency: + chkEmergency.Checked = true; + break; + case LyncVoicePolicyType.National: + chkNational.Checked = true; + break; + case LyncVoicePolicyType.Mobile: + chkMobile.Checked = true; + break; + case LyncVoicePolicyType.International: + chkInternational.Checked = true; + break; + default: + chkNone.Checked = true; + break; + } + + break; + } + } + + break; + } + } + + protected void btnSetDefaultPlan_Click(object sender, EventArgs e) + { + // get domain + int planId = Utils.ParseInt(Request.Form["DefaultLyncUserPlan"], 0); + + + + foreach (LyncUserPlan p in list) + { + p.IsDefault = false; + } + + foreach (LyncUserPlan p in list) + { + if (p.LyncUserPlanId == planId) + { + p.IsDefault = true; + break; + } + } + + gvPlans.DataSource = list; + gvPlans.DataBind(); + } + + public void SaveSettings(UserSettings settings) + { + XmlSerializer serializer = new XmlSerializer(list.GetType()); + + StringWriter writer = new StringWriter(); + + serializer.Serialize(writer, list); + + settings[UserSettings.DEFAULT_LYNCUSERPLANS] = writer.ToString(); + } + + + + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs new file mode 100644 index 00000000..3fd75740 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs @@ -0,0 +1,204 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class SettingsLyncUserPlansPolicy { + + /// + /// gvPlans control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvPlans; + + /// + /// btnSetDefaultPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSetDefaultPlan; + + /// + /// secPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPlan; + + /// + /// Plan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel Plan; + + /// + /// txtPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPlan; + + /// + /// valRequirePlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequirePlan; + + /// + /// secPlanFeatures control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeatures; + + /// + /// PlanFeatures control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PlanFeatures; + + /// + /// chkIM control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkIM; + + /// + /// chkMobility control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkMobility; + + /// + /// chkFederation control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkFederation; + + /// + /// chkConferencing control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkConferencing; + + /// + /// chkEnterpriseVoice control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnterpriseVoice; + + /// + /// secEnterpriseVoice control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secEnterpriseVoice; + + /// + /// EnterpriseVoice control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel EnterpriseVoice; + + /// + /// chkNone control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton chkNone; + + /// + /// chkEmergency control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton chkEmergency; + + /// + /// chkNational control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton chkNational; + + /// + /// chkMobile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton chkMobile; + + /// + /// chkInternational control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton chkInternational; + + /// + /// btnAddPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAddPlan; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx index a9fc8fe1..e75513e8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx @@ -9,6 +9,16 @@ +
  • + +
  • + +
  • + +
  • +
  • diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx.designer.cs index d47171c5..37ce576f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx.designer.cs @@ -30,6 +30,24 @@ namespace WebsitePanel.Portal { /// protected global::System.Web.UI.WebControls.HyperLink lnkWebPolicy; + /// + /// lnkExchangeMailboxPlansPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink lnkExchangeMailboxPlansPolicy; + + /// + /// lnkLyncUserPlansPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink lnkLyncUserPlansPolicy; + /// /// lnkFtpPolicy control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 9b102bd6..8159a5d4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -336,7 +336,7 @@ Lync_Settings.ascx - ASPXCodeBehind + ASPXCodeBehind ServersEditWebPlatformInstaller.ascx @@ -344,7 +344,7 @@ Lync_Settings.ascx - + ServersEditWebPlatformInstaller.ascx @@ -352,6 +352,20 @@ NotifyOverusedDatabases.ascx ASPXCodeBehind + + SettingsExchangeMailboxPlansPolicy.ascx + ASPXCodeBehind + + + SettingsExchangeMailboxPlansPolicy.ascx + + + SettingsLyncUserPlansPolicy.ascx + ASPXCodeBehind + + + SettingsLyncUserPlansPolicy.ascx + ASPXCodeBehind @@ -3797,6 +3811,8 @@ + + @@ -4926,6 +4942,8 @@ + + Designer