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(
_productsToInstall,
true, //search and install dependencies
WpiHelper.DeafultLanguage,
InstallStatusUpdatedHandler,
InstallCompleteHandler

View file

@ -185,6 +185,35 @@ namespace WebsitePanel.Server.Code
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 )
{
@ -309,6 +338,7 @@ namespace WebsitePanel.Server.Code
public Product GetProduct(string productId)
{
return _productManager.GetProduct(productId);
}
@ -321,13 +351,24 @@ namespace WebsitePanel.Server.Code
public void InstallProducts(
IEnumerable<string> productIdsToInstall,
bool installDependencies,
string languageId,
EventHandler<InstallStatusEventArgs> installStatusUpdatedHandler,
EventHandler<EventArgs> installCompleteHandler)
{
// Get products & dependencies list to install
List<Product> productsToInstall = GetProductsWithDependencies(productIdsToInstall);
List<Product> productsToInstall = null;
if (installDependencies)
{
// Get products & dependencies list to install
productsToInstall = GetProductsWithDependencies(productIdsToInstall);
}
else
{
productsToInstall = GetProducts(productIdsToInstall);
}
// Get installers
Language lang = GetLanguage(languageId);
@ -406,6 +447,8 @@ namespace WebsitePanel.Server.Code
Installer appInstaller = app.GetInstaller(GetLanguage(languageId));
WpiAppInstallLogger logger = new WpiAppInstallLogger();
if (null != installStatusUpdatedHandler)
{
_installManager.InstallerStatusUpdated += installStatusUpdatedHandler;

View file

@ -10,9 +10,12 @@
<div class="FormBody">
<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" />
</div>
<div class="FormFooter">
<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
messageBox.ShowMessage(appResult, "WAG_CANNOT_INSTALL_APPLICATION", "WebAppGallery");
chIgnoreDependencies.Visible = true;
btnInstall.Enabled = false;
}
}
@ -118,5 +119,10 @@ namespace WebsitePanel.Portal
RedirectSpaceHomePage();
}
protected void chIgnoreDependencies_CheckedChanged(object sender, EventArgs e)
{
btnInstall.Enabled = chIgnoreDependencies.Checked;
}
}
}

View file

@ -30,6 +30,15 @@ namespace WebsitePanel.Portal {
/// </remarks>
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>
/// appHeader control.
/// </summary>

View file

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