diff --git a/WebsitePanel.Installer/Sources/Setup.SchedulerService/Product.wxs b/WebsitePanel.Installer/Sources/Setup.SchedulerService/Product.wxs index 1fdff4cb..42e79b27 100644 --- a/WebsitePanel.Installer/Sources/Setup.SchedulerService/Product.wxs +++ b/WebsitePanel.Installer/Sources/Setup.SchedulerService/Product.wxs @@ -3,13 +3,23 @@ - + + bannrbmp - + + + + + + + @@ -72,7 +82,9 @@ - 1 + 1 + SKIPCONNECTIONSTRINGSTEP = "0" + SKIPCONNECTIONSTRINGSTEP = "1" 1 @@ -91,11 +103,15 @@ LicenseAccepted = "1" - 1 + SKIPCONNECTIONSTRINGSTEP = "0" + SKIPCONNECTIONSTRINGSTEP = "1" - + + (NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL") + + NOT Installed or REINSTALL @@ -103,8 +119,20 @@ - + + + + + + + + + + + + + @@ -115,8 +143,8 @@ - - + + diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.SchedulerServiceInstaller/CustomAction.cs b/WebsitePanel.Installer/Sources/WebsitePanel.SchedulerServiceInstaller/CustomAction.cs index eff618a7..4fe768ea 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.SchedulerServiceInstaller/CustomAction.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.SchedulerServiceInstaller/CustomAction.cs @@ -27,6 +27,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Collections.Generic; using System.Configuration.Install; using System.Data; using System.Data.SqlClient; @@ -34,6 +35,10 @@ using System.IO; using System.Linq; using System.ServiceProcess; using System.Text.RegularExpressions; +using System.Threading; +using System.Windows.Forms; +using System.Windows.Forms.VisualStyles; +using System.Xml; using Microsoft.Deployment.WindowsInstaller; using WebsitePanel.Setup; @@ -41,6 +46,8 @@ namespace WebsitePanel.SchedulerServiceInstaller { public class CustomActions { + public const string CustomDataDelimiter = "-=del=-"; + [CustomAction] public static ActionResult CheckConnection(Session session) { @@ -62,9 +69,71 @@ namespace WebsitePanel.SchedulerServiceInstaller [CustomAction] public static ActionResult FinalizeInstall(Session session) { - ChangeConfigString("installer.connectionstring", session["CONNECTIONSTRING"], session["INSTALLFOLDER"]); - ChangeCryptoKey(session["INSTALLFOLDER"]); - InstallService(session["INSTALLFOLDER"]); + var connectionString = GetCustomActionProperty(session, "ConnectionString").Replace(CustomDataDelimiter, ";"); + var serviceFolder = GetCustomActionProperty(session, "ServiceFolder"); + var previousConnectionString = GetCustomActionProperty(session, "PreviousConnectionString").Replace(CustomDataDelimiter, ";"); + var previousCryptoKey = GetCustomActionProperty(session, "PreviousCryptoKey"); + + if (string.IsNullOrEmpty(serviceFolder)) + { + return ActionResult.Success; + } + + connectionString = string.IsNullOrEmpty(previousConnectionString) + ? connectionString + : previousConnectionString; + + ChangeConfigString("/configuration/connectionStrings/add[@name='EnterpriseServer']", "connectionString", connectionString, serviceFolder); + ChangeConfigString("/configuration/appSettings/add[@key='WebsitePanel.CryptoKey']", "value", previousCryptoKey, serviceFolder); + InstallService(serviceFolder); + + return ActionResult.Success; + } + + [CustomAction] + public static ActionResult FinalizeUnInstall(Session session) + { + UnInstallService(); + + return ActionResult.Success; + } + + [CustomAction] + public static ActionResult PreInstallationAction(Session session) + { + session["SKIPCONNECTIONSTRINGSTEP"] = "0"; + + session["SERVICEFOLDER"] = session["INSTALLFOLDER"]; + + var servicePath = SecurityUtils.GetServicePath("WebsitePanel Scheduler"); + + if (!string.IsNullOrEmpty(servicePath)) + { + string path = Path.Combine(servicePath, "WebsitePanel.SchedulerService.exe.config"); + + if (File.Exists(path)) + { + using (var reader = new StreamReader(path)) + { + string content = reader.ReadToEnd(); + var pattern = new Regex(@"(?<=)"); + Match match = pattern.Match(content); + session["PREVIOUSCRYPTOKEY"] = match.Value; + + var connectionStringPattern = new Regex(@"(?<=)"); + match = connectionStringPattern.Match(content); + session["PREVIOUSCONNECTIONSTRING"] = match.Value.Replace(";", CustomDataDelimiter); + } + + session["SKIPCONNECTIONSTRINGSTEP"] = "1"; + + if (string.IsNullOrEmpty(session["SERVICEFOLDER"])) + { + session["SERVICEFOLDER"] = servicePath; + } + } + + } return ActionResult.Success; } @@ -93,44 +162,49 @@ namespace WebsitePanel.SchedulerServiceInstaller } } - private static void ChangeCryptoKey(string installFolder) + private static void UnInstallService() { - string path = Path.Combine(installFolder.Replace("SchedulerService", "Enterprise Server"), "web.config"); - string cryptoKey = "0123456789"; - - if (File.Exists(path)) + try { - using (var reader = new StreamReader(path)) - { - string content = reader.ReadToEnd(); - var pattern = new Regex(@"(?<=)"); - Match match = pattern.Match(content); - cryptoKey = match.Value; - } - } + var schedulerService = + ServiceController.GetServices().FirstOrDefault( + s => s.DisplayName.Equals("WebsitePanel Scheduler", StringComparison.CurrentCultureIgnoreCase)); - ChangeConfigString("installer.cryptokey", cryptoKey, installFolder); + if (schedulerService != null) + { + StopService(schedulerService.ServiceName); + + SecurityUtils.DeleteService(schedulerService.ServiceName); + } + } + catch (Exception) + { + } } - private static void ChangeConfigString(string searchString, string replaceValue, string installFolder) + private static void ChangeConfigString(string nodePath, string attrToChange, string value, string installFolder) { - string content; string path = Path.Combine(installFolder, "WebsitePanel.SchedulerService.exe.config"); - using (var reader = new StreamReader(path)) + if (!File.Exists(path)) { - content = reader.ReadToEnd(); + return; } - var re = new Regex("\\$\\{" + searchString + "\\}+", RegexOptions.IgnoreCase); - content = re.Replace(content, replaceValue); + XmlDocument xmldoc = new XmlDocument(); + xmldoc.Load(path); - using (var writer = new StreamWriter(path)) + XmlElement node = xmldoc.SelectSingleNode(nodePath) as XmlElement; + + if (node != null) { - writer.Write(content); + node.SetAttribute(attrToChange, value); + + xmldoc.Save(path); } } + private static void StopService(string serviceName) { var sc = new ServiceController(serviceName); @@ -155,12 +229,12 @@ namespace WebsitePanel.SchedulerServiceInstaller private static string GetConnectionString(string serverName, string databaseName) { - return string.Format("Server={0};database={1};Trusted_Connection=true;", serverName, databaseName); + return string.Format("Server={0};database={1};Trusted_Connection=true;", serverName, databaseName).Replace(";", CustomDataDelimiter); } private static string GetConnectionString(string serverName, string databaseName, string login, string password) { - return string.Format("Server={0};database={1};uid={2};password={3};", serverName, databaseName, login, password); + return string.Format("Server={0};database={1};uid={2};password={3};", serverName, databaseName, login, password).Replace(";", CustomDataDelimiter); } private static bool CheckConnection(string connectionString) @@ -186,5 +260,15 @@ namespace WebsitePanel.SchedulerServiceInstaller return result; } + + private static string GetCustomActionProperty(Session session, string key) + { + if (session.CustomActionData.ContainsKey(key)) + { + return session.CustomActionData[key].Replace("-=-", ";"); + } + + return string.Empty; + } } } \ No newline at end of file diff --git a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Common/SecurityUtils.cs b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Common/SecurityUtils.cs index 668e7875..5e71edae 100644 --- a/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Common/SecurityUtils.cs +++ b/WebsitePanel.Installer/Sources/WebsitePanel.Setup/Common/SecurityUtils.cs @@ -1110,6 +1110,25 @@ namespace WebsitePanel.Setup wmiService.Delete(); } + public static string GetServicePath(string serviceName) + { + var mc = new ManagementClass("Win32_Service"); + + foreach (var mo in mc.GetInstances()) + { + if (mo.GetPropertyValue("Name").ToString() == serviceName) + { + var path = mo.GetPropertyValue("PathName").ToString().Trim('"'); + + var directory = Path.GetDirectoryName(path); + + return directory; + } + } + + return string.Empty; + } + #endregion } diff --git a/WebsitePanel/Database/install_db.sql b/WebsitePanel/Database/install_db.sql index 47bb884f..c28f6f0b 100644 --- a/WebsitePanel/Database/install_db.sql +++ b/WebsitePanel/Database/install_db.sql @@ -21064,6 +21064,7 @@ SET @sql = @sql + ' SELECT COUNT(DomainID) FROM @Domains;SELECT WS.ItemName AS WebSiteName, ISNULL(MD.ItemID, 0) AS MailDomainID, MD.ItemName AS MailDomainName, + Z.ItemName AS ZoneName, D.IsSubDomain, D.IsInstantAlias, D.IsDomainPointer, diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 84f9572b..0684a998 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -6057,6 +6057,112 @@ END RETURN GO +-- wsp-10053: IDN, return ZoneName also from GetDomainsPaged (already exists in other GetDomain-sps) +ALTER PROCEDURE [dbo].[GetDomainsPaged] +( + @ActorID int, + @PackageID int, + @ServerID int, + @Recursive bit, + @FilterColumn nvarchar(50) = '', + @FilterValue nvarchar(50) = '', + @SortColumn nvarchar(50), + @StartRow int, + @MaximumRows int +) +AS +SET NOCOUNT ON + +-- check rights +IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0 +RAISERROR('You are not allowed to access this package', 16, 1) + +-- build query and run it to the temporary table +DECLARE @sql nvarchar(4000) + +IF @SortColumn = '' OR @SortColumn IS NULL +SET @SortColumn = 'DomainName' + +SET @sql = ' +DECLARE @Domains TABLE +( + ItemPosition int IDENTITY(1,1), + DomainID int +) +INSERT INTO @Domains (DomainID) +SELECT + D.DomainID +FROM Domains AS D +INNER JOIN Packages AS P ON D.PackageID = P.PackageID +INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID +LEFT OUTER JOIN ServiceItems AS Z ON D.ZoneItemID = Z.ItemID +LEFT OUTER JOIN Services AS S ON Z.ServiceID = S.ServiceID +LEFT OUTER JOIN Servers AS SRV ON S.ServerID = SRV.ServerID +WHERE (D.IsInstantAlias = 0 AND D.IsDomainPointer = 0) AND + ((@Recursive = 0 AND D.PackageID = @PackageID) + OR (@Recursive = 1 AND dbo.CheckPackageParent(@PackageID, D.PackageID) = 1)) +AND (@ServerID = 0 OR (@ServerID > 0 AND S.ServerID = @ServerID)) +' + +IF @FilterColumn <> '' AND @FilterValue <> '' +SET @sql = @sql + ' AND ' + @FilterColumn + ' LIKE @FilterValue ' + +IF @SortColumn <> '' AND @SortColumn IS NOT NULL +SET @sql = @sql + ' ORDER BY ' + @SortColumn + ' ' + +SET @sql = @sql + ' SELECT COUNT(DomainID) FROM @Domains;SELECT + D.DomainID, + D.PackageID, + D.ZoneItemID, + D.DomainItemID, + D.DomainName, + D.HostingAllowed, + ISNULL(WS.ItemID, 0) AS WebSiteID, + WS.ItemName AS WebSiteName, + ISNULL(MD.ItemID, 0) AS MailDomainID, + MD.ItemName AS MailDomainName, + Z.ItemName AS ZoneName, + D.IsSubDomain, + D.IsInstantAlias, + D.IsDomainPointer, + + -- packages + P.PackageName, + + -- server + ISNULL(SRV.ServerID, 0) AS ServerID, + ISNULL(SRV.ServerName, '''') AS ServerName, + ISNULL(SRV.Comments, '''') AS ServerComments, + ISNULL(SRV.VirtualServer, 0) AS VirtualServer, + + -- user + P.UserID, + U.Username, + U.FirstName, + U.LastName, + U.FullName, + U.RoleID, + U.Email +FROM @Domains AS SD +INNER JOIN Domains AS D ON SD.DomainID = D.DomainID +INNER JOIN Packages AS P ON D.PackageID = P.PackageID +INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID +LEFT OUTER JOIN ServiceItems AS WS ON D.WebSiteID = WS.ItemID +LEFT OUTER JOIN ServiceItems AS MD ON D.MailDomainID = MD.ItemID +LEFT OUTER JOIN ServiceItems AS Z ON D.ZoneItemID = Z.ItemID +LEFT OUTER JOIN Services AS S ON Z.ServiceID = S.ServiceID +LEFT OUTER JOIN Servers AS SRV ON S.ServerID = SRV.ServerID +WHERE SD.ItemPosition BETWEEN @StartRow + 1 AND @StartRow + @MaximumRows' + +exec sp_executesql @sql, N'@StartRow int, @MaximumRows int, @PackageID int, @FilterValue nvarchar(50), @ServerID int, @Recursive bit', +@StartRow, @MaximumRows, @PackageID, @FilterValue, @ServerID, @Recursive + + +RETURN + +GO + + -- Domain lookup tasks IF NOT EXISTS (SELECT * FROM [dbo].[ScheduleTasks] WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP') @@ -6085,7 +6191,13 @@ GO IF NOT EXISTS (SELECT * FROM [dbo].[ScheduleTaskParameters] WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP' AND [ParameterID]= N'SERVER_NAME' ) BEGIN -INSERT [dbo].[ScheduleTaskParameters] ([TaskID], [ParameterID], [DataTypeID], [DefaultValue], [ParameterOrder]) VALUES (N'SCHEDULE_TASK_DOMAIN_LOOKUP', N'SERVER_NAME', N'String', NULL, 3) +INSERT [dbo].[ScheduleTaskParameters] ([TaskID], [ParameterID], [DataTypeID], [DefaultValue], [ParameterOrder]) VALUES (N'SCHEDULE_TASK_DOMAIN_LOOKUP', N'SERVER_NAME', N'String', N'', 3) +END +GO + +IF EXISTS (SELECT * FROM [dbo].[ScheduleTaskParameters] WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP' AND [ParameterID]= N'SERVER_NAME' ) +BEGIN +UPDATE [dbo].[ScheduleTaskParameters] SET [DefaultValue] = N'' WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP' AND [ParameterID]= N'SERVER_NAME' END GO @@ -6379,7 +6491,7 @@ Please, find below details of MX and NS changes.

-

#Domain.DomainName#

+

#Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName#

@@ -6387,7 +6499,8 @@ Please, find below details of MX and NS changes. - + + @@ -6396,7 +6509,8 @@ Please, find below details of MX and NS changes. - + + @@ -6432,19 +6546,19 @@ INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [Property Hello #user.FirstName#, -Please, find below MX and NS Changes Information. - +Please, find below details of MX and NS changes. - #Domain.DomainName# + #Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName# - DNS: #DnsChange.DnsServer# - Type: #DnsChange.Type# - Status: #DnsChange.Status# - Value: #DnsChange.Record.Value# + DNS: #DnsChange.DnsServer# + Type: #DnsChange.Type# + Status: #DnsChange.Status# + Old Value: #DnsChange.OldRecord.Value# + New Value: #DnsChange.NewRecord.Value# @@ -6492,7 +6606,7 @@ Hello #user.FirstName#,

-No MX and NS changes have been founded. +No MX and NS changes have been found.

@@ -6581,6 +6695,24 @@ SELECT WHERE [DomainId] = @DomainId AND [RecordType] = @RecordType GO +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetDomainAllDnsRecords') +DROP PROCEDURE GetDomainAllDnsRecords +GO +CREATE PROCEDURE [dbo].GetDomainAllDnsRecords +( + @DomainId INT +) +AS +SELECT + ID, + DomainId, + DnsServer, + RecordType, + Value, + Date + FROM [dbo].[DomainDnsRecords] + WHERE [DomainId] = @DomainId +GO IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddDomainDnsRecord') @@ -6668,6 +6800,20 @@ AS UPDATE [dbo].[Domains] SET [LastUpdateDate] = @Date WHERE [DomainID] = @DomainId GO +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateDomainDates') +DROP PROCEDURE UpdateDomainDates +GO +CREATE PROCEDURE [dbo].UpdateDomainDates +( + @DomainId INT, + @DomainCreationDate DateTime, + @DomainExpirationDate DateTime, + @DomainLastUpdateDate DateTime +) +AS +UPDATE [dbo].[Domains] SET [CreationDate] = @DomainCreationDate, [ExpirationDate] = @DomainExpirationDate, [LastUpdateDate] = @DomainLastUpdateDate WHERE [DomainID] = @DomainId +GO + --Updating Domain procedures @@ -6912,9 +7058,17 @@ SET WHERE ID = @Id GO + +-- fix Windows 2012 Provider +BEGIN +UPDATE [dbo].[Providers] SET [EditorControl] = 'Windows2012' WHERE [ProviderName] = 'Windows2012' +END +GO + -- Hyper-V 2012 R2 IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'Microsoft Hyper-V 2012 R2') BEGIN INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (350, 30, N'HyperV2012R2', N'Microsoft Hyper-V 2012 R2', N'WebsitePanel.Providers.Virtualization.HyperV2012R2, WebsitePanel.Providers.Virtualization.HyperV2012R2', N'HyperV', 1) END -GO \ No newline at end of file +GO + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs index 2bad8a81..8b6f1e32 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs @@ -18,9 +18,8 @@ namespace WebsitePanel.EnterpriseServer { using System.Web.Services.Protocols; using System; using System.Diagnostics; - - using WebsitePanel.Providers.Common; using WebsitePanel.Providers.RemoteDesktopServices; + using WebsitePanel.Providers.Common; using WebsitePanel.Providers.HostedSolution; @@ -37,6 +36,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback AddRdsCollectionOperationCompleted; + private System.Threading.SendOrPostCallback EditRdsCollectionOperationCompleted; + private System.Threading.SendOrPostCallback GetRdsCollectionsPagedOperationCompleted; private System.Threading.SendOrPostCallback RemoveRdsCollectionOperationCompleted; @@ -87,6 +88,10 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback GetOrganizationRdsUsersCountOperationCompleted; + private System.Threading.SendOrPostCallback GetApplicationUsersOperationCompleted; + + private System.Threading.SendOrPostCallback SetApplicationUsersOperationCompleted; + /// public esRemoteDesktopServices() { this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx"; @@ -101,6 +106,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event AddRdsCollectionCompletedEventHandler AddRdsCollectionCompleted; + /// + public event EditRdsCollectionCompletedEventHandler EditRdsCollectionCompleted; + /// public event GetRdsCollectionsPagedCompletedEventHandler GetRdsCollectionsPagedCompleted; @@ -176,6 +184,12 @@ namespace WebsitePanel.EnterpriseServer { /// public event GetOrganizationRdsUsersCountCompletedEventHandler GetOrganizationRdsUsersCountCompleted; + /// + public event GetApplicationUsersCompletedEventHandler GetApplicationUsersCompleted; + + /// + public event SetApplicationUsersCompletedEventHandler SetApplicationUsersCompleted; + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public RdsCollection GetRdsCollection(int collectionId) { @@ -302,6 +316,50 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/EditRdsCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject EditRdsCollection(int itemId, RdsCollection collection) { + object[] results = this.Invoke("EditRdsCollection", new object[] { + itemId, + collection}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginEditRdsCollection(int itemId, RdsCollection collection, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("EditRdsCollection", new object[] { + itemId, + collection}, callback, asyncState); + } + + /// + public ResultObject EndEditRdsCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void EditRdsCollectionAsync(int itemId, RdsCollection collection) { + this.EditRdsCollectionAsync(itemId, collection, null); + } + + /// + public void EditRdsCollectionAsync(int itemId, RdsCollection collection, object userState) { + if ((this.EditRdsCollectionOperationCompleted == null)) { + this.EditRdsCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEditRdsCollectionOperationCompleted); + } + this.InvokeAsync("EditRdsCollection", new object[] { + itemId, + collection}, this.EditRdsCollectionOperationCompleted, userState); + } + + private void OnEditRdsCollectionOperationCompleted(object arg) { + if ((this.EditRdsCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.EditRdsCollectionCompleted(this, new EditRdsCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollectionsPaged", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public RdsCollectionPaged GetRdsCollectionsPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { @@ -510,9 +568,10 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOrganizationRdsServersPaged", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { + public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] System.Nullable collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { object[] results = this.Invoke("GetOrganizationRdsServersPaged", new object[] { itemId, + collectionId, filterColumn, filterValue, sortColumn, @@ -522,9 +581,10 @@ namespace WebsitePanel.EnterpriseServer { } /// - public System.IAsyncResult BeginGetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetOrganizationRdsServersPaged(int itemId, System.Nullable collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetOrganizationRdsServersPaged", new object[] { itemId, + collectionId, filterColumn, filterValue, sortColumn, @@ -539,17 +599,18 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void GetOrganizationRdsServersPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { - this.GetOrganizationRdsServersPagedAsync(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null); + public void GetOrganizationRdsServersPagedAsync(int itemId, System.Nullable collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { + this.GetOrganizationRdsServersPagedAsync(itemId, collectionId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null); } /// - public void GetOrganizationRdsServersPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) { + public void GetOrganizationRdsServersPagedAsync(int itemId, System.Nullable collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) { if ((this.GetOrganizationRdsServersPagedOperationCompleted == null)) { this.GetOrganizationRdsServersPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationRdsServersPagedOperationCompleted); } this.InvokeAsync("GetOrganizationRdsServersPaged", new object[] { itemId, + collectionId, filterColumn, filterValue, sortColumn, @@ -1452,6 +1513,103 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetApplicationUsers", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string[] GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp) { + object[] results = this.Invoke("GetApplicationUsers", new object[] { + itemId, + collectionId, + remoteApp}); + return ((string[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetApplicationUsers", new object[] { + itemId, + collectionId, + remoteApp}, callback, asyncState); + } + + /// + public string[] EndGetApplicationUsers(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string[])(results[0])); + } + + /// + public void GetApplicationUsersAsync(int itemId, int collectionId, RemoteApplication remoteApp) { + this.GetApplicationUsersAsync(itemId, collectionId, remoteApp, null); + } + + /// + public void GetApplicationUsersAsync(int itemId, int collectionId, RemoteApplication remoteApp, object userState) { + if ((this.GetApplicationUsersOperationCompleted == null)) { + this.GetApplicationUsersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetApplicationUsersOperationCompleted); + } + this.InvokeAsync("GetApplicationUsers", new object[] { + itemId, + collectionId, + remoteApp}, this.GetApplicationUsersOperationCompleted, userState); + } + + private void OnGetApplicationUsersOperationCompleted(object arg) { + if ((this.GetApplicationUsersCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetApplicationUsersCompleted(this, new GetApplicationUsersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetApplicationUsers", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject SetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp, string[] users) { + object[] results = this.Invoke("SetApplicationUsers", new object[] { + itemId, + collectionId, + remoteApp, + users}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginSetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp, string[] users, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetApplicationUsers", new object[] { + itemId, + collectionId, + remoteApp, + users}, callback, asyncState); + } + + /// + public ResultObject EndSetApplicationUsers(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void SetApplicationUsersAsync(int itemId, int collectionId, RemoteApplication remoteApp, string[] users) { + this.SetApplicationUsersAsync(itemId, collectionId, remoteApp, users, null); + } + + /// + public void SetApplicationUsersAsync(int itemId, int collectionId, RemoteApplication remoteApp, string[] users, object userState) { + if ((this.SetApplicationUsersOperationCompleted == null)) { + this.SetApplicationUsersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetApplicationUsersOperationCompleted); + } + this.InvokeAsync("SetApplicationUsers", new object[] { + itemId, + collectionId, + remoteApp, + users}, this.SetApplicationUsersOperationCompleted, userState); + } + + private void OnSetApplicationUsersOperationCompleted(object arg) { + if ((this.SetApplicationUsersCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetApplicationUsersCompleted(this, new SetApplicationUsersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { base.CancelAsync(userState); @@ -1536,6 +1694,32 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void EditRdsCollectionCompletedEventHandler(object sender, EditRdsCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class EditRdsCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal EditRdsCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetRdsCollectionsPagedCompletedEventHandler(object sender, GetRdsCollectionsPagedCompletedEventArgs e); @@ -2185,4 +2369,56 @@ namespace WebsitePanel.EnterpriseServer { } } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetApplicationUsersCompletedEventHandler(object sender, GetApplicationUsersCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetApplicationUsersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetApplicationUsersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetApplicationUsersCompletedEventHandler(object sender, SetApplicationUsersCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetApplicationUsersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SetApplicationUsersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index b7e2acf0..bab3c724 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -1910,9 +1910,9 @@ namespace WebsitePanel.EnterpriseServer public static IDataReader GetProcessBackgroundTasks(BackgroundTaskStatus status) { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetProcessBackgroundTasks", - new SqlParameter("@status", (int)status)); + return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, + ObjectQualifier + "GetProcessBackgroundTasks", + new SqlParameter("@status", (int)status)); } public static IDataReader GetBackgroundTopTask(Guid guid) @@ -4744,9 +4744,19 @@ namespace WebsitePanel.EnterpriseServer ); } + public static IDataReader GetDomainAllDnsRecords(int domainId) + { + return SqlHelper.ExecuteReader( + ConnectionString, + CommandType.StoredProcedure, + "GetDomainAllDnsRecords", + new SqlParameter("@DomainId", domainId) + ); + } + public static void AddDomainDnsRecord(DnsRecordInfo domainDnsRecord) { - SqlHelper.ExecuteReader( + SqlHelper.ExecuteNonQuery( ConnectionString, CommandType.StoredProcedure, "AddDomainDnsRecord", @@ -4770,7 +4780,7 @@ namespace WebsitePanel.EnterpriseServer public static void DeleteDomainDnsRecord(int id) { - SqlHelper.ExecuteReader( + SqlHelper.ExecuteNonQuery( ConnectionString, CommandType.StoredProcedure, "DeleteDomainDnsRecord", @@ -4795,7 +4805,7 @@ namespace WebsitePanel.EnterpriseServer private static void UpdateDomainDate(int domainId, string stroredProcedure, DateTime date) { - SqlHelper.ExecuteReader( + SqlHelper.ExecuteNonQuery( ConnectionString, CommandType.StoredProcedure, stroredProcedure, @@ -4804,6 +4814,19 @@ namespace WebsitePanel.EnterpriseServer ); } + public static void UpdateDomainDates(int domainId, DateTime? domainCreationDate, DateTime? domainExpirationDate, DateTime? domainLastUpdateDate) + { + SqlHelper.ExecuteNonQuery( + ConnectionString, + CommandType.StoredProcedure, + "UpdateDomainDates", + new SqlParameter("@DomainId", domainId), + new SqlParameter("@DomainCreationDate", domainCreationDate), + new SqlParameter("@DomainExpirationDate", domainExpirationDate), + new SqlParameter("@DomainLastUpdateDate", domainLastUpdateDate) + ); + } + #endregion } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs index 8a5d68e3..44ec6c81 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/DnsServers/DnsServerController.cs @@ -29,6 +29,8 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; +using System.Globalization; +using System.Linq; using System.Xml; using System.Xml.Serialization; using WebsitePanel.Providers; @@ -38,6 +40,12 @@ namespace WebsitePanel.EnterpriseServer { public class DnsServerController : IImportController, IBackupController { + private static string GetAsciiZoneName(string zoneName) + { + var idn = new IdnMapping(); + return idn.GetAscii(zoneName); + } + private static DNSServer GetDNSServer(int serviceId) { DNSServer dns = new DNSServer(); @@ -55,6 +63,9 @@ namespace WebsitePanel.EnterpriseServer // get DNS provider DNSServer dns = GetDNSServer(serviceId); + // Ensure zoneName is in ascii before saving to database + zoneName = GetAsciiZoneName(zoneName); + // check if zone already exists if (dns.ZoneExists(zoneName)) return BusinessErrorCodes.ERROR_DNS_ZONE_EXISTS; @@ -199,7 +210,7 @@ namespace WebsitePanel.EnterpriseServer { // zone item DnsZone zone = primaryZone ? new DnsZone() : new SecondaryDnsZone(); - zone.Name = zoneName; + zone.Name = GetAsciiZoneName(zoneName); zone.PackageId = spaceId; zone.ServiceId = serviceId; int zoneItemId = PackageController.AddPackageItem(zone); @@ -280,6 +291,8 @@ namespace WebsitePanel.EnterpriseServer foreach (GlobalDnsRecord record in records) { + domainName = GetAsciiZoneName(domainName); + DnsRecord rr = new DnsRecord(); rr.RecordType = (DnsRecordType)Enum.Parse(typeof(DnsRecordType), record.RecordType, true); rr.RecordName = Utils.ReplaceStringVariable(record.RecordName, "host_name", hostName, true); @@ -359,8 +372,11 @@ namespace WebsitePanel.EnterpriseServer DNSServer dns = new DNSServer(); ServiceProviderProxy.Init(dns, serviceId); + // IDN: The list of importable names is populated with unicode names, to make it easier for the user + var idn = new IdnMapping(); + if (itemType == typeof(DnsZone)) - items.AddRange(dns.GetZones()); + items.AddRange(dns.GetZones().Select(z => idn.GetUnicode(z))); return items; } @@ -377,7 +393,7 @@ namespace WebsitePanel.EnterpriseServer { // add DNS zone DnsZone zone = new DnsZone(); - zone.Name = itemName; + zone.Name = GetAsciiZoneName(itemName); zone.ServiceId = serviceId; zone.PackageId = packageId; int zoneId = PackageController.AddPackageItem(zone); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs index fab50dff..ecf6ebdc 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs @@ -278,11 +278,16 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution } private static void PopulateOrganizationData(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller) - { + { + TaskManager.Write("Stat populate organization data "+org.Name); + if (report.ExchangeReport != null) { + try { + TaskManager.Write("Populate exchange report items"); + PopulateExchangeReportItems(org, report, topReseller); } catch(Exception ex) @@ -295,6 +300,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution { try { + TaskManager.Write("Populate populate CRM report items"); + PopulateCRMReportItems(org, report, topReseller); } catch(Exception ex) @@ -307,6 +314,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution { try { + TaskManager.Write("Populate SharePoint item "); + PopulateSharePointItem(org, report, topReseller); } catch(Exception ex) @@ -319,6 +328,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution { try { + TaskManager.Write("Populate Lync report items"); + PopulateLyncReportItems(org, report, topReseller); } catch (Exception ex) @@ -331,6 +342,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution { try { + TaskManager.Write("Populate Organization statistics report"); + PopulateOrganizationStatisticsReport(org, report, topReseller); } catch(Exception ex) @@ -339,7 +352,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution } } - + TaskManager.Write("End populate organization data " + org.Name); } private static int GetExchangeServiceID(int packageId) @@ -408,6 +421,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution private static void PopulateExchangeReportItems(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller) { + TaskManager.Write("Exchange Report Items " + org.Name); + //Check if exchange organization if (string.IsNullOrEmpty(org.GlobalAddressList)) return; @@ -420,10 +435,14 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution } catch (Exception ex) { + TaskManager.WriteError(ex); + throw new ApplicationException( string.Format("Could not get mailboxes for current organization {0}", org.Id), ex); } + TaskManager.WriteParameter("mailboxes.Count", mailboxes.Count); + try { int exchangeServiceId = GetExchangeServiceID(org.PackageId); @@ -431,6 +450,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution } catch(Exception ex) { + TaskManager.WriteError(ex); + throw new ApplicationException( string.Format("Could not get exchange server. PackageId: {0}", org.PackageId), ex); } @@ -440,6 +461,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution { try { + TaskManager.WriteParameter("mailbox", mailbox.UserPrincipalName); + stats = null; try { @@ -448,6 +471,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution } catch (Exception ex) { + TaskManager.WriteError(ex); + TaskManager.WriteError(ex, "Could not get mailbox statistics. AccountName: {0}", mailbox.UserPrincipalName); } @@ -466,6 +491,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution stats.BlackberryEnabled = BlackBerryController.CheckBlackBerryUserExists(mailbox.AccountId); report.ExchangeReport.Items.Add(stats); + + TaskManager.Write("Items.Add"); } } catch(Exception ex) @@ -473,7 +500,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution TaskManager.WriteError(ex); } } - + + TaskManager.Write("End Populate Exchange Report Items " + org.Name); } @@ -547,6 +575,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution private static void PopulateSpaceData(int packageId, EnterpriseSolutionStatisticsReport report, string topReseller) { + TaskManager.Write("Populate SpaceData " + packageId); + List organizations; try @@ -570,10 +600,14 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution TaskManager.WriteError(ex); } } + + TaskManager.Write("End Populate SpaceData " + packageId); } private static void PopulateUserData(UserInfo user, EnterpriseSolutionStatisticsReport report, string topReseller) { + TaskManager.Write("Populate UserData " + user.Username); + DataSet ds; try { @@ -596,11 +630,14 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution TaskManager.WriteError(ex); } } - + + TaskManager.Write("End Populate UserData " + user.Username); } private static void GetUsersData(EnterpriseSolutionStatisticsReport report, int userId, bool generateExchangeReport, bool generateSharePointReport, bool generateCRMReport, bool generateOrganizationReport, bool generateLyncReport, string topReseller) { + TaskManager.Write("Get UsersData " + userId); + List users; try { @@ -611,9 +648,12 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution throw new ApplicationException("Cannot get users for report", ex); } + TaskManager.WriteParameter("users.Count", users.Count); foreach (UserInfo user in users) { + TaskManager.WriteParameter("User", user.Username); + try { PopulateUserData(user, report, topReseller); @@ -631,11 +671,16 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution { TaskManager.WriteError(ex); } - } + } + + TaskManager.Write("End get UsersData " + userId); + } public static EnterpriseSolutionStatisticsReport GetEnterpriseSolutionStatisticsReport(int userId, bool generateExchangeReport, bool generateSharePointReport, bool generateCRMReport, bool generateOrganizationReport, bool generateLyncReport) { + TaskManager.Write("Get enterprise solution statistics report " + userId); + EnterpriseSolutionStatisticsReport report = new EnterpriseSolutionStatisticsReport(); if (generateExchangeReport || generateOrganizationReport) @@ -647,7 +692,6 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution if (generateLyncReport || generateOrganizationReport) report.LyncReport = new LyncStatisticsReport(); - if (generateCRMReport || generateOrganizationReport) report.CRMReport = new CRMStatisticsReport(); @@ -664,6 +708,8 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution TaskManager.WriteError(ex, "Cannot get enterprise solution statistics report"); } + TaskManager.Write("End get enterprise solution statistics report " + userId); + return report; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs index e9f2f848..623b6a08 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Packages/PackageController.cs @@ -980,11 +980,13 @@ namespace WebsitePanel.EnterpriseServer homeFolder.PackageId = packageId; homeFolder.Name = path; + int res = AddPackageItem(homeFolder); + // Added By Haya UpdatePackageHardQuota(packageId); // save package item - return AddPackageItem(homeFolder); + return res; } public static DateTime GetPackageBandwidthUpdate(int packageId) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index c3c154a7..2c21c32f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -68,6 +68,11 @@ namespace WebsitePanel.EnterpriseServer return AddRdsCollectionInternal(itemId, collection); } + public static ResultObject EditRdsCollection(int itemId, RdsCollection collection) + { + return EditRdsCollectionInternal(itemId, collection); + } + public static RdsCollectionPaged GetRdsCollectionsPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { return GetRdsCollectionsPagedInternal(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows); @@ -93,9 +98,9 @@ namespace WebsitePanel.EnterpriseServer return GetFreeRdsServersPagedInternal(filterColumn, filterValue, sortColumn, startRow, maximumRows); } - public static RdsServersPaged GetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + public static RdsServersPaged GetOrganizationRdsServersPaged(int itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { - return GetOrganizationRdsServersPagedInternal(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows); + return GetOrganizationRdsServersPagedInternal(itemId, collectionId, filterColumn, filterValue, sortColumn, startRow, maximumRows); } public static RdsServersPaged GetOrganizationFreeRdsServersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) @@ -198,6 +203,16 @@ namespace WebsitePanel.EnterpriseServer return GetOrganizationRdsUsersCountInternal(itemId); } + public static List GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp) + { + return GetApplicationUsersInternal(itemId, collectionId, remoteApp); + } + + public static ResultObject SetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp, List users) + { + return SetApplicationUsersInternal(itemId, collectionId, remoteApp, users); + } + private static RdsCollection GetRdsCollectionInternal(int collectionId) { var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId)); @@ -285,6 +300,58 @@ namespace WebsitePanel.EnterpriseServer return result; } + private static ResultObject EditRdsCollectionInternal(int itemId, RdsCollection collection) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "EDIT_RDS_COLLECTION"); + + try + { + Organization org = OrganizationController.GetOrganization(itemId); + + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var existingServers = + ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList(); + var removedServers = existingServers.Where(x => !collection.Servers.Select(y => y.Id).Contains(x.Id)); + var newServers = collection.Servers.Where(x => !existingServers.Select(y => y.Id).Contains(x.Id)); + + foreach(var server in removedServers) + { + DataProvider.RemoveRDSServerFromCollection(server.Id); + } + + rds.AddRdsServersToDeployment(newServers.ToArray()); + + foreach (var server in newServers) + { + DataProvider.AddRDSServerToCollection(server.Id, collection.Id); + } + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + private static RdsCollectionPaged GetRdsCollectionsPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { DataSet ds = DataProvider.GetRDSCollectionsPaged(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows); @@ -425,9 +492,9 @@ namespace WebsitePanel.EnterpriseServer return result; } - private static RdsServersPaged GetOrganizationRdsServersPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + private static RdsServersPaged GetOrganizationRdsServersPagedInternal(int itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { - DataSet ds = DataProvider.GetRDSServersPaged(itemId, null, filterColumn, filterValue, sortColumn, startRow, maximumRows, ignoreRdsCollectionId: true); + DataSet ds = DataProvider.GetRDSServersPaged(itemId, collectionId, filterColumn, filterValue, sortColumn, startRow, maximumRows, ignoreRdsCollectionId: !collectionId.HasValue); RdsServersPaged result = new RdsServersPaged(); result.RecordsCount = (int)ds.Tables[0].Rows[0][0]; @@ -775,7 +842,7 @@ namespace WebsitePanel.EnterpriseServer private static List GetRdsCollectionUsersInternal(int collectionId) { return ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSCollectionUsersByRDSCollectionId(collectionId)); - } + } private static ResultObject SetUsersToRdsCollectionInternal(int itemId, int collectionId, List users) { @@ -855,6 +922,61 @@ namespace WebsitePanel.EnterpriseServer return result; } + private static List GetApplicationUsersInternal(int itemId, int collectionId, RemoteApplication remoteApp) + { + var result = new List(); + Organization org = OrganizationController.GetOrganization(itemId); + + if (org == null) + { + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var collection = GetRdsCollection(collectionId); + + result.AddRange(rds.GetApplicationUsers(collection.Name, remoteApp.DisplayName)); + + return result; + } + + private static ResultObject SetApplicationUsersInternal(int itemId, int collectionId, RemoteApplication remoteApp, List users) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "SET_REMOTE_APP_USERS"); + + try + { + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + result.IsSuccess = false; + result.AddError("", new NullReferenceException("Organization not found")); + return result; + } + + var collection = GetRdsCollection(collectionId); + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + rds.SetApplicationUsers(collection.Name, remoteApp, users.ToArray()); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_SET_REMOTE_APP_USERS", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + private static ResultObject AddRemoteApplicationToCollectionInternal(int itemId, RdsCollection collection, RemoteApplication remoteApp) { var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_REMOTE_APP_TO_COLLECTION"); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs index 3c08a751..ef0cce8d 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Net.Mail; using System.Text; using System.Text.RegularExpressions; +using System.Threading; using WebsitePanel.Providers.DomainLookup; using Whois.NET; @@ -31,6 +32,8 @@ namespace WebsitePanel.EnterpriseServer var checkedDomains = new List(); var expiredDomains = new List(); var nonExistenDomains = new List(); + var allDomains = new List(); + var allTopLevelDomains = new List(); // get input parameters int daysBeforeNotify; @@ -55,11 +58,11 @@ namespace WebsitePanel.EnterpriseServer { var domains = ServerController.GetDomains(package.PackageId); - var subDomains = domains.Where(x => x.IsSubDomain).ToList(); + allDomains.AddRange(domains); - var topLevelDomains = domains = domains.Where(x => !x.IsSubDomain && !x.IsDomainPointer).ToList(); //Selecting top-level domains + domains = domains.Where(x => !x.IsSubDomain && !x.IsDomainPointer).ToList(); //Selecting top-level domains - domains = topLevelDomains.Where(x => x.CreationDate == null || x.ExpirationDate == null ? true : CheckDomainExpiration(x.ExpirationDate, daysBeforeNotify)).ToList(); // selecting expired or with empty expire date domains + allTopLevelDomains.AddRange(domains); var domainUser = UserController.GetUser(package.UserId); @@ -88,16 +91,30 @@ namespace WebsitePanel.EnterpriseServer { nonExistenDomains.Add(domain); } + + Thread.Sleep(100); } + } - foreach (var subDomain in subDomains) + var subDomains = allDomains.Where(x => x.ExpirationDate == null || CheckDomainExpiration(x.ExpirationDate, daysBeforeNotify)).GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); + allTopLevelDomains = allTopLevelDomains.GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); + + foreach (var subDomain in subDomains) + { + var mainDomain = allTopLevelDomains.Where(x => subDomain.DomainId != x.DomainId && subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ; + + if (mainDomain != null) { - var mainDomain = topLevelDomains.Where(x => subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ; + ServerController.UpdateDomainRegistrationData(subDomain, mainDomain.CreationDate, mainDomain.ExpirationDate); - if (mainDomain != null) + var nonExistenDomain = nonExistenDomains.FirstOrDefault(x => subDomain.DomainId == x.DomainId); + + if (nonExistenDomain != null) { - ServerController.UpdateDomainRegistrationData(subDomain, mainDomain.CreationDate, mainDomain.ExpirationDate); + nonExistenDomains.Remove(nonExistenDomain); } + + Thread.Sleep(100); } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs index a1a49534..d5e042c1 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Net.Mail; using System.Text; using System.Text.RegularExpressions; +using System.Threading; using WebsitePanel.Providers.DNS; using WebsitePanel.Providers.DomainLookup; using WebsitePanel.Server; @@ -25,12 +26,15 @@ namespace WebsitePanel.EnterpriseServer private const string MxRecordPattern = @"mail exchanger = (.+)"; private const string NsRecordPattern = @"nameserver = (.+)"; - + private const string DnsTimeOutMessage = @"dns request timed out"; + private const int DnsTimeOutRetryCount = 3; + public override void DoWork() { BackgroundTask topTask = TaskManager.TopTask; List domainsChanges = new List(); + var domainUsers = new Dictionary(); // get input parameters string dnsServersString = (string)topTask.GetParamValue(DnsServersParameter); @@ -82,34 +86,41 @@ namespace WebsitePanel.EnterpriseServer continue; } + if (!domainUsers.ContainsKey(domain.PackageId)) + { + var domainUser = UserController.GetUser(packages.First(x=>x.PackageId == domain.PackageId).UserId); + + domainUsers.Add(domain.PackageId, domainUser); + } + DomainDnsChanges domainChanges = new DomainDnsChanges(); domainChanges.DomainName = domain.DomainName; + domainChanges.PackageId = domain.PackageId; - var mxRecords = ObjectUtils.CreateListFromDataReader(DataProvider.GetDomainDnsRecords(domain.DomainId, DnsRecordType.MX)); - var nsRecords = ObjectUtils.CreateListFromDataReader(DataProvider.GetDomainDnsRecords(domain.DomainId, DnsRecordType.NS)); + var dbDnsRecords = ObjectUtils.CreateListFromDataReader(DataProvider.GetDomainAllDnsRecords(domain.DomainId)); //execute server foreach (var dnsServer in dnsServers) { - var dnsMxRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.MX); - var dnsNsRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.NS); + var dnsMxRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.MX) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.MX).ToList(); + var dnsNsRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.NS) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.NS).ToList(); FillRecordData(dnsMxRecords, domain, dnsServer); FillRecordData(dnsNsRecords, domain, dnsServer); - domainChanges.DnsChanges.AddRange(ApplyDomainRecordsChanges(mxRecords, dnsMxRecords, dnsServer)); - domainChanges.DnsChanges.AddRange(ApplyDomainRecordsChanges(nsRecords, dnsNsRecords, dnsServer)); + domainChanges.DnsChanges.AddRange(ApplyDomainRecordsChanges(dbDnsRecords.Where(x => x.RecordType == DnsRecordType.MX), dnsMxRecords, dnsServer)); + domainChanges.DnsChanges.AddRange(ApplyDomainRecordsChanges(dbDnsRecords.Where(x => x.RecordType == DnsRecordType.NS), dnsNsRecords, dnsServer)); + + domainChanges.DnsChanges = CombineDnsRecordChanges(domainChanges.DnsChanges, dnsServer).ToList(); } domainsChanges.Add(domainChanges); } } - TaskManager.Write(string.Format("Domains checked: {0}", domainsChanges.Count)); - var changedDomains = FindDomainsWithChangedRecords(domainsChanges); - SendMailMessage(user, changedDomains); + SendMailMessage(user, changedDomains, domainUsers); } @@ -152,13 +163,13 @@ namespace WebsitePanel.EnterpriseServer if (dnsRecord != null) { - dnsRecordChanges.Add(new DnsRecordInfoChange { Record = record, Type = record.RecordType, Status = DomainDnsRecordStatuses.NotChanged, DnsServer = dnsServer }); + dnsRecordChanges.Add(new DnsRecordInfoChange { OldRecord = record, NewRecord = dnsRecord, Type = record.RecordType, Status = DomainDnsRecordStatuses.NotChanged, DnsServer = dnsServer }); dnsRecords.Remove(dnsRecord); } else { - dnsRecordChanges.Add(new DnsRecordInfoChange { Record = record, Type = record.RecordType, Status = DomainDnsRecordStatuses.Removed, DnsServer = dnsServer }); + dnsRecordChanges.Add(new DnsRecordInfoChange { OldRecord = record, NewRecord = new DnsRecordInfo { Value = string.Empty}, Type = record.RecordType, Status = DomainDnsRecordStatuses.Removed, DnsServer = dnsServer }); RemoveRecord(record); } @@ -166,7 +177,7 @@ namespace WebsitePanel.EnterpriseServer foreach (var record in dnsRecords) { - dnsRecordChanges.Add(new DnsRecordInfoChange { Record = record, Type = record.RecordType, Status = DomainDnsRecordStatuses.Added, DnsServer= dnsServer}); + dnsRecordChanges.Add(new DnsRecordInfoChange { OldRecord = new DnsRecordInfo { Value = string.Empty }, NewRecord = record, Type = record.RecordType, Status = DomainDnsRecordStatuses.Added, DnsServer = dnsServer }); AddRecord(record); } @@ -174,6 +185,39 @@ namespace WebsitePanel.EnterpriseServer return dnsRecordChanges; } + private IEnumerable CombineDnsRecordChanges(IEnumerable records, string dnsServer) + { + var resultRecords = records.Where(x => x.DnsServer == dnsServer).ToList(); + + var recordsToRemove = new List(); + + var removedRecords = records.Where(x => x.Status == DomainDnsRecordStatuses.Removed); + var addedRecords = records.Where(x => x.Status == DomainDnsRecordStatuses.Added); + + foreach (DnsRecordType type in (DnsRecordType[])Enum.GetValues(typeof(DnsRecordType))) + { + foreach (var removedRecord in removedRecords.Where(x => x.Type == type)) + { + var addedRecord = addedRecords.FirstOrDefault(x => x.Type == type && !recordsToRemove.Contains(x)); + + if (addedRecord != null) + { + recordsToRemove.Add(addedRecord); + + removedRecord.NewRecord = addedRecord.NewRecord; + removedRecord.Status = DomainDnsRecordStatuses.Updated; + } + } + } + + foreach (var record in recordsToRemove) + { + resultRecords.Remove(record); + } + + return resultRecords; + } + private void FillRecordData(IEnumerable records, DomainInfo domain, string dnsServer) { foreach (var record in records) @@ -200,6 +244,8 @@ namespace WebsitePanel.EnterpriseServer private void RemoveRecord(DnsRecordInfo dnsRecord) { DataProvider.DeleteDomainDnsRecord(dnsRecord.Id); + + Thread.Sleep(100); } private void AddRecords(IEnumerable dnsRecords) @@ -213,9 +259,11 @@ namespace WebsitePanel.EnterpriseServer private void AddRecord(DnsRecordInfo dnsRecord) { DataProvider.AddDomainDnsRecord(dnsRecord); + + Thread.Sleep(100); } - private void SendMailMessage(UserInfo user, IEnumerable domainsChanges) + private void SendMailMessage(UserInfo user, IEnumerable domainsChanges, Dictionary domainUsers) { BackgroundTask topTask = TaskManager.TopTask; @@ -249,6 +297,7 @@ namespace WebsitePanel.EnterpriseServer Hashtable items = new Hashtable(); items["user"] = user; + items["DomainUsers"] = domainUsers; items["Domains"] = domainsChanges; body = PackageController.EvaluateTemplate(body, items); @@ -264,7 +313,20 @@ namespace WebsitePanel.EnterpriseServer var args = string.Format("-type={0} {1} {2}", recordType, domain, dnsServer); // execute system command - var raw = winServer.ExecuteSystemCommand(command, args); + var raw = string.Empty; + int triesCount = 0; + + do + { + raw = winServer.ExecuteSystemCommand(command, args); + } + while (raw.ToLowerInvariant().Contains(DnsTimeOutMessage) && ++triesCount < DnsTimeOutRetryCount); + + //timeout check + if (raw.ToLowerInvariant().Contains(DnsTimeOutMessage)) + { + return null; + } var records = ParseNsLookupResult(raw, dnsServer, recordType); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/HostedSolutionReport.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/HostedSolutionReport.cs index e0209bc1..e7f82265 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/HostedSolutionReport.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/HostedSolutionReport.cs @@ -32,6 +32,7 @@ using System.IO; using System.Net.Mail; using System.Net.Mime; using System.Text; +using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer.Code.HostedSolution; using WebsitePanel.Providers.HostedSolution; @@ -51,6 +52,8 @@ namespace WebsitePanel.EnterpriseServer { try { + TaskManager.Write("Start HostedSolutionReportTask"); + BackgroundTask topTask = TaskManager.TopTask; bool isExchange = Utils.ParseBool(topTask.GetParamValue(EXCHANGE_REPORT), false); @@ -61,23 +64,41 @@ namespace WebsitePanel.EnterpriseServer string email = topTask.GetParamValue(EMAIL).ToString(); + TaskManager.WriteParameter("isExchange",isExchange); + TaskManager.WriteParameter("isSharePoint",isSharePoint); + TaskManager.WriteParameter("isLync", isLync); + TaskManager.WriteParameter("isCRM", isCRM); + TaskManager.WriteParameter("isOrganization", isOrganization); + TaskManager.WriteParameter("email", email); UserInfo user = PackageController.GetPackageOwner(topTask.PackageId); + + TaskManager.WriteParameter("user", user.Username); + EnterpriseSolutionStatisticsReport report = ReportController.GetEnterpriseSolutionStatisticsReport(user.UserId, isExchange, isSharePoint, isCRM, isOrganization, isLync); + TaskManager.WriteParameter("report.ExchangeReport.Items.Count", report.ExchangeReport.Items.Count); + TaskManager.WriteParameter("report.SharePointReport.Items.Count", report.SharePointReport.Items.Count); + TaskManager.WriteParameter("report.CRMReport.Items.Count", report.CRMReport.Items.Count); + TaskManager.WriteParameter("report.OrganizationReport.Items.Count", report.OrganizationReport.Items.Count); + TaskManager.WriteParameter("report.LyncReport.Items.Count", report.LyncReport.Items.Count); SendMessage(user, email, isExchange && report.ExchangeReport != null ? report.ExchangeReport.ToCSV() : string.Empty, isSharePoint && report.SharePointReport != null ? report.SharePointReport.ToCSV() : string.Empty, isCRM && report.CRMReport != null ? report.CRMReport.ToCSV() : string.Empty, isOrganization && report.OrganizationReport != null ? report.OrganizationReport.ToCSV() : string.Empty, isLync && report.LyncReport != null ? report.LyncReport.ToCSV() : string.Empty); + } catch(Exception ex) { TaskManager.WriteError(ex); } + + TaskManager.Write("End HostedSolutionReportTask"); + } @@ -97,6 +118,8 @@ namespace WebsitePanel.EnterpriseServer private void SendMessage(UserInfo user,string email, string exchange_csv, string sharepoint_csv, string crm_csv, string organization_csv, string lync_csv) { + TaskManager.Write("SendMessage"); + List attacments = new List(); PrepareAttament("exchange.csv", exchange_csv, attacments); PrepareAttament("sharepoint.csv", sharepoint_csv, attacments); @@ -104,9 +127,6 @@ namespace WebsitePanel.EnterpriseServer PrepareAttament("crm.csv", crm_csv, attacments); PrepareAttament("organization.csv", organization_csv, attacments); - - - // get letter settings UserSettings settings = UserController.GetUserSettings(user.UserId, UserSettings.HOSTED_SOLUTION_REPORT); @@ -116,9 +136,29 @@ namespace WebsitePanel.EnterpriseServer string body = user.HtmlMail ? settings["HtmlBody"] : settings["TextBody"]; bool isHtml = user.HtmlMail; - MailPriority priority = MailPriority.Normal; + MailPriority priority = MailPriority.Normal; + + TaskManager.WriteParameter("from", from); + TaskManager.WriteParameter("email", email); + TaskManager.WriteParameter("subject", subject); + TaskManager.WriteParameter("body", body); + - MailHelper.SendMessage(from, email, cc, subject, body, priority, isHtml, attacments.ToArray()); + int res = MailHelper.SendMessage(from, email, cc, subject, body, priority, isHtml, attacments.ToArray()); + + if (res==0) + { + TaskManager.Write("SendMessage OK"); + } + else + { + TaskManager.WriteError("SendMessage error ", "error code", res.ToString()); + } + + TaskManager.WriteParameter("", res); + + TaskManager.Write("End SendMessage"); + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Scheduling/Scheduler.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Scheduling/Scheduler.cs index 6773f712..d3a65dd4 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Scheduling/Scheduler.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Scheduling/Scheduler.cs @@ -45,7 +45,7 @@ namespace WebsitePanel.EnterpriseServer public static SchedulerJob nextSchedule = null; public static void Start() - { + { ScheduleTasks(); } @@ -73,7 +73,7 @@ namespace WebsitePanel.EnterpriseServer private static void RunManualTasks() { - var tasks = TaskController.GetProcessTasks(BackgroundTaskStatus.Stopping); + var tasks = TaskController.GetProcessTasks(BackgroundTaskStatus.Stopping); foreach (var task in tasks) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs index 507ae075..220ee79d 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs @@ -30,6 +30,7 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Data; +using System.Linq; using System.Net; using System.Xml; using WebsitePanel.Providers; @@ -42,6 +43,8 @@ using WebsitePanel.Providers.HostedSolution; using Whois.NET; using System.Text.RegularExpressions; using WebsitePanel.Providers.DomainLookup; +using System.Globalization; +using System.Linq; namespace WebsitePanel.EnterpriseServer { @@ -72,6 +75,9 @@ namespace WebsitePanel.EnterpriseServer @"expires:(.+)" //.fi }; + private static List _datePatterns = new List { @"ddd MMM dd HH:mm:ss G\MT yyyy" + }; + #region Servers public static List GetAllServers() { @@ -1641,11 +1647,16 @@ namespace WebsitePanel.EnterpriseServer { var result = new List(); - var mxRecords = ObjectUtils.CreateListFromDataReader(DataProvider.GetDomainDnsRecords(domainId, DnsRecordType.MX)); - var nsRecords = ObjectUtils.CreateListFromDataReader(DataProvider.GetDomainDnsRecords(domainId, DnsRecordType.NS)); + var records = ObjectUtils.CreateListFromDataReader(DataProvider.GetDomainAllDnsRecords(domainId)); - result.AddRange(mxRecords); - result.AddRange(nsRecords); + var activeDomain = records.OrderByDescending(x => x.Date).FirstOrDefault(); + + if (activeDomain != null) + { + records = records.Where(x => x.DnsServer == activeDomain.DnsServer).ToList(); + } + + result.AddRange(records); return result; } @@ -2178,11 +2189,13 @@ namespace WebsitePanel.EnterpriseServer } } + // Find and delete all zone items for this domain + var zoneItems = PackageController.GetPackageItemsByType(domain.PackageId, ResourceGroups.Dns, typeof (DnsZone)); + zoneItems.AddRange(PackageController.GetPackageItemsByType(domain.PackageId, ResourceGroups.Dns, typeof(SecondaryDnsZone))); - // remove DNS zone meta-item if required - if (domain.ZoneItemId > 0) + foreach (var zoneItem in zoneItems.Where(z => z.Name == domain.ZoneName)) { - PackageController.DeletePackageItem(domain.ZoneItemId); + PackageController.DeletePackageItem(zoneItem.Id); } // delete domain @@ -2680,26 +2693,20 @@ namespace WebsitePanel.EnterpriseServer public static DomainInfo UpdateDomainRegistrationData(DomainInfo domain) { + DateTime? createdDate = null; + DateTime? expiredDate = null; + try { - DataProvider.UpdateDomainLastUpdateDate(domain.DomainId, DateTime.Now); - var whoisResult = WhoisClient.Query(domain.DomainName.ToLowerInvariant()); - var createdDate = GetDomainInfoDate(whoisResult.Raw, _createdDatePatterns); - var expiredDate = GetDomainInfoDate(whoisResult.Raw, _expiredDatePatterns); + createdDate = GetDomainInfoDate(whoisResult.Raw, _createdDatePatterns); + expiredDate = GetDomainInfoDate(whoisResult.Raw, _expiredDatePatterns); - if (createdDate != null) - { - domain.CreationDate = createdDate; - DataProvider.UpdateDomainCreationDate(domain.DomainId, createdDate.Value); - } + domain.CreationDate = createdDate; + domain.ExpirationDate = expiredDate; - if (expiredDate != null) - { - domain.ExpirationDate = expiredDate; - DataProvider.UpdateDomainExpirationDate(domain.DomainId, expiredDate.Value); - } + DataProvider.UpdateDomainDates(domain.DomainId, createdDate, expiredDate, DateTime.Now); } catch (Exception e) { @@ -2711,19 +2718,10 @@ namespace WebsitePanel.EnterpriseServer public static DomainInfo UpdateDomainRegistrationData(DomainInfo domain, DateTime? creationDate, DateTime? expirationDate) { - if (creationDate != null) - { - domain.CreationDate = creationDate; - DataProvider.UpdateDomainCreationDate(domain.DomainId, creationDate.Value); - } + DataProvider.UpdateDomainDates(domain.DomainId, creationDate, expirationDate, DateTime.Now); - if (expirationDate != null) - { - domain.ExpirationDate = expirationDate; - DataProvider.UpdateDomainExpirationDate(domain.DomainId, expirationDate.Value); - } - - DataProvider.UpdateDomainLastUpdateDate(domain.DomainId, DateTime.Now); + domain.CreationDate = creationDate; + domain.ExpirationDate = expirationDate; return domain; } @@ -2738,7 +2736,7 @@ namespace WebsitePanel.EnterpriseServer { if (match.Success && match.Groups.Count == 2) { - return DateTime.Parse(match.Groups[1].ToString().Trim()); + return ParseDate(match.Groups[1].ToString().Trim()); } } } @@ -2746,6 +2744,21 @@ namespace WebsitePanel.EnterpriseServer return null; } + private static DateTime? ParseDate(string dateString) + { + var result = DateTime.MinValue; + + foreach (var datePattern in _datePatterns) + { + if (DateTime.TryParseExact(dateString, datePattern, CultureInfo.InvariantCulture, DateTimeStyles.None, out result)) + { + return result; + } + } + + return DateTime.Parse(dateString); + } + #endregion #region DNS Zones @@ -2763,7 +2776,7 @@ namespace WebsitePanel.EnterpriseServer DNSServer dns = new DNSServer(); ServiceProviderProxy.Init(dns, zoneItem.ServiceId); - return dns.GetZoneRecords(domain.DomainName); + return dns.GetZoneRecords(zoneItem.Name); } return new DnsRecord[] { }; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs index d86b9733..f05d3ca3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs @@ -70,6 +70,12 @@ namespace WebsitePanel.EnterpriseServer return RemoteDesktopServicesController.AddRdsCollection(itemId, collection); } + [WebMethod] + public ResultObject EditRdsCollection(int itemId, RdsCollection collection) + { + return RemoteDesktopServicesController.EditRdsCollection(itemId, collection); + } + [WebMethod] public RdsCollectionPaged GetRdsCollectionsPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) @@ -101,10 +107,10 @@ namespace WebsitePanel.EnterpriseServer } [WebMethod] - public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue, + public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { - return RemoteDesktopServicesController.GetOrganizationRdsServersPaged(itemId, filterColumn, filterValue, + return RemoteDesktopServicesController.GetOrganizationRdsServersPaged(itemId, collectionId, filterColumn, filterValue, sortColumn, startRow, maximumRows); } @@ -230,5 +236,16 @@ namespace WebsitePanel.EnterpriseServer return RemoteDesktopServicesController.GetOrganizationRdsUsersCount(itemId); } + [WebMethod] + public List GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp) + { + return RemoteDesktopServicesController.GetApplicationUsers(itemId, collectionId, remoteApp); + } + + [WebMethod] + public ResultObject SetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp, List users) + { + return RemoteDesktopServicesController.SetApplicationUsers(itemId, collectionId, remoteApp, users); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DnsRecordInfoChange.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DnsRecordInfoChange.cs index 183c16e0..a5c0306b 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DnsRecordInfoChange.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DnsRecordInfoChange.cs @@ -9,7 +9,8 @@ namespace WebsitePanel.Providers.DomainLookup public class DnsRecordInfoChange { public string DnsServer { get; set; } - public DnsRecordInfo Record { get; set; } + public DnsRecordInfo OldRecord { get; set; } + public DnsRecordInfo NewRecord { get; set; } public DomainDnsRecordStatuses Status { get; set; } public DnsRecordType Type { get; set; } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsChanges.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsChanges.cs index ff178e77..3f19ef39 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsChanges.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsChanges.cs @@ -8,6 +8,7 @@ namespace WebsitePanel.Providers.DomainLookup public class DomainDnsChanges { public string DomainName { get; set; } + public int PackageId { get; set; } public List DnsChanges { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsRecordStatuses.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsRecordStatuses.cs index 88fa25ed..33bddf37 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsRecordStatuses.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsRecordStatuses.cs @@ -9,6 +9,7 @@ namespace WebsitePanel.Providers.DomainLookup { NotChanged, Removed, - Added + Added, + Updated } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs index db2e114c..6de22e8d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs @@ -40,6 +40,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices public interface IRemoteDesktopServices { bool CreateCollection(string organizationId, RdsCollection collection); + bool AddRdsServersToDeployment(RdsServer[] servers); RdsCollection GetCollection(string collectionName); bool RemoveCollection(string organizationId, string collectionName); bool SetUsersInCollection(string organizationId, string collectionName, List users); @@ -60,5 +61,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices bool CheckSessionHostFeatureInstallation(string hostName); bool CheckServerAvailability(string hostName); + string[] GetApplicationUsers(string collectionName, string applicationName); + bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users); } } 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 index f6df0ed1..3389e9ec 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/WebsitePanel.Providers.Mail.IceWarp.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/WebsitePanel.Providers.Mail.IceWarp.csproj @@ -17,7 +17,7 @@ true full false - ..\WebsitePanel.Server\bin\ + ..\WebsitePanel.Server\bin\IceWarp\ DEBUG;TRACE prompt 4 @@ -25,7 +25,7 @@ pdbonly true - ..\WebsitePanel.Server\bin\ + ..\WebsitePanel.Server\bin\IceWarp\ TRACE prompt 4 @@ -48,10 +48,12 @@ {684C932A-6C75-46AC-A327-F3689D89EB42} WebsitePanel.Providers.Base + False {E91E52F3-9555-4D00-B577-2B1DBDD87CA7} WebsitePanel.Server.Utils + False diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs index 2622425f..010e6ee5 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.OS.Windows2012/Windows2012.cs @@ -80,10 +80,12 @@ namespace WebsitePanel.Providers.OS { Log.WriteStart("SetQuotaLimitOnFolder"); Log.WriteInfo("FolderPath : {0}", folderPath); - Log.WriteInfo("ShareNameDrive : {0}", shareNameDrive); Log.WriteInfo("QuotaLimit : {0}", quotaLimit); - string path = Path.Combine(shareNameDrive + @":\", folderPath); + string path = folderPath; + + if (shareNameDrive != null) + path = Path.Combine(shareNameDrive + @":\", folderPath); Runspace runSpace = null; try diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 1e8d85bc..16552df1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -169,6 +169,35 @@ namespace WebsitePanel.Providers.RemoteDesktopServices #region RDS Collections + public bool AddRdsServersToDeployment(RdsServer[] servers) + { + var result = true; + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + + foreach (var server in servers) + { + if (!ExistRdsServerInDeployment(runSpace, server)) + { + AddRdsServerToDeployment(runSpace, server); + } + } + } + catch (Exception e) + { + result = false; + } + finally + { + CloseRunspace(runSpace); + } + + return result; + } + public bool CreateCollection(string organizationId, RdsCollection collection) { var result = true; @@ -467,6 +496,70 @@ namespace WebsitePanel.Providers.RemoteDesktopServices #region Remote Applications + public string[] GetApplicationUsers(string collectionName, string applicationName) + { + Runspace runspace = null; + List result = new List(); + + try + { + runspace = OpenRunspace(); + + Command cmd = new Command("Get-RDRemoteApp"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + cmd.Parameters.Add("DisplayName", applicationName); + + var application = ExecuteShellCommand(runspace, cmd, false).FirstOrDefault(); + + if (application != null) + { + var users = (string[])(GetPSObjectProperty(application, "UserGroups")); + + if (users != null) + { + result.AddRange(users); + } + } + } + finally + { + CloseRunspace(runspace); + } + + return result.ToArray(); + } + + public bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users) + { + Runspace runspace = null; + bool result = true; + + try + { + runspace = OpenRunspace(); + + Command cmd = new Command("Set-RDRemoteApp"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + cmd.Parameters.Add("DisplayName", remoteApp.DisplayName); + cmd.Parameters.Add("UserGroups", users); + cmd.Parameters.Add("Alias", remoteApp.Alias); + + ExecuteShellCommand(runspace, cmd, false).FirstOrDefault(); + } + catch(Exception) + { + result = false; + } + finally + { + CloseRunspace(runspace); + } + + return result; + } + public List GetAvailableRemoteApplications(string collectionName) { var startApps = new List(); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIs80/WebsitePanel.Providers.Web.IIs80.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIs80/WebsitePanel.Providers.Web.IIs80.csproj index dd28ae8c..62f64039 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIs80/WebsitePanel.Providers.Web.IIs80.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Web.IIs80/WebsitePanel.Providers.Web.IIs80.csproj @@ -17,7 +17,7 @@ true full false - ..\WebsitePanel.Server\bin\ + ..\WebsitePanel.Server\bin\IIs80\ DEBUG;TRACE prompt 4 @@ -25,7 +25,7 @@ pdbonly true - ..\WebsitePanel.Server\bin\ + ..\WebsitePanel.Server\bin\IIs80\ TRACE prompt 4 @@ -56,18 +56,22 @@ {684c932a-6c75-46ac-a327-f3689d89eb42} WebsitePanel.Providers.Base + False {9be0317d-e42e-4ff6-9a87-8c801f046ea1} WebsitePanel.Providers.Web.IIs60 + False {1b9dce85-c664-49fc-b6e1-86c63cab88d1} WebsitePanel.Providers.Web.IIs70 + False {e91e52f3-9555-4d00-b577-2b1dbdd87ca7} WebsitePanel.Server.Utils + False diff --git a/WebsitePanel/Sources/WebsitePanel.SchedulerService/SchedulerService.cs b/WebsitePanel/Sources/WebsitePanel.SchedulerService/SchedulerService.cs index 2f017c19..92d0128a 100644 --- a/WebsitePanel/Sources/WebsitePanel.SchedulerService/SchedulerService.cs +++ b/WebsitePanel/Sources/WebsitePanel.SchedulerService/SchedulerService.cs @@ -35,15 +35,16 @@ namespace WebsitePanel.SchedulerService public partial class SchedulerService : ServiceBase { private Timer _Timer; - private static bool _isRuninng; + private static object _isRuninng; #region Construcor public SchedulerService() { + _isRuninng = new object(); + InitializeComponent(); _Timer = new Timer(Process, null, 5000, 5000); - _isRuninng = false; } #endregion @@ -57,12 +58,18 @@ namespace WebsitePanel.SchedulerService protected static void Process(object callback) { //check running service - if (_isRuninng) + if (!Monitor.TryEnter(_isRuninng)) return; - _isRuninng = true; - Scheduler.Start(); - _isRuninng = false; + try + { + Scheduler.Start(); + } + finally + { + Monitor.Exit(_isRuninng); + } + } #endregion diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs index 341c32cf..f3f14bca 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs @@ -31,6 +31,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { private System.Threading.SendOrPostCallback CreateCollectionOperationCompleted; + private System.Threading.SendOrPostCallback AddRdsServersToDeploymentOperationCompleted; + private System.Threading.SendOrPostCallback GetCollectionOperationCompleted; private System.Threading.SendOrPostCallback RemoveCollectionOperationCompleted; @@ -63,6 +65,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { private System.Threading.SendOrPostCallback CheckServerAvailabilityOperationCompleted; + private System.Threading.SendOrPostCallback GetApplicationUsersOperationCompleted; + + private System.Threading.SendOrPostCallback SetApplicationUsersOperationCompleted; + /// public RemoteDesktopServices() { this.Url = "http://localhost:9003/RemoteDesktopServices.asmx"; @@ -71,6 +77,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// public event CreateCollectionCompletedEventHandler CreateCollectionCompleted; + /// + public event AddRdsServersToDeploymentCompletedEventHandler AddRdsServersToDeploymentCompleted; + /// public event GetCollectionCompletedEventHandler GetCollectionCompleted; @@ -119,6 +128,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// public event CheckServerAvailabilityCompletedEventHandler CheckServerAvailabilityCompleted; + /// + public event GetApplicationUsersCompletedEventHandler GetApplicationUsersCompleted; + + /// + public event SetApplicationUsersCompletedEventHandler SetApplicationUsersCompleted; + /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -164,6 +179,48 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } } + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddRdsServersToDeployment", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool AddRdsServersToDeployment(RdsServer[] servers) { + object[] results = this.Invoke("AddRdsServersToDeployment", new object[] { + servers}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginAddRdsServersToDeployment(RdsServer[] servers, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("AddRdsServersToDeployment", new object[] { + servers}, callback, asyncState); + } + + /// + public bool EndAddRdsServersToDeployment(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void AddRdsServersToDeploymentAsync(RdsServer[] servers) { + this.AddRdsServersToDeploymentAsync(servers, null); + } + + /// + public void AddRdsServersToDeploymentAsync(RdsServer[] servers, object userState) { + if ((this.AddRdsServersToDeploymentOperationCompleted == null)) { + this.AddRdsServersToDeploymentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRdsServersToDeploymentOperationCompleted); + } + this.InvokeAsync("AddRdsServersToDeployment", new object[] { + servers}, this.AddRdsServersToDeploymentOperationCompleted, userState); + } + + private void OnAddRdsServersToDeploymentOperationCompleted(object arg) { + if ((this.AddRdsServersToDeploymentCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.AddRdsServersToDeploymentCompleted(this, new AddRdsServersToDeploymentCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -871,6 +928,99 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } } + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetApplicationUsers", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string[] GetApplicationUsers(string collectionName, string applicationName) { + object[] results = this.Invoke("GetApplicationUsers", new object[] { + collectionName, + applicationName}); + return ((string[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetApplicationUsers(string collectionName, string applicationName, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetApplicationUsers", new object[] { + collectionName, + applicationName}, callback, asyncState); + } + + /// + public string[] EndGetApplicationUsers(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string[])(results[0])); + } + + /// + public void GetApplicationUsersAsync(string collectionName, string applicationName) { + this.GetApplicationUsersAsync(collectionName, applicationName, null); + } + + /// + public void GetApplicationUsersAsync(string collectionName, string applicationName, object userState) { + if ((this.GetApplicationUsersOperationCompleted == null)) { + this.GetApplicationUsersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetApplicationUsersOperationCompleted); + } + this.InvokeAsync("GetApplicationUsers", new object[] { + collectionName, + applicationName}, this.GetApplicationUsersOperationCompleted, userState); + } + + private void OnGetApplicationUsersOperationCompleted(object arg) { + if ((this.GetApplicationUsersCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetApplicationUsersCompleted(this, new GetApplicationUsersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetApplicationUsers", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users) { + object[] results = this.Invoke("SetApplicationUsers", new object[] { + collectionName, + remoteApp, + users}); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginSetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SetApplicationUsers", new object[] { + collectionName, + remoteApp, + users}, callback, asyncState); + } + + /// + public bool EndSetApplicationUsers(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void SetApplicationUsersAsync(string collectionName, RemoteApplication remoteApp, string[] users) { + this.SetApplicationUsersAsync(collectionName, remoteApp, users, null); + } + + /// + public void SetApplicationUsersAsync(string collectionName, RemoteApplication remoteApp, string[] users, object userState) { + if ((this.SetApplicationUsersOperationCompleted == null)) { + this.SetApplicationUsersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetApplicationUsersOperationCompleted); + } + this.InvokeAsync("SetApplicationUsers", new object[] { + collectionName, + remoteApp, + users}, this.SetApplicationUsersOperationCompleted, userState); + } + + private void OnSetApplicationUsersOperationCompleted(object arg) { + if ((this.SetApplicationUsersCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SetApplicationUsersCompleted(this, new SetApplicationUsersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { base.CancelAsync(userState); @@ -903,6 +1053,32 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void AddRdsServersToDeploymentCompletedEventHandler(object sender, AddRdsServersToDeploymentCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class AddRdsServersToDeploymentCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal AddRdsServersToDeploymentCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public bool Result { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetCollectionCompletedEventHandler(object sender, GetCollectionCompletedEventArgs e); @@ -1208,4 +1384,56 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetApplicationUsersCompletedEventHandler(object sender, GetApplicationUsersCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetApplicationUsersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetApplicationUsersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SetApplicationUsersCompletedEventHandler(object sender, SetApplicationUsersCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SetApplicationUsersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SetApplicationUsersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public bool Result { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server/DNSServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/DNSServer.asmx.cs index 89c6574a..a4f26d8a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/DNSServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/DNSServer.asmx.cs @@ -28,6 +28,7 @@ using System; using System.ComponentModel; +using System.Globalization; using System.Web.Services; using System.Web.Services.Protocols; using WebsitePanel.Providers; @@ -51,6 +52,12 @@ namespace WebsitePanel.Server get { return (IDnsServer)Provider; } } + private string GetAsciiZoneName(string zoneName) + { + var idn = new IdnMapping(); + return idn.GetAscii(zoneName); + } + #region Zones [WebMethod, SoapHeader("settings")] public bool ZoneExists(string zoneName) @@ -58,7 +65,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' ZoneExists", ProviderSettings.ProviderName); - bool result = DnsProvider.ZoneExists(zoneName); + bool result = DnsProvider.ZoneExists(GetAsciiZoneName(zoneName)); Log.WriteEnd("'{0}' ZoneExists", ProviderSettings.ProviderName); return result; } @@ -92,7 +99,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' AddPrimaryZone", ProviderSettings.ProviderName); - DnsProvider.AddPrimaryZone(zoneName, secondaryServers); + DnsProvider.AddPrimaryZone(GetAsciiZoneName(zoneName), secondaryServers); Log.WriteEnd("'{0}' AddPrimaryZone", ProviderSettings.ProviderName); } catch (Exception ex) @@ -108,7 +115,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' AddSecondaryZone", ProviderSettings.ProviderName); - DnsProvider.AddSecondaryZone(zoneName, masterServers); + DnsProvider.AddSecondaryZone(GetAsciiZoneName(zoneName), masterServers); Log.WriteEnd("'{0}' AddSecondaryZone", ProviderSettings.ProviderName); } catch (Exception ex) @@ -124,7 +131,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' DeleteZone", ProviderSettings.ProviderName); - DnsProvider.DeleteZone(zoneName); + DnsProvider.DeleteZone(GetAsciiZoneName(zoneName)); Log.WriteEnd("'{0}' DeleteZone", ProviderSettings.ProviderName); } catch (Exception ex) @@ -140,7 +147,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' UpdateSoaRecord", ProviderSettings.ProviderName); - DnsProvider.UpdateSoaRecord(zoneName, host, primaryNsServer, primaryPerson); + DnsProvider.UpdateSoaRecord(GetAsciiZoneName(zoneName), host, primaryNsServer, primaryPerson); Log.WriteEnd("'{0}' UpdateSoaRecord", ProviderSettings.ProviderName); } catch (Exception ex) @@ -158,7 +165,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' GetZoneRecords", ProviderSettings.ProviderName); - DnsRecord[] result = DnsProvider.GetZoneRecords(zoneName); + DnsRecord[] result = DnsProvider.GetZoneRecords(GetAsciiZoneName(zoneName)); Log.WriteEnd("'{0}' GetZoneRecords", ProviderSettings.ProviderName); return result; } @@ -175,7 +182,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' AddZoneRecord", ProviderSettings.ProviderName); - DnsProvider.AddZoneRecord(zoneName, record); + DnsProvider.AddZoneRecord(GetAsciiZoneName(zoneName), record); Log.WriteEnd("'{0}' AddZoneRecord", ProviderSettings.ProviderName); } catch (Exception ex) @@ -191,7 +198,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' DeleteZoneRecord", ProviderSettings.ProviderName); - DnsProvider.DeleteZoneRecord(zoneName, record); + DnsProvider.DeleteZoneRecord(GetAsciiZoneName(zoneName), record); Log.WriteEnd("'{0}' DeleteZoneRecord", ProviderSettings.ProviderName); } catch (Exception ex) @@ -207,7 +214,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' AddZoneRecords", ProviderSettings.ProviderName); - DnsProvider.AddZoneRecords(zoneName, records); + DnsProvider.AddZoneRecords(GetAsciiZoneName(zoneName), records); Log.WriteEnd("'{0}' AddZoneRecords", ProviderSettings.ProviderName); } catch (Exception ex) @@ -223,7 +230,7 @@ namespace WebsitePanel.Server try { Log.WriteStart("'{0}' DeleteZoneRecords", ProviderSettings.ProviderName); - DnsProvider.DeleteZoneRecords(zoneName, records); + DnsProvider.DeleteZoneRecords(GetAsciiZoneName(zoneName), records); Log.WriteEnd("'{0}' DeleteZoneRecords", ProviderSettings.ProviderName); } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs index 91d8d444..46ebb460 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs @@ -76,6 +76,23 @@ namespace WebsitePanel.Server } } + [WebMethod, SoapHeader("settings")] + public bool AddRdsServersToDeployment(RdsServer[] servers) + { + try + { + Log.WriteStart("'{0}' AddRdsServersToDeployment", ProviderSettings.ProviderName); + var result = RDSProvider.AddRdsServersToDeployment(servers); + Log.WriteEnd("'{0}' AddRdsServersToDeployment", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' AddRdsServersToDeployment", ProviderSettings.ProviderName), ex); + throw; + } + } + [WebMethod, SoapHeader("settings")] public RdsCollection GetCollection(string collectionName) { @@ -342,6 +359,39 @@ namespace WebsitePanel.Server throw; } } - } + [WebMethod, SoapHeader("settings")] + public string[] GetApplicationUsers(string collectionName, string applicationName) + { + try + { + Log.WriteStart("'{0}' GetApplicationUsers", ProviderSettings.ProviderName); + var result = RDSProvider.GetApplicationUsers(collectionName, applicationName); + Log.WriteEnd("'{0}' GetApplicationUsers", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' GetApplicationUsers", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users) + { + try + { + Log.WriteStart("'{0}' SetApplicationUsers", ProviderSettings.ProviderName); + var result = RDSProvider.SetApplicationUsers(collectionName, remoteApp, users); + Log.WriteEnd("'{0}' SetApplicationUsers", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' SetApplicationUsers", ProviderSettings.ProviderName), ex); + throw; + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server/Web.config b/WebsitePanel/Sources/WebsitePanel.Server/Web.config index fd2b751d..d9d1bde5 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.Server/Web.config @@ -1,46 +1,51 @@ - + -

-
-
+
+
+
+
+
+
+
+
- - - - - + + + + + - + - + - + - + - + @@ -48,85 +53,85 @@ - + - + - + - + - + - - - + + + - + - - - - + + + + - - + + - - - - + + + + - + - + - - + + - + - + - + - - + + - - + + - - + + - - + + @@ -135,40 +140,40 @@ - - + + - + - - + + - - - - - - - + + + + + + + - - + + - - + + - + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj index 544fc997..7cfa6f68 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj @@ -17,7 +17,7 @@ 4.0 - v4.0 + v3.5 false @@ -80,7 +80,6 @@ - diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config index f2f41087..5e7e4ae7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config @@ -141,4 +141,6 @@ + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index b43e286a..da90d397 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -574,6 +574,8 @@ + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/Domains.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/Domains.ascx.resx index 3116414f..8ba7b6a4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/Domains.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/Domains.ascx.resx @@ -213,4 +213,7 @@ Non-Existent + + Current Real DNS Values + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/DomainsAddDomain.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/DomainsAddDomain.ascx.resx index 2389512c..c05e907e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/DomainsAddDomain.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/DomainsAddDomain.ascx.resx @@ -144,18 +144,6 @@ Tick this checkbox if DNS zone for this domain will be located on name servers of your hosting provider. Make sure you changed name servers in the domain registrar control panel. - - Please, enter correct domain name, for example "mydomain.com" or "sub.mydomain.com". - - - * - - - Please enter domain name - - - * - Enable DNS @@ -168,18 +156,6 @@ Assign to existing Web Site - - Please, enter correct sub-domain name, for example "subdomain" or "sub.subdomain". - - - * - - - Please enter sub-domain name - - - * - Hostname: diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/Utils.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/Utils.cs index 0a33b5a7..186614a1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/Utils.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/Utils.cs @@ -159,7 +159,7 @@ namespace WebsitePanel.Portal foreach (string part in parts) if (part.Trim() != "" && !list.Contains(part.Trim())) list.Add(part); - return (string[])list.ToArray(typeof(string)); + return (string[]) list.ToArray(typeof (string)); } public static string ReplaceStringVariable(string str, string variable, string value) @@ -172,7 +172,7 @@ namespace WebsitePanel.Portal { long length = stream.Length; byte[] content = new byte[length]; - stream.Read(content, 0, (int)length); + stream.Read(content, 0, (int) length); stream.Close(); return content; } @@ -231,7 +231,7 @@ namespace WebsitePanel.Portal selValues.Add(item.Value); } - string cookieVal = String.Join(",", (string[])selValues.ToArray(typeof(string))); + string cookieVal = String.Join(",", (string[]) selValues.ToArray(typeof (string))); // create cookie HttpCookie cookie = new HttpCookie(ctrl.UniqueID, cookieVal); @@ -251,7 +251,7 @@ namespace WebsitePanel.Portal foreach (ListItem item in ctrl.Items) item.Selected = false; - string[] vals = cookie.Value.Split(new char[] { ',' }); + string[] vals = cookie.Value.Split(new char[] {','}); foreach (string val in vals) { ListItem item = ctrl.Items.FindByValue(val); @@ -278,9 +278,9 @@ namespace WebsitePanel.Portal // Convert 4 bytes into a 32-bit integer value. int seed = (randomBytes[0] & 0x7f) << 24 | - randomBytes[1] << 16 | - randomBytes[2] << 8 | - randomBytes[3]; + randomBytes[1] << 16 | + randomBytes[2] << 8 | + randomBytes[3]; Random rnd = new Random(seed); @@ -294,17 +294,38 @@ namespace WebsitePanel.Portal public static bool CheckQouta(string key, PackageContext cntx) { return cntx.Quotas.ContainsKey(key) && - ((cntx.Quotas[key].QuotaAllocatedValue == 1 && cntx.Quotas[key].QuotaTypeId == 1) || - (cntx.Quotas[key].QuotaTypeId != 1 && (cntx.Quotas[key].QuotaAllocatedValue > 0 || cntx.Quotas[key].QuotaAllocatedValue == -1))); + ((cntx.Quotas[key].QuotaAllocatedValue == 1 && cntx.Quotas[key].QuotaTypeId == 1) || + (cntx.Quotas[key].QuotaTypeId != 1 && (cntx.Quotas[key].QuotaAllocatedValue > 0 || cntx.Quotas[key].QuotaAllocatedValue == -1))); } public static bool CheckQouta(string key, HostingPlanContext cntx) { return cntx.Quotas.ContainsKey(key) && - ((cntx.Quotas[key].QuotaAllocatedValue == 1 && cntx.Quotas[key].QuotaTypeId == 1) || - (cntx.Quotas[key].QuotaTypeId != 1 && (cntx.Quotas[key].QuotaAllocatedValue > 0 || cntx.Quotas[key].QuotaAllocatedValue == -1))); + ((cntx.Quotas[key].QuotaAllocatedValue == 1 && cntx.Quotas[key].QuotaTypeId == 1) || + (cntx.Quotas[key].QuotaTypeId != 1 && (cntx.Quotas[key].QuotaAllocatedValue > 0 || cntx.Quotas[key].QuotaAllocatedValue == -1))); } + public static bool IsIdnDomain(string domainName) + { + if (string.IsNullOrEmpty(domainName)) + { + return false; + } + + var idn = new IdnMapping(); + return idn.GetAscii(domainName) != domainName; + } + + public static string UnicodeToAscii(string domainName) + { + if (string.IsNullOrEmpty(domainName)) + { + return string.Empty; + } + + var idn = new IdnMapping(); + return idn.GetAscii(domainName); + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs index f8197414..8b8f8f72 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/RDSHelper.cs @@ -66,7 +66,7 @@ namespace WebsitePanel.Portal public RdsServer[] GetOrganizationRdsServersPaged(int itemId, int maximumRows, int startRowIndex, string sortColumn, string filterValue) { - rdsServers = ES.Services.RDS.GetOrganizationRdsServersPaged(itemId, "", filterValue, sortColumn, startRowIndex, maximumRows); + rdsServers = ES.Services.RDS.GetOrganizationRdsServersPaged(itemId, null, "", filterValue, sortColumn, startRowIndex, maximumRows); return rdsServers.Servers; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DnsZoneRecords.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DnsZoneRecords.ascx.cs index 1f323332..d9b78d01 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DnsZoneRecords.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DnsZoneRecords.ascx.cs @@ -30,6 +30,7 @@ using System; using System.Data; using System.Configuration; using System.Collections; +using System.Globalization; using System.Web; using System.Web.Security; using System.Web.UI; @@ -57,6 +58,10 @@ namespace WebsitePanel.Portal // domain name DomainInfo domain = ES.Services.Servers.GetDomain(PanelRequest.DomainID); litDomainName.Text = domain.DomainName; + if (Utils.IsIdnDomain(domain.DomainName)) + { + litDomainName.Text = string.Format("{0} ({1})", Utils.UnicodeToAscii(domain.DomainName), domain.DomainName); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs index da0f5a67..06fb93e2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs @@ -39,6 +39,7 @@ using System.Web.UI.HtmlControls; using System.Linq; using WebsitePanel.EnterpriseServer; +using System.Collections.Generic; namespace WebsitePanel.Portal { @@ -160,7 +161,15 @@ namespace WebsitePanel.Portal return "No Dns Records"; } - return string.Join("\r\n", records.Select(x=>string.Format("{0}: {1}", x.RecordType, x.Value))); + var header = GetLocalizedString("DomainLookup.TooltipHeader"); + + var tooltipLines = new List(); + + tooltipLines.Add(header); + tooltipLines.Add(" "); + tooltipLines.AddRange( records.Select(x=>string.Format("{0}: {1}", x.RecordType, x.Value))); + + return string.Join("\r\n", tooltipLines); } protected void odsDomainsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx index a7b93c8b..e1f91b1b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx @@ -1,33 +1,21 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DomainsAddDomain.ascx.cs" Inherits="WebsitePanel.Portal.DomainsAddDomain" %> <%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> -<%@ Register Src="DomainsSelectDomainControl.ascx" TagName="DomainsSelectDomainControl" TagPrefix="uc1" %> +<%@ Register Src="UserControls/DomainControl.ascx" TagName="DomainControl" TagPrefix="wsp" %> <%@ Register Src="UserControls/CollapsiblePanel.ascx" TagPrefix="wsp" TagName="CollapsiblePanel" %> - +
- -

- - - -

-

- - . - - - +

+

+<%-- +

+ +

--%> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.cs index 0de467dc..017e6797 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.cs @@ -30,6 +30,7 @@ using System; using System.Web; using WebsitePanel.EnterpriseServer; using System.Collections.Generic; +using WebsitePanel.Portal.UserControls; namespace WebsitePanel.Portal { @@ -82,12 +83,12 @@ namespace WebsitePanel.Portal if (type == DomainType.Domain || type == DomainType.DomainPointer) { // domains - DomainPanel.Visible = true; + DomainName.IsSubDomain = false; } else { // sub-domains - SubDomainPanel.Visible = true; + DomainName.IsSubDomain = true; // fill sub-domains if (!IsPostBack) @@ -178,14 +179,14 @@ namespace WebsitePanel.Portal if (!domain.IsDomainPointer && !domain.IsSubDomain && !domain.IsInstantAlias) domains.Add(domain); - DomainsList.DataSource = domains; - DomainsList.DataBind(); + DomainName.DataSource = domains; + DomainName.DataBind(); } private void BindResellerDomains() { - DomainsList.DataSource = ES.Services.Servers.GetResellerDomains(PanelSecurity.PackageId); - DomainsList.DataBind(); + DomainName.DataSource = ES.Services.Servers.GetResellerDomains(PanelSecurity.PackageId); + DomainName.DataBind(); } private void AddDomain() @@ -197,9 +198,7 @@ namespace WebsitePanel.Portal DomainType type = GetDomainType(Request["DomainType"]); // get domain name - string domainName = DomainName.Text.Trim(); - if (type == DomainType.SubDomain || type == DomainType.ProviderSubDomain) - domainName = SubDomainName.Text.Trim() + "." + DomainsList.SelectedValue; + var domainName = DomainName.Text; int pointWebSiteId = 0; int pointMailDomainId = 0; @@ -263,5 +262,13 @@ namespace WebsitePanel.Portal { AddDomain(); } + + protected void DomainName_TextChanged(object sender, DomainControl.DomainNameEventArgs e) + { + // If the choosen domain is a idn domain, don't allow to create mail + var isIdn = Utils.IsIdnDomain(e.DomainName); + PointMailDomainPanel.Enabled = !isIdn; + PointMailDomain.Checked = !isIdn; + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.designer.cs index 6b22fdcc..27f9ad97 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. - //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -74,70 +46,7 @@ namespace WebsitePanel.Portal { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.TextBox DomainName; - - /// - /// DomainRequiredValidator control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator DomainRequiredValidator; - - /// - /// DomainFormatValidator control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RegularExpressionValidator DomainFormatValidator; - - /// - /// SubDomainPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl SubDomainPanel; - - /// - /// SubDomainName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox SubDomainName; - - /// - /// DomainsList control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList DomainsList; - - /// - /// SubDomainRequiredValidator control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator SubDomainRequiredValidator; - - /// - /// SubDomainFormatValidator control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RegularExpressionValidator SubDomainFormatValidator; + protected global::WebsitePanel.Portal.UserControls.DomainControl DomainName; /// /// OptionsPanelHeader control. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsSelectDomainControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsSelectDomainControl.ascx.cs index 5bedfeba..97264617 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsSelectDomainControl.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsSelectDomainControl.ascx.cs @@ -30,6 +30,7 @@ using System; using System.Data; using System.Configuration; using System.Collections; +using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; @@ -44,6 +45,12 @@ namespace WebsitePanel.Portal { public partial class DomainsSelectDomainControl : WebsitePanelControlBase { + public bool HideIdnDomains + { + get { return (ViewState["HideIdnDomains"] != null) && (bool)ViewState["HideIdnDomains"]; } + set { ViewState["HideIdnDomains"] = value; } + } + public bool HideWebSites { get { return (ViewState["HideWebSites"] != null) ? (bool)ViewState["HideWebSites"] : false; } @@ -116,6 +123,11 @@ namespace WebsitePanel.Portal { DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PackageId); + if (HideIdnDomains) + { + domains = domains.Where(d => !Utils.IsIdnDomain(d.DomainName)).ToArray(); + } + WebSite[] sites = null; Hashtable htSites = new Hashtable(); Hashtable htMailDomainPointers = new Hashtable(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddDomainName.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddDomainName.ascx.cs index 69739f33..e3ef0c4f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddDomainName.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeAddDomainName.ascx.cs @@ -28,6 +28,7 @@ using System; using System.Data; +using System.Linq; using System.Text; using System.Collections.Generic; @@ -40,7 +41,7 @@ namespace WebsitePanel.Portal.ExchangeServer { protected void Page_Load(object sender, EventArgs e) { - DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId); + DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId).Where(d => !Utils.IsIdnDomain(d.DomainName)).ToArray(); Organization[] orgs = ES.Services.Organizations.GetOrganizations(PanelSecurity.PackageId, false); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationAddDomainName.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationAddDomainName.ascx.cs index abcd110c..0bef0f9b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationAddDomainName.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationAddDomainName.ascx.cs @@ -28,6 +28,7 @@ using System; using System.Data; +using System.Linq; using System.Text; using System.Collections.Generic; @@ -40,7 +41,7 @@ namespace WebsitePanel.Portal.ExchangeServer { protected void Page_Load(object sender, EventArgs e) { - DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId); + DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId).Where(d => !Utils.IsIdnDomain(d.DomainName)).ToArray(); Organization[] orgs = ES.Services.Organizations.GetOrganizations(PanelSecurity.PackageId, false); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateOrganization.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateOrganization.ascx.cs index 073033fa..12ebbdf2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateOrganization.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateOrganization.ascx.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; +using System.Linq; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.HostedSolution; @@ -37,7 +38,7 @@ namespace WebsitePanel.Portal.ExchangeServer { protected void Page_Load(object sender, EventArgs e) { - DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId); + DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId).Where(d => !Utils.IsIdnDomain(d.DomainName)).ToArray(); Organization[] orgs = ES.Services.Organizations.GetOrganizations(PanelSecurity.PackageId, false); var list = new List(); SetPolicy(PanelSecurity.PackageId, UserSettings.EXCHANGE_POLICY, "OrgIdPolicy"); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailDomainsAddPointer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailDomainsAddPointer.ascx index 1f57cb0f..9f7f5428 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailDomainsAddPointer.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailDomainsAddPointer.ascx @@ -6,7 +6,7 @@
DNS Type StatusValueOld ValueNew Value
#DnsChange.DnsServer# #DnsChange.Type# #DnsChange.Status##DnsChange.Record.Value##DnsChange.OldRecord.Value##DnsChange.NewRecord.Value#
+ HideMailDomains="true" HideDomainsSubDomains="false" HideInstantAlias="false" HideDomainPointers="true" HideIdnDomains="True"/>
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailEditAddress.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailEditAddress.ascx index 6037cbc1..48c26731 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailEditAddress.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailEditAddress.ascx @@ -9,7 +9,7 @@  @  - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/Windows2012_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/Windows2012_Settings.ascx.resx new file mode 100644 index 00000000..79e96a34 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/Windows2012_Settings.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 + + + Enable Hard Quota: + + + Hosting Spaces Folder: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Windows2012_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Windows2012_Settings.ascx new file mode 100644 index 00000000..89306fa7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Windows2012_Settings.ascx @@ -0,0 +1,25 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Windows2012_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.Windows2012_Settings" %> + + + + + + + + + +
+ + +
+ + + + + + + +
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Windows2012_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Windows2012_Settings.ascx.cs new file mode 100644 index 00000000..216d5521 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Windows2012_Settings.ascx.cs @@ -0,0 +1,79 @@ +// 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.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 Windows2012_Settings : WebsitePanelControlBase, IHostingServiceProviderSettings + { + protected void Page_Load(object sender, EventArgs e) + { + //CO Changes + if (!IsPostBack) + { + try + { + chkEnableHardQuota.Enabled = ES.Services.OperatingSystems.CheckFileServicesInstallation(PanelRequest.ServiceId); + if (!chkEnableHardQuota.Enabled) + lblFileServiceInfo.Visible = true; + } + catch + { + } + } + //END + } + + public void BindSettings(StringDictionary settings) + { + txtFolder.Text = settings["UsersHome"]; + //CO Changes + chkEnableHardQuota.Checked = settings["EnableHardQuota"] == "true" ? true : false; + //END + } + + public void SaveSettings(StringDictionary settings) + { + settings["UsersHome"] = txtFolder.Text; + //CO Changes + settings["EnableHardQuota"] = chkEnableHardQuota.Checked.ToString().ToLower(); + //END + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Windows2012_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Windows2012_Settings.ascx.designer.cs new file mode 100644 index 00000000..cb25aa41 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Windows2012_Settings.ascx.designer.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// 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 Windows2012_Settings { + + /// + /// lblSpacesFolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSpacesFolder; + + /// + /// txtFolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtFolder; + + /// + /// chkEnableHardQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkEnableHardQuota; + + /// + /// lblFileServiceInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblFileServiceInfo; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx new file mode 100644 index 00000000..a1ffcecb --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + ShowProgressDialog('Adding RDS Server ...'); + + + Save Changes + + + + + + Edit RDS Application + + + Edit RDS Application + + + Application Name: + + + Server Name + + + No RDS Servers have been added yet. To add a new RDS Servers click "Add RDS Server" button. + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollection.ascx.resx new file mode 100644 index 00000000..a4a9dd20 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditCollection.ascx.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + ShowProgressDialog('Adding RDS Server ...'); + + + Save + + + + + + Edit RDS Collection + + + Edit RDS Collection + + + Collection Name + + + Server Name + + + No RDS Servers have been added yet. To add a new RDS Servers click "Add RDS Server" button. + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx index 7fc47b47..6c77a487 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx @@ -47,8 +47,8 @@ - - + + <%# Eval("Name").ToString() %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs index 1842197e..2a58751d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs @@ -111,5 +111,10 @@ namespace WebsitePanel.Portal.RDS "CollectionId=" + collectionId, "ItemID=" + PanelRequest.ItemID); } + + public string GetCollectionEditUrl(string collectionId) + { + return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_edit_collection", "CollectionId=" + collectionId, "ItemID=" + PanelRequest.ItemID); + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx new file mode 100644 index 00000000..2dc96cb7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx @@ -0,0 +1,46 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSEditApplicationUsers.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSEditApplicationUsers" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="UserControls/RDSCollectionUsers.ascx" TagName="CollectionUsers" TagPrefix="wsp"%> + + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + +
+ +
+ +
+ +
+ +
+
+ +
+ + +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs new file mode 100644 index 00000000..95b7448f --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.Portal.RDS +{ + public partial class RDSEditApplicationUsers : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + var applications = ES.Services.RDS.GetCollectionRemoteApplications(PanelRequest.ItemID, collection.Name); + var remoteApp = applications.Where(x => x.DisplayName.Equals(PanelRequest.ApplicationID, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); + var collectionUsers = ES.Services.RDS.GetRdsCollectionUsers(PanelRequest.CollectionID); + var applicationUsers = ES.Services.RDS.GetApplicationUsers(PanelRequest.ItemID, PanelRequest.CollectionID, remoteApp); + + locCName.Text = collection.Name; + + users.SetUsers(collectionUsers.Where(x => applicationUsers.Contains(x.SamAccountName)).ToArray()); + } + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + { + return; + } + + try + { + var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + var applications = ES.Services.RDS.GetCollectionRemoteApplications(PanelRequest.ItemID, collection.Name); + var remoteApp = applications.Where(x => x.DisplayName.Equals(PanelRequest.ApplicationID, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); + ES.Services.RDS.SetApplicationUsers(PanelRequest.ItemID, PanelRequest.CollectionID, remoteApp, users.GetUsers().Select(x => x.AccountName).ToArray()); + + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_apps", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID)); + } + catch (Exception) + { + } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs new file mode 100644 index 00000000..8ece837d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// 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.RDS { + + + public partial class RDSEditApplicationUsers { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// imgEditRDSCollection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgEditRDSCollection; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// locApplicationName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locApplicationName; + + /// + /// locCName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCName; + + /// + /// UsersPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl UsersPanel; + + /// + /// locUsersSection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locUsersSection; + + /// + /// users control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionUsers users; + + /// + /// 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; + + /// + /// valSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary valSummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx new file mode 100644 index 00000000..f140dbe4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx @@ -0,0 +1,36 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSEditCollection.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSEditCollection" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="UserControls/RDSCollectionServers.ascx" TagName="CollectionServers" TagPrefix="wsp"%> + + + + +
+
+
+
+
+
+
+ + +
+
+ + +
+ +
+ +
+
+ +
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx.cs new file mode 100644 index 00000000..3f6c8e22 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.Portal.RDS +{ + public partial class RDSEditCollection : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + return; + + try + { + if (servers.GetServers().Count < 1) + { + messageBox.ShowErrorMessage("RDS_CREATE_COLLECTION_RDSSERVER_REQUAIRED"); + return; + } + + RdsCollection collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + collection.Servers = servers.GetServers(); + + ES.Services.RDS.EditRdsCollection(PanelRequest.ItemID, collection); + + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", + "SpaceID=" + PanelSecurity.PackageId)); + } + catch { } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx.designer.cs new file mode 100644 index 00000000..cd24985d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollection.ascx.designer.cs @@ -0,0 +1,87 @@ +//------------------------------------------------------------------------------ +// +// 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.RDS { + + + public partial class RDSEditCollection { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// imgAddRDSServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgAddRDSServer; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// RDSServersPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl RDSServersPanel; + + /// + /// locRDSServersSection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locRDSServersSection; + + /// + /// servers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionServers servers; + + /// + /// 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; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.cs index 0d647cb3..cfd3e35d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditCollectionApps.ascx.cs @@ -48,7 +48,7 @@ namespace WebsitePanel.Portal.RDS locCName.Text = collection.Name; - remoreApps.SetApps(collectionApps); + remoreApps.SetApps(collectionApps, Module); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx index fc3a8844..147cee05 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx @@ -21,13 +21,18 @@
- + + + + Users + +

diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs index d00a249e..684b9dd7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs @@ -54,6 +54,12 @@ namespace WebsitePanel.Portal.RDS.UserControls BindApps(apps, false); } + public void SetApps(RemoteApplication[] apps, WebPortal.PageModule module) + { + Module = module; + BindApps(apps, false); + } + public RemoteApplication[] GetApps() { return GetGridViewApps(SelectedState.All).ToArray(); @@ -218,5 +224,11 @@ namespace WebsitePanel.Portal.RDS.UserControls { return string.Compare(app1.DisplayName, app2.DisplayName); } + + public string GetCollectionUsersEditUrl(string appId) + { + return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_application_edit_users", + "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID, "ApplicationID=" + appId); + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs index b3ca3c35..55d5eefd 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionServers.ascx.cs @@ -53,19 +53,14 @@ namespace WebsitePanel.Portal.RDS.UserControls { BindServers(servers, false); } - - //public RdsServer[] GetServers() - //{ - // return GetGridViewServers(SelectedState.All).ToArray(); - //} - + public List GetServers() { return GetGridViewServers(SelectedState.All); } protected void Page_Load(object sender, EventArgs e) - { + { // register javascript if (!Page.ClientScript.IsClientScriptBlockRegistered("SelectAllCheckboxes")) { @@ -80,8 +75,14 @@ namespace WebsitePanel.Portal.RDS.UserControls Page.ClientScript.RegisterClientScriptBlock(typeof(RDSCollectionUsers), "SelectAllCheckboxes", script, true); } + + if (!IsPostBack && PanelRequest.CollectionID > 0) + { + BindOrganizationServers(); + } } + protected void btnAdd_Click(object sender, EventArgs e) { // bind all servers @@ -205,6 +206,25 @@ namespace WebsitePanel.Portal.RDS.UserControls } + protected void BindOrganizationServers() + { + RdsServer[] servers = ES.Services.RDS.GetOrganizationRdsServersPaged(PanelRequest.ItemID, PanelRequest.CollectionID, "FqdName", txtSearchValue.Text, null, 0, 1000).Servers; + Array.Sort(servers, CompareAccount); + + if (Direction == SortDirection.Ascending) + { + Array.Reverse(servers); + Direction = SortDirection.Descending; + } + else + { + Direction = SortDirection.Ascending; + } + + gvServers.DataSource = servers; + gvServers.DataBind(); + } + protected void cmdSearch_Click(object sender, ImageClickEventArgs e) { BindPopupServers(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx index 7034bce6..8655355c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx @@ -6,7 +6,8 @@ Server Name: - + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx.cs index 8e6dc106..e03b5a49 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx.cs @@ -30,7 +30,33 @@ namespace WebsitePanel.Portal.ScheduleTaskControls this.SetParameter(this.txtDnsServers, DnsServersParameter); this.SetParameter(this.txtMailTo, MailToParameter); - this.SetParameter(this.txtServerName, ServerNameParameter); + this.SetParameter(this.ddlServers, ServerNameParameter); + + var servers = ES.Services.Servers.GetAllServers(); + + var osGroup = ES.Services.Servers.GetResourceGroups().First(x => x.GroupName == ResourceGroups.Os); + var osProviders = ES.Services.Servers.GetProvidersByGroupId(osGroup.GroupId); + + var osServers = new List(); + + foreach (var server in servers) + { + var services = ES.Services.Servers.GetServicesByServerId(server.ServerId); + + if (services.Any(x => osProviders.Any(p=>p.ProviderId == x.ProviderId))) + { + osServers.Add(server); + } + } + + ddlServers.DataSource = osServers.Select(x => new { Id = x.ServerName, Name = x.ServerName }); + ddlServers.DataTextField = "Name"; + ddlServers.DataValueField = "Id"; + ddlServers.DataBind(); + + ScheduleTaskParameterInfo parameter = this.FindParameterById(ServerNameParameter); + + ddlServers.SelectedValue = parameter.ParameterValue; } /// @@ -41,7 +67,7 @@ namespace WebsitePanel.Portal.ScheduleTaskControls { ScheduleTaskParameterInfo dnsServers = this.GetParameter(this.txtDnsServers, DnsServersParameter); ScheduleTaskParameterInfo mailTo = this.GetParameter(this.txtMailTo, MailToParameter); - ScheduleTaskParameterInfo serverName = this.GetParameter(this.txtServerName, ServerNameParameter); + ScheduleTaskParameterInfo serverName = this.GetParameter(this.ddlServers, ServerNameParameter); return new ScheduleTaskParameterInfo[3] { dnsServers, mailTo, serverName }; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx.designer.cs index cfc285be..df689cac 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainLookupView.ascx.designer.cs @@ -22,13 +22,13 @@ namespace WebsitePanel.Portal.ScheduleTaskControls { protected global::System.Web.UI.WebControls.Label lblServerName; /// - /// txtServerName control. + /// ddlServers control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.TextBox txtServerName; + protected global::System.Web.UI.WebControls.DropDownList ddlServers; /// /// lblDnsServers control. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/DomainControl.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/DomainControl.ascx.resx new file mode 100644 index 00000000..7eef1acc --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/DomainControl.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 + + + Please, enter correct domain name, for example "mydomain.com" or "sub.mydomain.com". + + + * + + + Please enter domain name + + + * + + + Please enter sub-domain name + + + * + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainControl.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainControl.ascx new file mode 100644 index 00000000..871eb72d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainControl.ascx @@ -0,0 +1,10 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DomainControl.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.DomainControl" %> + + +. + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainControl.ascx.cs new file mode 100644 index 00000000..ddcb7541 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainControl.ascx.cs @@ -0,0 +1,134 @@ +// 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.Text.RegularExpressions; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Globalization; + +namespace WebsitePanel.Portal.UserControls +{ + public partial class DomainControl : WebsitePanelControlBase + { + public class DomainNameEventArgs : EventArgs + { + public string DomainName { get; set; } + } + + public event EventHandler TextChanged; + + public virtual void OnTextChanged() + { + var handler = TextChanged; + if (handler != null) handler(this, new DomainNameEventArgs {DomainName = Text}); + } + + public object DataSource + { + set { DomainsList.DataSource = value; } + } + + public bool AutoPostBack + { + get { return txtDomainName.AutoPostBack; } + set { txtDomainName.AutoPostBack = value; } + } + + public Unit Width + { + get { return txtDomainName.Width; } + set { txtDomainName.Width = value; } + } + + public bool RequiredEnabled + { + get { return DomainRequiredValidator.Enabled; } + set { DomainRequiredValidator.Enabled = value; } + } + + public string Text + { + get + { + var domainName = txtDomainName.Text.Trim(); + if (IsSubDomain) + { + domainName += "." + DomainsList.SelectedValue; + } + return domainName; + } + set { txtDomainName.Text = value; } + } + + public string ValidationGroup + { + get { return DomainRequiredValidator.ValidationGroup; } + set { DomainRequiredValidator.ValidationGroup = value; DomainFormatValidator.ValidationGroup = value; } + } + + public bool IsSubDomain { + get { return SubDomainSeparator.Visible; } + set + { + SubDomainSeparator.Visible = value; + DomainsList.Visible = value; + DomainRequiredValidator.Enabled = !value; + } + } + + protected void Page_Load(object sender, EventArgs e) + { + } + + protected new void DataBind() + { + DomainsList.DataBind(); + } + + protected void DomainFormatValidator_ServerValidate(object source, ServerValidateEventArgs args) + { + var idn = new IdnMapping(); + try + { + var ascii = idn.GetAscii(Text); + var regex = new Regex(@"^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.){1,10}[a-zA-Z]{2,15}$"); + args.IsValid = regex.IsMatch(ascii); + } + catch (Exception) + { + args.IsValid = false; + } + } + + protected void txtDomainName_TextChanged(object sender, EventArgs e) + { + OnTextChanged(); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainControl.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainControl.ascx.designer.cs new file mode 100644 index 00000000..07cd0861 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/DomainControl.ascx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// +// 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.UserControls { + + + public partial class DomainControl { + + /// + /// txtDomainName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDomainName; + + /// + /// SubDomainSeparator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal SubDomainSeparator; + + /// + /// DomainsList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList DomainsList; + + /// + /// DomainRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator DomainRequiredValidator; + + /// + /// DomainFormatValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CustomValidator DomainFormatValidator; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx index 12ccdeeb..8c821a95 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx @@ -1,12 +1,11 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserCreateSpace.ascx.cs" Inherits="WebsitePanel.Portal.UserCreateSpace" %> -<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="UserControls/CollapsiblePanel.ascx" %> <%@ Register Src="UserControls/UsernameControl.ascx" TagName="UsernameControl" TagPrefix="uc4" %> -<%@ Register Src="DomainsSelectDomainControl.ascx" TagName="DomainsSelectDomainControl" TagPrefix="uc1" %> +<%@ Register Src="UserControls/DomainControl.ascx" TagName="DomainControl" TagPrefix="wsp" %> <%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> - + @@ -74,12 +73,7 @@ - - - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx.designer.cs index 1429ed53..be8bf255 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx.designer.cs @@ -163,25 +163,7 @@ namespace WebsitePanel.Portal { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.TextBox txtDomainName; - - /// - /// DomainRequiredValidator control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator DomainRequiredValidator; - - /// - /// DomainFormatValidator control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RegularExpressionValidator DomainFormatValidator; + protected global::WebsitePanel.Portal.UserControls.DomainControl txtDomainName; /// /// fsWeb control. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebApplicationGalleryParamControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebApplicationGalleryParamControl.ascx.cs index 54d93bcf..d3c216b5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebApplicationGalleryParamControl.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebApplicationGalleryParamControl.ascx.cs @@ -185,104 +185,111 @@ namespace WebsitePanel.Portal private void BindControls() { - // hide database server parameters - DeploymentParameterWellKnownTag hiddenTags = - DeploymentParameterWellKnownTag.IisApp | - DeploymentParameterWellKnownTag.Hidden | - DeploymentParameterWellKnownTag.DBServer | - DeploymentParameterWellKnownTag.DBAdminUserName | - DeploymentParameterWellKnownTag.DBAdminPassword; - - if ((WellKnownTags & hiddenTags) > 0) + try { - this.Visible = false; - return; - } - // disable all editor controls - BooleanControl.Visible = false; - EnumControl.Visible = false; - PasswordControl.Visible = false; - TextControl.Visible = false; + // hide database server parameters + DeploymentParameterWellKnownTag hiddenTags = + DeploymentParameterWellKnownTag.IisApp | + DeploymentParameterWellKnownTag.Hidden | + DeploymentParameterWellKnownTag.DBServer | + DeploymentParameterWellKnownTag.DBAdminUserName | + DeploymentParameterWellKnownTag.DBAdminPassword; - // enable specific control - if ((ValidationKind & DeploymentParameterValidationKind.Boolean) == DeploymentParameterValidationKind.Boolean) - { - // Boolean value - BooleanControl.Visible = true; - bool val = false; - Boolean.TryParse(DefaultValue, out val); - boolValue.Checked = val; - } - else if ((ValidationKind & DeploymentParameterValidationKind.Enumeration) == DeploymentParameterValidationKind.Enumeration) - { - // Enumeration value - EnumControl.Visible = true; - - // fill dropdown - enumValue.Items.Clear(); - string[] items = (ValidationString ?? "").Trim().Split(','); - foreach (string item in items) - enumValue.Items.Add(item.Trim()); - - // select default value - enumValue.SelectedValue = DefaultValue; - } - else if ((WellKnownTags & DeploymentParameterWellKnownTag.Password) == DeploymentParameterWellKnownTag.Password) - { - // Password value - PasswordControl.Visible = true; - confirmPasswordControls.Visible = ((WellKnownTags & DeploymentParameterWellKnownTag.New) == DeploymentParameterWellKnownTag.New); - } - else - { - // Text value - TextControl.Visible = true; - textValue.Text = DefaultValue; - valPrefix.Text = ValuePrefix; - valSuffix.Text = ValueSuffix; - - if ( - (WellKnownTags & DeploymentParameterWellKnownTag.MySql) == DeploymentParameterWellKnownTag.MySql - && - (WellKnownTags & DeploymentParameterWellKnownTag.DBUserName) == DeploymentParameterWellKnownTag.DBUserName - ) + if ((WellKnownTags & hiddenTags) > 0) { - MysqlUsernameLengthValidator.Enabled = true; + this.Visible = false; + return; } + + // disable all editor controls + BooleanControl.Visible = false; + EnumControl.Visible = false; + PasswordControl.Visible = false; + TextControl.Visible = false; + + // enable specific control + if ((ValidationKind & DeploymentParameterValidationKind.Boolean) == DeploymentParameterValidationKind.Boolean) + { + // Boolean value + BooleanControl.Visible = true; + bool val = false; + Boolean.TryParse(DefaultValue, out val); + boolValue.Checked = val; + } + else if ((ValidationKind & DeploymentParameterValidationKind.Enumeration) == DeploymentParameterValidationKind.Enumeration) + { + // Enumeration value + EnumControl.Visible = true; + + // fill dropdown + enumValue.Items.Clear(); + string[] items = (ValidationString ?? "").Trim().Split(','); + foreach (string item in items) + enumValue.Items.Add(item.Trim()); + + // select default value + enumValue.SelectedValue = DefaultValue; + } + else if ((WellKnownTags & DeploymentParameterWellKnownTag.Password) == DeploymentParameterWellKnownTag.Password) + { + // Password value + PasswordControl.Visible = true; + confirmPasswordControls.Visible = ((WellKnownTags & DeploymentParameterWellKnownTag.New) == DeploymentParameterWellKnownTag.New); + } + else + { + // Text value + TextControl.Visible = true; + textValue.Text = DefaultValue == null ? "" : DefaultValue; + valPrefix.Text = ValuePrefix == null ? "" : ValuePrefix; + valSuffix.Text = ValueSuffix == null ? "" : ValueSuffix; + + if ( + (ValuePrefix != null) && (ValueSuffix != null) + && + ((WellKnownTags & DeploymentParameterWellKnownTag.MySql) == DeploymentParameterWellKnownTag.MySql) + && + ((WellKnownTags & DeploymentParameterWellKnownTag.DBUserName) == DeploymentParameterWellKnownTag.DBUserName) + ) + { + MysqlUsernameLengthValidator.Enabled = true; + } + } + + // enforce validation for database parameters if they are allowed empty by app pack developers + bool isDatabaseParameter = (WellKnownTags & ( + DeploymentParameterWellKnownTag.DBName | + DeploymentParameterWellKnownTag.DBUserName | + DeploymentParameterWellKnownTag.DBUserPassword)) > 0; + + // enforce validation for database name and username + if ((WellKnownTags & (DeploymentParameterWellKnownTag.DBName | DeploymentParameterWellKnownTag.DBUserName)) > 0 + && String.IsNullOrEmpty(ValidationString)) + { + validationKind |= DeploymentParameterValidationKind.RegularExpression; + validationString = DatabaseIdentifierRegexp; + } + + // validation common for all editors + requireTextValue.Enabled = requirePassword.Enabled = requireConfirmPassword.Enabled = requireEnumValue.Enabled = + ((ValidationKind & DeploymentParameterValidationKind.AllowEmpty) != DeploymentParameterValidationKind.AllowEmpty) || isDatabaseParameter; + + requireTextValue.Text = requirePassword.Text = requireEnumValue.Text = + String.Format(GetLocalizedString("RequiredValidator.Text"), FriendlyName); + + regexpTextValue.Enabled = regexpPassword.Enabled = regexpEnumValue.Enabled = + (ValidationKind & DeploymentParameterValidationKind.RegularExpression) == DeploymentParameterValidationKind.RegularExpression; + + regexpTextValue.ValidationExpression = regexpPassword.ValidationExpression = regexpEnumValue.ValidationExpression = + ValidationString ?? ""; + + regexpTextValue.Text = regexpPassword.Text = regexpEnumValue.Text = + String.Format(GetLocalizedString("RegexpValidator.Text"), FriendlyName, ValidationString); + + } - - - // enforce validation for database parameters if they are allowed empty by app pack developers - bool isDatabaseParameter = (WellKnownTags & ( - DeploymentParameterWellKnownTag.DBName | - DeploymentParameterWellKnownTag.DBUserName | - DeploymentParameterWellKnownTag.DBUserPassword)) > 0; - - // enforce validation for database name and username - if ((WellKnownTags & (DeploymentParameterWellKnownTag.DBName | DeploymentParameterWellKnownTag.DBUserName)) > 0 - && String.IsNullOrEmpty(ValidationString)) - { - validationKind |= DeploymentParameterValidationKind.RegularExpression; - validationString = DatabaseIdentifierRegexp; - } - - // validation common for all editors - requireTextValue.Enabled = requirePassword.Enabled = requireConfirmPassword.Enabled = requireEnumValue.Enabled = - ((ValidationKind & DeploymentParameterValidationKind.AllowEmpty) != DeploymentParameterValidationKind.AllowEmpty) || isDatabaseParameter; - - requireTextValue.Text = requirePassword.Text = requireEnumValue.Text = - String.Format(GetLocalizedString("RequiredValidator.Text"), FriendlyName); - - regexpTextValue.Enabled = regexpPassword.Enabled = regexpEnumValue.Enabled = - (ValidationKind & DeploymentParameterValidationKind.RegularExpression) == DeploymentParameterValidationKind.RegularExpression; - - regexpTextValue.ValidationExpression = regexpPassword.ValidationExpression = regexpEnumValue.ValidationExpression = - ValidationString ?? ""; - - regexpTextValue.Text = regexpPassword.Text = regexpEnumValue.Text = - String.Format(GetLocalizedString("RegexpValidator.Text"), FriendlyName, ValidationString); - + catch { } // just skip } 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 0aa1984e..ca234de3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -211,6 +211,13 @@ + + Windows2012_Settings.ascx + ASPXCodeBehind + + + Windows2012_Settings.ascx + RDSServersAddserver.ascx ASPXCodeBehind @@ -239,6 +246,20 @@ AddRDSServer.ascx + + RDSEditApplicationUsers.ascx + ASPXCodeBehind + + + RDSEditApplicationUsers.ascx + + + RDSEditCollection.ascx + ASPXCodeBehind + + + RDSEditCollection.ascx + RDSEditCollectionApps.ascx ASPXCodeBehind @@ -752,6 +773,13 @@ SpaceOrganizationsSelector.ascx + + DomainControl.ascx + ASPXCodeBehind + + + DomainControl.ascx + ASPXCodeBehind @@ -4263,10 +4291,13 @@ + + + @@ -4277,6 +4308,13 @@ + + + Designer + + + Designer + ResXFileCodeGenerator DomainLookupView.ascx.Designer.cs @@ -4348,6 +4386,7 @@ + @@ -5585,13 +5624,18 @@ Designer - - + + Designer + + + Designer + + Designer