diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineCreateControl.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs similarity index 79% rename from WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineCreateControl.cs rename to WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs index 7ffcba0b..5e19f7cb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineCreateControl.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs @@ -26,26 +26,13 @@ // (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 description for IVirtualMachineCreateControl - /// - public interface IVirtualMachineCreateControl + public interface IVirtualMachineSettingsControl { + bool IsEditMode { get; set; } void BindItem(VirtualMachine item); void SaveItem(VirtualMachine item); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Create.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Create.ascx.resx index 5b5b2e6f..29dcb1b3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Create.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Create.ascx.resx @@ -117,16 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - First - - - Second - - - Generation: - - - Generation - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Edit.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Edit.ascx.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Edit.ascx.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx index 04e7bb37..c3d1bc9d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx @@ -1,20 +1,6 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HyperV2012R2_Create.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.HyperV2012R2_Create" %> -<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> +<%@ Register TagPrefix="wsp" TagName="Generation" Src="../UserControls/Generation.ascx" %> +<%@ Register TagPrefix="wsp" TagName="DynamicMemory" Src="../UserControls/DynamicMemory.ascx" %> - - - - - - - - -
- - - 1 - 2 - -
-
+ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.cs index 18553f3d..884535d6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.cs @@ -27,25 +27,51 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Collections.Generic; +using System.Linq; +using System.Web.UI; using WebsitePanel.Providers.Virtualization; namespace WebsitePanel.Portal.ProviderControls { - public partial class HyperV2012R2_Create : WebsitePanelControlBase, IVirtualMachineCreateControl + public partial class HyperV2012R2_Create : WebsitePanelControlBase, IVirtualMachineSettingsControl { + private bool _isEditMode; + protected void Page_Load(object sender, EventArgs e) { } + public bool IsEditMode + { + get { return _isEditMode; } + set + { + _isEditMode = value; + SettingContols.ForEach(s=>s.IsEditMode = _isEditMode); + } + } + public void BindItem(VirtualMachine item) { - var generation = item.Generation > 1 ? item.Generation : 1; - ddlGeneration.SelectedValue = generation.ToString(); + SettingContols.ForEach(s => s.BindItem(item)); } public void SaveItem(VirtualMachine item) { - item.Generation = Convert.ToInt32(ddlGeneration.SelectedValue); + SettingContols.ForEach(s => s.SaveItem(item)); + } + + private List SettingContols + { + get + { + return Controls + .Cast() + .Where(c => c is IVirtualMachineSettingsControl) + .Cast() + .ToList(); + } } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.designer.cs index ffb228ce..a48cb3d9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.designer.cs @@ -13,39 +13,21 @@ namespace WebsitePanel.Portal.ProviderControls { public partial class HyperV2012R2_Create { /// - /// secGeneration control. + /// GenerationSetting control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.CollapsiblePanel secGeneration; + protected global::WebsitePanel.Portal.VPS.UserControls.Generation GenerationSetting; /// - /// GenerationPanel control. + /// DynamicMemorySetting control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Panel GenerationPanel; - - /// - /// locGeneration control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locGeneration; - - /// - /// ddlGeneration control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList ddlGeneration; + protected global::WebsitePanel.Portal.VPS.UserControls.DynamicMemory DynamicMemorySetting; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx new file mode 100644 index 00000000..6be1b29e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx @@ -0,0 +1,4 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HyperV2012R2_Edit.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.HyperV2012R2_Edit" %> +<%@ Register TagPrefix="wsp" TagName="DynamicMemory" Src="../UserControls/DynamicMemory.ascx" %> + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx.cs new file mode 100644 index 00000000..1fd43a45 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx.cs @@ -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 WebsitePanel.Providers.Virtualization; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class HyperV2012R2_Edit : WebsitePanelControlBase, IVirtualMachineSettingsControl + { + protected void Page_Load(object sender, EventArgs e) + { + } + + public bool IsEditMode { get; set; } + + public void BindItem(VirtualMachine item) + { + DynamicMemorySetting.BindItem(item); + } + + public void SaveItem(VirtualMachine item) + { + DynamicMemorySetting.SaveItem(item); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx.designer.cs new file mode 100644 index 00000000..8d77b902 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// +// 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 HyperV2012R2_Edit { + + /// + /// DynamicMemorySetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS.UserControls.DynamicMemory DynamicMemorySetting; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/App_LocalResources/DynamicMemory.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/App_LocalResources/DynamicMemory.ascx.resx new file mode 100644 index 00000000..de7f7771 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/App_LocalResources/DynamicMemory.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 + + + Dymanic memory: + + + Dymanic memory + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/App_LocalResources/Generation.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/App_LocalResources/Generation.ascx.resx new file mode 100644 index 00000000..5b5b2e6f --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/App_LocalResources/Generation.ascx.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + First + + + Second + + + Generation: + + + Generation + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx new file mode 100644 index 00000000..65e54d68 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx @@ -0,0 +1,17 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DynamicMemory.ascx.cs" Inherits="WebsitePanel.Portal.VPS.UserControls.DynamicMemory" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> + + + + + + + + + +
+ + +
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx.cs new file mode 100644 index 00000000..99314d09 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx.cs @@ -0,0 +1,50 @@ +// 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 WebsitePanel.Providers.Virtualization; + +namespace WebsitePanel.Portal.VPS.UserControls +{ + public partial class DynamicMemory : WebsitePanelControlBase, IVirtualMachineSettingsControl + { + protected void Page_Load(object sender, EventArgs e) + { + } + + public bool IsEditMode { get; set; } + + public void BindItem(VirtualMachine item) + { + } + + public void SaveItem(VirtualMachine item) + { + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx.designer.cs new file mode 100644 index 00000000..55c21c10 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx.designer.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// 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.VPS.UserControls { + + + public partial class DynamicMemory { + + /// + /// secDymanicMemory control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secDymanicMemory; + + /// + /// DymanicMemoryPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel DymanicMemoryPanel; + + /// + /// locDymanicMemory control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDymanicMemory; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx new file mode 100644 index 00000000..bab1e23d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx @@ -0,0 +1,24 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Generation.ascx.cs" Inherits="WebsitePanel.Portal.VPS.UserControls.Generation" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> + + + + + + + + +
+ + + <% if (IsEditMode) + { %> + + 1 + 2 + + <% } else { %> + + <% } %> +
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx.cs new file mode 100644 index 00000000..8b135de2 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx.cs @@ -0,0 +1,54 @@ +// 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 WebsitePanel.Providers.Virtualization; + +namespace WebsitePanel.Portal.VPS.UserControls +{ + public partial class Generation : WebsitePanelControlBase, IVirtualMachineSettingsControl + { + protected void Page_Load(object sender, EventArgs e) + { + } + + public bool IsEditMode { get; set; } + + public void BindItem(VirtualMachine item) + { + var generation = item.Generation > 1 ? item.Generation : 1; + ddlGeneration.SelectedValue = generation.ToString(); + lblGeneration.Text = generation.ToString(); + } + + public void SaveItem(VirtualMachine item) + { + item.Generation = Convert.ToInt32(ddlGeneration.SelectedValue); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx.designer.cs new file mode 100644 index 00000000..14a00d87 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.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.VPS.UserControls { + + + public partial class Generation { + + /// + /// secGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secGeneration; + + /// + /// GenerationPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel GenerationPanel; + + /// + /// locGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGeneration; + + /// + /// ddlGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlGeneration; + + /// + /// lblGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblGeneration; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx index 00efcc3b..75d7ca62 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx @@ -189,6 +189,7 @@ + <%-- Additional Custom Settings. Provider Control --%> + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs index a3b3dedb..ffd4ef90 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs @@ -61,18 +61,19 @@ namespace WebsitePanel.Portal.VPS try { LoadProviderControl(PanelSecurity.PackageId, "VPS", createSettingsProviderControl, "Create.ascx"); + if (CreareSettingsProviderControl != null) CreareSettingsProviderControl.IsEditMode = true; } catch { /* skip */ } } - private IVirtualMachineCreateControl CreareSettingsProviderControl + private IVirtualMachineSettingsControl CreareSettingsProviderControl { get { if (createSettingsProviderControl.Controls.Count == 0) return null; - return (IVirtualMachineCreateControl)createSettingsProviderControl.Controls[0]; + return (IVirtualMachineSettingsControl)createSettingsProviderControl.Controls[0]; } } @@ -136,11 +137,7 @@ namespace WebsitePanel.Portal.VPS ddlCpu.SelectedIndex = ddlCpu.Items.Count - 1; // select last (maximum) item // the custom provider control - if (CreareSettingsProviderControl != null) - { - IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)createSettingsProviderControl.Controls[0]; - ctrl.BindItem(new VirtualMachine()); - } + if (CreareSettingsProviderControl != null) CreareSettingsProviderControl.BindItem(new VirtualMachine()); // external network details if (PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS_EXTERNAL_NETWORK_ENABLED)) @@ -266,6 +263,11 @@ namespace WebsitePanel.Portal.VPS private void BindSummary() { + VirtualMachine virtualMachine = new VirtualMachine(); + + // the custom provider control + if (CreareSettingsProviderControl != null) CreareSettingsProviderControl.SaveItem(virtualMachine); + // general litHostname.Text = PortalAntiXSS.Encode(String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim())); litOperatingSystem.Text = listOperatingSystems.SelectedItem.Text; @@ -276,6 +278,7 @@ namespace WebsitePanel.Portal.VPS // config litCpu.Text = PortalAntiXSS.Encode(ddlCpu.SelectedValue); litRam.Text = PortalAntiXSS.Encode(txtRam.Text.Trim()); + litGeneration.Text = CreareSettingsProviderControl != null ? PortalAntiXSS.Encode(virtualMachine.Generation.ToString()) : "1"; litHdd.Text = PortalAntiXSS.Encode(txtHdd.Text.Trim()); litSnapshots.Text = PortalAntiXSS.Encode(txtSnapshots.Text.Trim()); optionDvdInstalled.Value = chkDvdInstalled.Checked; @@ -319,11 +322,7 @@ namespace WebsitePanel.Portal.VPS VirtualMachine virtualMachine = new VirtualMachine(); // the custom provider control - if (CreareSettingsProviderControl != null) - { - IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)createSettingsProviderControl.Controls[0]; - ctrl.SaveItem(virtualMachine); - } + if (CreareSettingsProviderControl != null) CreareSettingsProviderControl.SaveItem(virtualMachine); // collect and prepare data string hostname = String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim()); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.designer.cs index 8c736e9c..c59edd8c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.designer.cs @@ -993,6 +993,24 @@ namespace WebsitePanel.Portal.VPS { /// protected global::System.Web.UI.WebControls.Literal litRam; + /// + /// locGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGeneration; + + /// + /// litGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litGeneration; + /// /// locHdd control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx index 4d483ccf..721d18e3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx @@ -80,6 +80,9 @@ + <%-- Additional Custom Settings. Provider Control --%> + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx.cs index b4252e5c..937122f4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx.cs @@ -41,12 +41,34 @@ namespace WebsitePanel.Portal.VPS { protected void Page_Load(object sender, EventArgs e) { + LoadCustomProviderControls(); + if (!IsPostBack) { BindConfiguration(); } } + private void LoadCustomProviderControls() + { + try + { + LoadProviderControl(PanelSecurity.PackageId, "VPS", editSettingsProviderControl, "Edit.ascx"); + } + catch { /* skip */ } + } + + private IVirtualMachineSettingsControl EditSettingsProviderControl + { + get + { + if (editSettingsProviderControl.Controls.Count == 0) + return null; + + return (IVirtualMachineSettingsControl)editSettingsProviderControl.Controls[0]; + } + } + private void BindConfiguration() { VirtualMachine vm = null; @@ -96,8 +118,8 @@ namespace WebsitePanel.Portal.VPS chkExternalNetworkEnabled.Checked = vm.ExternalNetworkEnabled; chkPrivateNetworkEnabled.Checked = vm.PrivateNetworkEnabled; - // toggle controls - + // the custom provider control + if (EditSettingsProviderControl != null) EditSettingsProviderControl.BindItem(vm); // other quotas BindCheckboxOption(chkDvdInstalled, Quotas.VPS_DVD_ENABLED); @@ -146,6 +168,11 @@ namespace WebsitePanel.Portal.VPS return; } + VirtualMachine virtualMachine = new VirtualMachine(); + + // the custom provider control + if (EditSettingsProviderControl != null) EditSettingsProviderControl.SaveItem(virtualMachine); + ResultObject res = ES.Services.VPS.UpdateVirtualMachineConfiguration(PanelRequest.ItemID, Utils.ParseInt(ddlCpu.SelectedValue), Utils.ParseInt(txtRam.Text.Trim()), diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx.designer.cs index 3a79a132..641ab903 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsEditConfiguration.ascx.designer.cs @@ -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. - //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.1434 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -239,6 +210,15 @@ namespace WebsitePanel.Portal.VPS { /// protected global::System.Web.UI.WebControls.Localize locGB; + /// + /// editSettingsProviderControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder editSettingsProviderControl; + /// /// secSnapshots control. /// @@ -463,14 +443,5 @@ namespace WebsitePanel.Portal.VPS { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnCancel; - - /// - /// FormComments control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize FormComments; } } 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 faa2b0e3..4e2ba11d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -195,7 +195,7 @@ - + @@ -265,6 +265,13 @@ HyperV2012R2_Settings.ascx + + HyperV2012R2_Edit.ascx + ASPXCodeBehind + + + HyperV2012R2_Edit.ascx + HyperV2012R2_Create.ascx ASPXCodeBehind @@ -4062,6 +4069,20 @@ VpsEventsLog.ascx + + DynamicMemory.ascx + ASPXCodeBehind + + + DynamicMemory.ascx + + + Generation.ascx + ASPXCodeBehind + + + Generation.ascx + VpsMoveServer.ascx ASPXCodeBehind @@ -4539,6 +4560,7 @@ + @@ -4781,6 +4803,8 @@ + + @@ -4792,6 +4816,15 @@ + + Designer + + + Designer + + + Designer +