From 4bc50e9f409cda964848209245b2e2790a049ac1 Mon Sep 17 00:00:00 2001 From: ruslanht Date: Mon, 24 Sep 2012 14:22:06 +0300 Subject: [PATCH 1/2] Web App Gallery: Setting of DB policies for multiply databases fixed --- .../WebApplicationGalleryParams.ascx.cs | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebApplicationGalleryParams.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebApplicationGalleryParams.ascx.cs index 860b9e77..1bfbb79a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebApplicationGalleryParams.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebApplicationGalleryParams.ascx.cs @@ -150,8 +150,6 @@ namespace WebsitePanel.Portal AddDatabaseEngine(DeploymentParameterWellKnownTag.Sql, ResourceGroups.MsSql2005, GetSharedLocalizedString("ResourceGroup." + ResourceGroups.MsSql2005)); if (cntx.Groups.ContainsKey(ResourceGroups.MsSql2000)) AddDatabaseEngine(DeploymentParameterWellKnownTag.Sql, ResourceGroups.MsSql2000, GetSharedLocalizedString("ResourceGroup." + ResourceGroups.MsSql2000)); - - SetDBPolicies(UserSettings.MSSQL_POLICY, parameters); } // MySQL Server @@ -165,8 +163,6 @@ namespace WebsitePanel.Portal AddDatabaseEngine(DeploymentParameterWellKnownTag.MySql, ResourceGroups.MySql5, GetSharedLocalizedString("ResourceGroup." + ResourceGroups.MySql5)); if (cntx.Groups.ContainsKey(ResourceGroups.MySql4)) AddDatabaseEngine(DeploymentParameterWellKnownTag.MySql, ResourceGroups.MySql4, GetSharedLocalizedString("ResourceGroup." + ResourceGroups.MySql4)); - - SetDBPolicies(UserSettings.MYSQL_POLICY, parameters); } // SQLite @@ -181,6 +177,7 @@ namespace WebsitePanel.Portal if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.VistaDB) != null) AddDatabaseEngine(DeploymentParameterWellKnownTag.VistaDB, "", GetLocalizedString("DatabaseEngine.VistaDB")); + BindDBPolicies(parameters); // hide module if no database required divDatabase.Visible = (databaseEngines.Items.Count > 0); @@ -190,18 +187,42 @@ namespace WebsitePanel.Portal } #region prefix & suffix for database name & username - private void SetDBPolicies(string policy, IEnumerable parameters) + private void BindDBPolicies(List parameters) + { + // MS SQL Server + if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.Sql) != null) + { + SetDBPolicies(UserSettings.MSSQL_POLICY, parameters, DeploymentParameterWellKnownTag.Sql); + } + + // MySQL Server + if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.MySql) != null) + { + SetDBPolicies(UserSettings.MYSQL_POLICY, parameters, DeploymentParameterWellKnownTag.MySql); + } + } + + + private void SetDBPolicies(string policy, IEnumerable parameters, DeploymentParameterWellKnownTag dbTag) { foreach (DeploymentParameter parameter in parameters) { - if ((parameter.WellKnownTags & DeploymentParameterWellKnownTag.DBName) != 0) + if ( + (parameter.WellKnownTags & DeploymentParameterWellKnownTag.DBName) != 0 + && + (parameter.WellKnownTags & dbTag) != 0 + ) { // database name string policyValue = GetPackagePolicy(policy, "DatabaseNamePolicy"); ApplyPrefixSuffixPolicy(parameter, policyValue); } - if ((parameter.WellKnownTags & DeploymentParameterWellKnownTag.DBUserName) != 0) + if ( + (parameter.WellKnownTags & DeploymentParameterWellKnownTag.DBUserName) != 0 + && + (parameter.WellKnownTags & dbTag) != 0 + ) { // user name string policyValue = GetPackagePolicy(policy, "UserNamePolicy"); @@ -302,7 +323,13 @@ namespace WebsitePanel.Portal protected void databaseEngines_SelectedIndexChanged(object sender, EventArgs e) { - BindParameters(); + // load parameters + List parameters = GetApplicationParameters(); + if (parameters == null) + return; + + BindDBPolicies(parameters); + BindParameters(parameters); } protected void databaseMode_SelectedIndexChanged(object sender, EventArgs e) From 34e566e7d14af65e870dd891bcffac3455dd6c25 Mon Sep 17 00:00:00 2001 From: Sergey Date: Mon, 24 Sep 2012 16:25:59 +0300 Subject: [PATCH 2/2] checkbox galleryAppsAlwaysIgnoreDependencies --- .../Code/WebAppGallery/WebAppGalleryController.cs | 13 +++++++++++++ .../App_LocalResources/IIS60_Settings.ascx.resx | 4 ++++ .../App_LocalResources/IIS70_Settings.ascx.resx | 3 +++ .../ProviderControls/IIS60_Settings.ascx | 5 +++++ .../ProviderControls/IIS60_Settings.ascx.cs | 2 ++ .../IIS60_Settings.ascx.designer.cs | 9 +++++++++ .../ProviderControls/IIS70_Settings.ascx | 10 ++++++++++ .../ProviderControls/IIS70_Settings.ascx.cs | 4 ++++ .../IIS70_Settings.ascx.designer.cs | 9 +++++++++ 9 files changed, 59 insertions(+) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebAppGallery/WebAppGalleryController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebAppGallery/WebAppGalleryController.cs index 3ba7ed7c..f076cc89 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebAppGallery/WebAppGalleryController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebAppGallery/WebAppGalleryController.cs @@ -487,6 +487,19 @@ namespace WebsitePanel.EnterpriseServer || context.Groups.ContainsKey(ResourceGroups.MySql5))) result.ErrorCodes.Add(GalleryErrors.MySQLRequired); + + + //show Dependency warning optionaly + int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Web); + StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId); + + bool galleryAppsAlwaysIgnoreDependencies = Utils.ParseBool(serviceSettings["GalleryAppsAlwaysIgnoreDependencies"], false); + + if (galleryAppsAlwaysIgnoreDependencies) + { + result.ErrorCodes.Clear(); + } + if (result.ErrorCodes.Count > 0) { GalleryApplicationResult warning = Warning(result, GalleryErrors.PackageDoesNotMeetRequirements); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS60_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS60_Settings.ascx.resx index f733bc7c..09d656ce 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS60_Settings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS60_Settings.ascx.resx @@ -123,9 +123,13 @@ Click to modify the filter... + + Always ignore dependencies + Click to create a filter... + Gallery feed filter: diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS70_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS70_Settings.ascx.resx index 652755df..385036f5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS70_Settings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/IIS70_Settings.ascx.resx @@ -219,6 +219,9 @@ Click to create a filter... + + Always ignore dependencies + Gallery feed filter: diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx index f5a9ed77..8224cfdf 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx @@ -135,6 +135,11 @@ + + + + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx.cs index 483f2d7e..69e30d79 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx.cs @@ -132,6 +132,7 @@ namespace WebsitePanel.Portal.ProviderControls ActiveDirectoryIntegration.BindSettings(settings); // FilteredAppIds = settings["GalleryAppsFilter"]; + chkGalleryAppsAlwaysIgnoreDependencies.Checked = Utils.ParseBool(settings["GalleryAppsAlwaysIgnoreDependencies"], false); } public void SaveSettings(StringDictionary settings) @@ -166,6 +167,7 @@ namespace WebsitePanel.Portal.ProviderControls ActiveDirectoryIntegration.SaveSettings(settings); // settings["GalleryAppsFilter"] = GetAppsCatalogFilter(); + settings["GalleryAppsAlwaysIgnoreDependencies"] = chkGalleryAppsAlwaysIgnoreDependencies.Checked.ToString(); } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx.designer.cs index 6758771e..4eb363b2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS60_Settings.ascx.designer.cs @@ -255,6 +255,15 @@ namespace WebsitePanel.Portal.ProviderControls { /// protected global::System.Web.UI.WebControls.LinkButton FilterDialogButton; + /// + /// chkGalleryAppsAlwaysIgnoreDependencies control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkGalleryAppsAlwaysIgnoreDependencies; + /// /// FilterDialogPanel control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx index 7358411d..52198e79 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IIS70_Settings.ascx @@ -214,9 +214,19 @@ --%> + + + +
+ + + + + +