From 4d2e30d5feab16ba08a08c83469776037d0891ff Mon Sep 17 00:00:00 2001 From: robvde Date: Tue, 12 Aug 2014 21:15:21 +0800 Subject: [PATCH 01/91] Fix up to enable publishing --- .../WebsitePanel.EnterpriseServer.csproj | 44 ++++++- .../WebsitePanel.Server.csproj | 118 +++++++++++++++++- ...bsitePanel.Portal.Ecommerce.Modules.csproj | 7 ++ .../WebsitePanel.Portal.Modules.csproj | 1 + .../WebsitePanel.WebPortal.csproj | 22 ++++ 5 files changed, 187 insertions(+), 5 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj index cbc87b11..0856c2a6 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj @@ -83,6 +83,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -116,9 +150,9 @@ - + Designer - + @@ -288,6 +322,12 @@ + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj index 8b1d2bb6..4f7a0856 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj @@ -35,6 +35,7 @@ 4 AllRules.ruleset 618 + OnlyFilesToRunTheApp none @@ -91,6 +92,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -115,9 +221,11 @@ - + + + Designer - + @@ -243,6 +351,10 @@ {684C932A-6C75-46AC-A327-F3689D89EB42} WebsitePanel.Providers.Base + + {990c4a2a-34a5-4be0-9546-e10abdfffd0e} + WebsitePanel.Server.Client + {E91E52F3-9555-4D00-B577-2B1DBDD87CA7} WebsitePanel.Server.Utils @@ -253,7 +365,7 @@ - + 10.0 diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/Ecommerce/WebsitePanel.Portal.Ecommerce.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/Ecommerce/WebsitePanel.Portal.Ecommerce.Modules.csproj index dc3daeca..5593d561 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/Ecommerce/WebsitePanel.Portal.Ecommerce.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/Ecommerce/WebsitePanel.Portal.Ecommerce.Modules.csproj @@ -20,6 +20,10 @@ v4.0 false + + + + true @@ -1164,6 +1168,9 @@ + + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 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 84a7a6bc..c6b67e3e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -5301,6 +5301,7 @@ Designer + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj index c5ae723d..3cc8372b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj @@ -149,6 +149,24 @@ + + + + + + + + + + + + + + + + + + @@ -247,6 +265,10 @@ + + + + From 84df04ae8489f50520bc85b49d9c9eb92bde995b Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 31 Aug 2014 09:28:14 +0800 Subject: [PATCH 02/91] Partial Check on Hyper-V 2012 R2 VPS provider --- WebsitePanel/Database/update_db.sql | 11 +- .../WebsitePanel.EnterpriseServer/Web.config | 4 +- .../Virtualization/VirtualMachine.cs | 10 + .../Virtualization/VirtualMachineState.cs | 31 +- .../Virtualization/VirtualSwitch.cs | 1 + .../HyperV2012R2.cs | 2684 +++++++++++++++++ .../Properties/AssemblyInfo.cs | 21 + ...oviders.Virtualization.HyperV2012R2.csproj | 80 + .../Wmi.cs | 295 ++ .../Sources/WebsitePanel.Server.Utils/Log.cs | 3 + WebsitePanel/Sources/WebsitePanel.Server.sln | 16 +- .../Sources/WebsitePanel.Server/Web.config | 6 +- .../WebsitePanel.Server.csproj | 2 + 13 files changed, 3156 insertions(+), 8 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Properties/AssemblyInfo.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Wmi.cs diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 3f2dd1b2..e98d2bbf 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -4462,4 +4462,13 @@ GO BEGIN UPDATE [dbo].[ServiceItemTypes] SET [Suspendable] = 1 WHERE [ItemTypeID] = 38 AND [GroupID] = 23 END -GO \ No newline at end of file +GO + + +-- Hyper-V 2012 R2 +IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'Microsoft Hyper-V 2012 R2') +BEGIN +INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (350, 30, N'HyperV2012R2', N'Microsoft Hyper-V 2012 R2', N'WebsitePanel.Providers.Virtualization.HyperV2012R2, WebsitePanel.Providers.Virtualization.HyperV2012R2', N'HyperV', 1) +END +GO + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config index 3a721fdd..16814ac8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config @@ -5,11 +5,11 @@ - + - + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs index be219358..f8be508c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs @@ -123,5 +123,15 @@ namespace WebsitePanel.Providers.Virtualization // for GetVirtualMachineEx used in import method public VirtualMachineNetworkAdapter[] Adapters { get; set; } + + [Persistent] + public string Status { get; set; } + + [Persistent] + public string ReplicationState { get; set; } + + [Persistent] + public int Generation { get; set; } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachineState.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachineState.cs index 9076b189..0afe3092 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachineState.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachineState.cs @@ -34,8 +34,9 @@ namespace WebsitePanel.Providers.Virtualization { public enum VirtualMachineState { + /* Unknown = 0, - Started = 2, // start + Running = 2, // start Off = 3, // turn off Reset = 10, // reset Paused = 32768, // pause @@ -47,5 +48,33 @@ namespace WebsitePanel.Providers.Virtualization Stopping = 32774, Deleted = 32775, Pausing = 32776 + */ + + Unknown = 0, + Other = 1, + Running = 2, + Off = 3, + Stopping = 4, + Saved = 6, + Paused = 9, + Starting = 10, + Reset = 11, + Saving = 32773, + Pausing = 32776, + Resuming = 32777, + FastSaved = 32779, + FastSaving = 32780, + RunningCritical = 32781, + OffCritical = 32782, + StoppingCritical = 32783, + SavedCritical = 32784, + PausedCritical = 32785, + StartingCritical = 32786, + ResetCritical = 32787, + SavingCritical = 32788, + PausingCritical = 32789, + ResumingCritical = 32790, + FastSavedCritical = 32791, + FastSavingCritical = 32792 } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualSwitch.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualSwitch.cs index 997c45f4..8125587c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualSwitch.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualSwitch.cs @@ -37,5 +37,6 @@ namespace WebsitePanel.Providers.Virtualization { [Persistent] public string SwitchId { get; set; } + public string SwitchType { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs new file mode 100644 index 00000000..f3d7688e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -0,0 +1,2684 @@ +// Copyright (c) 2014, 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.IO; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +using System.Text; +using System.Drawing; +using System.Drawing.Imaging; + +using System.Management; +using System.Management.Automation; +using System.Management.Automation.Runspaces; + +using System.Reflection; +using System.Globalization; + +using System.Xml; +using WebsitePanel.Providers; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.Utils; +using WebsitePanel.Server.Utils; + +using Vds = Microsoft.Storage.Vds; +using System.Configuration; + +namespace WebsitePanel.Providers.Virtualization +{ + public class HyperV2012R2 : HostingServiceProviderBase, IVirtualizationServer + { + #region Constants + private const string CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG = "WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag"; + private const string WMI_VIRTUALIZATION_NAMESPACE = @"root\virtualization"; + private const string WMI_CIMV2_NAMESPACE = @"root\cimv2"; + + private const int SWITCH_PORTS_NUMBER = 1024; + private const string LIBRARY_INDEX_FILE_NAME = "index.xml"; + private const string EXTERNAL_NETWORK_ADAPTER_NAME = "External Network Adapter"; + private const string PRIVATE_NETWORK_ADAPTER_NAME = "Private Network Adapter"; + private const string MANAGEMENT_NETWORK_ADAPTER_NAME = "Management Network Adapter"; + + private const string KVP_RAM_SUMMARY_KEY = "VM-RAM-Summary"; + private const string KVP_HDD_SUMMARY_KEY = "VM-HDD-Summary"; + private const Int64 Size1G = 0x40000000; + private const Int64 Size1M = 0x100000; + + #endregion + + #region Provider Settings + protected string ServerNameSettings + { + get { return ProviderSettings["ServerName"]; } + } + + public int AutomaticStartActionSettings + { + get { return ProviderSettings.GetInt("StartAction"); } + } + + public int AutomaticStartupDelaySettings + { + get { return ProviderSettings.GetInt("StartupDelay"); } + } + + public int AutomaticStopActionSettings + { + get { return ProviderSettings.GetInt("StopAction"); } + } + + public int AutomaticRecoveryActionSettings + { + get { return 1 /* restart */; } + } + + public int CpuReserveSettings + { + get { return ProviderSettings.GetInt("CpuReserve"); } + } + + public int CpuLimitSettings + { + get { return ProviderSettings.GetInt("CpuLimit"); } + } + + public int CpuWeightSettings + { + get { return ProviderSettings.GetInt("CpuWeight"); } + } + #endregion + + #region Fields + private Wmi _wmi = null; + + private Wmi wmi + { + get + { + if (_wmi == null) + _wmi = new Wmi(ServerNameSettings, WMI_VIRTUALIZATION_NAMESPACE); + return _wmi; + } + } + #endregion + + #region Constructors + public HyperV2012R2() + { + } + #endregion + + #region Virtual Machines + public VirtualMachine GetVirtualMachine(string vmId) + { + + HostedSolutionLog.LogStart("GetVirtualMachine"); + HostedSolutionLog.DebugInfo("Virtual Machine: {0}", vmId); + + Runspace runSpace = null; + VirtualMachine vm = new VirtualMachine(); + + try + { + runSpace = OpenRunspace(); + Command cmd = new Command("Get-VM"); + + cmd.Parameters.Add("Id", vmId); + + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if (result != null && result.Count > 0) + { + vm.Name = GetPSObjectProperty(result[0], "Name").ToString(); + vm.State = (VirtualMachineState)Enum.Parse(typeof(VirtualMachineState), GetPSObjectProperty(result[0], "State").ToString()); + vm.CpuUsage = ConvertNullableToInt32((UInt32?)GetPSObjectProperty(result[0], "CpuUsage")); + vm.RamUsage = ConvertNullableToInt32((UInt32?)GetPSObjectProperty(result[0], "MemoryAssigned")); + vm.Uptime = TimeSpan.Parse(GetPSObjectProperty(result[0], "Uptime").ToString()).Ticks; + vm.Status = GetPSObjectProperty(result[0], "Status").ToString(); + vm.ReplicationState = GetPSObjectProperty(result[0], "ReplicationState").ToString(); + + vm.Heartbeat = GetVMHeartBeatStatus(runSpace, vm.Name); + + + //vm.CreatedDate = null; + + // HDD + /* + if (vmKvp.Name == KVP_HDD_SUMMARY_KEY) + { + string[] disksArray = vmKvp.Data.Split(';'); + vm.HddLogicalDisks = new LogicalDisk[disksArray.Length]; + for (int i = 0; i < disksArray.Length; i++) + { + string[] disk = disksArray[i].Split(':'); + vm.HddLogicalDisks[i] = new LogicalDisk(); + vm.HddLogicalDisks[i].DriveLetter = disk[0]; + vm.HddLogicalDisks[i].FreeSpace = Int32.Parse(disk[1]); + vm.HddLogicalDisks[i].Size = Int32.Parse(disk[2]); + } + } + */ + } + } + catch (Exception ex) + { + HostedSolutionLog.LogError("GetVirtualMachine", ex); + throw; + } + finally + { + CloseRunspace(runSpace); + } + + HostedSolutionLog.LogEnd("GetVirtualMachine"); + return vm; + + } + + internal OperationalStatus GetVMHeartBeatStatus(Runspace runSpace, string name) + { + + OperationalStatus status = OperationalStatus.None; + + runSpace = OpenRunspace(); + Command cmd = new Command("Get-VMIntegrationService"); + + cmd.Parameters.Add("VMName", name); + cmd.Parameters.Add("Name", "HeartBeat"); + + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if (result != null && result.Count > 0) + { + status = (OperationalStatus)Enum.Parse(typeof(OperationalStatus), GetPSObjectProperty(result[0], "PrimaryOperationalStatus").ToString()); + } + + + return status; + } + + public VirtualMachine GetVirtualMachineEx(string vmId) + { + ManagementObject objVm = wmi.GetWmiObject("msvm_ComputerSystem", "Name = '{0}'", vmId); + if (objVm == null) + return null; + + // general settings + VirtualMachine vm = CreateVirtualMachineFromWmiObject(objVm); + + // CPU + ManagementObject objCpu = wmi.GetWmiObject("Msvm_ProcessorSettingData", "InstanceID Like 'Microsoft:{0}%'", vmId); + vm.CpuCores = Convert.ToInt32(objCpu["VirtualQuantity"]); + + // RAM + ManagementObject objRam = wmi.GetWmiObject("Msvm_MemorySettingData", "InstanceID Like 'Microsoft:{0}%'", vmId); + vm.RamSize = Convert.ToInt32(objRam["VirtualQuantity"]); + + // other settings + ManagementObject objSettings = GetVirtualMachineSettingsObject(vmId); + + // BIOS (num lock) + vm.NumLockEnabled = Convert.ToBoolean(objSettings["BIOSNumLock"]); + + // BIOS (boot order) + // BootOrder = 0 - Boot from floppy, 1 - Boot from CD, 2 - Boot from disk, 3 - PXE Boot + UInt16[] bootOrder = (UInt16[])objSettings["BootOrder"]; + vm.BootFromCD = (bootOrder[0] == 1); + + // DVD drive + ManagementObject objDvd = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Synthetic DVD Drive'" + + " and InstanceID Like 'Microsoft:{0}%'", vmId); + vm.DvdDriveInstalled = (objDvd != null); + + // HDD + ManagementObject objVhd = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Virtual Hard Disk'" + + " and InstanceID like 'Microsoft:{0}%'", vmId); + + if (objVhd != null) + { + vm.VirtualHardDrivePath = ((string[])objVhd["Connection"])[0]; + + // get VHD size + VirtualHardDiskInfo vhdInfo = GetVirtualHardDiskInfo(vm.VirtualHardDrivePath); + if (vhdInfo != null) + vm.HddSize = Convert.ToInt32(vhdInfo.MaxInternalSize / Size1G); + } + + // network adapters + List nics = new List(); + ManagementObject objVM = GetVirtualMachineObject(vmId); + + // synthetic adapters + foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_SyntheticEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId)) + nics.Add(new VirtualMachineNetworkAdapter() { Name = (string)objNic["ElementName"], MacAddress = (string)objNic["Address"] }); + + // legacy adapters + foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_EmulatedEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId)) + nics.Add(new VirtualMachineNetworkAdapter() { Name = (string)objNic["ElementName"], MacAddress = (string)objNic["Address"] }); + + vm.Adapters = nics.ToArray(); + + return vm; + } + + public List GetVirtualMachines() + { + List vms = new List(); + + ManagementObjectCollection objVms = wmi.ExecuteWmiQuery("select * from msvm_ComputerSystem where Name <> ElementName"); + foreach (ManagementObject objVm in objVms) + vms.Add(CreateVirtualMachineFromWmiObject(objVm)); + + return vms; + } + + public byte[] GetVirtualMachineThumbnailImage(string vmId, ThumbnailSize size) + { + ManagementBaseObject objSummary = GetVirtualMachineSummaryInformation(vmId, (SummaryInformationRequest)size); + wmi.Dump(objSummary); + return GetTumbnailFromSummaryInformation(objSummary, size); + } + + private byte[] GetTumbnailFromSummaryInformation(ManagementBaseObject objSummary, ThumbnailSize size) + { + int width = 80; + int height = 60; + + if (size == ThumbnailSize.Medium160x120) + { + width = 160; + height = 120; + } + else if (size == ThumbnailSize.Large320x240) + { + width = 320; + height = 240; + } + + byte[] imgData = (byte[])objSummary["ThumbnailImage"]; + + // create new bitmap + Bitmap bmp = new Bitmap(width, height); + + if (imgData != null) + { + // lock bitmap + Rectangle rect = new Rectangle(0, 0, width, height); + BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format16bppRgb565); + + // get address of the first line + IntPtr ptr = bmpData.Scan0; + + // coby thumbnail bytes into bitmap + System.Runtime.InteropServices.Marshal.Copy(imgData, 0, ptr, imgData.Length); + + // unlock image + bmp.UnlockBits(bmpData); + } + else + { + // fill grey rectangle + Graphics g = Graphics.FromImage(bmp); + SolidBrush brush = new SolidBrush(Color.LightGray); + g.FillRectangle(brush, 0, 0, width, height); + } + + MemoryStream stream = new MemoryStream(); + bmp.Save(stream, ImageFormat.Png); + + stream.Flush(); + byte[] buffer = stream.ToArray(); + + bmp.Dispose(); + stream.Dispose(); + + return buffer; + } + + public VirtualMachine CreateVirtualMachine(VirtualMachine vm) + { + // evaluate paths + vm.RootFolderPath = FileUtils.EvaluateSystemVariables(vm.RootFolderPath); + vm.OperatingSystemTemplatePath = FileUtils.EvaluateSystemVariables(vm.OperatingSystemTemplatePath); + vm.VirtualHardDrivePath = FileUtils.EvaluateSystemVariables(vm.VirtualHardDrivePath); + + string vmID = null; + + // request management service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // display name + ManagementObject objGlobalSettings = wmi.GetWmiClass("msvm_VirtualSystemGlobalSettingData").CreateInstance(); + objGlobalSettings["ElementName"] = vm.Name; + + // VM folders + objGlobalSettings["ExternalDataRoot"] = vm.RootFolderPath; + objGlobalSettings["SnapshotDataRoot"] = vm.RootFolderPath; + + wmi.Dump(objGlobalSettings); + + // startup/shutdown actions + if (AutomaticStartActionSettings != 100) + { + objGlobalSettings["AutomaticStartupAction"] = AutomaticStartActionSettings; + objGlobalSettings["AutomaticStartupActionDelay"] = String.Format("000000000000{0:d2}.000000:000", AutomaticStartupDelaySettings); + } + + if (AutomaticStopActionSettings != 100) + objGlobalSettings["AutomaticShutdownAction"] = AutomaticStopActionSettings; + + if (AutomaticRecoveryActionSettings != 100) + objGlobalSettings["AutomaticRecoveryAction"] = AutomaticRecoveryActionSettings; + + // create machine + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("DefineVirtualSystem"); + inParams["SystemSettingData"] = objGlobalSettings.GetText(TextFormat.CimDtd20); + inParams["ResourceSettingData"] = new string[] { }; + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("DefineVirtualSystem", inParams, null); + ManagementObject objVM = wmi.GetWmiObjectByPath((string)outParams["DefinedSystem"]); + + // job + JobResult job = CreateJobResultFromWmiMethodResults(outParams); ; + + // read VM id + vmID = (string)objVM["Name"]; + + // update general settings + UpdateVirtualMachineGeneralSettings(vmID, objVM, + vm.CpuCores, + vm.RamSize, + vm.BootFromCD, + vm.NumLockEnabled); + + // hard disks + // load IDE 0 controller + ManagementObject objIDE0 = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Emulated IDE Controller'" + + " and InstanceID Like 'Microsoft:{0}%' and Address = 0", vmID); + + // load default hard disk drive + ManagementObject objDefaultHdd = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Synthetic Disk Drive'" + + " and InstanceID like '%Default'"); + ManagementObject objHdd = (ManagementObject)objDefaultHdd.Clone(); + objHdd["Parent"] = objIDE0.Path; + objHdd["Address"] = 0; + + // add HDD to VM resources + ManagementObject objAddedHDD = AddVirtualMachineResources(objVM, objHdd); + + // attach VHD + string fullVhdPath = vm.VirtualHardDrivePath; + ManagementObject objDefaultVHD = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Virtual Hard Disk'" + + " and InstanceID like '%Default'"); + ManagementObject objVhd = (ManagementObject)objDefaultVHD.Clone(); + objVhd["Parent"] = objAddedHDD.Path.Path; + objVhd["Connection"] = new string[] { fullVhdPath }; + + // add VHD to the system + AddVirtualMachineResources(objVM, objVhd); + + // DVD drive + if (vm.DvdDriveInstalled) + { + AddVirtualMachineDvdDrive(vmID, objVM); + } + + // add external adapter + if (vm.ExternalNetworkEnabled && !String.IsNullOrEmpty(vm.ExternalSwitchId)) + AddNetworkAdapter(objVM, vm.ExternalSwitchId, vm.Name, vm.ExternalNicMacAddress, EXTERNAL_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter); + + // add private adapter + if (vm.PrivateNetworkEnabled && !String.IsNullOrEmpty(vm.PrivateSwitchId)) + AddNetworkAdapter(objVM, vm.PrivateSwitchId, vm.Name, vm.PrivateNicMacAddress, PRIVATE_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter); + + // add management adapter + if (vm.ManagementNetworkEnabled && !String.IsNullOrEmpty(vm.ManagementSwitchId)) + AddNetworkAdapter(objVM, vm.ManagementSwitchId, vm.Name, vm.ManagementNicMacAddress, MANAGEMENT_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter); + + vm.VirtualMachineId = vmID; + return vm; + } + + public VirtualMachine UpdateVirtualMachine(VirtualMachine vm) + { + string vmId = vm.VirtualMachineId; + + // get VM object + ManagementObject objVM = GetVirtualMachineObject(vmId); + + // update general settings + UpdateVirtualMachineGeneralSettings(vmId, objVM, + vm.CpuCores, + vm.RamSize, + vm.BootFromCD, + vm.NumLockEnabled); + + // check DVD drive + ManagementObject objDvdDrive = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Synthetic DVD Drive'" + + " and InstanceID like 'Microsoft:{0}%' and Address = 0", vmId); + + if (vm.DvdDriveInstalled && objDvdDrive == null) + AddVirtualMachineDvdDrive(vmId, objVM); + else if (!vm.DvdDriveInstalled && objDvdDrive != null) + RemoveVirtualMachineResources(objVM, objDvdDrive); + + // External NIC + if (!vm.ExternalNetworkEnabled + && !String.IsNullOrEmpty(vm.ExternalNicMacAddress)) + { + // delete adapter + DeleteNetworkAdapter(objVM, vm.ExternalNicMacAddress); + + // reset MAC + vm.ExternalNicMacAddress = null; + } + else if (vm.ExternalNetworkEnabled + && !String.IsNullOrEmpty(vm.ExternalNicMacAddress)) + { + // add external adapter + AddNetworkAdapter(objVM, vm.ExternalSwitchId, vm.Name, vm.ExternalNicMacAddress, EXTERNAL_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter); + } + + + // Private NIC + if (!vm.PrivateNetworkEnabled + && !String.IsNullOrEmpty(vm.PrivateNicMacAddress)) + { + // delete adapter + DeleteNetworkAdapter(objVM, vm.PrivateNicMacAddress); + + // reset MAC + vm.PrivateNicMacAddress = null; + } + else if (vm.PrivateNetworkEnabled + && !String.IsNullOrEmpty(vm.PrivateNicMacAddress)) + { + // add private adapter + AddNetworkAdapter(objVM, vm.PrivateSwitchId, vm.Name, vm.PrivateNicMacAddress, PRIVATE_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter); + } + + return vm; + } + + private void UpdateVirtualMachineGeneralSettings(string vmId, ManagementObject objVM, int cpuCores, int ramMB, bool bootFromCD, bool numLockEnabled) + { + // request management service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // VM resources + List vmConfig = new List(); + + // get system settings + ManagementObject objSettings = GetVirtualMachineSettingsObject(vmId); + + // BIOS (num lock) + objSettings["BIOSNumLock"] = numLockEnabled; + + // BIOS (boot order) + // BootOrder = 0 - Boot from floppy, 1 - Boot from CD, 2 - Boot from disk, 3 - PXE Boot + objSettings["BootOrder"] = bootFromCD ? new int[] { 1, 2, 3, 0 } : new int[] { 2, 1, 3, 0 }; + + // modify machine settings + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ModifyVirtualSystem"); + inParams["ComputerSystem"] = objVM; + inParams["SystemSettingData"] = objSettings.GetText(TextFormat.CimDtd20); + ManagementBaseObject outParams = objVmsvc.InvokeMethod("ModifyVirtualSystem", inParams, null); + JobResult job = CreateJobResultFromWmiMethodResults(outParams); + + // setup CPU + ManagementObject objCpu = wmi.GetWmiObject("Msvm_ProcessorSettingData", "InstanceID Like 'Microsoft:{0}%'", vmId); + objCpu["VirtualQuantity"] = cpuCores; + objCpu["Limit"] = Convert.ToInt64(CpuLimitSettings * 1000); + objCpu["Reservation"] = Convert.ToInt64(CpuReserveSettings * 1000); + objCpu["Weight"] = CpuWeightSettings; + vmConfig.Add(objCpu.GetText(TextFormat.CimDtd20)); + + // setup RAM + ManagementObject objRam = wmi.GetWmiObject("Msvm_MemorySettingData", "InstanceID Like 'Microsoft:{0}%'", vmId); + objRam["VirtualQuantity"] = ramMB.ToString(); + objRam["Reservation"] = ramMB.ToString(); + objRam["Limit"] = ramMB.ToString(); + vmConfig.Add(objRam.GetText(TextFormat.CimDtd20)); + + // modify machine resources + inParams = objVmsvc.GetMethodParameters("ModifyVirtualSystemResources"); + inParams["ComputerSystem"] = objVM; + inParams["ResourceSettingData"] = vmConfig.ToArray(); + outParams = objVmsvc.InvokeMethod("ModifyVirtualSystemResources", inParams, null); + job = CreateJobResultFromWmiMethodResults(outParams); + } + + private void AddVirtualMachineDvdDrive(string vmId, ManagementObject objVM) + { + // load IDE 1 controller + ManagementObject objIDE1 = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Emulated IDE Controller'" + + " and InstanceID Like 'Microsoft:{0}%' and Address = 1", vmId); + + // load default hard disk drive + ManagementObject objDefaultDvd = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Synthetic DVD Drive'" + + " and InstanceID like '%Default'"); + ManagementObject objDvd = (ManagementObject)objDefaultDvd.Clone(); + objDvd["Parent"] = objIDE1.Path; + objDvd["Address"] = 0; + + // add DVD drive to VM resources + AddVirtualMachineResources(objVM, objDvd); + } + + private void AddNetworkAdapter(ManagementObject objVm, string switchId, string portName, string macAddress, string adapterName, bool legacyAdapter) + { + string nicClassName = GetNetworkAdapterClassName(legacyAdapter); + + string vmId = (string)objVm["Name"]; + + // check if already exists + ManagementObject objNic = wmi.GetWmiObject( + nicClassName, "InstanceID like 'Microsoft:{0}%' and Address = '{1}'", vmId, macAddress); + + if (objNic != null) + return; // exists - exit + + portName = String.Format("{0} - {1}", + portName, (adapterName == EXTERNAL_NETWORK_ADAPTER_NAME) ? "External" : "Private"); + + // Network service + ManagementObject objNetworkSvc = GetVirtualSwitchManagementService(); + + // default NIC + ManagementObject objDefaultNic = wmi.GetWmiObject(nicClassName, "InstanceID like '%Default'"); + + // find switch + ManagementObject objSwitch = wmi.GetWmiObject("msvm_VirtualSwitch", "Name = '{0}'", switchId); + + // create switch port + ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("CreateSwitchPort"); + inParams["VirtualSwitch"] = objSwitch; + inParams["Name"] = portName; + inParams["FriendlyName"] = portName; + inParams["ScopeOfResidence"] = ""; + + // invoke method + ManagementBaseObject outParams = objNetworkSvc.InvokeMethod("CreateSwitchPort", inParams, null); + + // process output parameters + ReturnCode code = (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + if (code == ReturnCode.OK) + { + // created port + ManagementObject objPort = wmi.GetWmiObjectByPath((string)outParams["CreatedSwitchPort"]); + + // create NIC + ManagementObject objExtNic = (ManagementObject)objDefaultNic.Clone(); + objExtNic["Connection"] = new string[] { objPort.Path.Path }; + + if (!String.IsNullOrEmpty(macAddress)) + { + objExtNic["StaticMacAddress"] = true; + objExtNic["Address"] = macAddress; + } + else + { + objExtNic["StaticMacAddress"] = false; + } + objExtNic["ElementName"] = adapterName; + + if (!legacyAdapter) + objExtNic["VirtualSystemIdentifiers"] = new string[] { Guid.NewGuid().ToString("B") }; + + // add NIC + ManagementObject objCreatedExtNic = AddVirtualMachineResources(objVm, objExtNic); + } + } + + private string GetNetworkAdapterClassName(bool legacy) + { + return legacy ? "Msvm_EmulatedEthernetPortSettingData" : "Msvm_SyntheticEthernetPortSettingData"; + } + + private ManagementObject AddVirtualMachineResources(ManagementObject objVm, ManagementObject resource) + { + if (resource == null) + return resource; + + // request management service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // add resources + string txtResource = resource.GetText(TextFormat.CimDtd20); + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("AddVirtualSystemResources"); + inParams["TargetSystem"] = objVm; + inParams["ResourceSettingData"] = new string[] { txtResource }; + ManagementBaseObject outParams = objVmsvc.InvokeMethod("AddVirtualSystemResources", inParams, null); + JobResult result = CreateJobResultFromWmiMethodResults(outParams); + + if (result.ReturnValue == ReturnCode.OK) + { + string[] wmiPaths = (string[])outParams["NewResources"]; + return wmi.GetWmiObjectByPath(wmiPaths[0]); + } + else if (result.ReturnValue == ReturnCode.JobStarted) + { + if (JobCompleted(result.Job)) + { + string[] wmiPaths = (string[])outParams["NewResources"]; + return wmi.GetWmiObjectByPath(wmiPaths[0]); + } + else + { + throw new Exception("Cannot add virtual machine resources"); + } + } + else + { + throw new Exception("Cannot add virtual machine resources: " + txtResource); + } + } + + private JobResult RemoveVirtualMachineResources(ManagementObject objVm, ManagementObject resource) + { + if (resource == null) + return null; + + // request management service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // remove resources + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("RemoveVirtualSystemResources"); + inParams["TargetSystem"] = objVm; + inParams["ResourceSettingData"] = new string[] { resource.Path.Path }; + ManagementBaseObject outParams = objVmsvc.InvokeMethod("RemoveVirtualSystemResources", inParams, null); + JobResult result = CreateJobResultFromWmiMethodResults(outParams); + if (result.ReturnValue == ReturnCode.OK) + { + return result; + } + else if (result.ReturnValue == ReturnCode.JobStarted) + { + if (!JobCompleted(result.Job)) + { + throw new Exception("Cannot remove virtual machine resources"); + } + } + else + { + throw new Exception("Cannot remove virtual machine resources: " + resource.Path.Path); + } + + return result; + } + + public JobResult ChangeVirtualMachineState(string vmId, VirtualMachineRequestedState newState) + { + // target computer + ManagementObject objVm = GetVirtualMachineObject(vmId); + + // get method + ManagementBaseObject inParams = objVm.GetMethodParameters("RequestStateChange"); + inParams["RequestedState"] = (Int32)newState; + + // invoke method + ManagementBaseObject outParams = objVm.InvokeMethod("RequestStateChange", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public ReturnCode ShutDownVirtualMachine(string vmId, bool force, string reason) + { + // load virtual machine object + ManagementObject objVm = GetVirtualMachineObject(vmId); + ManagementObject objShutdown = wmi.GetRelatedWmiObject(objVm, "msvm_ShutdownComponent"); + + // execute InitiateShutdown method + ManagementBaseObject inParams = objShutdown.GetMethodParameters("InitiateShutdown"); + inParams["Force"] = force; + inParams["Reason"] = reason; + + // invoke method + ManagementBaseObject outParams = objShutdown.InvokeMethod("InitiateShutdown", inParams, null); + return (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + } + + public List GetVirtualMachineJobs(string vmId) + { + List jobs = new List(); + + ManagementBaseObject objSummary = GetVirtualMachineSummaryInformation( + vmId, SummaryInformationRequest.AsynchronousTasks); + ManagementBaseObject[] objJobs = (ManagementBaseObject[])objSummary["AsynchronousTasks"]; + + if (objJobs != null) + { + foreach (ManagementBaseObject objJob in objJobs) + jobs.Add(CreateJobFromWmiObject(objJob)); + } + + return jobs; + } + + public JobResult RenameVirtualMachine(string vmId, string name) + { + // load virtual machine + ManagementObject objVm = GetVirtualMachineObject(vmId); + + // load machine settings + ManagementObject objVmSettings = GetVirtualMachineSettingsObject(vmId); + + // rename machine + objVmSettings["ElementName"] = name; + + // save + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ModifyVirtualSystem"); + inParams["ComputerSystem"] = objVm.Path.Path; + inParams["SystemSettingData"] = objVmSettings.GetText(TextFormat.CimDtd20); + ManagementBaseObject outParams = objVmsvc.InvokeMethod("ModifyVirtualSystem", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public JobResult DeleteVirtualMachine(string vmId) + { + // load virtual machine object + ManagementObject objVm = GetVirtualMachineObject(vmId); + + // check state + VirtualMachine vm = GetVirtualMachine(vmId); + + // The virtual computer system must be in the powered off or saved state prior to calling this method. + if (vm.State == VirtualMachineState.Saved + || vm.State == VirtualMachineState.Off) + { + // delete network adapters and ports + DeleteNetworkAdapters(objVm); + + // destroy machine + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // get method + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("DestroyVirtualSystem"); + inParams["ComputerSystem"] = objVm; + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("DestroyVirtualSystem", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + else + { + throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Destroy method."); + } + } + + private void DeleteNetworkAdapters(ManagementObject objVM) + { + string vmId = (string)objVM["Name"]; + + // delete synthetic adapters + foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_SyntheticEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId)) + DeleteNetworkAdapter(objVM, objNic); + + // delete legacy adapters + foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_EmulatedEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId)) + DeleteNetworkAdapter(objVM, objNic); + } + + private void DeleteNetworkAdapter(ManagementObject objVM, string macAddress) + { + // locate network adapter + ManagementObject objNic = wmi.GetWmiObject("CIM_ResourceAllocationSettingData", "Address = '{0}'", macAddress); + + // delete adapter + DeleteNetworkAdapter(objVM, objNic); + } + + private void DeleteNetworkAdapter(ManagementObject objVM, ManagementObject objNic) + { + if (objNic == null) + return; + + // delete corresponding switch port + string[] conn = (string[])objNic["Connection"]; + if (conn != null && conn.Length > 0) + DeleteSwitchPort(conn[0]); + + // delete adapter + RemoveVirtualMachineResources(objVM, objNic); + } + + private void DeleteSwitchPort(string portPath) + { + // Network service + ManagementObject objNetworkSvc = GetVirtualSwitchManagementService(); + + // create switch port + ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("DeleteSwitchPort"); + inParams["SwitchPort"] = portPath; + + // invoke method + objNetworkSvc.InvokeMethod("DeleteSwitchPort", inParams, null); + } + + public JobResult ExportVirtualMachine(string vmId, string exportPath) + { + // load virtual machine object + ManagementObject objVm = GetVirtualMachineObject(vmId); + + // check state + VirtualMachine vm = GetVirtualMachine(vmId); + + // The virtual computer system must be in the powered off or saved state prior to calling this method. + if (vm.State == VirtualMachineState.Off) + { + // export machine + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // get method + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ExportVirtualSystem"); + inParams["ComputerSystem"] = objVm; + inParams["CopyVmState"] = true; + inParams["ExportDirectory"] = FileUtils.EvaluateSystemVariables(exportPath); + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("ExportVirtualSystem", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + else + { + throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Export method."); + } + } + #endregion + + #region Snapshots + public List GetVirtualMachineSnapshots(string vmId) + { + // get all VM setting objects + ManagementObject objVmSettings = GetVirtualMachineSettingsObject(vmId); + VirtualMachineSnapshot runningSnapshot = CreateSnapshotFromWmiObject(objVmSettings); + + // load snapshots + ManagementBaseObject objSummary = GetVirtualMachineSummaryInformation(vmId, SummaryInformationRequest.Snapshots); + ManagementBaseObject[] objSnapshots = (ManagementBaseObject[])objSummary["Snapshots"]; + + List snapshots = new List(); + + if (objSnapshots != null) + { + foreach (ManagementBaseObject objSnapshot in objSnapshots) + { + VirtualMachineSnapshot snapshot = CreateSnapshotFromWmiObject(objSnapshot); + snapshot.IsCurrent = (runningSnapshot.ParentId == snapshot.Id); + snapshots.Add(snapshot); + } + } + + return snapshots; + } + + public VirtualMachineSnapshot GetSnapshot(string snapshotId) + { + // load snapshot + ManagementObject objSnapshot = GetSnapshotObject(snapshotId); + return CreateSnapshotFromWmiObject(objSnapshot); + } + + public JobResult CreateSnapshot(string vmId) + { + // get VM management service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // load virtual machine + ManagementObject objVm = GetVirtualMachineObject(vmId); + + // get method params + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("CreateVirtualSystemSnapshot"); + inParams["SourceSystem"] = objVm; + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("CreateVirtualSystemSnapshot", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public JobResult RenameSnapshot(string vmId, string snapshotId, string name) + { + // load virtual machine + ManagementObject objVm = GetVirtualMachineObject(vmId); + + // load snapshot + ManagementObject objSnapshot = GetSnapshotObject(snapshotId); + + // rename snapshot + objSnapshot["ElementName"] = name; + + // save + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ModifyVirtualSystem"); + inParams["ComputerSystem"] = objVm.Path.Path; + inParams["SystemSettingData"] = objSnapshot.GetText(TextFormat.CimDtd20); + ManagementBaseObject outParams = objVmsvc.InvokeMethod("ModifyVirtualSystem", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public JobResult ApplySnapshot(string vmId, string snapshotId) + { + // get VM management service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // load virtual machine + ManagementObject objVm = GetVirtualMachineObject(vmId); + + // load snapshot + ManagementObject objSnapshot = GetSnapshotObject(snapshotId); + + ManagementObjectCollection objRelated = objVm.GetRelated("Msvm_SettingsDefineState"); + + // get method params + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ApplyVirtualSystemSnapshot"); + inParams["ComputerSystem"] = objVm.Path.Path; + inParams["SnapshotSettingData"] = objSnapshot.Path.Path; + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("ApplyVirtualSystemSnapshot", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public JobResult DeleteSnapshot(string snapshotId) + { + // get VM management service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // load snapshot object + ManagementObject objSnapshot = GetSnapshotObject(snapshotId); + + // get method params + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("RemoveVirtualSystemSnapshot"); + inParams["SnapshotSettingData"] = objSnapshot.Path.Path; + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("RemoveVirtualSystemSnapshot", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public JobResult DeleteSnapshotSubtree(string snapshotId) + { + // get VM management service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // load snapshot object + ManagementObject objSnapshot = GetSnapshotObject(snapshotId); + + // get method params + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("RemoveVirtualSystemSnapshotTree"); + inParams["SnapshotSettingData"] = objSnapshot.Path.Path; + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("RemoveVirtualSystemSnapshotTree", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public byte[] GetSnapshotThumbnailImage(string snapshotId, ThumbnailSize size) + { + ManagementBaseObject objSummary = GetSnapshotSummaryInformation(snapshotId, (SummaryInformationRequest)size); + return GetTumbnailFromSummaryInformation(objSummary, size); + } + #endregion + + #region DVD operations + public string GetInsertedDVD(string vmId) + { + // find CD/DVD disk + ManagementObject objDvd = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Virtual CD/DVD Disk'" + + " and InstanceID Like 'Microsoft:{0}%'", vmId); + + if (objDvd == null) + return null; + + string[] path = (string[])objDvd["Connection"]; + if (path != null && path.Length > 0) + return path[0]; + + return null; + } + + public JobResult InsertDVD(string vmId, string isoPath) + { + isoPath = FileUtils.EvaluateSystemVariables(isoPath); + + // find DVD drive + ManagementObject objDvdDrive = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Synthetic DVD Drive'" + + " and InstanceID Like 'Microsoft:{0}%'", vmId); + + // create CD/DVD disk + ManagementObject objDefaultDVD = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Virtual CD/DVD Disk'" + + " and InstanceID like '%Default'"); + ManagementObject objDvd = (ManagementObject)objDefaultDVD.Clone(); + objDvd["Parent"] = objDvdDrive.Path; + objDvd["Connection"] = new string[] { isoPath }; + + // get VM service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // get method + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("AddVirtualSystemResources"); + inParams["TargetSystem"] = GetVirtualMachineObject(vmId); + inParams["ResourceSettingData"] = new string[] { objDvd.GetText(TextFormat.CimDtd20) }; + + // execute method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("AddVirtualSystemResources", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public JobResult EjectDVD(string vmId) + { + // find CD/DVD disk + ManagementObject objDvd = wmi.GetWmiObject( + "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Virtual CD/DVD Disk'" + + " and InstanceID Like 'Microsoft:{0}%'", vmId); + + // get VM service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // get method + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("RemoveVirtualSystemResources"); + inParams["TargetSystem"] = GetVirtualMachineObject(vmId); + inParams["ResourceSettingData"] = new object[] { objDvd.Path.Path }; + + // execute method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("RemoveVirtualSystemResources", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + #endregion + + #region Virtual Switches + public List GetSwitches() + { + List switches = new List(); + + // load wmi objects + ManagementObjectCollection objSwitches = wmi.GetWmiObjects("msvm_VirtualSwitch"); + foreach (ManagementObject objSwitch in objSwitches) + switches.Add(CreateSwitchFromWmiObject(objSwitch)); + + return switches; + } + + public List GetExternalSwitches(string computerName) + { + return GetSwitches(computerName, "External"); + } + + private List GetSwitches(string computerName, string type) + { + HostedSolutionLog.LogStart("GetSwitches"); + HostedSolutionLog.DebugInfo("ComputerName: {0}", computerName); + + Runspace runSpace = null; + List switches = new List(); + + try + { + runSpace = OpenRunspace(); + Command cmd = new Command("Get-VMSwitch"); + + if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName); + if (!string.IsNullOrEmpty(type)) cmd.Parameters.Add("SwitchType", type); + + Collection result = ExecuteShellCommand(runSpace, cmd,false); + foreach (PSObject current in result) + { + VirtualSwitch sw = new VirtualSwitch(); + sw.SwitchId = GetPSObjectProperty(current, "Id").ToString(); + sw.Name = GetPSObjectProperty(current, "Name").ToString(); + sw.SwitchType = GetPSObjectProperty(current, "SwitchType").ToString(); + switches.Add(sw); + } + } + catch (Exception ex) + { + HostedSolutionLog.LogError("GetSwitches", ex); + throw; + } + finally + { + CloseRunspace(runSpace); + } + + HostedSolutionLog.LogEnd("GetSwitches"); + return switches; + + } + + public bool SwitchExists(string switchId) + { + ManagementObject objSwitch = wmi.GetWmiObject("msvm_VirtualSwitch", "Name = '{0}'", switchId); + return (objSwitch != null); + } + + public VirtualSwitch CreateSwitch(string name) + { + // generate ID for new virtual switch + string id = Guid.NewGuid().ToString(); + + // get switch management object + ManagementObject objNetworkSvc = GetVirtualSwitchManagementService(); + + ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("CreateSwitch"); + inParams["Name"] = id; + inParams["FriendlyName"] = name; + inParams["NumLearnableAddresses"] = SWITCH_PORTS_NUMBER; + + // invoke method + ManagementBaseObject outParams = objNetworkSvc.InvokeMethod("CreateSwitch", inParams, null); + + // process output parameters + ManagementObject objSwitch = wmi.GetWmiObjectByPath((string)outParams["CreatedVirtualSwitch"]); + return CreateSwitchFromWmiObject(objSwitch); + } + + public ReturnCode DeleteSwitch(string switchId) + { + // find requested switch + ManagementObject objSwitch = wmi.GetWmiObject("msvm_VirtualSwitch", "Name = '{0}'", switchId); + + if (objSwitch == null) + throw new Exception("Virtual switch with the specified ID was not found."); + + // get switch management object + ManagementObject objNetworkSvc = GetVirtualSwitchManagementService(); + + // get method params + ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("DeleteSwitch"); + inParams["VirtualSwitch"] = objSwitch.Path.Path; + + ManagementBaseObject outParams = (ManagementBaseObject)objNetworkSvc.InvokeMethod("DeleteSwitch", inParams, null); + return (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + } + #endregion + + #region Library + public LibraryItem[] GetLibraryItems(string path) + { + path = Path.Combine(FileUtils.EvaluateSystemVariables(path), LIBRARY_INDEX_FILE_NAME); + + // convert to UNC if it is a remote computer + path = ConvertToUNC(path); + + if (!File.Exists(path)) + { + HostedSolutionLog.LogWarning("The folder does not contain 'index.xml' file: {0}", path); + return null; + } + + // create list + List items = new List(); + + // load xml + XmlDocument xml = new XmlDocument(); + xml.Load(path); + + XmlNodeList nodeItems = xml.SelectNodes("/items/item"); + + if (nodeItems.Count == 0) + HostedSolutionLog.LogWarning("index.xml found, but contains 0 items: {0}", path); + + foreach (XmlNode nodeItem in nodeItems) + { + LibraryItem item = new LibraryItem(); + item.Path = nodeItem.Attributes["path"].Value; + + // optional attributes + if (nodeItem.Attributes["diskSize"] != null) + item.DiskSize = Int32.Parse(nodeItem.Attributes["diskSize"].Value); + + if (nodeItem.Attributes["legacyNetworkAdapter"] != null) + item.LegacyNetworkAdapter = Boolean.Parse(nodeItem.Attributes["legacyNetworkAdapter"].Value); + + item.ProcessVolume = 0; // process (extend and sysprep) 1st volume by default + if (nodeItem.Attributes["processVolume"] != null) + item.ProcessVolume = Int32.Parse(nodeItem.Attributes["processVolume"].Value); + + if (nodeItem.Attributes["remoteDesktop"] != null) + item.RemoteDesktop = Boolean.Parse(nodeItem.Attributes["remoteDesktop"].Value); + + // inner nodes + item.Name = nodeItem.SelectSingleNode("name").InnerText; + item.Description = nodeItem.SelectSingleNode("description").InnerText; + + // sysprep files + XmlNodeList nodesSyspep = nodeItem.SelectNodes("provisioning/sysprep"); + List sysprepFiles = new List(); + foreach (XmlNode nodeSyspep in nodesSyspep) + { + if (nodeSyspep.Attributes["file"] != null) + sysprepFiles.Add(nodeSyspep.Attributes["file"].Value); + } + item.SysprepFiles = sysprepFiles.ToArray(); + + // vmconfig + XmlNode nodeVmConfig = nodeItem.SelectSingleNode("provisioning/vmconfig"); + if (nodeVmConfig != null) + { + if (nodeVmConfig.Attributes["computerName"] != null) + item.ProvisionComputerName = Boolean.Parse(nodeVmConfig.Attributes["computerName"].Value); + + if (nodeVmConfig.Attributes["administratorPassword"] != null) + item.ProvisionAdministratorPassword = Boolean.Parse(nodeVmConfig.Attributes["administratorPassword"].Value); + + if (nodeVmConfig.Attributes["networkAdapters"] != null) + item.ProvisionNetworkAdapters = Boolean.Parse(nodeVmConfig.Attributes["networkAdapters"].Value); + } + + items.Add(item); + } + + return items.ToArray(); + } + + private string ConvertToUNC(string path) + { + if (String.IsNullOrEmpty(ServerNameSettings) + || path.StartsWith(@"\\")) + return path; + + return String.Format(@"\\{0}\{1}", ServerNameSettings, path.Replace(":", "$")); + } + #endregion + + #region KVP + public List GetKVPItems(string vmId) + { + return GetKVPItems(vmId, "GuestExchangeItems"); + } + + public List GetStandardKVPItems(string vmId) + { + return GetKVPItems(vmId, "GuestIntrinsicExchangeItems"); + } + + private List GetKVPItems(string vmId, string exchangeItemsName) + { + List pairs = new List(); + + // load VM + ManagementObject objVm = GetVirtualMachineObject(vmId); + + ManagementObject objKvpExchange = null; + + try + { + objKvpExchange = wmi.GetRelatedWmiObject(objVm, "msvm_KvpExchangeComponent"); + } + catch + { + // TODO + // add logging... + + return pairs; + } + + // return XML pairs + string[] xmlPairs = (string[])objKvpExchange[exchangeItemsName]; + + if (xmlPairs == null) + return pairs; + + // join all pairs + StringBuilder sb = new StringBuilder(); + sb.Append(""); + foreach (string xmlPair in xmlPairs) + sb.Append(xmlPair); + sb.Append(""); + + // parse pairs + XmlDocument doc = new XmlDocument(); + doc.LoadXml(sb.ToString()); + + foreach (XmlNode nodeName in doc.SelectNodes("/result/INSTANCE/PROPERTY[@NAME='Name']/VALUE")) + { + string name = nodeName.InnerText; + string data = nodeName.ParentNode.ParentNode.SelectSingleNode("PROPERTY[@NAME='Data']/VALUE").InnerText; + pairs.Add(new KvpExchangeDataItem(name, data)); + } + + return pairs; + } + + public JobResult AddKVPItems(string vmId, KvpExchangeDataItem[] items) + { + // get KVP management object + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // create KVP items array + string[] wmiItems = new string[items.Length]; + + for (int i = 0; i < items.Length; i++) + { + ManagementClass clsKvp = wmi.GetWmiClass("Msvm_KvpExchangeDataItem"); + ManagementObject objKvp = clsKvp.CreateInstance(); + objKvp["Name"] = items[i].Name; + objKvp["Data"] = items[i].Data; + objKvp["Source"] = 0; + + // convert to WMI format + wmiItems[i] = objKvp.GetText(TextFormat.CimDtd20); + } + + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("AddKvpItems"); + inParams["TargetSystem"] = GetVirtualMachineObject(vmId); + inParams["DataItems"] = wmiItems; + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("AddKvpItems", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public JobResult RemoveKVPItems(string vmId, string[] itemNames) + { + // get KVP management object + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // delete items one by one + for (int i = 0; i < itemNames.Length; i++) + { + ManagementClass clsKvp = wmi.GetWmiClass("Msvm_KvpExchangeDataItem"); + ManagementObject objKvp = clsKvp.CreateInstance(); + objKvp["Name"] = itemNames[i]; + objKvp["Data"] = ""; + objKvp["Source"] = 0; + + // convert to WMI format + string wmiItem = objKvp.GetText(TextFormat.CimDtd20); + + // call method + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("RemoveKvpItems"); + inParams["TargetSystem"] = GetVirtualMachineObject(vmId); + inParams["DataItems"] = new string[] { wmiItem }; + + // invoke method + objVmsvc.InvokeMethod("RemoveKvpItems", inParams, null); + } + return null; + } + + public JobResult ModifyKVPItems(string vmId, KvpExchangeDataItem[] items) + { + // get KVP management object + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + // create KVP items array + string[] wmiItems = new string[items.Length]; + + for (int i = 0; i < items.Length; i++) + { + ManagementClass clsKvp = wmi.GetWmiClass("Msvm_KvpExchangeDataItem"); + ManagementObject objKvp = clsKvp.CreateInstance(); + objKvp["Name"] = items[i].Name; + objKvp["Data"] = items[i].Data; + objKvp["Source"] = 0; + + // convert to WMI format + wmiItems[i] = objKvp.GetText(TextFormat.CimDtd20); + } + + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ModifyKvpItems"); + inParams["TargetSystem"] = GetVirtualMachineObject(vmId); + inParams["DataItems"] = wmiItems; + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("ModifyKvpItems", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + #endregion + + #region Storage + public VirtualHardDiskInfo GetVirtualHardDiskInfo(string vhdPath) + { + ManagementObject objImgSvc = GetImageManagementService(); + + // get method params + ManagementBaseObject inParams = objImgSvc.GetMethodParameters("GetVirtualHardDiskInfo"); + inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); + + // execute method + ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("GetVirtualHardDiskInfo", inParams, null); + ReturnCode result = (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + if (result == ReturnCode.OK) + { + // create XML + string xml = (string)outParams["Info"]; + XmlDocument doc = new XmlDocument(); + doc.LoadXml(xml); + + // read properties + VirtualHardDiskInfo vhd = new VirtualHardDiskInfo(); + vhd.DiskType = (VirtualHardDiskType)Enum.Parse(typeof(VirtualHardDiskType), GetPropertyValue("Type", doc), true); + vhd.FileSize = Int64.Parse(GetPropertyValue("FileSize", doc)); + vhd.InSavedState = Boolean.Parse(GetPropertyValue("InSavedState", doc)); + vhd.InUse = Boolean.Parse(GetPropertyValue("InUse", doc)); + vhd.MaxInternalSize = Int64.Parse(GetPropertyValue("MaxInternalSize", doc)); + vhd.ParentPath = GetPropertyValue("ParentPath", doc); + return vhd; + } + return null; + } + + private string GetPropertyValue(string propertyName, XmlDocument doc) + { + string xpath = string.Format(@"//PROPERTY[@NAME = '{0}']/VALUE/child::text()", propertyName); + XmlNode node = doc.SelectSingleNode(xpath); + return node != null ? node.Value : null; + } + + public MountedDiskInfo MountVirtualHardDisk(string vhdPath) + { + ManagementObject objImgSvc = GetImageManagementService(); + + // get method params + ManagementBaseObject inParams = objImgSvc.GetMethodParameters("Mount"); + inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); + + ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("Mount", inParams, null); + JobResult result = CreateJobResultFromWmiMethodResults(outParams); + + // load storage job + if (result.ReturnValue != ReturnCode.JobStarted) + throw new Exception("Failed to start Mount job with the following error: " + result.ReturnValue); ; + + ManagementObject objJob = wmi.GetWmiObject("msvm_StorageJob", "InstanceID = '{0}'", result.Job.Id); + + if (!JobCompleted(result.Job)) + throw new Exception("Failed to complete Mount job with the following error: " + result.Job.ErrorDescription); + + try + { + List volumes = new List(); + + // load output data + ManagementObject objImage = wmi.GetRelatedWmiObject(objJob, "Msvm_MountedStorageImage"); + + int pathId = Convert.ToInt32(objImage["PathId"]); + int portNumber = Convert.ToInt32(objImage["PortNumber"]); + int targetId = Convert.ToInt32(objImage["TargetId"]); + int lun = Convert.ToInt32(objImage["Lun"]); + + string diskAddress = String.Format("Port{0}Path{1}Target{2}Lun{3}", portNumber, pathId, targetId, lun); + + HostedSolutionLog.LogInfo("Disk address: " + diskAddress); + + // find mounted disk using VDS + Vds.Advanced.AdvancedDisk advancedDisk = null; + Vds.Pack diskPack = null; + + // first attempt + System.Threading.Thread.Sleep(3000); + HostedSolutionLog.LogInfo("Trying to find mounted disk - first attempt"); + FindVdsDisk(diskAddress, out advancedDisk, out diskPack); + + // second attempt + if (advancedDisk == null) + { + System.Threading.Thread.Sleep(20000); + HostedSolutionLog.LogInfo("Trying to find mounted disk - second attempt"); + FindVdsDisk(diskAddress, out advancedDisk, out diskPack); + } + + if (advancedDisk == null) + throw new Exception("Could not find mounted disk"); + + // check if DiskPart must be used to bring disk online and clear read-only flag + bool useDiskPartToClearReadOnly = false; + if (ConfigurationManager.AppSettings[CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) + useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); + + // determine disk index for DiskPart + Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + ManagementObject objDisk = cimv2.GetWmiObject("win32_diskdrive", + "Model='Msft Virtual Disk SCSI Disk Device' and ScsiTargetID={0} and ScsiLogicalUnit={1} and scsiPort={2}", + targetId, lun, portNumber); + + if (useDiskPartToClearReadOnly) + { + // *** Clear Read-Only and bring disk online with DiskPart *** + HostedSolutionLog.LogInfo("Clearing disk Read-only flag and bringing disk online"); + + if (objDisk != null) + { + // disk found + // run DiskPart + string diskPartResult = RunDiskPart(String.Format(@"select disk {0} +attributes disk clear readonly +online disk +exit", Convert.ToInt32(objDisk["Index"]))); + + HostedSolutionLog.LogInfo("DiskPart Result: " + diskPartResult); + } + } + else + { + // *** Clear Read-Only and bring disk online with VDS *** + // clear Read-Only + if ((advancedDisk.Flags & Vds.DiskFlags.ReadOnly) == Vds.DiskFlags.ReadOnly) + { + HostedSolutionLog.LogInfo("Clearing disk Read-only flag"); + advancedDisk.ClearFlags(Vds.DiskFlags.ReadOnly); + while ((advancedDisk.Flags & Vds.DiskFlags.ReadOnly) == Vds.DiskFlags.ReadOnly) + { + System.Threading.Thread.Sleep(100); + advancedDisk.Refresh(); + } + } + + // bring disk ONLINE + if (advancedDisk.Status == Vds.DiskStatus.Offline) + { + HostedSolutionLog.LogInfo("Bringing disk online"); + advancedDisk.Online(); + while (advancedDisk.Status == Vds.DiskStatus.Offline) + { + System.Threading.Thread.Sleep(100); + advancedDisk.Refresh(); + } + } + } + + // small pause after getting disk online + System.Threading.Thread.Sleep(3000); + + // get disk again + FindVdsDisk(diskAddress, out advancedDisk, out diskPack); + + // find volumes using VDS + HostedSolutionLog.LogInfo("Querying disk volumes with VDS"); + foreach (Vds.Volume volume in diskPack.Volumes) + { + string letter = volume.DriveLetter.ToString(); + if (letter != "") + volumes.Add(letter); + } + + // find volumes using WMI + if (volumes.Count == 0 && objDisk != null) + { + HostedSolutionLog.LogInfo("Querying disk volumes with WMI"); + foreach (ManagementObject objPartition in objDisk.GetRelated("Win32_DiskPartition")) + { + foreach (ManagementObject objVolume in objPartition.GetRelated("Win32_LogicalDisk")) + { + volumes.Add(objVolume["Name"].ToString().TrimEnd(':')); + } + } + } + + HostedSolutionLog.LogInfo("Volumes found: " + volumes.Count); + + // info object + MountedDiskInfo info = new MountedDiskInfo(); + info.DiskAddress = diskAddress; + info.DiskVolumes = volumes.ToArray(); + return info; + } + catch (Exception ex) + { + // unmount disk + UnmountVirtualHardDisk(vhdPath); + + // throw error + throw ex; + } + } + + private void FindVdsDisk(string diskAddress, out Vds.Advanced.AdvancedDisk advancedDisk, out Vds.Pack diskPack) + { + advancedDisk = null; + diskPack = null; + + Vds.ServiceLoader serviceLoader = new Vds.ServiceLoader(); + Vds.Service vds = serviceLoader.LoadService(ServerNameSettings); + vds.WaitForServiceReady(); + + foreach (Vds.Disk disk in vds.UnallocatedDisks) + { + if (disk.DiskAddress == diskAddress) + { + advancedDisk = (Vds.Advanced.AdvancedDisk)disk; + break; + } + } + + if (advancedDisk == null) + { + vds.HardwareProvider = false; + vds.SoftwareProvider = true; + + foreach (Vds.SoftwareProvider provider in vds.Providers) + foreach (Vds.Pack pack in provider.Packs) + foreach (Vds.Disk disk in pack.Disks) + if (disk.DiskAddress == diskAddress) + { + diskPack = pack; + advancedDisk = (Vds.Advanced.AdvancedDisk)disk; + break; + } + } + } + + public ReturnCode UnmountVirtualHardDisk(string vhdPath) + { + ManagementObject objImgSvc = GetImageManagementService(); + + // get method params + ManagementBaseObject inParams = objImgSvc.GetMethodParameters("Unmount"); + inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); + + ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("Unmount", inParams, null); + return (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + } + + public JobResult ExpandVirtualHardDisk(string vhdPath, UInt64 sizeGB) + { + const UInt64 Size1G = 0x40000000; + + ManagementObject objImgSvc = GetImageManagementService(); + + // get method params + ManagementBaseObject inParams = objImgSvc.GetMethodParameters("ExpandVirtualHardDisk"); + inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); + inParams["MaxInternalSize"] = sizeGB * Size1G; + + ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("ExpandVirtualHardDisk", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public JobResult ConvertVirtualHardDisk(string sourcePath, string destinationPath, VirtualHardDiskType diskType) + { + sourcePath = FileUtils.EvaluateSystemVariables(sourcePath); + destinationPath = FileUtils.EvaluateSystemVariables(destinationPath); + + // check source file + if (!FileExists(sourcePath)) + throw new Exception("Source VHD cannot be found: " + sourcePath); + + // check destination folder + string destFolder = Path.GetDirectoryName(destinationPath); + if (!DirectoryExists(destFolder)) + CreateFolder(destFolder); + + ManagementObject objImgSvc = GetImageManagementService(); + + // get method params + ManagementBaseObject inParams = objImgSvc.GetMethodParameters("ConvertVirtualHardDisk"); + inParams["SourcePath"] = sourcePath; + inParams["DestinationPath"] = destinationPath; + inParams["Type"] = (UInt16)diskType; + + ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("ConvertVirtualHardDisk", inParams, null); + return CreateJobResultFromWmiMethodResults(outParams); + } + + public void DeleteRemoteFile(string path) + { + if (DirectoryExists(path)) + DeleteFolder(path); // WMI way + else if (FileExists(path)) + DeleteFile(path); // WMI way + } + + public void ExpandDiskVolume(string diskAddress, string volumeName) + { + // find mounted disk using VDS + Vds.Advanced.AdvancedDisk advancedDisk = null; + Vds.Pack diskPack = null; + + FindVdsDisk(diskAddress, out advancedDisk, out diskPack); + + if (advancedDisk == null) + throw new Exception("Could not find mounted disk"); + + // find volume + Vds.Volume diskVolume = null; + foreach (Vds.Volume volume in diskPack.Volumes) + { + if (volume.DriveLetter.ToString() == volumeName) + { + diskVolume = volume; + break; + } + } + + if (diskVolume == null) + throw new Exception("Could not find disk volume: " + volumeName); + + // determine maximum available space + ulong oneMegabyte = 1048576; + ulong freeSpace = 0; + foreach (Vds.DiskExtent extent in advancedDisk.Extents) + { + if (extent.Type != Microsoft.Storage.Vds.DiskExtentType.Free) + continue; + + if (extent.Size > oneMegabyte) + freeSpace += extent.Size; + } + + if (freeSpace == 0) + return; + + // input disk + Vds.InputDisk inputDisk = new Vds.InputDisk(); + foreach (Vds.VolumePlex plex in diskVolume.Plexes) + { + inputDisk.DiskId = advancedDisk.Id; + inputDisk.Size = freeSpace; + inputDisk.PlexId = plex.Id; + + foreach (Vds.DiskExtent extent in plex.Extents) + inputDisk.MemberIndex = extent.MemberIndex; + + break; + } + + // extend volume + Vds.Async extendEvent = diskVolume.BeginExtend(new Vds.InputDisk[] { inputDisk }, null, null); + while (!extendEvent.IsCompleted) + System.Threading.Thread.Sleep(100); + diskVolume.EndExtend(extendEvent); + } + + // obsolete and currently is not used + private string RunDiskPart(string script) + { + // create temp script file name + string localPath = Path.Combine(GetTempRemoteFolder(), Guid.NewGuid().ToString("N")); + + // save script to remote temp file + string remotePath = ConvertToUNC(localPath); + File.AppendAllText(remotePath, script); + + // run diskpart + ExecuteRemoteProcess("DiskPart /s " + localPath); + + // delete temp script + try + { + File.Delete(remotePath); + } + catch + { + // TODO + } + + return ""; + } + + public string ReadRemoteFile(string path) + { + // temp file name on "system" drive available through hidden share + string tempPath = Path.Combine(GetTempRemoteFolder(), Guid.NewGuid().ToString("N")); + + HostedSolutionLog.LogInfo("Read remote file: " + path); + HostedSolutionLog.LogInfo("Local file temp path: " + tempPath); + + // copy remote file to temp file (WMI) + if (!CopyFile(path, tempPath)) + return null; + + // read content of temp file + string remoteTempPath = ConvertToUNC(tempPath); + HostedSolutionLog.LogInfo("Remote file temp path: " + remoteTempPath); + + string content = File.ReadAllText(remoteTempPath); + + // delete temp file (WMI) + DeleteFile(tempPath); + + return content; + } + + public void WriteRemoteFile(string path, string content) + { + // temp file name on "system" drive available through hidden share + string tempPath = Path.Combine(GetTempRemoteFolder(), Guid.NewGuid().ToString("N")); + + // write to temp file + string remoteTempPath = ConvertToUNC(tempPath); + File.WriteAllText(remoteTempPath, content); + + // delete file (WMI) + if (FileExists(path)) + DeleteFile(path); + + // copy (WMI) + CopyFile(tempPath, path); + + // delete temp file (WMI) + DeleteFile(tempPath); + } + #endregion + + #region Jobs + public ConcreteJob GetJob(string jobId) + { + ManagementObject objJob = wmi.GetWmiObject("CIM_ConcreteJob", "InstanceID = '{0}'", jobId); + return CreateJobFromWmiObject(objJob); + } + + public List GetAllJobs() + { + List jobs = new List(); + + ManagementObjectCollection objJobs = wmi.GetWmiObjects("CIM_ConcreteJob"); + foreach (ManagementObject objJob in objJobs) + jobs.Add(CreateJobFromWmiObject(objJob)); + + return jobs; + } + + public ChangeJobStateReturnCode ChangeJobState(string jobId, ConcreteJobRequestedState newState) + { + ManagementObject objJob = GetJobWmiObject(jobId); + + // get method + ManagementBaseObject inParams = objJob.GetMethodParameters("RequestStateChange"); + inParams["RequestedState"] = (Int32)newState; + + // invoke method + ManagementBaseObject outParams = objJob.InvokeMethod("RequestStateChange", inParams, null); + return (ChangeJobStateReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + } + + #endregion + + #region Configuration + public int GetProcessorCoresNumber() + { + Wmi w = new Wmi(ServerNameSettings, @"root\cimv2"); + ManagementObject objCpu = w.GetWmiObject("win32_Processor"); + return Convert.ToInt32(objCpu["NumberOfCores"]); + } + #endregion + + #region IHostingServiceProvier methods + public override string[] Install() + { + List messages = new List(); + + // TODO + + return messages.ToArray(); + } + + public override bool IsInstalled() + { + // check if Hyper-V role is installed and available for management + //Wmi root = new Wmi(ServerNameSettings, "root"); + //ManagementObject objNamespace = root.GetWmiObject("__NAMESPACE", "name = 'virtualization'"); + //return (objNamespace != null); + return true; + } + + public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled) + { + foreach (ServiceProviderItem item in items) + { + if (item is VirtualMachine) + { + // start/stop virtual machine + VirtualMachine vm = item as VirtualMachine; + ChangeVirtualMachineServiceItemState(vm, enabled); + } + } + } + + public override void DeleteServiceItems(ServiceProviderItem[] items) + { + foreach (ServiceProviderItem item in items) + { + if (item is VirtualMachine) + { + // delete virtual machine + VirtualMachine vm = item as VirtualMachine; + DeleteVirtualMachineServiceItem(vm); + } + else if (item is VirtualSwitch) + { + // delete switch + VirtualSwitch vs = item as VirtualSwitch; + DeleteVirtualSwitchServiceItem(vs); + } + } + } + + private void ChangeVirtualMachineServiceItemState(VirtualMachine vm, bool started) + { + try + { + VirtualMachine vps = GetVirtualMachine(vm.VirtualMachineId); + JobResult result = null; + + if (vps == null) + { + HostedSolutionLog.LogWarning(String.Format("Virtual machine '{0}' object with ID '{1}' was not found. Change state operation aborted.", + vm.Name, vm.VirtualMachineId)); + return; + } + + #region Start + if (started && + (vps.State == VirtualMachineState.Off + || vps.State == VirtualMachineState.Paused + || vps.State == VirtualMachineState.Saved)) + { + VirtualMachineRequestedState state = VirtualMachineRequestedState.Start; + if (vps.State == VirtualMachineState.Paused) + state = VirtualMachineRequestedState.Resume; + + result = ChangeVirtualMachineState(vm.VirtualMachineId, state); + + // check result + if (result.ReturnValue != ReturnCode.JobStarted) + { + HostedSolutionLog.LogWarning(String.Format("Cannot {0} '{1}' virtual machine: {2}", + state, vm.Name, result.ReturnValue)); + return; + } + + // wait for completion + if (!JobCompleted(result.Job)) + { + HostedSolutionLog.LogWarning(String.Format("Cannot complete {0} '{1}' of virtual machine: {1}", + state, vm.Name, result.Job.ErrorDescription)); + return; + } + } + #endregion + + #region Stop + else if (!started && + (vps.State == VirtualMachineState.Started + || vps.State == VirtualMachineState.Paused)) + { + if (vps.State == VirtualMachineState.Started) + { + // try to shutdown the system + ReturnCode code = ShutDownVirtualMachine(vm.VirtualMachineId, true, "Virtual Machine has been suspended from WebsitePanel"); + if (code == ReturnCode.OK) + return; + } + + // turn off + VirtualMachineRequestedState state = VirtualMachineRequestedState.TurnOff; + result = ChangeVirtualMachineState(vm.VirtualMachineId, state); + + // check result + if (result.ReturnValue != ReturnCode.JobStarted) + { + HostedSolutionLog.LogWarning(String.Format("Cannot {0} '{1}' virtual machine: {2}", + state, vm.Name, result.ReturnValue)); + return; + } + + // wait for completion + if (!JobCompleted(result.Job)) + { + HostedSolutionLog.LogWarning(String.Format("Cannot complete {0} '{1}' of virtual machine: {1}", + state, vm.Name, result.Job.ErrorDescription)); + return; + } + } + #endregion + } + catch (Exception ex) + { + HostedSolutionLog.LogError(String.Format("Error {0} Virtual Machine '{1}'", + started ? "starting" : "turning off", + vm.Name), ex); + } + } + + private void DeleteVirtualMachineServiceItem(VirtualMachine vm) + { + try + { + JobResult result = null; + VirtualMachine vps = GetVirtualMachine(vm.VirtualMachineId); + + if (vps == null) + { + HostedSolutionLog.LogWarning(String.Format("Virtual machine '{0}' object with ID '{1}' was not found. Delete operation aborted.", + vm.Name, vm.VirtualMachineId)); + return; + } + + #region Turn off (if required) + if (vps.State != VirtualMachineState.Off) + { + result = ChangeVirtualMachineState(vm.VirtualMachineId, VirtualMachineRequestedState.TurnOff); + // check result + if (result.ReturnValue != ReturnCode.JobStarted) + { + HostedSolutionLog.LogWarning(String.Format("Cannot Turn off '{0}' virtual machine before deletion: {1}", + vm.Name, result.ReturnValue)); + return; + } + + // wait for completion + if (!JobCompleted(result.Job)) + { + HostedSolutionLog.LogWarning(String.Format("Cannot complete Turn off '{0}' of virtual machine before deletion: {1}", + vm.Name, result.Job.ErrorDescription)); + return; + } + } + #endregion + + #region Delete virtual machine + result = DeleteVirtualMachine(vm.VirtualMachineId); + + // check result + if (result.ReturnValue != ReturnCode.JobStarted) + { + HostedSolutionLog.LogWarning(String.Format("Cannot delete '{0}' virtual machine: {1}", + vm.Name, result.ReturnValue)); + return; + } + + // wait for completion + if (!JobCompleted(result.Job)) + { + HostedSolutionLog.LogWarning(String.Format("Cannot complete deletion of '{0}' virtual machine: {1}", + vm.Name, result.Job.ErrorDescription)); + return; + } + #endregion + + #region Delete virtual machine + try + { + DeleteFile(vm.RootFolderPath); + } + catch (Exception ex) + { + HostedSolutionLog.LogError(String.Format("Cannot delete virtual machine folder '{0}'", + vm.RootFolderPath), ex); + } + #endregion + + } + catch (Exception ex) + { + HostedSolutionLog.LogError(String.Format("Error deleting Virtual Machine '{0}'", vm.Name), ex); + } + } + + private void DeleteVirtualSwitchServiceItem(VirtualSwitch vs) + { + try + { + // delete virtual switch + DeleteSwitch(vs.SwitchId); + } + catch (Exception ex) + { + HostedSolutionLog.LogError(String.Format("Error deleting Virtual Switch '{0}'", vs.Name), ex); + } + } + #endregion + + #region Private Methods + protected JobResult CreateJobResultFromWmiMethodResults(ManagementBaseObject outParams) + { + JobResult result = new JobResult(); + + // return value + result.ReturnValue = (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + + // try getting job details job + try + { + ManagementBaseObject objJob = wmi.GetWmiObjectByPath((string)outParams["Job"]); + if (objJob != null && objJob.Properties.Count > 0) + { + result.Job = CreateJobFromWmiObject(objJob); + } + } + catch { /* dumb */ } + + return result; + } + + private ManagementObject GetJobWmiObject(string id) + { + return wmi.GetWmiObject("msvm_ConcreteJob", "InstanceID = '{0}'", id); + } + + private ManagementObject GetVirtualSystemManagementService() + { + return wmi.GetWmiObject("msvm_VirtualSystemManagementService"); + } + + private ManagementObject GetVirtualSwitchManagementService() + { + return wmi.GetWmiObject("msvm_VirtualSwitchManagementService"); + } + + protected ManagementObject GetImageManagementService() + { + return wmi.GetWmiObject("msvm_ImageManagementService"); + } + + private ManagementObject GetVirtualMachineObject(string vmId) + { + return wmi.GetWmiObject("msvm_ComputerSystem", "Name = '{0}'", vmId); + } + + private ManagementObject GetSnapshotObject(string snapshotId) + { + return wmi.GetWmiObject("Msvm_VirtualSystemSettingData", "InstanceID = '{0}'", snapshotId); + } + + + private VirtualMachineSnapshot CreateSnapshotFromWmiObject(ManagementBaseObject objSnapshot) + { + if (objSnapshot == null || objSnapshot.Properties.Count == 0) + return null; + + VirtualMachineSnapshot snapshot = new VirtualMachineSnapshot(); + snapshot.Id = (string)objSnapshot["InstanceID"]; + snapshot.Name = (string)objSnapshot["ElementName"]; + + string parentId = (string)objSnapshot["Parent"]; + if (!String.IsNullOrEmpty(parentId)) + { + int idx = parentId.IndexOf("Microsoft:"); + snapshot.ParentId = parentId.Substring(idx, parentId.Length - idx - 1); + } + snapshot.Created = wmi.ToDateTime((string)objSnapshot["CreationTime"]); + + return snapshot; + } + + private VirtualSwitch CreateSwitchFromWmiObject(ManagementObject objSwitch) + { + if (objSwitch == null || objSwitch.Properties.Count == 0) + return null; + + VirtualSwitch sw = new VirtualSwitch(); + sw.SwitchId = (string)objSwitch["Name"]; + sw.Name = (string)objSwitch["ElementName"]; + return sw; + } + + private ConcreteJob CreateJobFromWmiObject(ManagementBaseObject objJob) + { + if (objJob == null || objJob.Properties.Count == 0) + return null; + + ConcreteJob job = new ConcreteJob(); + job.Id = (string)objJob["InstanceID"]; + job.JobState = (ConcreteJobState)Convert.ToInt32(objJob["JobState"]); + job.Caption = (string)objJob["Caption"]; + job.Description = (string)objJob["Description"]; + job.StartTime = wmi.ToDateTime((string)objJob["StartTime"]); + // TODO proper parsing of WMI time spans, e.g. 00000000000001.325247:000 + job.ElapsedTime = DateTime.Now; //wmi.ToDateTime((string)objJob["ElapsedTime"]); + job.ErrorCode = Convert.ToInt32(objJob["ErrorCode"]); + job.ErrorDescription = (string)objJob["ErrorDescription"]; + job.PercentComplete = Convert.ToInt32(objJob["PercentComplete"]); + return job; + } + + private ManagementBaseObject GetSnapshotSummaryInformation( + string snapshotId, + SummaryInformationRequest requestedInformation) + { + // find VM settings object + ManagementObject objVmSetting = GetSnapshotObject(snapshotId); + + // get summary + return GetSummaryInformation(objVmSetting, requestedInformation); + } + + private ManagementBaseObject GetVirtualMachineSummaryInformation( + string vmId, + params SummaryInformationRequest[] requestedInformation) + { + // find VM settings object + ManagementObject objVmSetting = GetVirtualMachineSettingsObject(vmId); + + // get summary + return GetSummaryInformation(objVmSetting, requestedInformation); + } + + private ManagementBaseObject GetSummaryInformation( + ManagementObject objVmSetting, params SummaryInformationRequest[] requestedInformation) + { + if (requestedInformation == null || requestedInformation.Length == 0) + throw new ArgumentNullException("requestedInformation"); + + // get management service + ManagementObject objVmsvc = GetVirtualSystemManagementService(); + + uint[] reqif = new uint[requestedInformation.Length]; + for (int i = 0; i < requestedInformation.Length; i++) + reqif[i] = (uint)requestedInformation[i]; + + // get method params + ManagementBaseObject inParams = objVmsvc.GetMethodParameters("GetSummaryInformation"); + inParams["SettingData"] = new ManagementObject[] { objVmSetting }; + inParams["RequestedInformation"] = reqif; + + // invoke method + ManagementBaseObject outParams = objVmsvc.InvokeMethod("GetSummaryInformation", inParams, null); + return ((ManagementBaseObject[])outParams["SummaryInformation"])[0]; + } + + private ManagementObject GetVirtualMachineSettingsObject(string vmId) + { + return wmi.GetWmiObject("msvm_VirtualSystemSettingData", "InstanceID Like 'Microsoft:{0}%'", vmId); + } + + private bool JobCompleted(ConcreteJob job) + { + bool jobCompleted = true; + + while (job.JobState == ConcreteJobState.Starting || + job.JobState == ConcreteJobState.Running) + { + System.Threading.Thread.Sleep(200); + job = GetJob(job.Id); + } + + if (job.JobState != ConcreteJobState.Completed) + { + jobCompleted = false; + } + + return jobCompleted; + } + #endregion + + #region Remote File Methods + public bool FileExists(string path) + { + HostedSolutionLog.LogInfo("Check remote file exists: " + path); + + if (path.StartsWith(@"\\")) // network share + return File.Exists(path); + else + { + Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", path.Replace("\\", "\\\\")); + return (objFile != null); + } + } + + public bool DirectoryExists(string path) + { + if (path.StartsWith(@"\\")) // network share + return Directory.Exists(path); + else + { + Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + ManagementObject objDir = cimv2.GetWmiObject("Win32_Directory", "Name='{0}'", path.Replace("\\", "\\\\")); + return (objDir != null); + } + } + + public bool CopyFile(string sourceFileName, string destinationFileName) + { + HostedSolutionLog.LogInfo("Copy file - source: " + sourceFileName); + HostedSolutionLog.LogInfo("Copy file - destination: " + destinationFileName); + + if (sourceFileName.StartsWith(@"\\")) // network share + { + if (!File.Exists(sourceFileName)) + return false; + + File.Copy(sourceFileName, destinationFileName); + } + else + { + if (!FileExists(sourceFileName)) + return false; + + // copy using WMI + Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", sourceFileName.Replace("\\", "\\\\")); + if (objFile == null) + throw new Exception("Source file does not exists: " + sourceFileName); + + objFile.InvokeMethod("Copy", new object[] { destinationFileName }); + } + return true; + } + + public void DeleteFile(string path) + { + if (path.StartsWith(@"\\")) + { + // network share + File.Delete(path); + } + else + { + // delete file using WMI + Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); + ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", path.Replace("\\", "\\\\")); + objFile.InvokeMethod("Delete", null); + } + } + + public void DeleteFolder(string path) + { + if (path.StartsWith(@"\\")) + { + // network share + try + { + FileUtils.DeleteFile(path); + } + catch { /* just skip */ } + FileUtils.DeleteFile(path); + } + else + { + // local folder + // delete sub folders first + ManagementObjectCollection objSubFolders = GetSubFolders(path); + foreach (ManagementObject objSubFolder in objSubFolders) + DeleteFolder(objSubFolder["Name"].ToString()); + + // delete this folder itself + Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); + ManagementObject objFolder = cimv2.GetWmiObject("Win32_Directory", "Name='{0}'", path.Replace("\\", "\\\\")); + objFolder.InvokeMethod("Delete", null); + } + } + + private ManagementObjectCollection GetSubFolders(string path) + { + if (path.EndsWith("\\")) + path = path.Substring(0, path.Length - 1); + + Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); + + return cimv2.ExecuteWmiQuery("Associators of {Win32_Directory.Name='" + + path + "'} " + + "Where AssocClass = Win32_Subdirectory " + + "ResultRole = PartComponent"); + } + + public void CreateFolder(string path) + { + ExecuteRemoteProcess(String.Format("cmd.exe /c md \"{0}\"", path)); + } + + public void ExecuteRemoteProcess(string command) + { + Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); + ManagementClass objProcess = cimv2.GetWmiClass("Win32_Process"); + + // run process + object[] methodArgs = { command, null, null, 0 }; + objProcess.InvokeMethod("Create", methodArgs); + + // process ID + int processId = Convert.ToInt32(methodArgs[3]); + + // wait until finished + // Create event query to be notified within 1 second of + // a change in a service + WqlEventQuery query = + new WqlEventQuery("__InstanceDeletionEvent", + new TimeSpan(0, 0, 1), + "TargetInstance isa \"Win32_Process\""); + + // Initialize an event watcher and subscribe to events + // that match this query + ManagementEventWatcher watcher = new ManagementEventWatcher(cimv2.GetScope(), query); + // times out watcher.WaitForNextEvent in 20 seconds + watcher.Options.Timeout = new TimeSpan(0, 0, 20); + + // Block until the next event occurs + // Note: this can be done in a loop if waiting for + // more than one occurrence + while (true) + { + ManagementBaseObject e = null; + + try + { + // wait untill next process finish + e = watcher.WaitForNextEvent(); + } + catch + { + // nothing has been finished in timeout period + return; // exit + } + + // check process id + int pid = Convert.ToInt32(((ManagementBaseObject)e["TargetInstance"])["ProcessID"]); + if (pid == processId) + { + //Cancel the subscription + watcher.Stop(); + + // exit + return; + } + } + } + + public string GetTempRemoteFolder() + { + Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); + ManagementObject objOS = cimv2.GetWmiObject("win32_OperatingSystem"); + string sysPath = (string)objOS["SystemDirectory"]; + + // remove trailing slash + if (sysPath.EndsWith("\\")) + sysPath = sysPath.Substring(0, sysPath.Length - 1); + + sysPath = sysPath.Substring(0, sysPath.LastIndexOf("\\") + 1) + "Temp"; + + return sysPath; + } + #endregion + + #region Hyper-V Cloud + public bool CheckServerState(string connString) + { + return !String.IsNullOrEmpty(connString); + } + #endregion Hyper-V Cloud + + #region PowerShell integration + private static InitialSessionState session = null; + + internal virtual Runspace OpenRunspace() + { + HostedSolutionLog.LogStart("OpenRunspace"); + + if (session == null) + { + session = InitialSessionState.CreateDefault(); + session.ImportPSModule(new string[] { "Hyper-V" }); + } + Runspace runSpace = RunspaceFactory.CreateRunspace(session); + // + runSpace.Open(); + // + runSpace.SessionStateProxy.SetVariable("ConfirmPreference", "none"); + HostedSolutionLog.LogEnd("OpenRunspace"); + return runSpace; + } + + internal void CloseRunspace(Runspace runspace) + { + try + { + if (runspace != null && runspace.RunspaceStateInfo.State == RunspaceState.Opened) + { + runspace.Close(); + } + } + catch (Exception ex) + { + HostedSolutionLog.LogError("Runspace error", ex); + } + } + + internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd) + { + return ExecuteShellCommand(runSpace, cmd, true); + } + + internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController) + { + object[] errors; + return ExecuteShellCommand(runSpace, cmd, useDomainController, out errors); + } + + internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd, out object[] errors) + { + return ExecuteShellCommand(runSpace, cmd, true, out errors); + } + + internal Collection ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController, out object[] errors) + { + HostedSolutionLog.LogStart("ExecuteShellCommand"); + List errorList = new List(); + + HostedSolutionLog.DebugCommand(cmd); + Collection results = null; + // Create a pipeline + Pipeline pipeLine = runSpace.CreatePipeline(); + using (pipeLine) + { + // Add the command + pipeLine.Commands.Add(cmd); + // Execute the pipeline and save the objects returned. + results = pipeLine.Invoke(); + + // Log out any errors in the pipeline execution + // NOTE: These errors are NOT thrown as exceptions! + // Be sure to check this to ensure that no errors + // happened while executing the command. + if (pipeLine.Error != null && pipeLine.Error.Count > 0) + { + foreach (object item in pipeLine.Error.ReadToEnd()) + { + errorList.Add(item); + string errorMessage = string.Format("Invoke error: {0}", item); + HostedSolutionLog.LogWarning(errorMessage); + } + } + } + pipeLine = null; + errors = errorList.ToArray(); + HostedSolutionLog.LogEnd("ExecuteShellCommand"); + return results; + } + + internal object GetPSObjectProperty(PSObject obj, string name) + { + return obj.Members[name].Value; + } + + /// + /// Returns the identity of the object from the shell execution result + /// + /// + /// + internal string GetResultObjectIdentity(Collection result) + { + HostedSolutionLog.LogStart("GetResultObjectIdentity"); + if (result == null) + throw new ArgumentNullException("result", "Execution result is not specified"); + + if (result.Count < 1) + throw new ArgumentException("Execution result is empty", "result"); + + if (result.Count > 1) + throw new ArgumentException("Execution result contains more than one object", "result"); + + PSMemberInfo info = result[0].Members["Identity"]; + if (info == null) + throw new ArgumentException("Execution result does not contain Identity property", "result"); + + string ret = info.Value.ToString(); + HostedSolutionLog.LogEnd("GetResultObjectIdentity"); + return ret; + } + + internal string GetResultObjectDN(Collection result) + { + HostedSolutionLog.LogStart("GetResultObjectDN"); + if (result == null) + throw new ArgumentNullException("result", "Execution result is not specified"); + + if (result.Count < 1) + throw new ArgumentException("Execution result does not contain any object"); + + if (result.Count > 1) + throw new ArgumentException("Execution result contains more than one object"); + + PSMemberInfo info = result[0].Members["DistinguishedName"]; + if (info == null) + throw new ArgumentException("Execution result does not contain DistinguishedName property", "result"); + + string ret = info.Value.ToString(); + HostedSolutionLog.LogEnd("GetResultObjectDN"); + return ret; + } + #endregion + + + internal int ConvertNullableToInt32(Nullable value) where T : struct + { + int ret = 0; + if (value.HasValue) + { + ret = Convert.ToInt32(value.Value); + } + return ret; + } + + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Properties/AssemblyInfo.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..cb7f4edb --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Properties/AssemblyInfo.cs @@ -0,0 +1,21 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WebsitePanel.Providers.Virtualization.HyperV2012R2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyProduct("WebsitePanel.Providers.Virtualization.HyperV2012R2")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("959c2614-2d69-4e4f-9e77-bd868e5afd4b")] diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj new file mode 100644 index 00000000..908e78fd --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj @@ -0,0 +1,80 @@ + + + + + Debug + AnyCPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC} + Library + Properties + WebsitePanel.Providers.Virtualization.HyperV2012R2 + WebsitePanel.Providers.Virtualization.HyperV2012R2 + v4.0 + 512 + + + + true + full + false + ..\WebsitePanel.Server\bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\Lib\References\Microsoft\Microsoft.Storage.Vds.dll + + + + + + + + + + False + ..\..\Lib\References\Microsoft\Windows2012\System.Management.Automation.dll + + + + + + VersionInfo.cs + + + + + + + + {684c932a-6c75-46ac-a327-f3689d89eb42} + WebsitePanel.Providers.Base + + + {a06de5e4-4331-47e1-8f46-7b846146b559} + WebsitePanel.Providers.HostedSolution + + + {e91e52f3-9555-4d00-b577-2b1dbdd87ca7} + WebsitePanel.Server.Utils + + + + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Wmi.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Wmi.cs new file mode 100644 index 00000000..8ab33885 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Wmi.cs @@ -0,0 +1,295 @@ +// Copyright (c) 2014, 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.Collections.Generic; +using System.Text; +using System.Management; +using System.Diagnostics; + +namespace WebsitePanel.Providers.Virtualization +{ + internal class Wmi + { + string nameSpace = null; + string computerName = null; + ManagementScope scope = null; + + public Wmi(string nameSpace) : this(nameSpace, null) + { + } + + public Wmi(string computerName, string nameSpace) + { + this.nameSpace = nameSpace; + this.computerName = computerName; + } + + internal ManagementObjectCollection ExecuteWmiQuery(string query, params object[] args) + { + if (args != null && args.Length > 0) + query = String.Format(query, args); + + ManagementObjectSearcher searcher = new ManagementObjectSearcher(GetScope(), + new ObjectQuery(query)); + return searcher.Get(); + } + + internal ManagementObject GetWmiObject(string className, string filter, params object[] args) + { + ManagementObjectCollection col = GetWmiObjects(className, filter, args); + ManagementObjectCollection.ManagementObjectEnumerator enumerator = col.GetEnumerator(); + return enumerator.MoveNext() ? (ManagementObject)enumerator.Current : null; + } + + internal ManagementObject GetWmiObject(string className) + { + return GetWmiObject(className, null); + } + + internal ManagementObjectCollection GetWmiObjects(string className, string filter, params object[] args) + { + string query = "select * from " + className; + if (!String.IsNullOrEmpty(filter)) + query += " where " + filter; + return ExecuteWmiQuery(query, args); + } + + internal ManagementObjectCollection GetWmiObjects(string className) + { + return GetWmiObjects(className, null); + } + + internal ManagementObject GetWmiObjectByPath(string path) + { + return new ManagementObject(GetScope(), new ManagementPath(path), null); + } + + internal ManagementClass GetWmiClass(string className) + { + return new ManagementClass(GetScope(), new ManagementPath(className), null); + } + + internal ManagementObject GetRelatedWmiObject(ManagementObject obj, string className) + { + ManagementObjectCollection col = obj.GetRelated(className); + ManagementObjectCollection.ManagementObjectEnumerator enumerator = col.GetEnumerator(); + enumerator.MoveNext(); + return (ManagementObject)enumerator.Current; + } + + internal void Dump(ManagementBaseObject obj) + { +#if DEBUG + foreach (PropertyData prop in obj.Properties) + { + string typeName = prop.Value == null ? "null" : prop.Value.GetType().ToString(); + Debug.WriteLine(prop.Name + ": " + prop.Value + " (" + typeName + ")"); + } +#endif + } + + // Converts a given datetime in DMTF format to System.DateTime object. + internal System.DateTime ToDateTime(string dmtfDate) + { + System.DateTime initializer = System.DateTime.MinValue; + int year = initializer.Year; + int month = initializer.Month; + int day = initializer.Day; + int hour = initializer.Hour; + int minute = initializer.Minute; + int second = initializer.Second; + long ticks = 0; + string dmtf = dmtfDate; + System.DateTime datetime = System.DateTime.MinValue; + string tempString = string.Empty; + if (String.IsNullOrEmpty(dmtf)) + { + return DateTime.MinValue; + } + else if ((dmtf.Length != 25)) + { + throw new System.ArgumentOutOfRangeException(); + } + try + { + tempString = dmtf.Substring(0, 4); + if (("****" != tempString)) + { + year = int.Parse(tempString); + } + tempString = dmtf.Substring(4, 2); + if (("**" != tempString)) + { + month = int.Parse(tempString); + } + tempString = dmtf.Substring(6, 2); + if (("**" != tempString)) + { + day = int.Parse(tempString); + } + tempString = dmtf.Substring(8, 2); + if (("**" != tempString)) + { + hour = int.Parse(tempString); + } + tempString = dmtf.Substring(10, 2); + if (("**" != tempString)) + { + minute = int.Parse(tempString); + } + tempString = dmtf.Substring(12, 2); + if (("**" != tempString)) + { + second = int.Parse(tempString); + } + tempString = dmtf.Substring(15, 6); + if (("******" != tempString)) + { + ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000)))); + } + if (((((((((year < 0) + || (month < 0)) + || (day < 0)) + || (hour < 0)) + || (minute < 0)) + || (minute < 0)) + || (second < 0)) + || (ticks < 0))) + { + throw new System.ArgumentOutOfRangeException(); + } + } + catch (System.Exception e) + { + throw new System.ArgumentOutOfRangeException(null, e.Message); + } + + if (year == 0 + && month == 0 + && day == 0 + && hour == 0 + && minute == 0 + && second == 0 + && ticks == 0) + return DateTime.MinValue; + + datetime = new System.DateTime(year, month, day, hour, minute, second, 0); + datetime = datetime.AddTicks(ticks); + System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(datetime); + int UTCOffset = 0; + int OffsetToBeAdjusted = 0; + long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute))); + tempString = dmtf.Substring(22, 3); + if ((tempString != "******")) + { + tempString = dmtf.Substring(21, 4); + try + { + UTCOffset = int.Parse(tempString); + } + catch (System.Exception e) + { + throw new System.ArgumentOutOfRangeException(null, e.Message); + } + OffsetToBeAdjusted = ((int)((OffsetMins - UTCOffset))); + datetime = datetime.AddMinutes(((double)(OffsetToBeAdjusted))); + } + return datetime; + } + + // Converts a given System.DateTime object to DMTF datetime format. + internal string ToDmtfDateTime(System.DateTime date) + { + string utcString = string.Empty; + System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(date); + long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute))); + if ((System.Math.Abs(OffsetMins) > 999)) + { + date = date.ToUniversalTime(); + utcString = "+000"; + } + else + { + if ((tickOffset.Ticks >= 0)) + { + utcString = string.Concat("+", ((System.Int64)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute))).ToString().PadLeft(3, '0')); + } + else + { + string strTemp = ((System.Int64)(OffsetMins)).ToString(); + utcString = string.Concat("-", strTemp.Substring(1, (strTemp.Length - 1)).PadLeft(3, '0')); + } + } + string dmtfDateTime = ((System.Int32)(date.Year)).ToString().PadLeft(4, '0'); + dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Month)).ToString().PadLeft(2, '0')); + dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Day)).ToString().PadLeft(2, '0')); + dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Hour)).ToString().PadLeft(2, '0')); + dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Minute)).ToString().PadLeft(2, '0')); + dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Second)).ToString().PadLeft(2, '0')); + dmtfDateTime = string.Concat(dmtfDateTime, "."); + System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); + long microsec = ((long)((((date.Ticks - dtTemp.Ticks) + * 1000) + / System.TimeSpan.TicksPerMillisecond))); + string strMicrosec = ((System.Int64)(microsec)).ToString(); + if ((strMicrosec.Length > 6)) + { + strMicrosec = strMicrosec.Substring(0, 6); + } + dmtfDateTime = string.Concat(dmtfDateTime, strMicrosec.PadLeft(6, '0')); + dmtfDateTime = string.Concat(dmtfDateTime, utcString); + return dmtfDateTime; + } + + public ManagementScope GetScope() + { + if (scope != null) + return scope; + + // create new scope + if (String.IsNullOrEmpty(computerName)) + { + // local + scope = new ManagementScope(nameSpace); + } + else + { + // remote + ConnectionOptions options = new ConnectionOptions(); + + string path = String.Format(@"\\{0}\{1}", computerName, nameSpace); + scope = new ManagementScope(path, options); + } + + // connect + scope.Connect(); + return scope; + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Utils/Log.cs b/WebsitePanel/Sources/WebsitePanel.Server.Utils/Log.cs index e645d9f5..c35c3231 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Utils/Log.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Utils/Log.cs @@ -29,6 +29,7 @@ using System; using System.Diagnostics; + namespace WebsitePanel.Server.Utils { /// @@ -151,5 +152,7 @@ namespace WebsitePanel.Server.Utils // return String.Concat(String.Format("[{0:G}] {1}: ", DateTime.Now, tag), message); } + + } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server.sln b/WebsitePanel/Sources/WebsitePanel.Server.sln index 01b22496..c9ab529e 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.sln +++ b/WebsitePanel/Sources/WebsitePanel.Server.sln @@ -1,5 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2010 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30723.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching Application Block", "Caching Application Block", "{C8E6F2E4-A5B8-486A-A56E-92D864524682}" ProjectSection(SolutionItems) = preProject Bin\Microsoft.Practices.EnterpriseLibrary.Common.dll = Bin\Microsoft.Practices.EnterpriseLibrary.Common.dll @@ -150,6 +152,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.DNS. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.HostedSolution.Crm2013", "WebsitePanel.Providers.HostedSolution.Crm2013\WebsitePanel.Providers.HostedSolution.Crm2013.csproj", "{1EF935C9-6DB9-47A1-B261-CB56512DF980}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Virtualization.HyperV2012R2", "WebsitePanel.Providers.Virtualization.HyperV-2012R2\WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj", "{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -760,6 +764,16 @@ Global {1EF935C9-6DB9-47A1-B261-CB56512DF980}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {1EF935C9-6DB9-47A1-B261-CB56512DF980}.Release|Mixed Platforms.Build.0 = Release|Any CPU {1EF935C9-6DB9-47A1-B261-CB56512DF980}.Release|x86.ActiveCfg = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|x86.ActiveCfg = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Any CPU.Build.0 = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WebsitePanel/Sources/WebsitePanel.Server/Web.config b/WebsitePanel/Sources/WebsitePanel.Server/Web.config index f50b8202..fd2b751d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.Server/Web.config @@ -21,7 +21,7 @@ - + @@ -48,9 +48,9 @@ - + - + diff --git a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj index f34b2571..7cfa6f68 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj @@ -227,6 +227,8 @@ + + From 70bd6c51725c7199346b75200a727a395a6f5dd7 Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 31 Aug 2014 09:49:56 +0800 Subject: [PATCH 03/91] PArtial commit Hyper-V 2012 R2 VPS Provider --- .../HyperV2012R2.cs | 23 +++++++++++++++---- WebsitePanel/Sources/WebsitePanel.Server.sln | 16 ++++++++++++- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index f3d7688e..15199ad5 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -137,7 +137,13 @@ namespace WebsitePanel.Providers.Virtualization #endregion #region Virtual Machines + public VirtualMachine GetVirtualMachine(string vmId) + { + return GetVirtualMachineInternal( vmId, false); + } + + public VirtualMachine GetVirtualMachineInternal(string vmId, bool extended) { HostedSolutionLog.LogStart("GetVirtualMachine"); @@ -225,6 +231,13 @@ namespace WebsitePanel.Providers.Virtualization public VirtualMachine GetVirtualMachineEx(string vmId) { + return GetVirtualMachineInternal( vmId, true); + } + + /* + public VirtualMachine GetVirtualMachineExInternal(runSpace, string vmId) + { + ManagementObject objVm = wmi.GetWmiObject("msvm_ComputerSystem", "Name = '{0}'", vmId); if (objVm == null) return null; @@ -287,16 +300,18 @@ namespace WebsitePanel.Providers.Virtualization vm.Adapters = nics.ToArray(); return vm; + } + */ public List GetVirtualMachines() { List vms = new List(); - + /* ManagementObjectCollection objVms = wmi.ExecuteWmiQuery("select * from msvm_ComputerSystem where Name <> ElementName"); foreach (ManagementObject objVm in objVms) vms.Add(CreateVirtualMachineFromWmiObject(objVm)); - + */ return vms; } @@ -2029,10 +2044,10 @@ exit", Convert.ToInt32(objDisk["Index"]))); #region Stop else if (!started && - (vps.State == VirtualMachineState.Started + (vps.State == VirtualMachineState.Running || vps.State == VirtualMachineState.Paused)) { - if (vps.State == VirtualMachineState.Started) + if (vps.State == VirtualMachineState.Running) { // try to shutdown the system ReturnCode code = ShutDownVirtualMachine(vm.VirtualMachineId, true, "Virtual Machine has been suspended from WebsitePanel"); diff --git a/WebsitePanel/Sources/WebsitePanel.Server.sln b/WebsitePanel/Sources/WebsitePanel.Server.sln index 8d0401c9..9fecc65b 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.sln +++ b/WebsitePanel/Sources/WebsitePanel.Server.sln @@ -1,5 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30723.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching Application Block", "Caching Application Block", "{C8E6F2E4-A5B8-486A-A56E-92D864524682}" ProjectSection(SolutionItems) = preProject Bin\Microsoft.Practices.EnterpriseLibrary.Common.dll = Bin\Microsoft.Practices.EnterpriseLibrary.Common.dll @@ -152,6 +154,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Host EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Mail.IceWarp", "WebsitePanel.Providers.Mail.IceWarp\WebsitePanel.Providers.Mail.IceWarp.csproj", "{95EA2D6E-278C-4A74-97DB-946362C4DEEA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Virtualization.HyperV2012R2", "WebsitePanel.Providers.Virtualization.HyperV-2012R2\WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj", "{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -772,6 +776,16 @@ Global {95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|Mixed Platforms.Build.0 = Release|Any CPU {95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|x86.ActiveCfg = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|x86.ActiveCfg = Debug|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Any CPU.Build.0 = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 2b4460eac2657fad1c4cebcb29169e416251dc4a Mon Sep 17 00:00:00 2001 From: robvde Date: Mon, 8 Sep 2014 15:01:05 +0800 Subject: [PATCH 04/91] Partial Commit Hyper-V 2012 R2 provider --- .../Virtualization/BiosInfo.cs | 40 ++++ .../Virtualization/ControllerType.cs | 40 ++++ .../Virtualization/MemoryInfo.cs | 44 ++++ .../Virtualization/VirtualHardDiskInfo.cs | 10 + .../Virtualization/VirtualMachine.cs | 3 + .../WebsitePanel.Providers.Base.csproj | 4 + .../HyperV2012R2.cs | 207 ++++++++++++------ .../VPS/VpsDetailsGeneral.ascx.cs | 8 +- 8 files changed, 288 insertions(+), 68 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/BiosInfo.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/ControllerType.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MemoryInfo.cs diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/BiosInfo.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/BiosInfo.cs new file mode 100644 index 00000000..f7fd4a59 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/BiosInfo.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2014, 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.Collections.Generic; +using System.Text; + +namespace WebsitePanel.Providers.Virtualization +{ + public class BiosInfo + { + public bool NumLockEnabled { get; set; } + public string[] StartupOrder { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/ControllerType.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/ControllerType.cs new file mode 100644 index 00000000..afe85d2a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/ControllerType.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2014, 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.Collections.Generic; +using System.Text; + +namespace WebsitePanel.Providers.Virtualization +{ + public enum ControllerType + { + IDE = 0, + SCSI = 1 + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MemoryInfo.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MemoryInfo.cs new file mode 100644 index 00000000..0fe02369 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MemoryInfo.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2014, 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.Collections.Generic; +using System.Text; + +namespace WebsitePanel.Providers.Virtualization +{ + public class MemoryInfo + { + public bool DynamicMemoryEnabled { get; set; } + public Int32 Startup { get; set; } + public Int32 Minimum { get; set; } + public Int32 Maximum { get; set; } + public int Buffer { get; set; } + public int Priority { get; set; } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualHardDiskInfo.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualHardDiskInfo.cs index 906b3969..9881f717 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualHardDiskInfo.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualHardDiskInfo.cs @@ -40,5 +40,15 @@ namespace WebsitePanel.Providers.Virtualization public long MaxInternalSize { get; set; } public string ParentPath { get; set; } public VirtualHardDiskType DiskType { get; set; } + public bool SupportPersistentReservations { get; set; } + public long MaximumIOPS { get; set; } + public long MinimumIOPS { get; set; } + public ControllerType VHDControllerType { get; set; } + public int ControllerNumber { get; set; } + public int ControllerLocation { get; set; } + public string Name { get; set; } + public string Path { get; set; } + public VirtualHardDiskFormat DiskFormat { get; set; } + public bool Attached { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs index f8be508c..41ed3494 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs @@ -124,6 +124,9 @@ namespace WebsitePanel.Providers.Virtualization // for GetVirtualMachineEx used in import method public VirtualMachineNetworkAdapter[] Adapters { get; set; } + [Persistent] + public VirtualHardDiskInfo[] Disks { get; set; } + [Persistent] public string Status { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index 2ab48c12..fa659087 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -268,6 +268,7 @@ + Code @@ -278,6 +279,7 @@ Code + Code @@ -288,6 +290,7 @@ + @@ -302,6 +305,7 @@ Code + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index 15199ad5..6aa31177 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -143,7 +143,7 @@ namespace WebsitePanel.Providers.Virtualization return GetVirtualMachineInternal( vmId, false); } - public VirtualMachine GetVirtualMachineInternal(string vmId, bool extended) + public VirtualMachine GetVirtualMachineInternal(string vmId, bool extendedInfo) { HostedSolutionLog.LogStart("GetVirtualMachine"); @@ -171,26 +171,41 @@ namespace WebsitePanel.Providers.Virtualization vm.ReplicationState = GetPSObjectProperty(result[0], "ReplicationState").ToString(); vm.Heartbeat = GetVMHeartBeatStatus(runSpace, vm.Name); - - - //vm.CreatedDate = null; - // HDD - /* - if (vmKvp.Name == KVP_HDD_SUMMARY_KEY) + vm.CreatedDate = DateTime.Now; + + if (extendedInfo) { - string[] disksArray = vmKvp.Data.Split(';'); - vm.HddLogicalDisks = new LogicalDisk[disksArray.Length]; - for (int i = 0; i < disksArray.Length; i++) + vm.CpuCores = GetVMProcessors(runSpace, vm.Name); + + MemoryInfo memoryInfo = GetVMMemory(runSpace, vm.Name); + vm.RamSize = memoryInfo.Startup; + + BiosInfo biosInfo = GetVMBios(runSpace, vm.Name); + vm.NumLockEnabled = biosInfo.NumLockEnabled; + + vm.BootFromCD = false; + if ((biosInfo.StartupOrder != null) && (biosInfo.StartupOrder.Length > 0)) + vm.BootFromCD = (biosInfo.StartupOrder[0] == "CD"); + + cmd = new Command("Get-VMDvdDrive"); + cmd.Parameters.Add("VMName", vm.Name); + + result = ExecuteShellCommand(runSpace, cmd, false); + vm.DvdDriveInstalled = (result != null && result.Count > 0); + + vm.Disks = GetVirtualHardDisks(runSpace, vm.Name); + + if ((vm.Disks != null) & (vm.Disks.GetLength(0) > 0)) { - string[] disk = disksArray[i].Split(':'); - vm.HddLogicalDisks[i] = new LogicalDisk(); - vm.HddLogicalDisks[i].DriveLetter = disk[0]; - vm.HddLogicalDisks[i].FreeSpace = Int32.Parse(disk[1]); - vm.HddLogicalDisks[i].Size = Int32.Parse(disk[2]); + vm.VirtualHardDrivePath = vm.Disks[0].Path; + vm.HddSize = Convert.ToInt32(vm.Disks[0].FileSize); } + + + } - */ + } } catch (Exception ex) @@ -213,7 +228,6 @@ namespace WebsitePanel.Providers.Virtualization OperationalStatus status = OperationalStatus.None; - runSpace = OpenRunspace(); Command cmd = new Command("Get-VMIntegrationService"); cmd.Parameters.Add("VMName", name); @@ -224,8 +238,6 @@ namespace WebsitePanel.Providers.Virtualization { status = (OperationalStatus)Enum.Parse(typeof(OperationalStatus), GetPSObjectProperty(result[0], "PrimaryOperationalStatus").ToString()); } - - return status; } @@ -234,56 +246,123 @@ namespace WebsitePanel.Providers.Virtualization return GetVirtualMachineInternal( vmId, true); } + + internal int GetVMProcessors(Runspace runSpace, string name) + { + + int procs = 0; + + Command cmd = new Command("Get-VMProcessor"); + + cmd.Parameters.Add("VMName", name); + + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if (result != null && result.Count > 0) + { + procs = Convert.ToInt32(GetPSObjectProperty(result[0], "Count")); + + } + return procs; + } + + internal MemoryInfo GetVMMemory(Runspace runSpace, string name) + { + + MemoryInfo info = new MemoryInfo(); + + Command cmd = new Command("Get-VMMemory"); + + cmd.Parameters.Add("VMName", name); + + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if (result != null && result.Count > 0) + { + info.DynamicMemoryEnabled = Convert.ToBoolean(GetPSObjectProperty(result[0], "DynamicMemoryEnabled")); + info.Startup = Convert.ToInt32(GetPSObjectProperty(result[0], "Startup")); + info.Minimum = Convert.ToInt32(GetPSObjectProperty(result[0], "Minimum")); + info.Maximum = Convert.ToInt32(GetPSObjectProperty(result[0], "Maximum")); + info.Buffer = Convert.ToInt16(GetPSObjectProperty(result[0], "Buffer")); + info.Priority = Convert.ToInt16(GetPSObjectProperty(result[0], "Prioriy")); + } + return info; + } + + internal BiosInfo GetVMBios(Runspace runSpace, string name) + { + + BiosInfo info = new BiosInfo(); + + Command cmd = new Command("Get-VMBios"); + + cmd.Parameters.Add("VMName", name); + + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if (result != null && result.Count > 0) + { + info.NumLockEnabled = Convert.ToBoolean(GetPSObjectProperty(result[0], "NumLockEnabled")); + info.StartupOrder = (string[])GetPSObjectProperty(result[0], "StartupOrder"); + } + return info; + } + + internal VirtualHardDiskInfo[] GetVirtualHardDisks(Runspace runSpace, string name) + { + + List disks = new List(); + + Command cmd = new Command("Get-VMHardDiskDrive"); + cmd.Parameters.Add("VMName", name); + + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if (result != null && result.Count > 0) + { + foreach(PSObject d in result) + { + VirtualHardDiskInfo disk = new VirtualHardDiskInfo(); + + disk.SupportPersistentReservations = Convert.ToBoolean(GetPSObjectProperty(d, "SupportPersistentReservations")); + disk.MaximumIOPS= Convert.ToInt32(GetPSObjectProperty(d, "MaximumIOPS")); + disk.MinimumIOPS= Convert.ToInt32(GetPSObjectProperty(d, "MinimumIOPS")); + disk.VHDControllerType = (ControllerType)Enum.Parse(typeof(ControllerType), GetPSObjectProperty(d, "ControllerType").ToString()); + disk.ControllerNumber = Convert.ToInt16(GetPSObjectProperty(d, "ControllerNumber")); + disk.ControllerLocation = Convert.ToInt16(GetPSObjectProperty(d, "ControllerLocation")); + disk.Path = GetPSObjectProperty(d, "Path").ToString(); + disk.Name = GetPSObjectProperty(d, "Name").ToString(); + + GetVirtualHardDiskDetail(runSpace, disk.Path, ref disk); + + disks.Add(disk); + } + } + return disks.ToArray(); + } + + internal void GetVirtualHardDiskDetail(Runspace runSpace, string path, ref VirtualHardDiskInfo disk) + { + if (!string.IsNullOrEmpty(path)) + { + Command cmd = new Command("Get-VHD"); + cmd.Parameters.Add("Path", path); + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if (result != null && result.Count > 0) + { + disk.DiskFormat = (VirtualHardDiskFormat)Enum.Parse(typeof(VirtualHardDiskFormat), GetPSObjectProperty(result[0], "VhdFormat").ToString()); + disk.DiskType = (VirtualHardDiskType)Enum.Parse(typeof(VirtualHardDiskType), GetPSObjectProperty(result[0], "Type").ToString()); + disk.ParentPath = GetPSObjectProperty(result[0], "ParentPath").ToString(); + disk.MaxInternalSize = Convert.ToInt32(GetPSObjectProperty(result[0], "Size")) / Size1G; + disk.FileSize = Convert.ToInt32(GetPSObjectProperty(result[0], "FileSize")) / Size1G; + disk.Attached = Convert.ToBoolean(GetPSObjectProperty(result[0], "Attached")); + } + } + } + + /* public VirtualMachine GetVirtualMachineExInternal(runSpace, string vmId) { - ManagementObject objVm = wmi.GetWmiObject("msvm_ComputerSystem", "Name = '{0}'", vmId); - if (objVm == null) - return null; + - // general settings - VirtualMachine vm = CreateVirtualMachineFromWmiObject(objVm); - - // CPU - ManagementObject objCpu = wmi.GetWmiObject("Msvm_ProcessorSettingData", "InstanceID Like 'Microsoft:{0}%'", vmId); - vm.CpuCores = Convert.ToInt32(objCpu["VirtualQuantity"]); - - // RAM - ManagementObject objRam = wmi.GetWmiObject("Msvm_MemorySettingData", "InstanceID Like 'Microsoft:{0}%'", vmId); - vm.RamSize = Convert.ToInt32(objRam["VirtualQuantity"]); - - // other settings - ManagementObject objSettings = GetVirtualMachineSettingsObject(vmId); - - // BIOS (num lock) - vm.NumLockEnabled = Convert.ToBoolean(objSettings["BIOSNumLock"]); - - // BIOS (boot order) - // BootOrder = 0 - Boot from floppy, 1 - Boot from CD, 2 - Boot from disk, 3 - PXE Boot - UInt16[] bootOrder = (UInt16[])objSettings["BootOrder"]; - vm.BootFromCD = (bootOrder[0] == 1); - - // DVD drive - ManagementObject objDvd = wmi.GetWmiObject( - "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Synthetic DVD Drive'" - + " and InstanceID Like 'Microsoft:{0}%'", vmId); - vm.DvdDriveInstalled = (objDvd != null); - - // HDD - ManagementObject objVhd = wmi.GetWmiObject( - "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Virtual Hard Disk'" - + " and InstanceID like 'Microsoft:{0}%'", vmId); - - if (objVhd != null) - { - vm.VirtualHardDrivePath = ((string[])objVhd["Connection"])[0]; - - // get VHD size - VirtualHardDiskInfo vhdInfo = GetVirtualHardDiskInfo(vm.VirtualHardDrivePath); - if (vhdInfo != null) - vm.HddSize = Convert.ToInt32(vhdInfo.MaxInternalSize / Size1G); - } // network adapters List nics = new List(); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsGeneral.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsGeneral.ascx.cs index 050186fd..39fa7a08 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsGeneral.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsGeneral.ascx.cs @@ -155,7 +155,7 @@ namespace WebsitePanel.Portal.VPS || vm.State == VirtualMachineState.Saved)) buttons.Add(CreateActionButton("Start", "start.png")); - if (vm.State == VirtualMachineState.Started) + if (vm.State == VirtualMachineState.Running) { if(vmi.RebootAllowed) buttons.Add(CreateActionButton("Reboot", "reboot.png")); @@ -165,12 +165,12 @@ namespace WebsitePanel.Portal.VPS } if (vmi.StartTurnOffAllowed - && (vm.State == VirtualMachineState.Started + && (vm.State == VirtualMachineState.Running || vm.State == VirtualMachineState.Paused)) buttons.Add(CreateActionButton("TurnOff", "turnoff.png")); if (vmi.PauseResumeAllowed - && vm.State == VirtualMachineState.Started) + && vm.State == VirtualMachineState.Running) buttons.Add(CreateActionButton("Pause", "pause.png")); if (vmi.PauseResumeAllowed @@ -178,7 +178,7 @@ namespace WebsitePanel.Portal.VPS buttons.Add(CreateActionButton("Resume", "start2.png")); if (vmi.ResetAllowed - && (vm.State == VirtualMachineState.Started + && (vm.State == VirtualMachineState.Running || vm.State == VirtualMachineState.Paused)) buttons.Add(CreateActionButton("Reset", "reset2.png")); From 147a9285e9cf44d2bd1e2b1eaeae0883cfae24eb Mon Sep 17 00:00:00 2001 From: robvde Date: Wed, 8 Oct 2014 21:03:30 +0800 Subject: [PATCH 05/91] partial commit --- .../Virtualization/VirtualHardDiskFormat.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualHardDiskFormat.cs diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualHardDiskFormat.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualHardDiskFormat.cs new file mode 100644 index 00000000..8787c82d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualHardDiskFormat.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2014, 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.Collections.Generic; +using System.Text; + +namespace WebsitePanel.Providers.Virtualization +{ + public enum VirtualHardDiskFormat + { + VHD = 1, + VHDX = 2 + } +} From abb67a1cc536fb3da1c6ce56a77bdb05751263a2 Mon Sep 17 00:00:00 2001 From: robvde Date: Mon, 3 Nov 2014 10:44:52 +0800 Subject: [PATCH 06/91] Provider config fixed for hyper-v 2012 R2, partial check in --- WebsitePanel/Database/update_db.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index f3d6643d..a980545a 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -5377,7 +5377,7 @@ AS GO -- Hyper-V 2012 R2 -IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'Microsoft Hyper-V 2012 R2') +IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'HyperV2012R2') BEGIN INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (350, 30, N'HyperV2012R2', N'Microsoft Hyper-V 2012 R2', N'WebsitePanel.Providers.Virtualization.HyperV2012R2, WebsitePanel.Providers.Virtualization.HyperV2012R2', N'HyperV', 1) END From a0799c7158431270de8598abcb31b9ed59cdb009 Mon Sep 17 00:00:00 2001 From: robvde Date: Fri, 6 Feb 2015 06:43:41 +0800 Subject: [PATCH 07/91] sql fix up --- WebsitePanel/Database/update_db.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 615f49f3..cc7bfeb3 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -7455,7 +7455,7 @@ RETURN GO -- Hyper-V 2012 R2 -IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'Microsoft Hyper-V 2012 R2') +IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'HyperV2012R2') BEGIN INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (350, 30, N'HyperV2012R2', N'Microsoft Hyper-V 2012 R2', N'WebsitePanel.Providers.Virtualization.HyperV2012R2, WebsitePanel.Providers.Virtualization.HyperV2012R2', N'HyperV', 1) END From 1f9aff41c162093647241521920b19bb05592830 Mon Sep 17 00:00:00 2001 From: robvde Date: Tue, 17 Feb 2015 20:08:40 +0800 Subject: [PATCH 08/91] Fixed up project files to work with W10 tech preview --- .../WebsitePanel.Providers.DNS.MsDNS2012.csproj | 4 +++- ...bsitePanel.Providers.EnterpriseStorage.Windows2012.csproj | 2 +- ...WebsitePanel.Providers.HostedSolution.Exchange2013.csproj | 5 +++-- .../WebsitePanel.Providers.HostedSolution.Lync2013HP.csproj | 4 +++- ...WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj | 4 +++- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.DNS.MsDNS2012/WebsitePanel.Providers.DNS.MsDNS2012.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.DNS.MsDNS2012/WebsitePanel.Providers.DNS.MsDNS2012.csproj index 3e204b0a..d958a02e 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.DNS.MsDNS2012/WebsitePanel.Providers.DNS.MsDNS2012.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.DNS.MsDNS2012/WebsitePanel.Providers.DNS.MsDNS2012.csproj @@ -9,7 +9,7 @@ Properties WebsitePanel.Providers.DNS.MsDNS2012 WebsitePanel.Providers.DNS.MsDNS2012 - v4.0 + v4.5 512 @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + false diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/WebsitePanel.Providers.EnterpriseStorage.Windows2012.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/WebsitePanel.Providers.EnterpriseStorage.Windows2012.csproj index 2ff4ba61..21db961a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/WebsitePanel.Providers.EnterpriseStorage.Windows2012.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/WebsitePanel.Providers.EnterpriseStorage.Windows2012.csproj @@ -9,7 +9,7 @@ Properties WebsitePanel.Providers.EnterpriseStorage.Windows2012 WebsitePanel.Providers.EnterpriseStorage.Windows2012 - v3.5 + v4.0 512 diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/WebsitePanel.Providers.HostedSolution.Exchange2013.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/WebsitePanel.Providers.HostedSolution.Exchange2013.csproj index eb303e4c..dc984cec 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/WebsitePanel.Providers.HostedSolution.Exchange2013.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/WebsitePanel.Providers.HostedSolution.Exchange2013.csproj @@ -9,7 +9,7 @@ Properties WebsitePanel.Providers.HostedSolution.Exchange2013 WebsitePanel.Providers.HostedSolution.Exchange2013 - v4.0 + v4.5 512 @@ -22,6 +22,7 @@ prompt 4 AllRules.ruleset + false pdbonly @@ -30,6 +31,7 @@ TRACE prompt 4 + false @@ -70,7 +72,6 @@ False ..\..\Lib\References\Microsoft\Windows2012\System.Management.Automation.dll - False diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013HP/WebsitePanel.Providers.HostedSolution.Lync2013HP.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013HP/WebsitePanel.Providers.HostedSolution.Lync2013HP.csproj index 4cd53e34..82943dc4 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013HP/WebsitePanel.Providers.HostedSolution.Lync2013HP.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013HP/WebsitePanel.Providers.HostedSolution.Lync2013HP.csproj @@ -9,7 +9,7 @@ Properties WebsitePanel.Providers.HostedSolution.Lync2013HP WebsitePanel.Providers.HostedSolution.Lync2013HP - v4.0 + v4.5 512 @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + false diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj index 908e78fd..31e9533c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj @@ -9,7 +9,7 @@ Properties WebsitePanel.Providers.Virtualization.HyperV2012R2 WebsitePanel.Providers.Virtualization.HyperV2012R2 - v4.0 + v4.5 512 @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + false From 7d075f6142e7dba1072b5b4cc4bdeca3211c168a Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Mon, 30 Mar 2015 03:34:22 -0700 Subject: [PATCH 09/91] webdav portal root folder speed fix --- .../EnterpriseStorageProxy.cs | 81 +++++++++++++++++++ .../EnterpriseStorageController.cs | 56 +++++++++++++ .../esEnterpriseStorage.asmx.cs | 6 ++ .../Managers/WebDavManager.cs | 26 +----- 4 files changed, 147 insertions(+), 22 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs index ef29192f..761f7449 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/EnterpriseStorageProxy.cs @@ -47,6 +47,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback GetEnterpriseFoldersOperationCompleted; + private System.Threading.SendOrPostCallback GetUserRootFoldersOperationCompleted; + private System.Threading.SendOrPostCallback GetEnterpriseFolderOperationCompleted; private System.Threading.SendOrPostCallback CreateEnterpriseFolderOperationCompleted; @@ -128,6 +130,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event GetEnterpriseFoldersCompletedEventHandler GetEnterpriseFoldersCompleted; + /// + public event GetUserRootFoldersCompletedEventHandler GetUserRootFoldersCompleted; + /// public event GetEnterpriseFolderCompletedEventHandler GetEnterpriseFolderCompleted; @@ -456,6 +461,56 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetUserRootFolders", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SystemFile[] GetUserRootFolders(int itemId, int accountId, string userName, string displayName) { + object[] results = this.Invoke("GetUserRootFolders", new object[] { + itemId, + accountId, + userName, + displayName}); + return ((SystemFile[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetUserRootFolders(int itemId, int accountId, string userName, string displayName, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetUserRootFolders", new object[] { + itemId, + accountId, + userName, + displayName}, callback, asyncState); + } + + /// + public SystemFile[] EndGetUserRootFolders(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SystemFile[])(results[0])); + } + + /// + public void GetUserRootFoldersAsync(int itemId, int accountId, string userName, string displayName) { + this.GetUserRootFoldersAsync(itemId, accountId, userName, displayName, null); + } + + /// + public void GetUserRootFoldersAsync(int itemId, int accountId, string userName, string displayName, object userState) { + if ((this.GetUserRootFoldersOperationCompleted == null)) { + this.GetUserRootFoldersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetUserRootFoldersOperationCompleted); + } + this.InvokeAsync("GetUserRootFolders", new object[] { + itemId, + accountId, + userName, + displayName}, this.GetUserRootFoldersOperationCompleted, userState); + } + + private void OnGetUserRootFoldersOperationCompleted(object arg) { + if ((this.GetUserRootFoldersCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetUserRootFoldersCompleted(this, new GetUserRootFoldersCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetEnterpriseFolder", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public SystemFile GetEnterpriseFolder(int itemId, string folderName) { @@ -1933,6 +1988,32 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetUserRootFoldersCompletedEventHandler(object sender, GetUserRootFoldersCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetUserRootFoldersCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetUserRootFoldersCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SystemFile[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SystemFile[])(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetEnterpriseFolderCompletedEventHandler(object sender, GetEnterpriseFolderCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs index 6402a7b0..7398203b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs @@ -76,6 +76,11 @@ namespace WebsitePanel.EnterpriseServer return GetFoldersInternal(itemId); } + public static SystemFile[] GetUserRootFolders(int itemId, int accountId, string userName, string displayName) + { + return GetUserRootFoldersInternal(itemId, accountId, userName, displayName); + } + public static SystemFile GetFolder(int itemId, string folderName) { return GetFolderInternal(itemId, folderName); @@ -554,6 +559,57 @@ namespace WebsitePanel.EnterpriseServer } } + protected static SystemFile[] GetUserRootFoldersInternal(int itemId, int accountId, string userName, string displayName) + { + try + { + var rootFolders = new List(); + + // load organization + Organization org = OrganizationController.GetOrganization(itemId); + if (org == null) + { + return new SystemFile[0]; + } + + int serviceId = GetEnterpriseStorageServiceID(org.PackageId); + + if (serviceId == 0) + { + return new SystemFile[0]; + } + + EnterpriseStorage es = GetEnterpriseStorage(serviceId); + + var webDavSettings = ObjectUtils.CreateListFromDataReader( + DataProvider.GetEnterpriseFolders(itemId)).ToArray(); + + var userGroups = OrganizationController.GetSecurityGroupsByMember(itemId, accountId); + + foreach (var folder in es.GetFolders(org.OrganizationId, webDavSettings)) + { + var permissions = ConvertToESPermission(itemId,folder.Rules); + + foreach (var permission in permissions) + { + if ((!permission.IsGroup + && (permission.DisplayName == userName || permission.DisplayName == displayName)) + || (permission.IsGroup && userGroups.Any(x => x.DisplayName == permission.DisplayName))) + { + rootFolders.Add(folder); + break; + } + } + } + + return rootFolders.ToArray(); + } + catch (Exception ex) + { + throw ex; + } + } + protected static SystemFile GetFolderInternal(int itemId, string folderName) { try diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs index f5ba338b..eab4e26b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esEnterpriseStorage.asmx.cs @@ -92,6 +92,12 @@ namespace WebsitePanel.EnterpriseServer return EnterpriseStorageController.GetFolders(itemId); } + [WebMethod] + public SystemFile[] GetUserRootFolders(int itemId, int accountId, string userName, string displayName) + { + return EnterpriseStorageController.GetUserRootFolders(itemId, accountId, userName, displayName); + } + [WebMethod] public SystemFile GetEnterpriseFolder(int itemId, string folderName) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs index de3626fd..ceb0beb8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDav.Core/Managers/WebDavManager.cs @@ -47,7 +47,7 @@ namespace WebsitePanel.WebDav.Core.Managers if (string.IsNullOrWhiteSpace(pathPart)) { - children = ConnectToWebDavServer().Select(x => new WebDavResource + children = GetWebDavRootItems().Select(x => new WebDavResource { Href = new Uri(x.Url), ItemType = ItemType.Folder, @@ -82,10 +82,9 @@ namespace WebsitePanel.WebDav.Core.Managers SystemFile[] items; - if (string.IsNullOrWhiteSpace(pathPart)) { - var rootItems = ConnectToWebDavServer().Select(x => x.Name).ToList(); + var rootItems = GetWebDavRootItems().Select(x => x.Name).ToList(); rootItems.Insert(0, string.Empty); items = WspContext.Services.EnterpriseStorage.SearchFiles(itemId, rootItems.ToArray(), searchValue, uesrPrincipalName, recursive); @@ -285,28 +284,11 @@ namespace WebsitePanel.WebDav.Core.Managers } } - private IList ConnectToWebDavServer() + private IList GetWebDavRootItems() { - var rootFolders = new List(); var user = WspContext.User; - var userGroups = WSP.Services.Organizations.GetSecurityGroupsByMember(user.ItemId, user.AccountId); - - foreach (var folder in WSP.Services.EnterpriseStorage.GetEnterpriseFolders(WspContext.User.ItemId)) - { - var permissions = WSP.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(WspContext.User.ItemId, folder.Name); - - foreach (var permission in permissions) - { - if ((!permission.IsGroup - && (permission.DisplayName == user.UserName || permission.DisplayName == user.DisplayName)) - || (permission.IsGroup && userGroups.Any(x => x.DisplayName == permission.DisplayName))) - { - rootFolders.Add(folder); - break; - } - } - } + var rootFolders = WspContext.Services.EnterpriseStorage.GetUserRootFolders(user.ItemId, user.AccountId,user.UserName, user.DisplayName); return rootFolders; } From c2c449506ded518b522ef63c6c7132ec1ff0b8b6 Mon Sep 17 00:00:00 2001 From: Olov Karlsson Date: Mon, 30 Mar 2015 15:50:29 +0200 Subject: [PATCH 10/91] IceWarp changes: more error reporting and alias-bug fixed --- .../IceWarp.cs | 86 ++++++++++++++----- 1 file changed, 63 insertions(+), 23 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs index caafd49c..a4fe06aa 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs @@ -34,7 +34,6 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; using Microsoft.Win32; -using WebsitePanel.Providers.Utils; using WebsitePanel.Server.Utils; namespace WebsitePanel.Providers.Mail @@ -183,7 +182,9 @@ namespace WebsitePanel.Providers.Mail { if (!apiObject.Save()) { - throw new Exception("Cannot save Api Object: " + GetErrorMessage(apiObject.LastErr)); + var ex = new Exception("Cannot save Api Object: " + GetErrorMessage(apiObject.LastErr)); + Log.WriteError(ex); + throw ex; } } @@ -298,7 +299,7 @@ namespace WebsitePanel.Providers.Mail var obj = GetAccountObject(); if (!obj.Open(accountName)) { - throw new Exception("Cannot open account " + accountName + ": " + GetErrorMessage(obj.LastErr)); + Log.WriteWarning(string.Format("Cannot open account {0}: {1}", accountName, GetErrorMessage(obj.LastErr))); } return obj; @@ -308,7 +309,9 @@ namespace WebsitePanel.Providers.Mail { if (!domain.Save()) { - throw new ArgumentException("Could not save domain:" + GetErrorMessage(domain.LastErr)); + var ex = new Exception("Could not save domain:" + GetErrorMessage(domain.LastErr)); + Log.WriteError(ex); + throw ex; } } @@ -316,11 +319,12 @@ namespace WebsitePanel.Providers.Mail { if (!account.Save()) { - throw new ArgumentException("Could not save " + accountTypeName + ":" + GetErrorMessage(account.LastErr)); + var ex = new Exception(string.Format("Could not save {0}: {1}", accountTypeName, GetErrorMessage(account.LastErr))); + Log.WriteError(ex); + throw ex; } } - protected string GetEmailUser(string email) { if (string.IsNullOrWhiteSpace(email)) @@ -544,7 +548,7 @@ namespace WebsitePanel.Providers.Mail var ms = new MemoryStream(statsBuffer); var reader = new StreamReader(ms); - while (reader.Peek() != -1) + while (reader.Peek() > -1) { var line = reader.ReadLine(); var fields = line.Split(','); @@ -665,14 +669,18 @@ namespace WebsitePanel.Providers.Mail { if (string.IsNullOrWhiteSpace(domain.Name)) { - throw new ArgumentNullException("domain.Name"); + var ex = new Exception("Cannot create domain with empty domain name", new ArgumentNullException("domain.Name")); + Log.WriteError(ex); + throw ex; } var domainObject = GetDomainObject(); if (!domainObject.New(domain.Name)) { - throw new ApplicationException("Failed to create domain: " + GetErrorMessage(domainObject.LastErr)); + var ex = new Exception("Failed to create domain: " + GetErrorMessage(domainObject.LastErr)); + Log.WriteError(ex); + throw ex; } SaveDomain(domainObject); @@ -713,17 +721,22 @@ namespace WebsitePanel.Providers.Mail public void DeleteDomain(string domainName) { + if (!DomainExists(domainName)) + { + return; + } + var domainObject = GetDomainObject(domainName); - if (domainObject.Delete()) + if (!domainObject.Delete()) { - throw new Exception("Could not delete domain"); + Log.WriteError("Could not delete domain" + GetErrorMessage(domainObject.LastErr), null); } } #endregion - #region Domain alieses + #region Domain aliases public bool DomainAliasExists(string domainName, string aliasName) { @@ -904,7 +917,9 @@ namespace WebsitePanel.Providers.Mail var emailParts = new MailAddress(mailbox.Name); if (!accountObject.CanCreateMailbox(emailParts.User, emailParts.User, mailbox.Password, emailParts.Host)) { - throw new Exception("Cannot create account: " + GetErrorMessage(accountObject.LastErr)); + var ex = new Exception("Cannot create account because of password policy in IceWarp server, invalid username, alias or domain. Check if the password policy is different in IceWarp and WSP. Also perhaps your IceWarp diallows username in password?"); + Log.WriteError(ex); + throw ex; } if (accountObject.New(mailbox.Name)) @@ -989,10 +1004,15 @@ namespace WebsitePanel.Providers.Mail public void DeleteAccount(string mailboxName) { + if (!AccountExists(mailboxName)) + { + return; + } + var accountObject = GetAccountObject(mailboxName); if (!accountObject.Delete()) { - throw new Exception("Cannot delete account: " + GetErrorMessage(accountObject.LastErr)); + Log.WriteError("Cannot delete account: " + GetErrorMessage(accountObject.LastErr), null); } } @@ -1069,7 +1089,7 @@ namespace WebsitePanel.Providers.Mail else { var accountOject = GetAccountObject(mailAlias.ForwardTo); - var aliases = GetAliasListFromAccountObject(accountOject).ToList(); + var aliases = ((IEnumerable) GetAliasListFromAccountObject(accountOject)).ToList(); aliases.Add(GetEmailUser(mailAlias.Name)); accountOject.SetProperty("U_EmailAlias", string.Join(";", aliases)); @@ -1171,7 +1191,7 @@ namespace WebsitePanel.Providers.Mail } else { - throw new ApplicationException("Failed to create group: " + GetErrorMessage(accountObject.LastErr)); + Log.WriteError("Failed to create group: " + GetErrorMessage(accountObject.LastErr), null); } UpdateGroup(group); @@ -1190,10 +1210,15 @@ namespace WebsitePanel.Providers.Mail public void DeleteGroup(string groupName) { + if (!GroupExists(groupName)) + { + return; + } + var accountObject = GetAccountObject(groupName); if (!accountObject.Delete()) { - throw new Exception("Cannot delete group: " + GetErrorMessage(accountObject.LastErr)); + Log.WriteError("Cannot delete group: " + GetErrorMessage(accountObject.LastErr), null); } } @@ -1351,14 +1376,18 @@ namespace WebsitePanel.Providers.Mail { if (string.IsNullOrWhiteSpace(maillist.Name)) { - throw new ArgumentNullException("maillist.Name"); + var ex = new ArgumentNullException("maillist.Name", "Cannot create list with empty name"); + Log.WriteError(ex); + throw ex; } var accountObject = GetAccountObject(); if (!accountObject.New(maillist.Name)) { - throw new ApplicationException("Failed to create mailing list: " + GetErrorMessage(accountObject.LastErr)); + var ex = new Exception("Failed to create mailing list: " + GetErrorMessage(accountObject.LastErr)); + Log.WriteError(ex); + throw ex; } accountObject.SetProperty("U_Type", IceWarpAccountType.MailingList); @@ -1401,7 +1430,9 @@ namespace WebsitePanel.Providers.Mail // Create list server account if (!listServerAccountObject.New("srv" + mailingListName)) { - throw new Exception("Cannot create listserver account to associate with mailing list." + GetErrorMessage(listServerAccountObject.LastErr)); + var ex = new Exception("Cannot create listserver account to associate with mailing list." + GetErrorMessage(listServerAccountObject.LastErr)); + Log.WriteError(ex); + throw ex; } listServerAccountObject.SetProperty("U_Type", IceWarpAccountType.ListServer); @@ -1529,6 +1560,11 @@ namespace WebsitePanel.Providers.Mail public void DeleteList(string maillistName) { + if (!ListExists(maillistName)) + { + return; + } + var accountObject = GetAccountObject(maillistName); var listServerAccountObject = FindMatchingListServerAccount(maillistName, false); @@ -1546,7 +1582,9 @@ namespace WebsitePanel.Providers.Mail { if (!listServerAccountObject.Delete()) { - throw new Exception("Deleted mail list, but list server account remains: " + GetErrorMessage(listServerAccountObject.LastErr)); + var ex = new Exception("Deleted mail list, but list server account remains: " + GetErrorMessage(listServerAccountObject.LastErr)); + Log.WriteError(ex); + throw ex; } } else @@ -1554,13 +1592,15 @@ namespace WebsitePanel.Providers.Mail listServerAccountObject.SetProperty("L_ListFile_Contents", string.Join("\n", lists.Remove(maillistName))); if (!listServerAccountObject.Save()) { - throw new Exception("Deleted mail list, but associated list server account could not be updated: " + GetErrorMessage(listServerAccountObject.LastErr)); + var ex = new Exception("Deleted mail list, but associated list server account could not be updated: " + GetErrorMessage(listServerAccountObject.LastErr)); + Log.WriteError(ex); + throw ex; } } } else { - throw new Exception("Cannot delete mail list: " + GetErrorMessage(accountObject.LastErr)); + Log.WriteError("Cannot delete mail list: " + GetErrorMessage(accountObject.LastErr), null); } } From 687cc108b9428c82edf8becb4196c428a3bfeb3e Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Mar 2015 11:33:31 -0400 Subject: [PATCH 11/91] Added tag build-2.1.0.626 for changeset aa93849d0c37 From a2def5381f8137ca4bd6c9836f5b980636724d96 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Mar 2015 12:05:11 -0400 Subject: [PATCH 12/91] Added tag build-2.1.0.627 for changeset cd8ddf4cfd51 From 639e6600c0effec5f1fcfde0925b2739df16246c Mon Sep 17 00:00:00 2001 From: me Date: Mon, 30 Mar 2015 20:33:18 +0400 Subject: [PATCH 13/91] wsp-10323 fix job progress --- .../Virtualization/VirtualizationServerController.cs | 7 +++++++ .../WebsitePanel/VPS/UserControls/ServerTabs.ascx.cs | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs index 254ff3e9..4dfe23b5 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs @@ -612,6 +612,7 @@ namespace WebsitePanel.EnterpriseServer #region Setup External network TaskManager.Write("VPS_CREATE_SETUP_EXTERNAL_NETWORK"); + TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress try { @@ -644,6 +645,7 @@ namespace WebsitePanel.EnterpriseServer #region Setup Management network TaskManager.Write("VPS_CREATE_SETUP_MANAGEMENT_NETWORK"); + TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress try { @@ -704,6 +706,7 @@ namespace WebsitePanel.EnterpriseServer #region Setup Private network TaskManager.Write("VPS_CREATE_SETUP_PRIVATE_NETWORK"); + TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress try { @@ -759,6 +762,7 @@ namespace WebsitePanel.EnterpriseServer TaskManager.Write("VPS_CREATE_CONVERT_VHD"); TaskManager.Write("VPS_CREATE_CONVERT_SOURCE_VHD", vm.OperatingSystemTemplatePath); TaskManager.Write("VPS_CREATE_CONVERT_DEST_VHD", vm.VirtualHardDrivePath); + TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress try { // convert VHD @@ -817,6 +821,7 @@ namespace WebsitePanel.EnterpriseServer if (vm.HddSize > hddSizeGB) { TaskManager.Write("VPS_CREATE_EXPAND_VHD"); + TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress // expand VHD try @@ -958,6 +963,7 @@ namespace WebsitePanel.EnterpriseServer TaskManager.Write("VPS_CREATE_CPU_CORES", vm.CpuCores.ToString()); TaskManager.Write("VPS_CREATE_RAM_SIZE", vm.RamSize.ToString()); TaskManager.Write("VPS_CREATE_CREATE_VM"); + TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress // create virtual machine try { @@ -1031,6 +1037,7 @@ namespace WebsitePanel.EnterpriseServer #region Start VPS TaskManager.Write("VPS_CREATE_START_VPS"); + TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress try { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/ServerTabs.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/ServerTabs.ascx.cs index c1c05f80..bbcd3638 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/ServerTabs.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/ServerTabs.ascx.cs @@ -215,9 +215,14 @@ namespace WebsitePanel.Portal.VPS.UserControls gauge.Visible = false; if (e.Item.ItemIndex == task.GetLogs().Count - 1) { - gauge.Visible = true; - gauge.Total = task.IndicatorMaximum; - gauge.Progress = task.IndicatorCurrent; + if (task.IndicatorCurrent == -1) + litRecord.Text += "..."; + else + { + gauge.Visible = true; + gauge.Total = task.IndicatorMaximum; + gauge.Progress = task.IndicatorCurrent; + } } } } From 732adfd8cf1ff07fc1c9c62cb68cd99747101b91 Mon Sep 17 00:00:00 2001 From: Christopher York Date: Mon, 30 Mar 2015 11:42:42 -0600 Subject: [PATCH 14/91] Resolved issues with deleting VM on a remote computer --- .../HyperV2012R2.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index cb14f1d2..7065e666 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -504,7 +504,7 @@ namespace WebsitePanel.Providers.Virtualization if (vm.State != VirtualMachineState.Saved && vm.State != VirtualMachineState.Off) throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Destroy method."); - // Delete network adapters and network switchesw + // Delete network adapters and network switches foreach (var networkAdapter in vm.Adapters) { NetworkAdapterHelper.Delete(PowerShell, vm.Name, networkAdapter); @@ -516,7 +516,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmdSet = new Command("Remove-VM"); cmdSet.Parameters.Add("Name", vm.Name); cmdSet.Parameters.Add("Force"); - PowerShell.Execute(cmdSet, false, true); + PowerShell.Execute(cmdSet, true, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } @@ -782,10 +782,11 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Get-VMSwitch"); - if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName); + // Not needed as the PowerShellManager adds the computer name + //if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName); if (!string.IsNullOrEmpty(type)) cmd.Parameters.Add("SwitchType", type); - Collection result = PowerShell.Execute(cmd, false, true); + Collection result = PowerShell.Execute(cmd, true, true); foreach (PSObject current in result) { From 14b28939bba67cc0027017bbbae07a97d7dd7ede Mon Sep 17 00:00:00 2001 From: Christopher York Date: Mon, 30 Mar 2015 11:54:06 -0600 Subject: [PATCH 15/91] Fixed issue where deleting a virtual machine also deletes the assigned switch This can cause issues if more than 1 VM are assigned to the same virtual switch --- .../HyperV2012R2.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index 7065e666..cbefbb16 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -509,8 +509,10 @@ namespace WebsitePanel.Providers.Virtualization { NetworkAdapterHelper.Delete(PowerShell, vm.Name, networkAdapter); - if (!string.IsNullOrEmpty(networkAdapter.SwitchName)) - DeleteSwitch(networkAdapter.SwitchName); + // If more than 1 VM are assigned to the same switch, deleting the virtual machine also deletes the switch which takes other VM instances off line + // There may be a reason for this that I am not aware of? + //if (!string.IsNullOrEmpty(networkAdapter.SwitchName)) + //DeleteSwitch(networkAdapter.SwitchName); } Command cmdSet = new Command("Remove-VM"); From 11a3187ccdb634d7024069c3eec6e4ab211fe464 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Mar 2015 14:22:21 -0400 Subject: [PATCH 16/91] Added tag build-2.1.0.628 for changeset 4e1ff9709044 From 9a9ee5eccaf8ac0414928bf0fb93f0bf51183d3f Mon Sep 17 00:00:00 2001 From: Christopher York Date: Mon, 30 Mar 2015 14:30:44 -0600 Subject: [PATCH 17/91] Updated the GetVirtualMachineInternal to return the correct HDD and RAM usage using the WSP VMconfig service --- .../Constants.cs | 3 ++ .../HyperV2012R2.cs | 37 ++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Constants.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Constants.cs index b487d4cf..acdcf69c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Constants.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Constants.cs @@ -20,5 +20,8 @@ namespace WebsitePanel.Providers.Virtualization public const Int64 Size1G = 0x40000000; public const Int64 Size1M = 0x100000; + + public const string KVP_RAM_SUMMARY_KEY = "VM-RAM-Summary"; + public const string KVP_HDD_SUMMARY_KEY = "VM-HDD-Summary"; } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index cbefbb16..311d99a5 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -152,7 +152,10 @@ namespace WebsitePanel.Providers.Virtualization vm.Name = result[0].GetProperty("Name").ToString(); vm.State = result[0].GetEnum("State"); vm.CpuUsage = ConvertNullableToInt32(result[0].GetProperty("CpuUsage")); - vm.RamUsage = Convert.ToInt32(ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Constants.Size1M); + // This does not truly give the RAM usage, only the memory assigned to the VPS + // Lets handle detection of total memory and usage else where + //vm.RamUsage = Convert.ToInt32(ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Constants.Size1M); + vm.RamSize = Convert.ToInt32(ConvertNullableToInt64(result[0].GetProperty("MemoryStartup")) / Constants.Size1M); vm.Uptime = Convert.ToInt64(result[0].GetProperty("UpTime").TotalMilliseconds); vm.Status = result[0].GetProperty("Status").ToString(); vm.ReplicationState = result[0].GetProperty("ReplicationState").ToString(); @@ -192,6 +195,38 @@ namespace WebsitePanel.Providers.Virtualization // network adapters vm.Adapters = NetworkAdapterHelper.Get(PowerShell, vm.Name); } + else + { + // Use the WebsitePanel VMConfig Windows service to get the RAM usage as well as the HDD usage / sizes + List vmKvps = GetKVPItems(vmId); + foreach (KvpExchangeDataItem vmKvp in vmKvps) + { + // RAM + if (vmKvp.Name == Constants.KVP_RAM_SUMMARY_KEY) + { + string[] ram = vmKvp.Data.Split(':'); + int freeRam = Int32.Parse(ram[0]); + int availRam = Int32.Parse(ram[1]); + + vm.RamUsage = availRam - freeRam; + } + + // HDD + if (vmKvp.Name == Constants.KVP_HDD_SUMMARY_KEY) + { + string[] disksArray = vmKvp.Data.Split(';'); + vm.HddLogicalDisks = new LogicalDisk[disksArray.Length]; + for (int i = 0; i < disksArray.Length; i++) + { + string[] disk = disksArray[i].Split(':'); + vm.HddLogicalDisks[i] = new LogicalDisk(); + vm.HddLogicalDisks[i].DriveLetter = disk[0]; + vm.HddLogicalDisks[i].FreeSpace = Int32.Parse(disk[1]); + vm.HddLogicalDisks[i].Size = Int32.Parse(disk[2]); + } + } + } + } } } catch (Exception ex) From 679fe04c2c2b0c9bc45f19db9a68f5c81c130701 Mon Sep 17 00:00:00 2001 From: Christopher York Date: Mon, 30 Mar 2015 15:13:41 -0600 Subject: [PATCH 18/91] Processor weights etc. are being calculated / set wrong which results in errors --- .../Helpers/VirtualMachineHelper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs index 30aad925..44cbeafe 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs @@ -77,8 +77,8 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", vm.Name); cmd.Parameters.Add("Count", cpuCores); - cmd.Parameters.Add("Maximum", Convert.ToInt64(cpuLimitSettings * 1000)); - cmd.Parameters.Add("Reserve", Convert.ToInt64(cpuReserveSettings * 1000)); + cmd.Parameters.Add("Maximum", cpuLimitSettings); + cmd.Parameters.Add("Reserve", cpuReserveSettings); cmd.Parameters.Add("RelativeWeight", cpuWeightSettings); powerShell.Execute(cmd, true); From 94e226ccb8e6ea4f847a15c225b7f26691a164de Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Mar 2015 17:27:32 -0400 Subject: [PATCH 19/91] Added tag build-2.1.0.629 for changeset 31eadd63efd5 From 678797ea3a4693b04b4831446f4f75fbd62b787a Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 30 Mar 2015 18:20:35 -0400 Subject: [PATCH 20/91] Added tag build-2.1.0.630 for changeset d6c7e144125d From a105bc90475ea07bfae5afef49cd549b70604ddb Mon Sep 17 00:00:00 2001 From: robvde Date: Tue, 31 Mar 2015 06:48:07 +0800 Subject: [PATCH 21/91] merge commit --- .../WebsitePanel.EnterpriseServer.csproj | 2 ++ .../WebsitePanel.Server.csproj | 16 ++++++++++++++++ .../WebsitePanel.WebPortal.csproj | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj index 0856c2a6..c18d5220 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj @@ -84,6 +84,7 @@ + @@ -117,6 +118,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj index 7cfa6f68..8b9f3b8d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj @@ -124,6 +124,21 @@ + + + + + + + + + + + + + + + @@ -137,6 +152,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj index fb1dac4a..4b3119cd 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj @@ -154,19 +154,36 @@ + + + + + + + + + + + + + + + + + @@ -176,7 +193,9 @@ + + From 7af8432f4bed8fc156aabbfae07e7746c469472b Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 31 Mar 2015 01:26:36 -0700 Subject: [PATCH 22/91] RDS GPO changes --- .../RemoteDesktopServices/RdsServerSettings.cs | 18 +++++++++++++++++- .../SettingsRdsPolicy.ascx.resx | 2 +- .../RDS/RDSEditUserExperience.ascx | 16 +++++++++++++--- .../RDS/RDSEditUserExperience.ascx.cs | 18 ++++++++++++------ .../RDS/RDSEditUserExperience.ascx.designer.cs | 8 ++++---- .../WebsitePanel/SettingsRdsPolicy.ascx | 16 +++++++++++++--- .../WebsitePanel/SettingsRdsPolicy.ascx.cs | 14 ++++++++++---- .../SettingsRdsPolicy.ascx.designer.cs | 8 ++++---- 8 files changed, 74 insertions(+), 26 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs index 1c347305..be32aaa8 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs @@ -38,7 +38,7 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS public const string CHANGE_DESKTOP_DISABLED_USERS = "ChangingDesktopDisabledUsers"; public const string SCREEN_SAVER_DISABLED_ADMINISTRATORS = "ScreenSaverDisabledAdministrators"; public const string SCREEN_SAVER_DISABLED_USERS = "ScreenSaverDisabledUsers"; - public const string DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue"; + public const string DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue"; public string SettingsName { get; set; } public int ServerId { get; set; } @@ -58,5 +58,21 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS settings = value; } } + + public static List> ScreenSaverTimeOuts + { + get + { + return new List> { + new KeyValuePair("", "None"), + new KeyValuePair("10", "10"), + new KeyValuePair("20", "20"), + new KeyValuePair("30", "30"), + new KeyValuePair("40", "40"), + new KeyValuePair("50", "50"), + new KeyValuePair("60", "60") + }; + } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx index 91b50033..6f342a55 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx @@ -145,7 +145,7 @@ Disable Task Manager - Lock Screen Timeout + Lock Screen Timeout (sec.) Changing Desktop Disabled diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx index cb177a39..ff6065a3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx @@ -29,7 +29,7 @@ @@ -145,8 +145,18 @@
- +
-
- + + + + + + + + + + + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs index 4d5ee15a..cfe4ba23 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs @@ -15,6 +15,12 @@ namespace WebsitePanel.Portal.RDS { if (!IsPostBack) { + var timeouts = RdsServerSettings.ScreenSaverTimeOuts; + ddTimeout.DataSource = timeouts; + ddTimeout.DataTextField = "Value"; + ddTimeout.DataValueField = "Key"; + ddTimeout.DataBind(); + var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); litCollectionName.Text = collection.DisplayName; BindSettings(); @@ -39,7 +45,7 @@ namespace WebsitePanel.Portal.RDS private void BindSettings(RdsServerSettings settings) { var setting = GetServerSetting(settings, RdsServerSettings.LOCK_SCREEN_TIMEOUT); - txtTimeout.Text = setting.PropertyValue; + ddTimeout.SelectedValue = setting.PropertyValue; cbTimeoutAdministrators.Checked = setting.ApplyAdministrators; cbTimeoutUsers.Checked = setting.ApplyUsers; @@ -72,7 +78,7 @@ namespace WebsitePanel.Portal.RDS cbScreenSaverUsers.Checked = setting.ApplyUsers; setting = GetServerSetting(settings, RdsServerSettings.DRIVE_SPACE_THRESHOLD); - txtThreshold.Text = setting.PropertyValue; + ddTreshold.SelectedValue = setting.PropertyValue; } private RdsServerSetting GetServerSetting(RdsServerSettings settings, string propertyName) @@ -87,7 +93,7 @@ namespace WebsitePanel.Portal.RDS settings.Settings.Add(new RdsServerSetting { PropertyName = RdsServerSettings.LOCK_SCREEN_TIMEOUT, - PropertyValue = txtTimeout.Text, + PropertyValue = ddTimeout.SelectedValue, ApplyAdministrators = cbTimeoutAdministrators.Checked, ApplyUsers = cbTimeoutUsers.Checked }); @@ -151,7 +157,7 @@ namespace WebsitePanel.Portal.RDS settings.Settings.Add(new RdsServerSetting { PropertyName = RdsServerSettings.DRIVE_SPACE_THRESHOLD, - PropertyValue = txtThreshold.Text, + PropertyValue = ddTreshold.SelectedValue, ApplyAdministrators = true, ApplyUsers = true }); @@ -161,7 +167,7 @@ namespace WebsitePanel.Portal.RDS private void BindDefaultSettings(UserSettings settings) { - txtTimeout.Text = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE]; + ddTimeout.SelectedValue = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE]; cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]); cbTimeoutUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]); @@ -186,7 +192,7 @@ namespace WebsitePanel.Portal.RDS cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]); cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]); - txtThreshold.Text = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; + ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; } private bool SaveServerSettings() diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs index a743b041..ced85d01 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs @@ -85,13 +85,13 @@ namespace WebsitePanel.Portal.RDS { protected global::System.Web.UI.WebControls.Panel timeoutPanel; /// - /// txtTimeout control. + /// ddTimeout control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.TextBox txtTimeout; + protected global::System.Web.UI.WebControls.DropDownList ddTimeout; /// /// cbTimeoutUsers control. @@ -382,13 +382,13 @@ namespace WebsitePanel.Portal.RDS { protected global::System.Web.UI.WebControls.Panel driveSpacePanel; /// - /// txtThreshold control. + /// ddTreshold control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.TextBox txtThreshold; + protected global::System.Web.UI.WebControls.DropDownList ddTreshold; /// /// buttonPanel control. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx index 5b860eef..8e0a1ea6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx @@ -6,7 +6,7 @@ @@ -122,8 +122,18 @@
- +
-
- + + + + + + + + + + + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs index c7cc46ff..cdbd2821 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs @@ -13,7 +13,13 @@ namespace WebsitePanel.Portal { public void BindSettings(UserSettings settings) { - txtTimeout.Text = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE]; + var timeouts = RdsServerSettings.ScreenSaverTimeOuts; + ddTimeout.DataSource = timeouts; + ddTimeout.DataTextField = "Value"; + ddTimeout.DataValueField = "Key"; + ddTimeout.DataBind(); + + ddTimeout.SelectedValue = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE]; cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]); cbTimeoutUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]); @@ -38,12 +44,12 @@ namespace WebsitePanel.Portal cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]); cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]); - txtThreshold.Text = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; + ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; } public void SaveSettings(UserSettings settings) { - settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE] = txtTimeout.Text; + settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE] = ddTimeout.SelectedValue; settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS] = cbTimeoutAdministrators.Checked.ToString(); settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS] = cbTimeoutUsers.Checked.ToString(); settings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS] = cbRunCommandAdministrators.Checked.ToString(); @@ -60,7 +66,7 @@ namespace WebsitePanel.Portal settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS] = cbDesktopUsers.Checked.ToString(); settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS] = cbScreenSaverAdministrators.Checked.ToString(); settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS] = cbScreenSaverUsers.Checked.ToString(); - settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE] = txtThreshold.Text; + settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE] = ddTreshold.SelectedValue; } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs index ab5d3f15..4c962af4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs @@ -31,13 +31,13 @@ namespace WebsitePanel.Portal { protected global::System.Web.UI.WebControls.Panel timeoutPanel; /// - /// txtTimeout control. + /// ddTimeout control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.TextBox txtTimeout; + protected global::System.Web.UI.WebControls.DropDownList ddTimeout; /// /// cbTimeoutUsers control. @@ -328,12 +328,12 @@ namespace WebsitePanel.Portal { protected global::System.Web.UI.WebControls.Panel driveSpacePanel; /// - /// txtThreshold control. + /// ddTreshold control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.TextBox txtThreshold; + protected global::System.Web.UI.WebControls.DropDownList ddTreshold; } } From 0d5ad15f2137d8003bf8c0c366c4061b4985ddb8 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 31 Mar 2015 02:49:47 -0700 Subject: [PATCH 23/91] webdav portal fsrm excluded from root folders --- .../EnterpriseStorageController.cs | 2 +- .../EnterpriseStorage/IEnterpriseStorage.cs | 1 + .../Windows2012.cs | 43 ++++++++++ .../EnterpriseStorageProxy.cs | 82 ++++++++++++++++++- .../EnterpriseStorage.asmx.cs | 17 ++++ 5 files changed, 140 insertions(+), 5 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs index 7398203b..200a52fb 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/EnterpriseStorage/EnterpriseStorageController.cs @@ -586,7 +586,7 @@ namespace WebsitePanel.EnterpriseServer var userGroups = OrganizationController.GetSecurityGroupsByMember(itemId, accountId); - foreach (var folder in es.GetFolders(org.OrganizationId, webDavSettings)) + foreach (var folder in es.GetFoldersWithoutFrsm(org.OrganizationId, webDavSettings)) { var permissions = ConvertToESPermission(itemId,folder.Rules); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/EnterpriseStorage/IEnterpriseStorage.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/EnterpriseStorage/IEnterpriseStorage.cs index 892864a9..ae907208 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/EnterpriseStorage/IEnterpriseStorage.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/EnterpriseStorage/IEnterpriseStorage.cs @@ -39,6 +39,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage public interface IEnterpriseStorage { SystemFile[] GetFolders(string organizationId, WebDavSetting[] settings); + SystemFile[] GetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings); SystemFile GetFolder(string organizationId, string folderName, WebDavSetting setting); void CreateFolder(string organizationId, string folder, WebDavSetting setting); SystemFile RenameFolder(string organizationId, string originalFolder, string newFolder, WebDavSetting setting); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs index f0a8caf3..67b2d1ff 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.EnterpriseStorage.Windows2012/Windows2012.cs @@ -122,6 +122,49 @@ namespace WebsitePanel.Providers.EnterpriseStorage return (SystemFile[]) items.ToArray(typeof (SystemFile)); } + public SystemFile[] GetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings) + { + ArrayList items = new ArrayList(); + + var webDavSettings = GetWebDavSettings(settings); + + foreach (var setting in webDavSettings) + { + string rootPath = string.Format("{0}:\\{1}\\{2}", setting.LocationDrive, setting.HomeFolder, + organizationId); + + if (Directory.Exists(rootPath)) + { + DirectoryInfo root = new DirectoryInfo(rootPath); + IWebDav webdav = new Web.WebDav(setting); + + // get directories + DirectoryInfo[] dirs = root.GetDirectories(); + + foreach (DirectoryInfo dir in dirs) + { + SystemFile folder = new SystemFile(); + + folder.Name = dir.Name; + folder.FullName = dir.FullName; + folder.IsDirectory = true; + + if (folder.Size == -1) + { + folder.Size = FileUtils.BytesToMb(FileUtils.CalculateFolderSize(dir.FullName)); + } + + folder.Url = string.Format("https://{0}/{1}/{2}", setting.Domain, organizationId, dir.Name); + folder.Rules = webdav.GetFolderWebDavRules(organizationId, dir.Name); + + items.Add(folder); + } + } + } + + return (SystemFile[])items.ToArray(typeof(SystemFile)); + } + public SystemFile GetFolder(string organizationId, string folderName, WebDavSetting setting) { var webDavSetting = GetWebDavSetting(setting); diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/EnterpriseStorageProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/EnterpriseStorageProxy.cs index f43357e6..2fd82337 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/EnterpriseStorageProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/EnterpriseStorageProxy.cs @@ -11,10 +11,6 @@ // // This source code was auto-generated by wsdl, Version=2.0.50727.3038. // - -using WebsitePanel.Providers.OS; -using WebsitePanel.Providers.Web; - namespace WebsitePanel.Providers.EnterpriseStorage { using System.Xml.Serialization; using System.Web.Services; @@ -22,6 +18,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage { using System.Web.Services.Protocols; using System; using System.Diagnostics; + using WebsitePanel.Providers.OS; + using WebsitePanel.Providers.Web; /// @@ -36,6 +34,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage { private System.Threading.SendOrPostCallback GetFoldersOperationCompleted; + private System.Threading.SendOrPostCallback GetFoldersWithoutFrsmOperationCompleted; + private System.Threading.SendOrPostCallback GetFolderOperationCompleted; private System.Threading.SendOrPostCallback CreateFolderOperationCompleted; @@ -60,6 +60,9 @@ namespace WebsitePanel.Providers.EnterpriseStorage { /// public event GetFoldersCompletedEventHandler GetFoldersCompleted; + /// + public event GetFoldersWithoutFrsmCompletedEventHandler GetFoldersWithoutFrsmCompleted; + /// public event GetFolderCompletedEventHandler GetFolderCompleted; @@ -129,6 +132,51 @@ namespace WebsitePanel.Providers.EnterpriseStorage { } } + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetFoldersWithoutFrsm", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SystemFile[] GetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings) { + object[] results = this.Invoke("GetFoldersWithoutFrsm", new object[] { + organizationId, + settings}); + return ((SystemFile[])(results[0])); + } + + /// + public System.IAsyncResult BeginGetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetFoldersWithoutFrsm", new object[] { + organizationId, + settings}, callback, asyncState); + } + + /// + public SystemFile[] EndGetFoldersWithoutFrsm(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SystemFile[])(results[0])); + } + + /// + public void GetFoldersWithoutFrsmAsync(string organizationId, WebDavSetting[] settings) { + this.GetFoldersWithoutFrsmAsync(organizationId, settings, null); + } + + /// + public void GetFoldersWithoutFrsmAsync(string organizationId, WebDavSetting[] settings, object userState) { + if ((this.GetFoldersWithoutFrsmOperationCompleted == null)) { + this.GetFoldersWithoutFrsmOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFoldersWithoutFrsmOperationCompleted); + } + this.InvokeAsync("GetFoldersWithoutFrsm", new object[] { + organizationId, + settings}, this.GetFoldersWithoutFrsmOperationCompleted, userState); + } + + private void OnGetFoldersWithoutFrsmOperationCompleted(object arg) { + if ((this.GetFoldersWithoutFrsmCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetFoldersWithoutFrsmCompleted(this, new GetFoldersWithoutFrsmCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetFolder", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -544,6 +592,32 @@ namespace WebsitePanel.Providers.EnterpriseStorage { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetFoldersWithoutFrsmCompletedEventHandler(object sender, GetFoldersWithoutFrsmCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetFoldersWithoutFrsmCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetFoldersWithoutFrsmCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SystemFile[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SystemFile[])(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetFolderCompletedEventHandler(object sender, GetFolderCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.Server/EnterpriseStorage.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/EnterpriseStorage.asmx.cs index ecd4878c..6a27c78a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/EnterpriseStorage.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/EnterpriseStorage.asmx.cs @@ -75,6 +75,23 @@ namespace WebsitePanel.Server } } + [WebMethod, SoapHeader("settings")] + public SystemFile[] GetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings) + { + try + { + Log.WriteStart("'{0}' GetFolders", ProviderSettings.ProviderName); + SystemFile[] result = EnterpriseStorageProvider.GetFoldersWithoutFrsm(organizationId, settings); + Log.WriteEnd("'{0}' GetFolders", ProviderSettings.ProviderName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' GetFolders", ProviderSettings.ProviderName), ex); + throw; + } + } + [WebMethod, SoapHeader("settings")] public SystemFile GetFolder(string organizationId, string folder, WebDavSetting setting) { From 45b9973f78864c84c5185dcd24fc28bdcd974a41 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 31 Mar 2015 06:29:36 -0400 Subject: [PATCH 24/91] Added tag build-2.1.0.631 for changeset 2bb14799a77e From 0081c04ca768320b4917a8f4122b8b9ec00d8a81 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 31 Mar 2015 06:44:03 -0400 Subject: [PATCH 25/91] Added tag build-2.1.0.632 for changeset 83768c5ca3b1 From fa2dca8ea3573f3721be8824c82249e463a6fb1c Mon Sep 17 00:00:00 2001 From: pfregon Date: Wed, 1 Apr 2015 15:41:08 +1100 Subject: [PATCH 26/91] Updated MailEnable version check to work with all versions --- .../WebsitePanel.Providers.Mail.MailEnable/MailEnable.vb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.MailEnable/MailEnable.vb b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.MailEnable/MailEnable.vb index 9439198a..c067d2d8 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.MailEnable/MailEnable.vb +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.MailEnable/MailEnable.vb @@ -2034,8 +2034,9 @@ Public Class MailEnable End If If [String].IsNullOrEmpty(version) = False Then - Dim split As String() = version.Split(New [Char]() {"."c}) - Return split(0).Equals("1") Or split(0).Equals("2") Or split(0).Equals("3") Or split(0).Equals("4") Or split(0).Equals("5") Or split(0).Equals("6") Or split(0).Equals("7") + 'all versions of MailEnable will be compatible with this, so we are just checking to see if there is a version number + 'future versions aim to retain compatibility + Return True Else Return False End If From 8013b74b1652dfb4889ba495d4ad8f13451eba2e Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Wed, 1 Apr 2015 01:13:34 -0700 Subject: [PATCH 27/91] Mapped drive action changed to create --- .../OrganizationProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs index 44ee8db4..a39ff22d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/OrganizationProvider.cs @@ -1792,7 +1792,7 @@ namespace WebsitePanel.Providers.HostedSolution uidAttr.Value = Guid.NewGuid().ToString("B"); bypassErrorsAttr.Value = (1).ToString(); - actionPropAttr.Value = "R"; + actionPropAttr.Value = "C"; thisDrivePropAttr.Value = "NOCHANGE"; allDrivesPropAttr.Value = "NOCHANGE"; userNamePropAttr.Value = string.Empty; From 0949399a1937a2f12c5b83e1f16ceffde56b4672 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 1 Apr 2015 07:18:27 -0400 Subject: [PATCH 28/91] Added tag build-2.1.0.633 for changeset 5607159a5ecc From e3636a1c0296912e5611c6bd58d93c92064817be Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 1 Apr 2015 07:28:10 -0400 Subject: [PATCH 29/91] Added tag build-2.1.0.634 for changeset 4a02f54314dc From 4f5412e80962cad853e93acbf6eed2a848a6174c Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 1 Apr 2015 07:37:43 -0400 Subject: [PATCH 30/91] Added tag build-2.1.0.635 for changeset 24b2c56cfb7e From ab3ff694ac078ccd6ae857cac057f1bf0835079c Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Wed, 1 Apr 2015 05:36:51 -0700 Subject: [PATCH 31/91] RDS GPO changes --- WebsitePanel/Database/update_db.sql | 4 +- .../RemoteDesktopServicesProxy.cs | 80 +++++++++++- .../RemoteDesktopServicesController.cs | 48 ++++++- .../esRemoteDesktopServices.asmx.cs | 6 + .../IRemoteDesktopServices.cs | 3 +- .../RdsServerSettings.cs | 8 +- .../Windows2012.cs | 122 ++++++++++++++++-- .../RemoteDesktopServicesProxy.cs | 65 +++++++++- .../RemoteDesktopServices.asmx.cs | 20 ++- .../WebsitePanel_SharedResources.ascx.resx | 6 + .../SettingsRdsPolicy.ascx.resx | 10 +- .../RDSEditUserExperience.ascx.resx | 10 +- .../RDSUserSessions.ascx.resx | 12 ++ .../RDS/RDSEditUserExperience.ascx | 28 ++++ .../RDS/RDSEditUserExperience.ascx.cs | 111 +++++++++++++--- .../RDSEditUserExperience.ascx.designer.cs | 72 +++++++++++ .../WebsitePanel/RDS/RDSUserSessions.ascx | 18 ++- .../WebsitePanel/RDS/RDSUserSessions.ascx.cs | 22 ++++ .../WebsitePanel/SettingsRdsPolicy.ascx | 28 ++++ .../WebsitePanel/SettingsRdsPolicy.ascx.cs | 5 + .../SettingsRdsPolicy.ascx.designer.cs | 72 +++++++++++ 21 files changed, 697 insertions(+), 53 deletions(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 8829cb8d..228701b7 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9459,4 +9459,6 @@ BEGIN (SELECT TOP 1 @item_type_id, @group_id, 'SharePointSiteCollection', TypeName, 100, CalculateDiskSpace, CalculateBandwidth, Suspendable, Disposable, Searchable, Importable, Backupable FROM [dbo].[ServiceItemTypes] WHERE DisplayName = 'SharePointFoundationSiteCollection') END -GO \ No newline at end of file +GO + +UPDATE [dbo].[Quotas] SET GroupID = 45 WHERE QuotaName = 'EnterpriseStorage.DriveMaps' \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs index d5b90304..f15a1b1c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs @@ -20,8 +20,8 @@ namespace WebsitePanel.EnterpriseServer { using System.Diagnostics; using WebsitePanel.Providers.RemoteDesktopServices; using WebsitePanel.Providers.Common; - using WebsitePanel.Providers.HostedSolution; using WebsitePanel.EnterpriseServer.Base.RDS; + using WebsitePanel.Providers.HostedSolution; /// @@ -137,6 +137,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback UpdateRdsServerSettingsOperationCompleted; + private System.Threading.SendOrPostCallback ShadowSessionOperationCompleted; + /// public esRemoteDesktopServices() { this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx"; @@ -301,6 +303,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event UpdateRdsServerSettingsCompletedEventHandler UpdateRdsServerSettingsCompleted; + /// + public event ShadowSessionCompletedEventHandler ShadowSessionCompleted; + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public RdsCollection GetRdsCollection(int collectionId) { @@ -2671,6 +2676,53 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/ShadowSession", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject ShadowSession(int itemId, string sessionId, bool control) { + object[] results = this.Invoke("ShadowSession", new object[] { + itemId, + sessionId, + control}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginShadowSession(int itemId, string sessionId, bool control, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("ShadowSession", new object[] { + itemId, + sessionId, + control}, callback, asyncState); + } + + /// + public ResultObject EndShadowSession(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void ShadowSessionAsync(int itemId, string sessionId, bool control) { + this.ShadowSessionAsync(itemId, sessionId, control, null); + } + + /// + public void ShadowSessionAsync(int itemId, string sessionId, bool control, object userState) { + if ((this.ShadowSessionOperationCompleted == null)) { + this.ShadowSessionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnShadowSessionOperationCompleted); + } + this.InvokeAsync("ShadowSession", new object[] { + itemId, + sessionId, + control}, this.ShadowSessionOperationCompleted, userState); + } + + private void OnShadowSessionOperationCompleted(object arg) { + if ((this.ShadowSessionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ShadowSessionCompleted(this, new ShadowSessionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { base.CancelAsync(userState); @@ -4054,4 +4106,30 @@ namespace WebsitePanel.EnterpriseServer { } } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void ShadowSessionCompletedEventHandler(object sender, ShadowSessionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ShadowSessionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ShadowSessionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index 7d585e28..9595fbab 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -331,6 +331,49 @@ namespace WebsitePanel.EnterpriseServer return UpdateRdsServerSettingsInternal(serverId, settingsName, settings); } + public static ResultObject ShadowSession(int itemId, string sessionId, bool control) + { + return ShadowSessionInternal(itemId, sessionId, control); + } + + private static ResultObject ShadowSessionInternal(int itemId, string sessionId, bool control) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "SHADOW_RDS_SESSION"); + + try + { + Organization org = OrganizationController.GetOrganization(itemId); + + if (org == null) + { + result.IsSuccess = false; + result.AddError("SHADOW_RDS_SESSION", new NullReferenceException("Organization not found")); + + return result; + } + + var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + rds.ShadowSession(sessionId, control); + } + catch (Exception ex) + { + result.AddError("REMOTE_DESKTOP_SERVICES_SHADOW_RDS_SESSION", ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + private static RdsServerSettings GetRdsServerSettingsInternal(int serverId, string settingsName) { IDataReader reader = DataProvider.GetRdsServerSettings(serverId, settingsName); @@ -363,7 +406,8 @@ namespace WebsitePanel.EnterpriseServer { var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(serverId)); var rds = GetRemoteDesktopServices(GetRdsServiceId(collection.ItemId)); - rds.ApplyGPO(collection.Name, settings); + Organization org = OrganizationController.GetOrganization(collection.ItemId); + rds.ApplyGPO(org.OrganizationId, collection.Name, settings); XmlDocument doc = new XmlDocument(); XmlElement nodeProps = doc.CreateElement("properties"); @@ -748,7 +792,7 @@ namespace WebsitePanel.EnterpriseServer }; rds.CreateCollection(org.OrganizationId, collection); - rds.ApplyGPO(collection.Name, GetDefaultGpoSettings()); + rds.ApplyGPO(org.OrganizationId, collection.Name, GetDefaultGpoSettings()); collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description, collection.DisplayName); collection.Settings.RdsCollectionId = collection.Id; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs index 7b977052..b99ea321 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs @@ -380,5 +380,11 @@ namespace WebsitePanel.EnterpriseServer { return RemoteDesktopServicesController.UpdateRdsServerSettings(serverId, settingsName, settings); } + + [WebMethod] + public ResultObject ShadowSession(int itemId, string sessionId, bool control) + { + return RemoteDesktopServicesController.ShadowSession(itemId, sessionId, control); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs index 1d5b04b4..a2113c2e 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs @@ -81,6 +81,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices void RemoveRdsServerFromTenantOU(string hostName, string organizationId); void InstallCertificate(byte[] certificate, string password, List hostNames); void MoveSessionHostToRdsOU(string hostName); - void ApplyGPO(string collectionName, RdsServerSettings serverSettings); + void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings); + void ShadowSession(string sessionId, bool control); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs index be32aaa8..beddb245 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs @@ -38,7 +38,13 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS public const string CHANGE_DESKTOP_DISABLED_USERS = "ChangingDesktopDisabledUsers"; public const string SCREEN_SAVER_DISABLED_ADMINISTRATORS = "ScreenSaverDisabledAdministrators"; public const string SCREEN_SAVER_DISABLED_USERS = "ScreenSaverDisabledUsers"; - public const string DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue"; + public const string DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue"; + public const string RDS_VIEW_WITHOUT_PERMISSION = "RDSViewWithoutPermission"; + public const string RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS = "RDSViewWithoutPermissionAdministrators"; + public const string RDS_VIEW_WITHOUT_PERMISSION_Users = "RDSViewWithoutPermissionUsers"; + public const string RDS_CONTROL_WITHOUT_PERMISSION = "RDSControlWithoutPermission"; + public const string RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS = "RDSControlWithoutPermissionAdministrators"; + public const string RDS_CONTROL_WITHOUT_PERMISSION_Users = "RDSControlWithoutPermissionUsers"; public string SettingsName { get; set; } public int ServerId { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 58bc5ab0..1f3b46ce 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -93,6 +93,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices private const string DisableTaskManagerGpoValueName = "DisableTaskMgr"; private const string HideCDriveGpoKey = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"; private const string HideCDriveGpoValueName = "NoDrives"; + private const string RDSSessionGpoKey = @"HKCU\Software\Policies\Microsoft\Windows NT\Terminal Services"; + private const string RDSSessionGpoValueName = "Shadow"; #endregion @@ -371,6 +373,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices CreatePolicy(runSpace, organizationId, string.Format("{0}-administrators", collection.Name), new DirectoryEntry(GetGroupPath(organizationId, collection.Name, GetLocalAdminsGroupName(collection.Name))), collection.Name); CreatePolicy(runSpace, organizationId, string.Format("{0}-users", collection.Name), new DirectoryEntry(GetUsersGroupPath(organizationId, collection.Name)), collection.Name); + CreateHelpDeskPolicy(runSpace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collection.Name); } finally { @@ -516,6 +519,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices DeleteGpo(runSpace, string.Format("{0}-administrators", collectionName)); DeleteGpo(runSpace, string.Format("{0}-users", collectionName)); + DeleteHelpDeskPolicy(runSpace, collectionName); var capPolicyName = GetPolicyName(organizationId, collectionName, RdsPolicyTypes.RdCap); var rapPolicyName = GetPolicyName(organizationId, collectionName, RdsPolicyTypes.RdRap); @@ -1116,7 +1120,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices #region GPO - public void ApplyGPO(string collectionName, RdsServerSettings serverSettings) + public void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings) { string administratorsGpo = string.Format("{0}-administrators", collectionName); string usersGpo = string.Format("{0}-users", collectionName); @@ -1126,6 +1130,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { runspace = OpenRunspace(); + CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collectionName); RemoveRegistryValue(runspace, ScreenSaverGpoKey, administratorsGpo); RemoveRegistryValue(runspace, ScreenSaverGpoKey, usersGpo); RemoveRegistryValue(runspace, RemoveRestartGpoKey, administratorsGpo); @@ -1133,34 +1138,73 @@ namespace WebsitePanel.Providers.RemoteDesktopServices RemoveRegistryValue(runspace, DisableTaskManagerGpoKey, administratorsGpo); RemoveRegistryValue(runspace, DisableTaskManagerGpoKey, usersGpo); - var setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.SCREEN_SAVER_DISABLED)); - SetRegistryValue(setting, runspace, ScreenSaverGpoKey, administratorsGpo, usersGpo, ScreenSaverValueName, "0", "string"); + var setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.SCREEN_SAVER_DISABLED)); + SetRegistryValue(setting, runspace, ScreenSaverGpoKey, administratorsGpo, usersGpo, ScreenSaverValueName, "0", "string"); - setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_SHUTDOWN_RESTART)); - SetRegistryValue(setting, runspace, RemoveRestartGpoKey, administratorsGpo, usersGpo, RemoveRestartGpoValueName, "1", "DWord"); + setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_SHUTDOWN_RESTART)); + SetRegistryValue(setting, runspace, RemoveRestartGpoKey, administratorsGpo, usersGpo, RemoveRestartGpoValueName, "1", "DWord"); - setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_RUN_COMMAND)); + setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_RUN_COMMAND)); SetRegistryValue(setting, runspace, RemoveRunGpoKey, administratorsGpo, usersGpo, RemoveRunGpoValueName, "1", "DWord"); - setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.DISABLE_TASK_MANAGER)); + setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.DISABLE_TASK_MANAGER)); SetRegistryValue(setting, runspace, DisableTaskManagerGpoKey, administratorsGpo, usersGpo, DisableTaskManagerGpoValueName, "1", "DWord"); - setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.HIDE_C_DRIVE)); - SetRegistryValue(setting, runspace, HideCDriveGpoKey, administratorsGpo, usersGpo, HideCDriveGpoValueName, "4", "DWord"); - - setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.LOCK_SCREEN_TIMEOUT)); + setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.HIDE_C_DRIVE)); + SetRegistryValue(setting, runspace, HideCDriveGpoKey, administratorsGpo, usersGpo, HideCDriveGpoValueName, "4", "DWord"); + + setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.LOCK_SCREEN_TIMEOUT)); double result; - if (!string.IsNullOrEmpty(setting.PropertyValue) && double.TryParse(setting.PropertyValue, out result)) + if (setting != null && !string.IsNullOrEmpty(setting.PropertyValue) && double.TryParse(setting.PropertyValue, out result)) { SetRegistryValue(setting, runspace, ScreenSaverTimeoutGpoKey, administratorsGpo, usersGpo, ScreenSaverTimeoutValueName, setting.PropertyValue, "string"); } + + SetRdsSessionHostPermissions(runspace, serverSettings, usersGpo, administratorsGpo); } finally { CloseRunspace(runspace); } - } + } + + private void SetRdsSessionHostPermissions(Runspace runspace, RdsServerSettings settings, string usersGpo, string administratorsGpo) + { + var viewSetting = settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION)); + var controlSetting = settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION)); + + if (viewSetting == null || controlSetting == null) + { + return; + } + + if (controlSetting.ApplyUsers) + { + SetRegistryValue(runspace, RDSSessionGpoKey, usersGpo, "2", RDSSessionGpoValueName, "DWord"); + } + else if (viewSetting.ApplyUsers) + { + SetRegistryValue(runspace, RDSSessionGpoKey, usersGpo, "4", RDSSessionGpoValueName, "DWord"); + } + else + { + SetRegistryValue(runspace, RDSSessionGpoKey, usersGpo, "3", RDSSessionGpoValueName, "DWord"); + } + + if (controlSetting.ApplyAdministrators) + { + SetRegistryValue(runspace, RDSSessionGpoKey, administratorsGpo, "2", RDSSessionGpoValueName, "DWord"); + } + else if (viewSetting.ApplyAdministrators) + { + SetRegistryValue(runspace, RDSSessionGpoKey, administratorsGpo, "4", RDSSessionGpoValueName, "DWord"); + } + else + { + SetRegistryValue(runspace, RDSSessionGpoKey, administratorsGpo, "3", RDSSessionGpoValueName, "DWord"); + } + } private void RemoveRegistryValue(Runspace runspace, string key, string gpoName) { @@ -1173,6 +1217,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices private void SetRegistryValue(RdsServerSetting setting, Runspace runspace, string key, string administratorsGpo, string usersGpo, string valueName, string value, string type) { + if (setting == null) + { + return; + } + if (setting.ApplyAdministrators) { SetRegistryValue(runspace, key, administratorsGpo, value, valueName, type); @@ -1196,6 +1245,19 @@ namespace WebsitePanel.Providers.RemoteDesktopServices Collection result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd); } + private void CreateHelpDeskPolicy(Runspace runspace, DirectoryEntry entry, string organizationId, string collectionName) + { + string gpoName = string.Format("{0}-HelpDesk", collectionName); + string gpoId = GetPolicyId(runspace, gpoName); + + if (string.IsNullOrEmpty(gpoId)) + { + gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName); + SetPolicyPermissions(runspace, gpoName, entry); + SetRegistryValue(runspace, RDSSessionGpoKey, gpoName, "2", RDSSessionGpoValueName, "DWord"); + } + } + private string CreatePolicy(Runspace runspace, string organizationId, string gpoName, DirectoryEntry entry, string collectionName) { string gpoId = GetPolicyId(runspace, gpoName); @@ -1209,6 +1271,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices return gpoId; } + private void DeleteHelpDeskPolicy(Runspace runspace, string collectionName) + { + string gpoName = string.Format("{0}-HelpDesk", collectionName); + DeleteGpo(runspace, gpoName); + } + private void DeleteGpo(Runspace runspace, string gpoName) { Command cmd = new Command("Remove-GPO"); @@ -1235,7 +1303,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices try { - var entry = new DirectoryEntry(GetCollectionOUPath(organizationId, string.Format("{0}-OU", collectionName))); + var entry = new DirectoryEntry(GetOrganizationPath(organizationId)); var distinguishedName = string.Format("\"{0}\"", ActiveDirectoryUtils.GetADObjectProperty(entry, "DistinguishedName")); Command cmd = new Command("New-GPO"); @@ -1294,6 +1362,32 @@ namespace WebsitePanel.Providers.RemoteDesktopServices #endregion + #region Shadow Session + + public void ShadowSession(string sessionId, bool control) + { + Runspace runspace = null; + + try + { + runspace = OpenRunspace(); + + var scripts = new List + { + string.Format("mstsc /Shadow:{0}{1}", sessionId, control ? " /Control" : "") + }; + + object[] errors = null; + ExecuteShellCommand(runspace, scripts, out errors); + } + finally + { + CloseRunspace(runspace); + } + } + + #endregion + #region RDS Help Desk private string GetHelpDeskGroupPath(string groupName) diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs index fbb586a2..924cfa7d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs @@ -104,6 +104,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { private System.Threading.SendOrPostCallback ApplyGPOOperationCompleted; + private System.Threading.SendOrPostCallback ShadowSessionOperationCompleted; + /// public RemoteDesktopServices() { this.Url = "http://localhost:9003/RemoteDesktopServices.asmx"; @@ -220,6 +222,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// public event ApplyGPOCompletedEventHandler ApplyGPOCompleted; + /// + public event ShadowSessionCompletedEventHandler ShadowSessionCompleted; + /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -1791,15 +1796,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ApplyGPO", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public void ApplyGPO(string collectionName, RdsServerSettings serverSettings) { + public void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings) { this.Invoke("ApplyGPO", new object[] { + organizationId, collectionName, serverSettings}); } /// - public System.IAsyncResult BeginApplyGPO(string collectionName, RdsServerSettings serverSettings, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("ApplyGPO", new object[] { + organizationId, collectionName, serverSettings}, callback, asyncState); } @@ -1810,16 +1817,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } /// - public void ApplyGPOAsync(string collectionName, RdsServerSettings serverSettings) { - this.ApplyGPOAsync(collectionName, serverSettings, null); + public void ApplyGPOAsync(string organizationId, string collectionName, RdsServerSettings serverSettings) { + this.ApplyGPOAsync(organizationId, collectionName, serverSettings, null); } /// - public void ApplyGPOAsync(string collectionName, RdsServerSettings serverSettings, object userState) { + public void ApplyGPOAsync(string organizationId, string collectionName, RdsServerSettings serverSettings, object userState) { if ((this.ApplyGPOOperationCompleted == null)) { this.ApplyGPOOperationCompleted = new System.Threading.SendOrPostCallback(this.OnApplyGPOOperationCompleted); } this.InvokeAsync("ApplyGPO", new object[] { + organizationId, collectionName, serverSettings}, this.ApplyGPOOperationCompleted, userState); } @@ -1831,6 +1839,49 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } } + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ShadowSession", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void ShadowSession(string sessionId, bool control) { + this.Invoke("ShadowSession", new object[] { + sessionId, + control}); + } + + /// + public System.IAsyncResult BeginShadowSession(string sessionId, bool control, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("ShadowSession", new object[] { + sessionId, + control}, callback, asyncState); + } + + /// + public void EndShadowSession(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void ShadowSessionAsync(string sessionId, bool control) { + this.ShadowSessionAsync(sessionId, control, null); + } + + /// + public void ShadowSessionAsync(string sessionId, bool control, object userState) { + if ((this.ShadowSessionOperationCompleted == null)) { + this.ShadowSessionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnShadowSessionOperationCompleted); + } + this.InvokeAsync("ShadowSession", new object[] { + sessionId, + control}, this.ShadowSessionOperationCompleted, userState); + } + + private void OnShadowSessionOperationCompleted(object arg) { + if ((this.ShadowSessionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ShadowSessionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { base.CancelAsync(userState); @@ -2468,4 +2519,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void ApplyGPOCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void ShadowSessionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); } diff --git a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs index ff949699..c246e544 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs @@ -665,12 +665,12 @@ namespace WebsitePanel.Server } [WebMethod, SoapHeader("settings")] - public void ApplyGPO(string collectionName, RdsServerSettings serverSettings) + public void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings) { try { Log.WriteStart("'{0}' ApplyGPO", ProviderSettings.ProviderName); - RDSProvider.ApplyGPO(collectionName, serverSettings); + RDSProvider.ApplyGPO(organizationId, collectionName, serverSettings); Log.WriteEnd("'{0}' ApplyGPO", ProviderSettings.ProviderName); } catch (Exception ex) @@ -679,5 +679,21 @@ namespace WebsitePanel.Server throw; } } + + [WebMethod, SoapHeader("settings")] + public void ShadowSession(string sessionId, bool control) + { + try + { + Log.WriteStart("'{0}' ShadowSession", ProviderSettings.ProviderName); + RDSProvider.ShadowSession(sessionId, control); + Log.WriteEnd("'{0}' ShadowSession", ProviderSettings.ProviderName); + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' ShadowSession", ProviderSettings.ProviderName), ex); + throw; + } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index cbff0b24..937e6e43 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5702,6 +5702,12 @@ RDS User logging off error + + View session error + + + Control session error + Getting RDS User sessions error diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx index 6f342a55..837eae3e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx @@ -123,6 +123,12 @@ Users + + Changing Desktop Disabled + + + Control RDS Session without Users's Permission + Drive Space Threshold @@ -147,7 +153,7 @@ Lock Screen Timeout (sec.) - - Changing Desktop Disabled + + View RDS Session without Users's Permission \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx index 91b50033..a6355f92 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx @@ -123,6 +123,12 @@ Users + + Changing Desktop Disabled + + + Control RDS Session without Users's Permission + Drive Space Threshold @@ -147,7 +153,7 @@ Lock Screen Timeout - - Changing Desktop Disabled + + View RDS Session without Users's Permission \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx index e8f7f85d..54e311d7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx @@ -150,4 +150,16 @@ Refresh + + Control + + + Control Session + + + View + + + View Session + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx index ff6065a3..44b5384b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx @@ -162,6 +162,34 @@
+ + + + + + + +
+ + + +
+
+
+ + + + + + + +
+ + + +
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs index cfe4ba23..6fc1f396 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs @@ -45,45 +45,97 @@ namespace WebsitePanel.Portal.RDS private void BindSettings(RdsServerSettings settings) { var setting = GetServerSetting(settings, RdsServerSettings.LOCK_SCREEN_TIMEOUT); - ddTimeout.SelectedValue = setting.PropertyValue; - cbTimeoutAdministrators.Checked = setting.ApplyAdministrators; - cbTimeoutUsers.Checked = setting.ApplyUsers; + + if (setting != null) + { + ddTimeout.SelectedValue = setting.PropertyValue; + cbTimeoutAdministrators.Checked = setting.ApplyAdministrators; + cbTimeoutUsers.Checked = setting.ApplyUsers; + } setting = GetServerSetting(settings, RdsServerSettings.REMOVE_RUN_COMMAND); - cbRunCommandAdministrators.Checked = setting.ApplyAdministrators; - cbRunCommandUsers.Checked = setting.ApplyUsers; + + if (setting != null) + { + cbRunCommandAdministrators.Checked = setting.ApplyAdministrators; + cbRunCommandUsers.Checked = setting.ApplyUsers; + } setting = GetServerSetting(settings, RdsServerSettings.REMOVE_POWERSHELL_COMMAND); - cbPowershellAdministrators.Checked = setting.ApplyAdministrators; - cbPowershellUsers.Checked = setting.ApplyUsers; + + if (setting != null) + { + cbPowershellAdministrators.Checked = setting.ApplyAdministrators; + cbPowershellUsers.Checked = setting.ApplyUsers; + } setting = GetServerSetting(settings, RdsServerSettings.HIDE_C_DRIVE); - cbHideCDriveAdministrators.Checked = setting.ApplyAdministrators; - cbHideCDriveUsers.Checked = setting.ApplyUsers; + if (setting != null) + { + cbHideCDriveAdministrators.Checked = setting.ApplyAdministrators; + cbHideCDriveUsers.Checked = setting.ApplyUsers; + } + setting = GetServerSetting(settings, RdsServerSettings.REMOVE_SHUTDOWN_RESTART); - cbShutdownAdministrators.Checked = setting.ApplyAdministrators; - cbShutdownUsers.Checked = setting.ApplyUsers; + + if (setting != null) + { + cbShutdownAdministrators.Checked = setting.ApplyAdministrators; + cbShutdownUsers.Checked = setting.ApplyUsers; + } setting = GetServerSetting(settings, RdsServerSettings.DISABLE_TASK_MANAGER); - cbTaskManagerAdministrators.Checked = setting.ApplyAdministrators; - cbTaskManagerUsers.Checked = setting.ApplyUsers; + + if (setting != null) + { + cbTaskManagerAdministrators.Checked = setting.ApplyAdministrators; + cbTaskManagerUsers.Checked = setting.ApplyUsers; + } setting = GetServerSetting(settings, RdsServerSettings.CHANGE_DESKTOP_DISABLED); - cbDesktopAdministrators.Checked = setting.ApplyAdministrators; - cbDesktopUsers.Checked = setting.ApplyUsers; + + if (setting != null) + { + cbDesktopAdministrators.Checked = setting.ApplyAdministrators; + cbDesktopUsers.Checked = setting.ApplyUsers; + } setting = GetServerSetting(settings, RdsServerSettings.SCREEN_SAVER_DISABLED); - cbScreenSaverAdministrators.Checked = setting.ApplyAdministrators; - cbScreenSaverUsers.Checked = setting.ApplyUsers; + + if (setting != null) + { + cbScreenSaverAdministrators.Checked = setting.ApplyAdministrators; + cbViewSessionUsers.Checked = setting.ApplyUsers; + } + + setting = GetServerSetting(settings, RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION); + + if (setting != null) + { + cbViewSessionAdministrators.Checked = setting.ApplyAdministrators; + cbScreenSaverUsers.Checked = setting.ApplyUsers; + } + + setting = GetServerSetting(settings, RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION); + + if (setting != null) + { + cbControlSessionAdministrators.Checked = setting.ApplyAdministrators; + cbControlSessionUsers.Checked = setting.ApplyUsers; + } setting = GetServerSetting(settings, RdsServerSettings.DRIVE_SPACE_THRESHOLD); - ddTreshold.SelectedValue = setting.PropertyValue; + + if (setting != null) + { + ddTreshold.SelectedValue = setting.PropertyValue; + } } private RdsServerSetting GetServerSetting(RdsServerSettings settings, string propertyName) { - return settings.Settings.First(s => s.PropertyName.Equals(propertyName)); + return settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(propertyName)); } private RdsServerSettings GetSettings() @@ -162,6 +214,22 @@ namespace WebsitePanel.Portal.RDS ApplyUsers = true }); + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION, + PropertyValue = "", + ApplyAdministrators = cbViewSessionAdministrators.Checked, + ApplyUsers = cbViewSessionUsers.Checked + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION, + PropertyValue = "", + ApplyAdministrators = cbControlSessionAdministrators.Checked, + ApplyUsers = cbControlSessionUsers.Checked + }); + return settings; } @@ -192,6 +260,11 @@ namespace WebsitePanel.Portal.RDS cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]); cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]); + cbViewSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS]); + cbViewSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users]); + cbControlSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]); + cbControlSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]); + ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs index ced85d01..953e340e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs @@ -390,6 +390,78 @@ namespace WebsitePanel.Portal.RDS { /// protected global::System.Web.UI.WebControls.DropDownList ddTreshold; + /// + /// secViewSession control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secViewSession; + + /// + /// viewSessionPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel viewSessionPanel; + + /// + /// cbViewSessionUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbViewSessionUsers; + + /// + /// cbViewSessionAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbViewSessionAdministrators; + + /// + /// secControlSession control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secControlSession; + + /// + /// controlSessionPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel controlSessionPanel; + + /// + /// cbControlSessionUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbControlSessionUsers; + + /// + /// cbControlSessionAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbControlSessionAdministrators; + /// /// buttonPanel control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx index 9afc8a5b..15d0ef9e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx @@ -40,7 +40,7 @@ OnRowCommand="gvRDSCollections_RowCommand" AllowPaging="True" AllowSorting="True"> - + @@ -48,17 +48,29 @@ - + - + + + + + + + + + + +
+ + + + + + + + +
+ + + +
+
+
+ + + + + + + +
+ + + +
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs index cdbd2821..ed9bab8c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs @@ -44,6 +44,11 @@ namespace WebsitePanel.Portal cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]); cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]); + cbViewSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS]); + cbViewSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users]); + cbControlSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]); + cbControlSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]); + ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs index 4c962af4..2b120670 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs @@ -335,5 +335,77 @@ namespace WebsitePanel.Portal { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddTreshold; + + /// + /// secViewSession control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secViewSession; + + /// + /// viewSessionPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel viewSessionPanel; + + /// + /// cbViewSessionUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbViewSessionUsers; + + /// + /// cbViewSessionAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbViewSessionAdministrators; + + /// + /// secControlSession control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secControlSession; + + /// + /// controlSessionPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel controlSessionPanel; + + /// + /// cbControlSessionUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbControlSessionUsers; + + /// + /// cbControlSessionAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbControlSessionAdministrators; } } From a4d487f47abdd4a98bddabf420280269b95e30c1 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 1 Apr 2015 17:34:53 -0400 Subject: [PATCH 32/91] Added tag build-2.1.0.636 for changeset 4cef02af28cd From 84e88288828578350e9e131a54b20aabd37a277a Mon Sep 17 00:00:00 2001 From: me Date: Thu, 2 Apr 2015 16:56:16 +0400 Subject: [PATCH 33/91] Fix Bug in Multi-Select Users in Orgs --- .../DesktopModules/WebsitePanel/Code/Framework/Utils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/Utils.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/Utils.cs index fccbcbb2..8e745c8f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/Utils.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Framework/Utils.cs @@ -337,7 +337,7 @@ namespace WebsitePanel.Portal { if (((CheckBox)gvr.FindControl(checkboxName)).Checked) { - string userId = gridView.DataKeys[gvr.DataItemIndex].Value.ToString(); + string userId = gridView.DataKeys[gvr.DataItemIndex % gridView.PageSize].Value.ToString(); userIds.Add((T)Convert.ChangeType(userId, typeof(T))); } } From 07b40438f0c99e654065a7111d3d63fc9b7ec289 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Thu, 2 Apr 2015 09:19:56 -0400 Subject: [PATCH 34/91] Added tag build-2.1.0.637 for changeset 06c6bb3a7713 From 5fe1fb392788aa500076f4636bd98cd8e7a7d70e Mon Sep 17 00:00:00 2001 From: robvde Date: Thu, 2 Apr 2015 21:28:07 +0800 Subject: [PATCH 35/91] Quick fix on sharepoint provider for shared ssl root --- .../HostedSharePointEditSiteCollection.ascx.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs index 0a35bcfc..89ce616c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs @@ -420,6 +420,13 @@ namespace WebsitePanel.Portal return true; } + break; + case 552: + if (Convert.ToBoolean(quota.QuotaAllocatedValue)) + { + return true; + } + break; } } From 1c48c3d2307fb93ae2a3f6ff6a2de2b141ce6204 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Thu, 2 Apr 2015 10:20:06 -0400 Subject: [PATCH 36/91] Added tag build-2.1.0.638 for changeset 6792494f5f98 From 6489ebb2a455c0a44688427085a826f4cbd7a51b Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Thu, 2 Apr 2015 18:51:05 -0400 Subject: [PATCH 37/91] Added tag build-2.1.0.639 for changeset 673ab8323371 From fce7f6792af5eef609d5d27c46b2c00a85a225bd Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Fri, 3 Apr 2015 03:44:00 -0700 Subject: [PATCH 38/91] RDS Powershell disabled by GPO --- .../RdsServerSettings.cs | 3 + .../Windows2012.cs | 46 +++++++- .../SettingsRdsPolicy.ascx.resx | 3 + .../RDSEditUserExperience.ascx.resx | 3 + .../RDS/RDSEditUserExperience.ascx | 14 +++ .../RDS/RDSEditUserExperience.ascx.cs | 103 ++++++------------ .../RDSEditUserExperience.ascx.designer.cs | 36 ++++++ .../WebsitePanel/SettingsRdsPolicy.ascx | 14 +++ .../WebsitePanel/SettingsRdsPolicy.ascx.cs | 9 ++ .../SettingsRdsPolicy.ascx.designer.cs | 36 ++++++ 10 files changed, 195 insertions(+), 72 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs index beddb245..ad175a46 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs @@ -45,6 +45,9 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS public const string RDS_CONTROL_WITHOUT_PERMISSION = "RDSControlWithoutPermission"; public const string RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS = "RDSControlWithoutPermissionAdministrators"; public const string RDS_CONTROL_WITHOUT_PERMISSION_Users = "RDSControlWithoutPermissionUsers"; + public const string DISABLE_CMD = "DisableCMD"; + public const string DISABLE_CMD_ADMINISTRATORS = "DisableCMDAdministrators"; + public const string DISABLE_CMD_USERS = "DisableCMDUsers"; public string SettingsName { get; set; } public int ServerId { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 1f3b46ce..3fc744bf 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -95,6 +95,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices private const string HideCDriveGpoValueName = "NoDrives"; private const string RDSSessionGpoKey = @"HKCU\Software\Policies\Microsoft\Windows NT\Terminal Services"; private const string RDSSessionGpoValueName = "Shadow"; + private const string DisableCmdGpoKey = @"HKCU\Software\Policies\Microsoft\Windows\System"; + private const string DisableCmdGpoValueName = "DisableCMD"; + private const string DisallowRunParentKey = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"; + private const string DisallowRunKey = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun"; + private const string DisallowRunValueName = "DisallowRun"; #endregion @@ -1136,7 +1141,13 @@ namespace WebsitePanel.Providers.RemoteDesktopServices RemoveRegistryValue(runspace, RemoveRestartGpoKey, administratorsGpo); RemoveRegistryValue(runspace, RemoveRestartGpoKey, usersGpo); RemoveRegistryValue(runspace, DisableTaskManagerGpoKey, administratorsGpo); - RemoveRegistryValue(runspace, DisableTaskManagerGpoKey, usersGpo); + RemoveRegistryValue(runspace, DisableTaskManagerGpoKey, usersGpo); + RemoveRegistryValue(runspace, DisableCmdGpoKey, usersGpo); + RemoveRegistryValue(runspace, DisableCmdGpoKey, administratorsGpo); + RemoveRegistryValue(runspace, DisallowRunKey, usersGpo); + RemoveRegistryValue(runspace, DisallowRunParentKey, usersGpo); + RemoveRegistryValue(runspace, DisallowRunKey, administratorsGpo); + RemoveRegistryValue(runspace, DisallowRunParentKey, administratorsGpo); var setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.SCREEN_SAVER_DISABLED)); SetRegistryValue(setting, runspace, ScreenSaverGpoKey, administratorsGpo, usersGpo, ScreenSaverValueName, "0", "string"); @@ -1153,6 +1164,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.HIDE_C_DRIVE)); SetRegistryValue(setting, runspace, HideCDriveGpoKey, administratorsGpo, usersGpo, HideCDriveGpoValueName, "4", "DWord"); + setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.DISABLE_CMD)); + SetRegistryValue(setting, runspace, DisableCmdGpoKey, administratorsGpo, usersGpo, DisableCmdGpoValueName, "1", "DWord"); + setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.LOCK_SCREEN_TIMEOUT)); double result; @@ -1162,6 +1176,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } SetRdsSessionHostPermissions(runspace, serverSettings, usersGpo, administratorsGpo); + SetPowershellPermissions(runspace, serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_POWERSHELL_COMMAND)), usersGpo, administratorsGpo); } finally { @@ -1169,6 +1184,24 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } } + private void SetPowershellPermissions(Runspace runspace, RdsServerSetting setting, string usersGpo, string administratorsGpo) + { + if (setting != null) + { + SetRegistryValue(setting, runspace, DisallowRunParentKey, administratorsGpo, usersGpo, DisallowRunValueName, "1", "Dword"); + + if (setting.ApplyAdministrators) + { + SetRegistryValue(runspace, DisallowRunKey, administratorsGpo, "powershell.exe", "string"); + } + + if (setting.ApplyUsers) + { + SetRegistryValue(runspace, DisallowRunKey, usersGpo, "powershell.exe", "string"); + } + } + } + private void SetRdsSessionHostPermissions(Runspace runspace, RdsServerSettings settings, string usersGpo, string administratorsGpo) { var viewSetting = settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION)); @@ -1233,6 +1266,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } } + private void SetRegistryValue(Runspace runspace, string key, string gpoName, string value, string type) + { + Command cmd = new Command("Set-GPRegistryValue"); + cmd.Parameters.Add("Name", gpoName); + cmd.Parameters.Add("Key", string.Format("\"{0}\"", key)); + cmd.Parameters.Add("Value", value); + cmd.Parameters.Add("Type", type); + + Collection result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd); + } + private void SetRegistryValue(Runspace runspace, string key, string gpoName, string value, string valueName, string type) { Command cmd = new Command("Set-GPRegistryValue"); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx index 837eae3e..4e783a67 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx @@ -129,6 +129,9 @@ Control RDS Session without Users's Permission + + Disable Command Prompt + Drive Space Threshold diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx index a6355f92..1ba5fff1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx @@ -129,6 +129,9 @@ Control RDS Session without Users's Permission + + Disable Command Prompt + Drive Space Threshold diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx index 44b5384b..c7cf7553 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx @@ -190,6 +190,20 @@
+ + + + + + + +
+ + + +
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs index 6fc1f396..e413b313 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs @@ -53,77 +53,16 @@ namespace WebsitePanel.Portal.RDS cbTimeoutUsers.Checked = setting.ApplyUsers; } - setting = GetServerSetting(settings, RdsServerSettings.REMOVE_RUN_COMMAND); - - if (setting != null) - { - cbRunCommandAdministrators.Checked = setting.ApplyAdministrators; - cbRunCommandUsers.Checked = setting.ApplyUsers; - } - - setting = GetServerSetting(settings, RdsServerSettings.REMOVE_POWERSHELL_COMMAND); - - if (setting != null) - { - cbPowershellAdministrators.Checked = setting.ApplyAdministrators; - cbPowershellUsers.Checked = setting.ApplyUsers; - } - - setting = GetServerSetting(settings, RdsServerSettings.HIDE_C_DRIVE); - - if (setting != null) - { - cbHideCDriveAdministrators.Checked = setting.ApplyAdministrators; - cbHideCDriveUsers.Checked = setting.ApplyUsers; - } - - setting = GetServerSetting(settings, RdsServerSettings.REMOVE_SHUTDOWN_RESTART); - - if (setting != null) - { - cbShutdownAdministrators.Checked = setting.ApplyAdministrators; - cbShutdownUsers.Checked = setting.ApplyUsers; - } - - setting = GetServerSetting(settings, RdsServerSettings.DISABLE_TASK_MANAGER); - - if (setting != null) - { - cbTaskManagerAdministrators.Checked = setting.ApplyAdministrators; - cbTaskManagerUsers.Checked = setting.ApplyUsers; - } - - setting = GetServerSetting(settings, RdsServerSettings.CHANGE_DESKTOP_DISABLED); - - if (setting != null) - { - cbDesktopAdministrators.Checked = setting.ApplyAdministrators; - cbDesktopUsers.Checked = setting.ApplyUsers; - } - - setting = GetServerSetting(settings, RdsServerSettings.SCREEN_SAVER_DISABLED); - - if (setting != null) - { - cbScreenSaverAdministrators.Checked = setting.ApplyAdministrators; - cbViewSessionUsers.Checked = setting.ApplyUsers; - } - - setting = GetServerSetting(settings, RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION); - - if (setting != null) - { - cbViewSessionAdministrators.Checked = setting.ApplyAdministrators; - cbScreenSaverUsers.Checked = setting.ApplyUsers; - } - - setting = GetServerSetting(settings, RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION); - - if (setting != null) - { - cbControlSessionAdministrators.Checked = setting.ApplyAdministrators; - cbControlSessionUsers.Checked = setting.ApplyUsers; - } + SetCheckboxes(settings, RdsServerSettings.REMOVE_RUN_COMMAND, cbRunCommandAdministrators, cbRunCommandUsers); + SetCheckboxes(settings, RdsServerSettings.REMOVE_POWERSHELL_COMMAND, cbPowershellAdministrators, cbPowershellUsers); + SetCheckboxes(settings, RdsServerSettings.HIDE_C_DRIVE, cbHideCDriveAdministrators, cbHideCDriveUsers); + SetCheckboxes(settings, RdsServerSettings.REMOVE_SHUTDOWN_RESTART, cbShutdownAdministrators, cbShutdownUsers); + SetCheckboxes(settings, RdsServerSettings.DISABLE_TASK_MANAGER, cbTaskManagerAdministrators, cbTaskManagerUsers); + SetCheckboxes(settings, RdsServerSettings.CHANGE_DESKTOP_DISABLED, cbDesktopAdministrators, cbDesktopUsers); + SetCheckboxes(settings, RdsServerSettings.SCREEN_SAVER_DISABLED, cbScreenSaverAdministrators, cbScreenSaverUsers); + SetCheckboxes(settings, RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION, cbViewSessionAdministrators, cbViewSessionUsers); + SetCheckboxes(settings, RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION, cbControlSessionAdministrators, cbControlSessionUsers); + SetCheckboxes(settings, RdsServerSettings.DISABLE_CMD, cbDisableCmdAdministrators, cbDisableCmdUsers); setting = GetServerSetting(settings, RdsServerSettings.DRIVE_SPACE_THRESHOLD); @@ -133,6 +72,17 @@ namespace WebsitePanel.Portal.RDS } } + private void SetCheckboxes(RdsServerSettings settings, string settingName, CheckBox cbAdministrators, CheckBox cbUsers) + { + var setting = GetServerSetting(settings, settingName); + + if (setting != null) + { + cbAdministrators.Checked = setting.ApplyAdministrators; + cbUsers.Checked = setting.ApplyUsers; + } + } + private RdsServerSetting GetServerSetting(RdsServerSettings settings, string propertyName) { return settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(propertyName)); @@ -230,6 +180,14 @@ namespace WebsitePanel.Portal.RDS ApplyUsers = cbControlSessionUsers.Checked }); + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.DISABLE_CMD, + PropertyValue = "", + ApplyAdministrators = cbDisableCmdAdministrators.Checked, + ApplyUsers = cbDisableCmdUsers.Checked + }); + return settings; } @@ -265,6 +223,9 @@ namespace WebsitePanel.Portal.RDS cbControlSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]); cbControlSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]); + cbDisableCmdAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS]); + cbDisableCmdUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_USERS]); + ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs index 953e340e..b12d745a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs @@ -462,6 +462,42 @@ namespace WebsitePanel.Portal.RDS { /// protected global::System.Web.UI.WebControls.CheckBox cbControlSessionAdministrators; + /// + /// secDisableCmd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secDisableCmd; + + /// + /// disableCmdPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel disableCmdPanel; + + /// + /// cbDisableCmdUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDisableCmdUsers; + + /// + /// cbDisableCmdAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDisableCmdAdministrators; + /// /// buttonPanel control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx index 4d22c2e1..1f3300e5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx @@ -166,4 +166,18 @@
+ + + + + + + + +
+ + + +
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs index ed9bab8c..3e28ef23 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs @@ -49,6 +49,9 @@ namespace WebsitePanel.Portal cbControlSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]); cbControlSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]); + cbDisableCmdAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS]); + cbDisableCmdUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_USERS]); + ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; } @@ -72,6 +75,12 @@ namespace WebsitePanel.Portal settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS] = cbScreenSaverAdministrators.Checked.ToString(); settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS] = cbScreenSaverUsers.Checked.ToString(); settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE] = ddTreshold.SelectedValue; + settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS] = cbViewSessionAdministrators.Checked.ToString(); + settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users] = cbViewSessionUsers.Checked.ToString(); + settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS] = cbControlSessionAdministrators.Checked.ToString(); + settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users] = cbControlSessionUsers.Checked.ToString(); + settings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS] = cbDisableCmdAdministrators.Checked.ToString(); + settings[RdsServerSettings.DISABLE_CMD_USERS] = cbDisableCmdUsers.Checked.ToString(); } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs index 2b120670..9ecc5ff4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs @@ -407,5 +407,41 @@ namespace WebsitePanel.Portal { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbControlSessionAdministrators; + + /// + /// secDisableCmd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secDisableCmd; + + /// + /// disableCmdPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel disableCmdPanel; + + /// + /// cbDisableCmdUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDisableCmdUsers; + + /// + /// cbDisableCmdAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDisableCmdAdministrators; } } From ac46bfbff981074762d19ecb25d55768218382e9 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Fri, 3 Apr 2015 07:54:19 -0700 Subject: [PATCH 39/91] RDS GPO fixes --- .../RemoteDesktopServicesController.cs | 71 +++++++++++++------ .../Windows2012.cs | 2 + .../RDS/RDSEditUserExperience.ascx.cs | 44 +----------- .../RDS/UserControls/RDSCollectionTabs.ascx | 4 +- .../UserControls/RDSCollectionTabs.ascx.cs | 4 +- 5 files changed, 60 insertions(+), 65 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index 9595fbab..4d7fd9ff 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -408,24 +408,7 @@ namespace WebsitePanel.EnterpriseServer var rds = GetRemoteDesktopServices(GetRdsServiceId(collection.ItemId)); Organization org = OrganizationController.GetOrganization(collection.ItemId); rds.ApplyGPO(org.OrganizationId, collection.Name, settings); - - XmlDocument doc = new XmlDocument(); - XmlElement nodeProps = doc.CreateElement("properties"); - - if (settings != null) - { - foreach (var setting in settings.Settings) - { - XmlElement nodeProp = doc.CreateElement("property"); - nodeProp.SetAttribute("name", setting.PropertyName); - nodeProp.SetAttribute("value", setting.PropertyValue); - nodeProp.SetAttribute("applyUsers", setting.ApplyUsers ? "1" : "0"); - nodeProp.SetAttribute("applyAdministrators", setting.ApplyAdministrators ? "1" : "0"); - nodeProps.AppendChild(nodeProp); - } - } - - string xml = nodeProps.OuterXml; + string xml = GetSettingsXml(settings); DataProvider.UpdateRdsServerSettings(serverId, settingsName, xml); @@ -792,8 +775,11 @@ namespace WebsitePanel.EnterpriseServer }; rds.CreateCollection(org.OrganizationId, collection); - rds.ApplyGPO(org.OrganizationId, collection.Name, GetDefaultGpoSettings()); - collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description, collection.DisplayName); + var defaultGpoSettings = GetDefaultGpoSettings(); + rds.ApplyGPO(org.OrganizationId, collection.Name, defaultGpoSettings); + collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description, collection.DisplayName); + string xml = GetSettingsXml(defaultGpoSettings); + DataProvider.UpdateRdsServerSettings(collection.Id, string.Format("Collection-{0}-Settings", collection.Id), xml); collection.Settings.RdsCollectionId = collection.Id; int settingsId = DataProvider.AddRdsCollectionSettings(collection.Settings); @@ -2142,7 +2128,52 @@ namespace WebsitePanel.EnterpriseServer ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]) }); + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.DISABLE_CMD, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_CMD_USERS]) + }); + return settings; } + + private static string GetSettingsXml(RdsServerSettings settings) + { + XmlDocument doc = new XmlDocument(); + XmlElement nodeProps = doc.CreateElement("properties"); + + if (settings != null) + { + foreach (var setting in settings.Settings) + { + XmlElement nodeProp = doc.CreateElement("property"); + nodeProp.SetAttribute("name", setting.PropertyName); + nodeProp.SetAttribute("value", setting.PropertyValue); + nodeProp.SetAttribute("applyUsers", setting.ApplyUsers ? "1" : "0"); + nodeProp.SetAttribute("applyAdministrators", setting.ApplyAdministrators ? "1" : "0"); + nodeProps.AppendChild(nodeProp); + } + } + + return nodeProps.OuterXml; + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 3fc744bf..95bfca5d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -1135,6 +1135,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { runspace = OpenRunspace(); + CreatePolicy(runspace, organizationId, string.Format("{0}-administrators", collectionName), new DirectoryEntry(GetGroupPath(organizationId, collectionName, GetLocalAdminsGroupName(collectionName))), collectionName); + CreatePolicy(runspace, organizationId, string.Format("{0}-users", collectionName), new DirectoryEntry(GetUsersGroupPath(organizationId, collectionName)), collectionName); CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collectionName); RemoveRegistryValue(runspace, ScreenSaverGpoKey, administratorsGpo); RemoveRegistryValue(runspace, ScreenSaverGpoKey, usersGpo); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs index e413b313..19e11012 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs @@ -33,8 +33,8 @@ namespace WebsitePanel.Portal.RDS if (serverSettings == null || !serverSettings.Settings.Any()) { - var defaultSettings = ES.Services.Users.GetUserSettings(PanelSecurity.LoggedUserId, UserSettings.RDS_POLICY); - BindDefaultSettings(defaultSettings); + ddTimeout.SelectedValue = ""; + ddTreshold.SelectedValue = ""; } else { @@ -189,45 +189,7 @@ namespace WebsitePanel.Portal.RDS }); return settings; - } - - private void BindDefaultSettings(UserSettings settings) - { - ddTimeout.SelectedValue = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE]; - cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]); - cbTimeoutUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]); - - cbRunCommandAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS]); - cbRunCommandUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_RUN_COMMAND_USERS]); - - cbPowershellAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS]); - cbPowershellUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_USERS]); - - cbHideCDriveAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.HIDE_C_DRIVE_ADMINISTRATORS]); - cbHideCDriveUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.HIDE_C_DRIVE_USERS]); - - cbShutdownAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS]); - cbShutdownUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_USERS]); - - cbTaskManagerAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_TASK_MANAGER_ADMINISTRATORS]); - cbTaskManagerUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_TASK_MANAGER_USERS]); - - cbDesktopAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_ADMINISTRATORS]); - cbDesktopUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS]); - - cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]); - cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]); - - cbViewSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS]); - cbViewSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users]); - cbControlSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]); - cbControlSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]); - - cbDisableCmdAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS]); - cbDisableCmdUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_USERS]); - - ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; - } + } private bool SaveServerSettings() { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx index 35aa06a7..9f434613 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx @@ -5,13 +5,13 @@ - + <%# Eval("Name") %> - + <%# Eval("Name") %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs index 57e12294..cb563662 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs @@ -22,11 +22,11 @@ namespace WebsitePanel.Portal.RDS.UserControls List tabsList = new List(); tabsList.Add(CreateTab("rds_edit_collection", "Tab.RdsServers")); tabsList.Add(CreateTab("rds_edit_collection_settings", "Tab.Settings")); + tabsList.Add(CreateTab("rds_collection_user_experience", "Tab.UserExperience")); tabsList.Add(CreateTab("rds_collection_edit_apps", "Tab.RdsApplications")); tabsList.Add(CreateTab("rds_collection_edit_users", "Tab.RdsUsers")); tabsList.Add(CreateTab("rds_collection_user_sessions", "Tab.UserSessions")); - tabsList.Add(CreateTab("rds_collection_local_admins", "Tab.LocalAdmins")); - tabsList.Add(CreateTab("rds_collection_user_experience", "Tab.UserExperience")); + tabsList.Add(CreateTab("rds_collection_local_admins", "Tab.LocalAdmins")); tabsList.Add(CreateTab("rds_setup_letter", "Tab.RdsSetupLetter")); int idx = 0; From 8fa9792b8340defdea23b4051a71a26585362e63 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Fri, 3 Apr 2015 20:23:01 +0300 Subject: [PATCH 40/91] wsp-10327 Add Dynamic Memory to VPS - Server Part. --- .../Virtualization/DynamicMemory.cs | 46 ++++++++++ .../Virtualization/VirtualMachine.cs | 4 + .../WebsitePanel.Providers.Base.csproj | 2 +- .../Extensions/PSObjectExtension.cs | 4 + .../Helpers/MemoryHelper.cs | 58 +++++++++++++ .../Helpers/VirtualMachineHelper.cs | 32 ------- .../HyperV2012R2.cs | 83 ++++++++++--------- .../PowerShellManager.cs | 3 - ...oviders.Virtualization.HyperV2012R2.csproj | 1 + .../WebsitePanel/VPS/VdcCreateServer.ascx | 2 +- .../WebsitePanel/VPS/VdcCreateServer.ascx.cs | 24 +++--- .../VPS/VdcCreateServer.ascx.designer.cs | 4 +- 12 files changed, 171 insertions(+), 92 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/DynamicMemory.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/MemoryHelper.cs diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/DynamicMemory.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/DynamicMemory.cs new file mode 100644 index 00000000..91b91a08 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/DynamicMemory.cs @@ -0,0 +1,46 @@ +// 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; + + +namespace WebsitePanel.Providers.Virtualization +{ + public class DynamicMemory + { + public bool Enabled { get; set; } + + public int Minimum { get; set; } + + public int Maximum { get; set; } + + public int Buffer { get; set; } + + public int Priority { get; set; } // Weight + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs index aa659526..a4f1b809 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs @@ -71,6 +71,10 @@ namespace WebsitePanel.Providers.Virtualization [Persistent] public int RamSize { get; set; } public int RamUsage { get; set; } + + [Persistent] + public DynamicMemory DynamicMemory { get; set; } + [Persistent] public int HddSize { get; set; } public LogicalDisk[] HddLogicalDisks { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index e72359e6..da12a506 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -315,7 +315,6 @@ - @@ -333,6 +332,7 @@ + Code diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/PSObjectExtension.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/PSObjectExtension.cs index 33426fe2..ba8df901 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/PSObjectExtension.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/PSObjectExtension.cs @@ -36,6 +36,10 @@ namespace WebsitePanel.Providers.Virtualization { return obj.Members[name].Value == null ? "" : obj.Members[name].Value.ToString(); } + public static bool GetBool(this PSObject obj, string name) + { + return Convert.ToBoolean(obj.Members[name].Value); + } #endregion diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/MemoryHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/MemoryHelper.cs new file mode 100644 index 00000000..e999b0c4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/MemoryHelper.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Management.Automation; +using System.Management.Automation.Runspaces; +using System.Text; +using System.Threading.Tasks; + +namespace WebsitePanel.Providers.Virtualization +{ + public static class MemoryHelper + { + public static DynamicMemory GetDynamicMemory(PowerShellManager powerShell, string vmName) + { + DynamicMemory info = null; + + Command cmd = new Command("Get-VMMemory"); + cmd.Parameters.Add("VMName", vmName); + Collection result = powerShell.Execute(cmd); + + if (result != null && result.Count > 0) + { + info = new DynamicMemory(); + info.Enabled = result[0].GetBool("DynamicMemoryEnabled"); + info.Minimum = Convert.ToInt32(result[0].GetLong("Minimum") / Constants.Size1M); + info.Maximum = Convert.ToInt32(result[0].GetLong("Maximum") / Constants.Size1M); + info.Buffer = Convert.ToInt32(result[0].GetInt("Buffer") / Constants.Size1M); + info.Priority = Convert.ToInt32(result[0].GetInt("Priority") / Constants.Size1M); + } + + return info; + } + + public static void Update(PowerShellManager powerShell, VirtualMachine vm, int ramMb, DynamicMemory dynamicMemory) + { + Command cmd = new Command("Set-VMMemory"); + + cmd.Parameters.Add("VMName", vm.Name); + cmd.Parameters.Add("StartupBytes", ramMb * Constants.Size1M); + + if (dynamicMemory != null && dynamicMemory.Enabled) + { + cmd.Parameters.Add("DynamicMemoryEnabled", true); + cmd.Parameters.Add("MinimumBytes", dynamicMemory.Minimum * Constants.Size1M); + cmd.Parameters.Add("MaximumBytes", dynamicMemory.Maximum * Constants.Size1M); + cmd.Parameters.Add("Buffer", dynamicMemory.Buffer); + cmd.Parameters.Add("Priority", dynamicMemory.Priority); + } + else + { + cmd.Parameters.Add("DynamicMemoryEnabled", false); + } + + powerShell.Execute(cmd, true); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs index 44cbeafe..68cd50ac 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs @@ -34,7 +34,6 @@ namespace WebsitePanel.Providers.Virtualization public static int GetVMProcessors(PowerShellManager powerShell, string name) { - int procs = 0; Command cmd = new Command("Get-VMProcessor"); @@ -50,27 +49,6 @@ namespace WebsitePanel.Providers.Virtualization return procs; } - public static MemoryInfo GetVMMemory(PowerShellManager powerShell, string name) - { - MemoryInfo info = new MemoryInfo(); - - Command cmd = new Command("Get-VMMemory"); - - cmd.Parameters.Add("VMName", name); - - Collection result = powerShell.Execute(cmd, true); - if (result != null && result.Count > 0) - { - info.DynamicMemoryEnabled = Convert.ToBoolean(result[0].GetProperty("DynamicMemoryEnabled")); - info.Startup = Convert.ToInt32(Convert.ToInt64(result[0].GetProperty("Startup")) / Constants.Size1M); - info.Minimum = Convert.ToInt32(Convert.ToInt64(result[0].GetProperty("Minimum")) / Constants.Size1M); - info.Maximum = Convert.ToInt32(Convert.ToInt64(result[0].GetProperty("Maximum")) / Constants.Size1M); - info.Buffer = Convert.ToInt32(result[0].GetProperty("Buffer")); - info.Priority = Convert.ToInt32(result[0].GetProperty("Priority")); - } - return info; - } - public static void UpdateProcessors(PowerShellManager powerShell, VirtualMachine vm, int cpuCores, int cpuLimitSettings, int cpuReserveSettings, int cpuWeightSettings) { Command cmd = new Command("Set-VMProcessor"); @@ -83,15 +61,5 @@ namespace WebsitePanel.Providers.Virtualization powerShell.Execute(cmd, true); } - - public static void UpdateMemory(PowerShellManager powerShell, VirtualMachine vm, long ramMB) - { - Command cmd = new Command("Set-VMMemory"); - - cmd.Parameters.Add("VMName", vm.Name); - cmd.Parameters.Add("StartupBytes", ramMB * Constants.Size1M); - - powerShell.Execute(cmd, true); - } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index 311d99a5..9cfaba40 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -143,18 +143,17 @@ namespace WebsitePanel.Providers.Virtualization try { Command cmd = new Command("Get-VM"); - cmd.Parameters.Add("Id", vmId); - Collection result = PowerShell.Execute(cmd, true); + if (result != null && result.Count > 0) { - vm.Name = result[0].GetProperty("Name").ToString(); + vm.Name = result[0].GetString("Name"); vm.State = result[0].GetEnum("State"); vm.CpuUsage = ConvertNullableToInt32(result[0].GetProperty("CpuUsage")); // This does not truly give the RAM usage, only the memory assigned to the VPS - // Lets handle detection of total memory and usage else where - //vm.RamUsage = Convert.ToInt32(ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Constants.Size1M); + // Lets handle detection of total memory and usage else where. SetUsagesFromKVP method have been made for it. + vm.RamUsage = Convert.ToInt32(ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Constants.Size1M); vm.RamSize = Convert.ToInt32(ConvertNullableToInt64(result[0].GetProperty("MemoryStartup")) / Constants.Size1M); vm.Uptime = Convert.ToInt64(result[0].GetProperty("UpTime").TotalMilliseconds); vm.Status = result[0].GetProperty("Status").ToString(); @@ -162,18 +161,13 @@ namespace WebsitePanel.Providers.Virtualization vm.Generation = result[0].GetInt("Generation"); vm.ProcessorCount = result[0].GetInt("ProcessorCount"); vm.ParentSnapshotId = result[0].GetString("ParentSnapshotId"); - vm.Heartbeat = VirtualMachineHelper.GetVMHeartBeatStatus(PowerShell, vm.Name); - vm.CreatedDate = DateTime.Now; if (extendedInfo) { vm.CpuCores = VirtualMachineHelper.GetVMProcessors(PowerShell, vm.Name); - MemoryInfo memoryInfo = VirtualMachineHelper.GetVMMemory(PowerShell, vm.Name); - vm.RamSize = memoryInfo.Startup; - // BIOS BiosInfo biosInfo = BiosHelper.Get(PowerShell, vm.Name, vm.Generation); vm.NumLockEnabled = biosInfo.NumLockEnabled; @@ -195,38 +189,11 @@ namespace WebsitePanel.Providers.Virtualization // network adapters vm.Adapters = NetworkAdapterHelper.Get(PowerShell, vm.Name); } - else - { - // Use the WebsitePanel VMConfig Windows service to get the RAM usage as well as the HDD usage / sizes - List vmKvps = GetKVPItems(vmId); - foreach (KvpExchangeDataItem vmKvp in vmKvps) - { - // RAM - if (vmKvp.Name == Constants.KVP_RAM_SUMMARY_KEY) - { - string[] ram = vmKvp.Data.Split(':'); - int freeRam = Int32.Parse(ram[0]); - int availRam = Int32.Parse(ram[1]); - vm.RamUsage = availRam - freeRam; - } + vm.DynamicMemory = MemoryHelper.GetDynamicMemory(PowerShell, vm.Name); - // HDD - if (vmKvp.Name == Constants.KVP_HDD_SUMMARY_KEY) - { - string[] disksArray = vmKvp.Data.Split(';'); - vm.HddLogicalDisks = new LogicalDisk[disksArray.Length]; - for (int i = 0; i < disksArray.Length; i++) - { - string[] disk = disksArray[i].Split(':'); - vm.HddLogicalDisks[i] = new LogicalDisk(); - vm.HddLogicalDisks[i].DriveLetter = disk[0]; - vm.HddLogicalDisks[i].FreeSpace = Int32.Parse(disk[1]); - vm.HddLogicalDisks[i].Size = Int32.Parse(disk[2]); - } - } - } - } + // If it is possible get usage ram and usage hdd data from KVP + SetUsagesFromKVP(ref vm); } } catch (Exception ex) @@ -400,7 +367,7 @@ namespace WebsitePanel.Providers.Virtualization DvdDriveHelper.Update(PowerShell, realVm, vm.DvdDriveInstalled); // Dvd should be before bios because bios sets boot order BiosHelper.Update(PowerShell, realVm, vm.BootFromCD, vm.NumLockEnabled); VirtualMachineHelper.UpdateProcessors(PowerShell, realVm, vm.CpuCores, CpuLimitSettings, CpuReserveSettings, CpuWeightSettings); - VirtualMachineHelper.UpdateMemory(PowerShell, realVm, vm.RamSize); + MemoryHelper.Update(PowerShell, realVm, vm.RamSize, vm.DynamicMemory); NetworkAdapterHelper.Update(PowerShell, vm); } catch (Exception ex) @@ -1835,6 +1802,40 @@ namespace WebsitePanel.Providers.Virtualization return jobCompleted; } + private void SetUsagesFromKVP(ref VirtualMachine vm) + { + // Use the WebsitePanel VMConfig Windows service to get the RAM usage as well as the HDD usage / sizes + List vmKvps = GetKVPItems(vm.VirtualMachineId); + foreach (KvpExchangeDataItem vmKvp in vmKvps) + { + // RAM + if (vmKvp.Name == Constants.KVP_RAM_SUMMARY_KEY) + { + string[] ram = vmKvp.Data.Split(':'); + int freeRam = Int32.Parse(ram[0]); + int availRam = Int32.Parse(ram[1]); + + vm.RamUsage = availRam - freeRam; + } + + // HDD + if (vmKvp.Name == Constants.KVP_HDD_SUMMARY_KEY) + { + string[] disksArray = vmKvp.Data.Split(';'); + vm.HddLogicalDisks = new LogicalDisk[disksArray.Length]; + for (int i = 0; i < disksArray.Length; i++) + { + string[] disk = disksArray[i].Split(':'); + vm.HddLogicalDisks[i] = new LogicalDisk + { + DriveLetter = disk[0], + FreeSpace = Int32.Parse(disk[1]), + Size = Int32.Parse(disk[2]) + }; + } + } + } + } #endregion #region Remote File Methods diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs index 1f63b104..e55191f3 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs @@ -4,8 +4,6 @@ using System.Collections.ObjectModel; using System.Linq; using System.Management.Automation; using System.Management.Automation.Runspaces; -using System.Text; -using System.Threading.Tasks; using WebsitePanel.Providers.HostedSolution; namespace WebsitePanel.Providers.Virtualization @@ -65,7 +63,6 @@ namespace WebsitePanel.Providers.Virtualization public Collection Execute(Command cmd, bool addComputerNameParameter) { - object[] errors; return Execute(cmd, addComputerNameParameter, false); } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj index aa20c15c..814d9693 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj @@ -57,6 +57,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx index c864299e..00efcc3b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx @@ -189,7 +189,7 @@ - + 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 4fb5436e..a3b3dedb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2015, Outercurve Foundation. +// Copyright (c) 2015, Outercurve Foundation. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, @@ -26,7 +26,7 @@ // (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; using System.Collections.Generic; using System.Web; using System.Web.UI; @@ -42,7 +42,7 @@ namespace WebsitePanel.Portal.VPS { protected void Page_Load(object sender, EventArgs e) { - LoadCustomProviderControl(); + LoadCustomProviderControls(); if (!IsPostBack) { @@ -56,23 +56,23 @@ namespace WebsitePanel.Portal.VPS ToggleControls(); } - private void LoadCustomProviderControl() + private void LoadCustomProviderControls() { try { - LoadProviderControl(PanelSecurity.PackageId, "VPS", providerControl, "Create.ascx"); + LoadProviderControl(PanelSecurity.PackageId, "VPS", createSettingsProviderControl, "Create.ascx"); } catch { /* skip */ } } - private IVirtualMachineCreateControl CustomProviderControl + private IVirtualMachineCreateControl CreareSettingsProviderControl { get { - if (providerControl.Controls.Count == 0) + if (createSettingsProviderControl.Controls.Count == 0) return null; - return (IVirtualMachineCreateControl)providerControl.Controls[0]; + return (IVirtualMachineCreateControl)createSettingsProviderControl.Controls[0]; } } @@ -136,9 +136,9 @@ namespace WebsitePanel.Portal.VPS ddlCpu.SelectedIndex = ddlCpu.Items.Count - 1; // select last (maximum) item // the custom provider control - if (CustomProviderControl != null) + if (CreareSettingsProviderControl != null) { - IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)providerControl.Controls[0]; + IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)createSettingsProviderControl.Controls[0]; ctrl.BindItem(new VirtualMachine()); } @@ -319,9 +319,9 @@ namespace WebsitePanel.Portal.VPS VirtualMachine virtualMachine = new VirtualMachine(); // the custom provider control - if (CustomProviderControl != null) + if (CreareSettingsProviderControl != null) { - IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)providerControl.Controls[0]; + IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)createSettingsProviderControl.Controls[0]; ctrl.SaveItem(virtualMachine); } 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 c179bdcf..8c736e9c 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 @@ -373,13 +373,13 @@ namespace WebsitePanel.Portal.VPS { protected global::System.Web.UI.WebControls.Localize locGB; /// - /// providerControl control. + /// createSettingsProviderControl control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.PlaceHolder providerControl; + protected global::System.Web.UI.WebControls.PlaceHolder createSettingsProviderControl; /// /// secSnapshots control. From 054908269c01ac9b7098f38110625c3d6bb349ad Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Sat, 4 Apr 2015 14:07:22 +0300 Subject: [PATCH 41/91] wsp-10327 Add Dynamic Memory to VPS - Portal Part. --- ...l.cs => IVirtualMachineSettingsControl.cs} | 17 +-- .../HyperV2012R2_Create.ascx.resx | 12 -- .../HyperV2012R2_Edit.ascx.resx | 120 ++++++++++++++++ .../ProviderControls/HyperV2012R2_Create.ascx | 22 +-- .../HyperV2012R2_Create.ascx.cs | 34 ++++- .../HyperV2012R2_Create.ascx.designer.cs | 26 +--- .../ProviderControls/HyperV2012R2_Edit.ascx | 4 + .../HyperV2012R2_Edit.ascx.cs | 52 +++++++ .../HyperV2012R2_Edit.ascx.designer.cs | 24 ++++ .../DynamicMemory.ascx.resx | 126 +++++++++++++++++ .../App_LocalResources/Generation.ascx.resx | 132 ++++++++++++++++++ .../VPS/UserControls/DynamicMemory.ascx | 17 +++ .../VPS/UserControls/DynamicMemory.ascx.cs | 50 +++++++ .../DynamicMemory.ascx.designer.cs | 42 ++++++ .../VPS/UserControls/Generation.ascx | 24 ++++ .../VPS/UserControls/Generation.ascx.cs | 54 +++++++ .../UserControls/Generation.ascx.designer.cs | 60 ++++++++ .../WebsitePanel/VPS/VdcCreateServer.ascx | 5 + .../WebsitePanel/VPS/VdcCreateServer.ascx.cs | 23 ++- .../VPS/VdcCreateServer.ascx.designer.cs | 18 +++ .../VPS/VpsDetailsEditConfiguration.ascx | 3 + .../VPS/VpsDetailsEditConfiguration.ascx.cs | 31 +++- ...sDetailsEditConfiguration.ascx.designer.cs | 49 ++----- .../WebsitePanel.Portal.Modules.csproj | 35 ++++- 24 files changed, 855 insertions(+), 125 deletions(-) rename WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/{IVirtualMachineCreateControl.cs => IVirtualMachineSettingsControl.cs} (79%) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Edit.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Edit.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/App_LocalResources/DynamicMemory.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/App_LocalResources/Generation.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/DynamicMemory.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/UserControls/Generation.ascx.designer.cs 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 + From 919900b8a14a5e8b5023231bf298363d04b4e2a6 Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 5 Apr 2015 07:48:45 +0800 Subject: [PATCH 42/91] Sharepoint Enterprise 2013 provider --- WebsitePanel/Database/update_db.sql | 32 +- .../Packages/Quotas.cs | 3 + .../Servers/ResourceGroups.cs | 1 + .../WebsitePanel.EnterpriseServer.Base.csproj | 4 +- .../HostedSolution/OrganizationController.cs | 31 + .../HostedSharePointServerController.cs | 35 +- .../HostedSharePointServerEntController.cs | 1020 +++++++++++++++++ .../WebsitePanel.EnterpriseServer.Code.csproj | 5 +- .../WebsitePanel.EnterpriseServer.csproj | 16 +- .../esHostedSharePointServers.asmx.cs | 14 +- .../esHostedSharePointServersEnt.asmx | 1 + .../esHostedSharePointServersEnt.asmx.cs | 237 ++++ .../HostedSolution/Organization.cs | 16 + .../HostedSolution/OrganizationStatistics.cs | 15 + .../SharePoint/IHostedSharePointServerEnt.cs | 120 ++ .../WebsitePanel.Providers.Base.csproj | 1 + .../HostedSharePointServer2013Ent.cs | 352 ++++++ .../HostedSharePointServer2013EntImpl.cs | 851 ++++++++++++++ .../Properties/AssemblyInfo.cs | 36 + ...rs.HostedSolution.SharePoint2013Ent.csproj | 75 ++ .../HostedSharePointServerEntProxy.cs | 928 +++++++++++++++ .../WebsitePanel.Server.Client.csproj | 1 + WebsitePanel/Sources/WebsitePanel.Server.sln | 14 +- .../HostedSharePointServerEnt.asmx | 1 + .../HostedSharePointServerEnt.asmx.cs | 274 +++++ .../WebsitePanel.Server.csproj | 7 + .../Sources/generate_server_proxies.bat | 11 +- 27 files changed, 4056 insertions(+), 45 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx create mode 100644 WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/IHostedSharePointServerEnt.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013Ent.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013EntImpl.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/Properties/AssemblyInfo.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj create mode 100644 WebsitePanel/Sources/WebsitePanel.Server.Client/HostedSharePointServerEntProxy.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx create mode 100644 WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx.cs diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 228701b7..9470c435 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9461,4 +9461,34 @@ END GO -UPDATE [dbo].[Quotas] SET GroupID = 45 WHERE QuotaName = 'EnterpriseStorage.DriveMaps' \ No newline at end of file +UPDATE [dbo].[Quotas] SET GroupID = 45 WHERE QuotaName = 'EnterpriseStorage.DriveMaps' + + +UPDATE [dbo].[ResourceGroups] SET GroupName = 'Sharepoint Enterprise Server' WHERE GroupName = 'Sharepoint Server' +GO + +IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'Hosted SharePoint Enterprise 2013') +BEGIN +DECLARE @provider_id AS INT +DECLARE @group_id AS INT +SELECT @group_id = GroupId FROM [dbo].[ResourceGroups] WHERE GroupName = 'Sharepoint Enterprise Server' +SELECT TOP 1 @provider_id = ProviderId + 1 From [dbo].[Providers] ORDER BY ProviderID DESC +INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) +VALUES (@provider_id, @group_id, N'HostedSharePoint2013Ent', N'Hosted SharePoint Enterprise 2013', N'WebsitePanel.Providers.HostedSolution.HostedSharePointServer2013Ent, WebsitePanel.Providers.HostedSolution.SharePoint2013Ent', N'HostedSharePoint30', NULL) +END +GO + +UPDATE Providers SET ProviderType = N'WebsitePanel.Providers.HostedSolution.HostedSharePointServer2013Ent, WebsitePanel.Providers.HostedSolution.SharePoint2013Ent' WHERE ProviderID = 1301 +GO + +UPDATE [dbo].[Quotas] SET QuotaName = 'HostedSharePointEnterprise.Sites' WHERE QuotaId = 550 +GO + +UPDATE [dbo].[Quotas] SET QuotaName = 'HostedSharePointEnterprise.MaxStorage' WHERE QuotaId = 551 +GO + +UPDATE [dbo].[Quotas] SET QuotaName = 'HostedSharePointEnterprise.UseSharedSSL' WHERE QuotaId = 552 +GO + +UPDATE [dbo].[ServiceItemTypes] SET DisplayName = 'SharePointEnterpriseSiteCollection' WHERE DisplayName = 'SharePointSiteCollection' +GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs index 47155cb1..ed021ce8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Packages/Quotas.cs @@ -154,6 +154,9 @@ order by rg.groupOrder public const string HOSTED_SHAREPOINT_SITES = "HostedSharePoint.Sites"; // Hosted SharePoint Sites public const string HOSTED_SHAREPOINT_STORAGE_SIZE = "HostedSharePoint.MaxStorage"; // Hosted SharePoint storage size; public const string HOSTED_SHAREPOINT_USESHAREDSSL = "HostedSharePoint.UseSharedSSL"; // Hosted SharePoint Use Shared SSL Root + public const string HOSTED_SHAREPOINT_ENTERPRISE_SITES = "HostedSharePointEnterprise.Sites"; // Hosted SharePoint Sites + public const string HOSTED_SHAREPOINT_ENTERPRISE_STORAGE_SIZE = "HostedSharePointEnterprise.MaxStorage"; // Hosted SharePoint storage size; + public const string HOSTED_SHAREPOINT_ENTERPRISE_USESHAREDSSL = "HostedSharePointEnterprise.UseSharedSSL"; // Hosted SharePoint Use Shared SSL Root public const string DNS_EDITOR = "DNS.Editor"; // DNS Editor public const string DNS_ZONES = "DNS.Zones"; // DNS Editor public const string DNS_PRIMARY_ZONES = "DNS.PrimaryZones"; // DNS Editor diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs index 0e412bfb..f610eec3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs @@ -45,6 +45,7 @@ namespace WebsitePanel.EnterpriseServer public const string Statistics = "Statistics"; public const string SharePoint = "SharePoint"; public const string SharepointFoundationServer = "Sharepoint Foundation Server"; + public const string SharepointEnterpriseServer = "Sharepoint Enterprise Server"; public const string SharepointServer = "Sharepoint Server"; public const string Exchange = "Exchange"; public const string HostedOrganizations = "Hosted Organizations"; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj index 9f9c3763..ba6f30a1 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj @@ -39,7 +39,7 @@ true full false - ..\..\Bin\ + ..\WebsitePanel.EnterpriseServer\bin\ DEBUG;TRACE prompt 4 @@ -49,7 +49,7 @@ none true - ..\..\Bin\ + ..\WebsitePanel.EnterpriseServer\bin\ TRACE prompt 4 diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 57d9ea5f..c56aa486 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -381,6 +381,13 @@ namespace WebsitePanel.EnterpriseServer if (cntx.Quotas[Quotas.HOSTED_SHAREPOINT_STORAGE_SIZE] != null) org.WarningSharePointStorage = cntx.Quotas[Quotas.HOSTED_SHAREPOINT_STORAGE_SIZE].QuotaAllocatedValue; + if (cntx.Quotas[Quotas.HOSTED_SHAREPOINT_ENTERPRISE_STORAGE_SIZE] != null) + org.MaxSharePointEnterpriseStorage = cntx.Quotas[Quotas.HOSTED_SHAREPOINT_ENTERPRISE_STORAGE_SIZE].QuotaAllocatedValue; + + + if (cntx.Quotas[Quotas.HOSTED_SHAREPOINT_ENTERPRISE_STORAGE_SIZE] != null) + org.WarningSharePointEnterpriseStorage = cntx.Quotas[Quotas.HOSTED_SHAREPOINT_ENTERPRISE_STORAGE_SIZE].QuotaAllocatedValue; + //add organization to package items itemId = AddOrganizationToPackageItems(org, serviceId, packageId, organizationName, organizationId, domainName); @@ -668,6 +675,16 @@ namespace WebsitePanel.EnterpriseServer TaskManager.WriteError(ex); } + try + { + HostedSharePointServerEntController.DeleteSiteCollections(itemId); + } + catch (Exception ex) + { + successful = false; + TaskManager.WriteError(ex); + } + if (org.IsOCSOrganization) { DeleteOCSUsers(itemId, ref successful); @@ -937,7 +954,9 @@ namespace WebsitePanel.EnterpriseServer stats.CreatedUsers = 5; stats.AllocatedUsers = 10; stats.CreatedSharePointSiteCollections = 1; + stats.CreatedSharePointEnterpriseSiteCollections = 1; stats.AllocatedSharePointSiteCollections = 5; + stats.AllocatedSharePointEnterpriseSiteCollections = 5; return stats; } #endregion @@ -969,6 +988,13 @@ namespace WebsitePanel.EnterpriseServer stats.CreatedSharePointSiteCollections = sharePointStats.TotalRowCount; } + if (cntxTmp.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer)) + { + SharePointSiteCollectionListPaged sharePointStats = HostedSharePointServerEntController.GetSiteCollectionsPaged(org.PackageId, org.Id, string.Empty, string.Empty, string.Empty, 0, 0); + stats.CreatedSharePointEnterpriseSiteCollections = sharePointStats.TotalRowCount; + } + + if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedCRM)) { stats.CreatedCRMUsers = CRMController.GetCRMUsersCount(org.Id, string.Empty, string.Empty, CRMUserLycenseTypes.FULL).Value; @@ -1117,6 +1143,11 @@ namespace WebsitePanel.EnterpriseServer stats.AllocatedSharePointSiteCollections = cntx.Quotas[Quotas.HOSTED_SHAREPOINT_SITES].QuotaAllocatedValue; } + if (cntx.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer)) + { + stats.AllocatedSharePointEnterpriseSiteCollections = cntx.Quotas[Quotas.HOSTED_SHAREPOINT_ENTERPRISE_SITES].QuotaAllocatedValue; + } + if (cntx.Groups.ContainsKey(ResourceGroups.HostedCRM)) { stats.AllocatedCRMUsers = cntx.Quotas[Quotas.CRM_USERS].QuotaAllocatedValue; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs index 3915a855..a03a95ca 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs @@ -58,18 +58,18 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Row index to start from. /// Maximum number of rows to retrieve. /// Site collections that match. - public static SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName = null) + public static SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { if (IsDemoMode) { SharePointSiteCollectionListPaged demoResult = new SharePointSiteCollectionListPaged(); - demoResult.SiteCollections = GetSiteCollections(1, false, null); + demoResult.SiteCollections = GetSiteCollections(1, false); demoResult.TotalRowCount = demoResult.SiteCollections.Count; return demoResult; } SharePointSiteCollectionListPaged paged = new SharePointSiteCollectionListPaged(); - DataSet result = PackageController.GetRawPackageItemsPaged(packageId, groupName, typeof(SharePointSiteCollection), + DataSet result = PackageController.GetRawPackageItemsPaged(packageId, typeof(SharePointSiteCollection), true, filterColumn, filterValue, sortColumn, startRow, Int32.MaxValue); List items = PackageController.CreateServiceItemsList(result, 1).ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); @@ -149,9 +149,8 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint ///
/// Package that owns site collections. /// A value which shows whether nested spaces must be searched as well. - /// Resource group name. /// List of found site collections. - public static List GetSiteCollections(int packageId, bool recursive, string groupName) + public static List GetSiteCollections(int packageId, bool recursive) { if (IsDemoMode) { @@ -184,7 +183,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } - List items = PackageController.GetPackageItemsByType(packageId, groupName, typeof(SharePointSiteCollection), recursive); + List items = PackageController.GetPackageItemsByType(packageId, typeof(SharePointSiteCollection), recursive); return items.ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); } @@ -197,7 +196,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint { if (IsDemoMode) { - return GetSiteCollections(1, false, null)[itemId - 1]; + return GetSiteCollections(1, false)[itemId - 1]; } SharePointSiteCollection item = PackageController.GetPackageItem(itemId) as SharePointSiteCollection; @@ -208,9 +207,8 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Adds SharePoint site collection. ///
/// Site collection description. - /// Resource group name. /// Created site collection id within metabase. - public static int AddSiteCollection(SharePointSiteCollection item, string groupName) + public static int AddSiteCollection(SharePointSiteCollection item) { // Check account. @@ -238,7 +236,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } // Check if stats resource is available - int serviceId = PackageController.GetPackageServiceId(item.PackageId, groupName); + int serviceId = PackageController.GetPackageServiceId(item.PackageId, ResourceGroups.SharepointFoundationServer); if (serviceId == 0) { @@ -276,7 +274,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint item.Name = String.Format("{0}://{1}", rootWebApplicationUri.Scheme, hostNameBase + "-" + counter.ToString() + "." + sslRoot); siteName = String.Format("{0}", hostNameBase + "-" + counter.ToString() + "." + sslRoot); - while (CheckServiceItemExists(item.Name, item.PackageId)) + while ( DataProvider. CheckServiceItemExists( serviceId, item. Name, "WebsitePanel.Providers.SharePoint.SharePointSiteCollection, WebsitePanel.Providers.Base")) { counter++; item.Name = String.Format("{0}://{1}", rootWebApplicationUri.Scheme, hostNameBase + "-" + counter.ToString() + "." + sslRoot); @@ -306,7 +304,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint // Check package item with given name already exists. - if (PackageController.GetPackageItemByName(item.PackageId, groupName, item.Name, typeof(SharePointSiteCollection)) != null) + if (PackageController.GetPackageItemByName(item.PackageId, item.Name, typeof(SharePointSiteCollection)) != null) { return BusinessErrorCodes.ERROR_SHAREPOINT_PACKAGE_ITEM_EXISTS; } @@ -1016,16 +1014,5 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } } - private static bool CheckServiceItemExists(string name, int packageId) - { - bool exists = PackageController.GetPackageItemByName(packageId, ResourceGroups.SharepointFoundationServer, name, typeof(SharePointSiteCollection)) != null; - - if (!exists) - { - exists = PackageController.GetPackageItemByName(packageId, ResourceGroups.SharepointServer, name, typeof(SharePointSiteCollection)) != null; - } - - return exists; - } - } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs new file mode 100644 index 00000000..87c147e1 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs @@ -0,0 +1,1020 @@ +// 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.Collections.Generic; +using System.Collections.Specialized; +using System.Data; +using System.IO; +using System.Xml; +using System.Xml.Serialization; +using WebsitePanel.Providers; +using WebsitePanel.Providers.DNS; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.SharePoint; + +namespace WebsitePanel.EnterpriseServer.Code.SharePoint +{ + /// + /// Exposes handful API on hosted SharePoint site collections management. + /// + public class HostedSharePointServerEntController : IImportController, IBackupController + { + private const int FILE_BUFFER_LENGTH = 5000000; // ~5MB + + /// + /// Gets site collections in raw form. + /// + /// Package to which desired site collections belong. + /// Organization to which desired site collections belong. + /// Filter column name. + /// Filter value. + /// Sort column name. + /// Row index to start from. + /// Maximum number of rows to retrieve. + /// Site collections that match. + public static SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName = null) + { + if (IsDemoMode) + { + SharePointSiteCollectionListPaged demoResult = new SharePointSiteCollectionListPaged(); + demoResult.SiteCollections = GetSiteCollections(1, false); + demoResult.TotalRowCount = demoResult.SiteCollections.Count; + return demoResult; + } + + SharePointSiteCollectionListPaged paged = new SharePointSiteCollectionListPaged(); + DataSet result = PackageController.GetRawPackageItemsPaged(packageId, typeof(SharePointSiteCollection), + true, filterColumn, filterValue, sortColumn, startRow, Int32.MaxValue); + List items = PackageController.CreateServiceItemsList(result, 1).ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); + + if (organizationId > 0) + { + items = items.FindAll(delegate(SharePointSiteCollection siteCollection) { return siteCollection.OrganizationId == organizationId; }); + } + paged.TotalRowCount = items.Count; + + if (items.Count > maximumRows) + { + items.RemoveRange(maximumRows, items.Count - maximumRows); + } + + paged.SiteCollections = items; + + return paged; + } + + public static List GetSiteCollections(int organizationId) + { + Organization org = OrganizationController.GetOrganization(organizationId); + + List items = PackageController.GetPackageItemsByType(org.PackageId, typeof(SharePointSiteCollection), false); + items.ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); + List ret = new List(); + foreach (ServiceProviderItem item in items) + { + SharePointSiteCollection siteCollection = item as SharePointSiteCollection; + if (siteCollection != null && siteCollection.OrganizationId == organizationId) + { + ret.Add(siteCollection); + } + } + + return ret; + } + + /// + /// Gets list of supported languages by this installation of SharePoint. + /// + /// List of supported languages + public static int[] GetSupportedLanguages(int packageId) + { + if (IsDemoMode) + { + return new int[] { 1033 }; + } + + // Log operation. + TaskManager.StartTask("HOSTED_SHAREPOINT_ENTERPRISE", "GET_LANGUAGES"); + + int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.SharepointFoundationServer); + if (serviceId == 0) + { + return new int[] { }; + } + + try + { + // Create site collection on server. + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); + return hostedSharePointServer.Enterprise_GetSupportedLanguages(); + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + /// + /// Gets list of SharePoint site collections that belong to the package. + /// + /// Package that owns site collections. + /// A value which shows whether nested spaces must be searched as well. + /// Resource group name. + /// List of found site collections. + public static List GetSiteCollections(int packageId, bool recursive) + { + if (IsDemoMode) + { + List demoResult = new List(); + SharePointSiteCollection siteCollection1 = new SharePointSiteCollection(); + siteCollection1.Id = 1; + siteCollection1.OrganizationId = 1; + siteCollection1.LocaleId = 1033; + siteCollection1.Name = "http://john.fabrikam.com"; + siteCollection1.OwnerEmail = "john@fabrikam.com"; + siteCollection1.OwnerLogin = "john@fabrikam.com"; + siteCollection1.OwnerName = "John Smith"; + siteCollection1.PhysicalAddress = "http://john.fabrikam.com"; + siteCollection1.Title = "John Smith's Team Site"; + siteCollection1.Url = "http://john.fabrikam.com"; + demoResult.Add(siteCollection1); + SharePointSiteCollection siteCollection2 = new SharePointSiteCollection(); + siteCollection2.Id = 2; + siteCollection1.OrganizationId = 1; + siteCollection2.LocaleId = 1033; + siteCollection2.Name = "http://mark.contoso.com"; + siteCollection2.OwnerEmail = "mark@contoso.com"; + siteCollection2.OwnerLogin = "mark@contoso.com"; + siteCollection2.OwnerName = "Mark Jonsons"; + siteCollection2.PhysicalAddress = "http://mark.contoso.com"; + siteCollection2.Title = "Mark Jonsons' Blog"; + siteCollection2.Url = "http://mark.contoso.com"; + demoResult.Add(siteCollection2); + return demoResult; + } + + + List items = PackageController.GetPackageItemsByType(packageId, typeof(SharePointSiteCollection), recursive); + return items.ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); + } + + /// + /// Gets SharePoint site collection with given id. + /// + /// Site collection id within metabase. + /// Site collection or null in case no such item exist. + public static SharePointSiteCollection GetSiteCollection(int itemId) + { + if (IsDemoMode) + { + return GetSiteCollections(1, false)[itemId - 1]; + } + + SharePointSiteCollection item = PackageController.GetPackageItem(itemId) as SharePointSiteCollection; + return item; + } + + /// + /// Adds SharePoint site collection. + /// + /// Site collection description. + /// Resource group name. + /// Created site collection id within metabase. + public static int AddSiteCollection(SharePointSiteCollection item) + { + + // Check account. + int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); + if (accountCheck < 0) + { + return accountCheck; + } + + // Check package. + int packageCheck = SecurityContext.CheckPackage(item.PackageId, DemandPackage.IsActive); + if (packageCheck < 0) + { + return packageCheck; + } + + // Check quota. + OrganizationStatistics orgStats = OrganizationController.GetOrganizationStatistics(item.OrganizationId); + //QuotaValueInfo quota = PackageController.GetPackageQuota(item.PackageId, Quotas.HOSTED_SHAREPOINT_SITES); + + if (orgStats.AllocatedSharePointEnterpriseSiteCollections > -1 + && orgStats.CreatedSharePointEnterpriseSiteCollections >= orgStats.AllocatedSharePointEnterpriseSiteCollections) + { + return BusinessErrorCodes.ERROR_SHAREPOINT_RESOURCE_QUOTA_LIMIT; + } + + // Check if stats resource is available + int serviceId = PackageController.GetPackageServiceId(item.PackageId, ResourceGroups.SharepointEnterpriseServer); + + if (serviceId == 0) + { + return BusinessErrorCodes.ERROR_SHAREPOINT_RESOURCE_UNAVAILABLE; + } + + StringDictionary hostedSharePointSettings = ServerController.GetServiceSettings(serviceId); + QuotaValueInfo quota = PackageController.GetPackageQuota(item.PackageId, Quotas.HOSTED_SHAREPOINT_ENTERPRISE_USESHAREDSSL); + Uri rootWebApplicationUri = new Uri(hostedSharePointSettings["RootWebApplicationUri"]); + Organization org = OrganizationController.GetOrganization(item.OrganizationId); + string siteName = item.Name; + + if (quota.QuotaAllocatedValue == 1) + { + string sslRoot = hostedSharePointSettings["SharedSSLRoot"]; + + + string defaultDomain = org.DefaultDomain; + string hostNameBase = string.Empty; + + string[] tmp = defaultDomain.Split('.'); + if (tmp.Length == 2) + { + hostNameBase = tmp[0]; + } + else + { + if (tmp.Length > 2) + { + hostNameBase = tmp[0] + tmp[1]; + } + } + + int counter = 0; + item.Name = String.Format("{0}://{1}", rootWebApplicationUri.Scheme, hostNameBase + "-" + counter.ToString() + "." + sslRoot); + siteName = String.Format("{0}", hostNameBase + "-" + counter.ToString() + "." + sslRoot); + + while (DataProvider.CheckServiceItemExists(serviceId, item.Name, "WebsitePanel. Providers. SharePoint. SharePointSiteCollection, WebsitePanel. Providers. Base")) + { + counter++; + item.Name = String.Format("{0}://{1}", rootWebApplicationUri.Scheme, hostNameBase + "-" + counter.ToString() + "." + sslRoot); + siteName = String.Format("{0}", hostNameBase + "-" + counter.ToString() + "." + sslRoot); + } + } + else + item.Name = String.Format("{0}://{1}", rootWebApplicationUri.Scheme, item.Name); + + if (rootWebApplicationUri.Port > 0 && rootWebApplicationUri.Port != 80 && rootWebApplicationUri.Port != 443) + { + item.PhysicalAddress = String.Format("{0}:{1}", item.Name, rootWebApplicationUri.Port); + } + else + { + item.PhysicalAddress = item.Name; + } + + if (Utils.ParseBool(hostedSharePointSettings["LocalHostFile"], false)) + { + item.RootWebApplicationInteralIpAddress = hostedSharePointSettings["RootWebApplicationInteralIpAddress"]; + item.RootWebApplicationFQDN = item.Name.Replace(rootWebApplicationUri.Scheme + "://", ""); + } + + item.MaxSiteStorage = RecalculateMaxSize(org.MaxSharePointEnterpriseStorage, (int)item.MaxSiteStorage); + item.WarningStorage = item.MaxSiteStorage == -1 ? -1 : Math.Min((int)item.WarningStorage, item.MaxSiteStorage); + + + // Check package item with given name already exists. + if (PackageController.GetPackageItemByName(item.PackageId, item.Name, typeof(SharePointSiteCollection)) != null) + { + return BusinessErrorCodes.ERROR_SHAREPOINT_PACKAGE_ITEM_EXISTS; + } + + // Log operation. + TaskManager.StartTask("HOSTED_SHAREPOINT_ENTERPRISE", "ADD_SITE_COLLECTION", item.Name); + + try + { + // Create site collection on server. + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); + + hostedSharePointServer.Enterprise_CreateSiteCollection(item); + + // Make record in metabase. + item.ServiceId = serviceId; + int itemId = PackageController.AddPackageItem(item); + + hostedSharePointServer.Enterprise_SetPeoplePickerOu(item.Name, org.DistinguishedName); + + int dnsServiceId = PackageController.GetPackageServiceId(item.PackageId, ResourceGroups.Dns); + if (dnsServiceId > 0) + { + string[] tmpStr = siteName.Split('.'); + string hostName = tmpStr[0]; + string domainName = siteName.Substring(hostName.Length + 1, siteName.Length - (hostName.Length + 1)); + + List dnsRecords = ServerController.GetDnsRecordsByService(serviceId); + List resourceRecords = DnsServerController.BuildDnsResourceRecords(dnsRecords, hostName, domainName, ""); + DNSServer dns = new DNSServer(); + + ServiceProviderProxy.Init(dns, dnsServiceId); + // add new resource records + dns.AddZoneRecords(domainName, resourceRecords.ToArray()); + } + + TaskManager.ItemId = itemId; + + return itemId; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + /// + /// Deletes SharePoint site collection with given id. + /// + /// Site collection id within metabase. + /// ? + public static int DeleteSiteCollection(int itemId) + { + // Check account. + int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); + if (accountCheck < 0) + { + return accountCheck; + } + + // Load original meta item + SharePointSiteCollection origItem = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + if (origItem == null) + { + return BusinessErrorCodes.ERROR_SHAREPOINT_PACKAGE_ITEM_NOT_FOUND; + } + + // Get service settings. + StringDictionary hostedSharePointSettings = ServerController.GetServiceSettings(origItem.ServiceId); + Uri rootWebApplicationUri = new Uri(hostedSharePointSettings["RootWebApplicationUri"]); + string siteName = origItem.Name.Replace(String.Format("{0}://", rootWebApplicationUri.Scheme), String.Empty); + + // Log operation. + TaskManager.StartTask("HOSTED_SHAREPOINT_ENTERPRISE", "DELETE_SITE", origItem.Name, itemId); + + try + { + // Delete site collection on server. + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(origItem.ServiceId); + hostedSharePointServer.Enterprise_DeleteSiteCollection(origItem); + // Delete record in metabase. + PackageController.DeletePackageItem(origItem.Id); + + int dnsServiceId = PackageController.GetPackageServiceId(origItem.PackageId, ResourceGroups.Dns); + if (dnsServiceId > 0) + { + string[] tmpStr = siteName.Split('.'); + string hostName = tmpStr[0]; + string domainName = siteName.Substring(hostName.Length + 1, siteName.Length - (hostName.Length + 1)); + + List dnsRecords = ServerController.GetDnsRecordsByService(origItem.ServiceId); + List resourceRecords = DnsServerController.BuildDnsResourceRecords(dnsRecords, hostName, domainName, ""); + DNSServer dns = new DNSServer(); + + ServiceProviderProxy.Init(dns, dnsServiceId); + // add new resource records + dns.DeleteZoneRecords(domainName, resourceRecords.ToArray()); + } + + return 0; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + /// + /// Deletes SharePoint site collections which belong to organization. + /// + /// Site collection id within metabase. + public static void DeleteSiteCollections(int organizationId) + { + Organization org = OrganizationController.GetOrganization(organizationId); + SharePointSiteCollectionListPaged existentSiteCollections = GetSiteCollectionsPaged(org.PackageId, org.Id, String.Empty, String.Empty, String.Empty, 0, Int32.MaxValue); + foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) + { + DeleteSiteCollection(existentSiteCollection.Id); + } + } + + /// + /// Backups SharePoint site collection. + /// + /// Site collection id within metabase. + /// Backed up site collection file name. + /// A value which shows whether back up must be archived. + /// A value which shows whether created back up must be downloaded. + /// Local folder to store downloaded backup. + /// Created backup file name. + public static string BackupSiteCollection(int itemId, string fileName, bool zipBackup, bool download, string folderName) + { + // Check account. + int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); + if (accountCheck < 0) + { + return null; + } + + // Load original meta item + SharePointSiteCollection origItem = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + if (origItem == null) + { + return null; + } + + // Log operation. + TaskManager.StartTask("HOSTED_SHAREPOINT_ENTERPRISE", "BACKUP_SITE_COLLECTION", origItem.Name, itemId); + + try + { + // Create site collection on server. + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(origItem.ServiceId); + string backFile = hostedSharePointServer.Enterprise_BackupSiteCollection(origItem.Name, fileName, zipBackup); + + if (!download) + { + // Copy backup files to space folder. + string relFolderName = FilesController.CorrectRelativePath(folderName); + if (!relFolderName.EndsWith("\\")) + { + relFolderName = relFolderName + "\\"; + } + + // Create backup folder if not exists + if (!FilesController.DirectoryExists(origItem.PackageId, relFolderName)) + { + FilesController.CreateFolder(origItem.PackageId, relFolderName); + } + + string packageFile = relFolderName + Path.GetFileName(backFile); + + // Delete destination file if exists + if (FilesController.FileExists(origItem.PackageId, packageFile)) + { + FilesController.DeleteFiles(origItem.PackageId, new string[] { packageFile }); + } + + byte[] buffer = null; + + int offset = 0; + do + { + // Read remote content. + buffer = hostedSharePointServer.Enterprise_GetTempFileBinaryChunk(backFile, offset, FILE_BUFFER_LENGTH); + + // Write remote content. + FilesController.AppendFileBinaryChunk(origItem.PackageId, packageFile, buffer); + + offset += FILE_BUFFER_LENGTH; + } + while (buffer.Length == FILE_BUFFER_LENGTH); + } + + return backFile; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + /// + /// Restores SharePoint site collection. + /// + /// Site collection id within metabase. + /// + /// + /// + public static int RestoreSiteCollection(int itemId, string uploadedFile, string packageFile) + { + // Check account. + int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); + if (accountCheck < 0) + { + return accountCheck; + } + + // Load original meta item. + SharePointSiteCollection origItem = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + if (origItem == null) + { + return BusinessErrorCodes.ERROR_SHAREPOINT_PACKAGE_ITEM_NOT_FOUND; + } + + // Check package. + int packageCheck = SecurityContext.CheckPackage(origItem.PackageId, DemandPackage.IsActive); + if (packageCheck < 0) + { + return packageCheck; + } + + // Log operation. + TaskManager.StartTask("HOSTED_SHAREPOINT_ENTERPRISE", "BACKUP_SITE_COLLECTION", origItem.Name, itemId); + + try + { + // Create site collection on server. + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(origItem.ServiceId); + + string backupFile = null; + if (!String.IsNullOrEmpty(packageFile)) + { + // Copy package files to the remote SharePoint Server. + string path = null; + byte[] buffer = null; + + int offset = 0; + do + { + // Read package file. + buffer = FilesController.GetFileBinaryChunk(origItem.PackageId, packageFile, offset, FILE_BUFFER_LENGTH); + + // Write remote backup file + string tempPath = hostedSharePointServer.Enterprise_AppendTempFileBinaryChunk(Path.GetFileName(packageFile), path, buffer); + if (path == null) + { + path = tempPath; + backupFile = path; + } + + offset += FILE_BUFFER_LENGTH; + } + while (buffer.Length == FILE_BUFFER_LENGTH); + } + else if (!String.IsNullOrEmpty(uploadedFile)) + { + // Upladed files. + backupFile = uploadedFile; + } + + // Restore. + if (!String.IsNullOrEmpty(backupFile)) + { + hostedSharePointServer.Enterprise_RestoreSiteCollection(origItem, backupFile); + } + + return 0; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + /// + /// Gets binary data chunk of specified size from specified offset. + /// + /// Item id to obtain realted service id. + /// Path to file to get bunary data chunk from. + /// Offset from which to start data reading. + /// Binary data chunk length. + /// Binary data chunk read from file. + public static byte[] GetBackupBinaryChunk(int itemId, string path, int offset, int length) + { + // Load original meta item. + SharePointSiteCollection item = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + if (item == null) + { + return null; + } + + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(item.ServiceId); + return hostedSharePointServer.Enterprise_GetTempFileBinaryChunk(path, offset, length); + } + + /// + /// Appends supplied binary data chunk to file. + /// + /// Item id to obtain realted service id. + /// Non existent file name to append to. + /// Full path to existent file to append to. + /// Binary data chunk to append to. + /// Path to file that was appended with chunk. + public static string AppendBackupBinaryChunk(int itemId, string fileName, string path, byte[] chunk) + { + // Load original meta item. + SharePointSiteCollection item = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + if (item == null) + { + return null; + } + + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(item.ServiceId); + return hostedSharePointServer.Enterprise_AppendTempFileBinaryChunk(fileName, path, chunk); + } + + /// + /// Initializes a new hosted SharePoint server proxy. + /// + /// Hosted SharePoint service id. + /// Hosted SharePoint server proxy. + private static HostedSharePointServerEnt GetHostedSharePointServer(int serviceId) + { + + HostedSharePointServerEnt sps = new HostedSharePointServerEnt(); + ServiceProviderProxy.Init(sps, serviceId); + return sps; + } + + /// + /// Gets list of importable items. + /// + /// Package that owns importable items. + /// Item type id. + /// Item type. + /// Item resource group. + /// List of importable item names. + public List GetImportableItems(int packageId, int itemTypeId, Type itemType, ResourceGroupInfo group) + { + List items = new List(); + + // Get service id + int serviceId = PackageController.GetPackageServiceId(packageId, group.GroupName); + if (serviceId == 0) + { + return items; + } + + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); + if (itemType == typeof(SharePointSiteCollection)) + { + foreach (SharePointSiteCollection siteCollection in hostedSharePointServer.Enterprise_GetSiteCollections()) + { + items.Add(siteCollection.Url); + } + } + + return items; + } + + /// + /// Imports selected item into metabase. + /// + /// Package to which items must be imported. + /// Item type id. + /// Item type. + /// Item resource group. + /// Item name to import. + public void ImportItem(int packageId, int itemTypeId, Type itemType, ResourceGroupInfo group, string itemName) + { + // Get service id + int serviceId = PackageController.GetPackageServiceId(packageId, group.GroupName); + if (serviceId == 0) + { + return; + } + + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); + if (itemType == typeof(SharePointSiteCollection)) + { + SharePointSiteCollection siteCollection = hostedSharePointServer.Enterprise_GetSiteCollection(itemName); + PackageController.AddPackageItem(siteCollection); + } + } + + /// + /// Backups service item by serializing it into supplied writer. + /// + /// Temporary directory path. + /// Xml wirter used to store backuped service provider items. + /// Service provider item to be backed up.. + /// Service provider resource group. + /// Resulting code. + public int BackupItem(string tempFolder, XmlWriter writer, ServiceProviderItem item, ResourceGroupInfo group) + { + SharePointSiteCollection siteCollection = item as SharePointSiteCollection; + if (siteCollection != null) + { + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(siteCollection.ServiceId); + SharePointSiteCollection loadedSiteCollection = hostedSharePointServer.Enterprise_GetSiteCollection(siteCollection.Url); + // Update item + siteCollection.Url = loadedSiteCollection.Url; + siteCollection.OwnerLogin = loadedSiteCollection.OwnerLogin; + siteCollection.OwnerName = loadedSiteCollection.OwnerName; + siteCollection.OwnerEmail = loadedSiteCollection.OwnerEmail; + siteCollection.LocaleId = loadedSiteCollection.LocaleId; + siteCollection.Title = loadedSiteCollection.Title; + siteCollection.Description = loadedSiteCollection.Description; + // Serialize it. + XmlSerializer serializer = new XmlSerializer(typeof(SharePointSiteCollection)); + serializer.Serialize(writer, siteCollection); + + } + return 0; + } + + /// + /// Restore backed up previously service provider item. + /// + /// Temporary directory path. + /// Serialized service provider item. + /// Service provider item id. + /// Service provider item type. + /// Service provider item name. + /// Service provider item package. + /// Service provider item service id. + /// Service provider item resource group. + /// Resulting code. + public int RestoreItem(string tempFolder, XmlNode itemNode, int itemId, Type itemType, string itemName, int packageId, int serviceId, ResourceGroupInfo group) + { + if (itemType == typeof(SharePointSiteCollection)) + { + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); + // Deserialize item. + XmlSerializer serializer = new XmlSerializer(typeof(SharePointSiteCollection)); + SharePointSiteCollection siteCollection = (SharePointSiteCollection)serializer.Deserialize(new XmlNodeReader(itemNode.SelectSingleNode("SharePointSiteCollection"))); + siteCollection.PackageId = packageId; + siteCollection.ServiceId = serviceId; + + // Create site collection if needed. + if (hostedSharePointServer.Enterprise_GetSiteCollection(siteCollection.Url) == null) + { + hostedSharePointServer.Enterprise_CreateSiteCollection(siteCollection); + } + + // Add metabase record if needed. + SharePointSiteCollection metaSiteCollection = (SharePointSiteCollection)PackageController.GetPackageItemByName(packageId, itemName, typeof(SharePointSiteCollection)); + if (metaSiteCollection == null) + { + PackageController.AddPackageItem(siteCollection); + } + } + + return 0; + } + + + private static int GetHostedSharePointServiceId(int packageId) + { + return PackageController.GetPackageServiceId(packageId, ResourceGroups.SharepointFoundationServer); + } + + private static List GetOrganizationSharePointSiteCollections(int orgId) + { + Organization org = OrganizationController.GetOrganization(orgId); + + SharePointSiteCollectionListPaged siteCollections = GetSiteCollectionsPaged(org.PackageId, org.Id, String.Empty, String.Empty, String.Empty, 0, Int32.MaxValue); + return siteCollections.SiteCollections; + } + + private static int RecalculateStorageMaxSize(int size, int packageId) + { + PackageContext cntx = PackageController.GetPackageContext(packageId); + QuotaValueInfo quota = cntx.Quotas[Quotas.HOSTED_SHAREPOINT_ENTERPRISE_STORAGE_SIZE]; + + if (quota.QuotaAllocatedValue == -1) + { + if (size == -1)//Unlimited + return -1; + else + return size; + } + else + { + if (size == -1) + return quota.QuotaAllocatedValue; + + return Math.Min(size, quota.QuotaAllocatedValue); + } + } + + private static int RecalculateMaxSize(int parentSize, int realSize) + { + if (parentSize == -1) + { + if (realSize == -1 || realSize == 0) + return -1; + else + return realSize; + } + + + if (realSize == -1 || realSize == 0) + return parentSize; + + return Math.Min(parentSize, realSize); + + } + + + public static int SetStorageSettings(int itemId, int maxStorage, int warningStorage, bool applyToSiteCollections) + { + // check account + int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); + if (accountCheck < 0) return accountCheck; + + // place log record + TaskManager.StartTask("HOSTED_SHAREPOINT_ENTERPRISE", "SET_ORG_LIMITS", itemId); + + try + { + Organization org = (Organization)PackageController.GetPackageItem(itemId); + if (org == null) + return 0; + + // set limits + int realMaxSizeValue = RecalculateStorageMaxSize(maxStorage, org.PackageId); + + org.MaxSharePointEnterpriseStorage = realMaxSizeValue; + + org.WarningSharePointEnterpriseStorage = realMaxSizeValue == -1 ? -1 : Math.Min(warningStorage, realMaxSizeValue); + + // save organization + UpdateOrganization(org); + + if (applyToSiteCollections) + { + int serviceId = GetHostedSharePointServiceId(org.PackageId); + + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); + + List currentOrgSiteCollection = + GetOrganizationSharePointSiteCollections(org.Id); + + + foreach (SharePointSiteCollection siteCollection in currentOrgSiteCollection) + { + try + { + SharePointSiteCollection sc = GetSiteCollection(siteCollection.Id); + sc.MaxSiteStorage = realMaxSizeValue; + sc.WarningStorage = realMaxSizeValue == -1 ? -1 : warningStorage; + PackageController.UpdatePackageItem(sc); + + hostedSharePointServer.Enterprise_UpdateQuotas(siteCollection.PhysicalAddress, realMaxSizeValue, + warningStorage); + } + catch (Exception ex) + { + TaskManager.WriteError(ex); + } + } + } + + return 0; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + + public static SharePointSiteDiskSpace[] CalculateSharePointSitesDiskSpace(int itemId, out int errorCode) + { + SharePointSiteDiskSpace[] retDiskSpace = null; + errorCode = 0; + // check account + int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); + if (accountCheck < 0) + { + errorCode = accountCheck; + return null; + } + + // place log record + TaskManager.StartTask("HOSTED_SHAREPOINT_ENTERPRISE", "CALCULATE_DISK_SPACE", itemId); + + try + { + Organization org = (Organization)PackageController.GetPackageItem(itemId); + if (org == null) + return null; + + int serviceId = GetHostedSharePointServiceId(org.PackageId); + + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); + + List currentOrgSiteCollection = + GetOrganizationSharePointSiteCollections(org.Id); + + List urls = new List(); + foreach (SharePointSiteCollection siteCollection in currentOrgSiteCollection) + { + urls.Add(siteCollection.PhysicalAddress); + } + if (urls.Count > 0) + retDiskSpace = hostedSharePointServer.Enterprise_CalculateSiteCollectionsDiskSpace(urls.ToArray()); + else + { + retDiskSpace = new SharePointSiteDiskSpace[1]; + retDiskSpace[0] = new SharePointSiteDiskSpace(); + retDiskSpace[0].DiskSpace = 0; + retDiskSpace[0].Url = string.Empty; + } + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + return retDiskSpace; + } + + private static void UpdateOrganization(Organization organization) + { + PackageController.UpdatePackageItem(organization); + } + + + public static void UpdateQuota(int itemId, int siteCollectionId, int maxStorage, int warningStorage) + { + TaskManager.StartTask("HOSTED_SHAREPOINT_ENTERPRISE", "UPDATE_QUOTA"); + try + { + Organization org = (Organization)PackageController.GetPackageItem(itemId); + if (org == null) + return; + + int serviceId = GetHostedSharePointServiceId(org.PackageId); + + HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); + + SharePointSiteCollection sc = GetSiteCollection(siteCollectionId); + + int maxSize = RecalculateMaxSize(org.MaxSharePointEnterpriseStorage, maxStorage); + int warningSize = warningStorage; + + + sc.MaxSiteStorage = maxSize; + sc.WarningStorage = maxSize == -1 ? -1 : Math.Min(warningSize, maxSize); + PackageController.UpdatePackageItem(sc); + + hostedSharePointServer.Enterprise_UpdateQuotas(sc.PhysicalAddress, maxSize, + warningStorage); + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + /// + /// Gets a value if caller is in demo mode. + /// + private static bool IsDemoMode + { + get + { + return (SecurityContext.CheckAccount(DemandAccount.NotDemo) < 0); + } + } + + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/WebsitePanel.EnterpriseServer.Code.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/WebsitePanel.EnterpriseServer.Code.csproj index 58c17bbf..19107f3d 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/WebsitePanel.EnterpriseServer.Code.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/WebsitePanel.EnterpriseServer.Code.csproj @@ -17,7 +17,7 @@ true full false - ..\..\Bin\ + ..\WebsitePanel.EnterpriseServer\bin\ DEBUG;TRACE prompt 4 @@ -26,7 +26,7 @@ pdbonly true - ..\..\Bin\ + ..\WebsitePanel.EnterpriseServer\bin\ TRACE prompt 4 @@ -163,6 +163,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj index c18d5220..6e3e5f97 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/WebsitePanel.EnterpriseServer.csproj @@ -68,16 +68,19 @@ - + + False ..\..\Bin\WebsitePanel.EnterpriseServer.Base.dll - + + False ..\..\Bin\WebsitePanel.EnterpriseServer.Code.dll - + + False ..\..\Bin\WebsitePanel.Providers.Base.dll - + False ..\..\Bin\WebsitePanel.Server.Client.dll @@ -120,6 +123,7 @@ + @@ -164,6 +168,10 @@ esEnterpriseStorage.asmx Component + + esHostedSharePointServersEnt.asmx + Component + esRemoteDesktopServices.asmx Component diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs index c99bee6a..2468333c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs @@ -59,10 +59,10 @@ namespace WebsitePanel.EnterpriseServer /// Site collections in raw format. [WebMethod] public SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, - string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName) + string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { return HostedSharePointServerController.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, - sortColumn, startRow, maximumRows, groupName); + sortColumn, startRow, maximumRows); } /// @@ -83,9 +83,9 @@ namespace WebsitePanel.EnterpriseServer /// Resource group name. /// List of found site collections. [WebMethod] - public List GetSiteCollections(int packageId, bool recursive, string groupName) + public List GetSiteCollections(int packageId, bool recursive) { - return HostedSharePointServerController.GetSiteCollections(packageId, recursive, groupName); + return HostedSharePointServerController.GetSiteCollections(packageId, recursive); } [WebMethod] @@ -116,7 +116,7 @@ namespace WebsitePanel.EnterpriseServer public SharePointSiteCollection GetSiteCollectionByDomain(int organizationId, string domain) { DomainInfo domainInfo = ServerController.GetDomain(domain); - SharePointSiteCollectionListPaged existentSiteCollections = this.GetSiteCollectionsPaged(domainInfo.PackageId, organizationId, "ItemName", String.Format("%{0}", domain), String.Empty, 0, Int32.MaxValue, null); + SharePointSiteCollectionListPaged existentSiteCollections = this.GetSiteCollectionsPaged(domainInfo.PackageId, organizationId, "ItemName", String.Format("%{0}", domain), String.Empty, 0, Int32.MaxValue); foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) { Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); @@ -136,9 +136,9 @@ namespace WebsitePanel.EnterpriseServer /// Resource group name. /// Created site collection id within metabase. [WebMethod] - public int AddSiteCollection(SharePointSiteCollection item, string groupName) + public int AddSiteCollection(SharePointSiteCollection item) { - return HostedSharePointServerController.AddSiteCollection(item, groupName); + return HostedSharePointServerController.AddSiteCollection(item); } /// diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx new file mode 100644 index 00000000..394c337c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx @@ -0,0 +1 @@ +<%@ WebService Language="C#" CodeBehind="esHostedSharePointServersEnt.asmx.cs" Class="WebsitePanel.EnterpriseServer.esHostedSharePointServers" %> diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs new file mode 100644 index 00000000..e5b51f35 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs @@ -0,0 +1,237 @@ +// 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.Collections.Generic; +using System.ComponentModel; +using System.Web.Services; +using WebsitePanel.EnterpriseServer.Code.SharePoint; +using WebsitePanel.Providers.SharePoint; +using Microsoft.Web.Services3; + +namespace WebsitePanel.EnterpriseServer +{ + /// + /// Summary description for esHostedSharePointServers + /// + [WebService(Namespace = "http://smbsaas/websitepanel/enterpriseserver")] + [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] + [Policy("ServerPolicy")] + [ToolboxItem(false)] + public class esHostedSharePointServersEnt : WebService + { + /// + /// Gets site collections in raw form. + /// + /// Package to which desired site collections belong. + /// Organization to which desired site collections belong. + /// Filter column name. + /// Filter value. + /// Sort column name. + /// Row index to start from. + /// Maximum number of rows to retrieve. + /// Resource group name. + /// Site collections in raw format. + [WebMethod] + public SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, + string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + { + return HostedSharePointServerEntController.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, + sortColumn, startRow, maximumRows); + } + + /// + /// Gets list of supported languages by this installation of SharePoint. + /// + /// List of supported languages + [WebMethod] + public int[] GetSupportedLanguages(int packageId) + { + return HostedSharePointServerEntController.GetSupportedLanguages(packageId); + } + + /// + /// Gets list of SharePoint site collections that belong to the package. + /// + /// Package that owns site collections. + /// A value which shows whether nested spaces must be searched as well. + /// Resource group name. + /// List of found site collections. + [WebMethod] + public List GetSiteCollections(int packageId, bool recursive) + { + return HostedSharePointServerEntController.GetSiteCollections(packageId, recursive); + } + + [WebMethod] + public int SetStorageSettings(int itemId, int maxStorage, int warningStorage, bool applyToSiteCollections) + { + return HostedSharePointServerEntController.SetStorageSettings(itemId, maxStorage, warningStorage, applyToSiteCollections ); + } + + /// + /// Gets SharePoint site collection with given id. + /// + /// Site collection id within metabase. + /// Site collection. + [WebMethod] + public SharePointSiteCollection GetSiteCollection(int itemId) + { + return HostedSharePointServerEntController.GetSiteCollection(itemId); + } + + /// + /// Gets SharePoint site collection from package under organization with given domain. + /// + /// Package id. + /// Organization id. + /// Domain name. + /// SharePoint site collection or null. + [WebMethod] + public SharePointSiteCollection GetSiteCollectionByDomain(int organizationId, string domain) + { + DomainInfo domainInfo = ServerController.GetDomain(domain); + SharePointSiteCollectionListPaged existentSiteCollections = this.GetSiteCollectionsPaged(domainInfo.PackageId, organizationId, "ItemName", String.Format("%{0}", domain), String.Empty, 0, Int32.MaxValue); + foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) + { + Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); + if (existentSiteCollection.Name == String.Format("{0}://{1}", existentSiteCollectionUri.Scheme, domain)) + { + return existentSiteCollection; + } + } + + return null; + } + + /// + /// Adds SharePoint site collection. + /// + /// Site collection description. + /// Resource group name. + /// Created site collection id within metabase. + [WebMethod] + public int AddSiteCollection(SharePointSiteCollection item) + { + return HostedSharePointServerEntController.AddSiteCollection(item); + } + + /// + /// Deletes SharePoint site collection with given id. + /// + /// Site collection id within metabase. + /// ? + [WebMethod] + public int DeleteSiteCollection(int itemId) + { + return HostedSharePointServerEntController.DeleteSiteCollection(itemId); + } + + /// + /// Deletes SharePoint site collections which belong to organization. + /// + /// Site collection id within metabase. + /// ? + [WebMethod] + public int DeleteSiteCollections(int organizationId) + { + HostedSharePointServerEntController.DeleteSiteCollections(organizationId); + return 0; + } + + + /// + /// Backups SharePoint site collection. + /// + /// Site collection id within metabase. + /// Backed up site collection file name. + /// A value which shows whether back up must be archived. + /// A value which shows whether created back up must be downloaded. + /// Local folder to store downloaded backup. + /// Created backup file name. + [WebMethod] + public string BackupSiteCollection(int itemId, string fileName, bool zipBackup, bool download, string folderName) + { + return HostedSharePointServerEntController.BackupSiteCollection(itemId, fileName, zipBackup, download, folderName); + } + + /// + /// Restores SharePoint site collection. + /// + /// Site collection id within metabase. + /// + /// + /// + [WebMethod] + public int RestoreSiteCollection(int itemId, string uploadedFile, string packageFile) + { + return HostedSharePointServerEntController.RestoreSiteCollection(itemId, uploadedFile, packageFile); + } + + /// + /// Gets binary data chunk of specified size from specified offset. + /// + /// Item id to obtain realted service id. + /// Path to file to get bunary data chunk from. + /// Offset from which to start data reading. + /// Binary data chunk length. + /// Binary data chunk read from file. + [WebMethod] + public byte[] GetBackupBinaryChunk(int itemId, string path, int offset, int length) + { + return HostedSharePointServerEntController.GetBackupBinaryChunk(itemId, path, offset, length); + } + + /// + /// Appends supplied binary data chunk to file. + /// + /// Item id to obtain realted service id. + /// Non existent file name to append to. + /// Full path to existent file to append to. + /// Binary data chunk to append to. + /// Path to file that was appended with chunk. + [WebMethod] + public string AppendBackupBinaryChunk(int itemId, string fileName, string path, byte[] chunk) + { + return HostedSharePointServerEntController.AppendBackupBinaryChunk(itemId, fileName, path, chunk); + } + + [WebMethod] + public SharePointSiteDiskSpace[] CalculateSharePointSitesDiskSpace(int itemId, out int errorCode) + { + return HostedSharePointServerEntController.CalculateSharePointSitesDiskSpace(itemId, out errorCode); + } + + + [WebMethod] + public void UpdateQuota(int itemId, int siteCollectionId, int maxSize, int warningSize) + { + HostedSharePointServerEntController.UpdateQuota(itemId, siteCollectionId, maxSize, warningSize); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/Organization.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/Organization.cs index 69b3f2c7..f88314b1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/Organization.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/Organization.cs @@ -61,6 +61,9 @@ namespace WebsitePanel.Providers.HostedSolution private int maxSharePointStorage; private int warningSharePointStorage; + private int maxSharePointEnterpriseStorage; + private int warningSharePointEnterpriseStorage; + #endregion [Persistent] @@ -80,6 +83,19 @@ namespace WebsitePanel.Providers.HostedSolution set { warningSharePointStorage = value; } } + public int MaxSharePointEnterpriseStorage + { + get { return maxSharePointEnterpriseStorage; } + set { maxSharePointEnterpriseStorage = value; } + } + + [Persistent] + public int WarningSharePointEnterpriseStorage + { + get { return warningSharePointEnterpriseStorage; } + set { warningSharePointEnterpriseStorage = value; } + } + [Persistent] public string CrmUrl { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs index 56923206..eddf97ed 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/OrganizationStatistics.cs @@ -61,6 +61,9 @@ namespace WebsitePanel.Providers.HostedSolution private int allocatedSharePointSiteCollections; private int createdSharePointSiteCollections; + private int allocatedSharePointEnterpriseSiteCollections; + private int createdSharePointEnterpriseSiteCollections; + private int createdCRMUsers; private int allocatedCRMUsers; @@ -288,6 +291,18 @@ namespace WebsitePanel.Providers.HostedSolution set { createdSharePointSiteCollections = value; } } + public int AllocatedSharePointEnterpriseSiteCollections + { + get { return allocatedSharePointEnterpriseSiteCollections; } + set { allocatedSharePointEnterpriseSiteCollections = value; } + } + + public int CreatedSharePointEnterpriseSiteCollections + { + get { return createdSharePointEnterpriseSiteCollections; } + set { createdSharePointEnterpriseSiteCollections = value; } + } + public int CreatedBlackBerryUsers { get; set; } public int AllocatedBlackBerryUsers { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/IHostedSharePointServerEnt.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/IHostedSharePointServerEnt.cs new file mode 100644 index 00000000..4bc6f8ee --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/IHostedSharePointServerEnt.cs @@ -0,0 +1,120 @@ +// 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; + +namespace WebsitePanel.Providers.SharePoint +{ + /// + /// Exposes functionality for share point server provider hosted in conjunction with organization management provider and + /// exchange server. + /// + public interface IHostedSharePointServerEnt + { + /// + /// When implemented gets root web application uri. + /// + Uri Enterprise_RootWebApplicationUri + { + get; + } + + /// + /// When implemented gets list of supported languages by this installation of SharePoint. + /// + /// List of supported languages + int[] Enterprise_GetSupportedLanguages(); + + /// + /// When implemented gets list of SharePoint collections within root web application. + /// + /// List of SharePoint collections within root web application. + SharePointSiteCollection[] Enterprise_GetSiteCollections(); + + /// + /// When implemented gets SharePoint collection within root web application with given name. + /// + /// Url that uniquely identifies site collection to be loaded. + /// SharePoint collection within root web application with given name. + SharePointSiteCollection Enterprise_GetSiteCollection(string url); + + /// + /// When implemented creates site collection within predefined root web application. + /// + /// Information about site coolection to be created. + void Enterprise_CreateSiteCollection(SharePointSiteCollection siteCollection); + + /// + /// When implemented deletes site collection under given url. + /// + /// Url that uniquely identifies site collection to be deleted. + void Enterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection); + + /// + /// When implemeneted backups site collection under give url. + /// + /// Url that uniquely identifies site collection to be deleted. + /// Resulting backup file name. + /// A value which shows whether created backup must be archived. + /// Created backup full path. + string Enterprise_BackupSiteCollection(string url, string filename, bool zip); + + /// + /// When implemented restores site collection under given url from backup. + /// + /// Site collection to be restored. + /// Backup file name to restore from. + void Enterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename); + + /// + /// When implemented gets binary data chunk of specified size from specified offset. + /// + /// Path to file to get bunary data chunk from. + /// Offset from which to start data reading. + /// Binary data chunk length. + /// Binary data chunk read from file. + byte[] Enterprise_GetTempFileBinaryChunk(string path, int offset, int length); + + /// + /// When implemented appends supplied binary data chunk to file. + /// + /// Non existent file name to append to. + /// Full path to existent file to append to. + /// Binary data chunk to append to. + /// Path to file that was appended with chunk. + string Enterprise_AppendTempFileBinaryChunk(string fileName, string path, byte[] chunk); + + void Enterprise_UpdateQuotas(string url, long maxStorage, long warningStorage); + + SharePointSiteDiskSpace[] Enterprise_CalculateSiteCollectionsDiskSpace(string[] urls); + + long Enterprise_GetSiteCollectionSize(string url); + + void Enterprise_SetPeoplePickerOu(string site, string ou); + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index e72359e6..2dec0c17 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -280,6 +280,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013Ent.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013Ent.cs new file mode 100644 index 00000000..d9e93497 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013Ent.cs @@ -0,0 +1,352 @@ +// 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.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using System.Xml; +using Microsoft.Win32; +using WebsitePanel.Providers.SharePoint; +using WebsitePanel.Providers.Utils; +using WebsitePanel.Server.Utils; + +namespace WebsitePanel.Providers.HostedSolution +{ + /// + /// Provides hosted SharePoint server functionality implementation. + /// + public class HostedSharePointServer2013Ent : HostingServiceProviderBase, IHostedSharePointServerEnt + { + #region Delegate + + private delegate TReturn SharePointAction(HostedSharePointServer2013EntImpl impl); + + #endregion + + #region Fields + + protected string LanguagePacksPath; + protected string Wss3Registry32Key; + protected string Wss3RegistryKey; + + #endregion + + #region Properties + + public string BackupTemporaryFolder + { + get { return ProviderSettings["BackupTemporaryFolder"]; } + } + + public Uri Enterprise_RootWebApplicationUri + { + get { return new Uri(ProviderSettings["RootWebApplicationUri"]); } + } + + #endregion + + #region Constructor + + public HostedSharePointServer2013Ent() + { + Wss3RegistryKey = @"SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0"; + Wss3Registry32Key = @"SOFTWARE\Wow6432Node\Microsoft\Shared Tools\Web Server Extensions\15.0"; + LanguagePacksPath = @"%commonprogramfiles%\microsoft shared\Web Server Extensions\15\HCCab\"; + } + + #endregion + + #region Methods + + /// Gets list of supported languages by this installation of SharePoint. + /// List of supported languages + public int[] Enterprise_GetSupportedLanguages() + { + var impl = new HostedSharePointServer2013EntImpl(); + return impl.GetSupportedLanguages(Enterprise_RootWebApplicationUri); + } + + /// Gets list of SharePoint collections within root web application. + /// List of SharePoint collections within root web application. + public SharePointSiteCollection[] Enterprise_GetSiteCollections() + { + return ExecuteSharePointAction(impl => impl.GetSiteCollections(Enterprise_RootWebApplicationUri)); + } + + /// Gets SharePoint collection within root web application with given name. + /// Url that uniquely identifies site collection to be loaded. + /// SharePoint collection within root web application with given name. + public SharePointSiteCollection Enterprise_GetSiteCollection(string url) + { + return ExecuteSharePointAction(impl => impl.GetSiteCollection(Enterprise_RootWebApplicationUri, url)); + } + + /// Creates site collection within predefined root web application. + /// Information about site coolection to be created. + public void Enterprise_CreateSiteCollection(SharePointSiteCollection siteCollection) + { + ExecuteSharePointAction(delegate(HostedSharePointServer2013EntImpl impl) + { + impl.CreateSiteCollection(Enterprise_RootWebApplicationUri, siteCollection); + return null; + }); + } + + /// Deletes site collection under given url. + /// The site collection to be deleted. + public void Enterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection) + { + ExecuteSharePointAction(delegate(HostedSharePointServer2013EntImpl impl) + { + impl.DeleteSiteCollection(Enterprise_RootWebApplicationUri, siteCollection); + return null; + }); + } + + /// Backups site collection under give url. + /// Url that uniquely identifies site collection to be deleted. + /// Resulting backup file name. + /// A value which shows whether created backup must be archived. + /// Created backup full path. + public string Enterprise_BackupSiteCollection(string url, string filename, bool zip) + { + return ExecuteSharePointAction(impl => impl.BackupSiteCollection(Enterprise_RootWebApplicationUri, url, filename, zip, BackupTemporaryFolder)); + } + + /// Restores site collection under given url from backup. + /// Site collection to be restored. + /// Backup file name to restore from. + public void Enterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename) + { + ExecuteSharePointAction(delegate(HostedSharePointServer2013EntImpl impl) + { + impl.RestoreSiteCollection(Enterprise_RootWebApplicationUri, siteCollection, filename); + return null; + }); + } + + /// Gets binary data chunk of specified size from specified offset. + /// Path to file to get bunary data chunk from. + /// Offset from which to start data reading. + /// Binary data chunk length. + /// Binary data chunk read from file. + public virtual byte[] Enterprise_GetTempFileBinaryChunk(string path, int offset, int length) + { + byte[] buffer = FileUtils.GetFileBinaryChunk(path, offset, length); + + if (buffer.Length < length) + { + FileUtils.DeleteFile(path); + } + + return buffer; + } + + /// Appends supplied binary data chunk to file. + /// Non existent file name to append to. + /// Full path to existent file to append to. + /// Binary data chunk to append to. + /// Path to file that was appended with chunk. + public virtual string Enterprise_AppendTempFileBinaryChunk(string fileName, string path, byte[] chunk) + { + if (path == null) + { + path = Path.Combine(Path.GetTempPath(), fileName); + if (FileUtils.FileExists(path)) + { + FileUtils.DeleteFile(path); + } + } + + FileUtils.AppendFileBinaryContent(path, chunk); + + return path; + } + + public void Enterprise_UpdateQuotas(string url, long maxStorage, long warningStorage) + { + ExecuteSharePointAction(delegate(HostedSharePointServer2013EntImpl impl) + { + impl.UpdateQuotas(Enterprise_RootWebApplicationUri, url, maxStorage, warningStorage); + return null; + }); + } + + public SharePointSiteDiskSpace[] Enterprise_CalculateSiteCollectionsDiskSpace(string[] urls) + { + return ExecuteSharePointAction(impl => impl.CalculateSiteCollectionDiskSpace(Enterprise_RootWebApplicationUri, urls)); + } + + public long Enterprise_GetSiteCollectionSize(string url) + { + return ExecuteSharePointAction(impl => impl.GetSiteCollectionSize(Enterprise_RootWebApplicationUri, url)); + } + + public void Enterprise_SetPeoplePickerOu(string site, string ou) + { + ExecuteSharePointAction(delegate(HostedSharePointServer2013EntImpl impl) + { + impl.SetPeoplePickerOu(site, ou); + return null; + }); + } + + + public override bool IsInstalled() + { + return IsSharePointInstalled(); + } + + /// Deletes service items that represent SharePoint site collection. + /// Items to be deleted. + public override void DeleteServiceItems(ServiceProviderItem[] items) + { + foreach (ServiceProviderItem item in items) + { + var sharePointSiteCollection = item as SharePointSiteCollection; + + if (sharePointSiteCollection != null) + { + try + { + Enterprise_DeleteSiteCollection(sharePointSiteCollection); + } + catch (Exception ex) + { + Log.WriteError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex); + } + } + } + } + + /// Calculates diskspace used by supplied service items. + /// Service items to get diskspace usage for. + /// Calculated disk space usage statistics. + public override ServiceProviderItemDiskSpace[] GetServiceItemsDiskSpace(ServiceProviderItem[] items) + { + var itemsDiskspace = new List(); + + foreach (ServiceProviderItem item in items) + { + if (item is SharePointSiteCollection) + { + try + { + Log.WriteStart(String.Format("Calculating '{0}' site logs size", item.Name)); + + SharePointSiteCollection site = Enterprise_GetSiteCollection(item.Name); + var diskspace = new ServiceProviderItemDiskSpace { ItemId = item.Id, DiskSpace = site.Diskspace }; + itemsDiskspace.Add(diskspace); + + Log.WriteEnd(String.Format("Calculating '{0}' site logs size", item.Name)); + } + catch (Exception ex) + { + Log.WriteError(ex); + } + } + } + + return itemsDiskspace.ToArray(); + } + + /// Checks whether SharePoint 2013 is installed. + /// true - if it is installed; false - otherwise. + private bool IsSharePointInstalled() + { + RegistryKey spKey = Registry.LocalMachine.OpenSubKey(Wss3RegistryKey); + RegistryKey spKey32 = Registry.LocalMachine.OpenSubKey(Wss3Registry32Key); + + if (spKey == null && spKey32 == null) + { + return false; + } + + var spVal = (string)spKey.GetValue("SharePoint"); + + return (String.Compare(spVal, "installed", true) == 0); + } + + /// Executes supplied action within separate application domain. + /// Action to be executed. + /// Any object that results from action execution or null if nothing is supposed to be returned. + /// Is thrown in case supplied action is null. + private static TReturn ExecuteSharePointAction(SharePointAction action) + { + if (action == null) + { + throw new ArgumentNullException("action"); + } + + AppDomain domain = null; + + try + { + Type type = typeof(HostedSharePointServer2013EntImpl); + var info = new AppDomainSetup { ApplicationBase = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory), PrivateBinPath = GetPrivateBinPath() }; + domain = AppDomain.CreateDomain("WSS30", null, info); + var impl = (HostedSharePointServer2013EntImpl)domain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName); + + return action(impl); + } + finally + { + if (domain != null) + { + AppDomain.Unload(domain); + } + } + + throw new ArgumentNullException("action"); + } + + /// Getting PrivatePath from web.config. + /// The PrivateBinPath. + private static string GetPrivateBinPath() + { + var lines = new List { "bin", "bin/debug" }; + string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "web.config"); + + if (File.Exists(path)) + { + using (var reader = new StreamReader(path)) + { + string content = reader.ReadToEnd(); + var pattern = new Regex(@"(?<=probing .*?privatePath\s*=\s*"")[^""]+(?="".*?>)"); + Match match = pattern.Match(content); + lines.AddRange(match.Value.Split(';')); + } + } + + return string.Join(Path.PathSeparator.ToString(), lines.ToArray()); + } + + #endregion + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013EntImpl.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013EntImpl.cs new file mode 100644 index 00000000..ce92d7b2 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013EntImpl.cs @@ -0,0 +1,851 @@ +// 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.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Management.Automation.Runspaces; +using System.Security.Principal; +using Microsoft.SharePoint; +using Microsoft.SharePoint.Administration; +using WebsitePanel.Providers.SharePoint; +using WebsitePanel.Providers.Utils; + +namespace WebsitePanel.Providers.HostedSolution +{ + public class HostedSharePointServer2013EntImpl : MarshalByRefObject + { + #region Fields + + private static RunspaceConfiguration runspaceConfiguration; + + #endregion + + #region Properties + + private string SharepointSnapInName + { + get { return "Microsoft.SharePoint.Powershell"; } + } + + #endregion + + #region Methods + + /// Gets list of SharePoint collections within root web application. + /// The root web application Uri. + /// List of SharePoint collections within root web application. + public SharePointSiteCollection[] GetSiteCollections(Uri rootWebApplicationUri) + { + return GetSPSiteCollections(rootWebApplicationUri).Select(pair => NewSiteCollection(pair.Value)).ToArray(); + } + + /// Gets list of supported languages by this installation of SharePoint. + /// The root web application Uri. + /// List of supported languages + public int[] GetSupportedLanguages(Uri rootWebApplicationUri) + { + var languages = new List(); + + try + { + WindowsImpersonationContext wic = WindowsIdentity.GetCurrent().Impersonate(); + + try + { + languages.AddRange(from SPLanguage lang in SPRegionalSettings.GlobalInstalledLanguages select lang.LCID); + } + finally + { + wic.Undo(); + } + } + catch (Exception ex) + { + throw new InvalidOperationException("Failed to create site collection.", ex); + } + + return languages.ToArray(); + } + + /// Gets site collection size in bytes. + /// The root web application uri. + /// The site collection url. + /// Size in bytes. + public long GetSiteCollectionSize(Uri rootWebApplicationUri, string url) + { + Dictionary sizes = GetSitesCollectionSize(rootWebApplicationUri, new[] {url}); + + if (sizes.Count() == 1) + { + return sizes.First().Value; + } + + throw new ApplicationException(string.Format("SiteCollection {0} does not exist", url)); + } + + /// Gets sites disk space. + /// The root web application uri. + /// The sites urls. + /// The disk space. + public SharePointSiteDiskSpace[] CalculateSiteCollectionDiskSpace(Uri rootWebApplicationUri, string[] urls) + { + return GetSitesCollectionSize(rootWebApplicationUri, urls).Select(pair => new SharePointSiteDiskSpace {Url = pair.Key, DiskSpace = (long) Math.Round(pair.Value/1024.0/1024.0)}).ToArray(); + } + + /// Calculates size of the required seti collections. + /// The root web application uri. + /// The sites urls. + /// Calculated sizes. + private Dictionary GetSitesCollectionSize(Uri rootWebApplicationUri, IEnumerable urls) + { + Runspace runspace = null; + var result = new Dictionary(); + + try + { + runspace = OpenRunspace(); + + foreach (string url in urls) + { + string siteCollectionUrl = String.Format("{0}:{1}", url, rootWebApplicationUri.Port); + var scripts = new List {string.Format("$site=Get-SPSite -Identity \"{0}\"", siteCollectionUrl), "$site.RecalculateStorageUsed()", "$site.Usage.Storage"}; + Collection scriptResult = ExecuteShellCommand(runspace, scripts); + + if (scriptResult != null && scriptResult.Any()) + { + result.Add(url, Convert.ToInt64(scriptResult.First().BaseObject)); + } + } + } + finally + { + CloseRunspace(runspace); + } + + return result; + } + + /// Sets people picker OU. + /// The site. + /// OU. + public void SetPeoplePickerOu(string site, string ou) + { + HostedSolutionLog.LogStart("SetPeoplePickerOu"); + HostedSolutionLog.LogInfo(" Site: {0}", site); + HostedSolutionLog.LogInfo(" OU: {0}", ou); + + Runspace runspace = null; + + try + { + runspace = OpenRunspace(); + var cmd = new Command("Set-SPSite"); + cmd.Parameters.Add("Identity", site); + cmd.Parameters.Add("UserAccountDirectoryPath", ou); + ExecuteShellCommand(runspace, cmd); + } + finally + { + CloseRunspace(runspace); + } + + HostedSolutionLog.LogEnd("SetPeoplePickerOu"); + } + + /// Gets SharePoint collection within root web application with given name. + /// Root web application uri. + /// Url that uniquely identifies site collection to be loaded. + /// SharePoint collection within root web application with given name. + public SharePointSiteCollection GetSiteCollection(Uri rootWebApplicationUri, string url) + { + return NewSiteCollection(GetSPSiteCollection(rootWebApplicationUri, url)); + } + + /// Deletes quota. + /// The quota name. + private static void DeleteQuotaTemplate(string name) + { + SPFarm farm = SPFarm.Local; + + var webService = farm.Services.GetValue(""); + SPQuotaTemplateCollection quotaColl = webService.QuotaTemplates; + quotaColl.Delete(name); + } + + /// Updates site collection quota. + /// The root uri. + /// The site collection url. + /// The max storage. + /// The warning storage value. + public void UpdateQuotas(Uri root, string url, long maxStorage, long warningStorage) + { + if (maxStorage != -1) + { + maxStorage = maxStorage*1024*1024; + } + else + { + maxStorage = 0; + } + + if (warningStorage != -1 && maxStorage != -1) + { + warningStorage = Math.Min(warningStorage, maxStorage)*1024*1024; + } + else + { + warningStorage = 0; + } + + Runspace runspace = null; + + try + { + runspace = OpenRunspace(); + GrantAccess(runspace, root); + string siteCollectionUrl = String.Format("{0}:{1}", url, root.Port); + var command = new Command("Set-SPSite"); + command.Parameters.Add("Identity", siteCollectionUrl); + command.Parameters.Add("MaxSize", maxStorage); + command.Parameters.Add("WarningSize", warningStorage); + ExecuteShellCommand(runspace, command); + } + finally + { + CloseRunspace(runspace); + } + } + + /// Grants acces to current user. + /// The runspace. + /// The root web application uri. + private void GrantAccess(Runspace runspace, Uri rootWebApplicationUri) + { + ExecuteShellCommand(runspace, new List {string.Format("$webApp=Get-SPWebApplication {0}", rootWebApplicationUri.AbsoluteUri), string.Format("$webApp.GrantAccessToProcessIdentity(\"{0}\")", WindowsIdentity.GetCurrent().Name)}); + } + + /// Deletes site collection. + /// The runspace. + /// The site collection url. + /// True - if active directory accounts should be deleted. + private void DeleteSiteCollection(Runspace runspace, string url, bool deleteADAccounts) + { + var command = new Command("Remove-SPSite"); + command.Parameters.Add("Identity", url); + command.Parameters.Add("DeleteADAccounts", deleteADAccounts); + ExecuteShellCommand(runspace, command); + } + + /// Creates site collection within predefined root web application. + /// Root web application uri. + /// Information about site coolection to be created. + /// Is thrown in case requested operation fails for any reason. + public void CreateSiteCollection(Uri rootWebApplicationUri, SharePointSiteCollection siteCollection) + { + HostedSolutionLog.LogStart("CreateSiteCollection"); + WindowsImpersonationContext wic = null; + Runspace runspace = null; + + try + { + wic = WindowsIdentity.GetCurrent().Impersonate(); + runspace = OpenRunspace(); + CreateCollection(runspace, rootWebApplicationUri, siteCollection); + } + finally + { + CloseRunspace(runspace); + HostedSolutionLog.LogEnd("CreateSiteCollection"); + + if (wic != null) + { + wic.Undo(); + } + } + } + + /// Creates site collection within predefined root web application. + /// The runspace. + /// Root web application uri. + /// Information about site coolection to be created. + /// Is thrown in case requested operation fails for any reason. + private void CreateCollection(Runspace runspace, Uri rootWebApplicationUri, SharePointSiteCollection siteCollection) + { + string siteCollectionUrl = String.Format("{0}:{1}", siteCollection.Url, rootWebApplicationUri.Port); + HostedSolutionLog.DebugInfo("siteCollectionUrl: {0}", siteCollectionUrl); + + try + { + SPWebApplication rootWebApplication = SPWebApplication.Lookup(rootWebApplicationUri); + rootWebApplication.Sites.Add(siteCollectionUrl, siteCollection.Title, siteCollection.Description, (uint) siteCollection.LocaleId, String.Empty, siteCollection.OwnerLogin, siteCollection.OwnerName, siteCollection.OwnerEmail, null, null, null, true); + rootWebApplication.Update(); + } + catch (Exception) + { + DeleteSiteCollection(runspace, siteCollectionUrl, true); + throw; + } + + try + { + GrantAccess(runspace, rootWebApplicationUri); + var command = new Command("Set-SPSite"); + command.Parameters.Add("Identity", siteCollectionUrl); + + if (siteCollection.MaxSiteStorage != -1) + { + command.Parameters.Add("MaxSize", siteCollection.MaxSiteStorage*1024*1024); + } + + if (siteCollection.WarningStorage != -1 && siteCollection.MaxSiteStorage != -1) + { + command.Parameters.Add("WarningSize", Math.Min(siteCollection.WarningStorage, siteCollection.MaxSiteStorage)*1024*1024); + } + + ExecuteShellCommand(runspace, command); + } + catch (Exception) + { + DeleteQuotaTemplate(siteCollection.Title); + DeleteSiteCollection(runspace, siteCollectionUrl, true); + throw; + } + + AddHostsRecord(siteCollection); + } + + /// Deletes site collection under given url. + /// Root web application uri. + /// The site collection to be deleted. + /// Is thrown in case requested operation fails for any reason. + public void DeleteSiteCollection(Uri rootWebApplicationUri, SharePointSiteCollection siteCollection) + { + HostedSolutionLog.LogStart("DeleteSiteCollection"); + Runspace runspace = null; + + try + { + string siteCollectionUrl = String.Format("{0}:{1}", siteCollection.Url, rootWebApplicationUri.Port); + HostedSolutionLog.DebugInfo("siteCollectionUrl: {0}", siteCollectionUrl); + runspace = OpenRunspace(); + DeleteSiteCollection(runspace, siteCollectionUrl, false); + RemoveHostsRecord(siteCollection); + } + catch (Exception ex) + { + throw new InvalidOperationException("Failed to delete site collection.", ex); + } + finally + { + CloseRunspace(runspace); + HostedSolutionLog.LogEnd("DeleteSiteCollection"); + } + } + + /// Backups site collection under give url. + /// Root web application uri. + /// Url that uniquely identifies site collection to be deleted. + /// Resulting backup file name. + /// A value which shows whether created backup must be archived. + /// Custom temp path for backup + /// Full path to created backup. + /// Is thrown in case requested operation fails for any reason. + public string BackupSiteCollection(Uri rootWebApplicationUri, string url, string filename, bool zip, string tempPath) + { + try + { + string siteCollectionUrl = String.Format("{0}:{1}", url, rootWebApplicationUri.Port); + HostedSolutionLog.LogStart("BackupSiteCollection"); + HostedSolutionLog.DebugInfo("siteCollectionUrl: {0}", siteCollectionUrl); + + if (String.IsNullOrEmpty(tempPath)) + { + tempPath = Path.GetTempPath(); + } + + string backupFileName = Path.Combine(tempPath, (zip ? StringUtils.CleanIdentifier(siteCollectionUrl) + ".bsh" : StringUtils.CleanIdentifier(filename))); + HostedSolutionLog.DebugInfo("backupFilePath: {0}", backupFileName); + Runspace runspace = null; + + try + { + runspace = OpenRunspace(); + var command = new Command("Backup-SPSite"); + command.Parameters.Add("Identity", siteCollectionUrl); + command.Parameters.Add("Path", backupFileName); + ExecuteShellCommand(runspace, command); + + if (zip) + { + string zipFile = Path.Combine(tempPath, filename); + string zipRoot = Path.GetDirectoryName(backupFileName); + + FileUtils.ZipFiles(zipFile, zipRoot, new[] {Path.GetFileName(backupFileName)}); + FileUtils.DeleteFile(backupFileName); + + backupFileName = zipFile; + } + + return backupFileName; + } + finally + { + CloseRunspace(runspace); + HostedSolutionLog.LogEnd("BackupSiteCollection"); + } + } + catch (Exception ex) + { + throw new InvalidOperationException("Failed to backup site collection.", ex); + } + } + + /// Restores site collection under given url from backup. + /// Root web application uri. + /// Site collection to be restored. + /// Backup file name to restore from. + /// Is thrown in case requested operation fails for any reason. + public void RestoreSiteCollection(Uri rootWebApplicationUri, SharePointSiteCollection siteCollection, string filename) + { + string url = siteCollection.Url; + + try + { + string siteCollectionUrl = String.Format("{0}:{1}", url, rootWebApplicationUri.Port); + HostedSolutionLog.LogStart("RestoreSiteCollection"); + HostedSolutionLog.DebugInfo("siteCollectionUrl: {0}", siteCollectionUrl); + + HostedSolutionLog.DebugInfo("backupFilePath: {0}", filename); + Runspace runspace = null; + + try + { + string tempPath = Path.GetTempPath(); + string expandedFile = filename; + + if (Path.GetExtension(filename).ToLower() == ".zip") + { + expandedFile = FileUtils.UnzipFiles(filename, tempPath)[0]; + + // Delete zip archive. + FileUtils.DeleteFile(filename); + } + + runspace = OpenRunspace(); + DeleteSiteCollection(runspace, siteCollectionUrl, false); + var command = new Command("Restore-SPSite"); + command.Parameters.Add("Identity", siteCollectionUrl); + command.Parameters.Add("Path", filename); + ExecuteShellCommand(runspace, command); + + command = new Command("Set-SPSite"); + command.Parameters.Add("Identity", siteCollectionUrl); + command.Parameters.Add("OwnerAlias", siteCollection.OwnerLogin); + ExecuteShellCommand(runspace, command); + + command = new Command("Set-SPUser"); + command.Parameters.Add("Identity", siteCollection.OwnerLogin); + command.Parameters.Add("Email", siteCollection.OwnerEmail); + command.Parameters.Add("DisplayName", siteCollection.Name); + ExecuteShellCommand(runspace, command); + + FileUtils.DeleteFile(expandedFile); + } + finally + { + CloseRunspace(runspace); + HostedSolutionLog.LogEnd("RestoreSiteCollection"); + } + } + catch (Exception ex) + { + throw new InvalidOperationException("Failed to restore site collection.", ex); + } + } + + /// Creates new site collection with information from administration object. + /// Administration object. + private static SharePointSiteCollection NewSiteCollection(SPSite site) + { + var siteUri = new Uri(site.Url); + string url = (siteUri.Port > 0) ? site.Url.Replace(String.Format(":{0}", siteUri.Port), String.Empty) : site.Url; + + return new SharePointSiteCollection {Url = url, OwnerLogin = site.Owner.LoginName, OwnerName = site.Owner.Name, OwnerEmail = site.Owner.Email, LocaleId = site.RootWeb.Locale.LCID, Title = site.RootWeb.Title, Description = site.RootWeb.Description, Bandwidth = site.Usage.Bandwidth, Diskspace = site.Usage.Storage, MaxSiteStorage = site.Quota.StorageMaximumLevel, WarningStorage = site.Quota.StorageWarningLevel}; + } + + /// Gets SharePoint sites collection. + /// The root web application uri. + /// The SharePoint sites. + private Dictionary GetSPSiteCollections(Uri rootWebApplicationUri) + { + Runspace runspace = null; + var collections = new Dictionary(); + + try + { + runspace = OpenRunspace(); + var cmd = new Command("Get-SPSite"); + cmd.Parameters.Add("WebApplication", rootWebApplicationUri.AbsoluteUri); + Collection result = ExecuteShellCommand(runspace, cmd); + + if (result != null) + { + foreach (PSObject psObject in result) + { + var spSite = psObject.BaseObject as SPSite; + + if (spSite != null) + { + collections.Add(spSite.Url, spSite); + } + } + } + } + finally + { + CloseRunspace(runspace); + } + + return collections; + } + + /// Gets SharePoint site collection. + /// The root web application uri. + /// The required site url. + /// The SharePoint sites. + private SPSite GetSPSiteCollection(Uri rootWebApplicationUri, string url) + { + Runspace runspace = null; + + try + { + string siteCollectionUrl = String.Format("{0}:{1}", url, rootWebApplicationUri.Port); + runspace = OpenRunspace(); + var cmd = new Command("Get-SPSite"); + cmd.Parameters.Add("Identity", siteCollectionUrl); + Collection result = ExecuteShellCommand(runspace, cmd); + + if (result != null && result.Count() == 1) + { + var spSite = result.First().BaseObject as SPSite; + + if (spSite == null) + { + throw new ApplicationException(string.Format("SiteCollection {0} does not exist", url)); + } + + return result.First().BaseObject as SPSite; + } + else + { + throw new ApplicationException(string.Format("SiteCollection {0} does not exist", url)); + } + } + catch (Exception ex) + { + HostedSolutionLog.LogError(ex); + throw; + } + finally + { + CloseRunspace(runspace); + } + } + + /// Opens PowerShell runspace. + /// The runspace. + private Runspace OpenRunspace() + { + HostedSolutionLog.LogStart("OpenRunspace"); + + if (runspaceConfiguration == null) + { + runspaceConfiguration = RunspaceConfiguration.Create(); + PSSnapInException exception; + runspaceConfiguration.AddPSSnapIn(SharepointSnapInName, out exception); + HostedSolutionLog.LogInfo("Sharepoint snapin loaded"); + + if (exception != null) + { + HostedSolutionLog.LogWarning("SnapIn error", exception); + } + } + + Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration); + runspace.Open(); + runspace.SessionStateProxy.SetVariable("ConfirmPreference", "none"); + HostedSolutionLog.LogEnd("OpenRunspace"); + + return runspace; + } + + /// Closes runspace. + /// The runspace. + private void CloseRunspace(Runspace runspace) + { + try + { + if (runspace != null && runspace.RunspaceStateInfo.State == RunspaceState.Opened) + { + runspace.Close(); + } + } + catch (Exception ex) + { + HostedSolutionLog.LogError("Runspace error", ex); + } + } + + /// Executes shell command. + /// The runspace. + /// The command to be executed. + /// PSobjecs collection. + private Collection ExecuteShellCommand(Runspace runspace, object cmd) + { + object[] errors; + var command = cmd as Command; + + if (command != null) + { + return ExecuteShellCommand(runspace, command, out errors); + } + + return ExecuteShellCommand(runspace, cmd as List, out errors); + } + + /// Executes shell command. + /// The runspace. + /// The command to be executed. + /// The errors. + /// PSobjecs collection. + private Collection ExecuteShellCommand(Runspace runspace, Command cmd, out object[] errors) + { + HostedSolutionLog.LogStart("ExecuteShellCommand"); + var errorList = new List(); + Collection results; + + using (Pipeline pipeLine = runspace.CreatePipeline()) + { + pipeLine.Commands.Add(cmd); + results = pipeLine.Invoke(); + + if (pipeLine.Error != null && pipeLine.Error.Count > 0) + { + foreach (object item in pipeLine.Error.ReadToEnd()) + { + errorList.Add(item); + string errorMessage = string.Format("Invoke error: {0}", item); + HostedSolutionLog.LogWarning(errorMessage); + } + } + } + + errors = errorList.ToArray(); + HostedSolutionLog.LogEnd("ExecuteShellCommand"); + + return results; + } + + /// Executes shell command. + /// The runspace. + /// The scripts to be executed. + /// The errors. + /// PSobjecs collection. + private Collection ExecuteShellCommand(Runspace runspace, List scripts, out object[] errors) + { + HostedSolutionLog.LogStart("ExecuteShellCommand"); + var errorList = new List(); + Collection results; + + using (Pipeline pipeLine = runspace.CreatePipeline()) + { + foreach (string script in scripts) + { + pipeLine.Commands.AddScript(script); + } + + results = pipeLine.Invoke(); + + if (pipeLine.Error != null && pipeLine.Error.Count > 0) + { + foreach (object item in pipeLine.Error.ReadToEnd()) + { + errorList.Add(item); + string errorMessage = string.Format("Invoke error: {0}", item); + HostedSolutionLog.LogWarning(errorMessage); + + throw new ArgumentException(scripts.First()); + } + } + } + + errors = errorList.ToArray(); + HostedSolutionLog.LogEnd("ExecuteShellCommand"); + + return results; + } + + /// Adds record to hosts file. + /// The site collection object. + public void AddHostsRecord(SharePointSiteCollection siteCollection) + { + try + { + if (siteCollection.RootWebApplicationInteralIpAddress != string.Empty) + { + string dirPath = FileUtils.EvaluateSystemVariables(@"%windir%\system32\drivers\etc"); + string path = dirPath + "\\hosts"; + + if (FileUtils.FileExists(path)) + { + string content = FileUtils.GetFileTextContent(path); + content = content.Replace("\r\n", "\n").Replace("\n\r", "\n"); + string[] contentArr = content.Split(new[] {'\n'}); + bool bRecordExist = false; + + foreach (string s in contentArr) + { + if (s != string.Empty) + { + string hostName = string.Empty; + + if (s[0] != '#') + { + bool bSeperator = false; + + foreach (char c in s) + { + if ((c != ' ') & (c != '\t')) + { + if (bSeperator) + { + hostName += c; + } + } + else + { + bSeperator = true; + } + } + + if (hostName.ToLower() == siteCollection.RootWebApplicationFQDN.ToLower()) + { + bRecordExist = true; + break; + } + } + } + } + + if (!bRecordExist) + { + string outPut = contentArr.Where(o => o != string.Empty).Aggregate(string.Empty, (current, o) => current + (o + "\r\n")); + outPut += siteCollection.RootWebApplicationInteralIpAddress + '\t' + siteCollection.RootWebApplicationFQDN + "\r\n"; + FileUtils.UpdateFileTextContent(path, outPut); + } + } + } + } + catch (Exception ex) + { + HostedSolutionLog.LogError(ex); + } + } + + /// Removes record from hosts file. + /// The site collection object. + private void RemoveHostsRecord(SharePointSiteCollection siteCollection) + { + try + { + if (siteCollection.RootWebApplicationInteralIpAddress != string.Empty) + { + string dirPath = FileUtils.EvaluateSystemVariables(@"%windir%\system32\drivers\etc"); + string path = dirPath + "\\hosts"; + + if (FileUtils.FileExists(path)) + { + string content = FileUtils.GetFileTextContent(path); + content = content.Replace("\r\n", "\n").Replace("\n\r", "\n"); + string[] contentArr = content.Split(new[] {'\n'}); + string outPut = string.Empty; + + foreach (string s in contentArr) + { + if (s != string.Empty) + { + string hostName = string.Empty; + + if (s[0] != '#') + { + bool bSeperator = false; + + foreach (char c in s) + { + if ((c != ' ') & (c != '\t')) + { + if (bSeperator) + { + hostName += c; + } + } + else + { + bSeperator = true; + } + } + + if (hostName.ToLower() != siteCollection.RootWebApplicationFQDN.ToLower()) + { + outPut += s + "\r\n"; + } + } + else + { + outPut += s + "\r\n"; + } + } + } + + FileUtils.UpdateFileTextContent(path, outPut); + } + } + } + catch (Exception ex) + { + HostedSolutionLog.LogError(ex); + } + } + + #endregion + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/Properties/AssemblyInfo.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..e25dee60 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WebsitePanel.Providers.HostedSolution.SharePoint2013Ent")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebsitePanel.Providers.HostedSolution.SharePoint2013Ent")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fd1db47e-461e-41ac-88cf-fb2925f48d52")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj new file mode 100644 index 00000000..27740b68 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj @@ -0,0 +1,75 @@ + + + + + Debug + AnyCPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252} + Library + Properties + WebsitePanel.Providers.HostedSolution.SharePoint2013Ent + WebsitePanel.Providers.HostedSolution.SharePoint2013Ent + v4.5 + 512 + + + true + full + false + ..\WebsitePanel.Server\bin\Sharepoint2013Ent\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\Lib\References\Microsoft\Microsoft.SharePoint.dll + False + + + + + + False + ..\..\..\..\..\Windows\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll + + + + + + + + ..\..\Bin\WebsitePanel.Providers.Base.dll + False + + + ..\WebsitePanel.Server\bin\WebsitePanel.Providers.HostedSolution.dll + False + + + ..\WebsitePanel.Server.Utils\bin\Debug\WebsitePanel.Server.Utils.dll + False + + + + + + + + + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/HostedSharePointServerEntProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/HostedSharePointServerEntProxy.cs new file mode 100644 index 00000000..bec63849 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/HostedSharePointServerEntProxy.cs @@ -0,0 +1,928 @@ +// 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.8657 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// +// This source code was auto-generated by wsdl, Version=2.0.50727.3038. +// +namespace WebsitePanel.Providers.HostedSolution { + using System.Xml.Serialization; + using System.Web.Services; + using System.ComponentModel; + using System.Web.Services.Protocols; + using System; + using System.Diagnostics; + using WebsitePanel.Providers.SharePoint; + + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Web.Services.WebServiceBindingAttribute(Name="HostedSharePointServerEntSoap", Namespace="http://smbsaas/websitepanel/server/")] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(ServiceProviderItem))] + public partial class HostedSharePointServerEnt : Microsoft.Web.Services3.WebServicesClientProtocol { + + public ServiceProviderSettingsSoapHeader ServiceProviderSettingsSoapHeaderValue; + + private System.Threading.SendOrPostCallback Enterprise_GetSupportedLanguagesOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_GetSiteCollectionsOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_GetSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_CreateSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_UpdateQuotasOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_CalculateSiteCollectionsDiskSpaceOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_DeleteSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_BackupSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_RestoreSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_GetTempFileBinaryChunkOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_AppendTempFileBinaryChunkOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_GetSiteCollectionSizeOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_SetPeoplePickerOuOperationCompleted; + + /// + public HostedSharePointServerEnt() { + this.Url = "http://localhost:9003/HostedSharePointServerEnt.asmx"; + } + + /// + public event Enterprise_GetSupportedLanguagesCompletedEventHandler Enterprise_GetSupportedLanguagesCompleted; + + /// + public event Enterprise_GetSiteCollectionsCompletedEventHandler Enterprise_GetSiteCollectionsCompleted; + + /// + public event Enterprise_GetSiteCollectionCompletedEventHandler Enterprise_GetSiteCollectionCompleted; + + /// + public event Enterprise_CreateSiteCollectionCompletedEventHandler Enterprise_CreateSiteCollectionCompleted; + + /// + public event Enterprise_UpdateQuotasCompletedEventHandler Enterprise_UpdateQuotasCompleted; + + /// + public event Enterprise_CalculateSiteCollectionsDiskSpaceCompletedEventHandler Enterprise_CalculateSiteCollectionsDiskSpaceCompleted; + + /// + public event Enterprise_DeleteSiteCollectionCompletedEventHandler Enterprise_DeleteSiteCollectionCompleted; + + /// + public event Enterprise_BackupSiteCollectionCompletedEventHandler Enterprise_BackupSiteCollectionCompleted; + + /// + public event Enterprise_RestoreSiteCollectionCompletedEventHandler Enterprise_RestoreSiteCollectionCompleted; + + /// + public event Enterprise_GetTempFileBinaryChunkCompletedEventHandler Enterprise_GetTempFileBinaryChunkCompleted; + + /// + public event Enterprise_AppendTempFileBinaryChunkCompletedEventHandler Enterprise_AppendTempFileBinaryChunkCompleted; + + /// + public event Enterprise_GetSiteCollectionSizeCompletedEventHandler Enterprise_GetSiteCollectionSizeCompleted; + + /// + public event Enterprise_SetPeoplePickerOuCompletedEventHandler Enterprise_SetPeoplePickerOuCompleted; + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_GetSupportedLanguages", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int[] Enterprise_GetSupportedLanguages() { + object[] results = this.Invoke("Enterprise_GetSupportedLanguages", new object[0]); + return ((int[])(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetSupportedLanguages(System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetSupportedLanguages", new object[0], callback, asyncState); + } + + /// + public int[] EndEnterprise_GetSupportedLanguages(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int[])(results[0])); + } + + /// + public void Enterprise_GetSupportedLanguagesAsync() { + this.Enterprise_GetSupportedLanguagesAsync(null); + } + + /// + public void Enterprise_GetSupportedLanguagesAsync(object userState) { + if ((this.Enterprise_GetSupportedLanguagesOperationCompleted == null)) { + this.Enterprise_GetSupportedLanguagesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetSupportedLanguagesOperationCompleted); + } + this.InvokeAsync("Enterprise_GetSupportedLanguages", new object[0], this.Enterprise_GetSupportedLanguagesOperationCompleted, userState); + } + + private void OnEnterprise_GetSupportedLanguagesOperationCompleted(object arg) { + if ((this.Enterprise_GetSupportedLanguagesCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetSupportedLanguagesCompleted(this, new Enterprise_GetSupportedLanguagesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_GetSiteCollections", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SharePointSiteCollection[] Enterprise_GetSiteCollections() { + object[] results = this.Invoke("Enterprise_GetSiteCollections", new object[0]); + return ((SharePointSiteCollection[])(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetSiteCollections(System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetSiteCollections", new object[0], callback, asyncState); + } + + /// + public SharePointSiteCollection[] EndEnterprise_GetSiteCollections(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SharePointSiteCollection[])(results[0])); + } + + /// + public void Enterprise_GetSiteCollectionsAsync() { + this.Enterprise_GetSiteCollectionsAsync(null); + } + + /// + public void Enterprise_GetSiteCollectionsAsync(object userState) { + if ((this.Enterprise_GetSiteCollectionsOperationCompleted == null)) { + this.Enterprise_GetSiteCollectionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetSiteCollectionsOperationCompleted); + } + this.InvokeAsync("Enterprise_GetSiteCollections", new object[0], this.Enterprise_GetSiteCollectionsOperationCompleted, userState); + } + + private void OnEnterprise_GetSiteCollectionsOperationCompleted(object arg) { + if ((this.Enterprise_GetSiteCollectionsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetSiteCollectionsCompleted(this, new Enterprise_GetSiteCollectionsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_GetSiteCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SharePointSiteCollection Enterprise_GetSiteCollection(string url) { + object[] results = this.Invoke("Enterprise_GetSiteCollection", new object[] { + url}); + return ((SharePointSiteCollection)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetSiteCollection(string url, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetSiteCollection", new object[] { + url}, callback, asyncState); + } + + /// + public SharePointSiteCollection EndEnterprise_GetSiteCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SharePointSiteCollection)(results[0])); + } + + /// + public void Enterprise_GetSiteCollectionAsync(string url) { + this.Enterprise_GetSiteCollectionAsync(url, null); + } + + /// + public void Enterprise_GetSiteCollectionAsync(string url, object userState) { + if ((this.Enterprise_GetSiteCollectionOperationCompleted == null)) { + this.Enterprise_GetSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_GetSiteCollection", new object[] { + url}, this.Enterprise_GetSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_GetSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_GetSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetSiteCollectionCompleted(this, new Enterprise_GetSiteCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_CreateSiteCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void Enterprise_CreateSiteCollection(SharePointSiteCollection siteCollection) { + this.Invoke("Enterprise_CreateSiteCollection", new object[] { + siteCollection}); + } + + /// + public System.IAsyncResult BeginEnterprise_CreateSiteCollection(SharePointSiteCollection siteCollection, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_CreateSiteCollection", new object[] { + siteCollection}, callback, asyncState); + } + + /// + public void EndEnterprise_CreateSiteCollection(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void Enterprise_CreateSiteCollectionAsync(SharePointSiteCollection siteCollection) { + this.Enterprise_CreateSiteCollectionAsync(siteCollection, null); + } + + /// + public void Enterprise_CreateSiteCollectionAsync(SharePointSiteCollection siteCollection, object userState) { + if ((this.Enterprise_CreateSiteCollectionOperationCompleted == null)) { + this.Enterprise_CreateSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_CreateSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_CreateSiteCollection", new object[] { + siteCollection}, this.Enterprise_CreateSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_CreateSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_CreateSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_CreateSiteCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_UpdateQuotas", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void Enterprise_UpdateQuotas(string url, long maxSize, long warningSize) { + this.Invoke("Enterprise_UpdateQuotas", new object[] { + url, + maxSize, + warningSize}); + } + + /// + public System.IAsyncResult BeginEnterprise_UpdateQuotas(string url, long maxSize, long warningSize, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_UpdateQuotas", new object[] { + url, + maxSize, + warningSize}, callback, asyncState); + } + + /// + public void EndEnterprise_UpdateQuotas(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void Enterprise_UpdateQuotasAsync(string url, long maxSize, long warningSize) { + this.Enterprise_UpdateQuotasAsync(url, maxSize, warningSize, null); + } + + /// + public void Enterprise_UpdateQuotasAsync(string url, long maxSize, long warningSize, object userState) { + if ((this.Enterprise_UpdateQuotasOperationCompleted == null)) { + this.Enterprise_UpdateQuotasOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_UpdateQuotasOperationCompleted); + } + this.InvokeAsync("Enterprise_UpdateQuotas", new object[] { + url, + maxSize, + warningSize}, this.Enterprise_UpdateQuotasOperationCompleted, userState); + } + + private void OnEnterprise_UpdateQuotasOperationCompleted(object arg) { + if ((this.Enterprise_UpdateQuotasCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_UpdateQuotasCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_CalculateSiteCollectionsDiskSpace", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SharePointSiteDiskSpace[] Enterprise_CalculateSiteCollectionsDiskSpace(string[] urls) { + object[] results = this.Invoke("Enterprise_CalculateSiteCollectionsDiskSpace", new object[] { + urls}); + return ((SharePointSiteDiskSpace[])(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_CalculateSiteCollectionsDiskSpace(string[] urls, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_CalculateSiteCollectionsDiskSpace", new object[] { + urls}, callback, asyncState); + } + + /// + public SharePointSiteDiskSpace[] EndEnterprise_CalculateSiteCollectionsDiskSpace(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SharePointSiteDiskSpace[])(results[0])); + } + + /// + public void Enterprise_CalculateSiteCollectionsDiskSpaceAsync(string[] urls) { + this.Enterprise_CalculateSiteCollectionsDiskSpaceAsync(urls, null); + } + + /// + public void Enterprise_CalculateSiteCollectionsDiskSpaceAsync(string[] urls, object userState) { + if ((this.Enterprise_CalculateSiteCollectionsDiskSpaceOperationCompleted == null)) { + this.Enterprise_CalculateSiteCollectionsDiskSpaceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_CalculateSiteCollectionsDiskSpaceOperationCompleted); + } + this.InvokeAsync("Enterprise_CalculateSiteCollectionsDiskSpace", new object[] { + urls}, this.Enterprise_CalculateSiteCollectionsDiskSpaceOperationCompleted, userState); + } + + private void OnEnterprise_CalculateSiteCollectionsDiskSpaceOperationCompleted(object arg) { + if ((this.Enterprise_CalculateSiteCollectionsDiskSpaceCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_CalculateSiteCollectionsDiskSpaceCompleted(this, new Enterprise_CalculateSiteCollectionsDiskSpaceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_DeleteSiteCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void Enterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection) { + this.Invoke("Enterprise_DeleteSiteCollection", new object[] { + siteCollection}); + } + + /// + public System.IAsyncResult BeginEnterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_DeleteSiteCollection", new object[] { + siteCollection}, callback, asyncState); + } + + /// + public void EndEnterprise_DeleteSiteCollection(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void Enterprise_DeleteSiteCollectionAsync(SharePointSiteCollection siteCollection) { + this.Enterprise_DeleteSiteCollectionAsync(siteCollection, null); + } + + /// + public void Enterprise_DeleteSiteCollectionAsync(SharePointSiteCollection siteCollection, object userState) { + if ((this.Enterprise_DeleteSiteCollectionOperationCompleted == null)) { + this.Enterprise_DeleteSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_DeleteSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_DeleteSiteCollection", new object[] { + siteCollection}, this.Enterprise_DeleteSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_DeleteSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_DeleteSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_DeleteSiteCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_BackupSiteCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string Enterprise_BackupSiteCollection(string url, string filename, bool zip) { + object[] results = this.Invoke("Enterprise_BackupSiteCollection", new object[] { + url, + filename, + zip}); + return ((string)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_BackupSiteCollection(string url, string filename, bool zip, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_BackupSiteCollection", new object[] { + url, + filename, + zip}, callback, asyncState); + } + + /// + public string EndEnterprise_BackupSiteCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// + public void Enterprise_BackupSiteCollectionAsync(string url, string filename, bool zip) { + this.Enterprise_BackupSiteCollectionAsync(url, filename, zip, null); + } + + /// + public void Enterprise_BackupSiteCollectionAsync(string url, string filename, bool zip, object userState) { + if ((this.Enterprise_BackupSiteCollectionOperationCompleted == null)) { + this.Enterprise_BackupSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_BackupSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_BackupSiteCollection", new object[] { + url, + filename, + zip}, this.Enterprise_BackupSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_BackupSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_BackupSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_BackupSiteCollectionCompleted(this, new Enterprise_BackupSiteCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_RestoreSiteCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void Enterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename) { + this.Invoke("Enterprise_RestoreSiteCollection", new object[] { + siteCollection, + filename}); + } + + /// + public System.IAsyncResult BeginEnterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_RestoreSiteCollection", new object[] { + siteCollection, + filename}, callback, asyncState); + } + + /// + public void EndEnterprise_RestoreSiteCollection(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void Enterprise_RestoreSiteCollectionAsync(SharePointSiteCollection siteCollection, string filename) { + this.Enterprise_RestoreSiteCollectionAsync(siteCollection, filename, null); + } + + /// + public void Enterprise_RestoreSiteCollectionAsync(SharePointSiteCollection siteCollection, string filename, object userState) { + if ((this.Enterprise_RestoreSiteCollectionOperationCompleted == null)) { + this.Enterprise_RestoreSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_RestoreSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_RestoreSiteCollection", new object[] { + siteCollection, + filename}, this.Enterprise_RestoreSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_RestoreSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_RestoreSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_RestoreSiteCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_GetTempFileBinaryChunk", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] + public byte[] Enterprise_GetTempFileBinaryChunk(string path, int offset, int length) { + object[] results = this.Invoke("Enterprise_GetTempFileBinaryChunk", new object[] { + path, + offset, + length}); + return ((byte[])(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetTempFileBinaryChunk(string path, int offset, int length, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetTempFileBinaryChunk", new object[] { + path, + offset, + length}, callback, asyncState); + } + + /// + public byte[] EndEnterprise_GetTempFileBinaryChunk(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((byte[])(results[0])); + } + + /// + public void Enterprise_GetTempFileBinaryChunkAsync(string path, int offset, int length) { + this.Enterprise_GetTempFileBinaryChunkAsync(path, offset, length, null); + } + + /// + public void Enterprise_GetTempFileBinaryChunkAsync(string path, int offset, int length, object userState) { + if ((this.Enterprise_GetTempFileBinaryChunkOperationCompleted == null)) { + this.Enterprise_GetTempFileBinaryChunkOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetTempFileBinaryChunkOperationCompleted); + } + this.InvokeAsync("Enterprise_GetTempFileBinaryChunk", new object[] { + path, + offset, + length}, this.Enterprise_GetTempFileBinaryChunkOperationCompleted, userState); + } + + private void OnEnterprise_GetTempFileBinaryChunkOperationCompleted(object arg) { + if ((this.Enterprise_GetTempFileBinaryChunkCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetTempFileBinaryChunkCompleted(this, new Enterprise_GetTempFileBinaryChunkCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_AppendTempFileBinaryChunk", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string Enterprise_AppendTempFileBinaryChunk(string fileName, string path, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] chunk) { + object[] results = this.Invoke("Enterprise_AppendTempFileBinaryChunk", new object[] { + fileName, + path, + chunk}); + return ((string)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_AppendTempFileBinaryChunk(string fileName, string path, byte[] chunk, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_AppendTempFileBinaryChunk", new object[] { + fileName, + path, + chunk}, callback, asyncState); + } + + /// + public string EndEnterprise_AppendTempFileBinaryChunk(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// + public void Enterprise_AppendTempFileBinaryChunkAsync(string fileName, string path, byte[] chunk) { + this.Enterprise_AppendTempFileBinaryChunkAsync(fileName, path, chunk, null); + } + + /// + public void Enterprise_AppendTempFileBinaryChunkAsync(string fileName, string path, byte[] chunk, object userState) { + if ((this.Enterprise_AppendTempFileBinaryChunkOperationCompleted == null)) { + this.Enterprise_AppendTempFileBinaryChunkOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_AppendTempFileBinaryChunkOperationCompleted); + } + this.InvokeAsync("Enterprise_AppendTempFileBinaryChunk", new object[] { + fileName, + path, + chunk}, this.Enterprise_AppendTempFileBinaryChunkOperationCompleted, userState); + } + + private void OnEnterprise_AppendTempFileBinaryChunkOperationCompleted(object arg) { + if ((this.Enterprise_AppendTempFileBinaryChunkCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_AppendTempFileBinaryChunkCompleted(this, new Enterprise_AppendTempFileBinaryChunkCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_GetSiteCollectionSize", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public long Enterprise_GetSiteCollectionSize(string url) { + object[] results = this.Invoke("Enterprise_GetSiteCollectionSize", new object[] { + url}); + return ((long)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetSiteCollectionSize(string url, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetSiteCollectionSize", new object[] { + url}, callback, asyncState); + } + + /// + public long EndEnterprise_GetSiteCollectionSize(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((long)(results[0])); + } + + /// + public void Enterprise_GetSiteCollectionSizeAsync(string url) { + this.Enterprise_GetSiteCollectionSizeAsync(url, null); + } + + /// + public void Enterprise_GetSiteCollectionSizeAsync(string url, object userState) { + if ((this.Enterprise_GetSiteCollectionSizeOperationCompleted == null)) { + this.Enterprise_GetSiteCollectionSizeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetSiteCollectionSizeOperationCompleted); + } + this.InvokeAsync("Enterprise_GetSiteCollectionSize", new object[] { + url}, this.Enterprise_GetSiteCollectionSizeOperationCompleted, userState); + } + + private void OnEnterprise_GetSiteCollectionSizeOperationCompleted(object arg) { + if ((this.Enterprise_GetSiteCollectionSizeCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetSiteCollectionSizeCompleted(this, new Enterprise_GetSiteCollectionSizeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_SetPeoplePickerOu", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void Enterprise_SetPeoplePickerOu(string site, string ou) { + this.Invoke("Enterprise_SetPeoplePickerOu", new object[] { + site, + ou}); + } + + /// + public System.IAsyncResult BeginEnterprise_SetPeoplePickerOu(string site, string ou, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_SetPeoplePickerOu", new object[] { + site, + ou}, callback, asyncState); + } + + /// + public void EndEnterprise_SetPeoplePickerOu(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void Enterprise_SetPeoplePickerOuAsync(string site, string ou) { + this.Enterprise_SetPeoplePickerOuAsync(site, ou, null); + } + + /// + public void Enterprise_SetPeoplePickerOuAsync(string site, string ou, object userState) { + if ((this.Enterprise_SetPeoplePickerOuOperationCompleted == null)) { + this.Enterprise_SetPeoplePickerOuOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_SetPeoplePickerOuOperationCompleted); + } + this.InvokeAsync("Enterprise_SetPeoplePickerOu", new object[] { + site, + ou}, this.Enterprise_SetPeoplePickerOuOperationCompleted, userState); + } + + private void OnEnterprise_SetPeoplePickerOuOperationCompleted(object arg) { + if ((this.Enterprise_SetPeoplePickerOuCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_SetPeoplePickerOuCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) { + base.CancelAsync(userState); + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetSupportedLanguagesCompletedEventHandler(object sender, Enterprise_GetSupportedLanguagesCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetSupportedLanguagesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetSupportedLanguagesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetSiteCollectionsCompletedEventHandler(object sender, Enterprise_GetSiteCollectionsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetSiteCollectionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetSiteCollectionsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SharePointSiteCollection[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SharePointSiteCollection[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetSiteCollectionCompletedEventHandler(object sender, Enterprise_GetSiteCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetSiteCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SharePointSiteCollection Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SharePointSiteCollection)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_CreateSiteCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_UpdateQuotasCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_CalculateSiteCollectionsDiskSpaceCompletedEventHandler(object sender, Enterprise_CalculateSiteCollectionsDiskSpaceCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_CalculateSiteCollectionsDiskSpaceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_CalculateSiteCollectionsDiskSpaceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SharePointSiteDiskSpace[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SharePointSiteDiskSpace[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_DeleteSiteCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_BackupSiteCollectionCompletedEventHandler(object sender, Enterprise_BackupSiteCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_BackupSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_BackupSiteCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_RestoreSiteCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetTempFileBinaryChunkCompletedEventHandler(object sender, Enterprise_GetTempFileBinaryChunkCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetTempFileBinaryChunkCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetTempFileBinaryChunkCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public byte[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((byte[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_AppendTempFileBinaryChunkCompletedEventHandler(object sender, Enterprise_AppendTempFileBinaryChunkCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_AppendTempFileBinaryChunkCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_AppendTempFileBinaryChunkCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetSiteCollectionSizeCompletedEventHandler(object sender, Enterprise_GetSiteCollectionSizeCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetSiteCollectionSizeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetSiteCollectionSizeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public long Result { + get { + this.RaiseExceptionIfNecessary(); + return ((long)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_SetPeoplePickerOuCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); +} diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/WebsitePanel.Server.Client.csproj b/WebsitePanel/Sources/WebsitePanel.Server.Client/WebsitePanel.Server.Client.csproj index 751a8fe5..c68a63eb 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/WebsitePanel.Server.Client.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/WebsitePanel.Server.Client.csproj @@ -82,6 +82,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.Server.sln b/WebsitePanel/Sources/WebsitePanel.Server.sln index c5af78c6..b06fa4e6 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.sln +++ b/WebsitePanel/Sources/WebsitePanel.Server.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching Application Block", "Caching Application Block", "{C8E6F2E4-A5B8-486A-A56E-92D864524682}" ProjectSection(SolutionItems) = preProject @@ -152,6 +152,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Mail EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Virtualization.HyperV2012R2", "WebsitePanel.Providers.Virtualization.HyperV-2012R2\WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj", "{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.HostedSolution.SharePoint2013Ent", "WebsitePanel.Providers.HostedSolution.SharePoint2013Ent\WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj", "{0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -762,6 +764,16 @@ Global {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.Build.0 = Release|Any CPU {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|x86.ActiveCfg = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|x86.ActiveCfg = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|Any CPU.Build.0 = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx b/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx new file mode 100644 index 00000000..6eb0df72 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx @@ -0,0 +1 @@ +<%@ WebService Language="C#" CodeBehind="HostedSharePointServerEnt.asmx.cs" Class="WebsitePanel.Server.HostedSharePointServerEnt" %> diff --git a/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx.cs new file mode 100644 index 00000000..778e17c0 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx.cs @@ -0,0 +1,274 @@ +// 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.ComponentModel; +using System.Web.Services; +using System.Web.Services.Protocols; +using WebsitePanel.Providers; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.SharePoint; +using WebsitePanel.Server.Utils; +using Microsoft.Web.Services3; + +namespace WebsitePanel.Server +{ + /// + /// Summary description for HostedSharePointServerEnt + /// + [WebService(Namespace = "http://smbsaas/websitepanel/server/")] + [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] + [Policy("ServerPolicy")] + [ToolboxItem(false)] + public class HostedSharePointServerEnt : HostingServiceProviderWebService + { + private delegate TReturn Action(); + + /// + /// Gets hosted SharePoint provider instance. + /// + private IHostedSharePointServerEnt HostedSharePointServerEntProvider + { + get { return (IHostedSharePointServerEnt)Provider; } + } + + /// + /// Gets list of supported languages by this installation of SharePoint. + /// + /// List of supported languages + [WebMethod, SoapHeader("settings")] + public int[] Enterprise_GetSupportedLanguages() + { + return ExecuteAction(delegate + { + return HostedSharePointServerEntProvider.Enterprise_GetSupportedLanguages(); + }, "GetSupportedLanguages"); + } + + + /// + /// Gets list of SharePoint collections within root web application. + /// + /// List of SharePoint collections within root web application. + [WebMethod, SoapHeader("settings")] + public SharePointSiteCollection[] Enterprise_GetSiteCollections() + { + return ExecuteAction(delegate + { + return HostedSharePointServerEntProvider.Enterprise_GetSiteCollections(); + }, "GetSiteCollections"); + } + + /// + /// Gets SharePoint collection within root web application with given name. + /// + /// Url that uniquely identifies site collection to be loaded. + /// SharePoint collection within root web application with given name. + [WebMethod, SoapHeader("settings")] + public SharePointSiteCollection Enterprise_GetSiteCollection(string url) + { + return ExecuteAction(delegate + { + return HostedSharePointServerEntProvider.Enterprise_GetSiteCollection(url); + }, "GetSiteCollection"); + } + + /// + /// Creates site collection within predefined root web application. + /// + /// Information about site coolection to be created. + [WebMethod, SoapHeader("settings")] + public void Enterprise_CreateSiteCollection(SharePointSiteCollection siteCollection) + { + siteCollection.OwnerLogin = AttachNetbiosDomainName(siteCollection.OwnerLogin); + ExecuteAction(delegate + { + HostedSharePointServerEntProvider.Enterprise_CreateSiteCollection(siteCollection); + return new object(); + }, "CreateSiteCollection"); + } + + + [WebMethod, SoapHeader("settings")] + public void Enterprise_UpdateQuotas(string url, long maxSize, long warningSize) + { + ExecuteAction(delegate + { + HostedSharePointServerEntProvider.Enterprise_UpdateQuotas(url, maxSize, warningSize); + return new object(); + }, "UpdateQuotas"); + + + + } + + [WebMethod, SoapHeader("settings")] + public SharePointSiteDiskSpace[] Enterprise_CalculateSiteCollectionsDiskSpace(string[] urls) + { + SharePointSiteDiskSpace[] ret = null; + ret = ExecuteAction(delegate + { + return HostedSharePointServerEntProvider.Enterprise_CalculateSiteCollectionsDiskSpace(urls); + }, "CalculateSiteCollectionDiskSpace"); + return ret; + + } + /// + /// Deletes site collection under given url. + /// + /// Url that uniquely identifies site collection to be deleted. + [WebMethod, SoapHeader("settings")] + public void Enterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection) + { + ExecuteAction(delegate + { + HostedSharePointServerEntProvider.Enterprise_DeleteSiteCollection(siteCollection); + return new object(); + }, "DeleteSiteCollection"); + } + /// + /// Backups site collection under give url. + /// + /// Url that uniquely identifies site collection to be deleted. + /// Resulting backup file name. + /// A value which shows whether created backup must be archived. + /// Created backup full path. + [WebMethod, SoapHeader("settings")] + public string Enterprise_BackupSiteCollection(string url, string filename, bool zip) + { + return ExecuteAction(delegate + { + return + HostedSharePointServerEntProvider.Enterprise_BackupSiteCollection(url, filename, zip); + }, "BackupSiteCollection"); + } + + /// + /// Restores site collection under given url from backup. + /// + /// Site collection to be restored. + /// Backup file name to restore from. + [WebMethod, SoapHeader("settings")] + public void Enterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename) + { + siteCollection.OwnerLogin = AttachNetbiosDomainName(siteCollection.OwnerLogin); + ExecuteAction(delegate + { + HostedSharePointServerEntProvider.Enterprise_RestoreSiteCollection(siteCollection, filename); + return new object(); + }, "RestoreSiteCollection"); + } + + /// + /// Gets binary data chunk of specified size from specified offset. + /// + /// Path to file to get bunary data chunk from. + /// Offset from which to start data reading. + /// Binary data chunk length. + /// Binary data chunk read from file. + [WebMethod, SoapHeader("settings")] + public byte[] Enterprise_GetTempFileBinaryChunk(string path, int offset, int length) + { + return ExecuteAction(delegate + { + return + HostedSharePointServerEntProvider.Enterprise_GetTempFileBinaryChunk(path, offset, length); + }, "GetTempFileBinaryChunk"); + } + + /// + /// Appends supplied binary data chunk to file. + /// + /// Non existent file name to append to. + /// Full path to existent file to append to. + /// Binary data chunk to append to. + /// Path to file that was appended with chunk. + [WebMethod, SoapHeader("settings")] + public virtual string Enterprise_AppendTempFileBinaryChunk(string fileName, string path, byte[] chunk) + { + return ExecuteAction(delegate + { + return + HostedSharePointServerEntProvider.Enterprise_AppendTempFileBinaryChunk(fileName, path, chunk); + }, "AppendTempFileBinaryChunk"); + } + + + [WebMethod, SoapHeader("settings")] + public long Enterprise_GetSiteCollectionSize(string url) + { + return ExecuteAction(delegate + { + return + HostedSharePointServerEntProvider.Enterprise_GetSiteCollectionSize(url); + }, "GetSiteCollectionSize"); + } + + + [WebMethod, SoapHeader("settings")] + public void Enterprise_SetPeoplePickerOu(string site, string ou) + { + HostedSharePointServerEntProvider.Enterprise_SetPeoplePickerOu(site, ou); + } + + + /// + /// Executes supplied action and performs logging. + /// + /// Type of action's return value. + /// Action to be executed. + /// Action name for logging purposes. + /// Action execution result. + private TReturn ExecuteAction(Action action, string actionName) + { + try + { + Log.WriteStart("'{0}' {1}", ProviderSettings.ProviderName, actionName); + TReturn result = action(); + Log.WriteEnd("'{0}' {1}", ProviderSettings.ProviderName, actionName); + return result; + } + catch (Exception ex) + { + Log.WriteError(String.Format("Can't {1} '{0}' provider", ProviderSettings.ProviderName, actionName), ex); + throw; + } + } + + /// + /// Returns fully qualified netbios account name. + /// + /// Account name. + /// Fully qualified netbios account name. + private string AttachNetbiosDomainName(string accountName) + { + string domainNetbiosName = String.Format("{0}\\", ActiveDirectoryUtils.GetNETBIOSDomainName(ServerSettings.ADRootDomain)); + return String.Format("{0}{1}", domainNetbiosName, accountName.Replace(domainNetbiosName, String.Empty)); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj index 8b9f3b8d..2c8eda9a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj @@ -157,6 +157,8 @@ + + @@ -270,6 +272,7 @@ + @@ -319,6 +322,10 @@ EnterpriseStorage.asmx Component + + HostedSharePointServerEnt.asmx + Component + RemoteDesktopServices.asmx Component diff --git a/WebsitePanel/Sources/generate_server_proxies.bat b/WebsitePanel/Sources/generate_server_proxies.bat index 1ed0de0e..cd4f2b8a 100644 --- a/WebsitePanel/Sources/generate_server_proxies.bat +++ b/WebsitePanel/Sources/generate_server_proxies.bat @@ -17,8 +17,8 @@ REM %WSE_CLEAN% .\WebsitePanel.Server.Client\DatabaseServerProxy.cs REM %WSDL% %SERVER_URL%/DNSServer.asmx /out:.\WebsitePanel.Server.Client\DnsServerProxy.cs /namespace:WebsitePanel.Providers.DNS /type:webClient /fields REM %WSE_CLEAN% .\WebsitePanel.Server.Client\DnsServerProxy.cs -%WSDL% %SERVER_URL%/ExchangeServer.asmx /out:.\WebsitePanel.Server.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.Providers.Exchange /type:webClient /fields -%WSE_CLEAN% .\WebsitePanel.Server.Client\ExchangeServerProxy.cs +REM %WSDL% %SERVER_URL%/ExchangeServer.asmx /out:.\WebsitePanel.Server.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.Providers.Exchange /type:webClient /fields +REM %WSE_CLEAN% .\WebsitePanel.Server.Client\ExchangeServerProxy.cs REM %WSDL% %SERVER_URL%/ExchangeServerHostedEdition.asmx /out:.\WebsitePanel.Server.Client\ExchangeServerHostedEditionProxy.cs /namespace:WebsitePanel.Providers.ExchangeHostedEdition /type:webClient /fields REM %WSE_CLEAN% .\WebsitePanel.Server.Client\ExchangeServerHostedEditionProxy.cs @@ -26,6 +26,9 @@ REM %WSE_CLEAN% .\WebsitePanel.Server.Client\ExchangeServerHostedEditionProxy.cs REM %WSDL% %SERVER_URL%/HostedSharePointServer.asmx /out:.\WebsitePanel.Server.Client\HostedSharePointServerProxy.cs /namespace:WebsitePanel.Providers.HostedSolution /type:webClient /fields REM %WSE_CLEAN% .\WebsitePanel.Server.Client\HostedSharePointServerProxy.cs +%WSDL% %SERVER_URL%/HostedSharePointServerEnt.asmx /out:.\WebsitePanel.Server.Client\HostedSharePointServerEntProxy.cs /namespace:WebsitePanel.Providers.HostedSolution /type:webClient /fields +%WSE_CLEAN% .\WebsitePanel.Server.Client\HostedSharePointServerEntProxy.cs + REM %WSDL% %SERVER_URL%/OCSEdgeServer.asmx /out:.\WebsitePanel.Server.Client\OCSEdgeServerProxy.cs /namespace:WebsitePanel.Providers.OCS /type:webClient /fields REM %WSE_CLEAN% .\WebsitePanel.Server.Client\OCSEdgeServerProxy.cs @@ -35,8 +38,8 @@ REM %WSE_CLEAN% .\WebsitePanel.Server.Client\OCSServerProxy.cs REM %WSDL% %SERVER_URL%/OperatingSystem.asmx /out:.\WebsitePanel.Server.Client\OperatingSystemProxy.cs /namespace:WebsitePanel.Providers.OS /type:webClient /fields REM %WSE_CLEAN% .\WebsitePanel.Server.Client\OperatingSystemProxy.cs -%WSDL% %SERVER_URL%/Organizations.asmx /out:.\WebsitePanel.Server.Client\OrganizationProxy.cs /namespace:WebsitePanel.Providers.HostedSolution /type:webClient /fields -%WSE_CLEAN% .\WebsitePanel.Server.Client\OrganizationProxy.cs +REM %WSDL% %SERVER_URL%/Organizations.asmx /out:.\WebsitePanel.Server.Client\OrganizationProxy.cs /namespace:WebsitePanel.Providers.HostedSolution /type:webClient /fields +REM %WSE_CLEAN% .\WebsitePanel.Server.Client\OrganizationProxy.cs REM %WSDL% %SERVER_URL%/ServiceProvider.asmx /out:.\WebsitePanel.Server.Client\ServiceProviderProxy.cs /namespace:WebsitePanel.Providers /type:webClient /fields REM %WSE_CLEAN% .\WebsitePanel.Server.Client\ServiceProviderProxy.cs From 820dc84bc2616ef01687d147f3ac064c08839fbb Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 5 Apr 2015 08:03:26 +0800 Subject: [PATCH 43/91] Sharepoint Enterprise Integrated --- WebsitePanel/Sources/generate_es_proxies.bat | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/generate_es_proxies.bat b/WebsitePanel/Sources/generate_es_proxies.bat index 4f45afb7..ebfa40a4 100644 --- a/WebsitePanel/Sources/generate_es_proxies.bat +++ b/WebsitePanel/Sources/generate_es_proxies.bat @@ -47,6 +47,9 @@ REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\FilesProxy.cs REM %WSDL% %SERVER_URL%/esHostedSharePointServers.asmx /out:.\WebsitePanel.EnterpriseServer.Client\HostedSharePointServersProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\HostedSharePointServersProxy.cs +REM %WSDL% %SERVER_URL%/esHostedSharePointServersEnt.asmx /out:.\WebsitePanel.EnterpriseServer.Client\HostedSharePointServersEntProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient +REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\HostedSharePointServersEntProxy.cs + REM %WSDL% %SERVER_URL%/esImport.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ImportProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ImportProxy.cs @@ -56,8 +59,8 @@ REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OCSProxy.cs REM %WSDL% %SERVER_URL%/esOperatingSystems.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OperatingSystemsProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OperatingSystemsProxy.cs -%WSDL% %SERVER_URL%/esOrganizations.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs /namespace:WebsitePanel.EnterpriseServer.HostedSolution /type:webClient -%WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs +REM %WSDL% %SERVER_URL%/esOrganizations.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs /namespace:WebsitePanel.EnterpriseServer.HostedSolution /type:webClient +REB %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs REM %WSDL% %SERVER_URL%/esPackages.asmx /out:.\WebsitePanel.EnterpriseServer.Client\PackagesProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\PackagesProxy.cs From aa5a0cfc4454164637abeff1511101ce67a04357 Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 5 Apr 2015 08:13:57 +0800 Subject: [PATCH 44/91] Sharepoitn 2013 Fix up methods --- .../HostedSharePointServersProxy.cs | 29 +++++++++++++++++ .../esHostedSharePointServersEnt.asmx.cs | 32 +++++++++---------- WebsitePanel/Sources/generate_es_proxies.bat | 4 +-- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs index 0a2fb384..63534afd 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs @@ -1,3 +1,32 @@ +// 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. diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs index e5b51f35..3837ca4c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs @@ -58,7 +58,7 @@ namespace WebsitePanel.EnterpriseServer /// Resource group name. /// Site collections in raw format. [WebMethod] - public SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, + public SharePointSiteCollectionListPaged Enterprise_GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { return HostedSharePointServerEntController.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, @@ -70,7 +70,7 @@ namespace WebsitePanel.EnterpriseServer /// /// List of supported languages [WebMethod] - public int[] GetSupportedLanguages(int packageId) + public int[] Enterprise_GetSupportedLanguages(int packageId) { return HostedSharePointServerEntController.GetSupportedLanguages(packageId); } @@ -83,13 +83,13 @@ namespace WebsitePanel.EnterpriseServer /// Resource group name. /// List of found site collections. [WebMethod] - public List GetSiteCollections(int packageId, bool recursive) + public List Enterprise_GetSiteCollections(int packageId, bool recursive) { return HostedSharePointServerEntController.GetSiteCollections(packageId, recursive); } [WebMethod] - public int SetStorageSettings(int itemId, int maxStorage, int warningStorage, bool applyToSiteCollections) + public int Enterprise_SetStorageSettings(int itemId, int maxStorage, int warningStorage, bool applyToSiteCollections) { return HostedSharePointServerEntController.SetStorageSettings(itemId, maxStorage, warningStorage, applyToSiteCollections ); } @@ -100,7 +100,7 @@ namespace WebsitePanel.EnterpriseServer /// Site collection id within metabase. /// Site collection. [WebMethod] - public SharePointSiteCollection GetSiteCollection(int itemId) + public SharePointSiteCollection Enterprise_GetSiteCollection(int itemId) { return HostedSharePointServerEntController.GetSiteCollection(itemId); } @@ -113,10 +113,10 @@ namespace WebsitePanel.EnterpriseServer /// Domain name. /// SharePoint site collection or null. [WebMethod] - public SharePointSiteCollection GetSiteCollectionByDomain(int organizationId, string domain) + public SharePointSiteCollection Enterprise_GetSiteCollectionByDomain(int organizationId, string domain) { DomainInfo domainInfo = ServerController.GetDomain(domain); - SharePointSiteCollectionListPaged existentSiteCollections = this.GetSiteCollectionsPaged(domainInfo.PackageId, organizationId, "ItemName", String.Format("%{0}", domain), String.Empty, 0, Int32.MaxValue); + SharePointSiteCollectionListPaged existentSiteCollections = this.Enterprise_GetSiteCollectionsPaged(domainInfo.PackageId, organizationId, "ItemName", String.Format("%{0}", domain), String.Empty, 0, Int32.MaxValue); foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) { Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); @@ -136,7 +136,7 @@ namespace WebsitePanel.EnterpriseServer /// Resource group name. /// Created site collection id within metabase. [WebMethod] - public int AddSiteCollection(SharePointSiteCollection item) + public int Enterprise_AddSiteCollection(SharePointSiteCollection item) { return HostedSharePointServerEntController.AddSiteCollection(item); } @@ -147,7 +147,7 @@ namespace WebsitePanel.EnterpriseServer /// Site collection id within metabase. /// ? [WebMethod] - public int DeleteSiteCollection(int itemId) + public int Enterprise_DeleteSiteCollection(int itemId) { return HostedSharePointServerEntController.DeleteSiteCollection(itemId); } @@ -158,7 +158,7 @@ namespace WebsitePanel.EnterpriseServer /// Site collection id within metabase. /// ? [WebMethod] - public int DeleteSiteCollections(int organizationId) + public int Enterprise_DeleteSiteCollections(int organizationId) { HostedSharePointServerEntController.DeleteSiteCollections(organizationId); return 0; @@ -175,7 +175,7 @@ namespace WebsitePanel.EnterpriseServer /// Local folder to store downloaded backup. /// Created backup file name. [WebMethod] - public string BackupSiteCollection(int itemId, string fileName, bool zipBackup, bool download, string folderName) + public string Enterprise_BackupSiteCollection(int itemId, string fileName, bool zipBackup, bool download, string folderName) { return HostedSharePointServerEntController.BackupSiteCollection(itemId, fileName, zipBackup, download, folderName); } @@ -188,7 +188,7 @@ namespace WebsitePanel.EnterpriseServer /// /// [WebMethod] - public int RestoreSiteCollection(int itemId, string uploadedFile, string packageFile) + public int Enterprise_RestoreSiteCollection(int itemId, string uploadedFile, string packageFile) { return HostedSharePointServerEntController.RestoreSiteCollection(itemId, uploadedFile, packageFile); } @@ -202,7 +202,7 @@ namespace WebsitePanel.EnterpriseServer /// Binary data chunk length. /// Binary data chunk read from file. [WebMethod] - public byte[] GetBackupBinaryChunk(int itemId, string path, int offset, int length) + public byte[] Enterprise_GetBackupBinaryChunk(int itemId, string path, int offset, int length) { return HostedSharePointServerEntController.GetBackupBinaryChunk(itemId, path, offset, length); } @@ -216,20 +216,20 @@ namespace WebsitePanel.EnterpriseServer /// Binary data chunk to append to. /// Path to file that was appended with chunk. [WebMethod] - public string AppendBackupBinaryChunk(int itemId, string fileName, string path, byte[] chunk) + public string Enterprise_AppendBackupBinaryChunk(int itemId, string fileName, string path, byte[] chunk) { return HostedSharePointServerEntController.AppendBackupBinaryChunk(itemId, fileName, path, chunk); } [WebMethod] - public SharePointSiteDiskSpace[] CalculateSharePointSitesDiskSpace(int itemId, out int errorCode) + public SharePointSiteDiskSpace[] Enterprise_CalculateSharePointSitesDiskSpace(int itemId, out int errorCode) { return HostedSharePointServerEntController.CalculateSharePointSitesDiskSpace(itemId, out errorCode); } [WebMethod] - public void UpdateQuota(int itemId, int siteCollectionId, int maxSize, int warningSize) + public void Enterprise_UpdateQuota(int itemId, int siteCollectionId, int maxSize, int warningSize) { HostedSharePointServerEntController.UpdateQuota(itemId, siteCollectionId, maxSize, warningSize); } diff --git a/WebsitePanel/Sources/generate_es_proxies.bat b/WebsitePanel/Sources/generate_es_proxies.bat index ebfa40a4..b80218a8 100644 --- a/WebsitePanel/Sources/generate_es_proxies.bat +++ b/WebsitePanel/Sources/generate_es_proxies.bat @@ -35,8 +35,8 @@ REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecStorefrontProxy.cs REM %WSDL% %SERVER_URL%/ecStorehouse.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecStorehouseProxy.cs /namespace:WebsitePanel.Ecommerce.EnterpriseServer /type:webClient REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecStorehouseProxy.cs -%WSDL% %SERVER_URL%/esExchangeServer.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient -%WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs +REM %WSDL% %SERVER_URL%/esExchangeServer.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient +REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs REM %WSDL% %SERVER_URL%/esExchangeHostedEdition.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeHostedEditionProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeHostedEditionProxy.cs From a4aa1d419ec72bc64c37956043c9a6584caf23ec Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 5 Apr 2015 08:22:14 +0800 Subject: [PATCH 45/91] Sharepoitn 2013 enterprise fixed up enterprise server --- .../HostedSharePointServersEntProxy.cs | 1218 +++++++++++++++++ ...ebsitePanel.EnterpriseServer.Client.csproj | 1 + .../esHostedSharePointServersEnt.asmx | 2 +- 3 files changed, 1220 insertions(+), 1 deletion(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersEntProxy.cs diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersEntProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersEntProxy.cs new file mode 100644 index 00000000..f49885a5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersEntProxy.cs @@ -0,0 +1,1218 @@ +// 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.8009 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +// +// This source code was auto-generated by wsdl, Version=2.0.50727.3038. +// +namespace WebsitePanel.EnterpriseServer { + using System.Xml.Serialization; + using System.Web.Services; + using System.ComponentModel; + using System.Web.Services.Protocols; + using System; + using System.Diagnostics; + using WebsitePanel.Providers.SharePoint; + using WebsitePanel.Providers; + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Web.Services.WebServiceBindingAttribute(Name="esHostedSharePointServersEntSoap", Namespace="http://smbsaas/websitepanel/enterpriseserver")] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(ServiceProviderItem))] + public partial class esHostedSharePointServersEnt : Microsoft.Web.Services3.WebServicesClientProtocol { + + private System.Threading.SendOrPostCallback Enterprise_GetSiteCollectionsPagedOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_GetSupportedLanguagesOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_GetSiteCollectionsOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_SetStorageSettingsOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_GetSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_GetSiteCollectionByDomainOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_AddSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_DeleteSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_DeleteSiteCollectionsOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_BackupSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_RestoreSiteCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_GetBackupBinaryChunkOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_AppendBackupBinaryChunkOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_CalculateSharePointSitesDiskSpaceOperationCompleted; + + private System.Threading.SendOrPostCallback Enterprise_UpdateQuotaOperationCompleted; + + /// + public esHostedSharePointServersEnt() { + this.Url = "http://localhost:9002/esHostedSharePointServersEnt.asmx"; + } + + /// + public event Enterprise_GetSiteCollectionsPagedCompletedEventHandler Enterprise_GetSiteCollectionsPagedCompleted; + + /// + public event Enterprise_GetSupportedLanguagesCompletedEventHandler Enterprise_GetSupportedLanguagesCompleted; + + /// + public event Enterprise_GetSiteCollectionsCompletedEventHandler Enterprise_GetSiteCollectionsCompleted; + + /// + public event Enterprise_SetStorageSettingsCompletedEventHandler Enterprise_SetStorageSettingsCompleted; + + /// + public event Enterprise_GetSiteCollectionCompletedEventHandler Enterprise_GetSiteCollectionCompleted; + + /// + public event Enterprise_GetSiteCollectionByDomainCompletedEventHandler Enterprise_GetSiteCollectionByDomainCompleted; + + /// + public event Enterprise_AddSiteCollectionCompletedEventHandler Enterprise_AddSiteCollectionCompleted; + + /// + public event Enterprise_DeleteSiteCollectionCompletedEventHandler Enterprise_DeleteSiteCollectionCompleted; + + /// + public event Enterprise_DeleteSiteCollectionsCompletedEventHandler Enterprise_DeleteSiteCollectionsCompleted; + + /// + public event Enterprise_BackupSiteCollectionCompletedEventHandler Enterprise_BackupSiteCollectionCompleted; + + /// + public event Enterprise_RestoreSiteCollectionCompletedEventHandler Enterprise_RestoreSiteCollectionCompleted; + + /// + public event Enterprise_GetBackupBinaryChunkCompletedEventHandler Enterprise_GetBackupBinaryChunkCompleted; + + /// + public event Enterprise_AppendBackupBinaryChunkCompletedEventHandler Enterprise_AppendBackupBinaryChunkCompleted; + + /// + public event Enterprise_CalculateSharePointSitesDiskSpaceCompletedEventHandler Enterprise_CalculateSharePointSitesDiskSpaceCompleted; + + /// + public event Enterprise_UpdateQuotaCompletedEventHandler Enterprise_UpdateQuotaCompleted; + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetSiteCollectionsPaged", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SharePointSiteCollectionListPaged Enterprise_GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { + object[] results = this.Invoke("Enterprise_GetSiteCollectionsPaged", new object[] { + packageId, + organizationId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}); + return ((SharePointSiteCollectionListPaged)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetSiteCollectionsPaged", new object[] { + packageId, + organizationId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, callback, asyncState); + } + + /// + public SharePointSiteCollectionListPaged EndEnterprise_GetSiteCollectionsPaged(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SharePointSiteCollectionListPaged)(results[0])); + } + + /// + public void Enterprise_GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { + this.Enterprise_GetSiteCollectionsPagedAsync(packageId, organizationId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null); + } + + /// + public void Enterprise_GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) { + if ((this.Enterprise_GetSiteCollectionsPagedOperationCompleted == null)) { + this.Enterprise_GetSiteCollectionsPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetSiteCollectionsPagedOperationCompleted); + } + this.InvokeAsync("Enterprise_GetSiteCollectionsPaged", new object[] { + packageId, + organizationId, + filterColumn, + filterValue, + sortColumn, + startRow, + maximumRows}, this.Enterprise_GetSiteCollectionsPagedOperationCompleted, userState); + } + + private void OnEnterprise_GetSiteCollectionsPagedOperationCompleted(object arg) { + if ((this.Enterprise_GetSiteCollectionsPagedCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetSiteCollectionsPagedCompleted(this, new Enterprise_GetSiteCollectionsPagedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetSupportedLanguages", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int[] Enterprise_GetSupportedLanguages(int packageId) { + object[] results = this.Invoke("Enterprise_GetSupportedLanguages", new object[] { + packageId}); + return ((int[])(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetSupportedLanguages(int packageId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetSupportedLanguages", new object[] { + packageId}, callback, asyncState); + } + + /// + public int[] EndEnterprise_GetSupportedLanguages(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int[])(results[0])); + } + + /// + public void Enterprise_GetSupportedLanguagesAsync(int packageId) { + this.Enterprise_GetSupportedLanguagesAsync(packageId, null); + } + + /// + public void Enterprise_GetSupportedLanguagesAsync(int packageId, object userState) { + if ((this.Enterprise_GetSupportedLanguagesOperationCompleted == null)) { + this.Enterprise_GetSupportedLanguagesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetSupportedLanguagesOperationCompleted); + } + this.InvokeAsync("Enterprise_GetSupportedLanguages", new object[] { + packageId}, this.Enterprise_GetSupportedLanguagesOperationCompleted, userState); + } + + private void OnEnterprise_GetSupportedLanguagesOperationCompleted(object arg) { + if ((this.Enterprise_GetSupportedLanguagesCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetSupportedLanguagesCompleted(this, new Enterprise_GetSupportedLanguagesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetSiteCollections", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SharePointSiteCollection[] Enterprise_GetSiteCollections(int packageId, bool recursive) { + object[] results = this.Invoke("Enterprise_GetSiteCollections", new object[] { + packageId, + recursive}); + return ((SharePointSiteCollection[])(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetSiteCollections(int packageId, bool recursive, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetSiteCollections", new object[] { + packageId, + recursive}, callback, asyncState); + } + + /// + public SharePointSiteCollection[] EndEnterprise_GetSiteCollections(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SharePointSiteCollection[])(results[0])); + } + + /// + public void Enterprise_GetSiteCollectionsAsync(int packageId, bool recursive) { + this.Enterprise_GetSiteCollectionsAsync(packageId, recursive, null); + } + + /// + public void Enterprise_GetSiteCollectionsAsync(int packageId, bool recursive, object userState) { + if ((this.Enterprise_GetSiteCollectionsOperationCompleted == null)) { + this.Enterprise_GetSiteCollectionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetSiteCollectionsOperationCompleted); + } + this.InvokeAsync("Enterprise_GetSiteCollections", new object[] { + packageId, + recursive}, this.Enterprise_GetSiteCollectionsOperationCompleted, userState); + } + + private void OnEnterprise_GetSiteCollectionsOperationCompleted(object arg) { + if ((this.Enterprise_GetSiteCollectionsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetSiteCollectionsCompleted(this, new Enterprise_GetSiteCollectionsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_SetStorageSettings", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int Enterprise_SetStorageSettings(int itemId, int maxStorage, int warningStorage, bool applyToSiteCollections) { + object[] results = this.Invoke("Enterprise_SetStorageSettings", new object[] { + itemId, + maxStorage, + warningStorage, + applyToSiteCollections}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_SetStorageSettings(int itemId, int maxStorage, int warningStorage, bool applyToSiteCollections, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_SetStorageSettings", new object[] { + itemId, + maxStorage, + warningStorage, + applyToSiteCollections}, callback, asyncState); + } + + /// + public int EndEnterprise_SetStorageSettings(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void Enterprise_SetStorageSettingsAsync(int itemId, int maxStorage, int warningStorage, bool applyToSiteCollections) { + this.Enterprise_SetStorageSettingsAsync(itemId, maxStorage, warningStorage, applyToSiteCollections, null); + } + + /// + public void Enterprise_SetStorageSettingsAsync(int itemId, int maxStorage, int warningStorage, bool applyToSiteCollections, object userState) { + if ((this.Enterprise_SetStorageSettingsOperationCompleted == null)) { + this.Enterprise_SetStorageSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_SetStorageSettingsOperationCompleted); + } + this.InvokeAsync("Enterprise_SetStorageSettings", new object[] { + itemId, + maxStorage, + warningStorage, + applyToSiteCollections}, this.Enterprise_SetStorageSettingsOperationCompleted, userState); + } + + private void OnEnterprise_SetStorageSettingsOperationCompleted(object arg) { + if ((this.Enterprise_SetStorageSettingsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_SetStorageSettingsCompleted(this, new Enterprise_SetStorageSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetSiteCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SharePointSiteCollection Enterprise_GetSiteCollection(int itemId) { + object[] results = this.Invoke("Enterprise_GetSiteCollection", new object[] { + itemId}); + return ((SharePointSiteCollection)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetSiteCollection(int itemId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetSiteCollection", new object[] { + itemId}, callback, asyncState); + } + + /// + public SharePointSiteCollection EndEnterprise_GetSiteCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SharePointSiteCollection)(results[0])); + } + + /// + public void Enterprise_GetSiteCollectionAsync(int itemId) { + this.Enterprise_GetSiteCollectionAsync(itemId, null); + } + + /// + public void Enterprise_GetSiteCollectionAsync(int itemId, object userState) { + if ((this.Enterprise_GetSiteCollectionOperationCompleted == null)) { + this.Enterprise_GetSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_GetSiteCollection", new object[] { + itemId}, this.Enterprise_GetSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_GetSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_GetSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetSiteCollectionCompleted(this, new Enterprise_GetSiteCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetSiteCollectionByDomain" + + "", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SharePointSiteCollection Enterprise_GetSiteCollectionByDomain(int organizationId, string domain) { + object[] results = this.Invoke("Enterprise_GetSiteCollectionByDomain", new object[] { + organizationId, + domain}); + return ((SharePointSiteCollection)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetSiteCollectionByDomain(int organizationId, string domain, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetSiteCollectionByDomain", new object[] { + organizationId, + domain}, callback, asyncState); + } + + /// + public SharePointSiteCollection EndEnterprise_GetSiteCollectionByDomain(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((SharePointSiteCollection)(results[0])); + } + + /// + public void Enterprise_GetSiteCollectionByDomainAsync(int organizationId, string domain) { + this.Enterprise_GetSiteCollectionByDomainAsync(organizationId, domain, null); + } + + /// + public void Enterprise_GetSiteCollectionByDomainAsync(int organizationId, string domain, object userState) { + if ((this.Enterprise_GetSiteCollectionByDomainOperationCompleted == null)) { + this.Enterprise_GetSiteCollectionByDomainOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetSiteCollectionByDomainOperationCompleted); + } + this.InvokeAsync("Enterprise_GetSiteCollectionByDomain", new object[] { + organizationId, + domain}, this.Enterprise_GetSiteCollectionByDomainOperationCompleted, userState); + } + + private void OnEnterprise_GetSiteCollectionByDomainOperationCompleted(object arg) { + if ((this.Enterprise_GetSiteCollectionByDomainCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetSiteCollectionByDomainCompleted(this, new Enterprise_GetSiteCollectionByDomainCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_AddSiteCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int Enterprise_AddSiteCollection(SharePointSiteCollection item) { + object[] results = this.Invoke("Enterprise_AddSiteCollection", new object[] { + item}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_AddSiteCollection(SharePointSiteCollection item, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_AddSiteCollection", new object[] { + item}, callback, asyncState); + } + + /// + public int EndEnterprise_AddSiteCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void Enterprise_AddSiteCollectionAsync(SharePointSiteCollection item) { + this.Enterprise_AddSiteCollectionAsync(item, null); + } + + /// + public void Enterprise_AddSiteCollectionAsync(SharePointSiteCollection item, object userState) { + if ((this.Enterprise_AddSiteCollectionOperationCompleted == null)) { + this.Enterprise_AddSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_AddSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_AddSiteCollection", new object[] { + item}, this.Enterprise_AddSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_AddSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_AddSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_AddSiteCollectionCompleted(this, new Enterprise_AddSiteCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_DeleteSiteCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int Enterprise_DeleteSiteCollection(int itemId) { + object[] results = this.Invoke("Enterprise_DeleteSiteCollection", new object[] { + itemId}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_DeleteSiteCollection(int itemId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_DeleteSiteCollection", new object[] { + itemId}, callback, asyncState); + } + + /// + public int EndEnterprise_DeleteSiteCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void Enterprise_DeleteSiteCollectionAsync(int itemId) { + this.Enterprise_DeleteSiteCollectionAsync(itemId, null); + } + + /// + public void Enterprise_DeleteSiteCollectionAsync(int itemId, object userState) { + if ((this.Enterprise_DeleteSiteCollectionOperationCompleted == null)) { + this.Enterprise_DeleteSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_DeleteSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_DeleteSiteCollection", new object[] { + itemId}, this.Enterprise_DeleteSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_DeleteSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_DeleteSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_DeleteSiteCollectionCompleted(this, new Enterprise_DeleteSiteCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_DeleteSiteCollections", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int Enterprise_DeleteSiteCollections(int organizationId) { + object[] results = this.Invoke("Enterprise_DeleteSiteCollections", new object[] { + organizationId}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_DeleteSiteCollections(int organizationId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_DeleteSiteCollections", new object[] { + organizationId}, callback, asyncState); + } + + /// + public int EndEnterprise_DeleteSiteCollections(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void Enterprise_DeleteSiteCollectionsAsync(int organizationId) { + this.Enterprise_DeleteSiteCollectionsAsync(organizationId, null); + } + + /// + public void Enterprise_DeleteSiteCollectionsAsync(int organizationId, object userState) { + if ((this.Enterprise_DeleteSiteCollectionsOperationCompleted == null)) { + this.Enterprise_DeleteSiteCollectionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_DeleteSiteCollectionsOperationCompleted); + } + this.InvokeAsync("Enterprise_DeleteSiteCollections", new object[] { + organizationId}, this.Enterprise_DeleteSiteCollectionsOperationCompleted, userState); + } + + private void OnEnterprise_DeleteSiteCollectionsOperationCompleted(object arg) { + if ((this.Enterprise_DeleteSiteCollectionsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_DeleteSiteCollectionsCompleted(this, new Enterprise_DeleteSiteCollectionsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_BackupSiteCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string Enterprise_BackupSiteCollection(int itemId, string fileName, bool zipBackup, bool download, string folderName) { + object[] results = this.Invoke("Enterprise_BackupSiteCollection", new object[] { + itemId, + fileName, + zipBackup, + download, + folderName}); + return ((string)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_BackupSiteCollection(int itemId, string fileName, bool zipBackup, bool download, string folderName, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_BackupSiteCollection", new object[] { + itemId, + fileName, + zipBackup, + download, + folderName}, callback, asyncState); + } + + /// + public string EndEnterprise_BackupSiteCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// + public void Enterprise_BackupSiteCollectionAsync(int itemId, string fileName, bool zipBackup, bool download, string folderName) { + this.Enterprise_BackupSiteCollectionAsync(itemId, fileName, zipBackup, download, folderName, null); + } + + /// + public void Enterprise_BackupSiteCollectionAsync(int itemId, string fileName, bool zipBackup, bool download, string folderName, object userState) { + if ((this.Enterprise_BackupSiteCollectionOperationCompleted == null)) { + this.Enterprise_BackupSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_BackupSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_BackupSiteCollection", new object[] { + itemId, + fileName, + zipBackup, + download, + folderName}, this.Enterprise_BackupSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_BackupSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_BackupSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_BackupSiteCollectionCompleted(this, new Enterprise_BackupSiteCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_RestoreSiteCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int Enterprise_RestoreSiteCollection(int itemId, string uploadedFile, string packageFile) { + object[] results = this.Invoke("Enterprise_RestoreSiteCollection", new object[] { + itemId, + uploadedFile, + packageFile}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_RestoreSiteCollection(int itemId, string uploadedFile, string packageFile, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_RestoreSiteCollection", new object[] { + itemId, + uploadedFile, + packageFile}, callback, asyncState); + } + + /// + public int EndEnterprise_RestoreSiteCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void Enterprise_RestoreSiteCollectionAsync(int itemId, string uploadedFile, string packageFile) { + this.Enterprise_RestoreSiteCollectionAsync(itemId, uploadedFile, packageFile, null); + } + + /// + public void Enterprise_RestoreSiteCollectionAsync(int itemId, string uploadedFile, string packageFile, object userState) { + if ((this.Enterprise_RestoreSiteCollectionOperationCompleted == null)) { + this.Enterprise_RestoreSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_RestoreSiteCollectionOperationCompleted); + } + this.InvokeAsync("Enterprise_RestoreSiteCollection", new object[] { + itemId, + uploadedFile, + packageFile}, this.Enterprise_RestoreSiteCollectionOperationCompleted, userState); + } + + private void OnEnterprise_RestoreSiteCollectionOperationCompleted(object arg) { + if ((this.Enterprise_RestoreSiteCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_RestoreSiteCollectionCompleted(this, new Enterprise_RestoreSiteCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetBackupBinaryChunk", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [return: System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] + public byte[] Enterprise_GetBackupBinaryChunk(int itemId, string path, int offset, int length) { + object[] results = this.Invoke("Enterprise_GetBackupBinaryChunk", new object[] { + itemId, + path, + offset, + length}); + return ((byte[])(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_GetBackupBinaryChunk(int itemId, string path, int offset, int length, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_GetBackupBinaryChunk", new object[] { + itemId, + path, + offset, + length}, callback, asyncState); + } + + /// + public byte[] EndEnterprise_GetBackupBinaryChunk(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((byte[])(results[0])); + } + + /// + public void Enterprise_GetBackupBinaryChunkAsync(int itemId, string path, int offset, int length) { + this.Enterprise_GetBackupBinaryChunkAsync(itemId, path, offset, length, null); + } + + /// + public void Enterprise_GetBackupBinaryChunkAsync(int itemId, string path, int offset, int length, object userState) { + if ((this.Enterprise_GetBackupBinaryChunkOperationCompleted == null)) { + this.Enterprise_GetBackupBinaryChunkOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_GetBackupBinaryChunkOperationCompleted); + } + this.InvokeAsync("Enterprise_GetBackupBinaryChunk", new object[] { + itemId, + path, + offset, + length}, this.Enterprise_GetBackupBinaryChunkOperationCompleted, userState); + } + + private void OnEnterprise_GetBackupBinaryChunkOperationCompleted(object arg) { + if ((this.Enterprise_GetBackupBinaryChunkCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_GetBackupBinaryChunkCompleted(this, new Enterprise_GetBackupBinaryChunkCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_AppendBackupBinaryChunk", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string Enterprise_AppendBackupBinaryChunk(int itemId, string fileName, string path, [System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] chunk) { + object[] results = this.Invoke("Enterprise_AppendBackupBinaryChunk", new object[] { + itemId, + fileName, + path, + chunk}); + return ((string)(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_AppendBackupBinaryChunk(int itemId, string fileName, string path, byte[] chunk, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_AppendBackupBinaryChunk", new object[] { + itemId, + fileName, + path, + chunk}, callback, asyncState); + } + + /// + public string EndEnterprise_AppendBackupBinaryChunk(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((string)(results[0])); + } + + /// + public void Enterprise_AppendBackupBinaryChunkAsync(int itemId, string fileName, string path, byte[] chunk) { + this.Enterprise_AppendBackupBinaryChunkAsync(itemId, fileName, path, chunk, null); + } + + /// + public void Enterprise_AppendBackupBinaryChunkAsync(int itemId, string fileName, string path, byte[] chunk, object userState) { + if ((this.Enterprise_AppendBackupBinaryChunkOperationCompleted == null)) { + this.Enterprise_AppendBackupBinaryChunkOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_AppendBackupBinaryChunkOperationCompleted); + } + this.InvokeAsync("Enterprise_AppendBackupBinaryChunk", new object[] { + itemId, + fileName, + path, + chunk}, this.Enterprise_AppendBackupBinaryChunkOperationCompleted, userState); + } + + private void OnEnterprise_AppendBackupBinaryChunkOperationCompleted(object arg) { + if ((this.Enterprise_AppendBackupBinaryChunkCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_AppendBackupBinaryChunkCompleted(this, new Enterprise_AppendBackupBinaryChunkCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_CalculateSharePointSitesD" + + "iskSpace", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public SharePointSiteDiskSpace[] Enterprise_CalculateSharePointSitesDiskSpace(int itemId, out int errorCode) { + object[] results = this.Invoke("Enterprise_CalculateSharePointSitesDiskSpace", new object[] { + itemId}); + errorCode = ((int)(results[1])); + return ((SharePointSiteDiskSpace[])(results[0])); + } + + /// + public System.IAsyncResult BeginEnterprise_CalculateSharePointSitesDiskSpace(int itemId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_CalculateSharePointSitesDiskSpace", new object[] { + itemId}, callback, asyncState); + } + + /// + public SharePointSiteDiskSpace[] EndEnterprise_CalculateSharePointSitesDiskSpace(System.IAsyncResult asyncResult, out int errorCode) { + object[] results = this.EndInvoke(asyncResult); + errorCode = ((int)(results[1])); + return ((SharePointSiteDiskSpace[])(results[0])); + } + + /// + public void Enterprise_CalculateSharePointSitesDiskSpaceAsync(int itemId) { + this.Enterprise_CalculateSharePointSitesDiskSpaceAsync(itemId, null); + } + + /// + public void Enterprise_CalculateSharePointSitesDiskSpaceAsync(int itemId, object userState) { + if ((this.Enterprise_CalculateSharePointSitesDiskSpaceOperationCompleted == null)) { + this.Enterprise_CalculateSharePointSitesDiskSpaceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_CalculateSharePointSitesDiskSpaceOperationCompleted); + } + this.InvokeAsync("Enterprise_CalculateSharePointSitesDiskSpace", new object[] { + itemId}, this.Enterprise_CalculateSharePointSitesDiskSpaceOperationCompleted, userState); + } + + private void OnEnterprise_CalculateSharePointSitesDiskSpaceOperationCompleted(object arg) { + if ((this.Enterprise_CalculateSharePointSitesDiskSpaceCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_CalculateSharePointSitesDiskSpaceCompleted(this, new Enterprise_CalculateSharePointSitesDiskSpaceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_UpdateQuota", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void Enterprise_UpdateQuota(int itemId, int siteCollectionId, int maxSize, int warningSize) { + this.Invoke("Enterprise_UpdateQuota", new object[] { + itemId, + siteCollectionId, + maxSize, + warningSize}); + } + + /// + public System.IAsyncResult BeginEnterprise_UpdateQuota(int itemId, int siteCollectionId, int maxSize, int warningSize, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("Enterprise_UpdateQuota", new object[] { + itemId, + siteCollectionId, + maxSize, + warningSize}, callback, asyncState); + } + + /// + public void EndEnterprise_UpdateQuota(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void Enterprise_UpdateQuotaAsync(int itemId, int siteCollectionId, int maxSize, int warningSize) { + this.Enterprise_UpdateQuotaAsync(itemId, siteCollectionId, maxSize, warningSize, null); + } + + /// + public void Enterprise_UpdateQuotaAsync(int itemId, int siteCollectionId, int maxSize, int warningSize, object userState) { + if ((this.Enterprise_UpdateQuotaOperationCompleted == null)) { + this.Enterprise_UpdateQuotaOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_UpdateQuotaOperationCompleted); + } + this.InvokeAsync("Enterprise_UpdateQuota", new object[] { + itemId, + siteCollectionId, + maxSize, + warningSize}, this.Enterprise_UpdateQuotaOperationCompleted, userState); + } + + private void OnEnterprise_UpdateQuotaOperationCompleted(object arg) { + if ((this.Enterprise_UpdateQuotaCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.Enterprise_UpdateQuotaCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) { + base.CancelAsync(userState); + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetSiteCollectionsPagedCompletedEventHandler(object sender, Enterprise_GetSiteCollectionsPagedCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetSiteCollectionsPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetSiteCollectionsPagedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SharePointSiteCollectionListPaged Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SharePointSiteCollectionListPaged)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetSupportedLanguagesCompletedEventHandler(object sender, Enterprise_GetSupportedLanguagesCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetSupportedLanguagesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetSupportedLanguagesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetSiteCollectionsCompletedEventHandler(object sender, Enterprise_GetSiteCollectionsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetSiteCollectionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetSiteCollectionsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SharePointSiteCollection[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SharePointSiteCollection[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_SetStorageSettingsCompletedEventHandler(object sender, Enterprise_SetStorageSettingsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_SetStorageSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_SetStorageSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetSiteCollectionCompletedEventHandler(object sender, Enterprise_GetSiteCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetSiteCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SharePointSiteCollection Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SharePointSiteCollection)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetSiteCollectionByDomainCompletedEventHandler(object sender, Enterprise_GetSiteCollectionByDomainCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetSiteCollectionByDomainCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetSiteCollectionByDomainCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SharePointSiteCollection Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SharePointSiteCollection)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_AddSiteCollectionCompletedEventHandler(object sender, Enterprise_AddSiteCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_AddSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_AddSiteCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_DeleteSiteCollectionCompletedEventHandler(object sender, Enterprise_DeleteSiteCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_DeleteSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_DeleteSiteCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_DeleteSiteCollectionsCompletedEventHandler(object sender, Enterprise_DeleteSiteCollectionsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_DeleteSiteCollectionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_DeleteSiteCollectionsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_BackupSiteCollectionCompletedEventHandler(object sender, Enterprise_BackupSiteCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_BackupSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_BackupSiteCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_RestoreSiteCollectionCompletedEventHandler(object sender, Enterprise_RestoreSiteCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_RestoreSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_RestoreSiteCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_GetBackupBinaryChunkCompletedEventHandler(object sender, Enterprise_GetBackupBinaryChunkCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_GetBackupBinaryChunkCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_GetBackupBinaryChunkCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public byte[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((byte[])(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_AppendBackupBinaryChunkCompletedEventHandler(object sender, Enterprise_AppendBackupBinaryChunkCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_AppendBackupBinaryChunkCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_AppendBackupBinaryChunkCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public string Result { + get { + this.RaiseExceptionIfNecessary(); + return ((string)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_CalculateSharePointSitesDiskSpaceCompletedEventHandler(object sender, Enterprise_CalculateSharePointSitesDiskSpaceCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class Enterprise_CalculateSharePointSitesDiskSpaceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal Enterprise_CalculateSharePointSitesDiskSpaceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public SharePointSiteDiskSpace[] Result { + get { + this.RaiseExceptionIfNecessary(); + return ((SharePointSiteDiskSpace[])(this.results[0])); + } + } + + /// + public int errorCode { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[1])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void Enterprise_UpdateQuotaCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/WebsitePanel.EnterpriseServer.Client.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/WebsitePanel.EnterpriseServer.Client.csproj index 481ef66f..0393a436 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/WebsitePanel.EnterpriseServer.Client.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/WebsitePanel.EnterpriseServer.Client.csproj @@ -89,6 +89,7 @@ code + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx index 394c337c..c27229d3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx @@ -1 +1 @@ -<%@ WebService Language="C#" CodeBehind="esHostedSharePointServersEnt.asmx.cs" Class="WebsitePanel.EnterpriseServer.esHostedSharePointServers" %> +<%@ WebService Language="C#" CodeBehind="esHostedSharePointServersEnt.asmx.cs" Class="WebsitePanel.EnterpriseServer.esHostedSharePointServersEnt" %> From fed079a14b0d07ff7d9b9d1bed2d7fa3fd1414e0 Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 5 Apr 2015 08:56:18 +0800 Subject: [PATCH 46/91] Sharepoint Enterprise -> remove sharepoint changes applied to portal --- .../HostedSharePointServerEntController.cs | 6 +-- .../HostedSharePointBackupSiteCollection.ascx | 4 +- ...stedSharePointBackupSiteCollection.ascx.cs | 13 ++----- ...PointBackupSiteCollection.ascx.designer.cs | 37 +++++-------------- .../HostedSharePointEditSiteCollection.ascx | 2 + ...HostedSharePointEditSiteCollection.ascx.cs | 7 ---- ...rePointEditSiteCollection.ascx.designer.cs | 37 +++++-------------- ...HostedSharePointRestoreSiteCollection.ascx | 4 ++ ...tedSharePointRestoreSiteCollection.ascx.cs | 7 +--- ...ointRestoreSiteCollection.ascx.designer.cs | 37 +++++-------------- .../HostedSharePointSiteCollections.ascx | 3 +- .../HostedSharePointSiteCollections.ascx.cs | 10 ++--- .../HostedSharePointStorageSettings.ascx | 3 +- ...SharePointStorageSettings.ascx.designer.cs | 37 +++++-------------- .../HostedSharePointStorageUsage.ascx | 2 + ...tedSharePointStorageUsage.ascx.designer.cs | 37 +++++-------------- 16 files changed, 69 insertions(+), 177 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs index 87c147e1..f24b4c44 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs @@ -58,7 +58,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Row index to start from. /// Maximum number of rows to retrieve. /// Site collections that match. - public static SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName = null) + public static SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { if (IsDemoMode) { @@ -122,7 +122,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint // Log operation. TaskManager.StartTask("HOSTED_SHAREPOINT_ENTERPRISE", "GET_LANGUAGES"); - int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.SharepointFoundationServer); + int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.SharepointEnterpriseServer); if (serviceId == 0) { return new int[] { }; @@ -149,7 +149,6 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// /// Package that owns site collections. /// A value which shows whether nested spaces must be searched as well. - /// Resource group name. /// List of found site collections. public static List GetSiteCollections(int packageId, bool recursive) { @@ -208,7 +207,6 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Adds SharePoint site collection. /// /// Site collection description. - /// Resource group name. /// Created site collection id within metabase. public static int AddSiteCollection(SharePointSiteCollection item) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx index 932d7aa8..7cc9c611 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx @@ -3,7 +3,8 @@ <%@ Register Src="UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> <%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> - + +<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> <%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> @@ -13,6 +14,7 @@
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs index 4171ea68..5e1afb37 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs @@ -61,11 +61,6 @@ namespace WebsitePanel.Portal } } - public static string GroupName - { - get { return HttpContext.Current.Request["GroupName"]; } - } - protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) @@ -165,10 +160,10 @@ namespace WebsitePanel.Portal RedirectBack(); } - private void RedirectBack() - { - HttpContext.Current.Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); - } + private void RedirectBack() + { + HttpContext.Current.Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + } protected void chkZipBackup_CheckedChanged(object sender, EventArgs e) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs index fd9c426c..7e8df4e9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. @@ -49,6 +21,15 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + /// + /// menu control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; + /// /// Image1 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx index d80139d7..35773dfe 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx @@ -3,6 +3,7 @@ <%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> <%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> <%@ Register Src="UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> +<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> <%@ Register Src="UserControls/AllocatePackageIPAddresses.ascx" TagName="SiteUrlBuilder" TagPrefix="wsp" %> <%@ Register Src="ExchangeServer/UserControls/UserSelector.ascx" TagName="UserSelector" TagPrefix="wsp" %> <%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> @@ -14,6 +15,7 @@
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs index 89ce616c..0a35bcfc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs @@ -420,13 +420,6 @@ namespace WebsitePanel.Portal return true; } - break; - case 552: - if (Convert.ToBoolean(quota.QuotaAllocatedValue)) - { - return true; - } - break; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs index b82a5dd1..694af254 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. @@ -49,6 +21,15 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + /// + /// menu control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; + /// /// Image1 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx index 4b256403..16ea6abd 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx @@ -3,6 +3,9 @@ <%@ Register Src="UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> <%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +6 +<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> + <%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> @@ -14,6 +17,7 @@
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs index 74c9be70..de33f161 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs @@ -59,11 +59,6 @@ namespace WebsitePanel.Portal } } - public static string GroupName - { - get { return HttpContext.Current.Request["GroupName"]; } - } - protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) @@ -171,7 +166,7 @@ namespace WebsitePanel.Portal private void RedirectBack() { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); } protected void radioUpload_CheckedChanged(object sender, EventArgs e) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs index 061c85f8..7903ac5e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. @@ -49,6 +21,15 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + /// + /// menu control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; + /// /// Image1 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx index a1734e43..2e6b6269 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx @@ -76,8 +76,7 @@ function confirmation() - - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs index 0bd9b7b0..b03fd0f0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs @@ -44,11 +44,7 @@ namespace WebsitePanel.Portal { public partial class HostedSharePointSiteCollections : WebsitePanelModuleBase { - public static string GroupName - { - get { return HttpContext.Current.Request["GroupName"]; } - } - + protected void Page_Load(object sender, EventArgs e) { this.BindStats(); @@ -67,14 +63,14 @@ namespace WebsitePanel.Portal protected void btnCreateSiteCollection_Click(object sender, EventArgs e) { - Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_edit_sitecollection", "SpaceID=" + PanelSecurity.PackageId.ToString(), "GroupName=" + GroupName)); + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_edit_sitecollection", "SpaceID=" + PanelSecurity.PackageId.ToString())); } public string GetSiteCollectionEditUrl(string siteCollectionId) { return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + siteCollectionId, - "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName); + "ItemID=" + PanelRequest.ItemID.ToString()); } protected void odsSharePointSiteCollectionPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx index 6329dc5b..5fb250d7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx @@ -6,7 +6,7 @@ <%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> <%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> - +<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> <%@ Register src="UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> @@ -14,6 +14,7 @@
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs index 8cc0e3cc..b004706e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. @@ -40,6 +12,15 @@ namespace WebsitePanel.Portal { public partial class HostedSharePointStorageSettings { + /// + /// menu control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; + /// /// Image1 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx index 54db370b..9308c5b0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx @@ -6,10 +6,12 @@ <%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> <%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %>
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs index 43f100c7..b6916e27 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. @@ -40,6 +12,15 @@ namespace WebsitePanel.Portal { public partial class HostedSharePointStorageUsage { + /// + /// menu control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; + /// /// Image1 control. /// From 42b4d8730157a7824d73b4c1640e6775d113be23 Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 5 Apr 2015 11:30:57 +0800 Subject: [PATCH 47/91] Fix up sharepoint 2013 mess --- WebsitePanel/Database/update_db.sql | 7 +- .../HostedSharePointServersProxy.cs | 61 ++++++++--------- .../HostedSolution/OrganizationController.cs | 7 ++ .../HostedSolution/ReportController.cs | 66 +++++++++++++++++++ .../CalculatePackagesDiskspaceTask.cs | 14 ++++ .../HostedSharePointServerEntController.cs | 2 +- .../esHostedSharePointServers.asmx.cs | 3 - .../WebsitePanel_SharedResources.ascx.resx | 7 +- .../OrganizationMenu.ascx.resx | 4 +- .../UserOrganization.ascx.resx | 4 +- .../HostedSharePointSiteCollectionsHelper.cs | 16 +---- .../App_LocalResources/Menu.ascx.resx | 4 +- .../ExchangeServer/UserControls/Menu.ascx.cs | 4 +- .../HostedSharePointBackupSiteCollection.ascx | 1 - ...PointBackupSiteCollection.ascx.designer.cs | 9 --- .../HostedSharePointEditSiteCollection.ascx | 1 - ...HostedSharePointEditSiteCollection.ascx.cs | 30 ++------- ...rePointEditSiteCollection.ascx.designer.cs | 9 --- ...HostedSharePointRestoreSiteCollection.ascx | 1 - ...ointRestoreSiteCollection.ascx.designer.cs | 9 --- .../HostedSharePointStorageSettings.ascx | 1 - ...SharePointStorageSettings.ascx.designer.cs | 9 --- .../HostedSharePointStorageUsage.ascx | 1 - ...tedSharePointStorageUsage.ascx.designer.cs | 9 --- .../WebsitePanel/ServersEditService.ascx.cs | 2 +- .../UserControls/OrganizationMenuControl.cs | 4 +- 26 files changed, 141 insertions(+), 144 deletions(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 9470c435..68a99329 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9462,11 +9462,15 @@ END GO UPDATE [dbo].[Quotas] SET GroupID = 45 WHERE QuotaName = 'EnterpriseStorage.DriveMaps' +GO UPDATE [dbo].[ResourceGroups] SET GroupName = 'Sharepoint Enterprise Server' WHERE GroupName = 'Sharepoint Server' GO +UPDATE [dbo].[ResourceGroups] SET GroupController = 'WebsitePanel.EnterpriseServer.HostedSharePointServerEntController' WHERE GroupName = 'Sharepoint Enterprise Server' +GO + IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'Hosted SharePoint Enterprise 2013') BEGIN DECLARE @provider_id AS INT @@ -9478,9 +9482,6 @@ VALUES (@provider_id, @group_id, N'HostedSharePoint2013Ent', N'Hosted SharePoint END GO -UPDATE Providers SET ProviderType = N'WebsitePanel.Providers.HostedSolution.HostedSharePointServer2013Ent, WebsitePanel.Providers.HostedSolution.SharePoint2013Ent' WHERE ProviderID = 1301 -GO - UPDATE [dbo].[Quotas] SET QuotaName = 'HostedSharePointEnterprise.Sites' WHERE QuotaId = 550 GO diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs index 63534afd..ccff6073 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs @@ -26,11 +26,10 @@ // (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.7905 +// Runtime Version:2.0.50727.8009 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -51,6 +50,7 @@ namespace WebsitePanel.EnterpriseServer { using WebsitePanel.Providers; + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] @@ -141,7 +141,7 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetSiteCollectionsPaged", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName) { + public SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { object[] results = this.Invoke("GetSiteCollectionsPaged", new object[] { packageId, organizationId, @@ -149,13 +149,12 @@ namespace WebsitePanel.EnterpriseServer { filterValue, sortColumn, startRow, - maximumRows, - groupName}); + maximumRows}); return ((SharePointSiteCollectionListPaged)(results[0])); } /// - public System.IAsyncResult BeginGetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetSiteCollectionsPaged", new object[] { packageId, organizationId, @@ -163,8 +162,7 @@ namespace WebsitePanel.EnterpriseServer { filterValue, sortColumn, startRow, - maximumRows, - groupName}, callback, asyncState); + maximumRows}, callback, asyncState); } /// @@ -174,12 +172,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName) { - this.GetSiteCollectionsPagedAsync(packageId, organizationId, filterColumn, filterValue, sortColumn, startRow, maximumRows, groupName, null); + public void GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { + this.GetSiteCollectionsPagedAsync(packageId, organizationId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null); } /// - public void GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName, object userState) { + public void GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) { if ((this.GetSiteCollectionsPagedOperationCompleted == null)) { this.GetSiteCollectionsPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetSiteCollectionsPagedOperationCompleted); } @@ -190,8 +188,7 @@ namespace WebsitePanel.EnterpriseServer { filterValue, sortColumn, startRow, - maximumRows, - groupName}, this.GetSiteCollectionsPagedOperationCompleted, userState); + maximumRows}, this.GetSiteCollectionsPagedOperationCompleted, userState); } private void OnGetSiteCollectionsPagedOperationCompleted(object arg) { @@ -244,20 +241,18 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetSiteCollections", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollection[] GetSiteCollections(int packageId, bool recursive, string groupName) { + public SharePointSiteCollection[] GetSiteCollections(int packageId, bool recursive) { object[] results = this.Invoke("GetSiteCollections", new object[] { packageId, - recursive, - groupName}); + recursive}); return ((SharePointSiteCollection[])(results[0])); } /// - public System.IAsyncResult BeginGetSiteCollections(int packageId, bool recursive, string groupName, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetSiteCollections(int packageId, bool recursive, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetSiteCollections", new object[] { packageId, - recursive, - groupName}, callback, asyncState); + recursive}, callback, asyncState); } /// @@ -267,19 +262,18 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void GetSiteCollectionsAsync(int packageId, bool recursive, string groupName) { - this.GetSiteCollectionsAsync(packageId, recursive, groupName, null); + public void GetSiteCollectionsAsync(int packageId, bool recursive) { + this.GetSiteCollectionsAsync(packageId, recursive, null); } /// - public void GetSiteCollectionsAsync(int packageId, bool recursive, string groupName, object userState) { + public void GetSiteCollectionsAsync(int packageId, bool recursive, object userState) { if ((this.GetSiteCollectionsOperationCompleted == null)) { this.GetSiteCollectionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetSiteCollectionsOperationCompleted); } this.InvokeAsync("GetSiteCollections", new object[] { packageId, - recursive, - groupName}, this.GetSiteCollectionsOperationCompleted, userState); + recursive}, this.GetSiteCollectionsOperationCompleted, userState); } private void OnGetSiteCollectionsOperationCompleted(object arg) { @@ -426,18 +420,16 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddSiteCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public int AddSiteCollection(SharePointSiteCollection item, string groupName) { + public int AddSiteCollection(SharePointSiteCollection item) { object[] results = this.Invoke("AddSiteCollection", new object[] { - item, - groupName}); + item}); return ((int)(results[0])); } /// - public System.IAsyncResult BeginAddSiteCollection(SharePointSiteCollection item, string groupName, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginAddSiteCollection(SharePointSiteCollection item, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("AddSiteCollection", new object[] { - item, - groupName}, callback, asyncState); + item}, callback, asyncState); } /// @@ -447,18 +439,17 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void AddSiteCollectionAsync(SharePointSiteCollection item, string groupName) { - this.AddSiteCollectionAsync(item, groupName, null); + public void AddSiteCollectionAsync(SharePointSiteCollection item) { + this.AddSiteCollectionAsync(item, null); } /// - public void AddSiteCollectionAsync(SharePointSiteCollection item, string groupName, object userState) { + public void AddSiteCollectionAsync(SharePointSiteCollection item, object userState) { if ((this.AddSiteCollectionOperationCompleted == null)) { this.AddSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddSiteCollectionOperationCompleted); } this.InvokeAsync("AddSiteCollection", new object[] { - item, - groupName}, this.AddSiteCollectionOperationCompleted, userState); + item}, this.AddSiteCollectionOperationCompleted, userState); } private void OnAddSiteCollectionOperationCompleted(object arg) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index c56aa486..8b536f54 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -1074,8 +1074,15 @@ namespace WebsitePanel.EnterpriseServer { SharePointSiteCollectionListPaged sharePointStats = HostedSharePointServerController.GetSiteCollectionsPaged(org.PackageId, o.Id, string.Empty, string.Empty, string.Empty, 0, 0); stats.CreatedSharePointSiteCollections += sharePointStats.TotalRowCount; + } + + if (cntxTmp.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer)) + { + SharePointSiteCollectionListPaged sharePointStats = HostedSharePointServerController.GetSiteCollectionsPaged(org.PackageId, o.Id, string.Empty, string.Empty, string.Empty, 0, 0); + stats.CreatedSharePointEnterpriseSiteCollections += sharePointStats.TotalRowCount; } + if (cntxTmp.Groups.ContainsKey(ResourceGroups.HostedCRM)) { stats.CreatedCRMUsers += CRMController.GetCRMUsersCount(o.Id, string.Empty, string.Empty, CRMUserLycenseTypes.FULL ).Value; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs index 82589f64..b6c63d98 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs @@ -158,6 +158,18 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution return PackageController.GetPackageServiceId(packageId, ResourceGroups.SharepointFoundationServer); } + + private static HostedSharePointServerEnt GetHostedSharePointServerEnt(int serviceId) + { + HostedSharePointServerEnt sps = new HostedSharePointServerEnt(); + ServiceProviderProxy.Init(sps, serviceId); + return sps; + } + + private static int GetHostedSharePointEntServiceId(int packageId) + { + return PackageController.GetPackageServiceId(packageId, ResourceGroups.SharepointEnterpriseServer); + } private static void PopulateBaseItem(BaseStatistics stats, Organization org, string topReseller) { @@ -394,6 +406,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution string.Format("Could not get sharepoint server. PackageId: {0}", org.PackageId), ex); } + foreach (SharePointSiteCollection siteCollection in siteCollections) { try @@ -419,6 +432,59 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution } + private static void PopulateSharePointEntItem(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller) + { + List siteCollections; + + try + { + siteCollections = HostedSharePointServerEntController.GetSiteCollections(org.Id); + } + catch (Exception ex) + { + throw new ApplicationException(string.Format("Could not get site collections. OrgId: {0}", org.Id), ex); + } + + if (siteCollections == null || siteCollections.Count == 0) + return; + + + HostedSharePointServerEnt srvEnt; + try + { + int serviceId = GetHostedSharePointEntServiceId(org.PackageId); + srvEnt = GetHostedSharePointServerEnt(serviceId); + } + catch (Exception ex) + { + throw new ApplicationException( + string.Format("Could not get sharepoint enterprise server. PackageId: {0}", org.PackageId), ex); + } + + foreach (SharePointSiteCollection siteCollection in siteCollections) + { + try + { + SharePointStatistics stats = new SharePointStatistics(); + PopulateBaseItem(stats, org, topReseller); + + stats.SiteCollectionUrl = siteCollection.PhysicalAddress; + stats.SiteCollectionOwner = siteCollection.OwnerName; + stats.SiteCollectionQuota = siteCollection.MaxSiteStorage; + + stats.SiteCollectionCreated = siteCollection.CreatedDate; + + stats.SiteCollectionSize = srvEnt.Enterprise_GetSiteCollectionSize(siteCollection.PhysicalAddress); + + report.SharePointReport.Items.Add(stats); + } + catch (Exception ex) + { + TaskManager.WriteError(ex); + } + } + } + private static void PopulateExchangeReportItems(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller) { TaskManager.Write("Exchange Report Items " + org.Name); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/CalculatePackagesDiskspaceTask.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/CalculatePackagesDiskspaceTask.cs index 272c6e8a..9d6302fb 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/CalculatePackagesDiskspaceTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/CalculatePackagesDiskspaceTask.cs @@ -179,6 +179,20 @@ namespace WebsitePanel.EnterpriseServer } } } + + if (cntx.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer)) + { + SharePointSiteDiskSpace[] sharePointSiteDiskSpaces = + HostedSharePointServerEntController.CalculateSharePointSitesDiskSpace(org.Id, out res); + if (res == 0) + { + foreach (SharePointSiteDiskSpace currecnt in sharePointSiteDiskSpaces) + { + size += currecnt.DiskSpace; + } + } + } + ServiceProviderItemDiskSpace tmp = new ServiceProviderItemDiskSpace(); tmp.ItemId = item.Id; tmp.DiskSpace = size; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs index f24b4c44..cbe0867a 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs @@ -791,7 +791,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint private static int GetHostedSharePointServiceId(int packageId) { - return PackageController.GetPackageServiceId(packageId, ResourceGroups.SharepointFoundationServer); + return PackageController.GetPackageServiceId(packageId, ResourceGroups.SharepointEnterpriseServer); } private static List GetOrganizationSharePointSiteCollections(int orgId) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs index 2468333c..4aa4946f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs @@ -55,7 +55,6 @@ namespace WebsitePanel.EnterpriseServer /// Sort column name. /// Row index to start from. /// Maximum number of rows to retrieve. - /// Resource group name. /// Site collections in raw format. [WebMethod] public SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, @@ -80,7 +79,6 @@ namespace WebsitePanel.EnterpriseServer /// /// Package that owns site collections. /// A value which shows whether nested spaces must be searched as well. - /// Resource group name. /// List of found site collections. [WebMethod] public List GetSiteCollections(int packageId, bool recursive) @@ -133,7 +131,6 @@ namespace WebsitePanel.EnterpriseServer /// Adds SharePoint site collection. /// /// Site collection description. - /// Resource group name. /// Created site collection id within metabase. [WebMethod] public int AddSiteCollection(SharePointSiteCollection item) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 937e6e43..d403de41 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -3371,14 +3371,11 @@ Deleted Users Backup Storage Space per Organization, Mb - - Hosted SharePoint - SharePoint Foundation Server - - SharePoint Server + + SharePoint Enterprise Server Office Communications Server diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx index f6644414..11849f1e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx @@ -204,8 +204,8 @@ SharePoint Foundation - - SharePoint Server + + SharePoint Enterprise Server Site Collections diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx index 135dc55a..c9e880a7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx @@ -237,8 +237,8 @@ Hosted Organization - SharePoint Foundation Server - - Hosted Organization - SharePoint Server + + Hosted Organization - SharePoint Enterprise Server Sharepoint Sites diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointSiteCollectionsHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointSiteCollectionsHelper.cs index 50a0078e..6f0dd712 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointSiteCollectionsHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointSiteCollectionsHelper.cs @@ -37,7 +37,6 @@ using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using WebsitePanel.Providers.SharePoint; using System.Collections.Generic; -using WebsitePanel.EnterpriseServer; namespace WebsitePanel.Portal { @@ -45,28 +44,19 @@ namespace WebsitePanel.Portal { SharePointSiteCollectionListPaged result; - public int GetSharePointSiteCollectionPagedCount(int packageId, int organizationId, string groupName, string filterColumn, string filterValue) + public int GetSharePointSiteCollectionPagedCount(int packageId, int organizationId, string filterColumn, string filterValue) { return result.TotalRowCount; } - public List GetSharePointSiteCollectionPaged(int packageId, int organizationId, string groupName, string filterColumn, string filterValue, int maximumRows, int startRowIndex, string sortColumn) + public List GetSharePointSiteCollectionPaged(int packageId, int organizationId, string filterColumn, string filterValue, int maximumRows, int startRowIndex, string sortColumn) { if (!String.IsNullOrEmpty(filterValue)) { filterValue = filterValue + "%"; } - if (ResourceGroups.SharepointFoundationServer.Replace(" ", "").Equals(groupName)) - { - groupName = ResourceGroups.SharepointFoundationServer; - } - else if (ResourceGroups.SharepointServer.Replace(" ", "").Equals(groupName)) - { - groupName = ResourceGroups.SharepointServer; - } - - result = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows, groupName); + result = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows); return result.SiteCollections; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx index 6563c74a..cd6d756e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx @@ -168,8 +168,8 @@ SharePoint Foundation - - SharePoint Server + + SharePoint Enterprise OCS diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs index 45d1f8c5..25ae4d73 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/Menu.ascx.cs @@ -319,9 +319,9 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls PrepareSharePointMenu(cntx, groups, imagePath, GetLocalizedString("Text.SharePointFoundationServerGroup")); } - if (cntx.Groups.ContainsKey(ResourceGroups.SharepointServer)) + if (cntx.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer)) { - PrepareSharePointMenu(cntx, groups, imagePath, GetLocalizedString("Text.SharePointServerGroup")); + PrepareSharePointMenu(cntx, groups, imagePath, GetLocalizedString("Text.SharePointEnterpriseServerGroup")); } //CRM Menu diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx index 7cc9c611..6ee199ec 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx @@ -14,7 +14,6 @@
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs index 7e8df4e9..6bd4aa9e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs @@ -21,15 +21,6 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - /// - /// menu control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; - /// /// Image1 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx index 35773dfe..5a219436 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx @@ -15,7 +15,6 @@
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs index 0a35bcfc..1c150ca9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs @@ -44,11 +44,6 @@ namespace WebsitePanel.Portal { SharePointSiteCollection item = null; - public static string GroupName - { - get { return HttpContext.Current.Request["GroupName"]; } - } - private int OrganizationId { get @@ -230,7 +225,7 @@ namespace WebsitePanel.Portal /// Reserved disk space vallue. private int GetReservedDiskStorageSpace() { - var existingCollections = ES.Services.HostedSharePointServers.GetSiteCollections(PanelSecurity.PackageId, false, GroupName); + var existingCollections = ES.Services.HostedSharePointServers.GetSiteCollections(PanelSecurity.PackageId, false); return (int)existingCollections.Sum(siteCollection => siteCollection.MaxSiteStorage); } @@ -257,20 +252,9 @@ namespace WebsitePanel.Portal { item = new SharePointSiteCollection(); - string groupName = GroupName; - - if (ResourceGroups.SharepointFoundationServer.Replace(" ", "").Equals(groupName)) - { - groupName = ResourceGroups.SharepointFoundationServer; - } - else if (ResourceGroups.SharepointServer.Replace(" ", "").Equals(groupName)) - { - groupName = ResourceGroups.SharepointServer; - } - - if (!UseSharedSLL(PanelSecurity.PackageId)) + if (!UseSharedSLL(PanelSecurity.PackageId)) { - SharePointSiteCollectionListPaged existentSiteCollections = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(PanelSecurity.PackageId, this.OrganizationId, "ItemName", String.Format("%{0}", this.domain.DomainName), String.Empty, 0, Int32.MaxValue, groupName); + SharePointSiteCollectionListPaged existentSiteCollections = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(PanelSecurity.PackageId, this.OrganizationId, "ItemName", String.Format("%{0}", this.domain.DomainName), String.Empty, 0, Int32.MaxValue); foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) { Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); @@ -303,7 +287,7 @@ namespace WebsitePanel.Portal item.MaxSiteStorage = maxStorage.QuotaValue; item.WarningStorage = warningStorage.QuotaValue; - int result = ES.Services.HostedSharePointServers.AddSiteCollection(item, groupName); + int result = ES.Services.HostedSharePointServers.AddSiteCollection(item); if (result < 0) { localMessageBox.ShowResultMessage(result); @@ -390,19 +374,19 @@ namespace WebsitePanel.Portal protected void btnBackup_Click(object sender, EventArgs e) { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_backup_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_backup_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); } protected void btnRestore_Click(object sender, EventArgs e) { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_restore_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_restore_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); } private void RedirectToSiteCollectionsList() { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_sitecollections", "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_sitecollections", "ItemID=" + PanelRequest.ItemID.ToString())); } private bool UseSharedSLL(int packageID) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs index 694af254..6801e4b1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs @@ -21,15 +21,6 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - /// - /// menu control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; - /// /// Image1 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx index 16ea6abd..5f3f1771 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx @@ -17,7 +17,6 @@
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs index 7903ac5e..c59bec70 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs @@ -21,15 +21,6 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - /// - /// menu control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; - /// /// Image1 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx index 5fb250d7..f11df6ad 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx @@ -14,7 +14,6 @@
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs index b004706e..04b5be91 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs @@ -12,15 +12,6 @@ namespace WebsitePanel.Portal { public partial class HostedSharePointStorageSettings { - /// - /// menu control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; - /// /// Image1 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx index 9308c5b0..317c2138 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx @@ -11,7 +11,6 @@
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs index b6916e27..4c003393 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs @@ -12,15 +12,6 @@ namespace WebsitePanel.Portal { public partial class HostedSharePointStorageUsage { - /// - /// menu control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; - /// /// Image1 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ServersEditService.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ServersEditService.ascx.cs index 3ed913ac..224ce9e4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ServersEditService.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ServersEditService.ascx.cs @@ -161,7 +161,7 @@ namespace WebsitePanel.Portal (resourceGroup.GroupName == ResourceGroups.Os)| (resourceGroup.GroupName == ResourceGroups.HostedOrganizations) | (resourceGroup.GroupName == ResourceGroups.SharepointFoundationServer) | - (resourceGroup.GroupName == ResourceGroups.SharepointServer) | + (resourceGroup.GroupName == ResourceGroups.SharepointEnterpriseServer) | (resourceGroup.GroupName == ResourceGroups.Mail)| (resourceGroup.GroupName == ResourceGroups.Lync)| (resourceGroup.GroupName == ResourceGroups.Exchange)| diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs index 95925257..ad45d878 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs @@ -98,8 +98,8 @@ namespace WebsitePanel.Portal.UserControls if (Cntx.Groups.ContainsKey(ResourceGroups.SharepointFoundationServer)) PrepareSharePointMenuRoot(items, GetLocalizedString("Text.SharePointFoundationServerGroup"), ResourceGroups.SharepointFoundationServer.Replace(" ", "")); - if (Cntx.Groups.ContainsKey(ResourceGroups.SharepointServer)) - PrepareSharePointMenuRoot(items, GetLocalizedString("Text.SharePointServerGroup"), ResourceGroups.SharepointServer.Replace(" ", "")); + if (Cntx.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer)) + PrepareSharePointMenuRoot(items, GetLocalizedString("Text.SharePointEnterpriseServerGroup"), ResourceGroups.SharepointEnterpriseServer.Replace(" ", "")); //CRM Menu if (Cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013)) From 7c2a38743c5635917dd1a4193fdc6edbb96584e6 Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 5 Apr 2015 11:46:40 +0800 Subject: [PATCH 48/91] Fix the get site collections --- .../SharePoint/HostedSharePointServerController.cs | 2 +- .../SharePoint/HostedSharePointServerEntController.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs index a03a95ca..90d87927 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs @@ -69,7 +69,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } SharePointSiteCollectionListPaged paged = new SharePointSiteCollectionListPaged(); - DataSet result = PackageController.GetRawPackageItemsPaged(packageId, typeof(SharePointSiteCollection), + DataSet result = PackageController.GetRawPackageItemsPaged(packageId, "Sharepoint Foundation Server", typeof(SharePointSiteCollection), true, filterColumn, filterValue, sortColumn, startRow, Int32.MaxValue); List items = PackageController.CreateServiceItemsList(result, 1).ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs index cbe0867a..c57f783e 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs @@ -69,7 +69,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } SharePointSiteCollectionListPaged paged = new SharePointSiteCollectionListPaged(); - DataSet result = PackageController.GetRawPackageItemsPaged(packageId, typeof(SharePointSiteCollection), + DataSet result = PackageController.GetRawPackageItemsPaged(packageId, , "Sharepoint Enterprise Server", typeof(SharePointSiteCollection), true, filterColumn, filterValue, sortColumn, startRow, Int32.MaxValue); List items = PackageController.CreateServiceItemsList(result, 1).ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); From 079568a9e0ba966a4eecf5152d649d3387ea7453 Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 5 Apr 2015 14:18:13 +0800 Subject: [PATCH 49/91] Sharepoint 2013 UI Partial Check in --- .../ESModule_ControlsHierarchy.config | 13 +- .../App_Data/WebsitePanel_Modules.config | 17 + .../App_Data/WebsitePanel_Pages.config | 11 + .../WebsitePanel_Modules.ascx.resx | 15 + ...ntEnterpriseBackupSiteCollection.ascx.resx | 153 ++++++ ...ointEnterpriseEditSiteCollection.ascx.resx | 207 ++++++++ ...tEnterpriseRestoreSiteCollection.ascx.resx | 150 ++++++ ...rePointEnterpriseSiteCollections.ascx.resx | 153 ++++++ ...rePointEnterpriseStorageSettings.ascx.resx | 154 ++++++ ...SharePointEnterpriseStorageUsage.ascx.resx | 150 ++++++ .../WebsitePanel/Code/Framework/ES.cs | 5 + ...arePointEnterpriseSiteCollectionsHelper.cs | 65 +++ .../ExchangeServer/UserControls/Menu.ascx.cs | 16 +- ...rePointEnterpriseBackupSiteCollection.ascx | 80 ++++ ...ointEnterpriseBackupSiteCollection.ascx.cs | 189 ++++++++ ...priseBackupSiteCollection.ascx.designer.cs | 159 +++++++ ...harePointEnterpriseEditSiteCollection.ascx | 209 ++++++++ ...ePointEnterpriseEditSiteCollection.ascx.cs | 450 ++++++++++++++++++ ...erpriseEditSiteCollection.ascx.designer.cs | 447 +++++++++++++++++ ...ePointEnterpriseRestoreSiteCollection.ascx | 101 ++++ ...intEnterpriseRestoreSiteCollection.ascx.cs | 176 +++++++ ...riseRestoreSiteCollection.ascx.designer.cs | 159 +++++++ ...edSharePointEnterpriseSiteCollections.ascx | 92 ++++ ...harePointEnterpriseSiteCollections.ascx.cs | 110 +++++ ...EnterpriseSiteCollections.ascx.designer.cs | 141 ++++++ ...edSharePointEnterpriseStorageSettings.ascx | 62 +++ ...harePointEnterpriseStorageSettings.ascx.cs | 93 ++++ ...EnterpriseStorageSettings.ascx.designer.cs | 114 +++++ ...ostedSharePointEnterpriseStorageUsage.ascx | 57 +++ ...edSharePointEnterpriseStorageUsage.ascx.cs | 94 ++++ ...intEnterpriseStorageUsage.ascx.designer.cs | 114 +++++ .../UserControls/OrganizationMenuControl.cs | 68 ++- .../WebsitePanel.Portal.Modules.csproj | 67 +++ 33 files changed, 4077 insertions(+), 14 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseBackupSiteCollection.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseEditSiteCollection.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseRestoreSiteCollection.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseSiteCollections.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageSettings.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageUsage.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointEnterpriseSiteCollectionsHelper.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config index 7ed16940..f97bb492 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config @@ -98,11 +98,22 @@ - + + + + + + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index ecbdc1f6..1bd0de2e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -252,6 +252,16 @@ + + + + + + + + + + @@ -540,6 +550,13 @@ + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config index e10593c1..d695ed92 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config @@ -175,6 +175,17 @@ + +
- + @@ -41,13 +41,13 @@ - - - - - - + +
+ + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSSetupLetter.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSSetupLetter.ascx.cs index 41e33a4a..c50344f7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSSetupLetter.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSSetupLetter.ascx.cs @@ -59,5 +59,10 @@ namespace WebsitePanel.Portal.RDS return; } } + + protected void btnExit_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_users", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID)); + } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSSetupLetter.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSSetupLetter.ascx.designer.cs index 7a8f53e8..32a49f96 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSSetupLetter.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSSetupLetter.ascx.designer.cs @@ -129,6 +129,15 @@ namespace WebsitePanel.Portal.RDS { /// protected global::System.Web.UI.WebControls.TextBox txtCC; + /// + /// btnExit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnExit; + /// /// btnSend control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs index cb563662..9165638c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs @@ -26,8 +26,7 @@ namespace WebsitePanel.Portal.RDS.UserControls tabsList.Add(CreateTab("rds_collection_edit_apps", "Tab.RdsApplications")); tabsList.Add(CreateTab("rds_collection_edit_users", "Tab.RdsUsers")); tabsList.Add(CreateTab("rds_collection_user_sessions", "Tab.UserSessions")); - tabsList.Add(CreateTab("rds_collection_local_admins", "Tab.LocalAdmins")); - tabsList.Add(CreateTab("rds_setup_letter", "Tab.RdsSetupLetter")); + tabsList.Add(CreateTab("rds_collection_local_admins", "Tab.LocalAdmins")); int idx = 0; From bf2d866ecb83bcca62fd0e10ddf129dc0f963a2a Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 6 Apr 2015 08:28:39 -0400 Subject: [PATCH 70/91] Added tag build-2.1.0.654 for changeset 6db03b8d2ea6 From c6022ac4be2762d9875ac217aebc2d906e7959fd Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Mon, 6 Apr 2015 07:30:07 -0700 Subject: [PATCH 71/91] Sharepoint Enterprise Server Caption renamed --- .../App_LocalResources/OrganizationMenu.ascx.resx | 2 +- .../App_LocalResources/UserOrganization.ascx.resx | 2 +- .../UserControls/OrganizationMenuControl.cs | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx index 11849f1e..5631492c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx @@ -205,7 +205,7 @@ SharePoint Foundation - SharePoint Enterprise Server + SharePoint Server Site Collections diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx index c9e880a7..e1953ec3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx @@ -238,7 +238,7 @@ Hosted Organization - SharePoint Foundation Server - Hosted Organization - SharePoint Enterprise Server + Hosted Organization - SharePoint Server Sharepoint Sites diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs index ccd7d555..6b680b8f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs @@ -385,9 +385,9 @@ namespace WebsitePanel.Portal.UserControls private void PrepareSharePointMenu(MenuItemCollection spItems) { - spItems.Add(CreateMenuItem("Text.SiteCollections", "sharepoint_sitecollections", @"Icons/sharepoint_sitecollections_48.png")); - spItems.Add(CreateMenuItem("Text.StorageUsage", "sharepoint_storage_usage", @"Icons/sharepoint_storage_usage_48.png")); - spItems.Add(CreateMenuItem("Text.StorageLimits", "sharepoint_storage_settings", @"Icons/sharepoint_storage_settings_48.png")); + spItems.Add(CreateMenuItem("SiteCollections", "sharepoint_sitecollections", @"Icons/sharepoint_sitecollections_48.png")); + spItems.Add(CreateMenuItem("StorageUsage", "sharepoint_storage_usage", @"Icons/sharepoint_storage_usage_48.png")); + spItems.Add(CreateMenuItem("StorageLimits", "sharepoint_storage_settings", @"Icons/sharepoint_storage_settings_48.png")); } @@ -415,9 +415,9 @@ namespace WebsitePanel.Portal.UserControls private void PrepareSharePointEnterpriseMenu(MenuItemCollection spItems) { - spItems.Add(CreateMenuItem("Text.SiteCollections", "sharepoint_enterprise_sitecollections", @"Icons/sharepoint_sitecollections_48.png")); - spItems.Add(CreateMenuItem("Text.StorageUsage", "sharepoint_enterprise_storage_usage", @"Icons/sharepoint_storage_usage_48.png")); - spItems.Add(CreateMenuItem("Text.StorageLimits", "sharepoint_enterprise_storage_settings", @"Icons/sharepoint_storage_settings_48.png")); + spItems.Add(CreateMenuItem("SiteCollections", "sharepoint_enterprise_sitecollections", @"Icons/sharepoint_sitecollections_48.png")); + spItems.Add(CreateMenuItem("StorageUsage", "sharepoint_enterprise_storage_usage", @"Icons/sharepoint_storage_usage_48.png")); + spItems.Add(CreateMenuItem("StorageLimits", "sharepoint_enterprise_storage_settings", @"Icons/sharepoint_storage_settings_48.png")); } From 46a5a055701bfe01720342419eee8356047ac25a Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 6 Apr 2015 11:22:46 -0400 Subject: [PATCH 72/91] Added tag build-2.1.0.655 for changeset fa2874c47dec From a813e7c5fda1884b2979615daaf8908f419a69f3 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 6 Apr 2015 11:40:17 -0400 Subject: [PATCH 73/91] Added tag build-2.1.0.656 for changeset 4debb43442e5 From 44587a35c8de4520bcd1dcbdbdf777a1ea007bbe Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 7 Apr 2015 01:40:40 -0700 Subject: [PATCH 74/91] Sharepoint UI fixes --- .../Windows2012.cs | 31 +++++++---- .../App_LocalResources/SpaceQuotas.ascx.resx | 7 ++- .../OrganizationHome.ascx.resx | 2 +- .../WebsitePanel/RDSServers.ascx | 6 +- .../WebsitePanel/SpaceQuotas.ascx | 6 +- .../WebsitePanel/SpaceQuotas.ascx.cs | 3 +- .../WebsitePanel/SpaceQuotas.ascx.designer.cs | 55 +++++++++---------- 7 files changed, 62 insertions(+), 48 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index d510960f..42a11ee8 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -376,9 +376,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer); } - CreatePolicy(runSpace, organizationId, string.Format("{0}-administrators", collection.Name), new DirectoryEntry(GetGroupPath(organizationId, collection.Name, GetLocalAdminsGroupName(collection.Name))), collection.Name); - CreatePolicy(runSpace, organizationId, string.Format("{0}-users", collection.Name), new DirectoryEntry(GetUsersGroupPath(organizationId, collection.Name)), collection.Name); - CreateHelpDeskPolicy(runSpace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collection.Name); + string collectionComputersPath = GetComputerGroupPath(organizationId, collection.Name); + CreatePolicy(runSpace, organizationId, string.Format("{0}-administrators", collection.Name), + new DirectoryEntry(GetGroupPath(organizationId, collection.Name, GetLocalAdminsGroupName(collection.Name))), new DirectoryEntry(collectionComputersPath), collection.Name); + CreatePolicy(runSpace, organizationId, string.Format("{0}-users", collection.Name), new DirectoryEntry(GetUsersGroupPath(organizationId, collection.Name)) + , new DirectoryEntry(collectionComputersPath), collection.Name); + CreateHelpDeskPolicy(runSpace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), new DirectoryEntry(collectionComputersPath), organizationId, collection.Name); } finally { @@ -1142,10 +1145,13 @@ namespace WebsitePanel.Providers.RemoteDesktopServices try { runspace = OpenRunspace(); + string collectionComputersPath = GetComputerGroupPath(organizationId, collectionName); - CreatePolicy(runspace, organizationId, string.Format("{0}-administrators", collectionName), new DirectoryEntry(GetGroupPath(organizationId, collectionName, GetLocalAdminsGroupName(collectionName))), collectionName); - CreatePolicy(runspace, organizationId, string.Format("{0}-users", collectionName), new DirectoryEntry(GetUsersGroupPath(organizationId, collectionName)), collectionName); - CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collectionName); + CreatePolicy(runspace, organizationId, string.Format("{0}-administrators", collectionName), + new DirectoryEntry(GetGroupPath(organizationId, collectionName, GetLocalAdminsGroupName(collectionName))), new DirectoryEntry(collectionComputersPath), collectionName); + CreatePolicy(runspace, organizationId, string.Format("{0}-users", collectionName), + new DirectoryEntry(GetUsersGroupPath(organizationId, collectionName)), new DirectoryEntry(collectionComputersPath), collectionName); + CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), new DirectoryEntry(collectionComputersPath), organizationId, collectionName); RemoveRegistryValue(runspace, ScreenSaverGpoKey, administratorsGpo); RemoveRegistryValue(runspace, ScreenSaverGpoKey, usersGpo); RemoveRegistryValue(runspace, RemoveRestartGpoKey, administratorsGpo); @@ -1299,7 +1305,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices Collection result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd); } - private void CreateHelpDeskPolicy(Runspace runspace, DirectoryEntry entry, string organizationId, string collectionName) + private void CreateHelpDeskPolicy(Runspace runspace, DirectoryEntry entry, DirectoryEntry collectionComputersEntry, string organizationId, string collectionName) { string gpoName = string.Format("{0}-HelpDesk", collectionName); string gpoId = GetPolicyId(runspace, gpoName); @@ -1307,19 +1313,19 @@ namespace WebsitePanel.Providers.RemoteDesktopServices if (string.IsNullOrEmpty(gpoId)) { gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName); - SetPolicyPermissions(runspace, gpoName, entry); + SetPolicyPermissions(runspace, gpoName, entry, collectionComputersEntry); SetRegistryValue(runspace, RDSSessionGpoKey, gpoName, "2", RDSSessionGpoValueName, "DWord"); } } - private string CreatePolicy(Runspace runspace, string organizationId, string gpoName, DirectoryEntry entry, string collectionName) + private string CreatePolicy(Runspace runspace, string organizationId, string gpoName, DirectoryEntry entry, DirectoryEntry collectionComputersEntry, string collectionName) { string gpoId = GetPolicyId(runspace, gpoName); if (string.IsNullOrEmpty(gpoId)) { gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName); - SetPolicyPermissions(runspace, gpoName, entry); + SetPolicyPermissions(runspace, gpoName, entry, collectionComputersEntry); } return gpoId; @@ -1339,12 +1345,13 @@ namespace WebsitePanel.Providers.RemoteDesktopServices Collection result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd); } - private void SetPolicyPermissions(Runspace runspace, string gpoName, DirectoryEntry entry) + private void SetPolicyPermissions(Runspace runspace, string gpoName, DirectoryEntry entry, DirectoryEntry collectionComputersEntry) { var scripts = new List { string.Format("Set-GPPermissions -Name {0} -Replace -PermissionLevel None -TargetName 'Authenticated Users' -TargetType group", gpoName), - string.Format("Set-GPPermissions -Name {0} -PermissionLevel gpoapply -TargetName {1} -TargetType group", gpoName, string.Format("'{0}'", ActiveDirectoryUtils.GetADObjectProperty(entry, "sAMAccountName").ToString())) + string.Format("Set-GPPermissions -Name {0} -PermissionLevel gpoapply -TargetName {1} -TargetType group", gpoName, string.Format("'{0}'", ActiveDirectoryUtils.GetADObjectProperty(entry, "sAMAccountName").ToString())), + string.Format("Set-GPPermissions -Name {0} -PermissionLevel gpoapply -TargetName {1} -TargetType group", gpoName, string.Format("'{0}'", ActiveDirectoryUtils.GetADObjectProperty(collectionComputersEntry, "sAMAccountName").ToString())) }; object[] errors = null; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx index fc627511..d8372d63 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx @@ -180,8 +180,8 @@ OCS Users: - - Sharepoint Sites: + + Sharepoint Foundation Sites: User Accounts: @@ -210,4 +210,7 @@ Deleted Users: + + Sharepoint Server Sites: + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx index bdad4791..3218e1f3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx @@ -238,6 +238,6 @@ RDS Users - SharePoint Enterprise + SharePoint Server \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx index cb516139..af9ad456 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDSServers.ascx @@ -63,10 +63,10 @@ - - + + - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx index b52a64b4..140168e8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx @@ -71,9 +71,13 @@ - + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs index 0f4cd791..8bfc3d08 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs @@ -73,7 +73,8 @@ namespace WebsitePanel.Portal { "quotaFtpAccounts", "pnlFtpAccounts" }, { "quotaExchangeStorage", "pnlExchangeStorage" }, { "quotaNumberOfFolders", "pnlFolders" }, - { "quotaEnterpriseStorage", "pnlEnterpriseStorage" } + { "quotaEnterpriseStorage", "pnlEnterpriseStorage" }, + { "quotaEnterpriseSharepointSites", "pnlEnterpriseSharepointSites"} }; protected void Page_Load(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs index fbb13a74..309c02cb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. @@ -454,6 +426,33 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.Quota quotaSharepointSites; + /// + /// pnlEnterpriseSharepointSites control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow pnlEnterpriseSharepointSites; + + /// + /// lblEnterpriseSharepointSites control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblEnterpriseSharepointSites; + + /// + /// quotaEnterpriseSharepointSites control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.Quota quotaEnterpriseSharepointSites; + /// /// pnlWebSites control. /// From 53f61909819532521b6a7260ebdaf23924059c8c Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Tue, 7 Apr 2015 12:06:32 +0300 Subject: [PATCH 75/91] wsp-10327 Add Dynamic Memory to VPS - Portal Part. Step 2. --- .../VirtualMachineSettingExtensions.cs | 34 ++ .../IVirtualMachineSettingsControl.cs | 14 +- .../VdcCreateServer.ascx.resx | 3 + ...cx.resx => DynamicMemoryControl.ascx.resx} | 46 ++- .../VPS2012/UserControls/DynamicMemory.ascx | 17 - .../UserControls/DynamicMemory.ascx.cs | 50 --- .../DynamicMemory.ascx.designer.cs | 42 -- .../UserControls/DynamicMemoryControl.ascx | 126 ++++++ .../UserControls/DynamicMemoryControl.ascx.cs | 88 +++++ .../DynamicMemoryControl.ascx.designer.cs | 366 ++++++++++++++++++ .../VPS2012/UserControls/Generation.ascx | 44 ++- .../VPS2012/UserControls/Generation.ascx.cs | 14 +- .../UserControls/Generation.ascx.designer.cs | 27 ++ .../WebsitePanel/VPS2012/VdcCreateServer.ascx | 76 ++-- .../VPS2012/VdcCreateServer.ascx.cs | 46 ++- .../VPS2012/VdcCreateServer.ascx.designer.cs | 72 ++-- .../VPS2012/VpsDetailsConfiguration.ascx | 5 + .../VPS2012/VpsDetailsConfiguration.ascx.cs | 3 + .../VpsDetailsConfiguration.ascx.designer.cs | 18 + .../VPS2012/VpsDetailsEditConfiguration.ascx | 16 +- .../VpsDetailsEditConfiguration.ascx.cs | 30 +- ...sDetailsEditConfiguration.ascx.designer.cs | 4 +- .../VPS2012/VpsDetailsGeneral.ascx.cs | 11 +- .../WebsitePanel.Portal.Modules.csproj | 13 +- 24 files changed, 901 insertions(+), 264 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/VirtualMachineSettingExtensions.cs rename WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/{DynamicMemory.ascx.resx => DynamicMemoryControl.ascx.resx} (74%) delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/VirtualMachineSettingExtensions.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/VirtualMachineSettingExtensions.cs new file mode 100644 index 00000000..ec313c46 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/VirtualMachineSettingExtensions.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Web.UI; +using WebsitePanel.Providers.Virtualization; + +namespace WebsitePanel.Portal.Code.Helpers +{ + + public static class VirtualMachineSettingExtensions + { + public static void BindSettingsControls(this Control page, VirtualMachine vm) + { + page.GetSettingsControls().ForEach(s => s.BindItem(vm)); + } + + public static void SaveSettingsControls(this Control page, ref VirtualMachine vm) + { + foreach (var s in page.GetSettingsControls()) s.SaveItem(ref vm); + } + + public static List GetSettingsControls(this Control parent) + { + var result = new List(); + foreach (Control control in parent.Controls) + { + if (control is IVirtualMachineSettingsControl) + result.Add((IVirtualMachineSettingsControl)control); + + if (control.HasControls()) + result.AddRange(control.GetSettingsControls()); + } + return result; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs index 5e19f7cb..c35799ea 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineSettingsControl.cs @@ -26,14 +26,24 @@ // (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.Collections.Generic; +using System.Web.UI; using WebsitePanel.Providers.Virtualization; namespace WebsitePanel.Portal { + public enum VirtualMachineSettingsMode + { + Display, + Edit, + Summary, + } + public interface IVirtualMachineSettingsControl { - bool IsEditMode { get; set; } + VirtualMachineSettingsMode Mode { get; set; } void BindItem(VirtualMachine item); - void SaveItem(VirtualMachine item); + void SaveItem(ref VirtualMachine item); } + } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/App_LocalResources/VdcCreateServer.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/App_LocalResources/VdcCreateServer.ascx.resx index dab48649..b095172a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/App_LocalResources/VdcCreateServer.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/App_LocalResources/VdcCreateServer.ascx.resx @@ -372,4 +372,7 @@ Generation: + + Dynamic Memory + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemory.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx similarity index 74% rename from WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemory.ascx.resx rename to WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx index de7f7771..2e9c22f9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemory.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx @@ -117,10 +117,52 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Dymanic memory: + + Minimum RAM: + + + Minimum memory must be a whole number + + + Enter the minimum memory + + + Dymanic memory enabled Dymanic memory + + Dymanic memory enabled: + + + Dynamic memory enabled + + + Buffer must be a whole number between 0 and 100 + + + Enter the buffer + + + Buffer (%): + + + Maximum RAM: + + + Weight (Priority): + + + Maximum memory must be a whole number + + + Enter the maximum memory + + + Weight (priority) must be a whole number between 0 and 100 + + + Enter the weight (priority) + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx deleted file mode 100644 index acf4d304..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx +++ /dev/null @@ -1,17 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DynamicMemory.ascx.cs" Inherits="WebsitePanel.Portal.VPS2012.UserControls.DynamicMemory" %> -<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> - - - - - - - - - -
- - -
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.cs deleted file mode 100644 index 0ab36ea9..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.cs +++ /dev/null @@ -1,50 +0,0 @@ -// 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.VPS2012.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/VPS2012/UserControls/DynamicMemory.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.designer.cs deleted file mode 100644 index 5124bc48..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemory.ascx.designer.cs +++ /dev/null @@ -1,42 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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.VPS2012.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/VPS2012/UserControls/DynamicMemoryControl.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx new file mode 100644 index 00000000..a8c9888a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx @@ -0,0 +1,126 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DynamicMemoryControl.ascx.cs" Inherits="WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl" %> +<%@ Import Namespace="WebsitePanel.Portal" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> +<%@ Register TagPrefix="wsp" TagName="CheckBoxOption" Src="../../UserControls/CheckBoxOption.ascx" %> + +<% if (Mode != VirtualMachineSettingsMode.Summary){ %> + + + + + <% if (Mode == VirtualMachineSettingsMode.Edit) { %> + + + + <% } else { %> + + + + + + + + + + + + + + + + + + + + <% } %> +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + * + * +
+ + + + + * + * +
+ + + + + * + * +
+ + + + + * + * +
+
+ +
+
+<% } else { %> + + + + + + + + + + + + + + + + + + + + +<% } %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs new file mode 100644 index 00000000..e2344882 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs @@ -0,0 +1,88 @@ +// 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.VPS2012.UserControls +{ + public partial class DynamicMemoryControl : WebsitePanelControlBase, IVirtualMachineSettingsControl + { + protected void Page_Load(object sender, EventArgs e) + { + ToggleControls(); + } + + private void ToggleControls() + { + tableDynamicMemory.Visible = chkDynamicMemoryEnabled.Checked; + } + + public VirtualMachineSettingsMode Mode { get; set; } + + public void BindItem(VirtualMachine item) + { + if (item.DynamicMemory == null) + item.DynamicMemory = new DynamicMemory(); + + // set values + chkDynamicMemoryEnabled.Checked = optionDymanicMemoryDisplay.Value = optionDymanicMemorySummary.Value = item.DynamicMemory.Enabled; + txtMinimum.Text = litMinimumDisplay.Text = litMinimumSummary.Text = item.DynamicMemory.Minimum.ToString(); + txtMaximum.Text = litMaximumDisplay.Text = litMaximumSummary.Text = item.DynamicMemory.Maximum.ToString(); + txtBuffer.Text = litBufferDisplay.Text = litBufferSummary.Text = item.DynamicMemory.Buffer.ToString(); + txtPriority.Text = litPriorityDisplay.Text = litPrioritySummary.Text = item.DynamicMemory.Priority.ToString(); + + // set visibilities + trMinimumDisplay.Visible = trMaximumDisplay.Visible = trBufferDisplay.Visible = trPriorityDisplay.Visible = item.DynamicMemory.Enabled; + trMinimumSummary.Visible = trMaximumSummary.Visible = trBufferSummary.Visible = trPrioritySummary.Visible = item.DynamicMemory.Enabled; + } + + public void SaveItem(ref VirtualMachine item) + { + if (Mode != VirtualMachineSettingsMode.Edit) + return; + + item.DynamicMemory = new DynamicMemory + { + Enabled = chkDynamicMemoryEnabled.Checked, + Minimum = ParseInt(txtMinimum.Text), + Maximum = ParseInt(txtMaximum.Text), + Buffer = ParseInt(txtBuffer.Text), + Priority = ParseInt(txtPriority.Text), + }; + } + + private int ParseInt(string text) + { + if (string.IsNullOrEmpty(text)) + return 0; + + return Int32.Parse(txtMinimum.Text); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.designer.cs new file mode 100644 index 00000000..328179bb --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.designer.cs @@ -0,0 +1,366 @@ +//------------------------------------------------------------------------------ +// +// 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.VPS2012.UserControls { + + + public partial class DynamicMemoryControl { + + /// + /// 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; + + /// + /// chkDynamicMemoryEnabled control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkDynamicMemoryEnabled; + + /// + /// tableDynamicMemory control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tableDynamicMemory; + + /// + /// locMinimum control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMinimum; + + /// + /// txtMinimum control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMinimum; + + /// + /// locMaximum control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaximum; + + /// + /// txtMaximum control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMaximum; + + /// + /// locBuffer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locBuffer; + + /// + /// txtBuffer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtBuffer; + + /// + /// locPriority control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPriority; + + /// + /// txtPriority control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPriority; + + /// + /// optionDymanicMemoryDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.CheckBoxOption optionDymanicMemoryDisplay; + + /// + /// trMinimumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trMinimumDisplay; + + /// + /// locMinimumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMinimumDisplay; + + /// + /// litMinimumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litMinimumDisplay; + + /// + /// trMaximumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trMaximumDisplay; + + /// + /// locMaximumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaximumDisplay; + + /// + /// litMaximumDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litMaximumDisplay; + + /// + /// trBufferDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trBufferDisplay; + + /// + /// locBufferDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locBufferDisplay; + + /// + /// litBufferDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litBufferDisplay; + + /// + /// trPriorityDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trPriorityDisplay; + + /// + /// locPriorityDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPriorityDisplay; + + /// + /// litPriorityDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litPriorityDisplay; + + /// + /// locDymanicMemorySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDymanicMemorySummary; + + /// + /// optionDymanicMemorySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.CheckBoxOption optionDymanicMemorySummary; + + /// + /// trMinimumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trMinimumSummary; + + /// + /// locMinimumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMinimumSummary; + + /// + /// litMinimumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litMinimumSummary; + + /// + /// trMaximumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trMaximumSummary; + + /// + /// locMaximumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaximumSummary; + + /// + /// litMaximumSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litMaximumSummary; + + /// + /// trBufferSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trBufferSummary; + + /// + /// locBufferSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locBufferSummary; + + /// + /// litBufferSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litBufferSummary; + + /// + /// trPrioritySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow trPrioritySummary; + + /// + /// locPrioritySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrioritySummary; + + /// + /// litPrioritySummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litPrioritySummary; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx index 423a7077..ad9dc272 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx @@ -1,24 +1,36 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Generation.ascx.cs" Inherits="WebsitePanel.Portal.VPS2012.UserControls.Generation" %> +<%@ Import Namespace="WebsitePanel.Portal" %> <%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> - - - - - - + + <% } %> +
- - - <% if (IsEditMode) - { %> +<% if (Mode != VirtualMachineSettingsMode.Summary){ %> + + + + <% if (Mode == VirtualMachineSettingsMode.Edit) { %> + + + + + <% } else { %> + + - -
+ + 1 2 - <% } else { %> +
+ - <% } %> -
-
+
+
+<% } else { %> + + + + +<% } %> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.cs index 12299712..e092af49 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.cs @@ -37,18 +37,20 @@ namespace WebsitePanel.Portal.VPS2012.UserControls { } - public bool IsEditMode { get; set; } + public VirtualMachineSettingsMode Mode { get; set; } public void BindItem(VirtualMachine item) { - var generation = item.Generation > 1 ? item.Generation : 1; - ddlGeneration.SelectedValue = generation.ToString(); - lblGeneration.Text = generation.ToString(); + var generation = item.Generation > 1 ? item.Generation.ToString () : "1"; + + ddlGeneration.SelectedValue = generation; + lblGeneration.Text = litGeneration.Text = GetLocalizedString("ddlGenerationItem." + generation); } - public void SaveItem(VirtualMachine item) + public void SaveItem(ref VirtualMachine item) { - item.Generation = Convert.ToInt32(ddlGeneration.SelectedValue); + if (Mode == VirtualMachineSettingsMode.Edit) + item.Generation = Convert.ToInt32(ddlGeneration.SelectedValue); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.designer.cs index 7ae3a102..690bec4e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/Generation.ascx.designer.cs @@ -48,6 +48,15 @@ namespace WebsitePanel.Portal.VPS2012.UserControls { /// protected global::System.Web.UI.WebControls.DropDownList ddlGeneration; + /// + /// locGenerationDisplay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGenerationDisplay; + /// /// lblGeneration control. /// @@ -56,5 +65,23 @@ namespace WebsitePanel.Portal.VPS2012.UserControls { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblGeneration; + + /// + /// locGeneration2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGeneration2; + + /// + /// 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; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx index 6a22866b..9719b3a9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx @@ -7,7 +7,7 @@ <%@ Register Src="../UserControls/CheckBoxOption.ascx" TagName="CheckBoxOption" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> <%@ Register TagPrefix="wsp" TagName="Generation" Src="UserControls/Generation.ascx" %> -<%@ Register TagPrefix="wsp" TagName="DynamicMemory" Src="UserControls/DynamicMemory.ascx" %> +<%@ Register TagPrefix="wsp" TagName="DynamicMemoryControl" Src="UserControls/DynamicMemoryControl.ascx" %> @@ -33,7 +33,7 @@ + ValidationGroup="Vps" ShowMessageBox="True" ShowSummary="False" /> - - - - - @@ -84,10 +84,10 @@ * + ValidationGroup="Vps">* + ControlToValidate="txtHostname" Display="Dynamic" SetFocusOnError="true" ValidationGroup="Vps"> . @@ -95,10 +95,10 @@ * + ValidationGroup="Vps">* + ControlToValidate="txtDomain" Display="Dynamic" SetFocusOnError="true" ValidationGroup="Vps"> @@ -112,7 +112,7 @@ * + ValidationGroup="Vps">*   @@ -120,7 +120,7 @@ - + @@ -135,7 +135,7 @@ * + ValidationGroup="Vps">* @@ -148,14 +148,16 @@ meta:resourcekey="locConfigStepTitle" Text="Configuration" />


+ + - + - +
@@ -165,35 +167,33 @@
- +
* + ValidationGroup="Vps">*
- +
* + ValidationGroup="Vps">*
- - - + @@ -208,7 +208,7 @@ * + ValidationGroup="Vps">* @@ -313,7 +313,7 @@ * + ValidationGroup="Vps">* @@ -368,7 +368,7 @@ * + ValidationGroup="Vps">* @@ -447,6 +447,9 @@ meta:resourcekey="locConfigStepTitle" Text="Configuration" /> + + + @@ -455,10 +458,6 @@ - - - - @@ -505,6 +504,17 @@ + +   + + + + + + + +   diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs index 8a0f8508..0427461b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs @@ -28,11 +28,13 @@ using System; using System.Collections.Generic; -using System.Web; + using System.Linq; + using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; -using WebsitePanel.Providers.Virtualization; + using WebsitePanel.Portal.Code.Helpers; + using WebsitePanel.Providers.Virtualization; using WebsitePanel.Providers.Common; using WebsitePanel.Providers.ResultObjects; @@ -71,8 +73,18 @@ namespace WebsitePanel.Portal.VPS2012 } } + private void BindFormControls() { + var virtualMachine = new VirtualMachine + { + DynamicMemory = new DynamicMemory + { + Buffer = 20, + Priority = 50 + } + }; + // bind password policy password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.VPS_POLICY, "AdministratorPasswordPolicy"); @@ -112,11 +124,7 @@ namespace WebsitePanel.Portal.VPS2012 ddlCpu.Items.Add(i.ToString()); ddlCpu.SelectedIndex = ddlCpu.Items.Count - 1; // select last (maximum) item - - // the user controls - GenerationSetting.BindItem(new VirtualMachine()); - DynamicMemorySetting.BindItem(new VirtualMachine()); - + // external network details if (PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS2012_EXTERNAL_NETWORK_ENABLED)) { @@ -174,6 +182,12 @@ namespace WebsitePanel.Portal.VPS2012 { int availSize = ramQuota.QuotaAllocatedValue - ramQuota.QuotaUsedValue; txtRam.Text = availSize < 0 ? "" : availSize.ToString(); + + if (availSize > 0) + { + virtualMachine.DynamicMemory.Minimum = availSize/2; + virtualMachine.DynamicMemory.Maximum = availSize; + } } } @@ -210,6 +224,9 @@ namespace WebsitePanel.Portal.VPS2012 BindCheckboxOption(chkReset, Quotas.VPS2012_RESET_ALOWED); BindCheckboxOption(chkReboot, Quotas.VPS2012_REBOOT_ALLOWED); BindCheckboxOption(chkReinstall, Quotas.VPS2012_REINSTALL_ALLOWED); + + // the settings user controls + this.BindSettingsControls(virtualMachine); } private void BindCheckboxOption(CheckBox chk, string quotaName) @@ -241,11 +258,11 @@ namespace WebsitePanel.Portal.VPS2012 private void BindSummary() { - //VirtualMachine virtualMachine = new VirtualMachine(); + var resultVm = new VirtualMachine(); - //// the user controls - //GenerationSetting.SaveItem(virtualMachine); - //DynamicMemorySetting.BindItem(virtualMachine); + // the user controls + this.SaveSettingsControls(ref resultVm); + this.BindSettingsControls(resultVm); // general litHostname.Text = PortalAntiXSS.Encode(String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim())); @@ -257,7 +274,6 @@ namespace WebsitePanel.Portal.VPS2012 // 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; @@ -289,6 +305,7 @@ namespace WebsitePanel.Portal.VPS2012 string[] privIps = Utils.ParseDelimitedString(txtPrivateAddressesList.Text, '\n', '\r', ' ', '\t'); litPrivateAddressesList.Text = PortalAntiXSS.Encode(String.Join(", ", privIps)); + } protected void wizard_FinishButtonClick(object sender, WizardNavigationEventArgs e) @@ -301,8 +318,7 @@ namespace WebsitePanel.Portal.VPS2012 VirtualMachine virtualMachine = new VirtualMachine(); // the user controls - GenerationSetting.BindItem(virtualMachine); - DynamicMemorySetting.BindItem(virtualMachine); + this.SaveSettingsControls(ref virtualMachine); // collect and prepare data string hostname = String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim()); @@ -354,7 +370,7 @@ namespace WebsitePanel.Portal.VPS2012 if (wizard.ActiveStepIndex == 0) ViewState["Password"] = password.Password; - Page.Validate("VpsWizard"); + Page.Validate("Vps"); if (!Page.IsValid) e.Cancel = true; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs index 51cbe0be..e7a1f597 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs @@ -255,6 +255,15 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Localize locConfigStepTitle; + /// + /// GenerationSetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting; + /// /// secResources control. /// @@ -372,24 +381,6 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Localize locGB; - /// - /// GenerationSetting control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting; - - /// - /// DynamicMemorySetting control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemory DynamicMemorySetting; - /// /// secSnapshots control. /// @@ -966,6 +957,15 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Localize locConfig2; + /// + /// GenerationSettingsSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSettingsSummary; + /// /// locCpu control. /// @@ -1002,24 +1002,6 @@ namespace WebsitePanel.Portal.VPS2012 { /// 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. /// @@ -1200,6 +1182,24 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::WebsitePanel.Portal.UserControls.CheckBoxOption optionReinstall; + /// + /// locDynamicMemory control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDynamicMemory; + + /// + /// DynamicMemoryControlSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemoryControlSummary; + /// /// locExternalNetwork2 control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx index 2dbb9845..39f25576 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx @@ -8,6 +8,8 @@ <%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> <%@ Register Src="../UserControls/PasswordControl.ascx" TagName="PasswordControl" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" TagName="Generation" Src="UserControls/Generation.ascx" %> +<%@ Register TagPrefix="wsp" TagName="DynamicMemoryControl" Src="UserControls/DynamicMemoryControl.ascx" %> @@ -57,6 +59,7 @@
+ @@ -91,6 +94,8 @@ + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.cs index 18ec2f17..6acbe292 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.cs @@ -34,6 +34,7 @@ using System.Web.UI.WebControls; using WebsitePanel.Providers.Virtualization; using WebsitePanel.Providers.Common; using WebsitePanel.EnterpriseServer; +using WebsitePanel.Portal.Code.Helpers; namespace WebsitePanel.Portal.VPS2012 { @@ -93,6 +94,8 @@ namespace WebsitePanel.Portal.VPS2012 // toggle buttons bool manageAllowed = VirtualMachines2012Helper.IsVirtualMachineManagementAllowed(PanelSecurity.PackageId); btnEdit.Visible = manageAllowed; + + this.BindSettingsControls(vm); } catch (Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.designer.cs index ba604a17..0e1944fa 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsConfiguration.ascx.designer.cs @@ -129,6 +129,15 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.LinkButton btnChangePasswordPopup; + /// + /// GenerationSetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting; + /// /// secResources control. /// @@ -201,6 +210,15 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Literal litHdd; + /// + /// DynamicMemorySetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemorySetting; + /// /// secSnapshots control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx index 6db26b25..1d0a2e75 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx @@ -6,6 +6,7 @@ <%@ Register Src="UserControls/FormTitle.ascx" TagName="FormTitle" TagPrefix="wsp" %> <%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" TagName="DynamicMemoryControl" Src="UserControls/DynamicMemoryControl.ascx" %> @@ -35,8 +36,8 @@

- + ValidationGroup="Vps" ShowMessageBox="True" ShowSummary="False" /> + @@ -60,7 +61,7 @@ * + ValidationGroup="Vps">* @@ -73,15 +74,14 @@ * + ValidationGroup="Vps">* - <%-- Additional Custom Settings. Provider Control --%> - + @@ -96,7 +96,7 @@ * + ValidationGroup="Vps">* @@ -186,7 +186,7 @@

- /// editSettingsProviderControl control. + /// DynamicMemorySetting control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.PlaceHolder editSettingsProviderControl; + protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemorySetting; ///

/// secSnapshots control. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsGeneral.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsGeneral.ascx.cs index 48c6fa40..5f768272 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsGeneral.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsGeneral.ascx.cs @@ -109,11 +109,16 @@ namespace WebsitePanel.Portal.VPS2012 // RAM if (vm.RamSize > 0) { - int ramPercent = Convert.ToInt32((float)vm.RamUsage / (float)vm.RamSize * 100); - ramGauge.Total = vm.RamSize; + var totalRam = vm.RamSize; + + if (vm.DynamicMemory != null && vm.DynamicMemory.Enabled) + totalRam = vm.DynamicMemory.Maximum; + + int ramPercent = Convert.ToInt32((float)vm.RamUsage / (float)totalRam * 100); + ramGauge.Total = totalRam; ramGauge.Progress = vm.RamUsage; litRamPercentage.Text = String.Format(GetLocalizedString("MemoryPercentage.Text"), ramPercent); - litRamUsage.Text = String.Format(GetLocalizedString("MemoryUsage.Text"), vm.RamUsage, vm.RamSize); + litRamUsage.Text = String.Format(GetLocalizedString("MemoryUsage.Text"), vm.RamUsage, totalRam); } // HDD 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 423c3b49..333314fe 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -172,6 +172,7 @@ + @@ -287,12 +288,12 @@ Breadcrumb.ascx - - DynamicMemory.ascx + + DynamicMemoryControl.ascx ASPXCodeBehind - - DynamicMemory.ascx + + DynamicMemoryControl.ascx FormTitle.ascx @@ -4774,7 +4775,7 @@ - + @@ -5140,7 +5141,7 @@ Designer - + Designer From b97b85a358518c6f81dd290503c6a3c5c7097ae9 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 7 Apr 2015 02:36:13 -0700 Subject: [PATCH 76/91] RDS GPO --- .../Windows2012.cs | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 42a11ee8..233fe6a2 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -1144,14 +1144,14 @@ namespace WebsitePanel.Providers.RemoteDesktopServices try { - runspace = OpenRunspace(); + runspace = OpenRunspace(); string collectionComputersPath = GetComputerGroupPath(organizationId, collectionName); CreatePolicy(runspace, organizationId, string.Format("{0}-administrators", collectionName), new DirectoryEntry(GetGroupPath(organizationId, collectionName, GetLocalAdminsGroupName(collectionName))), new DirectoryEntry(collectionComputersPath), collectionName); CreatePolicy(runspace, organizationId, string.Format("{0}-users", collectionName), new DirectoryEntry(GetUsersGroupPath(organizationId, collectionName)), new DirectoryEntry(collectionComputersPath), collectionName); - CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), new DirectoryEntry(collectionComputersPath), organizationId, collectionName); + CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), new DirectoryEntry(collectionComputersPath), organizationId, collectionName); RemoveRegistryValue(runspace, ScreenSaverGpoKey, administratorsGpo); RemoveRegistryValue(runspace, ScreenSaverGpoKey, usersGpo); RemoveRegistryValue(runspace, RemoveRestartGpoKey, administratorsGpo); @@ -1200,6 +1200,25 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } } + private void CheckPolicySecurityFiltering(Runspace runspace, string gpoName, DirectoryEntry collectionComputersEntry) + { + var scripts = new List{ + string.Format("Get-GPPermissions -Name {0} -TargetName {1} -TargetType group", gpoName, string.Format("'{0}'", ActiveDirectoryUtils.GetADObjectProperty(collectionComputersEntry, "sAMAccountName").ToString())) + }; + + object[] errors = null; + ExecuteRemoteShellCommand(runspace, PrimaryDomainController, scripts, out errors); + + if (errors != null && errors.Any()) + { + scripts = new List{ + string.Format("Set-GPPermissions -Name {0} -PermissionLevel gpoapply -TargetName {1} -TargetType group", gpoName, string.Format("'{0}'", ActiveDirectoryUtils.GetADObjectProperty(collectionComputersEntry, "sAMAccountName").ToString())) + }; + } + + ExecuteRemoteShellCommand(runspace, PrimaryDomainController, scripts, out errors); + } + private void SetPowershellPermissions(Runspace runspace, RdsServerSetting setting, string usersGpo, string administratorsGpo) { if (setting != null) @@ -1316,6 +1335,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices SetPolicyPermissions(runspace, gpoName, entry, collectionComputersEntry); SetRegistryValue(runspace, RDSSessionGpoKey, gpoName, "2", RDSSessionGpoValueName, "DWord"); } + else + { + CheckPolicySecurityFiltering(runspace, gpoName, collectionComputersEntry); + } } private string CreatePolicy(Runspace runspace, string organizationId, string gpoName, DirectoryEntry entry, DirectoryEntry collectionComputersEntry, string collectionName) @@ -1327,6 +1350,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName); SetPolicyPermissions(runspace, gpoName, entry, collectionComputersEntry); } + else + { + CheckPolicySecurityFiltering(runspace, gpoName, collectionComputersEntry); + } return gpoId; } From c76ce9b158e85447929ae9efef44979635c52a6c Mon Sep 17 00:00:00 2001 From: robvde Date: Tue, 7 Apr 2015 20:52:02 +0800 Subject: [PATCH 77/91] sharepoint 2013, more segregation for the enteprrise provider and ui moved to a dedicated folder --- .../HostedSharePointServersEntProxy.cs | 68 +-- .../HostedSolution/OrganizationController.cs | 2 +- .../HostedSolution/ReportController.cs | 4 +- .../HostedSharePointServerEntController.cs | 100 ++-- .../esHostedSharePointServersEnt.asmx.cs | 15 +- .../HostedSolution/Organization.cs | 1 + ...e.cs => SharePointEntetpriseStatistics.cs} | 0 .../SharePoint/IHostedSharePointServerEnt.cs | 10 +- .../SharePointEnterpriseSiteCollection.cs | 298 ++++++++++++ ...ePointEnterpriseSiteCollectionListPaged.cs | 71 +++ .../SharePointEnterpriseSiteDiskSpace.cs | 52 ++ .../WebsitePanel.Providers.Base.csproj | 5 +- .../HostedSharePointServer2013Ent.cs | 20 +- .../HostedSharePointServer2013EntImpl.cs | 20 +- .../HostedSharePointServerEntProxy.cs | 50 +- .../HostedSharePointServerEnt.asmx.cs | 14 +- .../App_Data/WebsitePanel_Modules.config | 24 +- ...stedSharePointEditSiteCollection.ascx.resx | 207 -------- ...ntEnterpriseBackupSiteCollection.ascx.resx | 153 ------ ...ointEnterpriseEditSiteCollection.ascx.resx | 207 -------- ...tEnterpriseRestoreSiteCollection.ascx.resx | 150 ------ ...rePointEnterpriseSiteCollections.ascx.resx | 153 ------ ...rePointEnterpriseStorageSettings.ascx.resx | 154 ------ ...SharePointEnterpriseStorageUsage.ascx.resx | 150 ------ ...dSharePointRestoreSiteCollection.ascx.resx | 150 ------ .../HostedSharePointSiteCollections.ascx.resx | 153 ------ .../HostedSharePointStorageSettings.ascx.resx | 154 ------ .../HostedSharePointStorageUsage.ascx.resx | 150 ------ .../App_LocalResources/SpaceQuotas.ascx.resx | 5 +- ...arePointEnterpriseSiteCollectionsHelper.cs | 8 +- ...edSharePointBackupSiteCollection.ascx.resx | 0 .../HostedSharePointBackupSiteCollection.ascx | 80 ---- ...stedSharePointBackupSiteCollection.ascx.cs | 189 -------- ...PointBackupSiteCollection.ascx.designer.cs | 159 ------- .../HostedSharePointEditSiteCollection.ascx | 209 -------- ...HostedSharePointEditSiteCollection.ascx.cs | 450 ------------------ ...rePointEditSiteCollection.ascx.designer.cs | 447 ----------------- ...rePointEnterpriseBackupSiteCollection.ascx | 80 ---- ...ointEnterpriseBackupSiteCollection.ascx.cs | 189 -------- ...priseBackupSiteCollection.ascx.designer.cs | 159 ------- ...harePointEnterpriseEditSiteCollection.ascx | 209 -------- ...ePointEnterpriseEditSiteCollection.ascx.cs | 450 ------------------ ...erpriseEditSiteCollection.ascx.designer.cs | 447 ----------------- ...ePointEnterpriseRestoreSiteCollection.ascx | 101 ---- ...intEnterpriseRestoreSiteCollection.ascx.cs | 176 ------- ...riseRestoreSiteCollection.ascx.designer.cs | 159 ------- ...edSharePointEnterpriseSiteCollections.ascx | 92 ---- ...harePointEnterpriseSiteCollections.ascx.cs | 110 ----- ...EnterpriseSiteCollections.ascx.designer.cs | 141 ------ ...edSharePointEnterpriseStorageSettings.ascx | 62 --- ...harePointEnterpriseStorageSettings.ascx.cs | 93 ---- ...EnterpriseStorageSettings.ascx.designer.cs | 114 ----- ...ostedSharePointEnterpriseStorageUsage.ascx | 57 --- ...edSharePointEnterpriseStorageUsage.ascx.cs | 94 ---- ...intEnterpriseStorageUsage.ascx.designer.cs | 114 ----- ...HostedSharePointRestoreSiteCollection.ascx | 101 ---- ...tedSharePointRestoreSiteCollection.ascx.cs | 176 ------- ...ointRestoreSiteCollection.ascx.designer.cs | 159 ------- .../HostedSharePointSiteCollections.ascx | 92 ---- .../HostedSharePointSiteCollections.ascx.cs | 110 ----- ...SharePointSiteCollections.ascx.designer.cs | 141 ------ .../HostedSharePointStorageSettings.ascx | 62 --- .../HostedSharePointStorageSettings.ascx.cs | 93 ---- ...SharePointStorageSettings.ascx.designer.cs | 114 ----- .../HostedSharePointStorageUsage.ascx | 57 --- .../HostedSharePointStorageUsage.ascx.cs | 94 ---- ...tedSharePointStorageUsage.ascx.designer.cs | 114 ----- .../WebsitePanel/SpaceQuotas.ascx | 5 + .../WebsitePanel/SpaceQuotas.ascx.cs | 1 + .../WebsitePanel/SpaceQuotas.ascx.designer.cs | 55 ++- .../WebsitePanel.Portal.Modules.csproj | 96 ++-- .../WebsitePanel.WebPortal.csproj | 4 +- 72 files changed, 681 insertions(+), 7722 deletions(-) rename WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/{SharePointStatisticsEnterprise.cs => SharePointEntetpriseStatistics.cs} (100%) create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteCollection.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteCollectionListPaged.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteDiskSpace.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEditSiteCollection.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseBackupSiteCollection.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseEditSiteCollection.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseRestoreSiteCollection.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseSiteCollections.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageSettings.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageUsage.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointRestoreSiteCollection.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointSiteCollections.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointStorageSettings.ascx.resx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointStorageUsage.ascx.resx rename WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/{ => HostedSharePoint}/App_LocalResources/HostedSharePointBackupSiteCollection.ascx.resx (100%) delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersEntProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersEntProxy.cs index f49885a5..ff8492db 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersEntProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersEntProxy.cs @@ -140,7 +140,7 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetSiteCollectionsPaged", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollectionListPaged Enterprise_GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { + public SharePointEnterpriseSiteCollectionListPaged Enterprise_GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { object[] results = this.Invoke("Enterprise_GetSiteCollectionsPaged", new object[] { packageId, organizationId, @@ -149,7 +149,7 @@ namespace WebsitePanel.EnterpriseServer { sortColumn, startRow, maximumRows}); - return ((SharePointSiteCollectionListPaged)(results[0])); + return ((SharePointEnterpriseSiteCollectionListPaged)(results[0])); } /// @@ -165,9 +165,9 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteCollectionListPaged EndEnterprise_GetSiteCollectionsPaged(System.IAsyncResult asyncResult) { + public SharePointEnterpriseSiteCollectionListPaged EndEnterprise_GetSiteCollectionsPaged(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); - return ((SharePointSiteCollectionListPaged)(results[0])); + return ((SharePointEnterpriseSiteCollectionListPaged)(results[0])); } /// @@ -240,11 +240,11 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetSiteCollections", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollection[] Enterprise_GetSiteCollections(int packageId, bool recursive) { + public SharePointEnterpriseSiteCollection[] Enterprise_GetSiteCollections(int packageId, bool recursive) { object[] results = this.Invoke("Enterprise_GetSiteCollections", new object[] { packageId, recursive}); - return ((SharePointSiteCollection[])(results[0])); + return ((SharePointEnterpriseSiteCollection[])(results[0])); } /// @@ -255,9 +255,9 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteCollection[] EndEnterprise_GetSiteCollections(System.IAsyncResult asyncResult) { + public SharePointEnterpriseSiteCollection[] EndEnterprise_GetSiteCollections(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); - return ((SharePointSiteCollection[])(results[0])); + return ((SharePointEnterpriseSiteCollection[])(results[0])); } /// @@ -334,10 +334,10 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetSiteCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollection Enterprise_GetSiteCollection(int itemId) { + public SharePointEnterpriseSiteCollection Enterprise_GetSiteCollection(int itemId) { object[] results = this.Invoke("Enterprise_GetSiteCollection", new object[] { itemId}); - return ((SharePointSiteCollection)(results[0])); + return ((SharePointEnterpriseSiteCollection)(results[0])); } /// @@ -347,9 +347,9 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteCollection EndEnterprise_GetSiteCollection(System.IAsyncResult asyncResult) { + public SharePointEnterpriseSiteCollection EndEnterprise_GetSiteCollection(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); - return ((SharePointSiteCollection)(results[0])); + return ((SharePointEnterpriseSiteCollection)(results[0])); } /// @@ -376,11 +376,11 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_GetSiteCollectionByDomain" + "", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollection Enterprise_GetSiteCollectionByDomain(int organizationId, string domain) { + public SharePointEnterpriseSiteCollection Enterprise_GetSiteCollectionByDomain(int organizationId, string domain) { object[] results = this.Invoke("Enterprise_GetSiteCollectionByDomain", new object[] { organizationId, domain}); - return ((SharePointSiteCollection)(results[0])); + return ((SharePointEnterpriseSiteCollection)(results[0])); } /// @@ -391,9 +391,9 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteCollection EndEnterprise_GetSiteCollectionByDomain(System.IAsyncResult asyncResult) { + public SharePointEnterpriseSiteCollection EndEnterprise_GetSiteCollectionByDomain(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); - return ((SharePointSiteCollection)(results[0])); + return ((SharePointEnterpriseSiteCollection)(results[0])); } /// @@ -420,14 +420,14 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_AddSiteCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public int Enterprise_AddSiteCollection(SharePointSiteCollection item) { + public int Enterprise_AddSiteCollection(SharePointEnterpriseSiteCollection item) { object[] results = this.Invoke("Enterprise_AddSiteCollection", new object[] { item}); return ((int)(results[0])); } /// - public System.IAsyncResult BeginEnterprise_AddSiteCollection(SharePointSiteCollection item, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginEnterprise_AddSiteCollection(SharePointEnterpriseSiteCollection item, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("Enterprise_AddSiteCollection", new object[] { item}, callback, asyncState); } @@ -439,12 +439,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void Enterprise_AddSiteCollectionAsync(SharePointSiteCollection item) { + public void Enterprise_AddSiteCollectionAsync(SharePointEnterpriseSiteCollection item) { this.Enterprise_AddSiteCollectionAsync(item, null); } /// - public void Enterprise_AddSiteCollectionAsync(SharePointSiteCollection item, object userState) { + public void Enterprise_AddSiteCollectionAsync(SharePointEnterpriseSiteCollection item, object userState) { if ((this.Enterprise_AddSiteCollectionOperationCompleted == null)) { this.Enterprise_AddSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_AddSiteCollectionOperationCompleted); } @@ -745,11 +745,11 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/Enterprise_CalculateSharePointSitesD" + "iskSpace", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteDiskSpace[] Enterprise_CalculateSharePointSitesDiskSpace(int itemId, out int errorCode) { + public SharePointEnterpriseSiteDiskSpace[] Enterprise_CalculateSharePointSitesDiskSpace(int itemId, out int errorCode) { object[] results = this.Invoke("Enterprise_CalculateSharePointSitesDiskSpace", new object[] { itemId}); errorCode = ((int)(results[1])); - return ((SharePointSiteDiskSpace[])(results[0])); + return ((SharePointEnterpriseSiteDiskSpace[])(results[0])); } /// @@ -759,10 +759,10 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteDiskSpace[] EndEnterprise_CalculateSharePointSitesDiskSpace(System.IAsyncResult asyncResult, out int errorCode) { + public SharePointEnterpriseSiteDiskSpace[] EndEnterprise_CalculateSharePointSitesDiskSpace(System.IAsyncResult asyncResult, out int errorCode) { object[] results = this.EndInvoke(asyncResult); errorCode = ((int)(results[1])); - return ((SharePointSiteDiskSpace[])(results[0])); + return ((SharePointEnterpriseSiteDiskSpace[])(results[0])); } /// @@ -858,10 +858,10 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteCollectionListPaged Result { + public SharePointEnterpriseSiteCollectionListPaged Result { get { this.RaiseExceptionIfNecessary(); - return ((SharePointSiteCollectionListPaged)(this.results[0])); + return ((SharePointEnterpriseSiteCollectionListPaged)(this.results[0])); } } } @@ -910,10 +910,10 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteCollection[] Result { + public SharePointEnterpriseSiteCollection[] Result { get { this.RaiseExceptionIfNecessary(); - return ((SharePointSiteCollection[])(this.results[0])); + return ((SharePointEnterpriseSiteCollection[])(this.results[0])); } } } @@ -962,10 +962,10 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteCollection Result { + public SharePointEnterpriseSiteCollection Result { get { this.RaiseExceptionIfNecessary(); - return ((SharePointSiteCollection)(this.results[0])); + return ((SharePointEnterpriseSiteCollection)(this.results[0])); } } } @@ -988,10 +988,10 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteCollection Result { + public SharePointEnterpriseSiteCollection Result { get { this.RaiseExceptionIfNecessary(); - return ((SharePointSiteCollection)(this.results[0])); + return ((SharePointEnterpriseSiteCollection)(this.results[0])); } } } @@ -1196,10 +1196,10 @@ namespace WebsitePanel.EnterpriseServer { } /// - public SharePointSiteDiskSpace[] Result { + public SharePointEnterpriseSiteDiskSpace[] Result { get { this.RaiseExceptionIfNecessary(); - return ((SharePointSiteDiskSpace[])(this.results[0])); + return ((SharePointEnterpriseSiteDiskSpace[])(this.results[0])); } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 8b536f54..5bb15cef 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -990,7 +990,7 @@ namespace WebsitePanel.EnterpriseServer if (cntxTmp.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer)) { - SharePointSiteCollectionListPaged sharePointStats = HostedSharePointServerEntController.GetSiteCollectionsPaged(org.PackageId, org.Id, string.Empty, string.Empty, string.Empty, 0, 0); + SharePointEnterpriseSiteCollectionListPaged sharePointStats = HostedSharePointServerEntController.GetSiteCollectionsPaged(org.PackageId, org.Id, string.Empty, string.Empty, string.Empty, 0, 0); stats.CreatedSharePointEnterpriseSiteCollections = sharePointStats.TotalRowCount; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs index 166cc63a..16bf13ef 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/ReportController.cs @@ -464,7 +464,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution private static void PopulateSharePointEnterpriseItem(Organization org, EnterpriseSolutionStatisticsReport report, string topReseller) { - List siteCollections; + List siteCollections; try { @@ -491,7 +491,7 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution string.Format("Could not get sharepoint enterprise server. PackageId: {0}", org.PackageId), ex); } - foreach (SharePointSiteCollection siteCollection in siteCollections) + foreach (SharePointEnterpriseSiteCollection siteCollection in siteCollections) { try { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs index 4ecba88f..94020e38 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs @@ -58,24 +58,24 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Row index to start from. /// Maximum number of rows to retrieve. /// Site collections that match. - public static SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + public static SharePointEnterpriseSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { if (IsDemoMode) { - SharePointSiteCollectionListPaged demoResult = new SharePointSiteCollectionListPaged(); + SharePointEnterpriseSiteCollectionListPaged demoResult = new SharePointEnterpriseSiteCollectionListPaged(); demoResult.SiteCollections = GetSiteCollections(1, false); demoResult.TotalRowCount = demoResult.SiteCollections.Count; return demoResult; } - SharePointSiteCollectionListPaged paged = new SharePointSiteCollectionListPaged(); - DataSet result = PackageController.GetRawPackageItemsPaged(packageId, "Sharepoint Enterprise Server", typeof(SharePointSiteCollection), + SharePointEnterpriseSiteCollectionListPaged paged = new SharePointEnterpriseSiteCollectionListPaged(); + DataSet result = PackageController.GetRawPackageItemsPaged(packageId, "Sharepoint Enterprise Server", typeof(SharePointEnterpriseSiteCollection), true, filterColumn, filterValue, sortColumn, startRow, Int32.MaxValue); - List items = PackageController.CreateServiceItemsList(result, 1).ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); + List items = PackageController.CreateServiceItemsList(result, 1).ConvertAll(delegate(ServiceProviderItem item) { return (SharePointEnterpriseSiteCollection)item; }); if (organizationId > 0) { - items = items.FindAll(delegate(SharePointSiteCollection siteCollection) { return siteCollection.OrganizationId == organizationId; }); + items = items.FindAll(delegate(SharePointEnterpriseSiteCollection siteCollection) { return siteCollection.OrganizationId == organizationId; }); } paged.TotalRowCount = items.Count; @@ -89,16 +89,16 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint return paged; } - public static List GetSiteCollections(int organizationId) + public static List GetSiteCollections(int organizationId) { Organization org = OrganizationController.GetOrganization(organizationId); - List items = PackageController.GetPackageItemsByType(org.PackageId, typeof(SharePointSiteCollection), false); - items.ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); - List ret = new List(); + List items = PackageController.GetPackageItemsByType(org.PackageId, typeof(SharePointEnterpriseSiteCollection), false); + items.ConvertAll(delegate(ServiceProviderItem item) { return (SharePointEnterpriseSiteCollection)item; }); + List ret = new List(); foreach (ServiceProviderItem item in items) { - SharePointSiteCollection siteCollection = item as SharePointSiteCollection; + SharePointEnterpriseSiteCollection siteCollection = item as SharePointEnterpriseSiteCollection; if (siteCollection != null && siteCollection.OrganizationId == organizationId) { ret.Add(siteCollection); @@ -150,12 +150,12 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Package that owns site collections. /// A value which shows whether nested spaces must be searched as well. /// List of found site collections. - public static List GetSiteCollections(int packageId, bool recursive) + public static List GetSiteCollections(int packageId, bool recursive) { if (IsDemoMode) { - List demoResult = new List(); - SharePointSiteCollection siteCollection1 = new SharePointSiteCollection(); + List demoResult = new List(); + SharePointEnterpriseSiteCollection siteCollection1 = new SharePointEnterpriseSiteCollection(); siteCollection1.Id = 1; siteCollection1.OrganizationId = 1; siteCollection1.LocaleId = 1033; @@ -167,7 +167,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint siteCollection1.Title = "John Smith's Team Site"; siteCollection1.Url = "http://john.fabrikam.com"; demoResult.Add(siteCollection1); - SharePointSiteCollection siteCollection2 = new SharePointSiteCollection(); + SharePointEnterpriseSiteCollection siteCollection2 = new SharePointEnterpriseSiteCollection(); siteCollection2.Id = 2; siteCollection1.OrganizationId = 1; siteCollection2.LocaleId = 1033; @@ -183,8 +183,8 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } - List items = PackageController.GetPackageItemsByType(packageId, typeof(SharePointSiteCollection), recursive); - return items.ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); + List items = PackageController.GetPackageItemsByType(packageId, typeof(SharePointEnterpriseSiteCollection), recursive); + return items.ConvertAll(delegate(ServiceProviderItem item) { return (SharePointEnterpriseSiteCollection)item; }); } /// @@ -192,14 +192,14 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// /// Site collection id within metabase. /// Site collection or null in case no such item exist. - public static SharePointSiteCollection GetSiteCollection(int itemId) + public static SharePointEnterpriseSiteCollection GetSiteCollection(int itemId) { if (IsDemoMode) { return GetSiteCollections(1, false)[itemId - 1]; } - SharePointSiteCollection item = PackageController.GetPackageItem(itemId) as SharePointSiteCollection; + SharePointEnterpriseSiteCollection item = PackageController.GetPackageItem(itemId) as SharePointEnterpriseSiteCollection; return item; } @@ -208,7 +208,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// /// Site collection description. /// Created site collection id within metabase. - public static int AddSiteCollection(SharePointSiteCollection item) + public static int AddSiteCollection(SharePointEnterpriseSiteCollection item) { // Check account. @@ -274,7 +274,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint item.Name = String.Format("{0}://{1}", rootWebApplicationUri.Scheme, hostNameBase + "-" + counter.ToString() + "." + sslRoot); siteName = String.Format("{0}", hostNameBase + "-" + counter.ToString() + "." + sslRoot); - while (DataProvider.CheckServiceItemExists(serviceId, item.Name, "WebsitePanel.Providers.SharePoint.SharePointSiteCollection, WebsitePanel.Providers.Base")) + while (DataProvider.CheckServiceItemExists(serviceId, item.Name, "WebsitePanel.Providers.SharePoint.SharePointEnterpriseSiteCollection, WebsitePanel.Providers.Base")) { counter++; item.Name = String.Format("{0}://{1}", rootWebApplicationUri.Scheme, hostNameBase + "-" + counter.ToString() + "." + sslRoot); @@ -304,7 +304,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint // Check package item with given name already exists. - if (PackageController.GetPackageItemByName(item.PackageId, item.Name, typeof(SharePointSiteCollection)) != null) + if (PackageController.GetPackageItemByName(item.PackageId, item.Name, typeof(SharePointEnterpriseSiteCollection)) != null) { return BusinessErrorCodes.ERROR_SHAREPOINT_PACKAGE_ITEM_EXISTS; } @@ -370,7 +370,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } // Load original meta item - SharePointSiteCollection origItem = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + SharePointEnterpriseSiteCollection origItem = (SharePointEnterpriseSiteCollection)PackageController.GetPackageItem(itemId); if (origItem == null) { return BusinessErrorCodes.ERROR_SHAREPOINT_PACKAGE_ITEM_NOT_FOUND; @@ -427,8 +427,8 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint public static void DeleteSiteCollections(int organizationId) { Organization org = OrganizationController.GetOrganization(organizationId); - SharePointSiteCollectionListPaged existentSiteCollections = GetSiteCollectionsPaged(org.PackageId, org.Id, String.Empty, String.Empty, String.Empty, 0, Int32.MaxValue); - foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) + SharePointEnterpriseSiteCollectionListPaged existentSiteCollections = GetSiteCollectionsPaged(org.PackageId, org.Id, String.Empty, String.Empty, String.Empty, 0, Int32.MaxValue); + foreach (SharePointEnterpriseSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) { DeleteSiteCollection(existentSiteCollection.Id); } @@ -453,7 +453,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } // Load original meta item - SharePointSiteCollection origItem = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + SharePointEnterpriseSiteCollection origItem = (SharePointEnterpriseSiteCollection)PackageController.GetPackageItem(itemId); if (origItem == null) { return null; @@ -536,7 +536,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } // Load original meta item. - SharePointSiteCollection origItem = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + SharePointEnterpriseSiteCollection origItem = (SharePointEnterpriseSiteCollection)PackageController.GetPackageItem(itemId); if (origItem == null) { return BusinessErrorCodes.ERROR_SHAREPOINT_PACKAGE_ITEM_NOT_FOUND; @@ -617,7 +617,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint public static byte[] GetBackupBinaryChunk(int itemId, string path, int offset, int length) { // Load original meta item. - SharePointSiteCollection item = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + SharePointEnterpriseSiteCollection item = (SharePointEnterpriseSiteCollection)PackageController.GetPackageItem(itemId); if (item == null) { return null; @@ -638,7 +638,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint public static string AppendBackupBinaryChunk(int itemId, string fileName, string path, byte[] chunk) { // Load original meta item. - SharePointSiteCollection item = (SharePointSiteCollection)PackageController.GetPackageItem(itemId); + SharePointEnterpriseSiteCollection item = (SharePointEnterpriseSiteCollection)PackageController.GetPackageItem(itemId); if (item == null) { return null; @@ -681,9 +681,9 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); - if (itemType == typeof(SharePointSiteCollection)) + if (itemType == typeof(SharePointEnterpriseSiteCollection)) { - foreach (SharePointSiteCollection siteCollection in hostedSharePointServer.Enterprise_GetSiteCollections()) + foreach (SharePointEnterpriseSiteCollection siteCollection in hostedSharePointServer.Enterprise_GetSiteCollections()) { items.Add(siteCollection.Url); } @@ -710,9 +710,9 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); - if (itemType == typeof(SharePointSiteCollection)) + if (itemType == typeof(SharePointEnterpriseSiteCollection)) { - SharePointSiteCollection siteCollection = hostedSharePointServer.Enterprise_GetSiteCollection(itemName); + SharePointEnterpriseSiteCollection siteCollection = hostedSharePointServer.Enterprise_GetSiteCollection(itemName); PackageController.AddPackageItem(siteCollection); } } @@ -727,11 +727,11 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Resulting code. public int BackupItem(string tempFolder, XmlWriter writer, ServiceProviderItem item, ResourceGroupInfo group) { - SharePointSiteCollection siteCollection = item as SharePointSiteCollection; + SharePointEnterpriseSiteCollection siteCollection = item as SharePointEnterpriseSiteCollection; if (siteCollection != null) { HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(siteCollection.ServiceId); - SharePointSiteCollection loadedSiteCollection = hostedSharePointServer.Enterprise_GetSiteCollection(siteCollection.Url); + SharePointEnterpriseSiteCollection loadedSiteCollection = hostedSharePointServer.Enterprise_GetSiteCollection(siteCollection.Url); // Update item siteCollection.Url = loadedSiteCollection.Url; siteCollection.OwnerLogin = loadedSiteCollection.OwnerLogin; @@ -741,7 +741,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint siteCollection.Title = loadedSiteCollection.Title; siteCollection.Description = loadedSiteCollection.Description; // Serialize it. - XmlSerializer serializer = new XmlSerializer(typeof(SharePointSiteCollection)); + XmlSerializer serializer = new XmlSerializer(typeof(SharePointEnterpriseSiteCollection)); serializer.Serialize(writer, siteCollection); } @@ -762,12 +762,12 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Resulting code. public int RestoreItem(string tempFolder, XmlNode itemNode, int itemId, Type itemType, string itemName, int packageId, int serviceId, ResourceGroupInfo group) { - if (itemType == typeof(SharePointSiteCollection)) + if (itemType == typeof(SharePointEnterpriseSiteCollection)) { HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); // Deserialize item. - XmlSerializer serializer = new XmlSerializer(typeof(SharePointSiteCollection)); - SharePointSiteCollection siteCollection = (SharePointSiteCollection)serializer.Deserialize(new XmlNodeReader(itemNode.SelectSingleNode("SharePointSiteCollection"))); + XmlSerializer serializer = new XmlSerializer(typeof(SharePointEnterpriseSiteCollection)); + SharePointEnterpriseSiteCollection siteCollection = (SharePointEnterpriseSiteCollection)serializer.Deserialize(new XmlNodeReader(itemNode.SelectSingleNode("SharePointEnterpriseSiteCollection"))); siteCollection.PackageId = packageId; siteCollection.ServiceId = serviceId; @@ -778,7 +778,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } // Add metabase record if needed. - SharePointSiteCollection metaSiteCollection = (SharePointSiteCollection)PackageController.GetPackageItemByName(packageId, itemName, typeof(SharePointSiteCollection)); + SharePointEnterpriseSiteCollection metaSiteCollection = (SharePointEnterpriseSiteCollection)PackageController.GetPackageItemByName(packageId, itemName, typeof(SharePointEnterpriseSiteCollection)); if (metaSiteCollection == null) { PackageController.AddPackageItem(siteCollection); @@ -794,11 +794,11 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint return PackageController.GetPackageServiceId(packageId, ResourceGroups.SharepointEnterpriseServer); } - private static List GetOrganizationSharePointSiteCollections(int orgId) + private static List GetOrganizationSharePointEnterpriseSiteCollections(int orgId) { Organization org = OrganizationController.GetOrganization(orgId); - SharePointSiteCollectionListPaged siteCollections = GetSiteCollectionsPaged(org.PackageId, org.Id, String.Empty, String.Empty, String.Empty, 0, Int32.MaxValue); + SharePointEnterpriseSiteCollectionListPaged siteCollections = GetSiteCollectionsPaged(org.PackageId, org.Id, String.Empty, String.Empty, String.Empty, 0, Int32.MaxValue); return siteCollections.SiteCollections; } @@ -873,15 +873,15 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); - List currentOrgSiteCollection = - GetOrganizationSharePointSiteCollections(org.Id); + List currentOrgSiteCollection = + GetOrganizationSharePointEnterpriseSiteCollections(org.Id); - foreach (SharePointSiteCollection siteCollection in currentOrgSiteCollection) + foreach (SharePointEnterpriseSiteCollection siteCollection in currentOrgSiteCollection) { try { - SharePointSiteCollection sc = GetSiteCollection(siteCollection.Id); + SharePointEnterpriseSiteCollection sc = GetSiteCollection(siteCollection.Id); sc.MaxSiteStorage = realMaxSizeValue; sc.WarningStorage = realMaxSizeValue == -1 ? -1 : warningStorage; PackageController.UpdatePackageItem(sc); @@ -933,11 +933,11 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); - List currentOrgSiteCollection = - GetOrganizationSharePointSiteCollections(org.Id); + List currentOrgSiteCollection = + GetOrganizationSharePointEnterpriseSiteCollections(org.Id); List urls = new List(); - foreach (SharePointSiteCollection siteCollection in currentOrgSiteCollection) + foreach (SharePointEnterpriseSiteCollection siteCollection in currentOrgSiteCollection) { urls.Add(siteCollection.PhysicalAddress); } @@ -981,7 +981,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint HostedSharePointServerEnt hostedSharePointServer = GetHostedSharePointServer(serviceId); - SharePointSiteCollection sc = GetSiteCollection(siteCollectionId); + SharePointEnterpriseSiteCollection sc = GetSiteCollection(siteCollectionId); int maxSize = RecalculateMaxSize(org.MaxSharePointEnterpriseStorage, maxStorage); int warningSize = warningStorage; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs index 3837ca4c..37c62963 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServersEnt.asmx.cs @@ -58,7 +58,7 @@ namespace WebsitePanel.EnterpriseServer /// Resource group name. /// Site collections in raw format. [WebMethod] - public SharePointSiteCollectionListPaged Enterprise_GetSiteCollectionsPaged(int packageId, int organizationId, + public SharePointEnterpriseSiteCollectionListPaged Enterprise_GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { return HostedSharePointServerEntController.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, @@ -83,7 +83,7 @@ namespace WebsitePanel.EnterpriseServer /// Resource group name. /// List of found site collections. [WebMethod] - public List Enterprise_GetSiteCollections(int packageId, bool recursive) + public List Enterprise_GetSiteCollections(int packageId, bool recursive) { return HostedSharePointServerEntController.GetSiteCollections(packageId, recursive); } @@ -100,7 +100,7 @@ namespace WebsitePanel.EnterpriseServer /// Site collection id within metabase. /// Site collection. [WebMethod] - public SharePointSiteCollection Enterprise_GetSiteCollection(int itemId) + public SharePointEnterpriseSiteCollection Enterprise_GetSiteCollection(int itemId) { return HostedSharePointServerEntController.GetSiteCollection(itemId); } @@ -113,11 +113,11 @@ namespace WebsitePanel.EnterpriseServer /// Domain name. /// SharePoint site collection or null. [WebMethod] - public SharePointSiteCollection Enterprise_GetSiteCollectionByDomain(int organizationId, string domain) + public SharePointEnterpriseSiteCollection Enterprise_GetSiteCollectionByDomain(int organizationId, string domain) { DomainInfo domainInfo = ServerController.GetDomain(domain); - SharePointSiteCollectionListPaged existentSiteCollections = this.Enterprise_GetSiteCollectionsPaged(domainInfo.PackageId, organizationId, "ItemName", String.Format("%{0}", domain), String.Empty, 0, Int32.MaxValue); - foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) + SharePointEnterpriseSiteCollectionListPaged existentSiteCollections = this.Enterprise_GetSiteCollectionsPaged(domainInfo.PackageId, organizationId, "ItemName", String.Format("%{0}", domain), String.Empty, 0, Int32.MaxValue); + foreach (SharePointEnterpriseSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) { Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); if (existentSiteCollection.Name == String.Format("{0}://{1}", existentSiteCollectionUri.Scheme, domain)) @@ -133,10 +133,9 @@ namespace WebsitePanel.EnterpriseServer /// Adds SharePoint site collection. /// /// Site collection description. - /// Resource group name. /// Created site collection id within metabase. [WebMethod] - public int Enterprise_AddSiteCollection(SharePointSiteCollection item) + public int Enterprise_AddSiteCollection(SharePointEnterpriseSiteCollection item) { return HostedSharePointServerEntController.AddSiteCollection(item); } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/Organization.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/Organization.cs index f88314b1..23ea8636 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/Organization.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/Organization.cs @@ -83,6 +83,7 @@ namespace WebsitePanel.Providers.HostedSolution set { warningSharePointStorage = value; } } + [Persistent] public int MaxSharePointEnterpriseStorage { get { return maxSharePointEnterpriseStorage; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/SharePointStatisticsEnterprise.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/SharePointEntetpriseStatistics.cs similarity index 100% rename from WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/SharePointStatisticsEnterprise.cs rename to WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/SharePointEntetpriseStatistics.cs diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/IHostedSharePointServerEnt.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/IHostedSharePointServerEnt.cs index 4bc6f8ee..55b1d2e9 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/IHostedSharePointServerEnt.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/IHostedSharePointServerEnt.cs @@ -54,26 +54,26 @@ namespace WebsitePanel.Providers.SharePoint /// When implemented gets list of SharePoint collections within root web application. /// /// List of SharePoint collections within root web application. - SharePointSiteCollection[] Enterprise_GetSiteCollections(); + SharePointEnterpriseSiteCollection[] Enterprise_GetSiteCollections(); /// /// When implemented gets SharePoint collection within root web application with given name. /// /// Url that uniquely identifies site collection to be loaded. /// SharePoint collection within root web application with given name. - SharePointSiteCollection Enterprise_GetSiteCollection(string url); + SharePointEnterpriseSiteCollection Enterprise_GetSiteCollection(string url); /// /// When implemented creates site collection within predefined root web application. /// /// Information about site coolection to be created. - void Enterprise_CreateSiteCollection(SharePointSiteCollection siteCollection); + void Enterprise_CreateSiteCollection(SharePointEnterpriseSiteCollection siteCollection); /// /// When implemented deletes site collection under given url. /// /// Url that uniquely identifies site collection to be deleted. - void Enterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection); + void Enterprise_DeleteSiteCollection(SharePointEnterpriseSiteCollection siteCollection); /// /// When implemeneted backups site collection under give url. @@ -89,7 +89,7 @@ namespace WebsitePanel.Providers.SharePoint /// /// Site collection to be restored. /// Backup file name to restore from. - void Enterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename); + void Enterprise_RestoreSiteCollection(SharePointEnterpriseSiteCollection siteCollection, string filename); /// /// When implemented gets binary data chunk of specified size from specified offset. diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteCollection.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteCollection.cs new file mode 100644 index 00000000..7230f123 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteCollection.cs @@ -0,0 +1,298 @@ +// 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.Collections.Generic; +using System.Text; + +namespace WebsitePanel.Providers.SharePoint +{ + /// + /// Represents SharePoint site collection information. + /// + [Serializable] + public class SharePointEnterpriseSiteCollection : ServiceProviderItem + { + private int organizationId; + private string url; + private string physicalAddress; + private string ownerLogin; + private string ownerName; + private string ownerEmail; + private int localeId; + private string title; + private string description; + private long bandwidth; + private long diskspace; + private long maxSiteStorage; + private long warningStorage; + private string rootWebApplicationInteralIpAddress; + private string rootWebApplicationFQDN; + + + + [Persistent] + public long MaxSiteStorage + { + get { return maxSiteStorage; } + set { maxSiteStorage = value; } + } + + [Persistent] + public long WarningStorage + { + get { return warningStorage; } + set { warningStorage = value; } + } + + /// + /// Gets or sets service item name. + /// + public override string Name + { + get + { + return this.Url; + } + set + { + this.Url = value; + } + } + + /// + /// Gets or sets id of organization which owns this site collection. + /// + [Persistent] + public int OrganizationId + { + get + { + return this.organizationId; + } + set + { + this.organizationId = value; + } + } + + /// + /// Gets or sets url of the host named site collection to be created. It must not contain port number. + /// + [Persistent] + public string Url + { + get + { + return this.url; + } + set + { + this.url = value; + } + } + + /// + /// Gets or sets physical address of the host named site collection. It contains scheme and port number. + /// + [Persistent] + public string PhysicalAddress + { + get + { + return this.physicalAddress; + } + set + { + this.physicalAddress = value; + } + } + + /// + /// Gets or sets login name of the site collection's owner/primary site administrator. + /// + [Persistent] + public string OwnerLogin + { + get + { + return this.ownerLogin; + } + set + { + this.ownerLogin = value; + } + } + + /// + /// Gets or sets display name of the site collection's owner/primary site administrator. + /// + [Persistent] + public string OwnerName + { + get + { + return this.ownerName; + } + set + { + this.ownerName = value; + } + } + + /// + /// Gets or sets display email of the site collection's owner/primary site administrator. + /// + [Persistent] + public string OwnerEmail + { + get + { + return this.ownerEmail; + } + set + { + this.ownerEmail = value; + } + } + + /// + /// Gets or sets the internal ip address + /// + [Persistent] + public string RootWebApplicationInteralIpAddress + { + get + { + return this.rootWebApplicationInteralIpAddress; + } + set + { + this.rootWebApplicationInteralIpAddress = value; + } + } + + /// + /// Gets or sets the internal ip address + /// + [Persistent] + public string RootWebApplicationFQDN + { + get + { + return this.rootWebApplicationFQDN; + } + set + { + this.rootWebApplicationFQDN = value; + } + } + + + /// + /// Gets or sets locale id of the site collection to be created. + /// + [Persistent] + public int LocaleId + { + get + { + return this.localeId; + } + set + { + this.localeId = value; + } + } + + /// + /// Gets or sets title of the the site collection to be created. + /// + [Persistent] + public string Title + { + get + { + return this.title; + } + set + { + this.title = value; + } + } + + /// + /// Gets or sets description of the the site collection to be created. + /// + [Persistent] + public string Description + { + get + { + return this.description; + } + set + { + this.description = value; + } + } + + /// + /// Gets or sets bandwidth of the the site collection. + /// + [Persistent] + public long Bandwidth + { + get + { + return this.bandwidth; + } + set + { + this.bandwidth = value; + } + } + + /// + /// Gets or sets diskspace of the the site collection. + /// + [Persistent] + public long Diskspace + { + get + { + return this.diskspace; + } + set + { + this.diskspace = value; + } + } + + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteCollectionListPaged.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteCollectionListPaged.cs new file mode 100644 index 00000000..38ee5996 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteCollectionListPaged.cs @@ -0,0 +1,71 @@ +// 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.Collections.Generic; +using System.Text; + +namespace WebsitePanel.Providers.SharePoint +{ + [Serializable] + public class SharePointEnterpriseSiteCollectionListPaged + { + private int totalRowCount; + private List siteCollections; + + /// + /// Gets or sets total row count in persistent storage. + /// + public int TotalRowCount + { + get + { + return this.totalRowCount; + } + set + { + this.totalRowCount = value; + } + } + + /// + /// Gets or sets list of site collections on a single page. + /// + public List SiteCollections + { + get + { + return this.siteCollections; + } + set + { + this.siteCollections = value; + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteDiskSpace.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteDiskSpace.cs new file mode 100644 index 00000000..a734327b --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/SharePoint/SharePointEnterpriseSiteDiskSpace.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; + +namespace WebsitePanel.Providers.SharePoint +{ + [Serializable] + public class SharePointEnterpriseSiteDiskSpace + { + private string url; + private long diskSpace; + + + public string Url + { + get { return url; } + set { url = value; } + } + + public long DiskSpace + { + get { return diskSpace; } + set { diskSpace = value; } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index 90bec626..7b34bc85 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -123,7 +123,7 @@ - + @@ -286,8 +286,11 @@ + + + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013Ent.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013Ent.cs index d9e93497..1bc80759 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013Ent.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013Ent.cs @@ -94,7 +94,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Gets list of SharePoint collections within root web application. /// List of SharePoint collections within root web application. - public SharePointSiteCollection[] Enterprise_GetSiteCollections() + public SharePointEnterpriseSiteCollection[] Enterprise_GetSiteCollections() { return ExecuteSharePointAction(impl => impl.GetSiteCollections(Enterprise_RootWebApplicationUri)); } @@ -102,14 +102,14 @@ namespace WebsitePanel.Providers.HostedSolution /// Gets SharePoint collection within root web application with given name. /// Url that uniquely identifies site collection to be loaded. /// SharePoint collection within root web application with given name. - public SharePointSiteCollection Enterprise_GetSiteCollection(string url) + public SharePointEnterpriseSiteCollection Enterprise_GetSiteCollection(string url) { return ExecuteSharePointAction(impl => impl.GetSiteCollection(Enterprise_RootWebApplicationUri, url)); } /// Creates site collection within predefined root web application. /// Information about site coolection to be created. - public void Enterprise_CreateSiteCollection(SharePointSiteCollection siteCollection) + public void Enterprise_CreateSiteCollection(SharePointEnterpriseSiteCollection siteCollection) { ExecuteSharePointAction(delegate(HostedSharePointServer2013EntImpl impl) { @@ -120,7 +120,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Deletes site collection under given url. /// The site collection to be deleted. - public void Enterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection) + public void Enterprise_DeleteSiteCollection(SharePointEnterpriseSiteCollection siteCollection) { ExecuteSharePointAction(delegate(HostedSharePointServer2013EntImpl impl) { @@ -142,7 +142,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Restores site collection under given url from backup. /// Site collection to be restored. /// Backup file name to restore from. - public void Enterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename) + public void Enterprise_RestoreSiteCollection(SharePointEnterpriseSiteCollection siteCollection, string filename) { ExecuteSharePointAction(delegate(HostedSharePointServer2013EntImpl impl) { @@ -229,13 +229,13 @@ namespace WebsitePanel.Providers.HostedSolution { foreach (ServiceProviderItem item in items) { - var sharePointSiteCollection = item as SharePointSiteCollection; + var SharePointEnterpriseSiteCollection = item as SharePointEnterpriseSiteCollection; - if (sharePointSiteCollection != null) + if (SharePointEnterpriseSiteCollection != null) { try { - Enterprise_DeleteSiteCollection(sharePointSiteCollection); + Enterprise_DeleteSiteCollection(SharePointEnterpriseSiteCollection); } catch (Exception ex) { @@ -254,13 +254,13 @@ namespace WebsitePanel.Providers.HostedSolution foreach (ServiceProviderItem item in items) { - if (item is SharePointSiteCollection) + if (item is SharePointEnterpriseSiteCollection) { try { Log.WriteStart(String.Format("Calculating '{0}' site logs size", item.Name)); - SharePointSiteCollection site = Enterprise_GetSiteCollection(item.Name); + SharePointEnterpriseSiteCollection site = Enterprise_GetSiteCollection(item.Name); var diskspace = new ServiceProviderItemDiskSpace { ItemId = item.Id, DiskSpace = site.Diskspace }; itemsDiskspace.Add(diskspace); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013EntImpl.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013EntImpl.cs index ce92d7b2..04e39834 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013EntImpl.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/HostedSharePointServer2013EntImpl.cs @@ -63,7 +63,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Gets list of SharePoint collections within root web application. /// The root web application Uri. /// List of SharePoint collections within root web application. - public SharePointSiteCollection[] GetSiteCollections(Uri rootWebApplicationUri) + public SharePointEnterpriseSiteCollection[] GetSiteCollections(Uri rootWebApplicationUri) { return GetSPSiteCollections(rootWebApplicationUri).Select(pair => NewSiteCollection(pair.Value)).ToArray(); } @@ -185,7 +185,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Root web application uri. /// Url that uniquely identifies site collection to be loaded. /// SharePoint collection within root web application with given name. - public SharePointSiteCollection GetSiteCollection(Uri rootWebApplicationUri, string url) + public SharePointEnterpriseSiteCollection GetSiteCollection(Uri rootWebApplicationUri, string url) { return NewSiteCollection(GetSPSiteCollection(rootWebApplicationUri, url)); } @@ -269,7 +269,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Root web application uri. /// Information about site coolection to be created. /// Is thrown in case requested operation fails for any reason. - public void CreateSiteCollection(Uri rootWebApplicationUri, SharePointSiteCollection siteCollection) + public void CreateSiteCollection(Uri rootWebApplicationUri, SharePointEnterpriseSiteCollection siteCollection) { HostedSolutionLog.LogStart("CreateSiteCollection"); WindowsImpersonationContext wic = null; @@ -298,7 +298,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Root web application uri. /// Information about site coolection to be created. /// Is thrown in case requested operation fails for any reason. - private void CreateCollection(Runspace runspace, Uri rootWebApplicationUri, SharePointSiteCollection siteCollection) + private void CreateCollection(Runspace runspace, Uri rootWebApplicationUri, SharePointEnterpriseSiteCollection siteCollection) { string siteCollectionUrl = String.Format("{0}:{1}", siteCollection.Url, rootWebApplicationUri.Port); HostedSolutionLog.DebugInfo("siteCollectionUrl: {0}", siteCollectionUrl); @@ -347,7 +347,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Root web application uri. /// The site collection to be deleted. /// Is thrown in case requested operation fails for any reason. - public void DeleteSiteCollection(Uri rootWebApplicationUri, SharePointSiteCollection siteCollection) + public void DeleteSiteCollection(Uri rootWebApplicationUri, SharePointEnterpriseSiteCollection siteCollection) { HostedSolutionLog.LogStart("DeleteSiteCollection"); Runspace runspace = null; @@ -434,7 +434,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Site collection to be restored. /// Backup file name to restore from. /// Is thrown in case requested operation fails for any reason. - public void RestoreSiteCollection(Uri rootWebApplicationUri, SharePointSiteCollection siteCollection, string filename) + public void RestoreSiteCollection(Uri rootWebApplicationUri, SharePointEnterpriseSiteCollection siteCollection, string filename) { string url = siteCollection.Url; @@ -494,12 +494,12 @@ namespace WebsitePanel.Providers.HostedSolution /// Creates new site collection with information from administration object. /// Administration object. - private static SharePointSiteCollection NewSiteCollection(SPSite site) + private static SharePointEnterpriseSiteCollection NewSiteCollection(SPSite site) { var siteUri = new Uri(site.Url); string url = (siteUri.Port > 0) ? site.Url.Replace(String.Format(":{0}", siteUri.Port), String.Empty) : site.Url; - return new SharePointSiteCollection {Url = url, OwnerLogin = site.Owner.LoginName, OwnerName = site.Owner.Name, OwnerEmail = site.Owner.Email, LocaleId = site.RootWeb.Locale.LCID, Title = site.RootWeb.Title, Description = site.RootWeb.Description, Bandwidth = site.Usage.Bandwidth, Diskspace = site.Usage.Storage, MaxSiteStorage = site.Quota.StorageMaximumLevel, WarningStorage = site.Quota.StorageWarningLevel}; + return new SharePointEnterpriseSiteCollection {Url = url, OwnerLogin = site.Owner.LoginName, OwnerName = site.Owner.Name, OwnerEmail = site.Owner.Email, LocaleId = site.RootWeb.Locale.LCID, Title = site.RootWeb.Title, Description = site.RootWeb.Description, Bandwidth = site.Usage.Bandwidth, Diskspace = site.Usage.Storage, MaxSiteStorage = site.Quota.StorageMaximumLevel, WarningStorage = site.Quota.StorageWarningLevel}; } /// Gets SharePoint sites collection. @@ -716,7 +716,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Adds record to hosts file. /// The site collection object. - public void AddHostsRecord(SharePointSiteCollection siteCollection) + public void AddHostsRecord(SharePointEnterpriseSiteCollection siteCollection) { try { @@ -783,7 +783,7 @@ namespace WebsitePanel.Providers.HostedSolution /// Removes record from hosts file. /// The site collection object. - private void RemoveHostsRecord(SharePointSiteCollection siteCollection) + private void RemoveHostsRecord(SharePointEnterpriseSiteCollection siteCollection) { try { diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/HostedSharePointServerEntProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/HostedSharePointServerEntProxy.cs index bec63849..3b465943 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/HostedSharePointServerEntProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/HostedSharePointServerEntProxy.cs @@ -26,7 +26,6 @@ // (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. @@ -48,7 +47,6 @@ namespace WebsitePanel.Providers.HostedSolution { using System; using System.Diagnostics; using WebsitePanel.Providers.SharePoint; - /// @@ -173,9 +171,9 @@ namespace WebsitePanel.Providers.HostedSolution { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_GetSiteCollections", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollection[] Enterprise_GetSiteCollections() { + public SharePointEnterpriseSiteCollection[] Enterprise_GetSiteCollections() { object[] results = this.Invoke("Enterprise_GetSiteCollections", new object[0]); - return ((SharePointSiteCollection[])(results[0])); + return ((SharePointEnterpriseSiteCollection[])(results[0])); } /// @@ -184,9 +182,9 @@ namespace WebsitePanel.Providers.HostedSolution { } /// - public SharePointSiteCollection[] EndEnterprise_GetSiteCollections(System.IAsyncResult asyncResult) { + public SharePointEnterpriseSiteCollection[] EndEnterprise_GetSiteCollections(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); - return ((SharePointSiteCollection[])(results[0])); + return ((SharePointEnterpriseSiteCollection[])(results[0])); } /// @@ -212,10 +210,10 @@ namespace WebsitePanel.Providers.HostedSolution { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_GetSiteCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollection Enterprise_GetSiteCollection(string url) { + public SharePointEnterpriseSiteCollection Enterprise_GetSiteCollection(string url) { object[] results = this.Invoke("Enterprise_GetSiteCollection", new object[] { url}); - return ((SharePointSiteCollection)(results[0])); + return ((SharePointEnterpriseSiteCollection)(results[0])); } /// @@ -225,9 +223,9 @@ namespace WebsitePanel.Providers.HostedSolution { } /// - public SharePointSiteCollection EndEnterprise_GetSiteCollection(System.IAsyncResult asyncResult) { + public SharePointEnterpriseSiteCollection EndEnterprise_GetSiteCollection(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); - return ((SharePointSiteCollection)(results[0])); + return ((SharePointEnterpriseSiteCollection)(results[0])); } /// @@ -254,13 +252,13 @@ namespace WebsitePanel.Providers.HostedSolution { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_CreateSiteCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public void Enterprise_CreateSiteCollection(SharePointSiteCollection siteCollection) { + public void Enterprise_CreateSiteCollection(SharePointEnterpriseSiteCollection siteCollection) { this.Invoke("Enterprise_CreateSiteCollection", new object[] { siteCollection}); } /// - public System.IAsyncResult BeginEnterprise_CreateSiteCollection(SharePointSiteCollection siteCollection, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginEnterprise_CreateSiteCollection(SharePointEnterpriseSiteCollection siteCollection, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("Enterprise_CreateSiteCollection", new object[] { siteCollection}, callback, asyncState); } @@ -271,12 +269,12 @@ namespace WebsitePanel.Providers.HostedSolution { } /// - public void Enterprise_CreateSiteCollectionAsync(SharePointSiteCollection siteCollection) { + public void Enterprise_CreateSiteCollectionAsync(SharePointEnterpriseSiteCollection siteCollection) { this.Enterprise_CreateSiteCollectionAsync(siteCollection, null); } /// - public void Enterprise_CreateSiteCollectionAsync(SharePointSiteCollection siteCollection, object userState) { + public void Enterprise_CreateSiteCollectionAsync(SharePointEnterpriseSiteCollection siteCollection, object userState) { if ((this.Enterprise_CreateSiteCollectionOperationCompleted == null)) { this.Enterprise_CreateSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_CreateSiteCollectionOperationCompleted); } @@ -382,13 +380,13 @@ namespace WebsitePanel.Providers.HostedSolution { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_DeleteSiteCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public void Enterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection) { + public void Enterprise_DeleteSiteCollection(SharePointEnterpriseSiteCollection siteCollection) { this.Invoke("Enterprise_DeleteSiteCollection", new object[] { siteCollection}); } /// - public System.IAsyncResult BeginEnterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginEnterprise_DeleteSiteCollection(SharePointEnterpriseSiteCollection siteCollection, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("Enterprise_DeleteSiteCollection", new object[] { siteCollection}, callback, asyncState); } @@ -399,12 +397,12 @@ namespace WebsitePanel.Providers.HostedSolution { } /// - public void Enterprise_DeleteSiteCollectionAsync(SharePointSiteCollection siteCollection) { + public void Enterprise_DeleteSiteCollectionAsync(SharePointEnterpriseSiteCollection siteCollection) { this.Enterprise_DeleteSiteCollectionAsync(siteCollection, null); } /// - public void Enterprise_DeleteSiteCollectionAsync(SharePointSiteCollection siteCollection, object userState) { + public void Enterprise_DeleteSiteCollectionAsync(SharePointEnterpriseSiteCollection siteCollection, object userState) { if ((this.Enterprise_DeleteSiteCollectionOperationCompleted == null)) { this.Enterprise_DeleteSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_DeleteSiteCollectionOperationCompleted); } @@ -470,14 +468,14 @@ namespace WebsitePanel.Providers.HostedSolution { /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/Enterprise_RestoreSiteCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public void Enterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename) { + public void Enterprise_RestoreSiteCollection(SharePointEnterpriseSiteCollection siteCollection, string filename) { this.Invoke("Enterprise_RestoreSiteCollection", new object[] { siteCollection, filename}); } /// - public System.IAsyncResult BeginEnterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginEnterprise_RestoreSiteCollection(SharePointEnterpriseSiteCollection siteCollection, string filename, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("Enterprise_RestoreSiteCollection", new object[] { siteCollection, filename}, callback, asyncState); @@ -489,12 +487,12 @@ namespace WebsitePanel.Providers.HostedSolution { } /// - public void Enterprise_RestoreSiteCollectionAsync(SharePointSiteCollection siteCollection, string filename) { + public void Enterprise_RestoreSiteCollectionAsync(SharePointEnterpriseSiteCollection siteCollection, string filename) { this.Enterprise_RestoreSiteCollectionAsync(siteCollection, filename, null); } /// - public void Enterprise_RestoreSiteCollectionAsync(SharePointSiteCollection siteCollection, string filename, object userState) { + public void Enterprise_RestoreSiteCollectionAsync(SharePointEnterpriseSiteCollection siteCollection, string filename, object userState) { if ((this.Enterprise_RestoreSiteCollectionOperationCompleted == null)) { this.Enterprise_RestoreSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEnterprise_RestoreSiteCollectionOperationCompleted); } @@ -742,10 +740,10 @@ namespace WebsitePanel.Providers.HostedSolution { } /// - public SharePointSiteCollection[] Result { + public SharePointEnterpriseSiteCollection[] Result { get { this.RaiseExceptionIfNecessary(); - return ((SharePointSiteCollection[])(this.results[0])); + return ((SharePointEnterpriseSiteCollection[])(this.results[0])); } } } @@ -768,10 +766,10 @@ namespace WebsitePanel.Providers.HostedSolution { } /// - public SharePointSiteCollection Result { + public SharePointEnterpriseSiteCollection Result { get { this.RaiseExceptionIfNecessary(); - return ((SharePointSiteCollection)(this.results[0])); + return ((SharePointEnterpriseSiteCollection)(this.results[0])); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx.cs index 778e17c0..732ddf55 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/HostedSharePointServerEnt.asmx.cs @@ -76,9 +76,9 @@ namespace WebsitePanel.Server /// /// List of SharePoint collections within root web application. [WebMethod, SoapHeader("settings")] - public SharePointSiteCollection[] Enterprise_GetSiteCollections() + public SharePointEnterpriseSiteCollection[] Enterprise_GetSiteCollections() { - return ExecuteAction(delegate + return ExecuteAction(delegate { return HostedSharePointServerEntProvider.Enterprise_GetSiteCollections(); }, "GetSiteCollections"); @@ -90,9 +90,9 @@ namespace WebsitePanel.Server /// Url that uniquely identifies site collection to be loaded. /// SharePoint collection within root web application with given name. [WebMethod, SoapHeader("settings")] - public SharePointSiteCollection Enterprise_GetSiteCollection(string url) + public SharePointEnterpriseSiteCollection Enterprise_GetSiteCollection(string url) { - return ExecuteAction(delegate + return ExecuteAction(delegate { return HostedSharePointServerEntProvider.Enterprise_GetSiteCollection(url); }, "GetSiteCollection"); @@ -103,7 +103,7 @@ namespace WebsitePanel.Server /// /// Information about site coolection to be created. [WebMethod, SoapHeader("settings")] - public void Enterprise_CreateSiteCollection(SharePointSiteCollection siteCollection) + public void Enterprise_CreateSiteCollection(SharePointEnterpriseSiteCollection siteCollection) { siteCollection.OwnerLogin = AttachNetbiosDomainName(siteCollection.OwnerLogin); ExecuteAction(delegate @@ -143,7 +143,7 @@ namespace WebsitePanel.Server /// /// Url that uniquely identifies site collection to be deleted. [WebMethod, SoapHeader("settings")] - public void Enterprise_DeleteSiteCollection(SharePointSiteCollection siteCollection) + public void Enterprise_DeleteSiteCollection(SharePointEnterpriseSiteCollection siteCollection) { ExecuteAction(delegate { @@ -174,7 +174,7 @@ namespace WebsitePanel.Server /// Site collection to be restored. /// Backup file name to restore from. [WebMethod, SoapHeader("settings")] - public void Enterprise_RestoreSiteCollection(SharePointSiteCollection siteCollection, string filename) + public void Enterprise_RestoreSiteCollection(SharePointEnterpriseSiteCollection siteCollection, string filename) { siteCollection.OwnerLogin = AttachNetbiosDomainName(siteCollection.OwnerLogin); ExecuteAction(delegate diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index 1bd0de2e..7734d3d6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -542,20 +542,20 @@ - - - - - - + + + + + + - - - - - - + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEditSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEditSiteCollection.ascx.resx deleted file mode 100644 index 856828c3..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEditSiteCollection.ascx.resx +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Backup Site Collection - - - Cancel - - - ShowProgressDialog('Deleting SharePoint site collection...'); - - - Delete - - - Restore Site Collection - - - ShowProgressDialog('Updating SharePoint site collection...'); - - - Update - - - <p>Here you can create new SharePoint site collection. Choose URL from the list of domains you already own. Site URL like team.yourcompany.com should be added as domain in “Domain names” organization’s menu before SharePoint site collection creation.</p> - -<p><b>Site owner</b> is member of your organization who will be responsible for this SharePoint site collection administration: choosing site templates, adding other users, creating sub-sites.</p> - -<p><b>Locale ID</b> defines your site language and can not be changed after site creation. However child sub sites can use another Locale IDs.</p> - -<p>Title will be visible in site header.</p> - -<p><b>Description</b> will be visible when you open site on the top of the main site page.</p> - -<p>After you create this site open it using owner login, and do at least 2 main steps: -1. Choose site template -2. Define who will be able to access this site. To add user from your hosted organization to SharePoint site, please copy/paste his or her e-mail from user's properties in WebsitePanel to SharePoint site collection’s Users/Groups field.</p> - - - Email - - - User Name - - - Description: - - - Locale ID: - - - Owner: - - - Url: - - - Title: - - - Send warning E-mail when site storage reaches (MB): - - - Full list of locales - - - SharePoint Site Collection - - - SharePoint Site Collection Tools - - - Add Site Collection - - - Edit SharePoint Site Collection - - - Update - - - Maximum site storage size (MB): - - - Do not send - - - ShowProgressDialog('Creating SharePoint site collection...'); - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseBackupSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseBackupSiteCollection.ascx.resx deleted file mode 100644 index c931ca06..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseBackupSiteCollection.ascx.resx +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Backup - - - Cancel - - - ZIP Backup - - - <p>The backup file that you create includes list or library content, security settings, user information, navigation, customizations, and personalizations (such as views, site templates, and content types). The backup file does not include workflows, alerts, and properties stored at the site collection level.</p> - - - Backup Destination: - - - Backup File Name: - - - Backup Options: - - - Backup SharePoint Site Collection - - - Copy to Folder - - - Download via HTTP - - - Backup SharePoint Site Collection - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseEditSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseEditSiteCollection.ascx.resx deleted file mode 100644 index 856828c3..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseEditSiteCollection.ascx.resx +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Backup Site Collection - - - Cancel - - - ShowProgressDialog('Deleting SharePoint site collection...'); - - - Delete - - - Restore Site Collection - - - ShowProgressDialog('Updating SharePoint site collection...'); - - - Update - - - <p>Here you can create new SharePoint site collection. Choose URL from the list of domains you already own. Site URL like team.yourcompany.com should be added as domain in “Domain names” organization’s menu before SharePoint site collection creation.</p> - -<p><b>Site owner</b> is member of your organization who will be responsible for this SharePoint site collection administration: choosing site templates, adding other users, creating sub-sites.</p> - -<p><b>Locale ID</b> defines your site language and can not be changed after site creation. However child sub sites can use another Locale IDs.</p> - -<p>Title will be visible in site header.</p> - -<p><b>Description</b> will be visible when you open site on the top of the main site page.</p> - -<p>After you create this site open it using owner login, and do at least 2 main steps: -1. Choose site template -2. Define who will be able to access this site. To add user from your hosted organization to SharePoint site, please copy/paste his or her e-mail from user's properties in WebsitePanel to SharePoint site collection’s Users/Groups field.</p> - - - Email - - - User Name - - - Description: - - - Locale ID: - - - Owner: - - - Url: - - - Title: - - - Send warning E-mail when site storage reaches (MB): - - - Full list of locales - - - SharePoint Site Collection - - - SharePoint Site Collection Tools - - - Add Site Collection - - - Edit SharePoint Site Collection - - - Update - - - Maximum site storage size (MB): - - - Do not send - - - ShowProgressDialog('Creating SharePoint site collection...'); - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseRestoreSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseRestoreSiteCollection.ascx.resx deleted file mode 100644 index 06164c47..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseRestoreSiteCollection.ascx.resx +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Cancel - - - ShowProgressDialog('Restoring SharePoint site collection...'); - - - Restore - - - <p>After site collection is restored it will have primary administrator assigned to it as it was before restoration (primary administrator record from backup is ignored).</p> - - - .ZIP, .BAK files are allowed - - - Restore From: - - - Restore SharePoint Site Collection - - - Hosting Space File - - - Uploaded File - - - Restore SharePoint Site Collection - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseSiteCollections.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseSiteCollections.ascx.resx deleted file mode 100644 index 224fd542..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseSiteCollections.ascx.resx +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Add SharePoint Enterprise Site Collection - - - Create New Site Collection - - - Delete - - - Url - - - <p><b>SharePoint site collection</b> is a group of sites built on Microsoft Windows SharePoint Services that all exist under a top-level site. To make managing the sites and their content more convenient, you can assign users to be site collection administrators or site collection owners. These are permission levels to give to users who you want to have full administrative rights to all sites and content within a site collection.</p> - - - Owner - - - No SharePoint site collections have been created. To create a SharePoint site collection click "Create New Site Collection" button. - - - Site Collection Url - - - Total Site Collections Created: - - - SharePoint Enterprise Site Collections - - - SharePoint Enterprise Site Collections - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageSettings.ascx.resx deleted file mode 100644 index 062e04df..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageSettings.ascx.resx +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Save - - - Save and Apply to All Site Collections - - - <p>Storage settings are used to limit the amount of storage available on a SharePoint site collection, and they are used to send e-mail alerts to the site administrator when a specified value of space is used.</p> - -<p>These settings will be applied to the new site collections only. By clicking "Save and Apply to All Site Collections" button you can override these settings for all existing site collections.</p> - -<p>Please note, that you cannot specify storage settings higher than defined in the space hosting plan.</p> - - - Maximum site storage size (MB): - - - Send warning E-mail when site storage reaches (MB): - - - Storage Settings - - - Storage Settings - - - Storage Settings - - - Don't use - - - Do not send - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageUsage.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageUsage.ascx.resx deleted file mode 100644 index b945ab03..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointEnterpriseStorageUsage.ascx.resx +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Recalculate Disk Space - - - <p>SharePoint disk space usage is calculated on timely basis (usually once a day). You can recalculate it right now by clicking "Recalculate Disk Space" button.</p> - - - Site Collection - - - Total Size, MB - - - There are no site collections - - - Storage Usage - - - Site Collections - - - Storage Usage - - - Total Size (MB): - - - Total Items: - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointRestoreSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointRestoreSiteCollection.ascx.resx deleted file mode 100644 index 06164c47..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointRestoreSiteCollection.ascx.resx +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Cancel - - - ShowProgressDialog('Restoring SharePoint site collection...'); - - - Restore - - - <p>After site collection is restored it will have primary administrator assigned to it as it was before restoration (primary administrator record from backup is ignored).</p> - - - .ZIP, .BAK files are allowed - - - Restore From: - - - Restore SharePoint Site Collection - - - Hosting Space File - - - Uploaded File - - - Restore SharePoint Site Collection - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointSiteCollections.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointSiteCollections.ascx.resx deleted file mode 100644 index 44c0004a..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointSiteCollections.ascx.resx +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Add SharePoint Site Collection - - - Create New Site Collection - - - Delete - - - Url - - - <p><b>SharePoint site collection</b> is a group of sites built on Microsoft Windows SharePoint Services that all exist under a top-level site. To make managing the sites and their content more convenient, you can assign users to be site collection administrators or site collection owners. These are permission levels to give to users who you want to have full administrative rights to all sites and content within a site collection.</p> - - - Owner - - - No SharePoint site collections have been created. To create a SharePoint site collection click "Create New Site Collection" button. - - - Site Collection Url - - - Total Site Collections Created: - - - SharePoint Site Collections - - - SharePoint Site Collections - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointStorageSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointStorageSettings.ascx.resx deleted file mode 100644 index 062e04df..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointStorageSettings.ascx.resx +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Save - - - Save and Apply to All Site Collections - - - <p>Storage settings are used to limit the amount of storage available on a SharePoint site collection, and they are used to send e-mail alerts to the site administrator when a specified value of space is used.</p> - -<p>These settings will be applied to the new site collections only. By clicking "Save and Apply to All Site Collections" button you can override these settings for all existing site collections.</p> - -<p>Please note, that you cannot specify storage settings higher than defined in the space hosting plan.</p> - - - Maximum site storage size (MB): - - - Send warning E-mail when site storage reaches (MB): - - - Storage Settings - - - Storage Settings - - - Storage Settings - - - Don't use - - - Do not send - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointStorageUsage.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointStorageUsage.ascx.resx deleted file mode 100644 index b945ab03..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointStorageUsage.ascx.resx +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Recalculate Disk Space - - - <p>SharePoint disk space usage is calculated on timely basis (usually once a day). You can recalculate it right now by clicking "Recalculate Disk Space" button.</p> - - - Site Collection - - - Total Size, MB - - - There are no site collections - - - Storage Usage - - - Site Collections - - - Storage Usage - - - Total Size (MB): - - - Total Items: - - \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx index fc627511..a03b66d5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx @@ -181,7 +181,7 @@ OCS Users: - Sharepoint Sites: + SharePoint Foundation Sites: User Accounts: @@ -210,4 +210,7 @@ Deleted Users: + + SharePoint Enterprise Sites: + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointEnterpriseSiteCollectionsHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointEnterpriseSiteCollectionsHelper.cs index cd46de49..5ed1105a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointEnterpriseSiteCollectionsHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointEnterpriseSiteCollectionsHelper.cs @@ -42,14 +42,16 @@ namespace WebsitePanel.Portal { public class HostedSharePointEnterpriseSiteCollectionsHelper { - SharePointSiteCollectionListPaged result; + SharePointEnterpriseSiteCollectionListPaged result; - public int GetSharePointSiteCollectionPagedCount(int packageId, int organizationId, string filterColumn, string filterValue) + public int GetSharePointEnterpriseSiteCollectionPagedCount(int packageId, int organizationId, string filterColumn, string filterValue) { return result.TotalRowCount; } - public List GetSharePointSiteCollectionPaged(int packageId, int organizationId, string filterColumn, string filterValue, int maximumRows, int startRowIndex, string sortColumn) + + + public List GetSharePointEnterpriseSiteCollectionPaged(int packageId, int organizationId, string filterColumn, string filterValue, int maximumRows, int startRowIndex, string sortColumn) { if (!String.IsNullOrEmpty(filterValue)) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointBackupSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointBackupSiteCollection.ascx.resx similarity index 100% rename from WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/HostedSharePointBackupSiteCollection.ascx.resx rename to WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointBackupSiteCollection.ascx.resx diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx deleted file mode 100644 index 6ee199ec..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx +++ /dev/null @@ -1,80 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointBackupSiteCollection.ascx.cs" - Inherits="WebsitePanel.Portal.HostedSharePointBackupSiteCollection" %> -<%@ Register Src="UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> - -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> - - - - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - - - - - - - - - - -
-
-  
- -
- - -
-
-
- - -
- -
-      -
-
- - -
-
-
-
-
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs deleted file mode 100644 index 5e1afb37..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs +++ /dev/null @@ -1,189 +0,0 @@ -// 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.Collections; -using System.IO; -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.SharePoint; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointBackupSiteCollection : WebsitePanelModuleBase - { - private const string BACKUP_EXTENSION = ".bsh"; - - private int OrganizationId - { - get - { - return PanelRequest.GetInt("ItemID"); - } - } - - private int SiteCollectionId - { - get - { - return PanelRequest.GetInt("SiteCollectionID"); - } - } - - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - BindSite(); - } - } - - private void BindSite() - { - try - { - SharePointSiteCollection siteCollection = ES.Services.HostedSharePointServers.GetSiteCollection(this.SiteCollectionId); - litSiteCollectionName.Text = siteCollection.PhysicalAddress; - txtBackupName.Text = siteCollection.Url + BACKUP_EXTENSION; - fileLookup.SelectedFile = "\\"; - fileLookup.PackageId = siteCollection.PackageId; - - BindBackupName(); - ToggleControls(); - } - catch (Exception ex) - { - ShowErrorMessage("SHAREPOINT_GET_SITE", ex); - return; - } - } - - private void BindBackupName() - { - string backupName = Path.GetFileNameWithoutExtension(txtBackupName.Text); - txtBackupName.Text = backupName + (chkZipBackup.Checked ? ".zip" : BACKUP_EXTENSION); - } - - private void ToggleControls() - { - fileLookup.Visible = rbCopy.Checked; - } - - private void BackupSiteCollection() - { - try - { - string bakFile = ES.Services.HostedSharePointServers.BackupSiteCollection(this.SiteCollectionId, - txtBackupName.Text, chkZipBackup.Checked, rbDownload.Checked, fileLookup.SelectedFile); - - if (rbDownload.Checked && !String.IsNullOrEmpty(bakFile)) - { - - string fileName = bakFile; - - //Response.Clear(); - Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(fileName)); - Response.ContentType = "application/octet-stream"; - - int FILE_BUFFER_LENGTH = 5000000; - byte[] buffer = null; - int offset = 0; - do - { - // Read remote content. - buffer = ES.Services.HostedSharePointServers.GetBackupBinaryChunk(this.SiteCollectionId, fileName, offset, FILE_BUFFER_LENGTH); - - // Write to stream. - //Response.BinaryWrite(buffer); - Response.OutputStream.Write(buffer, 0, buffer.Length); - offset += FILE_BUFFER_LENGTH; - } - while (buffer.Length == FILE_BUFFER_LENGTH); - - Response.Flush(); - Response.End(); - //Response.Close(); - //HttpContext.Current.ApplicationInstance.CompleteRequest(); - //Response.End(); - - } - } - catch (Exception ex) - { - ShowErrorMessage("SHAREPOINT_BACKUP_SITE", ex); - return; - } - //Response.ClearContent(); - Context.Response.Clear(); - if (!rbDownload.Checked) - RedirectBack(); - - } - - protected void btnBackup_Click(object sender, EventArgs e) - { - BackupSiteCollection(); - } - protected void btnCancel_Click(object sender, EventArgs e) - { - RedirectBack(); - } - - private void RedirectBack() - { - HttpContext.Current.Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); - } - - protected void chkZipBackup_CheckedChanged(object sender, EventArgs e) - { - BindBackupName(); - } - - protected void rbDownload_CheckedChanged(object sender, EventArgs e) - { - ToggleControls(); - } - - protected override void OnPreRender(EventArgs e) - { - string str = string.Format("var rb = document.getElementById('{0}'); if (!rb.checked) ShowProgressDialog('Backing up site collection...');", rbDownload.ClientID); - - - - btnBackup.Attributes.Add("onclick", str); - base.OnPreRender(e); - } - - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs deleted file mode 100644 index 6bd4aa9e..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.designer.cs +++ /dev/null @@ -1,159 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointBackupSiteCollection { - - /// - /// asyncTasks control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// litSiteCollectionName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litSiteCollectionName; - - /// - /// lblBackupFileName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblBackupFileName; - - /// - /// txtBackupName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtBackupName; - - /// - /// validatorUserName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator validatorUserName; - - /// - /// lblBackupOptions control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblBackupOptions; - - /// - /// chkZipBackup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox chkZipBackup; - - /// - /// lblBackupDestination control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblBackupDestination; - - /// - /// rbDownload control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RadioButton rbDownload; - - /// - /// rbCopy control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RadioButton rbCopy; - - /// - /// fileLookup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.FileLookup fileLookup; - - /// - /// btnBackup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnBackup; - - /// - /// btnCancel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnCancel; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx deleted file mode 100644 index 5a219436..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx +++ /dev/null @@ -1,209 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEditSiteCollection.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointEditSiteCollection" %> -<%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> -<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> -<%@ Register Src="UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> -<%@ Register Src="UserControls/AllocatePackageIPAddresses.ascx" TagName="SiteUrlBuilder" TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/UserSelector.ascx" TagName="UserSelector" TagPrefix="wsp" %> -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> -<%@ Register src="UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> -<%@ Register Src="DomainsSelectDomainControl.ascx" TagName="DomainsSelectDomainControl" TagPrefix="uc1" %> - - - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - . - - -
- - - -
- - - -
- - - - -
- - - -
- - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - -
- - - -
- - - - -
- - - -
- - - -
- - - -
- - - - -
- - - - - - - - - - -
- -
- -
-
-
-
- - - -
-
-
-
-
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs deleted file mode 100644 index 1c150ca9..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs +++ /dev/null @@ -1,450 +0,0 @@ -// 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.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Web; -using System.Web.UI.WebControls; -using WebsitePanel.EnterpriseServer; -using WebsitePanel.Providers.DNS; -using WebsitePanel.Providers.HostedSolution; -using WebsitePanel.Providers.SharePoint; - - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointEditSiteCollection : WebsitePanelModuleBase - { - SharePointSiteCollection item = null; - - private int OrganizationId - { - get - { - return PanelRequest.GetInt("ItemID"); - } - } - - private int SiteCollectionId - { - get - { - return PanelRequest.GetInt("SiteCollectionID"); - } - } - - protected void Page_Load(object sender, EventArgs e) - { - domain.PackageId = PanelSecurity.PackageId; - - warningStorage.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); - editWarningStorage.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); - - bool newItem = (this.SiteCollectionId == 0); - - tblEditItem.Visible = newItem; - tblViewItem.Visible = !newItem; - - //btnUpdate.Visible = newItem; - btnDelete.Visible = !newItem; - btnUpdate.Text = newItem ? GetLocalizedString("Text.Add") : GetLocalizedString("Text.Update"); - btnUpdate.OnClientClick = newItem ? GetLocalizedString("btnCreate.OnClientClick") : GetLocalizedString("btnUpdate.OnClientClick"); - - btnBackup.Enabled = btnRestore.Enabled = !newItem; - - // bind item - BindItem(); - - } - - private void BindItem() - { - try - { - if (!IsPostBack) - { - if (!this.IsDnsServiceAvailable()) - { - localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_DNS"); - } - - // load item if required - if (this.SiteCollectionId > 0) - { - // existing item - item = ES.Services.HostedSharePointServers.GetSiteCollection(this.SiteCollectionId); - if (item != null) - { - // save package info - ViewState["PackageId"] = item.PackageId; - } - else - RedirectToBrowsePage(); - } - else - { - // new item - ViewState["PackageId"] = PanelSecurity.PackageId; - if (UseSharedSLL(PanelSecurity.PackageId)) - { - - rowUrl.Visible = false; - valRequireHostName.Enabled = false; - valRequireCorrectHostName.Enabled = false; - } - } - - //this.gvUsers.DataBind(); - - List cultures = new List(); - foreach (int localeId in ES.Services.HostedSharePointServers.GetSupportedLanguages(PanelSecurity.PackageId)) - { - cultures.Add(new CultureInfo(localeId, false)); - } - - this.ddlLocaleID.DataSource = cultures; - this.ddlLocaleID.DataBind(); - } - - if (!IsPostBack) - { - // bind item to controls - if (item != null) - { - // bind item to controls - lnkUrl.Text = item.PhysicalAddress; - lnkUrl.NavigateUrl = item.PhysicalAddress; - litSiteCollectionOwner.Text = String.Format("{0} ({1})", item.OwnerName, item.OwnerEmail); - litLocaleID.Text = new CultureInfo(item.LocaleId, false).DisplayName; - litTitle.Text = item.Title; - litDescription.Text = item.Description; - editWarningStorage.QuotaValue = (int)item.WarningStorage; - editMaxStorage.QuotaValue = (int)item.MaxSiteStorage; - } - - Organization org = ES.Services.Organizations.GetOrganization(OrganizationId); - - if (org != null) - { - SetStorageQuotas(org, item); - } - } - //OrganizationDomainName[] domains = ES.Services.Organizations.GetOrganizationDomains(PanelRequest.ItemID); - - //DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId); - - EnterpriseServer.DomainInfo[] domains = ES.Services.Servers.GetDomains(PanelSecurity.PackageId); - - if (domains.Length == 0) - { - localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_DOMAINS"); - DisableFormControls(this, btnCancel); - return; - } - //if (this.gvUsers.Rows.Count == 0) - //{ - // localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_USERS"); - // DisableFormControls(this, btnCancel); - // return; - //} - } - catch - { - - localMessageBox.ShowWarningMessage("INIT_SERVICE_ITEM_FORM"); - - DisableFormControls(this, btnCancel); - return; - } - } - - /// Checks and sets disk quotas values. - /// The organization. - /// The site collection. - private void SetStorageQuotas(Organization organization, SharePointSiteCollection collection) - { - var quotaValue = organization.MaxSharePointStorage; - - if (quotaValue != -1) - { - var spaceResrved = GetReservedDiskStorageSpace(); - - if (spaceResrved > quotaValue) - { - quotaValue = 0; - } - else - { - quotaValue -= spaceResrved; - } - - if (collection != null) - { - quotaValue += (int)collection.MaxSiteStorage; - } - } - - maxStorage.ParentQuotaValue = quotaValue; - maxStorage.QuotaValue = quotaValue; - editMaxStorage.ParentQuotaValue = quotaValue; - warningStorage.ParentQuotaValue = quotaValue; - warningStorage.QuotaValue = quotaValue; - editWarningStorage.ParentQuotaValue = quotaValue; - - btnUpdate.Enabled = quotaValue != 0; - } - - /// Gets disk space reserved by existing site collections. - /// Reserved disk space vallue. - private int GetReservedDiskStorageSpace() - { - var existingCollections = ES.Services.HostedSharePointServers.GetSiteCollections(PanelSecurity.PackageId, false); - - return (int)existingCollections.Sum(siteCollection => siteCollection.MaxSiteStorage); - } - - private void SaveItem() - { - if (!Page.IsValid) - { - return; - } - - - if (this.SiteCollectionId == 0) - { - if (this.userSelector.GetAccount() == null) - { - localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_USERS"); - return; - } - - - // new item - try - { - item = new SharePointSiteCollection(); - - if (!UseSharedSLL(PanelSecurity.PackageId)) - { - SharePointSiteCollectionListPaged existentSiteCollections = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(PanelSecurity.PackageId, this.OrganizationId, "ItemName", String.Format("%{0}", this.domain.DomainName), String.Empty, 0, Int32.MaxValue); - foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) - { - Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); - if (existentSiteCollection.Name == String.Format("{0}://{1}", existentSiteCollectionUri.Scheme, this.txtHostName.Text.ToLower() + "." + this.domain.DomainName)) - { - localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_DOMAIN_IN_USE"); - return; - } - } - - item.Name = this.txtHostName.Text.ToLower() + "." + this.domain.DomainName; - } - else - item.Name = string.Empty; - - // get form data - - item.OrganizationId = this.OrganizationId; - item.Id = this.SiteCollectionId; - item.PackageId = PanelSecurity.PackageId; - - item.LocaleId = Int32.Parse(this.ddlLocaleID.SelectedValue); - item.OwnerLogin = this.userSelector.GetSAMAccountName(); - item.OwnerEmail = this.userSelector.GetPrimaryEmailAddress(); - item.OwnerName = this.userSelector.GetDisplayName(); - item.Title = txtTitle.Text; - item.Description = txtDescription.Text; - - - item.MaxSiteStorage = maxStorage.QuotaValue; - item.WarningStorage = warningStorage.QuotaValue; - - int result = ES.Services.HostedSharePointServers.AddSiteCollection(item); - if (result < 0) - { - localMessageBox.ShowResultMessage(result); - return; - } - } - catch (Exception ex) - { - localMessageBox.ShowErrorMessage("HOSTEDSHAREPOINT_ADD_SITECOLLECTION", ex); - return; - } - } - else - { - ES.Services.HostedSharePointServers.UpdateQuota(PanelRequest.ItemID, SiteCollectionId, editMaxStorage.QuotaValue, editWarningStorage.QuotaValue); - } - - // return - RedirectToSiteCollectionsList(); - } - - private void AddDnsRecord(int domainId, string recordName, string recordData) - { - int result = ES.Services.Servers.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, recordData, 0, 0, 0, 0); - if (result < 0) - { - ShowResultMessage(result); - } - } - - private bool IsDnsServiceAvailable() - { - ProviderInfo dnsProvider = ES.Services.Servers.GetPackageServiceProvider(PanelSecurity.PackageId, ResourceGroups.Dns); - return dnsProvider != null; - } - - private void DeleteItem() - { - // delete - try - { - int result = ES.Services.HostedSharePointServers.DeleteSiteCollection(this.SiteCollectionId); - if (result < 0) - { - ShowResultMessage(result); - return; - } - } - catch (Exception ex) - { - localMessageBox.ShowErrorMessage("HOSTEDSHAREPOINT_DELETE_SITECOLLECTION", ex); - return; - } - - // return - RedirectToSiteCollectionsList(); - } - - protected void odsAccountsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) - { - if (e.Exception != null) - { - localMessageBox.ShowErrorMessage("ORGANIZATION_GET_USERS", e.Exception); - e.ExceptionHandled = true; - } - } - - - protected void btnCancel_Click(object sender, EventArgs e) - { - // return - RedirectToSiteCollectionsList(); - } - - protected void btnDelete_Click(object sender, EventArgs e) - { - DeleteItem(); - } - - protected void btnUpdate_Click(object sender, EventArgs e) - { - SaveItem(); - } - - protected void btnBackup_Click(object sender, EventArgs e) - { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_backup_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); - } - - protected void btnRestore_Click(object sender, EventArgs e) - { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_restore_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); - } - - - - private void RedirectToSiteCollectionsList() - { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_sitecollections", "ItemID=" + PanelRequest.ItemID.ToString())); - } - - private bool UseSharedSLL(int packageID) - { - PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); - if (cntx != null) - { - foreach (QuotaValueInfo quota in cntx.QuotasArray) - { - switch (quota.QuotaId) - { - case 400: - if (Convert.ToBoolean(quota.QuotaAllocatedValue)) - { - return true; - } - - break; - } - } - } - - return false; - } - - - //private void RegisterOwnerSelector() - //{ - // // Define the name and type of the client scripts on the page. - // String csname = "OwnerSelectorScript"; - // Type cstype = this.GetType(); - - // // Get a ClientScriptManager reference from the Page class. - // ClientScriptManager cs = Page.ClientScript; - - // // Check to see if the client script is already registered. - // if (!cs.IsClientScriptBlockRegistered(cstype, csname)) - // { - // StringBuilder ownerSelector = new StringBuilder(); - // ownerSelector.Append(""); - // cs.RegisterClientScriptBlock(cstype, csname, ownerSelector.ToString(), false); - // } - - //} - - //private StringDictionary ConvertArrayToDictionary(string[] settings) - //{ - // StringDictionary r = new StringDictionary(); - // foreach (string setting in settings) - // { - // int idx = setting.IndexOf('='); - // r.Add(setting.Substring(0, idx), setting.Substring(idx + 1)); - // } - // return r; - //} - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs deleted file mode 100644 index 6801e4b1..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.designer.cs +++ /dev/null @@ -1,447 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointEditSiteCollection { - - /// - /// asyncTasks control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// localMessageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox localMessageBox; - - /// - /// tblEditItem control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTable tblEditItem; - - /// - /// rowUrl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTableRow rowUrl; - - /// - /// lblSiteCollectionUrl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionUrl; - - /// - /// txtHostName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtHostName; - - /// - /// domain control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.DomainsSelectDomainControl domain; - - /// - /// valRequireHostName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireHostName; - - /// - /// valRequireCorrectHostName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectHostName; - - /// - /// lblSiteCollectionOwner control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionOwner; - - /// - /// userSelector control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.UserSelector userSelector; - - /// - /// lblSiteCollectionLocaleID control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionLocaleID; - - /// - /// ddlLocaleID control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList ddlLocaleID; - - /// - /// lblMaxStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblMaxStorage; - - /// - /// maxStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor maxStorage; - - /// - /// lblWarningStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblWarningStorage; - - /// - /// warningStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor warningStorage; - - /// - /// lblTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTitle; - - /// - /// txtTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtTitle; - - /// - /// valRequireTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireTitle; - - /// - /// lblDescription control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblDescription; - - /// - /// txtDescription control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtDescription; - - /// - /// RequiredFieldValidator1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; - - /// - /// tblViewItem control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTable tblViewItem; - - /// - /// lblSiteCollectionUrl2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionUrl2; - - /// - /// lnkUrl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.HyperLink lnkUrl; - - /// - /// lblSiteCollectionOwner2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionOwner2; - - /// - /// litSiteCollectionOwner control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litSiteCollectionOwner; - - /// - /// lblSiteCollectionLocaleID2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionLocaleID2; - - /// - /// litLocaleID control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litLocaleID; - - /// - /// lblMaxStorageView control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblMaxStorageView; - - /// - /// editMaxStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor editMaxStorage; - - /// - /// lblWarningStorageView control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblWarningStorageView; - - /// - /// editWarningStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor editWarningStorage; - - /// - /// lblTitle2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTitle2; - - /// - /// litTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litTitle; - - /// - /// lblDescription2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblDescription2; - - /// - /// litDescription control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litDescription; - - /// - /// secMainTools control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secMainTools; - - /// - /// ToolsPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel ToolsPanel; - - /// - /// tblMaintenance control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTable tblMaintenance; - - /// - /// btnBackup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnBackup; - - /// - /// btnRestore control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnRestore; - - /// - /// btnUpdate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnUpdate; - - /// - /// btnCancel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnCancel; - - /// - /// btnDelete control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnDelete; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx deleted file mode 100644 index 4b315bc8..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx +++ /dev/null @@ -1,80 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEnterpriseBackupSiteCollection.ascx.cs" - Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseBackupSiteCollection" %> -<%@ Register Src="UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> - -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> - - - - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - - - - - - - - - - -
-
-  
- -
- - -
-
-
- - -
- -
-      -
-
- - -
-
-
-
-
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.cs deleted file mode 100644 index e5a59c73..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.cs +++ /dev/null @@ -1,189 +0,0 @@ -// 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.Collections; -using System.IO; -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.SharePoint; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointEnterpriseBackupSiteCollection : WebsitePanelModuleBase - { - private const string BACKUP_EXTENSION = ".bsh"; - - private int OrganizationId - { - get - { - return PanelRequest.GetInt("ItemID"); - } - } - - private int SiteCollectionId - { - get - { - return PanelRequest.GetInt("SiteCollectionID"); - } - } - - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - BindSite(); - } - } - - private void BindSite() - { - try - { - SharePointSiteCollection siteCollection = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollection(this.SiteCollectionId); - litSiteCollectionName.Text = siteCollection.PhysicalAddress; - txtBackupName.Text = siteCollection.Url + BACKUP_EXTENSION; - fileLookup.SelectedFile = "\\"; - fileLookup.PackageId = siteCollection.PackageId; - - BindBackupName(); - ToggleControls(); - } - catch (Exception ex) - { - ShowErrorMessage("SHAREPOINT_GET_SITE", ex); - return; - } - } - - private void BindBackupName() - { - string backupName = Path.GetFileNameWithoutExtension(txtBackupName.Text); - txtBackupName.Text = backupName + (chkZipBackup.Checked ? ".zip" : BACKUP_EXTENSION); - } - - private void ToggleControls() - { - fileLookup.Visible = rbCopy.Checked; - } - - private void BackupSiteCollection() - { - try - { - string bakFile = ES.Services.HostedSharePointServersEnt.Enterprise_BackupSiteCollection(this.SiteCollectionId, - txtBackupName.Text, chkZipBackup.Checked, rbDownload.Checked, fileLookup.SelectedFile); - - if (rbDownload.Checked && !String.IsNullOrEmpty(bakFile)) - { - - string fileName = bakFile; - - //Response.Clear(); - Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(fileName)); - Response.ContentType = "application/octet-stream"; - - int FILE_BUFFER_LENGTH = 5000000; - byte[] buffer = null; - int offset = 0; - do - { - // Read remote content. - buffer = ES.Services.HostedSharePointServersEnt.Enterprise_GetBackupBinaryChunk(this.SiteCollectionId, fileName, offset, FILE_BUFFER_LENGTH); - - // Write to stream. - //Response.BinaryWrite(buffer); - Response.OutputStream.Write(buffer, 0, buffer.Length); - offset += FILE_BUFFER_LENGTH; - } - while (buffer.Length == FILE_BUFFER_LENGTH); - - Response.Flush(); - Response.End(); - //Response.Close(); - //HttpContext.Current.ApplicationInstance.CompleteRequest(); - //Response.End(); - - } - } - catch (Exception ex) - { - ShowErrorMessage("SHAREPOINT_BACKUP_SITE", ex); - return; - } - //Response.ClearContent(); - Context.Response.Clear(); - if (!rbDownload.Checked) - RedirectBack(); - - } - - protected void btnBackup_Click(object sender, EventArgs e) - { - BackupSiteCollection(); - } - protected void btnCancel_Click(object sender, EventArgs e) - { - RedirectBack(); - } - - private void RedirectBack() - { - HttpContext.Current.Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); - } - - protected void chkZipBackup_CheckedChanged(object sender, EventArgs e) - { - BindBackupName(); - } - - protected void rbDownload_CheckedChanged(object sender, EventArgs e) - { - ToggleControls(); - } - - protected override void OnPreRender(EventArgs e) - { - string str = string.Format("var rb = document.getElementById('{0}'); if (!rb.checked) ShowProgressDialog('Backing up site collection...');", rbDownload.ClientID); - - - - btnBackup.Attributes.Add("onclick", str); - base.OnPreRender(e); - } - - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.designer.cs deleted file mode 100644 index b74025b4..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseBackupSiteCollection.ascx.designer.cs +++ /dev/null @@ -1,159 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointEnterpriseBackupSiteCollection { - - /// - /// asyncTasks control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// litSiteCollectionName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litSiteCollectionName; - - /// - /// lblBackupFileName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblBackupFileName; - - /// - /// txtBackupName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtBackupName; - - /// - /// validatorUserName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator validatorUserName; - - /// - /// lblBackupOptions control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblBackupOptions; - - /// - /// chkZipBackup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox chkZipBackup; - - /// - /// lblBackupDestination control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblBackupDestination; - - /// - /// rbDownload control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RadioButton rbDownload; - - /// - /// rbCopy control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RadioButton rbCopy; - - /// - /// fileLookup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.FileLookup fileLookup; - - /// - /// btnBackup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnBackup; - - /// - /// btnCancel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnCancel; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx deleted file mode 100644 index cd1a07f8..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx +++ /dev/null @@ -1,209 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEnterpriseEditSiteCollection.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseEditSiteCollection" %> -<%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> -<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> -<%@ Register Src="UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> -<%@ Register Src="UserControls/AllocatePackageIPAddresses.ascx" TagName="SiteUrlBuilder" TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/UserSelector.ascx" TagName="UserSelector" TagPrefix="wsp" %> -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> -<%@ Register src="UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> -<%@ Register Src="DomainsSelectDomainControl.ascx" TagName="DomainsSelectDomainControl" TagPrefix="uc1" %> - - - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - . - - -
- - - -
- - - -
- - - - -
- - - -
- - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - -
- - - -
- - - - -
- - - -
- - - -
- - - -
- - - - -
- - - - - - - - - - -
- -
- -
-
-
-
- - - -
-
-
-
-
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.cs deleted file mode 100644 index eae4b2ab..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.cs +++ /dev/null @@ -1,450 +0,0 @@ -// 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.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Web; -using System.Web.UI.WebControls; -using WebsitePanel.EnterpriseServer; -using WebsitePanel.Providers.DNS; -using WebsitePanel.Providers.HostedSolution; -using WebsitePanel.Providers.SharePoint; - - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointEnterpriseEditSiteCollection : WebsitePanelModuleBase - { - SharePointSiteCollection item = null; - - private int OrganizationId - { - get - { - return PanelRequest.GetInt("ItemID"); - } - } - - private int SiteCollectionId - { - get - { - return PanelRequest.GetInt("SiteCollectionID"); - } - } - - protected void Page_Load(object sender, EventArgs e) - { - domain.PackageId = PanelSecurity.PackageId; - - warningStorage.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); - editWarningStorage.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); - - bool newItem = (this.SiteCollectionId == 0); - - tblEditItem.Visible = newItem; - tblViewItem.Visible = !newItem; - - //btnUpdate.Visible = newItem; - btnDelete.Visible = !newItem; - btnUpdate.Text = newItem ? GetLocalizedString("Text.Add") : GetLocalizedString("Text.Update"); - btnUpdate.OnClientClick = newItem ? GetLocalizedString("btnCreate.OnClientClick") : GetLocalizedString("btnUpdate.OnClientClick"); - - btnBackup.Enabled = btnRestore.Enabled = !newItem; - - // bind item - BindItem(); - - } - - private void BindItem() - { - try - { - if (!IsPostBack) - { - if (!this.IsDnsServiceAvailable()) - { - localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_DNS"); - } - - // load item if required - if (this.SiteCollectionId > 0) - { - // existing item - item = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollection(this.SiteCollectionId); - if (item != null) - { - // save package info - ViewState["PackageId"] = item.PackageId; - } - else - RedirectToBrowsePage(); - } - else - { - // new item - ViewState["PackageId"] = PanelSecurity.PackageId; - if (UseSharedSLL(PanelSecurity.PackageId)) - { - - rowUrl.Visible = false; - valRequireHostName.Enabled = false; - valRequireCorrectHostName.Enabled = false; - } - } - - //this.gvUsers.DataBind(); - - List cultures = new List(); - foreach (int localeId in ES.Services.HostedSharePointServersEnt.Enterprise_GetSupportedLanguages(PanelSecurity.PackageId)) - { - cultures.Add(new CultureInfo(localeId, false)); - } - - this.ddlLocaleID.DataSource = cultures; - this.ddlLocaleID.DataBind(); - } - - if (!IsPostBack) - { - // bind item to controls - if (item != null) - { - // bind item to controls - lnkUrl.Text = item.PhysicalAddress; - lnkUrl.NavigateUrl = item.PhysicalAddress; - litSiteCollectionOwner.Text = String.Format("{0} ({1})", item.OwnerName, item.OwnerEmail); - litLocaleID.Text = new CultureInfo(item.LocaleId, false).DisplayName; - litTitle.Text = item.Title; - litDescription.Text = item.Description; - editWarningStorage.QuotaValue = (int)item.WarningStorage; - editMaxStorage.QuotaValue = (int)item.MaxSiteStorage; - } - - Organization org = ES.Services.Organizations.GetOrganization(OrganizationId); - - if (org != null) - { - SetStorageQuotas(org, item); - } - } - //OrganizationDomainName[] domains = ES.Services.Organizations.GetOrganizationDomains(PanelRequest.ItemID); - - //DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId); - - EnterpriseServer.DomainInfo[] domains = ES.Services.Servers.GetDomains(PanelSecurity.PackageId); - - if (domains.Length == 0) - { - localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_DOMAINS"); - DisableFormControls(this, btnCancel); - return; - } - //if (this.gvUsers.Rows.Count == 0) - //{ - // localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_USERS"); - // DisableFormControls(this, btnCancel); - // return; - //} - } - catch - { - - localMessageBox.ShowWarningMessage("INIT_SERVICE_ITEM_FORM"); - - DisableFormControls(this, btnCancel); - return; - } - } - - /// Checks and sets disk quotas values. - /// The organization. - /// The site collection. - private void SetStorageQuotas(Organization organization, SharePointSiteCollection collection) - { - var quotaValue = organization.MaxSharePointEnterpriseStorage; - - if (quotaValue != -1) - { - var spaceResrved = GetReservedDiskStorageSpace(); - - if (spaceResrved > quotaValue) - { - quotaValue = 0; - } - else - { - quotaValue -= spaceResrved; - } - - if (collection != null) - { - quotaValue += (int)collection.MaxSiteStorage; - } - } - - maxStorage.ParentQuotaValue = quotaValue; - maxStorage.QuotaValue = quotaValue; - editMaxStorage.ParentQuotaValue = quotaValue; - warningStorage.ParentQuotaValue = quotaValue; - warningStorage.QuotaValue = quotaValue; - editWarningStorage.ParentQuotaValue = quotaValue; - - btnUpdate.Enabled = quotaValue != 0; - } - - /// Gets disk space reserved by existing site collections. - /// Reserved disk space vallue. - private int GetReservedDiskStorageSpace() - { - var existingCollections = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollections(PanelSecurity.PackageId, false); - - return (int)existingCollections.Sum(siteCollection => siteCollection.MaxSiteStorage); - } - - private void SaveItem() - { - if (!Page.IsValid) - { - return; - } - - - if (this.SiteCollectionId == 0) - { - if (this.userSelector.GetAccount() == null) - { - localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_USERS"); - return; - } - - - // new item - try - { - item = new SharePointSiteCollection(); - - if (!UseSharedSLL(PanelSecurity.PackageId)) - { - SharePointSiteCollectionListPaged existentSiteCollections = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollectionsPaged(PanelSecurity.PackageId, this.OrganizationId, "ItemName", String.Format("%{0}", this.domain.DomainName), String.Empty, 0, Int32.MaxValue); - foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) - { - Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); - if (existentSiteCollection.Name == String.Format("{0}://{1}", existentSiteCollectionUri.Scheme, this.txtHostName.Text.ToLower() + "." + this.domain.DomainName)) - { - localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_DOMAIN_IN_USE"); - return; - } - } - - item.Name = this.txtHostName.Text.ToLower() + "." + this.domain.DomainName; - } - else - item.Name = string.Empty; - - // get form data - - item.OrganizationId = this.OrganizationId; - item.Id = this.SiteCollectionId; - item.PackageId = PanelSecurity.PackageId; - - item.LocaleId = Int32.Parse(this.ddlLocaleID.SelectedValue); - item.OwnerLogin = this.userSelector.GetSAMAccountName(); - item.OwnerEmail = this.userSelector.GetPrimaryEmailAddress(); - item.OwnerName = this.userSelector.GetDisplayName(); - item.Title = txtTitle.Text; - item.Description = txtDescription.Text; - - - item.MaxSiteStorage = maxStorage.QuotaValue; - item.WarningStorage = warningStorage.QuotaValue; - - int result = ES.Services.HostedSharePointServersEnt.Enterprise_AddSiteCollection(item); - if (result < 0) - { - localMessageBox.ShowResultMessage(result); - return; - } - } - catch (Exception ex) - { - localMessageBox.ShowErrorMessage("HOSTEDSHAREPOINT_ADD_SITECOLLECTION", ex); - return; - } - } - else - { - ES.Services.HostedSharePointServersEnt.Enterprise_UpdateQuota(PanelRequest.ItemID, SiteCollectionId, editMaxStorage.QuotaValue, editWarningStorage.QuotaValue); - } - - // return - RedirectToSiteCollectionsList(); - } - - private void AddDnsRecord(int domainId, string recordName, string recordData) - { - int result = ES.Services.Servers.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, recordData, 0, 0, 0, 0); - if (result < 0) - { - ShowResultMessage(result); - } - } - - private bool IsDnsServiceAvailable() - { - ProviderInfo dnsProvider = ES.Services.Servers.GetPackageServiceProvider(PanelSecurity.PackageId, ResourceGroups.Dns); - return dnsProvider != null; - } - - private void DeleteItem() - { - // delete - try - { - int result = ES.Services.HostedSharePointServersEnt.Enterprise_DeleteSiteCollection(this.SiteCollectionId); - if (result < 0) - { - ShowResultMessage(result); - return; - } - } - catch (Exception ex) - { - localMessageBox.ShowErrorMessage("HOSTEDSHAREPOINT_DELETE_SITECOLLECTION", ex); - return; - } - - // return - RedirectToSiteCollectionsList(); - } - - protected void odsAccountsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) - { - if (e.Exception != null) - { - localMessageBox.ShowErrorMessage("ORGANIZATION_GET_USERS", e.Exception); - e.ExceptionHandled = true; - } - } - - - protected void btnCancel_Click(object sender, EventArgs e) - { - // return - RedirectToSiteCollectionsList(); - } - - protected void btnDelete_Click(object sender, EventArgs e) - { - DeleteItem(); - } - - protected void btnUpdate_Click(object sender, EventArgs e) - { - SaveItem(); - } - - protected void btnBackup_Click(object sender, EventArgs e) - { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_backup_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); - } - - protected void btnRestore_Click(object sender, EventArgs e) - { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_restore_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); - } - - - - private void RedirectToSiteCollectionsList() - { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_sitecollections", "ItemID=" + PanelRequest.ItemID.ToString())); - } - - private bool UseSharedSLL(int packageID) - { - PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); - if (cntx != null) - { - foreach (QuotaValueInfo quota in cntx.QuotasArray) - { - switch (quota.QuotaId) - { - case 552: - if (Convert.ToBoolean(quota.QuotaAllocatedValue)) - { - return true; - } - - break; - } - } - } - - return false; - } - - - //private void RegisterOwnerSelector() - //{ - // // Define the name and type of the client scripts on the page. - // String csname = "OwnerSelectorScript"; - // Type cstype = this.GetType(); - - // // Get a ClientScriptManager reference from the Page class. - // ClientScriptManager cs = Page.ClientScript; - - // // Check to see if the client script is already registered. - // if (!cs.IsClientScriptBlockRegistered(cstype, csname)) - // { - // StringBuilder ownerSelector = new StringBuilder(); - // ownerSelector.Append(""); - // cs.RegisterClientScriptBlock(cstype, csname, ownerSelector.ToString(), false); - // } - - //} - - //private StringDictionary ConvertArrayToDictionary(string[] settings) - //{ - // StringDictionary r = new StringDictionary(); - // foreach (string setting in settings) - // { - // int idx = setting.IndexOf('='); - // r.Add(setting.Substring(0, idx), setting.Substring(idx + 1)); - // } - // return r; - //} - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.designer.cs deleted file mode 100644 index 37f5fdf5..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseEditSiteCollection.ascx.designer.cs +++ /dev/null @@ -1,447 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointEnterpriseEditSiteCollection { - - /// - /// asyncTasks control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// localMessageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox localMessageBox; - - /// - /// tblEditItem control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTable tblEditItem; - - /// - /// rowUrl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTableRow rowUrl; - - /// - /// lblSiteCollectionUrl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionUrl; - - /// - /// txtHostName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtHostName; - - /// - /// domain control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.DomainsSelectDomainControl domain; - - /// - /// valRequireHostName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireHostName; - - /// - /// valRequireCorrectHostName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectHostName; - - /// - /// lblSiteCollectionOwner control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionOwner; - - /// - /// userSelector control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.ExchangeServer.UserControls.UserSelector userSelector; - - /// - /// lblSiteCollectionLocaleID control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionLocaleID; - - /// - /// ddlLocaleID control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList ddlLocaleID; - - /// - /// lblMaxStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblMaxStorage; - - /// - /// maxStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor maxStorage; - - /// - /// lblWarningStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblWarningStorage; - - /// - /// warningStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor warningStorage; - - /// - /// lblTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTitle; - - /// - /// txtTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtTitle; - - /// - /// valRequireTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireTitle; - - /// - /// lblDescription control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblDescription; - - /// - /// txtDescription control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtDescription; - - /// - /// RequiredFieldValidator1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; - - /// - /// tblViewItem control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTable tblViewItem; - - /// - /// lblSiteCollectionUrl2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionUrl2; - - /// - /// lnkUrl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.HyperLink lnkUrl; - - /// - /// lblSiteCollectionOwner2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionOwner2; - - /// - /// litSiteCollectionOwner control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litSiteCollectionOwner; - - /// - /// lblSiteCollectionLocaleID2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblSiteCollectionLocaleID2; - - /// - /// litLocaleID control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litLocaleID; - - /// - /// lblMaxStorageView control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblMaxStorageView; - - /// - /// editMaxStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor editMaxStorage; - - /// - /// lblWarningStorageView control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblWarningStorageView; - - /// - /// editWarningStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor editWarningStorage; - - /// - /// lblTitle2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTitle2; - - /// - /// litTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litTitle; - - /// - /// lblDescription2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblDescription2; - - /// - /// litDescription control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litDescription; - - /// - /// secMainTools control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secMainTools; - - /// - /// ToolsPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel ToolsPanel; - - /// - /// tblMaintenance control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTable tblMaintenance; - - /// - /// btnBackup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnBackup; - - /// - /// btnRestore control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnRestore; - - /// - /// btnUpdate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnUpdate; - - /// - /// btnCancel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnCancel; - - /// - /// btnDelete control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnDelete; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx deleted file mode 100644 index cb599a87..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx +++ /dev/null @@ -1,101 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs" - Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseRestoreSiteCollection" %> -<%@ Register Src="UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> -6 -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> - - -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> - - - - - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - - -
-
-  
- - - - - - - - - - - - - - -
- -
- -
- - - - - - - -
-
-
-
- - - - - - - -
- -
-
-
-
-
-
- - -
-
-
-
-
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs deleted file mode 100644 index 7523e6d7..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs +++ /dev/null @@ -1,176 +0,0 @@ -// 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.Collections; -using System.IO; -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.SharePoint; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointEnterpriseRestoreSiteCollection : WebsitePanelModuleBase - { - private int OrganizationId - { - get - { - return PanelRequest.GetInt("ItemID"); - } - } - - private int SiteCollectionId - { - get - { - return PanelRequest.GetInt("SiteCollectionID"); - } - } - - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - BindSite(); - } - } - - private void BindSite() - { - try - { - SharePointSiteCollection siteCollection = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollection(this.SiteCollectionId); - litSiteCollectionName.Text = siteCollection.PhysicalAddress; - fileLookup.SelectedFile = String.Empty; - fileLookup.PackageId = siteCollection.PackageId; - - ToggleControls(); - } - catch (Exception ex) - { - ShowErrorMessage("SHAREPOINT_GET_SITE", ex); - return; - } - } - - private void ToggleControls() - { - cellFile.Visible = radioFile.Checked; - cellUploadFile.Visible = radioUpload.Checked; - } - - private void RestoreSiteCollection() - { - try - { - string uploadedFile = null; - string packageFile = null; - - if (radioUpload.Checked) - { - if (uploadFile.PostedFile.FileName != "") - { - Stream stream = uploadFile.PostedFile.InputStream; - - // save uploaded file - int FILE_BUFFER_LENGTH = 5000000; - string path = null; - int readBytes = 0; - string fileName = Path.GetFileName(uploadFile.PostedFile.FileName); - - int offset = 0; - do - { - // read input stream - byte[] buffer = new byte[FILE_BUFFER_LENGTH]; - readBytes = stream.Read(buffer, 0, FILE_BUFFER_LENGTH); - - if (readBytes < FILE_BUFFER_LENGTH) - Array.Resize(ref buffer, readBytes); - - // write remote backup file - string tempPath = ES.Services.HostedSharePointServersEnt.Enterprise_AppendBackupBinaryChunk(this.SiteCollectionId, fileName, path, buffer); - if (path == null) - path = tempPath; - - offset += FILE_BUFFER_LENGTH; - } - while (readBytes == FILE_BUFFER_LENGTH); - - uploadedFile = path; - } - } - else - { - // package files - packageFile = fileLookup.SelectedFile; - } - - int result = ES.Services.HostedSharePointServersEnt.Enterprise_RestoreSiteCollection(this.SiteCollectionId, uploadedFile, packageFile); - if (result < 0) - { - ShowResultMessage(result); - return; - } - } - catch (Exception ex) - { - ShowErrorMessage("SHAREPOINT_RESTORE_SITE", ex); - return; - } - - RedirectBack(); - } - - protected void btnRestore_Click(object sender, EventArgs e) - { - RestoreSiteCollection(); - } - - protected void btnCancel_Click(object sender, EventArgs e) - { - RedirectBack(); - } - - private void RedirectBack() - { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); - } - protected void radioUpload_CheckedChanged(object sender, EventArgs e) - { - ToggleControls(); - } - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.designer.cs deleted file mode 100644 index 444b7e6c..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseRestoreSiteCollection.ascx.designer.cs +++ /dev/null @@ -1,159 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointEnterpriseRestoreSiteCollection { - - /// - /// asyncTasks control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// litSiteCollectionName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litSiteCollectionName; - - /// - /// lblRestoreFrom control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblRestoreFrom; - - /// - /// radioUpload control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RadioButton radioUpload; - - /// - /// radioFile control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RadioButton radioFile; - - /// - /// cellUploadFile control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTableCell cellUploadFile; - - /// - /// uploadFile control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.FileUpload uploadFile; - - /// - /// lblAllowedFiles1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblAllowedFiles1; - - /// - /// cellFile control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTableCell cellFile; - - /// - /// fileLookup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.FileLookup fileLookup; - - /// - /// lblAllowedFiles2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblAllowedFiles2; - - /// - /// btnRestore control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnRestore; - - /// - /// btnCancel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnCancel; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx deleted file mode 100644 index 56d0e786..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx +++ /dev/null @@ -1,92 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEnterpriseSiteCollections.ascx.cs" - Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseSiteCollections" %> -<%@ Register Src="UserControls/SpaceServiceItems.ascx" TagName="SpaceServiceItems" - TagPrefix="wsp" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> -<%@ Register Src="UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> -<%@ Register Src="UserControls/Quota.ascx" TagName="Quota" TagPrefix="wsp" %> - -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> - - - - - -
-
-
-
-
-
-
- - -
-
- -
-
- -
-
- - - - Url - - -
-
- - - - - - - <%# Eval("PhysicalAddress") %> - - - - - - - - - - - - - - - - - - - -
- -     - <%----%> - -
-
-
-
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.cs deleted file mode 100644 index 0573f900..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.cs +++ /dev/null @@ -1,110 +0,0 @@ -// 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.Collections; -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 System.Collections.Generic; -using WebsitePanel.Providers.SharePoint; -using WebsitePanel.Providers.HostedSolution; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointEnterpriseSiteCollections : WebsitePanelModuleBase - { - - protected void Page_Load(object sender, EventArgs e) - { - this.BindStats(); - } - - private void BindStats() - { - // quota values - OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID); - OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID); - - siteCollectionsQuota.QuotaUsedValue = stats.CreatedSharePointEnterpriseSiteCollections; - siteCollectionsQuota.QuotaValue = stats.AllocatedSharePointEnterpriseSiteCollections; - if (stats.AllocatedSharePointEnterpriseSiteCollections != -1) siteCollectionsQuota.QuotaAvailable = tenantStats.AllocatedSharePointEnterpriseSiteCollections - tenantStats.CreatedSharePointEnterpriseSiteCollections; - } - - protected void btnCreateSiteCollection_Click(object sender, EventArgs e) - { - Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_enterprise_edit_sitecollection", "SpaceID=" + PanelSecurity.PackageId.ToString())); - } - - public string GetSiteCollectionEditUrl(string siteCollectionId) - { - return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_edit_sitecollection", - "SiteCollectionID=" + siteCollectionId, - "ItemID=" + PanelRequest.ItemID.ToString()); - } - - protected void odsSharePointSiteCollectionPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) - { - if (e.Exception != null) - { - messageBox.ShowErrorMessage("HOSTEDSHAREPOINT_GET_SITECOLLECTIONS", e.Exception); - e.ExceptionHandled = true; - } - } - - protected void gvSiteCollections_RowCommand(object sender, GridViewCommandEventArgs e) - { - if (e.CommandName == "DeleteItem") - { - int siteCollectionId = Utils.ParseInt(e.CommandArgument.ToString(), 0); - - try - { - int result = ES.Services.HostedSharePointServersEnt.Enterprise_DeleteSiteCollection(siteCollectionId); - if (result < 0) - { - messageBox.ShowResultMessage(result); - return; - } - - gvSiteCollections.DataBind(); - this.BindStats(); - } - catch (Exception ex) - { - messageBox.ShowErrorMessage("HOSTEDSHAREPOINT_DELETE_SITECOLLECTION", ex); - } - } - } - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.designer.cs deleted file mode 100644 index 7c4bf6b7..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseSiteCollections.ascx.designer.cs +++ /dev/null @@ -1,141 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointEnterpriseSiteCollections { - - /// - /// asyncTasks control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// btnCreateSiteCollection control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnCreateSiteCollection; - - /// - /// SearchPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SearchPanel; - - /// - /// locSearch control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locSearch; - - /// - /// ddlSearchColumn control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList ddlSearchColumn; - - /// - /// txtSearchValue control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtSearchValue; - - /// - /// cmdSearch control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ImageButton cmdSearch; - - /// - /// gvSiteCollections control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.GridView gvSiteCollections; - - /// - /// odsSiteCollectionsPaged control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ObjectDataSource odsSiteCollectionsPaged; - - /// - /// locQuota control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locQuota; - - /// - /// siteCollectionsQuota control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaViewer siteCollectionsQuota; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx deleted file mode 100644 index 21d2d979..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx +++ /dev/null @@ -1,62 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HostedSharePointEnterpriseStorageSettings.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseStorageSettings" %> -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> -<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" - TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> -<%@ Register src="UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> - - - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - - - - - -
- -
- - -
-
-
- -
- - - -
- -
-
-
-
-
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.cs deleted file mode 100644 index d2b2547b..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.cs +++ /dev/null @@ -1,93 +0,0 @@ -// 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.EnterpriseServer; -using WebsitePanel.Providers.HostedSolution; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointEnterpriseStorageSettings : WebsitePanelModuleBase - { - protected void Page_Load(object sender, EventArgs e) - { - warningValue.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); - - - if (!IsPostBack) - { - Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); - - PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); - foreach(QuotaValueInfo quota in cntx.QuotasArray) - { - if (quota.QuotaId == 551 /*Max storage quota*/) - { - maxStorageSettingsValue.ParentQuotaValue = quota.QuotaAllocatedValue; - warningValue.ParentQuotaValue = quota.QuotaAllocatedValue; - } - } - - maxStorageSettingsValue.QuotaValue = org.MaxSharePointEnterpriseStorage; - warningValue.QuotaValue = org.WarningSharePointEnterpriseStorage; - - } - } - - private void Save(bool apply) - { - try - { - int res = ES.Services.HostedSharePointServersEnt.Enterprise_SetStorageSettings(PanelRequest.ItemID, maxStorageSettingsValue.QuotaValue, - warningValue.QuotaValue, - apply); - if (res < 0) - { - messageBox.ShowResultMessage(res); - return; - } - messageBox.ShowSuccessMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); - } - catch (Exception) - { - messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); - } - - } - - protected void btnSave_Click(object sender, EventArgs e) - { - Save(false); - } - - protected void btnSaveApply_Click(object sender, EventArgs e) - { - Save(true); - } - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.designer.cs deleted file mode 100644 index 26170885..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageSettings.ascx.designer.cs +++ /dev/null @@ -1,114 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointEnterpriseStorageSettings { - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// secStorageLimits control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secStorageLimits; - - /// - /// StorageLimits control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel StorageLimits; - - /// - /// locMaxStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locMaxStorage; - - /// - /// maxStorageSettingsValue control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor maxStorageSettingsValue; - - /// - /// locWarningStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locWarningStorage; - - /// - /// warningValue control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor warningValue; - - /// - /// btnSave control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnSave; - - /// - /// btnSaveApply control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnSaveApply; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx deleted file mode 100644 index d4fcf361..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx +++ /dev/null @@ -1,57 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HostedSharePointEnterpriseStorageUsage.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseStorageUsage" %> -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> -<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" - TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - -
- - - - - - - - - -
177
100
-
-
- - -
- -
-
-
-
-
-
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.cs deleted file mode 100644 index efb65e5f..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.cs +++ /dev/null @@ -1,94 +0,0 @@ -// 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.SharePoint; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointEnterpriseStorageUsage : WebsitePanelModuleBase - { - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - BindGrid(); - } - - protected void btnRecalculateDiscSpace_Click(object sender, EventArgs e) - { - BindGrid(); - } - - private void BindGrid() - { - int errorCode; - try - { - SharePointSiteDiskSpace[] sharePointSiteDiskSpace = - ES.Services.HostedSharePointServersEnt.Enterprise_CalculateSharePointSitesDiskSpace(PanelRequest.ItemID, - out errorCode); - - - if (errorCode < 0) - { - messageBox.ShowResultMessage(errorCode); - return; - } - - if (sharePointSiteDiskSpace != null && sharePointSiteDiskSpace.Length == 1 && string.IsNullOrEmpty(sharePointSiteDiskSpace[0].Url)) - { - gvStorageUsage.DataSource = null; - gvStorageUsage.DataBind(); - lblTotalItems.Text = "0"; - lblTotalSize.Text = "0"; - return; - } - - gvStorageUsage.DataSource = sharePointSiteDiskSpace; - gvStorageUsage.DataBind(); - - if (sharePointSiteDiskSpace != null) - { - lblTotalItems.Text = sharePointSiteDiskSpace.Length.ToString(); - - long total = 0; - foreach (SharePointSiteDiskSpace current in sharePointSiteDiskSpace) - { - total += current.DiskSpace; - } - - lblTotalSize.Text = total.ToString(); - } - } - catch(Exception ex) - { - messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_RECALCULATE_SIZE", ex); - } - } - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.designer.cs deleted file mode 100644 index a91f43f8..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEnterpriseStorageUsage.ascx.designer.cs +++ /dev/null @@ -1,114 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointEnterpriseStorageUsage { - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// secSiteCollectionsReport control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secSiteCollectionsReport; - - /// - /// siteCollectionsReport control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel siteCollectionsReport; - - /// - /// gvStorageUsage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.GridView gvStorageUsage; - - /// - /// locTotalboxItems control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTotalboxItems; - - /// - /// lblTotalItems control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTotalItems; - - /// - /// locTotalMailboxesSize control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTotalMailboxesSize; - - /// - /// lblTotalSize control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTotalSize; - - /// - /// btnRecalculateDiscSpace control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnRecalculateDiscSpace; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx deleted file mode 100644 index 5f3f1771..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx +++ /dev/null @@ -1,101 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointRestoreSiteCollection.ascx.cs" - Inherits="WebsitePanel.Portal.HostedSharePointRestoreSiteCollection" %> -<%@ Register Src="UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> -6 -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> - - -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> - - - - - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - - -
-
-  
- - - - - - - - - - - - - - -
- -
- -
- - - - - - - -
-
-
-
- - - - - - - -
- -
-
-
-
-
-
- - -
-
-
-
-
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs deleted file mode 100644 index de33f161..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs +++ /dev/null @@ -1,176 +0,0 @@ -// 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.Collections; -using System.IO; -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.SharePoint; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointRestoreSiteCollection : WebsitePanelModuleBase - { - private int OrganizationId - { - get - { - return PanelRequest.GetInt("ItemID"); - } - } - - private int SiteCollectionId - { - get - { - return PanelRequest.GetInt("SiteCollectionID"); - } - } - - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - BindSite(); - } - } - - private void BindSite() - { - try - { - SharePointSiteCollection siteCollection = ES.Services.HostedSharePointServers.GetSiteCollection(this.SiteCollectionId); - litSiteCollectionName.Text = siteCollection.PhysicalAddress; - fileLookup.SelectedFile = String.Empty; - fileLookup.PackageId = siteCollection.PackageId; - - ToggleControls(); - } - catch (Exception ex) - { - ShowErrorMessage("SHAREPOINT_GET_SITE", ex); - return; - } - } - - private void ToggleControls() - { - cellFile.Visible = radioFile.Checked; - cellUploadFile.Visible = radioUpload.Checked; - } - - private void RestoreSiteCollection() - { - try - { - string uploadedFile = null; - string packageFile = null; - - if (radioUpload.Checked) - { - if (uploadFile.PostedFile.FileName != "") - { - Stream stream = uploadFile.PostedFile.InputStream; - - // save uploaded file - int FILE_BUFFER_LENGTH = 5000000; - string path = null; - int readBytes = 0; - string fileName = Path.GetFileName(uploadFile.PostedFile.FileName); - - int offset = 0; - do - { - // read input stream - byte[] buffer = new byte[FILE_BUFFER_LENGTH]; - readBytes = stream.Read(buffer, 0, FILE_BUFFER_LENGTH); - - if (readBytes < FILE_BUFFER_LENGTH) - Array.Resize(ref buffer, readBytes); - - // write remote backup file - string tempPath = ES.Services.HostedSharePointServers.AppendBackupBinaryChunk(this.SiteCollectionId, fileName, path, buffer); - if (path == null) - path = tempPath; - - offset += FILE_BUFFER_LENGTH; - } - while (readBytes == FILE_BUFFER_LENGTH); - - uploadedFile = path; - } - } - else - { - // package files - packageFile = fileLookup.SelectedFile; - } - - int result = ES.Services.HostedSharePointServers.RestoreSiteCollection(this.SiteCollectionId, uploadedFile, packageFile); - if (result < 0) - { - ShowResultMessage(result); - return; - } - } - catch (Exception ex) - { - ShowErrorMessage("SHAREPOINT_RESTORE_SITE", ex); - return; - } - - RedirectBack(); - } - - protected void btnRestore_Click(object sender, EventArgs e) - { - RestoreSiteCollection(); - } - - protected void btnCancel_Click(object sender, EventArgs e) - { - RedirectBack(); - } - - private void RedirectBack() - { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); - } - protected void radioUpload_CheckedChanged(object sender, EventArgs e) - { - ToggleControls(); - } - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs deleted file mode 100644 index c59bec70..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.designer.cs +++ /dev/null @@ -1,159 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointRestoreSiteCollection { - - /// - /// asyncTasks control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// litSiteCollectionName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litSiteCollectionName; - - /// - /// lblRestoreFrom control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblRestoreFrom; - - /// - /// radioUpload control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RadioButton radioUpload; - - /// - /// radioFile control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RadioButton radioFile; - - /// - /// cellUploadFile control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTableCell cellUploadFile; - - /// - /// uploadFile control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.FileUpload uploadFile; - - /// - /// lblAllowedFiles1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblAllowedFiles1; - - /// - /// cellFile control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlTableCell cellFile; - - /// - /// fileLookup control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.FileLookup fileLookup; - - /// - /// lblAllowedFiles2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblAllowedFiles2; - - /// - /// btnRestore control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnRestore; - - /// - /// btnCancel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnCancel; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx deleted file mode 100644 index 2e6b6269..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx +++ /dev/null @@ -1,92 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointSiteCollections.ascx.cs" - Inherits="WebsitePanel.Portal.HostedSharePointSiteCollections" %> -<%@ Register Src="UserControls/SpaceServiceItems.ascx" TagName="SpaceServiceItems" - TagPrefix="wsp" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> -<%@ Register Src="UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> -<%@ Register Src="UserControls/Quota.ascx" TagName="Quota" TagPrefix="wsp" %> - -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> - - - - - -
-
-
-
-
-
-
- - -
-
- -
-
- -
-
- - - - Url - - -
-
- - - - - - - <%# Eval("PhysicalAddress") %> - - - - - - - - - - - - - - - - - - - -
- -     - <%----%> - -
-
-
-
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs deleted file mode 100644 index b03fd0f0..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs +++ /dev/null @@ -1,110 +0,0 @@ -// 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.Collections; -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 System.Collections.Generic; -using WebsitePanel.Providers.SharePoint; -using WebsitePanel.Providers.HostedSolution; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointSiteCollections : WebsitePanelModuleBase - { - - protected void Page_Load(object sender, EventArgs e) - { - this.BindStats(); - } - - private void BindStats() - { - // quota values - OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID); - OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID); - - siteCollectionsQuota.QuotaUsedValue = stats.CreatedSharePointSiteCollections; - siteCollectionsQuota.QuotaValue = stats.AllocatedSharePointSiteCollections; - if (stats.AllocatedSharePointSiteCollections != -1) siteCollectionsQuota.QuotaAvailable = tenantStats.AllocatedSharePointSiteCollections - tenantStats.CreatedSharePointSiteCollections; - } - - protected void btnCreateSiteCollection_Click(object sender, EventArgs e) - { - Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_edit_sitecollection", "SpaceID=" + PanelSecurity.PackageId.ToString())); - } - - public string GetSiteCollectionEditUrl(string siteCollectionId) - { - return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", - "SiteCollectionID=" + siteCollectionId, - "ItemID=" + PanelRequest.ItemID.ToString()); - } - - protected void odsSharePointSiteCollectionPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) - { - if (e.Exception != null) - { - messageBox.ShowErrorMessage("HOSTEDSHAREPOINT_GET_SITECOLLECTIONS", e.Exception); - e.ExceptionHandled = true; - } - } - - protected void gvSiteCollections_RowCommand(object sender, GridViewCommandEventArgs e) - { - if (e.CommandName == "DeleteItem") - { - int siteCollectionId = Utils.ParseInt(e.CommandArgument.ToString(), 0); - - try - { - int result = ES.Services.HostedSharePointServers.DeleteSiteCollection(siteCollectionId); - if (result < 0) - { - messageBox.ShowResultMessage(result); - return; - } - - gvSiteCollections.DataBind(); - this.BindStats(); - } - catch (Exception ex) - { - messageBox.ShowErrorMessage("HOSTEDSHAREPOINT_DELETE_SITECOLLECTION", ex); - } - } - } - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.designer.cs deleted file mode 100644 index 2e8763e8..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.designer.cs +++ /dev/null @@ -1,141 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointSiteCollections { - - /// - /// asyncTasks control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// btnCreateSiteCollection control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnCreateSiteCollection; - - /// - /// SearchPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel SearchPanel; - - /// - /// locSearch control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locSearch; - - /// - /// ddlSearchColumn control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList ddlSearchColumn; - - /// - /// txtSearchValue control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtSearchValue; - - /// - /// cmdSearch control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ImageButton cmdSearch; - - /// - /// gvSiteCollections control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.GridView gvSiteCollections; - - /// - /// odsSiteCollectionsPaged control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ObjectDataSource odsSiteCollectionsPaged; - - /// - /// locQuota control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locQuota; - - /// - /// siteCollectionsQuota control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaViewer siteCollectionsQuota; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx deleted file mode 100644 index f11df6ad..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx +++ /dev/null @@ -1,62 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HostedSharePointStorageSettings.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointStorageSettings" %> -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> -<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" - TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> -<%@ Register src="UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> - - - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - - - - - -
- -
- - -
-
-
- -
- - - -
- -
-
-
-
-
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.cs deleted file mode 100644 index 52e86521..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.cs +++ /dev/null @@ -1,93 +0,0 @@ -// 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.EnterpriseServer; -using WebsitePanel.Providers.HostedSolution; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointStorageSettings : WebsitePanelModuleBase - { - protected void Page_Load(object sender, EventArgs e) - { - warningValue.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); - - - if (!IsPostBack) - { - Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); - - PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); - foreach(QuotaValueInfo quota in cntx.QuotasArray) - { - if (quota.QuotaId == 208 /*Max storage quota*/) - { - maxStorageSettingsValue.ParentQuotaValue = quota.QuotaAllocatedValue; - warningValue.ParentQuotaValue = quota.QuotaAllocatedValue; - } - } - - maxStorageSettingsValue.QuotaValue = org.MaxSharePointStorage; - warningValue.QuotaValue = org.WarningSharePointStorage; - - } - } - - private void Save(bool apply) - { - try - { - int res = ES.Services.HostedSharePointServers.SetStorageSettings(PanelRequest.ItemID, maxStorageSettingsValue.QuotaValue, - warningValue.QuotaValue, - apply); - if (res < 0) - { - messageBox.ShowResultMessage(res); - return; - } - messageBox.ShowSuccessMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); - } - catch (Exception) - { - messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); - } - - } - - protected void btnSave_Click(object sender, EventArgs e) - { - Save(false); - } - - protected void btnSaveApply_Click(object sender, EventArgs e) - { - Save(true); - } - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs deleted file mode 100644 index 04b5be91..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageSettings.ascx.designer.cs +++ /dev/null @@ -1,114 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointStorageSettings { - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// secStorageLimits control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secStorageLimits; - - /// - /// StorageLimits control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel StorageLimits; - - /// - /// locMaxStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locMaxStorage; - - /// - /// maxStorageSettingsValue control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor maxStorageSettingsValue; - - /// - /// locWarningStorage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locWarningStorage; - - /// - /// warningValue control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.QuotaEditor warningValue; - - /// - /// btnSave control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnSave; - - /// - /// btnSaveApply control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnSaveApply; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx deleted file mode 100644 index 317c2138..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx +++ /dev/null @@ -1,57 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HostedSharePointStorageUsage.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointStorageUsage" %> -<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" - TagPrefix="wsp" %> -<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" - TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> -<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" - TagPrefix="wsp" %> -<%@ Register Src="ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> - -
-
-
-
-
-
-
- - -
-
- - - - - - - - - - - -
- - - - - - - - - -
177
100
-
-
- - -
- -
-
-
-
-
-
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.cs deleted file mode 100644 index c18a2e4f..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.cs +++ /dev/null @@ -1,94 +0,0 @@ -// 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.SharePoint; - -namespace WebsitePanel.Portal -{ - public partial class HostedSharePointStorageUsage : WebsitePanelModuleBase - { - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - BindGrid(); - } - - protected void btnRecalculateDiscSpace_Click(object sender, EventArgs e) - { - BindGrid(); - } - - private void BindGrid() - { - int errorCode; - try - { - SharePointSiteDiskSpace[] sharePointSiteDiskSpace = - ES.Services.HostedSharePointServers.CalculateSharePointSitesDiskSpace(PanelRequest.ItemID, - out errorCode); - - - if (errorCode < 0) - { - messageBox.ShowResultMessage(errorCode); - return; - } - - if (sharePointSiteDiskSpace != null && sharePointSiteDiskSpace.Length == 1 && string.IsNullOrEmpty(sharePointSiteDiskSpace[0].Url)) - { - gvStorageUsage.DataSource = null; - gvStorageUsage.DataBind(); - lblTotalItems.Text = "0"; - lblTotalSize.Text = "0"; - return; - } - - gvStorageUsage.DataSource = sharePointSiteDiskSpace; - gvStorageUsage.DataBind(); - - if (sharePointSiteDiskSpace != null) - { - lblTotalItems.Text = sharePointSiteDiskSpace.Length.ToString(); - - long total = 0; - foreach (SharePointSiteDiskSpace current in sharePointSiteDiskSpace) - { - total += current.DiskSpace; - } - - lblTotalSize.Text = total.ToString(); - } - } - catch(Exception ex) - { - messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_RECALCULATE_SIZE", ex); - } - } - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs deleted file mode 100644 index 4c003393..00000000 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointStorageUsage.ascx.designer.cs +++ /dev/null @@ -1,114 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 { - - - public partial class HostedSharePointStorageUsage { - - /// - /// Image1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Image Image1; - - /// - /// locTitle control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTitle; - - /// - /// messageBox control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; - - /// - /// secSiteCollectionsReport control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::WebsitePanel.Portal.CollapsiblePanel secSiteCollectionsReport; - - /// - /// siteCollectionsReport control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel siteCollectionsReport; - - /// - /// gvStorageUsage control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.GridView gvStorageUsage; - - /// - /// locTotalboxItems control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTotalboxItems; - - /// - /// lblTotalItems control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTotalItems; - - /// - /// locTotalMailboxesSize control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize locTotalMailboxesSize; - - /// - /// lblTotalSize control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label lblTotalSize; - - /// - /// btnRecalculateDiscSpace control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button btnRecalculateDiscSpace; - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx index b52a64b4..dcd883a4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx @@ -74,6 +74,11 @@ + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs index 0f4cd791..76eb4338 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.cs @@ -67,6 +67,7 @@ namespace WebsitePanel.Portal { "quotaLyncUsers", "pnlLyncUsers" }, { "quotaBlackBerryUsers", "pnlBlackBerryUsers" }, { "quotaSharepointSites", "pnlSharepointSites" }, + { "quotaSharepointEnterpriseSites", "pnlSharepointEnterpriseSites" }, { "quotaWebSites", "pnlWebSites" }, { "quotaDatabases", "pnlDatabases" }, { "quotaNumberOfVm", "pnlHyperVForPC" }, diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs index fbb13a74..4c46ce4f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx.designer.cs @@ -1,31 +1,3 @@ -// 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. @@ -454,6 +426,33 @@ namespace WebsitePanel.Portal { /// protected global::WebsitePanel.Portal.Quota quotaSharepointSites; + /// + /// pnlSharepointEnterpriseSites control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow pnlSharepointEnterpriseSites; + + /// + /// Label2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label Label2; + + /// + /// quotaSharepointEnterpriseSites control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.Quota quotaSharepointEnterpriseSites; + /// /// pnlWebSites control. /// 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 6d782e5d..87046bd1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -259,46 +259,46 @@ EnterpriseStorageOwaUsersList.ascx - + HostedSharePointEnterpriseBackupSiteCollection.ascx ASPXCodeBehind - + HostedSharePointEnterpriseBackupSiteCollection.ascx - + HostedSharePointEnterpriseEditSiteCollection.ascx ASPXCodeBehind - + HostedSharePointEnterpriseEditSiteCollection.ascx - + HostedSharePointEnterpriseSiteCollections.ascx ASPXCodeBehind - + HostedSharePointEnterpriseSiteCollections.ascx - + HostedSharePointEnterpriseRestoreSiteCollection.ascx ASPXCodeBehind - + HostedSharePointEnterpriseRestoreSiteCollection.ascx - + HostedSharePointEnterpriseStorageSettings.ascx ASPXCodeBehind - + HostedSharePointEnterpriseStorageSettings.ascx - + HostedSharePointEnterpriseStorageUsage.ascx ASPXCodeBehind - + HostedSharePointEnterpriseStorageUsage.ascx @@ -1521,46 +1521,46 @@ UserSelector.ascx - + HostedSharePointBackupSiteCollection.ascx ASPXCodeBehind - + HostedSharePointBackupSiteCollection.ascx - + HostedSharePointEditSiteCollection.ascx ASPXCodeBehind - + HostedSharePointEditSiteCollection.ascx - + HostedSharePointRestoreSiteCollection.ascx ASPXCodeBehind - + HostedSharePointRestoreSiteCollection.ascx - + HostedSharePointSiteCollections.ascx ASPXCodeBehind - + HostedSharePointSiteCollections.ascx - + HostedSharePointStorageSettings.ascx ASPXCodeBehind - + HostedSharePointStorageSettings.ascx - + HostedSharePointStorageUsage.ascx ASPXCodeBehind - + HostedSharePointStorageUsage.ascx @@ -4581,12 +4581,12 @@ - - - - - - + + + + + + @@ -4645,22 +4645,22 @@ Designer - + Designer - + Designer - + Designer - + Designer - + Designer - + Designer @@ -6206,12 +6206,12 @@ - - - - - - + + + + + + @@ -6245,7 +6245,7 @@ - + Designer @@ -6253,7 +6253,7 @@ - + Designer @@ -6679,16 +6679,16 @@ Designer - + Designer - + Designer - + Designer - + Designer diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj index 4b3119cd..eb62f9b5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/WebsitePanel.WebPortal.csproj @@ -313,7 +313,9 @@ Designer - + + Designer + From 882ac47dbcd87b97fcb05bb5c7750c713150e5c0 Mon Sep 17 00:00:00 2001 From: robvde Date: Tue, 7 Apr 2015 20:53:24 +0800 Subject: [PATCH 78/91] 2013 commitr --- ...stedSharePointEditSiteCollection.ascx.resx | 207 ++++++++ ...ntEnterpriseBackupSiteCollection.ascx.resx | 153 ++++++ ...ointEnterpriseEditSiteCollection.ascx.resx | 207 ++++++++ ...tEnterpriseRestoreSiteCollection.ascx.resx | 150 ++++++ ...rePointEnterpriseSiteCollections.ascx.resx | 153 ++++++ ...rePointEnterpriseStorageSettings.ascx.resx | 154 ++++++ ...SharePointEnterpriseStorageUsage.ascx.resx | 150 ++++++ ...dSharePointRestoreSiteCollection.ascx.resx | 150 ++++++ .../HostedSharePointSiteCollections.ascx.resx | 153 ++++++ .../HostedSharePointStorageSettings.ascx.resx | 154 ++++++ .../HostedSharePointStorageUsage.ascx.resx | 150 ++++++ .../HostedSharePointBackupSiteCollection.ascx | 80 ++++ ...stedSharePointBackupSiteCollection.ascx.cs | 189 ++++++++ ...PointBackupSiteCollection.ascx.designer.cs | 159 +++++++ .../HostedSharePointEditSiteCollection.ascx | 209 ++++++++ ...HostedSharePointEditSiteCollection.ascx.cs | 450 ++++++++++++++++++ ...rePointEditSiteCollection.ascx.designer.cs | 447 +++++++++++++++++ ...rePointEnterpriseBackupSiteCollection.ascx | 80 ++++ ...ointEnterpriseBackupSiteCollection.ascx.cs | 189 ++++++++ ...priseBackupSiteCollection.ascx.designer.cs | 159 +++++++ ...harePointEnterpriseEditSiteCollection.ascx | 209 ++++++++ ...ePointEnterpriseEditSiteCollection.ascx.cs | 450 ++++++++++++++++++ ...erpriseEditSiteCollection.ascx.designer.cs | 447 +++++++++++++++++ ...ePointEnterpriseRestoreSiteCollection.ascx | 101 ++++ ...intEnterpriseRestoreSiteCollection.ascx.cs | 176 +++++++ ...riseRestoreSiteCollection.ascx.designer.cs | 159 +++++++ ...edSharePointEnterpriseSiteCollections.ascx | 92 ++++ ...harePointEnterpriseSiteCollections.ascx.cs | 110 +++++ ...EnterpriseSiteCollections.ascx.designer.cs | 141 ++++++ ...edSharePointEnterpriseStorageSettings.ascx | 62 +++ ...harePointEnterpriseStorageSettings.ascx.cs | 93 ++++ ...EnterpriseStorageSettings.ascx.designer.cs | 114 +++++ ...ostedSharePointEnterpriseStorageUsage.ascx | 57 +++ ...edSharePointEnterpriseStorageUsage.ascx.cs | 94 ++++ ...intEnterpriseStorageUsage.ascx.designer.cs | 114 +++++ ...HostedSharePointRestoreSiteCollection.ascx | 101 ++++ ...tedSharePointRestoreSiteCollection.ascx.cs | 176 +++++++ ...ointRestoreSiteCollection.ascx.designer.cs | 159 +++++++ .../HostedSharePointSiteCollections.ascx | 92 ++++ .../HostedSharePointSiteCollections.ascx.cs | 110 +++++ ...SharePointSiteCollections.ascx.designer.cs | 141 ++++++ .../HostedSharePointStorageSettings.ascx | 62 +++ .../HostedSharePointStorageSettings.ascx.cs | 93 ++++ ...SharePointStorageSettings.ascx.designer.cs | 114 +++++ .../HostedSharePointStorageUsage.ascx | 57 +++ .../HostedSharePointStorageUsage.ascx.cs | 94 ++++ ...tedSharePointStorageUsage.ascx.designer.cs | 114 +++++ 47 files changed, 7475 insertions(+) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEditSiteCollection.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseBackupSiteCollection.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseEditSiteCollection.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseRestoreSiteCollection.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseSiteCollections.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseStorageSettings.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseStorageUsage.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointRestoreSiteCollection.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointSiteCollections.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointStorageSettings.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointStorageUsage.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEditSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEditSiteCollection.ascx.resx new file mode 100644 index 00000000..856828c3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEditSiteCollection.ascx.resx @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Backup Site Collection + + + Cancel + + + ShowProgressDialog('Deleting SharePoint site collection...'); + + + Delete + + + Restore Site Collection + + + ShowProgressDialog('Updating SharePoint site collection...'); + + + Update + + + <p>Here you can create new SharePoint site collection. Choose URL from the list of domains you already own. Site URL like team.yourcompany.com should be added as domain in “Domain names” organization’s menu before SharePoint site collection creation.</p> + +<p><b>Site owner</b> is member of your organization who will be responsible for this SharePoint site collection administration: choosing site templates, adding other users, creating sub-sites.</p> + +<p><b>Locale ID</b> defines your site language and can not be changed after site creation. However child sub sites can use another Locale IDs.</p> + +<p>Title will be visible in site header.</p> + +<p><b>Description</b> will be visible when you open site on the top of the main site page.</p> + +<p>After you create this site open it using owner login, and do at least 2 main steps: +1. Choose site template +2. Define who will be able to access this site. To add user from your hosted organization to SharePoint site, please copy/paste his or her e-mail from user's properties in WebsitePanel to SharePoint site collection’s Users/Groups field.</p> + + + Email + + + User Name + + + Description: + + + Locale ID: + + + Owner: + + + Url: + + + Title: + + + Send warning E-mail when site storage reaches (MB): + + + Full list of locales + + + SharePoint Site Collection + + + SharePoint Site Collection Tools + + + Add Site Collection + + + Edit SharePoint Site Collection + + + Update + + + Maximum site storage size (MB): + + + Do not send + + + ShowProgressDialog('Creating SharePoint site collection...'); + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseBackupSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseBackupSiteCollection.ascx.resx new file mode 100644 index 00000000..c931ca06 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseBackupSiteCollection.ascx.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Backup + + + Cancel + + + ZIP Backup + + + <p>The backup file that you create includes list or library content, security settings, user information, navigation, customizations, and personalizations (such as views, site templates, and content types). The backup file does not include workflows, alerts, and properties stored at the site collection level.</p> + + + Backup Destination: + + + Backup File Name: + + + Backup Options: + + + Backup SharePoint Site Collection + + + Copy to Folder + + + Download via HTTP + + + Backup SharePoint Site Collection + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseEditSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseEditSiteCollection.ascx.resx new file mode 100644 index 00000000..856828c3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseEditSiteCollection.ascx.resx @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Backup Site Collection + + + Cancel + + + ShowProgressDialog('Deleting SharePoint site collection...'); + + + Delete + + + Restore Site Collection + + + ShowProgressDialog('Updating SharePoint site collection...'); + + + Update + + + <p>Here you can create new SharePoint site collection. Choose URL from the list of domains you already own. Site URL like team.yourcompany.com should be added as domain in “Domain names” organization’s menu before SharePoint site collection creation.</p> + +<p><b>Site owner</b> is member of your organization who will be responsible for this SharePoint site collection administration: choosing site templates, adding other users, creating sub-sites.</p> + +<p><b>Locale ID</b> defines your site language and can not be changed after site creation. However child sub sites can use another Locale IDs.</p> + +<p>Title will be visible in site header.</p> + +<p><b>Description</b> will be visible when you open site on the top of the main site page.</p> + +<p>After you create this site open it using owner login, and do at least 2 main steps: +1. Choose site template +2. Define who will be able to access this site. To add user from your hosted organization to SharePoint site, please copy/paste his or her e-mail from user's properties in WebsitePanel to SharePoint site collection’s Users/Groups field.</p> + + + Email + + + User Name + + + Description: + + + Locale ID: + + + Owner: + + + Url: + + + Title: + + + Send warning E-mail when site storage reaches (MB): + + + Full list of locales + + + SharePoint Site Collection + + + SharePoint Site Collection Tools + + + Add Site Collection + + + Edit SharePoint Site Collection + + + Update + + + Maximum site storage size (MB): + + + Do not send + + + ShowProgressDialog('Creating SharePoint site collection...'); + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseRestoreSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseRestoreSiteCollection.ascx.resx new file mode 100644 index 00000000..06164c47 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseRestoreSiteCollection.ascx.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cancel + + + ShowProgressDialog('Restoring SharePoint site collection...'); + + + Restore + + + <p>After site collection is restored it will have primary administrator assigned to it as it was before restoration (primary administrator record from backup is ignored).</p> + + + .ZIP, .BAK files are allowed + + + Restore From: + + + Restore SharePoint Site Collection + + + Hosting Space File + + + Uploaded File + + + Restore SharePoint Site Collection + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseSiteCollections.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseSiteCollections.ascx.resx new file mode 100644 index 00000000..224fd542 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseSiteCollections.ascx.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add SharePoint Enterprise Site Collection + + + Create New Site Collection + + + Delete + + + Url + + + <p><b>SharePoint site collection</b> is a group of sites built on Microsoft Windows SharePoint Services that all exist under a top-level site. To make managing the sites and their content more convenient, you can assign users to be site collection administrators or site collection owners. These are permission levels to give to users who you want to have full administrative rights to all sites and content within a site collection.</p> + + + Owner + + + No SharePoint site collections have been created. To create a SharePoint site collection click "Create New Site Collection" button. + + + Site Collection Url + + + Total Site Collections Created: + + + SharePoint Enterprise Site Collections + + + SharePoint Enterprise Site Collections + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseStorageSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseStorageSettings.ascx.resx new file mode 100644 index 00000000..062e04df --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseStorageSettings.ascx.resx @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Save + + + Save and Apply to All Site Collections + + + <p>Storage settings are used to limit the amount of storage available on a SharePoint site collection, and they are used to send e-mail alerts to the site administrator when a specified value of space is used.</p> + +<p>These settings will be applied to the new site collections only. By clicking "Save and Apply to All Site Collections" button you can override these settings for all existing site collections.</p> + +<p>Please note, that you cannot specify storage settings higher than defined in the space hosting plan.</p> + + + Maximum site storage size (MB): + + + Send warning E-mail when site storage reaches (MB): + + + Storage Settings + + + Storage Settings + + + Storage Settings + + + Don't use + + + Do not send + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseStorageUsage.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseStorageUsage.ascx.resx new file mode 100644 index 00000000..b945ab03 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointEnterpriseStorageUsage.ascx.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Recalculate Disk Space + + + <p>SharePoint disk space usage is calculated on timely basis (usually once a day). You can recalculate it right now by clicking "Recalculate Disk Space" button.</p> + + + Site Collection + + + Total Size, MB + + + There are no site collections + + + Storage Usage + + + Site Collections + + + Storage Usage + + + Total Size (MB): + + + Total Items: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointRestoreSiteCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointRestoreSiteCollection.ascx.resx new file mode 100644 index 00000000..06164c47 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointRestoreSiteCollection.ascx.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cancel + + + ShowProgressDialog('Restoring SharePoint site collection...'); + + + Restore + + + <p>After site collection is restored it will have primary administrator assigned to it as it was before restoration (primary administrator record from backup is ignored).</p> + + + .ZIP, .BAK files are allowed + + + Restore From: + + + Restore SharePoint Site Collection + + + Hosting Space File + + + Uploaded File + + + Restore SharePoint Site Collection + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointSiteCollections.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointSiteCollections.ascx.resx new file mode 100644 index 00000000..44c0004a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointSiteCollections.ascx.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add SharePoint Site Collection + + + Create New Site Collection + + + Delete + + + Url + + + <p><b>SharePoint site collection</b> is a group of sites built on Microsoft Windows SharePoint Services that all exist under a top-level site. To make managing the sites and their content more convenient, you can assign users to be site collection administrators or site collection owners. These are permission levels to give to users who you want to have full administrative rights to all sites and content within a site collection.</p> + + + Owner + + + No SharePoint site collections have been created. To create a SharePoint site collection click "Create New Site Collection" button. + + + Site Collection Url + + + Total Site Collections Created: + + + SharePoint Site Collections + + + SharePoint Site Collections + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointStorageSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointStorageSettings.ascx.resx new file mode 100644 index 00000000..062e04df --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointStorageSettings.ascx.resx @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Save + + + Save and Apply to All Site Collections + + + <p>Storage settings are used to limit the amount of storage available on a SharePoint site collection, and they are used to send e-mail alerts to the site administrator when a specified value of space is used.</p> + +<p>These settings will be applied to the new site collections only. By clicking "Save and Apply to All Site Collections" button you can override these settings for all existing site collections.</p> + +<p>Please note, that you cannot specify storage settings higher than defined in the space hosting plan.</p> + + + Maximum site storage size (MB): + + + Send warning E-mail when site storage reaches (MB): + + + Storage Settings + + + Storage Settings + + + Storage Settings + + + Don't use + + + Do not send + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointStorageUsage.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointStorageUsage.ascx.resx new file mode 100644 index 00000000..b945ab03 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/App_LocalResources/HostedSharePointStorageUsage.ascx.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Recalculate Disk Space + + + <p>SharePoint disk space usage is calculated on timely basis (usually once a day). You can recalculate it right now by clicking "Recalculate Disk Space" button.</p> + + + Site Collection + + + Total Size, MB + + + There are no site collections + + + Storage Usage + + + Site Collections + + + Storage Usage + + + Total Size (MB): + + + Total Items: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx new file mode 100644 index 00000000..743a1ec4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx @@ -0,0 +1,80 @@ +<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointBackupSiteCollection.ascx.cs" + Inherits="WebsitePanel.Portal.HostedSharePointBackupSiteCollection" %> +<%@ Register Src="../UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> + +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> + + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + +
+
+  
+ +
+ + +
+
+
+ + +
+ +
+      +
+
+ + +
+
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx.cs new file mode 100644 index 00000000..5e1afb37 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx.cs @@ -0,0 +1,189 @@ +// 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.Collections; +using System.IO; +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.SharePoint; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointBackupSiteCollection : WebsitePanelModuleBase + { + private const string BACKUP_EXTENSION = ".bsh"; + + private int OrganizationId + { + get + { + return PanelRequest.GetInt("ItemID"); + } + } + + private int SiteCollectionId + { + get + { + return PanelRequest.GetInt("SiteCollectionID"); + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BindSite(); + } + } + + private void BindSite() + { + try + { + SharePointSiteCollection siteCollection = ES.Services.HostedSharePointServers.GetSiteCollection(this.SiteCollectionId); + litSiteCollectionName.Text = siteCollection.PhysicalAddress; + txtBackupName.Text = siteCollection.Url + BACKUP_EXTENSION; + fileLookup.SelectedFile = "\\"; + fileLookup.PackageId = siteCollection.PackageId; + + BindBackupName(); + ToggleControls(); + } + catch (Exception ex) + { + ShowErrorMessage("SHAREPOINT_GET_SITE", ex); + return; + } + } + + private void BindBackupName() + { + string backupName = Path.GetFileNameWithoutExtension(txtBackupName.Text); + txtBackupName.Text = backupName + (chkZipBackup.Checked ? ".zip" : BACKUP_EXTENSION); + } + + private void ToggleControls() + { + fileLookup.Visible = rbCopy.Checked; + } + + private void BackupSiteCollection() + { + try + { + string bakFile = ES.Services.HostedSharePointServers.BackupSiteCollection(this.SiteCollectionId, + txtBackupName.Text, chkZipBackup.Checked, rbDownload.Checked, fileLookup.SelectedFile); + + if (rbDownload.Checked && !String.IsNullOrEmpty(bakFile)) + { + + string fileName = bakFile; + + //Response.Clear(); + Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(fileName)); + Response.ContentType = "application/octet-stream"; + + int FILE_BUFFER_LENGTH = 5000000; + byte[] buffer = null; + int offset = 0; + do + { + // Read remote content. + buffer = ES.Services.HostedSharePointServers.GetBackupBinaryChunk(this.SiteCollectionId, fileName, offset, FILE_BUFFER_LENGTH); + + // Write to stream. + //Response.BinaryWrite(buffer); + Response.OutputStream.Write(buffer, 0, buffer.Length); + offset += FILE_BUFFER_LENGTH; + } + while (buffer.Length == FILE_BUFFER_LENGTH); + + Response.Flush(); + Response.End(); + //Response.Close(); + //HttpContext.Current.ApplicationInstance.CompleteRequest(); + //Response.End(); + + } + } + catch (Exception ex) + { + ShowErrorMessage("SHAREPOINT_BACKUP_SITE", ex); + return; + } + //Response.ClearContent(); + Context.Response.Clear(); + if (!rbDownload.Checked) + RedirectBack(); + + } + + protected void btnBackup_Click(object sender, EventArgs e) + { + BackupSiteCollection(); + } + protected void btnCancel_Click(object sender, EventArgs e) + { + RedirectBack(); + } + + private void RedirectBack() + { + HttpContext.Current.Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + } + + protected void chkZipBackup_CheckedChanged(object sender, EventArgs e) + { + BindBackupName(); + } + + protected void rbDownload_CheckedChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + protected override void OnPreRender(EventArgs e) + { + string str = string.Format("var rb = document.getElementById('{0}'); if (!rb.checked) ShowProgressDialog('Backing up site collection...');", rbDownload.ClientID); + + + + btnBackup.Attributes.Add("onclick", str); + base.OnPreRender(e); + } + + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx.designer.cs new file mode 100644 index 00000000..6bd4aa9e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointBackupSiteCollection.ascx.designer.cs @@ -0,0 +1,159 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointBackupSiteCollection { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// litSiteCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litSiteCollectionName; + + /// + /// lblBackupFileName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblBackupFileName; + + /// + /// txtBackupName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtBackupName; + + /// + /// validatorUserName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator validatorUserName; + + /// + /// lblBackupOptions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblBackupOptions; + + /// + /// chkZipBackup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkZipBackup; + + /// + /// lblBackupDestination control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblBackupDestination; + + /// + /// rbDownload control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton rbDownload; + + /// + /// rbCopy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton rbCopy; + + /// + /// fileLookup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.FileLookup fileLookup; + + /// + /// btnBackup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnBackup; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx new file mode 100644 index 00000000..ad030d8c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx @@ -0,0 +1,209 @@ +<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEditSiteCollection.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointEditSiteCollection" %> +<%@ Register Src="../ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/AllocatePackageIPAddresses.ascx" TagName="SiteUrlBuilder" TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/UserSelector.ascx" TagName="UserSelector" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register src="../UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> +<%@ Register Src="../DomainsSelectDomainControl.ascx" TagName="DomainsSelectDomainControl" TagPrefix="uc1" %> + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + . + + +
+ + + +
+ + + +
+ + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + +
+ + + +
+ + + + +
+ + + +
+ + + +
+ + + +
+ + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+
+ + + +
+
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx.cs new file mode 100644 index 00000000..1c150ca9 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx.cs @@ -0,0 +1,450 @@ +// 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.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Web; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.DNS; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.SharePoint; + + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointEditSiteCollection : WebsitePanelModuleBase + { + SharePointSiteCollection item = null; + + private int OrganizationId + { + get + { + return PanelRequest.GetInt("ItemID"); + } + } + + private int SiteCollectionId + { + get + { + return PanelRequest.GetInt("SiteCollectionID"); + } + } + + protected void Page_Load(object sender, EventArgs e) + { + domain.PackageId = PanelSecurity.PackageId; + + warningStorage.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); + editWarningStorage.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); + + bool newItem = (this.SiteCollectionId == 0); + + tblEditItem.Visible = newItem; + tblViewItem.Visible = !newItem; + + //btnUpdate.Visible = newItem; + btnDelete.Visible = !newItem; + btnUpdate.Text = newItem ? GetLocalizedString("Text.Add") : GetLocalizedString("Text.Update"); + btnUpdate.OnClientClick = newItem ? GetLocalizedString("btnCreate.OnClientClick") : GetLocalizedString("btnUpdate.OnClientClick"); + + btnBackup.Enabled = btnRestore.Enabled = !newItem; + + // bind item + BindItem(); + + } + + private void BindItem() + { + try + { + if (!IsPostBack) + { + if (!this.IsDnsServiceAvailable()) + { + localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_DNS"); + } + + // load item if required + if (this.SiteCollectionId > 0) + { + // existing item + item = ES.Services.HostedSharePointServers.GetSiteCollection(this.SiteCollectionId); + if (item != null) + { + // save package info + ViewState["PackageId"] = item.PackageId; + } + else + RedirectToBrowsePage(); + } + else + { + // new item + ViewState["PackageId"] = PanelSecurity.PackageId; + if (UseSharedSLL(PanelSecurity.PackageId)) + { + + rowUrl.Visible = false; + valRequireHostName.Enabled = false; + valRequireCorrectHostName.Enabled = false; + } + } + + //this.gvUsers.DataBind(); + + List cultures = new List(); + foreach (int localeId in ES.Services.HostedSharePointServers.GetSupportedLanguages(PanelSecurity.PackageId)) + { + cultures.Add(new CultureInfo(localeId, false)); + } + + this.ddlLocaleID.DataSource = cultures; + this.ddlLocaleID.DataBind(); + } + + if (!IsPostBack) + { + // bind item to controls + if (item != null) + { + // bind item to controls + lnkUrl.Text = item.PhysicalAddress; + lnkUrl.NavigateUrl = item.PhysicalAddress; + litSiteCollectionOwner.Text = String.Format("{0} ({1})", item.OwnerName, item.OwnerEmail); + litLocaleID.Text = new CultureInfo(item.LocaleId, false).DisplayName; + litTitle.Text = item.Title; + litDescription.Text = item.Description; + editWarningStorage.QuotaValue = (int)item.WarningStorage; + editMaxStorage.QuotaValue = (int)item.MaxSiteStorage; + } + + Organization org = ES.Services.Organizations.GetOrganization(OrganizationId); + + if (org != null) + { + SetStorageQuotas(org, item); + } + } + //OrganizationDomainName[] domains = ES.Services.Organizations.GetOrganizationDomains(PanelRequest.ItemID); + + //DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId); + + EnterpriseServer.DomainInfo[] domains = ES.Services.Servers.GetDomains(PanelSecurity.PackageId); + + if (domains.Length == 0) + { + localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_DOMAINS"); + DisableFormControls(this, btnCancel); + return; + } + //if (this.gvUsers.Rows.Count == 0) + //{ + // localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_USERS"); + // DisableFormControls(this, btnCancel); + // return; + //} + } + catch + { + + localMessageBox.ShowWarningMessage("INIT_SERVICE_ITEM_FORM"); + + DisableFormControls(this, btnCancel); + return; + } + } + + /// Checks and sets disk quotas values. + /// The organization. + /// The site collection. + private void SetStorageQuotas(Organization organization, SharePointSiteCollection collection) + { + var quotaValue = organization.MaxSharePointStorage; + + if (quotaValue != -1) + { + var spaceResrved = GetReservedDiskStorageSpace(); + + if (spaceResrved > quotaValue) + { + quotaValue = 0; + } + else + { + quotaValue -= spaceResrved; + } + + if (collection != null) + { + quotaValue += (int)collection.MaxSiteStorage; + } + } + + maxStorage.ParentQuotaValue = quotaValue; + maxStorage.QuotaValue = quotaValue; + editMaxStorage.ParentQuotaValue = quotaValue; + warningStorage.ParentQuotaValue = quotaValue; + warningStorage.QuotaValue = quotaValue; + editWarningStorage.ParentQuotaValue = quotaValue; + + btnUpdate.Enabled = quotaValue != 0; + } + + /// Gets disk space reserved by existing site collections. + /// Reserved disk space vallue. + private int GetReservedDiskStorageSpace() + { + var existingCollections = ES.Services.HostedSharePointServers.GetSiteCollections(PanelSecurity.PackageId, false); + + return (int)existingCollections.Sum(siteCollection => siteCollection.MaxSiteStorage); + } + + private void SaveItem() + { + if (!Page.IsValid) + { + return; + } + + + if (this.SiteCollectionId == 0) + { + if (this.userSelector.GetAccount() == null) + { + localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_USERS"); + return; + } + + + // new item + try + { + item = new SharePointSiteCollection(); + + if (!UseSharedSLL(PanelSecurity.PackageId)) + { + SharePointSiteCollectionListPaged existentSiteCollections = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(PanelSecurity.PackageId, this.OrganizationId, "ItemName", String.Format("%{0}", this.domain.DomainName), String.Empty, 0, Int32.MaxValue); + foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) + { + Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); + if (existentSiteCollection.Name == String.Format("{0}://{1}", existentSiteCollectionUri.Scheme, this.txtHostName.Text.ToLower() + "." + this.domain.DomainName)) + { + localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_DOMAIN_IN_USE"); + return; + } + } + + item.Name = this.txtHostName.Text.ToLower() + "." + this.domain.DomainName; + } + else + item.Name = string.Empty; + + // get form data + + item.OrganizationId = this.OrganizationId; + item.Id = this.SiteCollectionId; + item.PackageId = PanelSecurity.PackageId; + + item.LocaleId = Int32.Parse(this.ddlLocaleID.SelectedValue); + item.OwnerLogin = this.userSelector.GetSAMAccountName(); + item.OwnerEmail = this.userSelector.GetPrimaryEmailAddress(); + item.OwnerName = this.userSelector.GetDisplayName(); + item.Title = txtTitle.Text; + item.Description = txtDescription.Text; + + + item.MaxSiteStorage = maxStorage.QuotaValue; + item.WarningStorage = warningStorage.QuotaValue; + + int result = ES.Services.HostedSharePointServers.AddSiteCollection(item); + if (result < 0) + { + localMessageBox.ShowResultMessage(result); + return; + } + } + catch (Exception ex) + { + localMessageBox.ShowErrorMessage("HOSTEDSHAREPOINT_ADD_SITECOLLECTION", ex); + return; + } + } + else + { + ES.Services.HostedSharePointServers.UpdateQuota(PanelRequest.ItemID, SiteCollectionId, editMaxStorage.QuotaValue, editWarningStorage.QuotaValue); + } + + // return + RedirectToSiteCollectionsList(); + } + + private void AddDnsRecord(int domainId, string recordName, string recordData) + { + int result = ES.Services.Servers.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, recordData, 0, 0, 0, 0); + if (result < 0) + { + ShowResultMessage(result); + } + } + + private bool IsDnsServiceAvailable() + { + ProviderInfo dnsProvider = ES.Services.Servers.GetPackageServiceProvider(PanelSecurity.PackageId, ResourceGroups.Dns); + return dnsProvider != null; + } + + private void DeleteItem() + { + // delete + try + { + int result = ES.Services.HostedSharePointServers.DeleteSiteCollection(this.SiteCollectionId); + if (result < 0) + { + ShowResultMessage(result); + return; + } + } + catch (Exception ex) + { + localMessageBox.ShowErrorMessage("HOSTEDSHAREPOINT_DELETE_SITECOLLECTION", ex); + return; + } + + // return + RedirectToSiteCollectionsList(); + } + + protected void odsAccountsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) + { + if (e.Exception != null) + { + localMessageBox.ShowErrorMessage("ORGANIZATION_GET_USERS", e.Exception); + e.ExceptionHandled = true; + } + } + + + protected void btnCancel_Click(object sender, EventArgs e) + { + // return + RedirectToSiteCollectionsList(); + } + + protected void btnDelete_Click(object sender, EventArgs e) + { + DeleteItem(); + } + + protected void btnUpdate_Click(object sender, EventArgs e) + { + SaveItem(); + } + + protected void btnBackup_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_backup_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + } + + protected void btnRestore_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_restore_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + } + + + + private void RedirectToSiteCollectionsList() + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_sitecollections", "ItemID=" + PanelRequest.ItemID.ToString())); + } + + private bool UseSharedSLL(int packageID) + { + PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); + if (cntx != null) + { + foreach (QuotaValueInfo quota in cntx.QuotasArray) + { + switch (quota.QuotaId) + { + case 400: + if (Convert.ToBoolean(quota.QuotaAllocatedValue)) + { + return true; + } + + break; + } + } + } + + return false; + } + + + //private void RegisterOwnerSelector() + //{ + // // Define the name and type of the client scripts on the page. + // String csname = "OwnerSelectorScript"; + // Type cstype = this.GetType(); + + // // Get a ClientScriptManager reference from the Page class. + // ClientScriptManager cs = Page.ClientScript; + + // // Check to see if the client script is already registered. + // if (!cs.IsClientScriptBlockRegistered(cstype, csname)) + // { + // StringBuilder ownerSelector = new StringBuilder(); + // ownerSelector.Append(""); + // cs.RegisterClientScriptBlock(cstype, csname, ownerSelector.ToString(), false); + // } + + //} + + //private StringDictionary ConvertArrayToDictionary(string[] settings) + //{ + // StringDictionary r = new StringDictionary(); + // foreach (string setting in settings) + // { + // int idx = setting.IndexOf('='); + // r.Add(setting.Substring(0, idx), setting.Substring(idx + 1)); + // } + // return r; + //} + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx.designer.cs new file mode 100644 index 00000000..6801e4b1 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEditSiteCollection.ascx.designer.cs @@ -0,0 +1,447 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointEditSiteCollection { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// localMessageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox localMessageBox; + + /// + /// tblEditItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tblEditItem; + + /// + /// rowUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowUrl; + + /// + /// lblSiteCollectionUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionUrl; + + /// + /// txtHostName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtHostName; + + /// + /// domain control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.DomainsSelectDomainControl domain; + + /// + /// valRequireHostName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireHostName; + + /// + /// valRequireCorrectHostName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectHostName; + + /// + /// lblSiteCollectionOwner control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionOwner; + + /// + /// userSelector control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.UserSelector userSelector; + + /// + /// lblSiteCollectionLocaleID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionLocaleID; + + /// + /// ddlLocaleID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlLocaleID; + + /// + /// lblMaxStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxStorage; + + /// + /// maxStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor maxStorage; + + /// + /// lblWarningStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblWarningStorage; + + /// + /// warningStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor warningStorage; + + /// + /// lblTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblTitle; + + /// + /// txtTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtTitle; + + /// + /// valRequireTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireTitle; + + /// + /// lblDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDescription; + + /// + /// txtDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDescription; + + /// + /// RequiredFieldValidator1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; + + /// + /// tblViewItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tblViewItem; + + /// + /// lblSiteCollectionUrl2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionUrl2; + + /// + /// lnkUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink lnkUrl; + + /// + /// lblSiteCollectionOwner2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionOwner2; + + /// + /// litSiteCollectionOwner control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litSiteCollectionOwner; + + /// + /// lblSiteCollectionLocaleID2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionLocaleID2; + + /// + /// litLocaleID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litLocaleID; + + /// + /// lblMaxStorageView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxStorageView; + + /// + /// editMaxStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor editMaxStorage; + + /// + /// lblWarningStorageView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblWarningStorageView; + + /// + /// editWarningStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor editWarningStorage; + + /// + /// lblTitle2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblTitle2; + + /// + /// litTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litTitle; + + /// + /// lblDescription2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDescription2; + + /// + /// litDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litDescription; + + /// + /// secMainTools control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secMainTools; + + /// + /// ToolsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel ToolsPanel; + + /// + /// tblMaintenance control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tblMaintenance; + + /// + /// btnBackup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnBackup; + + /// + /// btnRestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRestore; + + /// + /// btnUpdate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnUpdate; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + + /// + /// btnDelete control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnDelete; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx new file mode 100644 index 00000000..f680ba4a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx @@ -0,0 +1,80 @@ +<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEnterpriseBackupSiteCollection.ascx.cs" + Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseBackupSiteCollection" %> +<%@ Register Src="../UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> + +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> + + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + +
+
+  
+ +
+ + +
+
+
+ + +
+ +
+      +
+
+ + +
+
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx.cs new file mode 100644 index 00000000..6a74ea65 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx.cs @@ -0,0 +1,189 @@ +// 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.Collections; +using System.IO; +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.SharePoint; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointEnterpriseBackupSiteCollection : WebsitePanelModuleBase + { + private const string BACKUP_EXTENSION = ".bsh"; + + private int OrganizationId + { + get + { + return PanelRequest.GetInt("ItemID"); + } + } + + private int SiteCollectionId + { + get + { + return PanelRequest.GetInt("SiteCollectionID"); + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BindSite(); + } + } + + private void BindSite() + { + try + { + SharePointEnterpriseSiteCollection siteCollection = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollection(this.SiteCollectionId); + litSiteCollectionName.Text = siteCollection.PhysicalAddress; + txtBackupName.Text = siteCollection.Url + BACKUP_EXTENSION; + fileLookup.SelectedFile = "\\"; + fileLookup.PackageId = siteCollection.PackageId; + + BindBackupName(); + ToggleControls(); + } + catch (Exception ex) + { + ShowErrorMessage("SHAREPOINT_GET_SITE", ex); + return; + } + } + + private void BindBackupName() + { + string backupName = Path.GetFileNameWithoutExtension(txtBackupName.Text); + txtBackupName.Text = backupName + (chkZipBackup.Checked ? ".zip" : BACKUP_EXTENSION); + } + + private void ToggleControls() + { + fileLookup.Visible = rbCopy.Checked; + } + + private void BackupSiteCollection() + { + try + { + string bakFile = ES.Services.HostedSharePointServersEnt.Enterprise_BackupSiteCollection(this.SiteCollectionId, + txtBackupName.Text, chkZipBackup.Checked, rbDownload.Checked, fileLookup.SelectedFile); + + if (rbDownload.Checked && !String.IsNullOrEmpty(bakFile)) + { + + string fileName = bakFile; + + //Response.Clear(); + Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(fileName)); + Response.ContentType = "application/octet-stream"; + + int FILE_BUFFER_LENGTH = 5000000; + byte[] buffer = null; + int offset = 0; + do + { + // Read remote content. + buffer = ES.Services.HostedSharePointServersEnt.Enterprise_GetBackupBinaryChunk(this.SiteCollectionId, fileName, offset, FILE_BUFFER_LENGTH); + + // Write to stream. + //Response.BinaryWrite(buffer); + Response.OutputStream.Write(buffer, 0, buffer.Length); + offset += FILE_BUFFER_LENGTH; + } + while (buffer.Length == FILE_BUFFER_LENGTH); + + Response.Flush(); + Response.End(); + //Response.Close(); + //HttpContext.Current.ApplicationInstance.CompleteRequest(); + //Response.End(); + + } + } + catch (Exception ex) + { + ShowErrorMessage("SHAREPOINT_BACKUP_SITE", ex); + return; + } + //Response.ClearContent(); + Context.Response.Clear(); + if (!rbDownload.Checked) + RedirectBack(); + + } + + protected void btnBackup_Click(object sender, EventArgs e) + { + BackupSiteCollection(); + } + protected void btnCancel_Click(object sender, EventArgs e) + { + RedirectBack(); + } + + private void RedirectBack() + { + HttpContext.Current.Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + } + + protected void chkZipBackup_CheckedChanged(object sender, EventArgs e) + { + BindBackupName(); + } + + protected void rbDownload_CheckedChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + protected override void OnPreRender(EventArgs e) + { + string str = string.Format("var rb = document.getElementById('{0}'); if (!rb.checked) ShowProgressDialog('Backing up site collection...');", rbDownload.ClientID); + + + + btnBackup.Attributes.Add("onclick", str); + base.OnPreRender(e); + } + + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx.designer.cs new file mode 100644 index 00000000..b74025b4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseBackupSiteCollection.ascx.designer.cs @@ -0,0 +1,159 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointEnterpriseBackupSiteCollection { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// litSiteCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litSiteCollectionName; + + /// + /// lblBackupFileName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblBackupFileName; + + /// + /// txtBackupName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtBackupName; + + /// + /// validatorUserName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator validatorUserName; + + /// + /// lblBackupOptions control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblBackupOptions; + + /// + /// chkZipBackup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkZipBackup; + + /// + /// lblBackupDestination control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblBackupDestination; + + /// + /// rbDownload control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton rbDownload; + + /// + /// rbCopy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton rbCopy; + + /// + /// fileLookup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.FileLookup fileLookup; + + /// + /// btnBackup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnBackup; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx new file mode 100644 index 00000000..5a4b5917 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx @@ -0,0 +1,209 @@ +<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEnterpriseEditSiteCollection.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseEditSiteCollection" %> +<%@ Register Src="../ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/AllocatePackageIPAddresses.ascx" TagName="SiteUrlBuilder" TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/UserSelector.ascx" TagName="UserSelector" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register src="../UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> +<%@ Register Src="../DomainsSelectDomainControl.ascx" TagName="DomainsSelectDomainControl" TagPrefix="uc1" %> + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + . + + +
+ + + +
+ + + +
+ + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + +
+ + + +
+ + + + +
+ + + +
+ + + +
+ + + +
+ + + + +
+ + + + + + + + + + +
+ +
+ +
+
+
+
+ + + +
+
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx.cs new file mode 100644 index 00000000..80585245 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx.cs @@ -0,0 +1,450 @@ +// 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.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Web; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.DNS; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.SharePoint; + + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointEnterpriseEditSiteCollection : WebsitePanelModuleBase + { + SharePointEnterpriseSiteCollection item = null; + + private int OrganizationId + { + get + { + return PanelRequest.GetInt("ItemID"); + } + } + + private int SiteCollectionId + { + get + { + return PanelRequest.GetInt("SiteCollectionID"); + } + } + + protected void Page_Load(object sender, EventArgs e) + { + domain.PackageId = PanelSecurity.PackageId; + + warningStorage.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); + editWarningStorage.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); + + bool newItem = (this.SiteCollectionId == 0); + + tblEditItem.Visible = newItem; + tblViewItem.Visible = !newItem; + + //btnUpdate.Visible = newItem; + btnDelete.Visible = !newItem; + btnUpdate.Text = newItem ? GetLocalizedString("Text.Add") : GetLocalizedString("Text.Update"); + btnUpdate.OnClientClick = newItem ? GetLocalizedString("btnCreate.OnClientClick") : GetLocalizedString("btnUpdate.OnClientClick"); + + btnBackup.Enabled = btnRestore.Enabled = !newItem; + + // bind item + BindItem(); + + } + + private void BindItem() + { + try + { + if (!IsPostBack) + { + if (!this.IsDnsServiceAvailable()) + { + localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_DNS"); + } + + // load item if required + if (this.SiteCollectionId > 0) + { + // existing item + item = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollection(this.SiteCollectionId); + if (item != null) + { + // save package info + ViewState["PackageId"] = item.PackageId; + } + else + RedirectToBrowsePage(); + } + else + { + // new item + ViewState["PackageId"] = PanelSecurity.PackageId; + if (UseSharedSLL(PanelSecurity.PackageId)) + { + + rowUrl.Visible = false; + valRequireHostName.Enabled = false; + valRequireCorrectHostName.Enabled = false; + } + } + + //this.gvUsers.DataBind(); + + List cultures = new List(); + foreach (int localeId in ES.Services.HostedSharePointServersEnt.Enterprise_GetSupportedLanguages(PanelSecurity.PackageId)) + { + cultures.Add(new CultureInfo(localeId, false)); + } + + this.ddlLocaleID.DataSource = cultures; + this.ddlLocaleID.DataBind(); + } + + if (!IsPostBack) + { + // bind item to controls + if (item != null) + { + // bind item to controls + lnkUrl.Text = item.PhysicalAddress; + lnkUrl.NavigateUrl = item.PhysicalAddress; + litSiteCollectionOwner.Text = String.Format("{0} ({1})", item.OwnerName, item.OwnerEmail); + litLocaleID.Text = new CultureInfo(item.LocaleId, false).DisplayName; + litTitle.Text = item.Title; + litDescription.Text = item.Description; + editWarningStorage.QuotaValue = (int)item.WarningStorage; + editMaxStorage.QuotaValue = (int)item.MaxSiteStorage; + } + + Organization org = ES.Services.Organizations.GetOrganization(OrganizationId); + + if (org != null) + { + SetStorageQuotas(org, item); + } + } + //OrganizationDomainName[] domains = ES.Services.Organizations.GetOrganizationDomains(PanelRequest.ItemID); + + //DomainInfo[] domains = ES.Services.Servers.GetMyDomains(PanelSecurity.PackageId); + + EnterpriseServer.DomainInfo[] domains = ES.Services.Servers.GetDomains(PanelSecurity.PackageId); + + if (domains.Length == 0) + { + localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_DOMAINS"); + DisableFormControls(this, btnCancel); + return; + } + //if (this.gvUsers.Rows.Count == 0) + //{ + // localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_USERS"); + // DisableFormControls(this, btnCancel); + // return; + //} + } + catch + { + + localMessageBox.ShowWarningMessage("INIT_SERVICE_ITEM_FORM"); + + DisableFormControls(this, btnCancel); + return; + } + } + + /// Checks and sets disk quotas values. + /// The organization. + /// The site collection. + private void SetStorageQuotas(Organization organization, SharePointEnterpriseSiteCollection collection) + { + var quotaValue = organization.MaxSharePointEnterpriseStorage; + + if (quotaValue != -1) + { + var spaceResrved = GetReservedDiskStorageSpace(); + + if (spaceResrved > quotaValue) + { + quotaValue = 0; + } + else + { + quotaValue -= spaceResrved; + } + + if (collection != null) + { + quotaValue += (int)collection.MaxSiteStorage; + } + } + + maxStorage.ParentQuotaValue = quotaValue; + maxStorage.QuotaValue = quotaValue; + editMaxStorage.ParentQuotaValue = quotaValue; + warningStorage.ParentQuotaValue = quotaValue; + warningStorage.QuotaValue = quotaValue; + editWarningStorage.ParentQuotaValue = quotaValue; + + btnUpdate.Enabled = quotaValue != 0; + } + + /// Gets disk space reserved by existing site collections. + /// Reserved disk space vallue. + private int GetReservedDiskStorageSpace() + { + var existingCollections = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollections(PanelSecurity.PackageId, false); + + return (int)existingCollections.Sum(siteCollection => siteCollection.MaxSiteStorage); + } + + private void SaveItem() + { + if (!Page.IsValid) + { + return; + } + + + if (this.SiteCollectionId == 0) + { + if (this.userSelector.GetAccount() == null) + { + localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_NO_USERS"); + return; + } + + + // new item + try + { + item = new SharePointEnterpriseSiteCollection(); + + if (!UseSharedSLL(PanelSecurity.PackageId)) + { + SharePointEnterpriseSiteCollectionListPaged existentSiteCollections = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollectionsPaged(PanelSecurity.PackageId, this.OrganizationId, "ItemName", String.Format("%{0}", this.domain.DomainName), String.Empty, 0, Int32.MaxValue); + foreach (SharePointEnterpriseSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) + { + Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); + if (existentSiteCollection.Name == String.Format("{0}://{1}", existentSiteCollectionUri.Scheme, this.txtHostName.Text.ToLower() + "." + this.domain.DomainName)) + { + localMessageBox.ShowWarningMessage("HOSTEDSHAREPOINT_DOMAIN_IN_USE"); + return; + } + } + + item.Name = this.txtHostName.Text.ToLower() + "." + this.domain.DomainName; + } + else + item.Name = string.Empty; + + // get form data + + item.OrganizationId = this.OrganizationId; + item.Id = this.SiteCollectionId; + item.PackageId = PanelSecurity.PackageId; + + item.LocaleId = Int32.Parse(this.ddlLocaleID.SelectedValue); + item.OwnerLogin = this.userSelector.GetSAMAccountName(); + item.OwnerEmail = this.userSelector.GetPrimaryEmailAddress(); + item.OwnerName = this.userSelector.GetDisplayName(); + item.Title = txtTitle.Text; + item.Description = txtDescription.Text; + + + item.MaxSiteStorage = maxStorage.QuotaValue; + item.WarningStorage = warningStorage.QuotaValue; + + int result = ES.Services.HostedSharePointServersEnt.Enterprise_AddSiteCollection(item); + if (result < 0) + { + localMessageBox.ShowResultMessage(result); + return; + } + } + catch (Exception ex) + { + localMessageBox.ShowErrorMessage("HOSTEDSHAREPOINT_ADD_SITECOLLECTION", ex); + return; + } + } + else + { + ES.Services.HostedSharePointServersEnt.Enterprise_UpdateQuota(PanelRequest.ItemID, SiteCollectionId, editMaxStorage.QuotaValue, editWarningStorage.QuotaValue); + } + + // return + RedirectToSiteCollectionsList(); + } + + private void AddDnsRecord(int domainId, string recordName, string recordData) + { + int result = ES.Services.Servers.AddDnsZoneRecord(domainId, recordName, DnsRecordType.A, recordData, 0, 0, 0, 0); + if (result < 0) + { + ShowResultMessage(result); + } + } + + private bool IsDnsServiceAvailable() + { + ProviderInfo dnsProvider = ES.Services.Servers.GetPackageServiceProvider(PanelSecurity.PackageId, ResourceGroups.Dns); + return dnsProvider != null; + } + + private void DeleteItem() + { + // delete + try + { + int result = ES.Services.HostedSharePointServersEnt.Enterprise_DeleteSiteCollection(this.SiteCollectionId); + if (result < 0) + { + ShowResultMessage(result); + return; + } + } + catch (Exception ex) + { + localMessageBox.ShowErrorMessage("HOSTEDSHAREPOINT_DELETE_SITECOLLECTION", ex); + return; + } + + // return + RedirectToSiteCollectionsList(); + } + + protected void odsAccountsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) + { + if (e.Exception != null) + { + localMessageBox.ShowErrorMessage("ORGANIZATION_GET_USERS", e.Exception); + e.ExceptionHandled = true; + } + } + + + protected void btnCancel_Click(object sender, EventArgs e) + { + // return + RedirectToSiteCollectionsList(); + } + + protected void btnDelete_Click(object sender, EventArgs e) + { + DeleteItem(); + } + + protected void btnUpdate_Click(object sender, EventArgs e) + { + SaveItem(); + } + + protected void btnBackup_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_backup_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + } + + protected void btnRestore_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_restore_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + } + + + + private void RedirectToSiteCollectionsList() + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_sitecollections", "ItemID=" + PanelRequest.ItemID.ToString())); + } + + private bool UseSharedSLL(int packageID) + { + PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); + if (cntx != null) + { + foreach (QuotaValueInfo quota in cntx.QuotasArray) + { + switch (quota.QuotaId) + { + case 552: + if (Convert.ToBoolean(quota.QuotaAllocatedValue)) + { + return true; + } + + break; + } + } + } + + return false; + } + + + //private void RegisterOwnerSelector() + //{ + // // Define the name and type of the client scripts on the page. + // String csname = "OwnerSelectorScript"; + // Type cstype = this.GetType(); + + // // Get a ClientScriptManager reference from the Page class. + // ClientScriptManager cs = Page.ClientScript; + + // // Check to see if the client script is already registered. + // if (!cs.IsClientScriptBlockRegistered(cstype, csname)) + // { + // StringBuilder ownerSelector = new StringBuilder(); + // ownerSelector.Append(""); + // cs.RegisterClientScriptBlock(cstype, csname, ownerSelector.ToString(), false); + // } + + //} + + //private StringDictionary ConvertArrayToDictionary(string[] settings) + //{ + // StringDictionary r = new StringDictionary(); + // foreach (string setting in settings) + // { + // int idx = setting.IndexOf('='); + // r.Add(setting.Substring(0, idx), setting.Substring(idx + 1)); + // } + // return r; + //} + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx.designer.cs new file mode 100644 index 00000000..37f5fdf5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseEditSiteCollection.ascx.designer.cs @@ -0,0 +1,447 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointEnterpriseEditSiteCollection { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// localMessageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox localMessageBox; + + /// + /// tblEditItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tblEditItem; + + /// + /// rowUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow rowUrl; + + /// + /// lblSiteCollectionUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionUrl; + + /// + /// txtHostName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtHostName; + + /// + /// domain control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.DomainsSelectDomainControl domain; + + /// + /// valRequireHostName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireHostName; + + /// + /// valRequireCorrectHostName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RegularExpressionValidator valRequireCorrectHostName; + + /// + /// lblSiteCollectionOwner control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionOwner; + + /// + /// userSelector control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ExchangeServer.UserControls.UserSelector userSelector; + + /// + /// lblSiteCollectionLocaleID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionLocaleID; + + /// + /// ddlLocaleID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlLocaleID; + + /// + /// lblMaxStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxStorage; + + /// + /// maxStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor maxStorage; + + /// + /// lblWarningStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblWarningStorage; + + /// + /// warningStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor warningStorage; + + /// + /// lblTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblTitle; + + /// + /// txtTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtTitle; + + /// + /// valRequireTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireTitle; + + /// + /// lblDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDescription; + + /// + /// txtDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDescription; + + /// + /// RequiredFieldValidator1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; + + /// + /// tblViewItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tblViewItem; + + /// + /// lblSiteCollectionUrl2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionUrl2; + + /// + /// lnkUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink lnkUrl; + + /// + /// lblSiteCollectionOwner2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionOwner2; + + /// + /// litSiteCollectionOwner control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litSiteCollectionOwner; + + /// + /// lblSiteCollectionLocaleID2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSiteCollectionLocaleID2; + + /// + /// litLocaleID control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litLocaleID; + + /// + /// lblMaxStorageView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblMaxStorageView; + + /// + /// editMaxStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor editMaxStorage; + + /// + /// lblWarningStorageView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblWarningStorageView; + + /// + /// editWarningStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor editWarningStorage; + + /// + /// lblTitle2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblTitle2; + + /// + /// litTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litTitle; + + /// + /// lblDescription2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDescription2; + + /// + /// litDescription control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litDescription; + + /// + /// secMainTools control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secMainTools; + + /// + /// ToolsPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel ToolsPanel; + + /// + /// tblMaintenance control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTable tblMaintenance; + + /// + /// btnBackup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnBackup; + + /// + /// btnRestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRestore; + + /// + /// btnUpdate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnUpdate; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + + /// + /// btnDelete control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnDelete; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx new file mode 100644 index 00000000..b2a36898 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx @@ -0,0 +1,101 @@ +<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs" + Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseRestoreSiteCollection" %> +<%@ Register Src="../UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> +6 +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> + + +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> + + + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + +
+
+  
+ + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs new file mode 100644 index 00000000..191c7546 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx.cs @@ -0,0 +1,176 @@ +// 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.Collections; +using System.IO; +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.SharePoint; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointEnterpriseRestoreSiteCollection : WebsitePanelModuleBase + { + private int OrganizationId + { + get + { + return PanelRequest.GetInt("ItemID"); + } + } + + private int SiteCollectionId + { + get + { + return PanelRequest.GetInt("SiteCollectionID"); + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BindSite(); + } + } + + private void BindSite() + { + try + { + SharePointEnterpriseSiteCollection siteCollection = ES.Services.HostedSharePointServersEnt.Enterprise_GetSiteCollection(this.SiteCollectionId); + litSiteCollectionName.Text = siteCollection.PhysicalAddress; + fileLookup.SelectedFile = String.Empty; + fileLookup.PackageId = siteCollection.PackageId; + + ToggleControls(); + } + catch (Exception ex) + { + ShowErrorMessage("SHAREPOINT_GET_SITE", ex); + return; + } + } + + private void ToggleControls() + { + cellFile.Visible = radioFile.Checked; + cellUploadFile.Visible = radioUpload.Checked; + } + + private void RestoreSiteCollection() + { + try + { + string uploadedFile = null; + string packageFile = null; + + if (radioUpload.Checked) + { + if (uploadFile.PostedFile.FileName != "") + { + Stream stream = uploadFile.PostedFile.InputStream; + + // save uploaded file + int FILE_BUFFER_LENGTH = 5000000; + string path = null; + int readBytes = 0; + string fileName = Path.GetFileName(uploadFile.PostedFile.FileName); + + int offset = 0; + do + { + // read input stream + byte[] buffer = new byte[FILE_BUFFER_LENGTH]; + readBytes = stream.Read(buffer, 0, FILE_BUFFER_LENGTH); + + if (readBytes < FILE_BUFFER_LENGTH) + Array.Resize(ref buffer, readBytes); + + // write remote backup file + string tempPath = ES.Services.HostedSharePointServersEnt.Enterprise_AppendBackupBinaryChunk(this.SiteCollectionId, fileName, path, buffer); + if (path == null) + path = tempPath; + + offset += FILE_BUFFER_LENGTH; + } + while (readBytes == FILE_BUFFER_LENGTH); + + uploadedFile = path; + } + } + else + { + // package files + packageFile = fileLookup.SelectedFile; + } + + int result = ES.Services.HostedSharePointServersEnt.Enterprise_RestoreSiteCollection(this.SiteCollectionId, uploadedFile, packageFile); + if (result < 0) + { + ShowResultMessage(result); + return; + } + } + catch (Exception ex) + { + ShowErrorMessage("SHAREPOINT_RESTORE_SITE", ex); + return; + } + + RedirectBack(); + } + + protected void btnRestore_Click(object sender, EventArgs e) + { + RestoreSiteCollection(); + } + + protected void btnCancel_Click(object sender, EventArgs e) + { + RedirectBack(); + } + + private void RedirectBack() + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + } + protected void radioUpload_CheckedChanged(object sender, EventArgs e) + { + ToggleControls(); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx.designer.cs new file mode 100644 index 00000000..444b7e6c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseRestoreSiteCollection.ascx.designer.cs @@ -0,0 +1,159 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointEnterpriseRestoreSiteCollection { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// litSiteCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litSiteCollectionName; + + /// + /// lblRestoreFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblRestoreFrom; + + /// + /// radioUpload control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton radioUpload; + + /// + /// radioFile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton radioFile; + + /// + /// cellUploadFile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableCell cellUploadFile; + + /// + /// uploadFile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.FileUpload uploadFile; + + /// + /// lblAllowedFiles1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblAllowedFiles1; + + /// + /// cellFile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableCell cellFile; + + /// + /// fileLookup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.FileLookup fileLookup; + + /// + /// lblAllowedFiles2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblAllowedFiles2; + + /// + /// btnRestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRestore; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx new file mode 100644 index 00000000..02e376d4 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx @@ -0,0 +1,92 @@ +<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointEnterpriseSiteCollections.ascx.cs" + Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseSiteCollections" %> +<%@ Register Src="../UserControls/SpaceServiceItems.ascx" TagName="SpaceServiceItems" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/Quota.ascx" TagName="Quota" TagPrefix="wsp" %> + +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> + + + + + +
+
+
+
+
+
+
+ + +
+
+ +
+
+ +
+
+ + + + Url + + +
+
+ + + + + + + <%# Eval("PhysicalAddress") %> + + + + + + + + + + + + + + + + + + + +
+ +     + <%----%> + +
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx.cs new file mode 100644 index 00000000..43fafca9 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx.cs @@ -0,0 +1,110 @@ +// 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.Collections; +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 System.Collections.Generic; +using WebsitePanel.Providers.SharePoint; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointEnterpriseSiteCollections : WebsitePanelModuleBase + { + + protected void Page_Load(object sender, EventArgs e) + { + this.BindStats(); + } + + private void BindStats() + { + // quota values + OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID); + OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID); + + siteCollectionsQuota.QuotaUsedValue = stats.CreatedSharePointEnterpriseSiteCollections; + siteCollectionsQuota.QuotaValue = stats.AllocatedSharePointEnterpriseSiteCollections; + if (stats.AllocatedSharePointEnterpriseSiteCollections != -1) siteCollectionsQuota.QuotaAvailable = tenantStats.AllocatedSharePointEnterpriseSiteCollections - tenantStats.CreatedSharePointEnterpriseSiteCollections; + } + + protected void btnCreateSiteCollection_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_enterprise_edit_sitecollection", "SpaceID=" + PanelSecurity.PackageId.ToString())); + } + + public string GetSiteCollectionEditUrl(string siteCollectionId) + { + return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_enterprise_edit_sitecollection", + "SiteCollectionID=" + siteCollectionId, + "ItemID=" + PanelRequest.ItemID.ToString()); + } + + protected void odsSharePointEnterpriseSiteCollectionPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) + { + if (e.Exception != null) + { + messageBox.ShowErrorMessage("HOSTEDSHAREPOINT_GET_SITECOLLECTIONS", e.Exception); + e.ExceptionHandled = true; + } + } + + protected void gvSiteCollections_RowCommand(object sender, GridViewCommandEventArgs e) + { + if (e.CommandName == "DeleteItem") + { + int siteCollectionId = Utils.ParseInt(e.CommandArgument.ToString(), 0); + + try + { + int result = ES.Services.HostedSharePointServersEnt.Enterprise_DeleteSiteCollection(siteCollectionId); + if (result < 0) + { + messageBox.ShowResultMessage(result); + return; + } + + gvSiteCollections.DataBind(); + this.BindStats(); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("HOSTEDSHAREPOINT_DELETE_SITECOLLECTION", ex); + } + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx.designer.cs new file mode 100644 index 00000000..7c4bf6b7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseSiteCollections.ascx.designer.cs @@ -0,0 +1,141 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointEnterpriseSiteCollections { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// btnCreateSiteCollection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCreateSiteCollection; + + /// + /// SearchPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SearchPanel; + + /// + /// locSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locSearch; + + /// + /// ddlSearchColumn control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlSearchColumn; + + /// + /// txtSearchValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSearchValue; + + /// + /// cmdSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + + /// + /// gvSiteCollections control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvSiteCollections; + + /// + /// odsSiteCollectionsPaged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsSiteCollectionsPaged; + + /// + /// locQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locQuota; + + /// + /// siteCollectionsQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer siteCollectionsQuota; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx new file mode 100644 index 00000000..ab641896 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx @@ -0,0 +1,62 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HostedSharePointEnterpriseStorageSettings.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseStorageSettings" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" + TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> +<%@ Register src="../UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + +
+ +
+ + +
+
+
+ +
+ + + +
+ +
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx.cs new file mode 100644 index 00000000..d2b2547b --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx.cs @@ -0,0 +1,93 @@ +// 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.EnterpriseServer; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointEnterpriseStorageSettings : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + warningValue.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); + + + if (!IsPostBack) + { + Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); + + PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); + foreach(QuotaValueInfo quota in cntx.QuotasArray) + { + if (quota.QuotaId == 551 /*Max storage quota*/) + { + maxStorageSettingsValue.ParentQuotaValue = quota.QuotaAllocatedValue; + warningValue.ParentQuotaValue = quota.QuotaAllocatedValue; + } + } + + maxStorageSettingsValue.QuotaValue = org.MaxSharePointEnterpriseStorage; + warningValue.QuotaValue = org.WarningSharePointEnterpriseStorage; + + } + } + + private void Save(bool apply) + { + try + { + int res = ES.Services.HostedSharePointServersEnt.Enterprise_SetStorageSettings(PanelRequest.ItemID, maxStorageSettingsValue.QuotaValue, + warningValue.QuotaValue, + apply); + if (res < 0) + { + messageBox.ShowResultMessage(res); + return; + } + messageBox.ShowSuccessMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); + } + catch (Exception) + { + messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); + } + + } + + protected void btnSave_Click(object sender, EventArgs e) + { + Save(false); + } + + protected void btnSaveApply_Click(object sender, EventArgs e) + { + Save(true); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx.designer.cs new file mode 100644 index 00000000..26170885 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageSettings.ascx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointEnterpriseStorageSettings { + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// secStorageLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secStorageLimits; + + /// + /// StorageLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel StorageLimits; + + /// + /// locMaxStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaxStorage; + + /// + /// maxStorageSettingsValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor maxStorageSettingsValue; + + /// + /// locWarningStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locWarningStorage; + + /// + /// warningValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor warningValue; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + + /// + /// btnSaveApply control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSaveApply; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx new file mode 100644 index 00000000..5e30898b --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx @@ -0,0 +1,57 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HostedSharePointEnterpriseStorageUsage.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointEnterpriseStorageUsage" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" + TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + +
177
100
+
+
+ + +
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx.cs new file mode 100644 index 00000000..da030e66 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx.cs @@ -0,0 +1,94 @@ +// 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.SharePoint; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointEnterpriseStorageUsage : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + BindGrid(); + } + + protected void btnRecalculateDiscSpace_Click(object sender, EventArgs e) + { + BindGrid(); + } + + private void BindGrid() + { + int errorCode; + try + { + SharePointEnterpriseSiteDiskSpace[] sharePointEnterpriseSiteDiskSpace = + ES.Services.HostedSharePointServersEnt.Enterprise_CalculateSharePointSitesDiskSpace(PanelRequest.ItemID, + out errorCode); + + + if (errorCode < 0) + { + messageBox.ShowResultMessage(errorCode); + return; + } + + if (sharePointEnterpriseSiteDiskSpace != null && sharePointEnterpriseSiteDiskSpace.Length == 1 && string.IsNullOrEmpty(sharePointEnterpriseSiteDiskSpace[0].Url)) + { + gvStorageUsage.DataSource = null; + gvStorageUsage.DataBind(); + lblTotalItems.Text = "0"; + lblTotalSize.Text = "0"; + return; + } + + gvStorageUsage.DataSource = sharePointEnterpriseSiteDiskSpace; + gvStorageUsage.DataBind(); + + if (sharePointEnterpriseSiteDiskSpace != null) + { + lblTotalItems.Text = sharePointEnterpriseSiteDiskSpace.Length.ToString(); + + long total = 0; + foreach (SharePointEnterpriseSiteDiskSpace current in sharePointEnterpriseSiteDiskSpace) + { + total += current.DiskSpace; + } + + lblTotalSize.Text = total.ToString(); + } + } + catch(Exception ex) + { + messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_RECALCULATE_SIZE", ex); + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx.designer.cs new file mode 100644 index 00000000..a91f43f8 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointEnterpriseStorageUsage.ascx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointEnterpriseStorageUsage { + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// secSiteCollectionsReport control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secSiteCollectionsReport; + + /// + /// siteCollectionsReport control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel siteCollectionsReport; + + /// + /// gvStorageUsage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvStorageUsage; + + /// + /// locTotalboxItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTotalboxItems; + + /// + /// lblTotalItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblTotalItems; + + /// + /// locTotalMailboxesSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTotalMailboxesSize; + + /// + /// lblTotalSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblTotalSize; + + /// + /// btnRecalculateDiscSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRecalculateDiscSpace; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx new file mode 100644 index 00000000..abd8ad0c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx @@ -0,0 +1,101 @@ +<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointRestoreSiteCollection.ascx.cs" + Inherits="WebsitePanel.Portal.HostedSharePointRestoreSiteCollection" %> +<%@ Register Src="../UserControls/FileLookup.ascx" TagName="FileLookup" TagPrefix="uc1" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> +6 +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> + + +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> + + + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + +
+
+  
+ + + + + + + + + + + + + + +
+ +
+ +
+ + + + + + + +
+
+
+
+ + + + + + + +
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx.cs new file mode 100644 index 00000000..de33f161 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx.cs @@ -0,0 +1,176 @@ +// 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.Collections; +using System.IO; +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.SharePoint; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointRestoreSiteCollection : WebsitePanelModuleBase + { + private int OrganizationId + { + get + { + return PanelRequest.GetInt("ItemID"); + } + } + + private int SiteCollectionId + { + get + { + return PanelRequest.GetInt("SiteCollectionID"); + } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BindSite(); + } + } + + private void BindSite() + { + try + { + SharePointSiteCollection siteCollection = ES.Services.HostedSharePointServers.GetSiteCollection(this.SiteCollectionId); + litSiteCollectionName.Text = siteCollection.PhysicalAddress; + fileLookup.SelectedFile = String.Empty; + fileLookup.PackageId = siteCollection.PackageId; + + ToggleControls(); + } + catch (Exception ex) + { + ShowErrorMessage("SHAREPOINT_GET_SITE", ex); + return; + } + } + + private void ToggleControls() + { + cellFile.Visible = radioFile.Checked; + cellUploadFile.Visible = radioUpload.Checked; + } + + private void RestoreSiteCollection() + { + try + { + string uploadedFile = null; + string packageFile = null; + + if (radioUpload.Checked) + { + if (uploadFile.PostedFile.FileName != "") + { + Stream stream = uploadFile.PostedFile.InputStream; + + // save uploaded file + int FILE_BUFFER_LENGTH = 5000000; + string path = null; + int readBytes = 0; + string fileName = Path.GetFileName(uploadFile.PostedFile.FileName); + + int offset = 0; + do + { + // read input stream + byte[] buffer = new byte[FILE_BUFFER_LENGTH]; + readBytes = stream.Read(buffer, 0, FILE_BUFFER_LENGTH); + + if (readBytes < FILE_BUFFER_LENGTH) + Array.Resize(ref buffer, readBytes); + + // write remote backup file + string tempPath = ES.Services.HostedSharePointServers.AppendBackupBinaryChunk(this.SiteCollectionId, fileName, path, buffer); + if (path == null) + path = tempPath; + + offset += FILE_BUFFER_LENGTH; + } + while (readBytes == FILE_BUFFER_LENGTH); + + uploadedFile = path; + } + } + else + { + // package files + packageFile = fileLookup.SelectedFile; + } + + int result = ES.Services.HostedSharePointServers.RestoreSiteCollection(this.SiteCollectionId, uploadedFile, packageFile); + if (result < 0) + { + ShowResultMessage(result); + return; + } + } + catch (Exception ex) + { + ShowErrorMessage("SHAREPOINT_RESTORE_SITE", ex); + return; + } + + RedirectBack(); + } + + protected void btnRestore_Click(object sender, EventArgs e) + { + RestoreSiteCollection(); + } + + protected void btnCancel_Click(object sender, EventArgs e) + { + RedirectBack(); + } + + private void RedirectBack() + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + } + protected void radioUpload_CheckedChanged(object sender, EventArgs e) + { + ToggleControls(); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx.designer.cs new file mode 100644 index 00000000..c59bec70 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointRestoreSiteCollection.ascx.designer.cs @@ -0,0 +1,159 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointRestoreSiteCollection { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// litSiteCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litSiteCollectionName; + + /// + /// lblRestoreFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblRestoreFrom; + + /// + /// radioUpload control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton radioUpload; + + /// + /// radioFile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton radioFile; + + /// + /// cellUploadFile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableCell cellUploadFile; + + /// + /// uploadFile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.FileUpload uploadFile; + + /// + /// lblAllowedFiles1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblAllowedFiles1; + + /// + /// cellFile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableCell cellFile; + + /// + /// fileLookup control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.FileLookup fileLookup; + + /// + /// lblAllowedFiles2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblAllowedFiles2; + + /// + /// btnRestore control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRestore; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx new file mode 100644 index 00000000..7a5430e3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx @@ -0,0 +1,92 @@ +<%@ Control Language="C#" AutoEventWireup="true" Codebehind="HostedSharePointSiteCollections.ascx.cs" + Inherits="WebsitePanel.Portal.HostedSharePointSiteCollections" %> +<%@ Register Src="../UserControls/SpaceServiceItems.ascx" TagName="SpaceServiceItems" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/Quota.ascx" TagName="Quota" TagPrefix="wsp" %> + +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> + + + + + +
+
+
+
+
+
+
+ + +
+
+ +
+
+ +
+
+ + + + Url + + +
+
+ + + + + + + <%# Eval("PhysicalAddress") %> + + + + + + + + + + + + + + + + + + + +
+ +     + <%----%> + +
+
+
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx.cs new file mode 100644 index 00000000..b03fd0f0 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx.cs @@ -0,0 +1,110 @@ +// 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.Collections; +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 System.Collections.Generic; +using WebsitePanel.Providers.SharePoint; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointSiteCollections : WebsitePanelModuleBase + { + + protected void Page_Load(object sender, EventArgs e) + { + this.BindStats(); + } + + private void BindStats() + { + // quota values + OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID); + OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID); + + siteCollectionsQuota.QuotaUsedValue = stats.CreatedSharePointSiteCollections; + siteCollectionsQuota.QuotaValue = stats.AllocatedSharePointSiteCollections; + if (stats.AllocatedSharePointSiteCollections != -1) siteCollectionsQuota.QuotaAvailable = tenantStats.AllocatedSharePointSiteCollections - tenantStats.CreatedSharePointSiteCollections; + } + + protected void btnCreateSiteCollection_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_edit_sitecollection", "SpaceID=" + PanelSecurity.PackageId.ToString())); + } + + public string GetSiteCollectionEditUrl(string siteCollectionId) + { + return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", + "SiteCollectionID=" + siteCollectionId, + "ItemID=" + PanelRequest.ItemID.ToString()); + } + + protected void odsSharePointSiteCollectionPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) + { + if (e.Exception != null) + { + messageBox.ShowErrorMessage("HOSTEDSHAREPOINT_GET_SITECOLLECTIONS", e.Exception); + e.ExceptionHandled = true; + } + } + + protected void gvSiteCollections_RowCommand(object sender, GridViewCommandEventArgs e) + { + if (e.CommandName == "DeleteItem") + { + int siteCollectionId = Utils.ParseInt(e.CommandArgument.ToString(), 0); + + try + { + int result = ES.Services.HostedSharePointServers.DeleteSiteCollection(siteCollectionId); + if (result < 0) + { + messageBox.ShowResultMessage(result); + return; + } + + gvSiteCollections.DataBind(); + this.BindStats(); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("HOSTEDSHAREPOINT_DELETE_SITECOLLECTION", ex); + } + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx.designer.cs new file mode 100644 index 00000000..2e8763e8 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointSiteCollections.ascx.designer.cs @@ -0,0 +1,141 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointSiteCollections { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// btnCreateSiteCollection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnCreateSiteCollection; + + /// + /// SearchPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel SearchPanel; + + /// + /// locSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locSearch; + + /// + /// ddlSearchColumn control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlSearchColumn; + + /// + /// txtSearchValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSearchValue; + + /// + /// cmdSearch control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ImageButton cmdSearch; + + /// + /// gvSiteCollections control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvSiteCollections; + + /// + /// odsSiteCollectionsPaged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsSiteCollectionsPaged; + + /// + /// locQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locQuota; + + /// + /// siteCollectionsQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaViewer siteCollectionsQuota; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx new file mode 100644 index 00000000..a4557072 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx @@ -0,0 +1,62 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HostedSharePointStorageSettings.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointStorageSettings" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" + TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> +<%@ Register src="../UserControls/QuotaEditor.ascx" tagname="QuotaEditor" tagprefix="uc1" %> + + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + +
+ +
+ + +
+
+
+ +
+ + + +
+ +
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx.cs new file mode 100644 index 00000000..52e86521 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx.cs @@ -0,0 +1,93 @@ +// 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.EnterpriseServer; +using WebsitePanel.Providers.HostedSolution; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointStorageSettings : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + warningValue.UnlimitedText = GetLocalizedString("WarningUnlimitedValue"); + + + if (!IsPostBack) + { + Organization org = ES.Services.Organizations.GetOrganization(PanelRequest.ItemID); + + PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); + foreach(QuotaValueInfo quota in cntx.QuotasArray) + { + if (quota.QuotaId == 208 /*Max storage quota*/) + { + maxStorageSettingsValue.ParentQuotaValue = quota.QuotaAllocatedValue; + warningValue.ParentQuotaValue = quota.QuotaAllocatedValue; + } + } + + maxStorageSettingsValue.QuotaValue = org.MaxSharePointStorage; + warningValue.QuotaValue = org.WarningSharePointStorage; + + } + } + + private void Save(bool apply) + { + try + { + int res = ES.Services.HostedSharePointServers.SetStorageSettings(PanelRequest.ItemID, maxStorageSettingsValue.QuotaValue, + warningValue.QuotaValue, + apply); + if (res < 0) + { + messageBox.ShowResultMessage(res); + return; + } + messageBox.ShowSuccessMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); + } + catch (Exception) + { + messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_UPDATE_QUOTAS"); + } + + } + + protected void btnSave_Click(object sender, EventArgs e) + { + Save(false); + } + + protected void btnSaveApply_Click(object sender, EventArgs e) + { + Save(true); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx.designer.cs new file mode 100644 index 00000000..04b5be91 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageSettings.ascx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointStorageSettings { + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// secStorageLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secStorageLimits; + + /// + /// StorageLimits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel StorageLimits; + + /// + /// locMaxStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMaxStorage; + + /// + /// maxStorageSettingsValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor maxStorageSettingsValue; + + /// + /// locWarningStorage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locWarningStorage; + + /// + /// warningValue control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.QuotaEditor warningValue; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + + /// + /// btnSaveApply control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSaveApply; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx new file mode 100644 index 00000000..b551a4a7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx @@ -0,0 +1,57 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HostedSharePointStorageUsage.ascx.cs" Inherits="WebsitePanel.Portal.HostedSharePointStorageUsage" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" + TagPrefix="wsp" %> +<%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" + TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/SizeBox.ascx" TagName="SizeBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" + TagPrefix="wsp" %> +<%@ Register Src="../ExchangeServer/UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + +
177
100
+
+
+ + +
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx.cs new file mode 100644 index 00000000..c18a2e4f --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx.cs @@ -0,0 +1,94 @@ +// 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.SharePoint; + +namespace WebsitePanel.Portal +{ + public partial class HostedSharePointStorageUsage : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + BindGrid(); + } + + protected void btnRecalculateDiscSpace_Click(object sender, EventArgs e) + { + BindGrid(); + } + + private void BindGrid() + { + int errorCode; + try + { + SharePointSiteDiskSpace[] sharePointSiteDiskSpace = + ES.Services.HostedSharePointServers.CalculateSharePointSitesDiskSpace(PanelRequest.ItemID, + out errorCode); + + + if (errorCode < 0) + { + messageBox.ShowResultMessage(errorCode); + return; + } + + if (sharePointSiteDiskSpace != null && sharePointSiteDiskSpace.Length == 1 && string.IsNullOrEmpty(sharePointSiteDiskSpace[0].Url)) + { + gvStorageUsage.DataSource = null; + gvStorageUsage.DataBind(); + lblTotalItems.Text = "0"; + lblTotalSize.Text = "0"; + return; + } + + gvStorageUsage.DataSource = sharePointSiteDiskSpace; + gvStorageUsage.DataBind(); + + if (sharePointSiteDiskSpace != null) + { + lblTotalItems.Text = sharePointSiteDiskSpace.Length.ToString(); + + long total = 0; + foreach (SharePointSiteDiskSpace current in sharePointSiteDiskSpace) + { + total += current.DiskSpace; + } + + lblTotalSize.Text = total.ToString(); + } + } + catch(Exception ex) + { + messageBox.ShowErrorMessage("HOSTED_SHAREPOINT_RECALCULATE_SIZE", ex); + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx.designer.cs new file mode 100644 index 00000000..4c003393 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePoint/HostedSharePointStorageUsage.ascx.designer.cs @@ -0,0 +1,114 @@ +//------------------------------------------------------------------------------ +// +// 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 { + + + public partial class HostedSharePointStorageUsage { + + /// + /// Image1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image Image1; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// secSiteCollectionsReport control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secSiteCollectionsReport; + + /// + /// siteCollectionsReport control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel siteCollectionsReport; + + /// + /// gvStorageUsage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView gvStorageUsage; + + /// + /// locTotalboxItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTotalboxItems; + + /// + /// lblTotalItems control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblTotalItems; + + /// + /// locTotalMailboxesSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTotalMailboxesSize; + + /// + /// lblTotalSize control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblTotalSize; + + /// + /// btnRecalculateDiscSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRecalculateDiscSpace; + } +} From 5703d9070c354d55eca0037302a4f5954764e845 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 7 Apr 2015 09:32:26 -0400 Subject: [PATCH 79/91] Added tag build-2.1.0.659 for changeset 5cf3e8bedc1a From 3894b40d12eff9db44047c2d9b239269c65f69fa Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Tue, 7 Apr 2015 07:13:46 -0700 Subject: [PATCH 80/91] Fixes after merge --- .../WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx | 2 +- .../DesktopModules/WebsitePanel/SpaceQuotas.ascx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx index 7bbd2597..da260eaf 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SpaceQuotas.ascx.resx @@ -211,6 +211,6 @@ Deleted Users:
- SharePoint Enterprise Sites: + SharePoint Server Sites: \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx index 1da424a9..d5260819 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SpaceQuotas.ascx @@ -75,7 +75,7 @@ - + From b2bc19c817e385c08b5c52f19c1f87ef41e0e6e8 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 7 Apr 2015 10:50:31 -0400 Subject: [PATCH 81/91] Added tag build-2.1.0.660 for changeset ed46f30e635e From 88681f444ed5f5de3910d58cc3590491c0bc9e52 Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Tue, 7 Apr 2015 21:49:03 +0300 Subject: [PATCH 82/91] wsp-10327 Add Dynamic Memory to VPS - Enterprise Part. --- WebsitePanel/Database/update_db.sql | 17 +- .../VirtualizationErrorCodes.cs | 1 + .../VirtualizationServerProxy2012.cs | 252 ++++++++++-------- .../Common/ObjectUtils.cs | 113 ++++++-- .../VirtualizationServerController2012.cs | 62 +++-- .../esVirtualizationServer2012.asmx.cs | 14 +- .../Common/PersistentAttribute.cs | 2 +- .../Virtualization/DynamicMemory.cs | 6 + .../Helpers/MemoryHelper.cs | 4 +- .../WebsitePanel_SharedResources.ascx.resx | 3 + .../DynamicMemoryControl.ascx.resx | 6 +- .../UserControls/DynamicMemoryControl.ascx.cs | 2 +- .../WebsitePanel/VPS2012/VdcCreateServer.ascx | 2 +- .../VPS2012/VdcCreateServer.ascx.cs | 5 +- .../VPS2012/VdcCreateServer.ascx.designer.cs | 9 + .../WebsitePanel/VPS2012/VdcImportServer.ascx | 15 +- .../VPS2012/VdcImportServer.ascx.cs | 5 +- .../VPS2012/VdcImportServer.ascx.designer.cs | 18 ++ .../VpsDetailsEditConfiguration.ascx.cs | 6 +- 19 files changed, 364 insertions(+), 178 deletions(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 972a6006..cdeae8e4 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -21,7 +21,10 @@ DELETE FROM HostingPlanQuotas WHERE QuotaID = 342 GO DELETE FROM HostingPlanQuotas WHERE QuotaID = 343 GO +IF NOT EXISTS (SELECT * FROM [dbo].[ResourceGroups] WHERE GroupID = 33 AND [GroupName] = 'VPS2012') +BEGIN DELETE FROM HostingPlanResources WHERE GroupID = 33 +END GO @@ -8218,17 +8221,23 @@ AS INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 3) - ELSE IF @QuotaID = 558 -- RAM of VPS - SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP + ELSE IF @QuotaID = 558 BEGIN -- RAM of VPS2012 + DECLARE @Result1 int = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID WHERE SIP.PropertyName = 'RamSize' AND PT.ParentPackageID = @PackageID) - ELSE IF @QuotaID = 559 -- HDD of VPS + DECLARE @Result2 int = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP + INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID + INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID + WHERE SIP.PropertyName = 'DynamicMemory.Maximum' AND PT.ParentPackageID = @PackageID) + SET @Result = CASE WHEN isnull(@Result1,0) > isnull(@Result2,0) THEN @Result1 ELSE @Result2 END + END + ELSE IF @QuotaID = 559 -- HDD of VPS2012 SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID WHERE SIP.PropertyName = 'HddSize' AND PT.ParentPackageID = @PackageID) - ELSE IF @QuotaID = 562 -- External IP addresses of VPS + ELSE IF @QuotaID = 562 -- External IP addresses of VPS2012 SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Virtualization/VirtualizationErrorCodes.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Virtualization/VirtualizationErrorCodes.cs index e97a8914..6ccd5695 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Virtualization/VirtualizationErrorCodes.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Virtualization/VirtualizationErrorCodes.cs @@ -39,6 +39,7 @@ public const string QUOTA_EXCEEDED_CPU = "VPS_QUOTA_EXCEEDED_CPU"; public const string QUOTA_EXCEEDED_RAM = "VPS_QUOTA_EXCEEDED_RAM"; public const string QUOTA_WRONG_RAM = "VPS_QUOTA_WRONG_RAM"; + public const string QUOTA_NOT_IN_DYNAMIC_RAM = "VPS_QUOTA_NOT_IN_DYNAMIC_RAM"; public const string QUOTA_EXCEEDED_HDD = "VPS_QUOTA_EXCEEDED_HDD"; public const string QUOTA_WRONG_HDD = "VPS_QUOTA_WRONG_HDD"; public const string QUOTA_EXCEEDED_SNAPSHOTS = "VPS_QUOTA_EXCEEDED_SNAPSHOTS"; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/VirtualizationServerProxy2012.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/VirtualizationServerProxy2012.cs index 45cfcd16..0798c760 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/VirtualizationServerProxy2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/VirtualizationServerProxy2012.cs @@ -23,7 +23,6 @@ namespace WebsitePanel.EnterpriseServer { using WebsitePanel.Providers.Virtualization; using WebsitePanel.Providers.ResultObjects; - /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute()] @@ -1105,65 +1104,6 @@ namespace WebsitePanel.EnterpriseServer { string osTemplateFile, string password, string summaryLetterEmail, - int generation, - int cpuCores, - int ramMB, - int hddGB, - int snapshots, - bool dvdInstalled, - bool bootFromCD, - bool numLock, - bool startShutdownAllowed, - bool pauseResumeAllowed, - bool rebootAllowed, - bool resetAllowed, - bool reinstallAllowed, - bool externalNetworkEnabled, - int externalAddressesNumber, - bool randomExternalAddresses, - int[] externalAddresses, - bool privateNetworkEnabled, - int privateAddressesNumber, - bool randomPrivateAddresses, - string[] privateAddresses) { - object[] results = this.Invoke("CreateVirtualMachine", new object[] { - packageId, - hostname, - osTemplateFile, - password, - summaryLetterEmail, - generation, - cpuCores, - ramMB, - hddGB, - snapshots, - dvdInstalled, - bootFromCD, - numLock, - startShutdownAllowed, - pauseResumeAllowed, - rebootAllowed, - resetAllowed, - reinstallAllowed, - externalNetworkEnabled, - externalAddressesNumber, - randomExternalAddresses, - externalAddresses, - privateNetworkEnabled, - privateAddressesNumber, - randomPrivateAddresses, - privateAddresses}); - return ((IntResult)(results[0])); - } - - /// - public System.IAsyncResult BeginCreateVirtualMachine( - int packageId, - string hostname, - string osTemplateFile, - string password, - string summaryLetterEmail, - int generation, int cpuCores, int ramMB, int hddGB, @@ -1184,15 +1124,13 @@ namespace WebsitePanel.EnterpriseServer { int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses, - System.AsyncCallback callback, - object asyncState) { - return this.BeginInvoke("CreateVirtualMachine", new object[] { + VirtualMachine otherSettings) { + object[] results = this.Invoke("CreateVirtualMachine", new object[] { packageId, hostname, osTemplateFile, password, summaryLetterEmail, - generation, cpuCores, ramMB, hddGB, @@ -1212,7 +1150,68 @@ namespace WebsitePanel.EnterpriseServer { privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, - privateAddresses}, callback, asyncState); + privateAddresses, + otherSettings}); + return ((IntResult)(results[0])); + } + + /// + public System.IAsyncResult BeginCreateVirtualMachine( + int packageId, + string hostname, + string osTemplateFile, + string password, + string summaryLetterEmail, + int cpuCores, + int ramMB, + int hddGB, + int snapshots, + bool dvdInstalled, + bool bootFromCD, + bool numLock, + bool startShutdownAllowed, + bool pauseResumeAllowed, + bool rebootAllowed, + bool resetAllowed, + bool reinstallAllowed, + bool externalNetworkEnabled, + int externalAddressesNumber, + bool randomExternalAddresses, + int[] externalAddresses, + bool privateNetworkEnabled, + int privateAddressesNumber, + bool randomPrivateAddresses, + string[] privateAddresses, + VirtualMachine otherSettings, + System.AsyncCallback callback, + object asyncState) { + return this.BeginInvoke("CreateVirtualMachine", new object[] { + packageId, + hostname, + osTemplateFile, + password, + summaryLetterEmail, + cpuCores, + ramMB, + hddGB, + snapshots, + dvdInstalled, + bootFromCD, + numLock, + startShutdownAllowed, + pauseResumeAllowed, + rebootAllowed, + resetAllowed, + reinstallAllowed, + externalNetworkEnabled, + externalAddressesNumber, + randomExternalAddresses, + externalAddresses, + privateNetworkEnabled, + privateAddressesNumber, + randomPrivateAddresses, + privateAddresses, + otherSettings}, callback, asyncState); } /// @@ -1228,38 +1227,6 @@ namespace WebsitePanel.EnterpriseServer { string osTemplateFile, string password, string summaryLetterEmail, - int generation, - int cpuCores, - int ramMB, - int hddGB, - int snapshots, - bool dvdInstalled, - bool bootFromCD, - bool numLock, - bool startShutdownAllowed, - bool pauseResumeAllowed, - bool rebootAllowed, - bool resetAllowed, - bool reinstallAllowed, - bool externalNetworkEnabled, - int externalAddressesNumber, - bool randomExternalAddresses, - int[] externalAddresses, - bool privateNetworkEnabled, - int privateAddressesNumber, - bool randomPrivateAddresses, - string[] privateAddresses) { - this.CreateVirtualMachineAsync(packageId, hostname, osTemplateFile, password, summaryLetterEmail, generation, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses, null); - } - - /// - public void CreateVirtualMachineAsync( - int packageId, - string hostname, - string osTemplateFile, - string password, - string summaryLetterEmail, - int generation, int cpuCores, int ramMB, int hddGB, @@ -1280,6 +1247,38 @@ namespace WebsitePanel.EnterpriseServer { int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses, + VirtualMachine otherSettings) { + this.CreateVirtualMachineAsync(packageId, hostname, osTemplateFile, password, summaryLetterEmail, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses, otherSettings, null); + } + + /// + public void CreateVirtualMachineAsync( + int packageId, + string hostname, + string osTemplateFile, + string password, + string summaryLetterEmail, + int cpuCores, + int ramMB, + int hddGB, + int snapshots, + bool dvdInstalled, + bool bootFromCD, + bool numLock, + bool startShutdownAllowed, + bool pauseResumeAllowed, + bool rebootAllowed, + bool resetAllowed, + bool reinstallAllowed, + bool externalNetworkEnabled, + int externalAddressesNumber, + bool randomExternalAddresses, + int[] externalAddresses, + bool privateNetworkEnabled, + int privateAddressesNumber, + bool randomPrivateAddresses, + string[] privateAddresses, + VirtualMachine otherSettings, object userState) { if ((this.CreateVirtualMachineOperationCompleted == null)) { this.CreateVirtualMachineOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateVirtualMachineOperationCompleted); @@ -1290,7 +1289,6 @@ namespace WebsitePanel.EnterpriseServer { osTemplateFile, password, summaryLetterEmail, - generation, cpuCores, ramMB, hddGB, @@ -1310,7 +1308,8 @@ namespace WebsitePanel.EnterpriseServer { privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, - privateAddresses}, this.CreateVirtualMachineOperationCompleted, userState); + privateAddresses, + otherSettings}, this.CreateVirtualMachineOperationCompleted, userState); } private void OnCreateVirtualMachineOperationCompleted(object arg) { @@ -1765,7 +1764,23 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/UpdateVirtualMachineConfiguration", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public ResultObject UpdateVirtualMachineConfiguration(int itemId, int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, bool externalNetworkEnabled, bool privateNetworkEnabled) { + public ResultObject UpdateVirtualMachineConfiguration( + int itemId, + int cpuCores, + int ramMB, + int hddGB, + int snapshots, + bool dvdInstalled, + bool bootFromCD, + bool numLock, + bool startShutdownAllowed, + bool pauseResumeAllowed, + bool rebootAllowed, + bool resetAllowed, + bool reinstallAllowed, + bool externalNetworkEnabled, + bool privateNetworkEnabled, + VirtualMachine otherSettings) { object[] results = this.Invoke("UpdateVirtualMachineConfiguration", new object[] { itemId, cpuCores, @@ -1781,7 +1796,8 @@ namespace WebsitePanel.EnterpriseServer { resetAllowed, reinstallAllowed, externalNetworkEnabled, - privateNetworkEnabled}); + privateNetworkEnabled, + otherSettings}); return ((ResultObject)(results[0])); } @@ -1802,6 +1818,7 @@ namespace WebsitePanel.EnterpriseServer { bool reinstallAllowed, bool externalNetworkEnabled, bool privateNetworkEnabled, + VirtualMachine otherSettings, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("UpdateVirtualMachineConfiguration", new object[] { @@ -1819,7 +1836,8 @@ namespace WebsitePanel.EnterpriseServer { resetAllowed, reinstallAllowed, externalNetworkEnabled, - privateNetworkEnabled}, callback, asyncState); + privateNetworkEnabled, + otherSettings}, callback, asyncState); } /// @@ -1828,11 +1846,6 @@ namespace WebsitePanel.EnterpriseServer { return ((ResultObject)(results[0])); } - /// - public void UpdateVirtualMachineConfigurationAsync(int itemId, int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, bool externalNetworkEnabled, bool privateNetworkEnabled) { - this.UpdateVirtualMachineConfigurationAsync(itemId, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, privateNetworkEnabled, null); - } - /// public void UpdateVirtualMachineConfigurationAsync( int itemId, @@ -1850,6 +1863,28 @@ namespace WebsitePanel.EnterpriseServer { bool reinstallAllowed, bool externalNetworkEnabled, bool privateNetworkEnabled, + VirtualMachine otherSettings) { + this.UpdateVirtualMachineConfigurationAsync(itemId, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, privateNetworkEnabled, otherSettings, null); + } + + /// + public void UpdateVirtualMachineConfigurationAsync( + int itemId, + int cpuCores, + int ramMB, + int hddGB, + int snapshots, + bool dvdInstalled, + bool bootFromCD, + bool numLock, + bool startShutdownAllowed, + bool pauseResumeAllowed, + bool rebootAllowed, + bool resetAllowed, + bool reinstallAllowed, + bool externalNetworkEnabled, + bool privateNetworkEnabled, + VirtualMachine otherSettings, object userState) { if ((this.UpdateVirtualMachineConfigurationOperationCompleted == null)) { this.UpdateVirtualMachineConfigurationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateVirtualMachineConfigurationOperationCompleted); @@ -1869,7 +1904,8 @@ namespace WebsitePanel.EnterpriseServer { resetAllowed, reinstallAllowed, externalNetworkEnabled, - privateNetworkEnabled}, this.UpdateVirtualMachineConfigurationOperationCompleted, userState); + privateNetworkEnabled, + otherSettings}, this.UpdateVirtualMachineConfigurationOperationCompleted, userState); } private void OnUpdateVirtualMachineConfigurationOperationCompleted(object arg) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Common/ObjectUtils.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Common/ObjectUtils.cs index 67b8a138..b8e28155 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Common/ObjectUtils.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Common/ObjectUtils.cs @@ -98,6 +98,19 @@ namespace WebsitePanel.EnterpriseServer svals[i] = ivals[i].ToString(); s = String.Join(";", svals); } + // when property is custom class with Persistent attribute + else if (prop.PropertyType.GetCustomAttributes(typeof(PersistentAttribute), false).Length > 0) + { + // add sub-class properties to hash + var childHash = GetObjectProperties(val, persistentOnly); + foreach (var hashKey in childHash.Keys) + { + var value = childHash[hashKey]; + hash.Add(prop.Name + "." + hashKey, value); + } + // exit + continue; + } else s = val.ToString(); } @@ -476,6 +489,41 @@ namespace WebsitePanel.EnterpriseServer } } + private static Hashtable GetPropertiesForCache(Type type, bool persistentOnly) + { + // create properties cache + var props = new Hashtable(); + PropertyInfo[] objProps = type.GetProperties(BindingFlags.Instance + //| BindingFlags.DeclaredOnly + | BindingFlags.Public); + foreach (PropertyInfo prop in objProps) + { + // check for persistent attribute + object[] attrs = prop.GetCustomAttributes(typeof(PersistentAttribute), false); + if (!persistentOnly || (persistentOnly && attrs.Length > 0) && !props.ContainsKey(prop.Name)) + { + // when property is custom class with Persistent attribute + if (prop.PropertyType.GetCustomAttributes(typeof (PersistentAttribute), false).Length > 0) + { + // add sub-class properties to hash + var childHash = GetPropertiesForCache(prop.PropertyType, persistentOnly); + foreach (var hashKey in childHash.Keys) + { + var value = childHash[hashKey]; + props.Add(prop.Name + "." + hashKey, value); + } + // exit + continue; + } + + // add property to hash + props.Add(prop.Name, prop); + } + } + + return props; + } + public static void CreateObjectFromHash(object obj, Hashtable propValues, bool persistentOnly) { Type type = obj.GetType(); @@ -489,21 +537,7 @@ namespace WebsitePanel.EnterpriseServer } else { - // create properties cache - props = new Hashtable(); - PropertyInfo[] objProps = type.GetProperties(BindingFlags.Instance - //| BindingFlags.DeclaredOnly - | BindingFlags.Public); - foreach (PropertyInfo prop in objProps) - { - // check for persistent attribute - object[] attrs = prop.GetCustomAttributes(typeof(PersistentAttribute), false); - if (!persistentOnly || (persistentOnly && attrs.Length > 0) && !props.ContainsKey(prop.Name)) - { - // add property to hash - props.Add(prop.Name, prop); - } - } + props = GetPropertiesForCache(type, persistentOnly); if (!propertiesCache.ContainsKey(type.Name)) { @@ -518,38 +552,63 @@ namespace WebsitePanel.EnterpriseServer // try to locate specified property if (props[propName] != null) { + PropertyInfo prop = (PropertyInfo)props[propName]; + string val = propValues[propName].ToString(); + var currentObj = obj; + + // when property is custom class with Persistent attribute + if (propName.Contains(".")) + { + var mainPropertyName = propName.Split('.')[0]; + var childPropertyName = propName.Split('.')[1]; + + var mainProperty = type.GetProperty(mainPropertyName); + if (mainProperty == null) continue; + + var mainVal = mainProperty.GetValue(obj, null); + if (mainVal == null) + { + mainVal = Activator.CreateInstance(mainProperty.PropertyType); + mainProperty.SetValue(obj, mainVal, null); + } + currentObj = mainVal; + + var childProperty = mainProperty.PropertyType.GetProperty(childPropertyName); + if (childProperty == null) continue; + prop = childProperty; + } + // set property // we support: // String // Int32 // Boolean // Float - PropertyInfo prop = (PropertyInfo)props[propName]; - string val = propValues[propName].ToString(); + if (prop.PropertyType == typeof(String)) - prop.SetValue(obj, val, null); + prop.SetValue(currentObj, val, null); else if (prop.PropertyType == typeof(Int32)) - prop.SetValue(obj, Int32.Parse(val), null); + prop.SetValue(currentObj, Int32.Parse(val), null); else if (prop.PropertyType == typeof(long)) - prop.SetValue(obj, long.Parse(val), null); + prop.SetValue(currentObj, long.Parse(val), null); else if (prop.PropertyType == typeof(Boolean)) - prop.SetValue(obj, Boolean.Parse(val), null); + prop.SetValue(currentObj, Boolean.Parse(val), null); else if (prop.PropertyType == typeof(Single)) - prop.SetValue(obj, Single.Parse(val), null); + prop.SetValue(currentObj, Single.Parse(val), null); else if (prop.PropertyType.IsEnum) - prop.SetValue(obj, Enum.Parse(prop.PropertyType, val, true), null); + prop.SetValue(currentObj, Enum.Parse(prop.PropertyType, val, true), null); else if (prop.PropertyType == typeof(Guid)) - prop.SetValue(obj, new Guid(val), null); + prop.SetValue(currentObj, new Guid(val), null); else if (prop.PropertyType == typeof(string[])) { if (val == "") - prop.SetValue(obj, new string[0], null); + prop.SetValue(currentObj, new string[0], null); else - prop.SetValue(obj, val.Split(';'), null); + prop.SetValue(currentObj, val.Split(';'), null); } else if (prop.PropertyType == typeof(int[])) { @@ -562,7 +621,7 @@ namespace WebsitePanel.EnterpriseServer if (val == "") ivals = new int[0]; - prop.SetValue(obj, ivals, null); + prop.SetValue(currentObj, ivals, null); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization2012/VirtualizationServerController2012.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization2012/VirtualizationServerController2012.cs index 40a599ab..8f4402e7 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization2012/VirtualizationServerController2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization2012/VirtualizationServerController2012.cs @@ -254,8 +254,6 @@ namespace WebsitePanel.EnterpriseServer return res; } - int generation = 1; - // CPU cores int cpuCores = cntx.Quotas[Quotas.VPS2012_CPU_NUMBER].QuotaAllocatedValue; if (cpuCores == -1) // unlimited is not possible @@ -309,20 +307,20 @@ namespace WebsitePanel.EnterpriseServer // create server and return result return CreateVirtualMachine(packageId, hostname, osTemplate, password, summaryLetterEmail, - generation, cpuCores, ramMB, hddGB, snapshots, + cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, - privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses); + privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses, new VirtualMachine()); } public static IntResult CreateVirtualMachine(int packageId, string hostname, string osTemplateFile, string password, string summaryLetterEmail, - int generation, int cpuCores, int ramMB, int hddGB, int snapshots, + int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, bool externalNetworkEnabled, int externalAddressesNumber, bool randomExternalAddresses, int[] externalAddresses, - bool privateNetworkEnabled, int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses) + bool privateNetworkEnabled, int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses, VirtualMachine otherSettings) { // result object IntResult res = new IntResult(); @@ -368,10 +366,20 @@ namespace WebsitePanel.EnterpriseServer List quotaResults = new List(); PackageContext cntx = PackageController.GetPackageContext(packageId); + // dynamic memory + var newRam = ramMB; + if (otherSettings.DynamicMemory != null && otherSettings.DynamicMemory.Enabled) + { + newRam = otherSettings.DynamicMemory.Maximum; + + if (ramMB > otherSettings.DynamicMemory.Maximum || ramMB < otherSettings.DynamicMemory.Minimum) + quotaResults.Add(VirtualizationErrorCodes.QUOTA_NOT_IN_DYNAMIC_RAM); + } + CheckListsQuota(cntx, quotaResults, Quotas.VPS2012_SERVERS_NUMBER, VirtualizationErrorCodes.QUOTA_EXCEEDED_SERVERS_NUMBER); CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_CPU_NUMBER, cpuCores, VirtualizationErrorCodes.QUOTA_EXCEEDED_CPU); - CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_RAM, ramMB, VirtualizationErrorCodes.QUOTA_EXCEEDED_RAM); + CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_RAM, newRam, VirtualizationErrorCodes.QUOTA_EXCEEDED_RAM); CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_HDD, hddGB, VirtualizationErrorCodes.QUOTA_EXCEEDED_HDD); CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_SNAPSHOTS_NUMBER, snapshots, VirtualizationErrorCodes.QUOTA_EXCEEDED_SNAPSHOTS); @@ -458,7 +466,7 @@ namespace WebsitePanel.EnterpriseServer vm.CurrentTaskId = Guid.NewGuid().ToString("N"); // generate creation task id vm.ProvisioningStatus = VirtualMachineProvisioningStatus.InProgress; - vm.Generation = generation; + vm.Generation = otherSettings.Generation; vm.CpuCores = cpuCores; vm.RamSize = ramMB; vm.HddSize = hddGB; @@ -472,6 +480,12 @@ namespace WebsitePanel.EnterpriseServer vm.ResetAllowed = resetAllowed; vm.ReinstallAllowed = reinstallAllowed; + // dynamic memory + if (otherSettings.DynamicMemory != null && otherSettings.DynamicMemory.Enabled) + vm.DynamicMemory = otherSettings.DynamicMemory; + else + vm.DynamicMemory = null; + // networking vm.ExternalNetworkEnabled = externalNetworkEnabled; vm.PrivateNetworkEnabled = privateNetworkEnabled; @@ -1192,8 +1206,10 @@ namespace WebsitePanel.EnterpriseServer item.Name = vm.Name; item.ProvisioningStatus = VirtualMachineProvisioningStatus.OK; + item.Generation = vm.Generation; item.CpuCores = vm.CpuCores; item.RamSize = vm.RamSize; + item.DynamicMemory = vm.DynamicMemory; item.HddSize = vm.HddSize; item.VirtualHardDrivePath = vm.VirtualHardDrivePath; item.RootFolderPath = Path.GetDirectoryName(vm.VirtualHardDrivePath); @@ -1947,11 +1963,7 @@ namespace WebsitePanel.EnterpriseServer #endregion #region VPS – Edit Configuration - public static ResultObject UpdateVirtualMachineConfiguration(int itemId, int cpuCores, int ramMB, int hddGB, int snapshots, - bool dvdInstalled, bool bootFromCD, bool numLock, - bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, - bool externalNetworkEnabled, - bool privateNetworkEnabled) + public static ResultObject UpdateVirtualMachineConfiguration(int itemId, int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, bool externalNetworkEnabled, bool privateNetworkEnabled, VirtualMachine otherSettings) { ResultObject res = new ResultObject(); @@ -1978,8 +1990,22 @@ namespace WebsitePanel.EnterpriseServer List quotaResults = new List(); PackageContext cntx = PackageController.GetPackageContext(vm.PackageId); + var currentRam = vm.RamSize; + var newRam = ramMB; + + // dynamic memory + if (vm.DynamicMemory != null && vm.DynamicMemory.Enabled) + currentRam = vm.DynamicMemory.Maximum; + if (otherSettings.DynamicMemory != null && otherSettings.DynamicMemory.Enabled) + { + newRam = otherSettings.DynamicMemory.Maximum; + + if (ramMB > otherSettings.DynamicMemory.Maximum || ramMB < otherSettings.DynamicMemory.Minimum) + quotaResults.Add(VirtualizationErrorCodes.QUOTA_NOT_IN_DYNAMIC_RAM); + } + CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_CPU_NUMBER, cpuCores, VirtualizationErrorCodes.QUOTA_EXCEEDED_CPU); - CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_RAM, vm.RamSize, ramMB, VirtualizationErrorCodes.QUOTA_EXCEEDED_RAM); + CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_RAM, currentRam, newRam, VirtualizationErrorCodes.QUOTA_EXCEEDED_RAM); CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_HDD, vm.HddSize, hddGB, VirtualizationErrorCodes.QUOTA_EXCEEDED_HDD); CheckNumericQuota(cntx, quotaResults, Quotas.VPS2012_SNAPSHOTS_NUMBER, snapshots, VirtualizationErrorCodes.QUOTA_EXCEEDED_SNAPSHOTS); @@ -2058,7 +2084,7 @@ namespace WebsitePanel.EnterpriseServer vm.RamSize = ramMB; vm.HddSize = hddGB; vm.SnapshotsNumber = snapshots; - + vm.BootFromCD = bootFromCD; vm.NumLockEnabled = numLock; vm.DvdDriveInstalled = dvdInstalled; @@ -2072,6 +2098,12 @@ namespace WebsitePanel.EnterpriseServer vm.ExternalNetworkEnabled = externalNetworkEnabled; vm.PrivateNetworkEnabled = privateNetworkEnabled; + // dynamic memory + if (otherSettings.DynamicMemory != null && otherSettings.DynamicMemory.Enabled) + vm.DynamicMemory = otherSettings.DynamicMemory; + else + vm.DynamicMemory = null; + // load service settings StringDictionary settings = ServerController.GetServiceSettings(vm.ServiceId); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer2012.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer2012.asmx.cs index bd486169..79bfecbf 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer2012.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer2012.asmx.cs @@ -186,17 +186,17 @@ namespace WebsitePanel.EnterpriseServer [WebMethod] public IntResult CreateVirtualMachine(int packageId, string hostname, string osTemplateFile, string password, string summaryLetterEmail, - int generation, int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, + int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, bool externalNetworkEnabled, int externalAddressesNumber, bool randomExternalAddresses, int[] externalAddresses, - bool privateNetworkEnabled, int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses) + bool privateNetworkEnabled, int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses, VirtualMachine otherSettings) { return VirtualizationServerController2012.CreateVirtualMachine(packageId, hostname, osTemplateFile, password, summaryLetterEmail, - generation, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, + cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, - privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses); + privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses, otherSettings); } #endregion @@ -278,14 +278,14 @@ namespace WebsitePanel.EnterpriseServer bool dvdInstalled, bool bootFromCD, bool numLock, bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, bool externalNetworkEnabled, - bool privateNetworkEnabled) + bool privateNetworkEnabled, VirtualMachine otherSettings) { return VirtualizationServerController2012.UpdateVirtualMachineConfiguration( itemId, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, - externalNetworkEnabled, - privateNetworkEnabled); + externalNetworkEnabled, privateNetworkEnabled, + otherSettings); } #endregion diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Common/PersistentAttribute.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Common/PersistentAttribute.cs index 1f3b7108..232b90bd 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Common/PersistentAttribute.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Common/PersistentAttribute.cs @@ -30,7 +30,7 @@ using System; namespace WebsitePanel.Providers { - [AttributeUsage(AttributeTargets.Property)] + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)] public class PersistentAttribute : Attribute { public PersistentAttribute() diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/DynamicMemory.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/DynamicMemory.cs index 91b91a08..64b23a64 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/DynamicMemory.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/DynamicMemory.cs @@ -31,16 +31,22 @@ namespace WebsitePanel.Providers.Virtualization { + [Persistent] public class DynamicMemory { + [Persistent] public bool Enabled { get; set; } + [Persistent] public int Minimum { get; set; } + [Persistent] public int Maximum { get; set; } + [Persistent] public int Buffer { get; set; } + [Persistent] public int Priority { get; set; } // Weight } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/MemoryHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/MemoryHelper.cs index e999b0c4..035da473 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/MemoryHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/MemoryHelper.cs @@ -25,8 +25,8 @@ namespace WebsitePanel.Providers.Virtualization info.Enabled = result[0].GetBool("DynamicMemoryEnabled"); info.Minimum = Convert.ToInt32(result[0].GetLong("Minimum") / Constants.Size1M); info.Maximum = Convert.ToInt32(result[0].GetLong("Maximum") / Constants.Size1M); - info.Buffer = Convert.ToInt32(result[0].GetInt("Buffer") / Constants.Size1M); - info.Priority = Convert.ToInt32(result[0].GetInt("Priority") / Constants.Size1M); + info.Buffer = Convert.ToInt32(result[0].GetInt("Buffer")); + info.Priority = Convert.ToInt32(result[0].GetInt("Priority")); } return info; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 56ba857f..046c66ef 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -4262,6 +4262,9 @@ RAM size must be a positive number and greater than zero + + RAM size must be between the minimum and maximum of the dynamic memory + Snapshots must be a positive number and greater than zero diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx index 2e9c22f9..8ddc22e8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/App_LocalResources/DynamicMemoryControl.ascx.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Minimum RAM: + Minimum RAM, Mb: Minimum memory must be a whole number @@ -145,10 +145,10 @@ Enter the buffer - Buffer (%): + Buffer, %: - Maximum RAM: + Maximum RAM, Mb: Weight (Priority): diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs index e2344882..1ee4fc95 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/UserControls/DynamicMemoryControl.ascx.cs @@ -82,7 +82,7 @@ namespace WebsitePanel.Portal.VPS2012.UserControls if (string.IsNullOrEmpty(text)) return 0; - return Int32.Parse(txtMinimum.Text); + return Int32.Parse(text); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx index 9719b3a9..058854d5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx @@ -193,7 +193,7 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs index 0427461b..ad7cdbb3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.cs @@ -338,12 +338,13 @@ namespace WebsitePanel.Portal.VPS2012 // create virtual machine IntResult res = ES.Services.VPS2012.CreateVirtualMachine(PanelSecurity.PackageId, hostname, listOperatingSystems.SelectedValue, adminPassword, summaryEmail, - virtualMachine.Generation, Utils.ParseInt(ddlCpu.SelectedValue), Utils.ParseInt(txtRam.Text.Trim()), + 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, chkExternalNetworkEnabled.Checked, Utils.ParseInt(txtExternalAddressesNumber.Text.Trim()), radioExternalRandom.Checked, extIps.ToArray(), - chkPrivateNetworkEnabled.Checked, Utils.ParseInt(txtPrivateAddressesNumber.Text.Trim()), radioPrivateRandom.Checked, privIps); + chkPrivateNetworkEnabled.Checked, Utils.ParseInt(txtPrivateAddressesNumber.Text.Trim()), radioPrivateRandom.Checked, privIps, + virtualMachine); if (res.IsSuccess) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs index e7a1f597..4baed83d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcCreateServer.ascx.designer.cs @@ -381,6 +381,15 @@ namespace WebsitePanel.Portal.VPS2012 { /// protected global::System.Web.UI.WebControls.Localize locGB; + /// + /// DynamicMemorySetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemorySetting; + /// /// secSnapshots control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx index c9e4f6e5..65b9f276 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx @@ -6,6 +6,8 @@ <%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> <%@ Register Src="../UserControls/CheckBoxOption.ascx" TagName="CheckBoxOption" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" TagName="Generation" Src="UserControls/Generation.ascx" %> +<%@ Register TagPrefix="wsp" TagName="DynamicMemoryControl" Src="UserControls/DynamicMemoryControl.ascx" %> @@ -114,11 +116,12 @@ + - - @@ -126,7 +129,7 @@ - @@ -134,7 +137,7 @@ - @@ -142,13 +145,15 @@ -
+ +
+
+
+
+ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx.cs index 11a4c795..a9a41098 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx.cs @@ -33,7 +33,8 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using WebsitePanel.EnterpriseServer; -using WebsitePanel.Providers.Virtualization; +using WebsitePanel.Portal.Code.Helpers; +using WebsitePanel.Providers.Virtualization; using WebsitePanel.Providers.ResultObjects; namespace WebsitePanel.Portal.VPS2012 @@ -126,6 +127,8 @@ namespace WebsitePanel.Portal.VPS2012 HddSize.Text = vm.HddSize.ToString(); VhdPath.Text = vm.VirtualHardDrivePath; + this.BindSettingsControls(vm); + // other settings NumLockEnabled.Value = vm.NumLockEnabled; BootFromCd.Value = vm.BootFromCD; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx.designer.cs index 6b29702f..eb489aea 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VdcImportServer.ascx.designer.cs @@ -246,6 +246,15 @@ namespace WebsitePanel.Portal.VPS2012 { ///
protected global::System.Web.UI.WebControls.Panel ConfigurationPanel; + /// + /// GenerationSetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.Generation GenerationSetting; + /// /// locCPU control. /// @@ -318,6 +327,15 @@ namespace WebsitePanel.Portal.VPS2012 { ///
protected global::System.Web.UI.WebControls.Literal VhdPath; + /// + /// DynamicMemorySetting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.VPS2012.UserControls.DynamicMemoryControl DynamicMemorySetting; + /// /// secBios control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx.cs index 34530902..21ccc0c6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS2012/VpsDetailsEditConfiguration.ascx.cs @@ -137,6 +137,9 @@ namespace WebsitePanel.Portal.VPS2012 protected void btnUpdate_Click(object sender, EventArgs e) { + if (!Page.IsValid) + return; + try { // check rights @@ -165,7 +168,8 @@ namespace WebsitePanel.Portal.VPS2012 chkReset.Checked, chkReinstall.Checked, chkExternalNetworkEnabled.Checked, - chkPrivateNetworkEnabled.Checked); + chkPrivateNetworkEnabled.Checked, + virtualMachine); if (res.IsSuccess) { From 45d98481a5fddfbd87331702708165eb2b5ac2c8 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 7 Apr 2015 16:09:23 -0400 Subject: [PATCH 83/91] Added tag build-2.1.0.661 for changeset 1e66da07a6b2 From 774fda95aad297f144d213021862d1dd20ae772a Mon Sep 17 00:00:00 2001 From: robvde Date: Wed, 8 Apr 2015 14:52:30 +0800 Subject: [PATCH 84/91] Fix up release build to include sp2103ent provider Fix up link to enterprise site collection on organization home --- ...bsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj | 2 +- .../WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj index 0d80844d..145d2914 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj @@ -24,7 +24,7 @@ pdbonly true - bin\Release\ + ..\WebsitePanel.Server\bin\Sharepoint2013Ent\ TRACE prompt 4 diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs index d582425b..24dc9ebc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationHome.ascx.cs @@ -254,7 +254,7 @@ namespace WebsitePanel.Portal.ExchangeServer { sharePointEnterpriseStatsPanel.Visible = true; - lnkSiteCollections.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_enterprise_sitecollections", + lnkEnterpriseSiteCollections.NavigateUrl = EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_enterprise_sitecollections", "SpaceID=" + PanelSecurity.PackageId); enterpriseSiteCollectionsStats.QuotaUsedValue = orgStats.CreatedSharePointEnterpriseSiteCollections; enterpriseSiteCollectionsStats.QuotaValue = orgStats.AllocatedSharePointEnterpriseSiteCollections; From 70d7ddf19ccc700d908eb01d3c44de3e35a392b6 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 8 Apr 2015 03:08:16 -0400 Subject: [PATCH 85/91] Added tag build-2.1.0.662 for changeset 25dab9baa1c4 From c6a27f02e8ac83e86e99f2957fac603dd02a9dfd Mon Sep 17 00:00:00 2001 From: robvde Date: Wed, 8 Apr 2015 16:41:48 +0800 Subject: [PATCH 86/91] Fixed up Sp 2013 Enterprise Provider Fixup itemtype in database Moved provider to sharepoint2013 folder Updated the GetPackageRawPaged --- WebsitePanel/Database/update_db.sql | 3 +++ .../HostedSolution/OrganizationController.cs | 2 +- .../SharePoint/HostedSharePointServerController.cs | 2 +- .../SharePoint/HostedSharePointServerEntController.cs | 2 +- ...itePanel.Providers.HostedSolution.SharePoint2013Ent.csproj | 4 ++-- .../Sources/WebsitePanel.Server/WebsitePanel.Server.csproj | 4 ++-- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 6d18f699..32d72c41 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9503,3 +9503,6 @@ BEGIN END GO + +UPDATE [dbo].[ServiceItemTypes] SET TypeName ='WebsitePanel.Providers.SharePoint.SharePointEnterpriseSiteCollection, WebsitePanel.Providers.Base' WHERE DisplayName = 'SharePointEnterpriseSiteCollection' +GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 5bb15cef..acd5f507 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -1078,7 +1078,7 @@ namespace WebsitePanel.EnterpriseServer if (cntxTmp.Groups.ContainsKey(ResourceGroups.SharepointEnterpriseServer)) { - SharePointSiteCollectionListPaged sharePointStats = HostedSharePointServerController.GetSiteCollectionsPaged(org.PackageId, o.Id, string.Empty, string.Empty, string.Empty, 0, 0); + SharePointEnterpriseSiteCollectionListPaged sharePointStats = HostedSharePointServerEntController.GetSiteCollectionsPaged(org.PackageId, o.Id, string.Empty, string.Empty, string.Empty, 0, 0); stats.CreatedSharePointEnterpriseSiteCollections += sharePointStats.TotalRowCount; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs index 90d87927..6dfe1bd3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs @@ -69,7 +69,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } SharePointSiteCollectionListPaged paged = new SharePointSiteCollectionListPaged(); - DataSet result = PackageController.GetRawPackageItemsPaged(packageId, "Sharepoint Foundation Server", typeof(SharePointSiteCollection), + DataSet result = PackageController.GetRawPackageItemsPaged(packageId, ResourceGroups.SharepointFoundationServer, typeof(SharePointSiteCollection), true, filterColumn, filterValue, sortColumn, startRow, Int32.MaxValue); List items = PackageController.CreateServiceItemsList(result, 1).ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs index 94020e38..c15bcb58 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerEntController.cs @@ -69,7 +69,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } SharePointEnterpriseSiteCollectionListPaged paged = new SharePointEnterpriseSiteCollectionListPaged(); - DataSet result = PackageController.GetRawPackageItemsPaged(packageId, "Sharepoint Enterprise Server", typeof(SharePointEnterpriseSiteCollection), + DataSet result = PackageController.GetRawPackageItemsPaged(packageId, ResourceGroups.SharepointEnterpriseServer, typeof(SharePointEnterpriseSiteCollection), true, filterColumn, filterValue, sortColumn, startRow, Int32.MaxValue); List items = PackageController.CreateServiceItemsList(result, 1).ConvertAll(delegate(ServiceProviderItem item) { return (SharePointEnterpriseSiteCollection)item; }); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj index 145d2914..88440ff3 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent/WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj @@ -16,7 +16,7 @@ true full false - ..\WebsitePanel.Server\bin\Sharepoint2013Ent\ + ..\WebsitePanel.Server\bin\Sharepoint2013\ DEBUG;TRACE prompt 4 @@ -24,7 +24,7 @@ pdbonly true - ..\WebsitePanel.Server\bin\Sharepoint2013Ent\ + ..\WebsitePanel.Server\bin\Sharepoint2013\ TRACE prompt 4 diff --git a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj index 2c8eda9a..029e25a2 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Server/WebsitePanel.Server.csproj @@ -157,10 +157,10 @@ - - + + From 9e024213664e5fc5296fe42362e454ea24a09bf7 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 8 Apr 2015 08:00:30 -0400 Subject: [PATCH 87/91] Added tag build-2.1.0.663 for changeset c6fbf3742b18 From 4a1cfce0e93d927c4e40c58e157487b9f1f5ee00 Mon Sep 17 00:00:00 2001 From: robvde Date: Thu, 9 Apr 2015 09:46:17 +0800 Subject: [PATCH 88/91] Restore SP 2013 enterprise provider to solution --- WebsitePanel/Sources/WebsitePanel.Server.sln | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Server.sln b/WebsitePanel/Sources/WebsitePanel.Server.sln index c5af78c6..b06fa4e6 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.sln +++ b/WebsitePanel/Sources/WebsitePanel.Server.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching Application Block", "Caching Application Block", "{C8E6F2E4-A5B8-486A-A56E-92D864524682}" ProjectSection(SolutionItems) = preProject @@ -152,6 +152,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Mail EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Virtualization.HyperV2012R2", "WebsitePanel.Providers.Virtualization.HyperV-2012R2\WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj", "{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.HostedSolution.SharePoint2013Ent", "WebsitePanel.Providers.HostedSolution.SharePoint2013Ent\WebsitePanel.Providers.HostedSolution.SharePoint2013Ent.csproj", "{0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -762,6 +764,16 @@ Global {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.Build.0 = Release|Any CPU {EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|x86.ActiveCfg = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Debug|x86.ActiveCfg = Debug|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|Any CPU.Build.0 = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {0CF0C19E-7BFE-4A61-AF00-7B7CE7264252}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 414414b11d648f68c2737be508b4112281b68a52 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 8 Apr 2015 22:46:16 -0400 Subject: [PATCH 89/91] Added tag build-2.1.0.664 for changeset a69ec3136828 From 3feba6e7ecefc8f93f235e1efa5cfd01f9a24912 Mon Sep 17 00:00:00 2001 From: Olov Karlsson Date: Tue, 14 Apr 2015 11:53:16 +0200 Subject: [PATCH 90/91] IceWarp fixes and improvements --- .../IceWarp.cs | 476 +++++++++++------- .../MailAccountsEditAccount.ascx.cs | 1 + .../IceWarp_EditAccount.ascx.cs | 2 +- 3 files changed, 287 insertions(+), 192 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs index a4fe06aa..43c2c9a4 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Mail.IceWarp/IceWarp.cs @@ -31,6 +31,7 @@ using System.IO; using System.Net.Mail; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using Microsoft.Win32; @@ -38,15 +39,15 @@ using WebsitePanel.Server.Utils; namespace WebsitePanel.Providers.Mail { - public class IceWarp : HostingServiceProviderBase, IMailServer + public class IceWarp : HostingServiceProviderBase, IMailServer, IDisposable { protected const string API_PROGID = "IceWarpServer.APIObject"; protected const string DOMAIN_PROGID = "IceWarpServer.DomainObject"; protected const string ACCOUNT_PROGID = "IceWarpServer.AccountObject"; - + private dynamic _currentApiObject = null; - #region IceWarp Enums + #region Protected Enums protected enum IceWarpErrorCode { @@ -109,8 +110,8 @@ namespace WebsitePanel.Providers.Mail get { var apiObject = GetApiObject(); - var adresses = ((object) apiObject.GetProperty("C_System_Services_BindIPAddress")); - return adresses == null ? "" : adresses.ToString().Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); + var adresses = ((object)apiObject.GetProperty("C_System_Services_BindIPAddress")); + return adresses == null ? "" : adresses.ToString().Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); } } @@ -119,7 +120,7 @@ namespace WebsitePanel.Providers.Mail get { var apiObject = GetApiObject(); - return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_UseDiskQuota")); + return Convert.ToBoolean((object)apiObject.GetProperty("C_Accounts_Global_Domains_UseDiskQuota")); } } @@ -128,7 +129,7 @@ namespace WebsitePanel.Providers.Mail get { var apiObject = GetApiObject(); - return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_UseDomainLimits")); + return Convert.ToBoolean((object)apiObject.GetProperty("C_Accounts_Global_Domains_UseDomainLimits")); } } @@ -137,7 +138,7 @@ namespace WebsitePanel.Providers.Mail get { var apiObject = GetApiObject(); - return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_UseUserLimits")); + return Convert.ToBoolean((object)apiObject.GetProperty("C_Accounts_Global_Domains_UseUserLimits")); } } @@ -146,7 +147,7 @@ namespace WebsitePanel.Providers.Mail get { var apiObject = GetApiObject(); - return Convert.ToBoolean((object) apiObject.GetProperty("C_Accounts_Global_Domains_OverrideGlobal")); + return Convert.ToBoolean((object)apiObject.GetProperty("C_Accounts_Global_Domains_OverrideGlobal")); } } @@ -155,16 +156,16 @@ namespace WebsitePanel.Providers.Mail get { var apiObject = GetApiObject(); - return Convert.ToInt32((object) apiObject.GetProperty("C_Mail_SMTP_Delivery_MaxMsgSize"))/1024/1024; + return Convert.ToInt32((object)apiObject.GetProperty("C_Mail_SMTP_Delivery_MaxMsgSize")) / 1024 / 1024; } } - + protected int WarnMailboxUsage { get { var apiObject = GetApiObject(); - return Convert.ToInt32((object)apiObject.GetProperty("C_Accounts_Global_Domains_WarnMailboxUsage")); + return Convert.ToInt32((object)apiObject.GetProperty("C_Accounts_Global_Domains_WarnMailboxUsage")); } } @@ -176,7 +177,7 @@ namespace WebsitePanel.Providers.Mail return Convert.ToInt32((object)apiObject.GetProperty("C_Accounts_Global_Domains_WarnDomainSize")); } } - + private void SaveApiSetting(dynamic apiObject) { @@ -194,7 +195,7 @@ namespace WebsitePanel.Providers.Mail protected static string GetErrorMessage(int errorCode) { - switch ((IceWarpErrorCode) errorCode) + switch ((IceWarpErrorCode)errorCode) { case IceWarpErrorCode.S_OK: return "OK"; @@ -248,6 +249,11 @@ namespace WebsitePanel.Providers.Mail } } + protected void DisposeObject(object obj) + { + Marshal.FinalReleaseComObject(obj); + } + protected dynamic GetApiObject() { if (_currentApiObject != null) return _currentApiObject; @@ -386,6 +392,8 @@ namespace WebsitePanel.Providers.Mail } } + DisposeObject(accountObject); + return mailAccounts.ToArray(); } @@ -399,7 +407,7 @@ namespace WebsitePanel.Providers.Mail apiObject.SetProperty("C_Accounts_Global_Domains_WarnMailboxUsage", ProviderSettings["WarnMailboxUsage"]); apiObject.SetProperty("C_Accounts_Global_Domains_WarnDomainSize", ProviderSettings["WarnDomainSize"]); - apiObject.SetProperty("C_Mail_SMTP_Delivery_MaxMsgSize", Convert.ToInt32(ProviderSettings["MaxMessageSize"])*1024*1024); + apiObject.SetProperty("C_Mail_SMTP_Delivery_MaxMsgSize", Convert.ToInt32(ProviderSettings["MaxMessageSize"]) * 1024 * 1024); apiObject.SetProperty("C_Mail_SMTP_Delivery_LimitMsgSize", Convert.ToInt32(ProviderSettings["MaxMessageSize"]) > 0); SaveApiSetting(apiObject); @@ -407,11 +415,11 @@ namespace WebsitePanel.Providers.Mail #endregion - #region IHostingServiceProvier methods + #region IHostingServiceProvier methods - public override SettingPair[] GetProviderDefaultSettings() - { - var settings = new [] + public override SettingPair[] GetProviderDefaultSettings() + { + var settings = new[] { new SettingPair("UseDomainDiskQuota", UseDomainDiskQuota.ToString()), new SettingPair("UseDomainLimits", UseDomainLimits.ToString()), @@ -423,8 +431,8 @@ namespace WebsitePanel.Providers.Mail new SettingPair("ServerIpAddress", BindIpAddress) }; - return settings; - } + return settings; + } public override string[] Install() { @@ -433,25 +441,25 @@ namespace WebsitePanel.Providers.Mail } public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled) - { - foreach (var item in items.OfType()) - { - try - { - // enable/disable mail domain - if (DomainExists(item.Name)) - { - var mailDomain = GetDomain(item.Name); - mailDomain.Enabled = enabled; - UpdateDomain(mailDomain); - } - } - catch (Exception ex) - { - Log.WriteError(String.Format("Error switching '{0}' IceWarp domain", item.Name), ex); - } - } - } + { + foreach (var item in items.OfType()) + { + try + { + // enable/disable mail domain + if (DomainExists(item.Name)) + { + var mailDomain = GetDomain(item.Name); + mailDomain.Enabled = enabled; + UpdateDomain(mailDomain); + } + } + catch (Exception ex) + { + Log.WriteError(String.Format("Error switching '{0}' IceWarp domain", item.Name), ex); + } + } + } public override void DeleteServiceItems(ServiceProviderItem[] items) { @@ -470,64 +478,69 @@ namespace WebsitePanel.Providers.Mail } public override ServiceProviderItemDiskSpace[] GetServiceItemsDiskSpace(ServiceProviderItem[] items) - { - var itemsDiskspace = new List(); + { + var itemsDiskspace = new List(); + + var accountObject = GetAccountObject(); - // update items with diskspace - foreach (var item in items.OfType()) - { - try - { - Log.WriteStart(String.Format("Calculating mail account '{0}' size", item.Name)); - // calculate disk space - var accountObject = GetAccountObject(item.Name); - var size = Convert.ToInt64((object)accountObject.GetProperty("U_MailboxSize")) * 1024; + // update items with diskspace + foreach (var item in items.OfType()) + { + try + { + Log.WriteStart(String.Format("Calculating mail account '{0}' size", item.Name)); + // calculate disk space + accountObject.Open(item.Name); + var size = Convert.ToInt64((object)accountObject.GetProperty("U_MailboxSize")) * 1024; - var diskspace = new ServiceProviderItemDiskSpace {ItemId = item.Id, DiskSpace = size}; - itemsDiskspace.Add(diskspace); - Log.WriteEnd(String.Format("Calculating mail account '{0}' size", item.Name)); - } - catch (Exception ex) - { - Log.WriteError(ex); - } - } - return itemsDiskspace.ToArray(); - } + var diskspace = new ServiceProviderItemDiskSpace { ItemId = item.Id, DiskSpace = size }; + itemsDiskspace.Add(diskspace); - public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since) - { - var itemsBandwidth = new ServiceProviderItemBandwidth[items.Length]; + Log.WriteEnd(String.Format("Calculating mail account '{0}' size", item.Name)); + } + catch (Exception ex) + { + Log.WriteError(ex); + } + } - // update items with diskspace - for (int i = 0; i < items.Length; i++) - { - ServiceProviderItem item = items[i]; + DisposeObject(accountObject); - // create new bandwidth object - itemsBandwidth[i] = new ServiceProviderItemBandwidth - { - ItemId = item.Id, + return itemsDiskspace.ToArray(); + } + + public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since) + { + var itemsBandwidth = new ServiceProviderItemBandwidth[items.Length]; + + // update items with bandwidth + for (var i = 0; i < items.Length; i++) + { + var item = items[i]; + + // create new bandwidth object + itemsBandwidth[i] = new ServiceProviderItemBandwidth + { + ItemId = item.Id, Days = new DailyStatistics[0] - }; + }; - if (item is MailDomain) - { - try - { - // get daily statistics - itemsBandwidth[i].Days = GetDailyStatistics(since, item.Name); - } - catch (Exception ex) - { - Log.WriteError(ex); - System.Diagnostics.Debug.WriteLine(ex); - } - } - } + if (!(item is MailDomain)) continue; - return itemsBandwidth; - } + try + { + // get daily statistics + itemsBandwidth[i].Days = GetDailyStatistics(since, item.Name); + } + catch (Exception ex) + { + Log.WriteError(ex); + System.Diagnostics.Debug.WriteLine(ex); + } + } + + return itemsBandwidth; + } public DailyStatistics[] GetDailyStatistics(DateTime since, string maildomainName) { @@ -565,11 +578,11 @@ namespace WebsitePanel.Providers.Mail case '*': var dailyStats = new DailyStatistics { - Year = date.Year, - Month = date.Month, - Day = date.Day, - BytesSent = Convert.ToInt64(fields[mailSentField])*1024, - BytesReceived = Convert.ToInt64(fields[mailReceivedField])*1024 + Year = date.Year, + Month = date.Month, + Day = date.Day, + BytesSent = Convert.ToInt64(fields[mailSentField]) * 1024, + BytesReceived = Convert.ToInt64(fields[mailReceivedField]) * 1024 }; days.Add(dailyStats); continue; @@ -618,7 +631,7 @@ namespace WebsitePanel.Providers.Mail // Checking for version 10.4.0 (released 2012-03-21) or newer // This version introduced L_ListFile_Contents, G_ListFile_Contents and M_ListFileContents that is the latest API variable used by this provider - var split = version.Split(new[] {'.'}); + var split = version.Split(new[] { '.' }); var majorVersion = Convert.ToInt32(split[0]); var minVersion = Convert.ToInt32(split[1]); @@ -636,32 +649,34 @@ namespace WebsitePanel.Providers.Mail public string[] GetDomains() { var api = GetApiObject(); - return api.GetDomainList().Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries); + return api.GetDomainList().Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } public MailDomain GetDomain(string domainName) { - var domain = GetDomainObject(domainName); + var domainObject = GetDomainObject(domainName); var mailDomain = new MailDomain { - Name = domain.Name, - PostmasterAccount = domain.GetProperty("D_AdminEmail"), - CatchAllAccount = domain.GetProperty("D_UnknownForwardTo"), - Enabled = Convert.ToBoolean((object) domain.GetProperty("D_DisableLogin")), - MaxDomainSizeInMB = Convert.ToInt32((object) domain.GetProperty("D_DiskQuota"))/1024, - MaxDomainUsers = Convert.ToInt32((object) domain.GetProperty("D_AccountNumber")), - MegaByteSendLimit = Convert.ToInt32((object) domain.GetProperty("D_VolumeLimit"))/1024, - NumberSendLimit = Convert.ToInt32((object) domain.GetProperty("D_NumberLimit")), - DefaultUserQuotaInMB = Convert.ToInt32((object) domain.GetProperty("D_UserMailbox"))/1024, - DefaultUserMaxMessageSizeMegaByte = Convert.ToInt32((object) domain.GetProperty("D_UserMsg"))/1024, - DefaultUserMegaByteSendLimit = Convert.ToInt32((object) domain.GetProperty("D_UserMB")), - DefaultUserNumberSendLimit = Convert.ToInt32((object) domain.GetProperty("D_UserNumber")), + Name = domainObject.Name, + PostmasterAccount = domainObject.GetProperty("D_AdminEmail"), + CatchAllAccount = domainObject.GetProperty("D_UnknownForwardTo"), + Enabled = Convert.ToBoolean((object)domainObject.GetProperty("D_DisableLogin")), + MaxDomainSizeInMB = Convert.ToInt32((object)domainObject.GetProperty("D_DiskQuota")) / 1024, + MaxDomainUsers = Convert.ToInt32((object)domainObject.GetProperty("D_AccountNumber")), + MegaByteSendLimit = Convert.ToInt32((object)domainObject.GetProperty("D_VolumeLimit")) / 1024, + NumberSendLimit = Convert.ToInt32((object)domainObject.GetProperty("D_NumberLimit")), + DefaultUserQuotaInMB = Convert.ToInt32((object)domainObject.GetProperty("D_UserMailbox")) / 1024, + DefaultUserMaxMessageSizeMegaByte = Convert.ToInt32((object)domainObject.GetProperty("D_UserMsg")) / 1024, + DefaultUserMegaByteSendLimit = Convert.ToInt32((object)domainObject.GetProperty("D_UserMB")), + DefaultUserNumberSendLimit = Convert.ToInt32((object)domainObject.GetProperty("D_UserNumber")), UseDomainDiskQuota = Convert.ToBoolean(ProviderSettings["UseDomainDiskQuota"]), UseDomainLimits = Convert.ToBoolean(ProviderSettings["UseDomainLimits"]), UseUserLimits = Convert.ToBoolean(ProviderSettings["UseUserLimits"]) }; + DisposeObject(domainObject); + return mailDomain; } @@ -685,6 +700,8 @@ namespace WebsitePanel.Providers.Mail SaveDomain(domainObject); + DisposeObject(domainObject); + UpdateDomain(domain); } @@ -706,17 +723,19 @@ namespace WebsitePanel.Providers.Mail } domainObject.SetProperty("D_DisableLogin", !domain.Enabled); - domainObject.SetProperty("D_DiskQuota", domain.MaxDomainSizeInMB*1024); + domainObject.SetProperty("D_DiskQuota", domain.MaxDomainSizeInMB * 1024); domainObject.SetProperty("D_AccountNumber", domain.MaxDomainUsers); - domainObject.SetProperty("D_VolumeLimit", domain.MegaByteSendLimit*1024); + domainObject.SetProperty("D_VolumeLimit", domain.MegaByteSendLimit * 1024); domainObject.SetProperty("D_NumberLimit", domain.NumberSendLimit); - domainObject.SetProperty("D_UserMailbox", domain.DefaultUserQuotaInMB*1024); - domainObject.SetProperty("D_UserMsg", domain.DefaultUserMaxMessageSizeMegaByte*1024); + domainObject.SetProperty("D_UserMailbox", domain.DefaultUserQuotaInMB * 1024); + domainObject.SetProperty("D_UserMsg", domain.DefaultUserMaxMessageSizeMegaByte * 1024); domainObject.SetProperty("D_UserMB", domain.DefaultUserMegaByteSendLimit); domainObject.SetProperty("D_UserNumber", domain.DefaultUserNumberSendLimit); SaveDomain(domainObject); + + DisposeObject(domainObject); } public void DeleteDomain(string domainName) @@ -732,6 +751,8 @@ namespace WebsitePanel.Providers.Mail { Log.WriteError("Could not delete domain" + GetErrorMessage(domainObject.LastErr), null); } + + DisposeObject(domainObject); } #endregion @@ -747,7 +768,11 @@ namespace WebsitePanel.Providers.Mail var domainObject = GetDomainObject(aliasName); - return Convert.ToInt32((object) domainObject.GetProperty("D_Type")) == 2 && string.Compare(domainObject.GetProperty("D_DomainValue").ToString(), domainName, true) == 0; + var result = Convert.ToInt32((object)domainObject.GetProperty("D_Type")) == 2 && string.Compare(domainObject.GetProperty("D_DomainValue").ToString(), domainName, true) == 0; + + DisposeObject(domainObject); + + return result; } public string[] GetDomainAliases(string domainName) @@ -772,13 +797,15 @@ namespace WebsitePanel.Providers.Mail public void AddDomainAlias(string domainName, string aliasName) { - var mailDomain = new MailDomain {Name = aliasName}; + var mailDomain = new MailDomain { Name = aliasName }; CreateDomain(mailDomain); var domainObject = GetDomainObject(aliasName); domainObject.SetProperty("D_Type", 2); domainObject.SetProperty("D_DomainValue", domainName); SaveDomain(domainObject); + + DisposeObject(domainObject); } public void DeleteDomainAlias(string domainName, string aliasName) @@ -794,7 +821,11 @@ namespace WebsitePanel.Providers.Mail { var accountObject = GetAccountObject(); - return accountObject.Open(mailboxName) && Convert.ToInt32((object) accountObject.GetProperty("U_Type")) == (int) IceWarpAccountType.User; + var result = accountObject.Open(mailboxName) && Convert.ToInt32((object)accountObject.GetProperty("U_Type")) == (int)IceWarpAccountType.User; + + DisposeObject(accountObject); + + return result; } protected class IceWarpResponderContent @@ -840,35 +871,35 @@ namespace WebsitePanel.Providers.Mail return result; } - protected static MailAccount CreateMailAccountFromAccountObject(dynamic accountObject) + protected MailAccount CreateMailAccountFromAccountObject(dynamic accountObject) { var mailAccount = new MailAccount { Name = accountObject.EmailAddress, FullName = accountObject.GetProperty("U_Name"), - Enabled = Convert.ToInt32((object) accountObject.GetProperty("U_AccountDisabled")) == 0, - ForwardingEnabled = !string.IsNullOrWhiteSpace(accountObject.GetProperty("U_ForwardTo")) || string.IsNullOrWhiteSpace(accountObject.GetProperty("U_RemoteAddress")) && Convert.ToBoolean((object) accountObject.GetProperty("U_UseRemoteAddress")), - IsDomainAdmin = Convert.ToBoolean((object) accountObject.GetProperty("U_DomainAdmin")), - MaxMailboxSize = Convert.ToBoolean((object) accountObject.GetProperty("U_MaxBox")) ? Convert.ToInt32((object) accountObject.GetProperty("U_MaxBoxSize"))/1024 : 0, + Enabled = Convert.ToInt32((object)accountObject.GetProperty("U_AccountDisabled")) == 0, + ForwardingEnabled = !string.IsNullOrWhiteSpace(accountObject.GetProperty("U_ForwardTo")) || string.IsNullOrWhiteSpace(accountObject.GetProperty("U_RemoteAddress")) && Convert.ToBoolean((object)accountObject.GetProperty("U_UseRemoteAddress")), + IsDomainAdmin = Convert.ToBoolean((object)accountObject.GetProperty("U_DomainAdmin")), + MaxMailboxSize = Convert.ToBoolean((object)accountObject.GetProperty("U_MaxBox")) ? Convert.ToInt32((object)accountObject.GetProperty("U_MaxBoxSize")) / 1024 : 0, Password = accountObject.GetProperty("U_Password"), - ResponderEnabled = Convert.ToInt32((object) accountObject.GetProperty("U_Respond")) > 0, - QuotaUsed = Convert.ToInt64((object) accountObject.GetProperty("U_MailBoxSize")), - MaxMessageSizeMegaByte = Convert.ToInt32((object) accountObject.GetProperty("U_MaxMessageSize"))/1024, - MegaByteSendLimit = Convert.ToInt32((object) accountObject.GetProperty("U_MegabyteSendLimit")), - NumberSendLimit = Convert.ToInt32((object) accountObject.GetProperty("U_NumberSendLimit")), - DeleteOlder = Convert.ToBoolean((object) accountObject.GetProperty("U_DeleteOlder")), - DeleteOlderDays = Convert.ToInt32((object) accountObject.GetProperty("U_DeleteOlderDays")), - ForwardOlder = Convert.ToBoolean((object) accountObject.GetProperty("U_ForwardOlder")), - ForwardOlderDays = Convert.ToInt32((object) accountObject.GetProperty("U_ForwardOlderDays")), + ResponderEnabled = Convert.ToInt32((object)accountObject.GetProperty("U_Respond")) > 0, + QuotaUsed = Convert.ToInt64((object)accountObject.GetProperty("U_MailBoxSize")), + MaxMessageSizeMegaByte = Convert.ToInt32((object)accountObject.GetProperty("U_MaxMessageSize")) / 1024, + MegaByteSendLimit = Convert.ToInt32((object)accountObject.GetProperty("U_MegabyteSendLimit")), + NumberSendLimit = Convert.ToInt32((object)accountObject.GetProperty("U_NumberSendLimit")), + DeleteOlder = Convert.ToBoolean((object)accountObject.GetProperty("U_DeleteOlder")), + DeleteOlderDays = Convert.ToInt32((object)accountObject.GetProperty("U_DeleteOlderDays")), + ForwardOlder = Convert.ToBoolean((object)accountObject.GetProperty("U_ForwardOlder")), + ForwardOlderDays = Convert.ToInt32((object)accountObject.GetProperty("U_ForwardOlderDays")), ForwardOlderTo = accountObject.GetProperty("U_ForwardOlderTo"), - IceWarpAccountState = Convert.ToInt32((object) accountObject.GetProperty("U_AccountDisabled")), - IceWarpAccountType = Convert.ToInt32((object) accountObject.GetProperty("U_AccountType")), - IceWarpRespondType = Convert.ToInt32((object) accountObject.GetProperty("U_Respond")) + IceWarpAccountState = Convert.ToInt32((object)accountObject.GetProperty("U_AccountDisabled")), + IceWarpAccountType = Convert.ToInt32((object)accountObject.GetProperty("U_AccountType")), + IceWarpRespondType = Convert.ToInt32((object)accountObject.GetProperty("U_Respond")) }; if (mailAccount.ForwardingEnabled) { - mailAccount.ForwardingAddresses = new string[] {accountObject.GetProperty("U_ForwardTo") + accountObject.GetProperty("U_RemoteAddress")}; + mailAccount.ForwardingAddresses = new string[] { accountObject.GetProperty("U_ForwardTo") + accountObject.GetProperty("U_RemoteAddress") }; mailAccount.DeleteOnForward = Convert.ToInt32(accountObject.GetProperty("U_UseRemoteAddress")) == 1; mailAccount.RetainLocalCopy = !mailAccount.DeleteOnForward; } @@ -889,7 +920,7 @@ namespace WebsitePanel.Providers.Mail mailAccount.RespondTo = respondTo; } - mailAccount.RespondPeriodInDays = Convert.ToInt32((object) accountObject.GetProperty("U_RespondPeriod")); + mailAccount.RespondPeriodInDays = Convert.ToInt32((object)accountObject.GetProperty("U_RespondPeriod")); var responderContent = ParseResponderContent(accountObject.GetProperty("U_ResponderContent")); mailAccount.ResponderMessage = responderContent.Content; mailAccount.ResponderSubject = responderContent.Subject; @@ -907,7 +938,11 @@ namespace WebsitePanel.Providers.Mail public MailAccount GetAccount(string mailboxName) { var accountObject = GetAccountObject(mailboxName); - return CreateMailAccountFromAccountObject(accountObject); + var account = CreateMailAccountFromAccountObject(accountObject); + + DisposeObject(accountObject); + + return account; } public void CreateAccount(MailAccount mailbox) @@ -924,10 +959,12 @@ namespace WebsitePanel.Providers.Mail if (accountObject.New(mailbox.Name)) { + accountObject.SetProperty("U_Password", mailbox.Password); accountObject.Save(); + UpdateAccount(mailbox); } - UpdateAccount(mailbox); + DisposeObject(accountObject); } public void UpdateAccount(MailAccount mailbox) @@ -937,10 +974,15 @@ namespace WebsitePanel.Providers.Mail accountObject.SetProperty("U_Name", mailbox.FullName); accountObject.SetProperty("U_AccountDisabled", mailbox.IceWarpAccountState); accountObject.SetProperty("U_DomainAdmin", mailbox.IsDomainAdmin); - accountObject.SetProperty("U_Password", mailbox.Password); - accountObject.SetProperty("U_MaxBoxSize", mailbox.MaxMailboxSize*1024); + + if (mailbox.ChangePassword) + { + accountObject.SetProperty("U_Password", mailbox.Password); + } + + accountObject.SetProperty("U_MaxBoxSize", mailbox.MaxMailboxSize * 1024); accountObject.SetProperty("U_MaxBox", mailbox.MaxMailboxSize > 0 ? "1" : "0"); - accountObject.SetProperty("U_MaxMessageSize", mailbox.MaxMessageSizeMegaByte*1024); + accountObject.SetProperty("U_MaxMessageSize", mailbox.MaxMessageSizeMegaByte * 1024); accountObject.SetProperty("U_MegabyteSendLimit", mailbox.MegaByteSendLimit); accountObject.SetProperty("U_NumberSendLimit", mailbox.NumberSendLimit); accountObject.SetProperty("U_AccountType", mailbox.IceWarpAccountType); @@ -1000,6 +1042,8 @@ namespace WebsitePanel.Providers.Mail } SaveAccount(accountObject); + + DisposeObject(accountObject); } public void DeleteAccount(string mailboxName) @@ -1014,6 +1058,8 @@ namespace WebsitePanel.Providers.Mail { Log.WriteError("Cannot delete account: " + GetErrorMessage(accountObject.LastErr), null); } + + DisposeObject(accountObject); } #endregion @@ -1024,7 +1070,11 @@ namespace WebsitePanel.Providers.Mail { var accountObject = GetAccountObject(); - return accountObject.Open(mailAliasName); + var result = accountObject.Open(mailAliasName); + + DisposeObject(accountObject); + + return result; } protected IEnumerable GetAliasListFromAccountObject(dynamic accountObject) @@ -1056,12 +1106,14 @@ namespace WebsitePanel.Providers.Mail { var forwardTo = GetForwardToAddressFromAccountObject(accountObject); var aliases = GetAliasListFromAccountObject(accountObject) as IEnumerable; - aliasList.AddRange(aliases.Where(a => a + "@" + domainName != forwardTo).Select(alias => new MailAlias {Name = alias + "@" + domainName, ForwardTo = forwardTo})); + aliasList.AddRange(aliases.Where(a => a + "@" + domainName != forwardTo).Select(alias => new MailAlias { Name = alias + "@" + domainName, ForwardTo = forwardTo })); } accountObject.FindDone(); } + DisposeObject(accountObject); + return aliasList.ToArray(); } @@ -1071,7 +1123,11 @@ namespace WebsitePanel.Providers.Mail var forwardTo = GetForwardToAddressFromAccountObject(accountObject); - return new MailAlias {ForwardTo = forwardTo, Name = mailAliasName}; + var result = new MailAlias { ForwardTo = forwardTo, Name = mailAliasName }; + + DisposeObject(accountObject); + + return result; } public void CreateMailAlias(MailAlias mailAlias) @@ -1081,23 +1137,25 @@ namespace WebsitePanel.Providers.Mail { mailAlias.ForwardingEnabled = true; mailAlias.DeleteOnForward = true; - mailAlias.ForwardingAddresses = new[] {mailAlias.ForwardTo}; + mailAlias.ForwardingAddresses = new[] { mailAlias.ForwardTo }; mailAlias.Password = GetRandomPassword(); CreateAccount(mailAlias); } - // else open account and add alias to list + // else open account and add alias to list else { - var accountOject = GetAccountObject(mailAlias.ForwardTo); - var aliases = ((IEnumerable) GetAliasListFromAccountObject(accountOject)).ToList(); + var accountObject = GetAccountObject(mailAlias.ForwardTo); + var aliases = ((IEnumerable)GetAliasListFromAccountObject(accountObject)).ToList(); aliases.Add(GetEmailUser(mailAlias.Name)); - accountOject.SetProperty("U_EmailAlias", string.Join(";", aliases)); + accountObject.SetProperty("U_EmailAlias", string.Join(";", aliases)); - SaveAccount(accountOject, "account when creating mail alias"); + SaveAccount(accountObject, "account when creating mail alias"); + + DisposeObject(accountObject); } } - private string GetRandowChars(string chars, int length) + private static string GetRandowChars(string chars, int length) { var random = new Random(); return new string(Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)]).ToArray()); @@ -1111,8 +1169,8 @@ namespace WebsitePanel.Providers.Mail var nonAlphaNum = apiObject.GetProperty("C_Accounts_Policies_Pass_NonAlphaNum"); var alpha = apiObject.GetProperty("C_Accounts_Policies_Pass_Alpha"); - return System.Web.Security.Membership.GeneratePassword(minLength, nonAlphaNum) + - GetRandowChars("0123456789", digits)+ + return System.Web.Security.Membership.GeneratePassword(minLength, nonAlphaNum) + + GetRandowChars("0123456789", digits) + GetRandowChars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", alpha); } @@ -1137,11 +1195,13 @@ namespace WebsitePanel.Providers.Mail accountObject.SetProperty("U_EmailAlias", string.Join(";", otherAliases)); SaveAccount(accountObject, "account during alias delete"); } - // If no other aliases, this should be an account with a remote address and then we should delete the account + // If no other aliases, this should be an account with a remote address and then we should delete the account else { DeleteAccount(mailAliasName); } + + DisposeObject(accountObject); } #endregion @@ -1152,7 +1212,11 @@ namespace WebsitePanel.Providers.Mail { var accountObject = GetAccountObject(); - return accountObject.Open(groupName) && Convert.ToInt32(accountObject.GetProperty("U_Type")) == 7; + var result = accountObject.Open(groupName) && (IceWarpAccountType)Enum.Parse(typeof(IceWarpAccountType), ((object)accountObject.GetProperty("U_Type")).ToString()) == IceWarpAccountType.UserGroup; + + DisposeObject(accountObject); + + return result; } public MailGroup[] GetGroups(string domainName) @@ -1165,7 +1229,7 @@ namespace WebsitePanel.Providers.Mail var mailGroup = new MailGroup { Name = accountObject.EmailAddress, - Enabled = Convert.ToInt32((object) accountObject.GetProperty("U_AccountDisabled")) == 0, + Enabled = Convert.ToInt32((object)accountObject.GetProperty("U_AccountDisabled")) == 0, GroupName = accountObject.GetProperty("G_Name"), Members = ((IEnumerable)SplitFileContents(accountObject, "G_ListFile_Contents")).ToArray() }; @@ -1176,7 +1240,11 @@ namespace WebsitePanel.Providers.Mail public MailGroup GetGroup(string groupName) { var accountObject = GetAccountObject(groupName); - return CreateMailGroupFromAccountObject(accountObject); + var result = CreateMailGroupFromAccountObject(accountObject); + + DisposeObject(accountObject); + + return result; } public void CreateGroup(MailGroup @group) @@ -1185,7 +1253,7 @@ namespace WebsitePanel.Providers.Mail if (accountObject.New(group.Name)) { - accountObject.SetProperty("U_Type", 7); + accountObject.SetProperty("U_Type", IceWarpAccountType.UserGroup); accountObject.SetProperty("G_GroupwareMailDelivery", false); SaveAccount(accountObject, "group account"); } @@ -1195,6 +1263,8 @@ namespace WebsitePanel.Providers.Mail } UpdateGroup(group); + + DisposeObject(accountObject); } public void UpdateGroup(MailGroup @group) @@ -1206,6 +1276,8 @@ namespace WebsitePanel.Providers.Mail accountObject.SetProperty("G_ListFile_Contents", string.Join("\n", group.Members)); SaveAccount(accountObject, "group"); + + DisposeObject(accountObject); } public void DeleteGroup(string groupName) @@ -1220,6 +1292,8 @@ namespace WebsitePanel.Providers.Mail { Log.WriteError("Cannot delete group: " + GetErrorMessage(accountObject.LastErr), null); } + + DisposeObject(accountObject); } #endregion @@ -1230,7 +1304,11 @@ namespace WebsitePanel.Providers.Mail { var accountObject = GetAccountObject(); - return accountObject.Open(maillistName) && (IceWarpAccountType) Enum.Parse(typeof (IceWarpAccountType), ((object) accountObject.GetProperty("U_Type")).ToString()) == IceWarpAccountType.MailingList; + var result = accountObject.Open(maillistName) && (IceWarpAccountType)Enum.Parse(typeof(IceWarpAccountType), ((object)accountObject.GetProperty("U_Type")).ToString()) == IceWarpAccountType.MailingList; + + DisposeObject(accountObject); + + return result; } public MailList[] GetLists(string domainName) @@ -1240,8 +1318,8 @@ namespace WebsitePanel.Providers.Mail protected IEnumerable SplitStringProperty(dynamic accountObject, string propertyName, char separator) { - var value = (object) accountObject.GetProperty(propertyName); - return value == null ? new String[] {} : value.ToString().Split(new[] {separator}, StringSplitOptions.RemoveEmptyEntries); + var value = (object)accountObject.GetProperty(propertyName); + return value == null ? new String[] { } : value.ToString().Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries); } protected IEnumerable SplitFileContents(dynamic accountObject, string propertyName) @@ -1262,43 +1340,43 @@ namespace WebsitePanel.Providers.Mail Name = accountObject.EmailAddress, Description = accountObject.GetProperty("M_Name"), ModeratorAddress = accountObject.GetProperty("M_OwnerAddress"), - MembersSource = (IceWarpListMembersSource) Enum.Parse(typeof (IceWarpListMembersSource), ((object) accountObject.GetProperty("M_SendAllLists")).ToString()), - Members = ((IEnumerable)SplitFileContents(accountObject, "M_ListFile_Contents")).Select(m => m.TrimEnd(new[] {';', '0', '1', '2'})).ToArray(), - SetReceipientsToToHeader = Convert.ToBoolean((object) accountObject.GetProperty("M_SeparateTo")), + MembersSource = (IceWarpListMembersSource)Enum.Parse(typeof(IceWarpListMembersSource), ((object)accountObject.GetProperty("M_SendAllLists")).ToString()), + Members = ((IEnumerable)SplitFileContents(accountObject, "M_ListFile_Contents")).Select(m => m.TrimEnd(new[] { ';', '0', '1', '2' })).ToArray(), + SetReceipientsToToHeader = Convert.ToBoolean((object)accountObject.GetProperty("M_SeparateTo")), SubjectPrefix = accountObject.GetProperty("M_AddToSubject"), - Originator = (IceWarpListOriginator) Enum.Parse(typeof (IceWarpListOriginator), ((object) accountObject.GetProperty("M_ListSender")).ToString()), - PostingMode = Convert.ToBoolean((object) accountObject.GetProperty("M_MembersOnly")) ? PostingMode.MembersCanPost : PostingMode.AnyoneCanPost, - PasswordProtection = (PasswordProtection) Enum.Parse(typeof (PasswordProtection), ((object) accountObject.GetProperty("M_Moderated")).ToString()), + Originator = (IceWarpListOriginator)Enum.Parse(typeof(IceWarpListOriginator), ((object)accountObject.GetProperty("M_ListSender")).ToString()), + PostingMode = Convert.ToBoolean((object)accountObject.GetProperty("M_MembersOnly")) ? PostingMode.MembersCanPost : PostingMode.AnyoneCanPost, + PasswordProtection = (PasswordProtection)Enum.Parse(typeof(PasswordProtection), ((object)accountObject.GetProperty("M_Moderated")).ToString()), Password = accountObject.GetProperty("M_ModeratedPassword"), - DefaultRights = (IceWarpListDefaultRights) Enum.Parse(typeof (IceWarpListDefaultRights), ((object) accountObject.GetProperty("M_DefaultRights")).ToString()), - MaxMessageSizeEnabled = Convert.ToBoolean((object) accountObject.GetProperty("M_MaxList")), - MaxMessageSize = Convert.ToInt32((object) accountObject.GetProperty("M_MaxListSize")), - MaxMembers = Convert.ToInt32((object) accountObject.GetProperty("M_MaxMembers")), - SendToSender = Convert.ToBoolean((object) accountObject.GetProperty("M_SendToSender")), - DigestMode = Convert.ToBoolean((object) accountObject.GetProperty("M_DigestConfirmed")), - MaxMessagesPerMinute = Convert.ToInt32((object) accountObject.GetProperty("M_ListBatch")), - SendSubscribe = Convert.ToBoolean((object) accountObject.GetProperty("M_NotifyJoin")), - SendUnsubscribe = Convert.ToBoolean((object) accountObject.GetProperty("M_NotifyLeave")), + DefaultRights = (IceWarpListDefaultRights)Enum.Parse(typeof(IceWarpListDefaultRights), ((object)accountObject.GetProperty("M_DefaultRights")).ToString()), + MaxMessageSizeEnabled = Convert.ToBoolean((object)accountObject.GetProperty("M_MaxList")), + MaxMessageSize = Convert.ToInt32((object)accountObject.GetProperty("M_MaxListSize")), + MaxMembers = Convert.ToInt32((object)accountObject.GetProperty("M_MaxMembers")), + SendToSender = Convert.ToBoolean((object)accountObject.GetProperty("M_SendToSender")), + DigestMode = Convert.ToBoolean((object)accountObject.GetProperty("M_DigestConfirmed")), + MaxMessagesPerMinute = Convert.ToInt32((object)accountObject.GetProperty("M_ListBatch")), + SendSubscribe = Convert.ToBoolean((object)accountObject.GetProperty("M_NotifyJoin")), + SendUnsubscribe = Convert.ToBoolean((object)accountObject.GetProperty("M_NotifyLeave")), // From list server account - ConfirmSubscription = (IceWarpListConfirmSubscription) Enum.Parse(typeof (IceWarpListConfirmSubscription), ((object) listServerAccountObject.GetProperty("L_DigestConfirmed")).ToString()), - CommandsInSubject = Convert.ToBoolean((object) listServerAccountObject.GetProperty("L_ListSubject")), - DisableSubscribecommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_JoinR")), - AllowUnsubscribe = Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_LeaveR")), - DisableListcommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_ListsR")), - DisableWhichCommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_WhichR")), - DisableReviewCommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_ReviewR")), - DisableVacationCommand = !Convert.ToBoolean((object) listServerAccountObject.GetProperty("M_VacationR")), - Moderated = Convert.ToBoolean((object) listServerAccountObject.GetProperty("L_Moderated")), + ConfirmSubscription = (IceWarpListConfirmSubscription)Enum.Parse(typeof(IceWarpListConfirmSubscription), ((object)listServerAccountObject.GetProperty("L_DigestConfirmed")).ToString()), + CommandsInSubject = Convert.ToBoolean((object)listServerAccountObject.GetProperty("L_ListSubject")), + DisableSubscribecommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_JoinR")), + AllowUnsubscribe = Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_LeaveR")), + DisableListcommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_ListsR")), + DisableWhichCommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_WhichR")), + DisableReviewCommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_ReviewR")), + DisableVacationCommand = !Convert.ToBoolean((object)listServerAccountObject.GetProperty("M_VacationR")), + Moderated = Convert.ToBoolean((object)listServerAccountObject.GetProperty("L_Moderated")), CommandPassword = listServerAccountObject.GetProperty("L_ModeratedPassword"), - SuppressCommandResponses = Convert.ToBoolean((object) listServerAccountObject.GetProperty("L_MaxList")) + SuppressCommandResponses = Convert.ToBoolean((object)listServerAccountObject.GetProperty("L_MaxList")) }; // This is how I get values for from and replyto header values. TODO: There must be a better way, but I don't see the pattern right now... - var ss = Convert.ToInt32((object) accountObject.GetProperty("M_SetSender")); - var sv = Convert.ToInt32((object) accountObject.GetProperty("M_SetValue")); - var vm = Convert.ToBoolean((object) accountObject.GetProperty("M_ValueMode")); + var ss = Convert.ToInt32((object)accountObject.GetProperty("M_SetSender")); + var sv = Convert.ToInt32((object)accountObject.GetProperty("M_SetValue")); + var vm = Convert.ToBoolean((object)accountObject.GetProperty("M_ValueMode")); var value = accountObject.GetProperty("M_HeaderValue"); switch (ss) @@ -1363,13 +1441,19 @@ namespace WebsitePanel.Providers.Mail break; } + DisposeObject(listServerAccountObject); + return mailList; } public MailList GetList(string maillistName) { var accountObject = GetAccountObject(maillistName); - return CreateMailListFromAccountObject(accountObject); + var result = CreateMailListFromAccountObject(accountObject); + + DisposeObject(accountObject); + + return result; } public void CreateList(MailList maillist) @@ -1395,6 +1479,8 @@ namespace WebsitePanel.Providers.Mail SaveAccount(accountObject, "mailing list"); UpdateList(maillist); + + DisposeObject(accountObject); } protected dynamic FindMatchingListServerAccount(string mailingListName, bool createListServerAccountIfNeeded) @@ -1555,7 +1641,7 @@ namespace WebsitePanel.Providers.Mail listServerAccountObject.SetProperty("L_ListSender", maillist.Originator); listServerAccountObject.SetProperty("L_MaxList", maillist.SuppressCommandResponses); - SaveAccount(accountObject, "listserver account associated with mailing list"); + SaveAccount(listServerAccountObject, "listserver account associated with mailing list"); } public void DeleteList(string maillistName) @@ -1602,8 +1688,16 @@ namespace WebsitePanel.Providers.Mail { Log.WriteError("Cannot delete mail list: " + GetErrorMessage(accountObject.LastErr), null); } + + DisposeObject(accountObject); + DisposeObject(listServerAccountObject); } #endregion + + public void Dispose() + { + Marshal.FinalReleaseComObject(_currentApiObject); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailAccountsEditAccount.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailAccountsEditAccount.ascx.cs index bc1bdca0..019e0b95 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailAccountsEditAccount.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailAccountsEditAccount.ascx.cs @@ -153,6 +153,7 @@ namespace WebsitePanel.Portal if (maxMailboxSizeLimit == -1 || maxMailboxSizeLimit == 0) { MaxMailboxSizeLimitValidator.Enabled = false; + CompareValidator1.Enabled = false; } else { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.cs index 858cb7d4..d6915278 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/IceWarp_EditAccount.ascx.cs @@ -43,6 +43,7 @@ namespace WebsitePanel.Portal.ProviderControls secForwarding.Visible = (PanelRequest.ItemID > 0); OlderMailsPanel.Visible = (PanelRequest.ItemID > 0); secOlderMails.Visible = (PanelRequest.ItemID > 0); + Utils.SelectListItem(ddlAccountType, "1"); // Set default account type to POP3 & IMAP } public void BindItem(MailAccount item) @@ -108,7 +109,6 @@ namespace WebsitePanel.Portal.ProviderControls item.ForwardingAddresses = Utils.ParseDelimitedString(txtForward.Text, ';', ' ', ','); item.DeleteOnForward = cbDeleteOnForward.Checked; item.ChangePassword = cbChangePassword.Checked; - item.ChangePassword = cbChangePassword.Checked; item.IsDomainAdmin = cbDomainAdmin.Checked; item.DeleteOlder = cbDeleteOlder.Checked; From 3c7160b3fbb6dc45c69430df4f0e4739c2621521 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 14 Apr 2015 08:04:52 -0400 Subject: [PATCH 91/91] Added tag build-2.1.0.665 for changeset 186ccc832a0f