checkbox - IgnoreDependencies for Application

This commit is contained in:
Sergey 2012-08-27 15:52:40 +03:00
parent 24ee7357c1
commit 7d10a750a0
6 changed files with 73 additions and 11 deletions

View file

@ -172,6 +172,7 @@ namespace WebsitePanel.Server.WPIService
{ {
_wpiHelper.InstallProducts( _wpiHelper.InstallProducts(
_productsToInstall, _productsToInstall,
true, //search and install dependencies
WpiHelper.DeafultLanguage, WpiHelper.DeafultLanguage,
InstallStatusUpdatedHandler, InstallStatusUpdatedHandler,
InstallCompleteHandler InstallCompleteHandler

View file

@ -185,6 +185,35 @@ namespace WebsitePanel.Server.Code
return installersToUse; return installersToUse;
} }
public List<Product> GetProducts(IEnumerable<string> productIdsToInstall)
{
List<Product> productsToInstall = new List<Product>();
foreach (string productId in productIdsToInstall)
{
Log(string.Format("Product {0} to be installed", productId));
Product product = _productManager.GetProduct(productId);
if (null == product)
{
Log(string.Format("Product {0} not found", productId));
continue;
}
if (product.IsInstalled(true))
{
Log(string.Format("Product {0} is installed", product.Title));
}
else
{
Log(string.Format("Adding product {0}", product.Title));
productsToInstall.Add(product);
}
}
return productsToInstall;
}
public List<Product> GetProductsWithDependencies(IEnumerable<string> productIdsToInstall ) public List<Product> GetProductsWithDependencies(IEnumerable<string> productIdsToInstall )
{ {
@ -309,6 +338,7 @@ namespace WebsitePanel.Server.Code
public Product GetProduct(string productId) public Product GetProduct(string productId)
{ {
return _productManager.GetProduct(productId); return _productManager.GetProduct(productId);
} }
@ -321,13 +351,24 @@ namespace WebsitePanel.Server.Code
public void InstallProducts( public void InstallProducts(
IEnumerable<string> productIdsToInstall, IEnumerable<string> productIdsToInstall,
bool installDependencies,
string languageId, string languageId,
EventHandler<InstallStatusEventArgs> installStatusUpdatedHandler, EventHandler<InstallStatusEventArgs> installStatusUpdatedHandler,
EventHandler<EventArgs> installCompleteHandler) EventHandler<EventArgs> installCompleteHandler)
{ {
// Get products & dependencies list to install List<Product> productsToInstall = null;
List<Product> productsToInstall = GetProductsWithDependencies(productIdsToInstall); if (installDependencies)
{
// Get products & dependencies list to install
productsToInstall = GetProductsWithDependencies(productIdsToInstall);
}
else
{
productsToInstall = GetProducts(productIdsToInstall);
}
// Get installers // Get installers
Language lang = GetLanguage(languageId); Language lang = GetLanguage(languageId);
@ -406,6 +447,8 @@ namespace WebsitePanel.Server.Code
Installer appInstaller = app.GetInstaller(GetLanguage(languageId)); Installer appInstaller = app.GetInstaller(GetLanguage(languageId));
WpiAppInstallLogger logger = new WpiAppInstallLogger(); WpiAppInstallLogger logger = new WpiAppInstallLogger();
if (null != installStatusUpdatedHandler) if (null != installStatusUpdatedHandler)
{ {
_installManager.InstallerStatusUpdated += installStatusUpdatedHandler; _installManager.InstallerStatusUpdated += installStatusUpdatedHandler;

View file

@ -10,9 +10,12 @@
<div class="FormBody"> <div class="FormBody">
<uc1:SimpleMessageBox ID="messageBox" runat="server" /> <uc1:SimpleMessageBox ID="messageBox" runat="server" />
<asp:CheckBox ID="chIgnoreDependencies" runat="server"
Text="Ignore these dependencies" Visible="false" AutoPostBack="True"
oncheckedchanged="chIgnoreDependencies_CheckedChanged" />
<uc1:WebApplicationGalleryHeader ID="appHeader" runat="server" /> <uc1:WebApplicationGalleryHeader ID="appHeader" runat="server" />
</div> </div>
<div class="FormFooter"> <div class="FormFooter">
<asp:Button ID="btnInstall" runat="server" meta:resourcekey="btnInstall" Text="Install" CssClass="Button1" OnClick="btnInstall_Click" OnClientClick="ShowProgressDialog('Installing application...');"/> <asp:Button ID="btnInstall" runat="server" meta:resourcekey="btnInstall" Text="Install" CssClass="Button1" OnClick="btnInstall_Click" OnClientClick="ShowProgressDialog('Installing application...');"/>

View file

@ -64,6 +64,7 @@ namespace WebsitePanel.Portal
{ {
// app does not meet requirements // app does not meet requirements
messageBox.ShowMessage(appResult, "WAG_CANNOT_INSTALL_APPLICATION", "WebAppGallery"); messageBox.ShowMessage(appResult, "WAG_CANNOT_INSTALL_APPLICATION", "WebAppGallery");
chIgnoreDependencies.Visible = true;
btnInstall.Enabled = false; btnInstall.Enabled = false;
} }
} }
@ -118,5 +119,10 @@ namespace WebsitePanel.Portal
RedirectSpaceHomePage(); RedirectSpaceHomePage();
} }
protected void chIgnoreDependencies_CheckedChanged(object sender, EventArgs e)
{
btnInstall.Enabled = chIgnoreDependencies.Checked;
}
} }
} }

View file

@ -30,6 +30,15 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// chIgnoreDependencies control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chIgnoreDependencies;
/// <summary> /// <summary>
/// appHeader control. /// appHeader control.
/// </summary> /// </summary>

View file

@ -74,13 +74,13 @@ namespace WebsitePanel.Portal
// bind app details // bind app details
appHeader.BindApplicationDetails(appResult.Value); appHeader.BindApplicationDetails(appResult.Value);
// check for warnings //// check for warnings
if (appResult.ErrorCodes.Count > 0) //if (appResult.ErrorCodes.Count > 0)
{ //{
// app does not meet requirements // // app does not meet requirements
messageBox.ShowMessage(appResult, "WAG_CANNOT_INSTALL_APPLICATION", "WebAppGallery"); // messageBox.ShowMessage(appResult, "WAG_CANNOT_INSTALL_APPLICATION", "WebAppGallery");
btnInstall.Enabled = false; // //btnInstall.Enabled = false;
} //}
// bind app parameters // bind app parameters
List<DeploymentParameter> parameters = GetApplicationParameters(); List<DeploymentParameter> parameters = GetApplicationParameters();