Merge
This commit is contained in:
commit
9d582348ba
22 changed files with 544 additions and 708 deletions
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) 2015, 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.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
using WebsitePanel.Providers.Mail;
|
||||
using WebsitePanel.Providers.Virtualization;
|
||||
|
||||
namespace WebsitePanel.Portal
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for IVirtualMachineCreateControl
|
||||
/// </summary>
|
||||
public interface IVirtualMachineCreateControl
|
||||
{
|
||||
void BindItem(VirtualMachine item);
|
||||
void SaveItem(VirtualMachine item);
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@
|
|||
</asp:hyperlink>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField HeaderText="gvUsersEmail" meta:resourcekey="gvUsersEmail" DataField="SipAddress" SortExpression="PrimaryUri" ItemStyle-Width="25%" />
|
||||
<asp:BoundField HeaderText="gvUsersEmail" meta:resourcekey="gvUsersEmail" DataField="SipAddress" SortExpression="SipAddress" ItemStyle-Width="25%" />
|
||||
<asp:BoundField HeaderText="gvLyncUserPlan" meta:resourcekey="gvLyncUserPlan" DataField="LyncUserPlanName" SortExpression="LyncUserPlanName" ItemStyle-Width="25%" />
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
|
|
|
@ -56,15 +56,15 @@ namespace WebsitePanel.Portal
|
|||
set { ViewState["DisplayText"] = value; }
|
||||
}
|
||||
|
||||
public long Progress
|
||||
public int Progress
|
||||
{
|
||||
get { return (ViewState["Progress"] != null) ? (long)ViewState["Progress"] : 0; }
|
||||
get { return (ViewState["Progress"] != null) ? (int)ViewState["Progress"] : 0; }
|
||||
set { ViewState["Progress"] = value; }
|
||||
}
|
||||
|
||||
public long Total
|
||||
public int Total
|
||||
{
|
||||
get { return (ViewState["Total"] != null) ? (long)ViewState["Total"] : 0; }
|
||||
get { return (ViewState["Total"] != null) ? (int)ViewState["Total"] : 0; }
|
||||
set { ViewState["Total"] = value; }
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ namespace WebsitePanel.Portal
|
|||
string bkgSrc = Page.ResolveUrl(PortalUtils.GetThemedImage("gauge_bkg.gif"));
|
||||
|
||||
// calculate the width of the gauge
|
||||
long fTotal = Total;
|
||||
int fTotal = Total;
|
||||
int percent = (fTotal > 0) ? Convert.ToInt32(Math.Round((double)Progress / (double)fTotal * 100)) : 0;
|
||||
|
||||
double fFilledWidth = (fTotal > 0) ? ((double)Progress / (double)fTotal * Width) : 0;
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace WebsitePanel.Portal
|
|||
|
||||
private void UpdateControl()
|
||||
{
|
||||
long total = gauge.Total;
|
||||
int total = gauge.Total;
|
||||
if (QuotaTypeId == 1)
|
||||
{
|
||||
litValue.Text = (total == 0) ? GetLocalizedString("Text.Disabled") : GetLocalizedString("Text.Enabled");
|
||||
|
|
|
@ -189,6 +189,8 @@
|
|||
</table>
|
||||
</asp:Panel>
|
||||
|
||||
<asp:PlaceHolder ID="providerControl" runat="server"></asp:PlaceHolder>
|
||||
|
||||
<wsp:CollapsiblePanel id="secSnapshots" runat="server"
|
||||
TargetControlID="SnapshotsPanel" meta:resourcekey="secSnapshots" Text="Snapshots">
|
||||
</wsp:CollapsiblePanel>
|
||||
|
|
|
@ -42,6 +42,8 @@ namespace WebsitePanel.Portal.VPS
|
|||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadCustomProviderControl();
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BindFormControls();
|
||||
|
@ -54,6 +56,26 @@ namespace WebsitePanel.Portal.VPS
|
|||
ToggleControls();
|
||||
}
|
||||
|
||||
private void LoadCustomProviderControl()
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadProviderControl(PanelSecurity.PackageId, "VPS", providerControl, "Create.ascx");
|
||||
}
|
||||
catch { /* skip */ }
|
||||
}
|
||||
|
||||
private IVirtualMachineCreateControl CustomProviderControl
|
||||
{
|
||||
get
|
||||
{
|
||||
if (providerControl.Controls.Count == 0)
|
||||
return null;
|
||||
|
||||
return (IVirtualMachineCreateControl)providerControl.Controls[0];
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleWizardSteps()
|
||||
{
|
||||
// external network
|
||||
|
@ -113,6 +135,13 @@ namespace WebsitePanel.Portal.VPS
|
|||
|
||||
ddlCpu.SelectedIndex = ddlCpu.Items.Count - 1; // select last (maximum) item
|
||||
|
||||
// the custom provider control
|
||||
if (CustomProviderControl != null)
|
||||
{
|
||||
IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)providerControl.Controls[0];
|
||||
ctrl.BindItem(new VirtualMachine());
|
||||
}
|
||||
|
||||
// external network details
|
||||
if (PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS_EXTERNAL_NETWORK_ENABLED))
|
||||
{
|
||||
|
@ -287,6 +316,15 @@ namespace WebsitePanel.Portal.VPS
|
|||
|
||||
try
|
||||
{
|
||||
VirtualMachine virtualMachine = new VirtualMachine();
|
||||
|
||||
// the custom provider control
|
||||
if (CustomProviderControl != null)
|
||||
{
|
||||
IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)providerControl.Controls[0];
|
||||
ctrl.SaveItem(virtualMachine);
|
||||
}
|
||||
|
||||
// collect and prepare data
|
||||
string hostname = String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim());
|
||||
|
||||
|
@ -305,7 +343,7 @@ namespace WebsitePanel.Portal.VPS
|
|||
// create virtual machine
|
||||
IntResult res = ES.Services.VPS.CreateVirtualMachine(PanelSecurity.PackageId,
|
||||
hostname, listOperatingSystems.SelectedValue, adminPassword, summaryEmail,
|
||||
Utils.ParseInt(ddlCpu.SelectedValue), Utils.ParseInt(txtRam.Text.Trim()),
|
||||
virtualMachine.Generation, Utils.ParseInt(ddlCpu.SelectedValue), Utils.ParseInt(txtRam.Text.Trim()),
|
||||
Utils.ParseInt(txtHdd.Text.Trim()), Utils.ParseInt(txtSnapshots.Text.Trim()),
|
||||
chkDvdInstalled.Checked, chkBootFromCd.Checked, chkNumLock.Checked,
|
||||
chkStartShutdown.Checked, chkPauseResume.Checked, chkReboot.Checked, chkReset.Checked, chkReinstall.Checked,
|
||||
|
|
|
@ -1,38 +1,9 @@
|
|||
// Copyright (c) 2015, 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.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.3053
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
@ -401,6 +372,15 @@ namespace WebsitePanel.Portal.VPS {
|
|||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Localize locGB;
|
||||
|
||||
/// <summary>
|
||||
/// providerControl 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.PlaceHolder providerControl;
|
||||
|
||||
/// <summary>
|
||||
/// secSnapshots control.
|
||||
/// </summary>
|
||||
|
@ -1354,14 +1334,5 @@ namespace WebsitePanel.Portal.VPS {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Literal litPrivateAddressesList;
|
||||
|
||||
/// <summary>
|
||||
/// FormComments 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.Localize FormComments;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
<Compile Include="Code\ProviderControls\IDatabaseEditUserControl.cs" />
|
||||
<Compile Include="Code\ProviderControls\IFtpEditAccountControl.cs" />
|
||||
<Compile Include="Code\ProviderControls\IHostingServiceProviderSettings.cs" />
|
||||
<Compile Include="Code\ProviderControls\IVirtualMachineCreateControl.cs" />
|
||||
<Compile Include="Code\ProviderControls\IMailEditAccountControl.cs" />
|
||||
<Compile Include="Code\ProviderControls\IMailEditDomainControl.cs" />
|
||||
<Compile Include="Code\ProviderControls\IMailEditForwardingControl.cs" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue