This commit is contained in:
vfedosevich 2015-02-19 05:34:40 -08:00
commit a516f04367
48 changed files with 2591 additions and 275 deletions

View file

@ -106,6 +106,14 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback GetRdsCollectionSessionHostsOperationCompleted; private System.Threading.SendOrPostCallback GetRdsCollectionSessionHostsOperationCompleted;
private System.Threading.SendOrPostCallback GetRdsServerInfoOperationCompleted;
private System.Threading.SendOrPostCallback GetRdsServerStatusOperationCompleted;
private System.Threading.SendOrPostCallback ShutDownRdsServerOperationCompleted;
private System.Threading.SendOrPostCallback RestartRdsServerOperationCompleted;
/// <remarks/> /// <remarks/>
public esRemoteDesktopServices() { public esRemoteDesktopServices() {
this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx"; this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx";
@ -225,6 +233,18 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/> /// <remarks/>
public event GetRdsCollectionSessionHostsCompletedEventHandler GetRdsCollectionSessionHostsCompleted; public event GetRdsCollectionSessionHostsCompletedEventHandler GetRdsCollectionSessionHostsCompleted;
/// <remarks/>
public event GetRdsServerInfoCompletedEventHandler GetRdsServerInfoCompleted;
/// <remarks/>
public event GetRdsServerStatusCompletedEventHandler GetRdsServerStatusCompleted;
/// <remarks/>
public event ShutDownRdsServerCompletedEventHandler ShutDownRdsServerCompleted;
/// <remarks/>
public event RestartRdsServerCompletedEventHandler RestartRdsServerCompleted;
/// <remarks/> /// <remarks/>
[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)] [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) { public RdsCollection GetRdsCollection(int collectionId) {
@ -1944,6 +1964,182 @@ namespace WebsitePanel.EnterpriseServer {
} }
} }
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsServerInfo", 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 RdsServerInfo GetRdsServerInfo(int itemId, string fqdnName) {
object[] results = this.Invoke("GetRdsServerInfo", new object[] {
itemId,
fqdnName});
return ((RdsServerInfo)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetRdsServerInfo(int itemId, string fqdnName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetRdsServerInfo", new object[] {
itemId,
fqdnName}, callback, asyncState);
}
/// <remarks/>
public RdsServerInfo EndGetRdsServerInfo(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((RdsServerInfo)(results[0]));
}
/// <remarks/>
public void GetRdsServerInfoAsync(int itemId, string fqdnName) {
this.GetRdsServerInfoAsync(itemId, fqdnName, null);
}
/// <remarks/>
public void GetRdsServerInfoAsync(int itemId, string fqdnName, object userState) {
if ((this.GetRdsServerInfoOperationCompleted == null)) {
this.GetRdsServerInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServerInfoOperationCompleted);
}
this.InvokeAsync("GetRdsServerInfo", new object[] {
itemId,
fqdnName}, this.GetRdsServerInfoOperationCompleted, userState);
}
private void OnGetRdsServerInfoOperationCompleted(object arg) {
if ((this.GetRdsServerInfoCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetRdsServerInfoCompleted(this, new GetRdsServerInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsServerStatus", 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 GetRdsServerStatus(int itemId, string fqdnName) {
object[] results = this.Invoke("GetRdsServerStatus", new object[] {
itemId,
fqdnName});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetRdsServerStatus(int itemId, string fqdnName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetRdsServerStatus", new object[] {
itemId,
fqdnName}, callback, asyncState);
}
/// <remarks/>
public string EndGetRdsServerStatus(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void GetRdsServerStatusAsync(int itemId, string fqdnName) {
this.GetRdsServerStatusAsync(itemId, fqdnName, null);
}
/// <remarks/>
public void GetRdsServerStatusAsync(int itemId, string fqdnName, object userState) {
if ((this.GetRdsServerStatusOperationCompleted == null)) {
this.GetRdsServerStatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServerStatusOperationCompleted);
}
this.InvokeAsync("GetRdsServerStatus", new object[] {
itemId,
fqdnName}, this.GetRdsServerStatusOperationCompleted, userState);
}
private void OnGetRdsServerStatusOperationCompleted(object arg) {
if ((this.GetRdsServerStatusCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetRdsServerStatusCompleted(this, new GetRdsServerStatusCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/ShutDownRdsServer", 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 ShutDownRdsServer(int itemId, string fqdnName) {
object[] results = this.Invoke("ShutDownRdsServer", new object[] {
itemId,
fqdnName});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginShutDownRdsServer(int itemId, string fqdnName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ShutDownRdsServer", new object[] {
itemId,
fqdnName}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndShutDownRdsServer(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void ShutDownRdsServerAsync(int itemId, string fqdnName) {
this.ShutDownRdsServerAsync(itemId, fqdnName, null);
}
/// <remarks/>
public void ShutDownRdsServerAsync(int itemId, string fqdnName, object userState) {
if ((this.ShutDownRdsServerOperationCompleted == null)) {
this.ShutDownRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnShutDownRdsServerOperationCompleted);
}
this.InvokeAsync("ShutDownRdsServer", new object[] {
itemId,
fqdnName}, this.ShutDownRdsServerOperationCompleted, userState);
}
private void OnShutDownRdsServerOperationCompleted(object arg) {
if ((this.ShutDownRdsServerCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.ShutDownRdsServerCompleted(this, new ShutDownRdsServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/RestartRdsServer", 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 RestartRdsServer(int itemId, string fqdnName) {
object[] results = this.Invoke("RestartRdsServer", new object[] {
itemId,
fqdnName});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginRestartRdsServer(int itemId, string fqdnName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("RestartRdsServer", new object[] {
itemId,
fqdnName}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndRestartRdsServer(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void RestartRdsServerAsync(int itemId, string fqdnName) {
this.RestartRdsServerAsync(itemId, fqdnName, null);
}
/// <remarks/>
public void RestartRdsServerAsync(int itemId, string fqdnName, object userState) {
if ((this.RestartRdsServerOperationCompleted == null)) {
this.RestartRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRestartRdsServerOperationCompleted);
}
this.InvokeAsync("RestartRdsServer", new object[] {
itemId,
fqdnName}, this.RestartRdsServerOperationCompleted, userState);
}
private void OnRestartRdsServerOperationCompleted(object arg) {
if ((this.RestartRdsServerCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.RestartRdsServerCompleted(this, new RestartRdsServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/> /// <remarks/>
public new void CancelAsync(object userState) { public new void CancelAsync(object userState) {
base.CancelAsync(userState); base.CancelAsync(userState);
@ -2937,4 +3133,108 @@ namespace WebsitePanel.EnterpriseServer {
} }
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetRdsServerInfoCompletedEventHandler(object sender, GetRdsServerInfoCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetRdsServerInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetRdsServerInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public RdsServerInfo Result {
get {
this.RaiseExceptionIfNecessary();
return ((RdsServerInfo)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetRdsServerStatusCompletedEventHandler(object sender, GetRdsServerStatusCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetRdsServerStatusCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetRdsServerStatusCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void ShutDownRdsServerCompletedEventHandler(object sender, ShutDownRdsServerCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ShutDownRdsServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal ShutDownRdsServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void RestartRdsServerCompletedEventHandler(object sender, RestartRdsServerCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class RestartRdsServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal RestartRdsServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
} }

View file

@ -248,6 +248,26 @@ namespace WebsitePanel.EnterpriseServer
return GetRdsCollectionSessionHostsInternal(collectionId); return GetRdsCollectionSessionHostsInternal(collectionId);
} }
public static RdsServerInfo GetRdsServerInfo(int itemId, string fqdnName)
{
return GetRdsServerInfoInternal(itemId, fqdnName);
}
public static string GetRdsServerStatus(int itemId, string fqdnName)
{
return GetRdsServerStatusInternal(itemId, fqdnName);
}
public static ResultObject ShutDownRdsServer(int itemId, string fqdnName)
{
return ShutDownRdsServerInternal(itemId, fqdnName);
}
public static ResultObject RestartRdsServer(int itemId, string fqdnName)
{
return RestartRdsServerInternal(itemId, fqdnName);
}
private static RdsCollection GetRdsCollectionInternal(int collectionId) private static RdsCollection GetRdsCollectionInternal(int collectionId)
{ {
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId)); var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
@ -586,7 +606,7 @@ namespace WebsitePanel.EnterpriseServer
foreach (var tmpServer in tmpServers) foreach (var tmpServer in tmpServers)
{ {
FillRdsServerData(tmpServer); FillRdsServerData(tmpServer);
} }
result.Servers = tmpServers.ToArray(); result.Servers = tmpServers.ToArray();
@ -1235,6 +1255,118 @@ namespace WebsitePanel.EnterpriseServer
return result; return result;
} }
private static RdsServerInfo GetRdsServerInfoInternal(int itemId, string fqdnName)
{
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
return new RdsServerInfo();
}
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
var result = rds.GetRdsServerInfo(fqdnName);
return result;
}
private static string GetRdsServerStatusInternal(int itemId, string fqdnName)
{
Organization org = OrganizationController.GetOrganization(itemId);
var result = "Unavailable";
if (org == null)
{
return result;
}
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
try
{
result = rds.GetRdsServerStatus(fqdnName);
}
catch
{
}
return result;
}
private static ResultObject ShutDownRdsServerInternal(int itemId, string fqdnName)
{
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "SHUTDOWN_RDS_SERVER");
try
{
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
result.IsSuccess = false;
result.AddError("", new NullReferenceException("Organization not found"));
return result;
}
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
rds.ShutDownRdsServer(fqdnName);
}
catch (Exception ex)
{
result.AddError("REMOTE_DESKTOP_SERVICES_SHUTDOWN_RDS_SERVER", ex);
}
finally
{
if (!result.IsSuccess)
{
TaskManager.CompleteResultTask(result);
}
else
{
TaskManager.CompleteResultTask();
}
}
return result;
}
private static ResultObject RestartRdsServerInternal(int itemId, string fqdnName)
{
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "RESTART_RDS_SERVER");
try
{
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
result.IsSuccess = false;
result.AddError("", new NullReferenceException("Organization not found"));
return result;
}
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
rds.RestartRdsServer(fqdnName);
}
catch (Exception ex)
{
result.AddError("REMOTE_DESKTOP_SERVICES_RESTART_RDS_SERVER", ex);
}
finally
{
if (!result.IsSuccess)
{
TaskManager.CompleteResultTask(result);
}
else
{
TaskManager.CompleteResultTask();
}
}
return result;
}
private static List<RemoteApplication> GetCollectionRemoteApplicationsInternal(int itemId, string collectionName) private static List<RemoteApplication> GetCollectionRemoteApplicationsInternal(int itemId, string collectionName)
{ {
var result = new List<RemoteApplication>(); var result = new List<RemoteApplication>();

View file

@ -289,5 +289,29 @@ namespace WebsitePanel.EnterpriseServer
{ {
return RemoteDesktopServicesController.GetRdsCollectionSessionHosts(collectionId); return RemoteDesktopServicesController.GetRdsCollectionSessionHosts(collectionId);
} }
[WebMethod]
public RdsServerInfo GetRdsServerInfo(int itemId, string fqdnName)
{
return RemoteDesktopServicesController.GetRdsServerInfo(itemId, fqdnName);
}
[WebMethod]
public string GetRdsServerStatus(int itemId, string fqdnName)
{
return RemoteDesktopServicesController.GetRdsServerStatus(itemId, fqdnName);
}
[WebMethod]
public ResultObject ShutDownRdsServer(int itemId, string fqdnName)
{
return RemoteDesktopServicesController.ShutDownRdsServer(itemId, fqdnName);
}
[WebMethod]
public ResultObject RestartRdsServer(int itemId, string fqdnName)
{
return RemoteDesktopServicesController.RestartRdsServer(itemId, fqdnName);
}
} }
} }

View file

@ -69,5 +69,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
List<RdsUserSession> GetRdsUserSessions(string collectionName); List<RdsUserSession> GetRdsUserSessions(string collectionName);
void LogOffRdsUser(string unifiedSessionId, string hostServer); void LogOffRdsUser(string unifiedSessionId, string hostServer);
List<string> GetRdsCollectionSessionHosts(string collectionName); List<string> GetRdsCollectionSessionHosts(string collectionName);
RdsServerInfo GetRdsServerInfo(string serverName);
string GetRdsServerStatus(string serverName);
void ShutDownRdsServer(string serverName);
void RestartRdsServer(string serverName);
} }
} }

View file

@ -47,5 +47,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
public string ItemName { get; set; } public string ItemName { get; set; }
public int? RdsCollectionId { get; set; } public int? RdsCollectionId { get; set; }
public bool ConnectionEnabled { get; set; } public bool ConnectionEnabled { get; set; }
public string Status { get; set; }
} }
} }

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WebsitePanel.Providers.RemoteDesktopServices
{
public class RdsServerDriveInfo
{
public string DeviceId { get; set; }
public string VolumeName { get; set; }
public double SizeMb { get; set; }
public double FreeSpaceMb { get; set; }
}
}

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WebsitePanel.Providers.RemoteDesktopServices
{
public class RdsServerInfo
{
public string Status { get; set; }
public int NumberOfCores { get; set; }
public int MaxClockSpeed { get; set; }
public int LoadPercentage { get; set; }
public double MemoryAllocatedMb { get; set; }
public double FreeMemoryMb { get; set; }
public RdsServerDriveInfo[] Drives { get; set; }
}
}

View file

@ -135,6 +135,8 @@
<Compile Include="RemoteDesktopServices\RdsEnums.cs" /> <Compile Include="RemoteDesktopServices\RdsEnums.cs" />
<Compile Include="RemoteDesktopServices\RdsPolicyTypes.cs" /> <Compile Include="RemoteDesktopServices\RdsPolicyTypes.cs" />
<Compile Include="RemoteDesktopServices\RdsServer.cs" /> <Compile Include="RemoteDesktopServices\RdsServer.cs" />
<Compile Include="RemoteDesktopServices\RdsServerDriveInfo.cs" />
<Compile Include="RemoteDesktopServices\RdsServerInfo.cs" />
<Compile Include="RemoteDesktopServices\RdsServersPaged.cs" /> <Compile Include="RemoteDesktopServices\RdsServersPaged.cs" />
<Compile Include="RemoteDesktopServices\RdsUserSession.cs" /> <Compile Include="RemoteDesktopServices\RdsUserSession.cs" />
<Compile Include="RemoteDesktopServices\RemoteApplication.cs" /> <Compile Include="RemoteDesktopServices\RemoteApplication.cs" />

View file

@ -63,7 +63,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
private const string Users = "users"; private const string Users = "users";
private const string RdsGroupFormat = "rds-{0}-{1}"; private const string RdsGroupFormat = "rds-{0}-{1}";
private const string RdsModuleName = "RemoteDesktopServices"; private const string RdsModuleName = "RemoteDesktopServices";
private const string AddNpsString = "netsh nps add np name=\"\"{0}\"\" policysource=\"1\" processingorder=\"{1}\" conditionid=\"0x3d\" conditiondata=\"^5$\" conditionid=\"0x1fb5\" conditiondata=\"{2}\" conditionid=\"0x1e\" conditiondata=\"UserAuthType:(PW|CA)\" profileid=\"0x1005\" profiledata=\"TRUE\" profileid=\"0x100f\" profiledata=\"TRUE\" profileid=\"0x1009\" profiledata=\"0x7\" profileid=\"0x1fe6\" profiledata=\"0x40000000\""; private const string AddNpsString = "netsh nps add np name=\"\"{0}\"\" policysource=\"1\" processingorder=\"{1}\" conditionid=\"0x3d\" conditiondata=\"^5$\" conditionid=\"0x1fb5\" conditiondata=\"{2}\" conditionid=\"0x1e\" conditiondata=\"UserAuthType:(PW|CA)\" profileid=\"0x1005\" profiledata=\"TRUE\" profileid=\"0x100f\" profiledata=\"TRUE\" profileid=\"0x1009\" profiledata=\"0x7\" profileid=\"0x1fe6\" profiledata=\"0x40000000\"";
#endregion #endregion
#region Properties #region Properties
@ -956,9 +957,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); cmd.Parameters.Add("ConnectionBroker", ConnectionBroker);
ExecuteShellCommand(runSpace, cmd, false); ExecuteShellCommand(runSpace, cmd, false);
} }
private bool ExistRdsServerInDeployment(Runspace runSpace, RdsServer server) private bool ExistRdsServerInDeployment(Runspace runSpace, RdsServer server)
{ {
@ -1835,6 +1834,238 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
} }
#endregion #endregion
#region Server Info
public RdsServerInfo GetRdsServerInfo(string serverName)
{
var result = new RdsServerInfo();
Runspace runspace = null;
try
{
runspace = OpenRunspace();
result = GetServerInfo(runspace, serverName);
result.Status = GetRdsServerStatus(runspace, serverName);
}
finally
{
CloseRunspace(runspace);
}
return result;
}
public string GetRdsServerStatus(string serverName)
{
string result = "";
Runspace runspace = null;
try
{
runspace = OpenRunspace();
result = GetRdsServerStatus(runspace, serverName);
}
finally
{
CloseRunspace(runspace);
}
return result;
}
public void ShutDownRdsServer(string serverName)
{
Runspace runspace = null;
try
{
runspace = OpenRunspace();
var command = new Command("Stop-Computer");
command.Parameters.Add("ComputerName", serverName);
command.Parameters.Add("Force", true);
object[] errors = null;
ExecuteShellCommand(runspace, command, false, out errors);
if (errors.Any())
{
Log.WriteWarning(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
throw new Exception(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
}
}
finally
{
CloseRunspace(runspace);
}
}
public void RestartRdsServer(string serverName)
{
Runspace runspace = null;
try
{
runspace = OpenRunspace();
var command = new Command("Restart-Computer");
command.Parameters.Add("ComputerName", serverName);
command.Parameters.Add("Force", true);
object[] errors = null;
ExecuteShellCommand(runspace, command, false, out errors);
if (errors.Any())
{
Log.WriteWarning(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
throw new Exception(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
}
}
finally
{
CloseRunspace(runspace);
}
}
private RdsServerInfo GetServerInfo(Runspace runspace, string serverName)
{
var result = new RdsServerInfo();
Command cmd = new Command("Get-WmiObject");
cmd.Parameters.Add("Class", "Win32_Processor");
cmd.Parameters.Add("ComputerName", serverName);
object[] errors = null;
var psProcInfo = ExecuteShellCommand(runspace, cmd, false, out errors).First();
if (errors.Any())
{
Log.WriteWarning(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
return result;
}
cmd = new Command("Get-WmiObject");
cmd.Parameters.Add("Class", "Win32_OperatingSystem");
cmd.Parameters.Add("ComputerName", serverName);
var psMemoryInfo = ExecuteShellCommand(runspace, cmd, false, out errors).First();
if (errors.Any())
{
Log.WriteWarning(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
return result;
}
result.NumberOfCores = Convert.ToInt32(GetPSObjectProperty(psProcInfo, "NumberOfCores"));
result.MaxClockSpeed = Convert.ToInt32(GetPSObjectProperty(psProcInfo, "MaxClockSpeed"));
result.LoadPercentage = Convert.ToInt32(GetPSObjectProperty(psProcInfo, "LoadPercentage"));
result.MemoryAllocatedMb = Math.Round(Convert.ToDouble(GetPSObjectProperty(psMemoryInfo, "TotalVisibleMemorySize")) / 1024, 1);
result.FreeMemoryMb = Math.Round(Convert.ToDouble(GetPSObjectProperty(psMemoryInfo, "FreePhysicalMemory")) / 1024, 1);
result.Drives = GetRdsServerDriveInfo(runspace, serverName).ToArray();
return result;
}
private string GetRdsServerStatus (Runspace runspace, string serverName)
{
if (CheckServerAvailability(serverName))
{
if (CheckPendingReboot(runspace, serverName))
{
return "Online - Pending Reboot";
}
return "Online";
}
else
{
return "Unavailable";
}
}
private List<RdsServerDriveInfo> GetRdsServerDriveInfo(Runspace runspace, string serverName)
{
var result = new List<RdsServerDriveInfo>();
Command cmd = new Command("Get-WmiObject");
cmd.Parameters.Add("Class", "Win32_LogicalDisk");
cmd.Parameters.Add("Filter", "DriveType=3");
cmd.Parameters.Add("ComputerName", serverName);
object[] errors = null;
var psDrives = ExecuteShellCommand(runspace, cmd, false, out errors);
if (errors.Any())
{
Log.WriteWarning(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
return result;
}
foreach (var psDrive in psDrives)
{
var driveInfo = new RdsServerDriveInfo()
{
VolumeName = GetPSObjectProperty(psDrive, "VolumeName").ToString(),
DeviceId = GetPSObjectProperty(psDrive, "DeviceId").ToString(),
SizeMb = Math.Round(Convert.ToDouble(GetPSObjectProperty(psDrive, "Size"))/1024/1024, 1),
FreeSpaceMb = Math.Round(Convert.ToDouble(GetPSObjectProperty(psDrive, "FreeSpace"))/1024/1024, 1)
};
result.Add(driveInfo);
}
return result;
}
private bool CheckRDSServerAvaliability(string serverName)
{
var ping = new Ping();
var reply = ping.Send(serverName, 1000);
if (reply.Status == IPStatus.Success)
{
return true;
}
return false;
}
private bool CheckPendingReboot(Runspace runspace, string serverName)
{
if (CheckPendingReboot(runspace, serverName, @"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing", "RebootPending"))
{
return true;
}
if (CheckPendingReboot(runspace, serverName, @"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update", "RebootRequired"))
{
return true;
}
if (CheckPendingReboot(runspace, serverName, @"HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager", "PendingFileRenameOperations"))
{
return true;
}
return false;
}
private bool CheckPendingReboot(Runspace runspace, string serverName, string registryPath, string registryKey)
{
Command cmd = new Command("Get-ItemProperty");
cmd.Parameters.Add("Path", registryPath);
cmd.Parameters.Add("Name", registryKey);
cmd.Parameters.Add("ErrorAction", "SilentlyContinue");
var feature = ExecuteRemoteShellCommand(runspace, serverName, cmd).FirstOrDefault();
if (feature != null)
{
return true;
}
return false;
}
#endregion
} }
} }

View file

@ -81,6 +81,14 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
private System.Threading.SendOrPostCallback GetRdsCollectionSessionHostsOperationCompleted; private System.Threading.SendOrPostCallback GetRdsCollectionSessionHostsOperationCompleted;
private System.Threading.SendOrPostCallback GetRdsServerInfoOperationCompleted;
private System.Threading.SendOrPostCallback GetRdsServerStatusOperationCompleted;
private System.Threading.SendOrPostCallback ShutDownRdsServerOperationCompleted;
private System.Threading.SendOrPostCallback RestartRdsServerOperationCompleted;
/// <remarks/> /// <remarks/>
public RemoteDesktopServices() { public RemoteDesktopServices() {
this.Url = "http://localhost:9003/RemoteDesktopServices.asmx"; this.Url = "http://localhost:9003/RemoteDesktopServices.asmx";
@ -164,6 +172,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/> /// <remarks/>
public event GetRdsCollectionSessionHostsCompletedEventHandler GetRdsCollectionSessionHostsCompleted; public event GetRdsCollectionSessionHostsCompletedEventHandler GetRdsCollectionSessionHostsCompleted;
/// <remarks/>
public event GetRdsServerInfoCompletedEventHandler GetRdsServerInfoCompleted;
/// <remarks/>
public event GetRdsServerStatusCompletedEventHandler GetRdsServerStatusCompleted;
/// <remarks/>
public event ShutDownRdsServerCompletedEventHandler ShutDownRdsServerCompleted;
/// <remarks/>
public event RestartRdsServerCompletedEventHandler RestartRdsServerCompleted;
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [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)] [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)]
@ -1299,6 +1319,170 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
} }
} }
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetRdsServerInfo", 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 RdsServerInfo GetRdsServerInfo(string serverName) {
object[] results = this.Invoke("GetRdsServerInfo", new object[] {
serverName});
return ((RdsServerInfo)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetRdsServerInfo(string serverName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetRdsServerInfo", new object[] {
serverName}, callback, asyncState);
}
/// <remarks/>
public RdsServerInfo EndGetRdsServerInfo(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((RdsServerInfo)(results[0]));
}
/// <remarks/>
public void GetRdsServerInfoAsync(string serverName) {
this.GetRdsServerInfoAsync(serverName, null);
}
/// <remarks/>
public void GetRdsServerInfoAsync(string serverName, object userState) {
if ((this.GetRdsServerInfoOperationCompleted == null)) {
this.GetRdsServerInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServerInfoOperationCompleted);
}
this.InvokeAsync("GetRdsServerInfo", new object[] {
serverName}, this.GetRdsServerInfoOperationCompleted, userState);
}
private void OnGetRdsServerInfoOperationCompleted(object arg) {
if ((this.GetRdsServerInfoCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetRdsServerInfoCompleted(this, new GetRdsServerInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetRdsServerStatus", 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 GetRdsServerStatus(string serverName) {
object[] results = this.Invoke("GetRdsServerStatus", new object[] {
serverName});
return ((string)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetRdsServerStatus(string serverName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetRdsServerStatus", new object[] {
serverName}, callback, asyncState);
}
/// <remarks/>
public string EndGetRdsServerStatus(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
/// <remarks/>
public void GetRdsServerStatusAsync(string serverName) {
this.GetRdsServerStatusAsync(serverName, null);
}
/// <remarks/>
public void GetRdsServerStatusAsync(string serverName, object userState) {
if ((this.GetRdsServerStatusOperationCompleted == null)) {
this.GetRdsServerStatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServerStatusOperationCompleted);
}
this.InvokeAsync("GetRdsServerStatus", new object[] {
serverName}, this.GetRdsServerStatusOperationCompleted, userState);
}
private void OnGetRdsServerStatusOperationCompleted(object arg) {
if ((this.GetRdsServerStatusCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetRdsServerStatusCompleted(this, new GetRdsServerStatusCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ShutDownRdsServer", 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 ShutDownRdsServer(string serverName) {
this.Invoke("ShutDownRdsServer", new object[] {
serverName});
}
/// <remarks/>
public System.IAsyncResult BeginShutDownRdsServer(string serverName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ShutDownRdsServer", new object[] {
serverName}, callback, asyncState);
}
/// <remarks/>
public void EndShutDownRdsServer(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void ShutDownRdsServerAsync(string serverName) {
this.ShutDownRdsServerAsync(serverName, null);
}
/// <remarks/>
public void ShutDownRdsServerAsync(string serverName, object userState) {
if ((this.ShutDownRdsServerOperationCompleted == null)) {
this.ShutDownRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnShutDownRdsServerOperationCompleted);
}
this.InvokeAsync("ShutDownRdsServer", new object[] {
serverName}, this.ShutDownRdsServerOperationCompleted, userState);
}
private void OnShutDownRdsServerOperationCompleted(object arg) {
if ((this.ShutDownRdsServerCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.ShutDownRdsServerCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/RestartRdsServer", 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 RestartRdsServer(string serverName) {
this.Invoke("RestartRdsServer", new object[] {
serverName});
}
/// <remarks/>
public System.IAsyncResult BeginRestartRdsServer(string serverName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("RestartRdsServer", new object[] {
serverName}, callback, asyncState);
}
/// <remarks/>
public void EndRestartRdsServer(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void RestartRdsServerAsync(string serverName) {
this.RestartRdsServerAsync(serverName, null);
}
/// <remarks/>
public void RestartRdsServerAsync(string serverName, object userState) {
if ((this.RestartRdsServerOperationCompleted == null)) {
this.RestartRdsServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRestartRdsServerOperationCompleted);
}
this.InvokeAsync("RestartRdsServer", new object[] {
serverName}, this.RestartRdsServerOperationCompleted, userState);
}
private void OnRestartRdsServerOperationCompleted(object arg) {
if ((this.RestartRdsServerCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.RestartRdsServerCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/> /// <remarks/>
public new void CancelAsync(object userState) { public new void CancelAsync(object userState) {
base.CancelAsync(userState); base.CancelAsync(userState);
@ -1826,4 +2010,64 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
} }
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetRdsServerInfoCompletedEventHandler(object sender, GetRdsServerInfoCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetRdsServerInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetRdsServerInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public RdsServerInfo Result {
get {
this.RaiseExceptionIfNecessary();
return ((RdsServerInfo)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetRdsServerStatusCompletedEventHandler(object sender, GetRdsServerStatusCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetRdsServerStatusCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetRdsServerStatusCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string Result {
get {
this.RaiseExceptionIfNecessary();
return ((string)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void ShutDownRdsServerCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void RestartRdsServerCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
} }

View file

@ -495,5 +495,73 @@ namespace WebsitePanel.Server
throw; throw;
} }
} }
[WebMethod, SoapHeader("settings")]
public RdsServerInfo GetRdsServerInfo(string serverName)
{
try
{
Log.WriteStart("'{0}' GetRdsServerInfo", ProviderSettings.ProviderName);
var result = RDSProvider.GetRdsServerInfo(serverName);
Log.WriteEnd("'{0}' GetRdsServerInfo", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetRdsServerInfo", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public string GetRdsServerStatus(string serverName)
{
try
{
Log.WriteStart("'{0}' GetRdsServerStatus", ProviderSettings.ProviderName);
var result = RDSProvider.GetRdsServerStatus(serverName);
Log.WriteEnd("'{0}' GetRdsServerStatus", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetRdsServerStatus", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ShutDownRdsServer(string serverName)
{
try
{
Log.WriteStart("'{0}' ShutDownRdsServer", ProviderSettings.ProviderName);
RDSProvider.ShutDownRdsServer(serverName);
Log.WriteEnd("'{0}' ShutDownRdsServer", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ShutDownRdsServer", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void RestartRdsServer(string serverName)
{
try
{
Log.WriteStart("'{0}' RestartRdsServer", ProviderSettings.ProviderName);
RDSProvider.RestartRdsServer(serverName);
Log.WriteEnd("'{0}' RestartRdsServer", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' RestartRdsServer", ProviderSettings.ProviderName), ex);
throw;
}
}
} }
} }

View file

@ -3136,14 +3136,14 @@
<data name="Success.ORGANIZATION_UPDATE_USER_SETTINGS" xml:space="preserve"> <data name="Success.ORGANIZATION_UPDATE_USER_SETTINGS" xml:space="preserve">
<value>User general settings have been successfully updated.</value> <value>User general settings have been successfully updated.</value>
</data> </data>
<data name="Success.ORGANIZATION_USERS_ACTIONS" xml:space="preserve"> <data name="Success.ACTIONS_MESSAGE" xml:space="preserve">
<value>Action has been successfully performed.</value> <value>Action has been successfully performed.</value>
</data> </data>
<data name="Error.ORGANIZATION_USERS_ACTIONS" xml:space="preserve"> <data name="Error.ACTIONS_MESSAGE" xml:space="preserve">
<value>Failed to perform action.</value> <value>Failed to perform action.</value>
</data> </data>
<data name="Warning.ORGANIZATION_USERS_ACTIONS" xml:space="preserve"> <data name="Warning.ACTIONS_MESSAGE" xml:space="preserve">
<value>Please select the users for which you want to perform actions.</value> <value>Please select the items for which you want to perform action.</value>
</data> </data>
<data name="Success.ORGANIZATION_SET_USER_PASSWORD" xml:space="preserve"> <data name="Success.ORGANIZATION_SET_USER_PASSWORD" xml:space="preserve">
<value>User password has been successfully updated.</value> <value>User password has been successfully updated.</value>

View file

@ -32,11 +32,13 @@ Default skin template. The following skins are provided as examples only.
<asp:ImageButton SkinID="StopMedium" runat="server" ImageUrl="Images/stop_24.png" ImageAlign="AbsMiddle" Width="24" Height="24"/> <asp:ImageButton SkinID="StopMedium" runat="server" ImageUrl="Images/stop_24.png" ImageAlign="AbsMiddle" Width="24" Height="24"/>
<asp:ImageButton SkinID="ContinueMedium" runat="server" ImageUrl="Images/play_24.png" ImageAlign="AbsMiddle" Width="24" Height="24"/> <asp:ImageButton SkinID="ContinueMedium" runat="server" ImageUrl="Images/play_24.png" ImageAlign="AbsMiddle" Width="24" Height="24"/>
<asp:ImageButton SkinID="RecycleMedium" runat="server" ImageUrl="Images/restart_24.png" ImageAlign="AbsMiddle" Width="24" Height="24"/> <asp:ImageButton SkinID="RecycleMedium" runat="server" ImageUrl="Images/restart_24.png" ImageAlign="AbsMiddle" Width="24" Height="24"/>
<asp:ImageButton SkinID="ApplyMedium" runat="server" ImageUrl="Images/apply_24.png" ImageAlign="AbsMiddle" Width="24" Height="24"/>
<asp:ImageButton SkinID="PauseSmall" runat="server" ImageUrl="Images/pause_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"/> <asp:ImageButton SkinID="PauseSmall" runat="server" ImageUrl="Images/pause_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"/>
<asp:ImageButton SkinID="StartSmall" runat="server" ImageUrl="Images/play_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"/> <asp:ImageButton SkinID="StartSmall" runat="server" ImageUrl="Images/play_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"/>
<asp:ImageButton SkinID="StopSmall" runat="server" ImageUrl="Images/stop_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"/> <asp:ImageButton SkinID="StopSmall" runat="server" ImageUrl="Images/stop_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"/>
<asp:ImageButton SkinID="ContinueSmall" runat="server" ImageUrl="Images/play_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"/> <asp:ImageButton SkinID="ContinueSmall" runat="server" ImageUrl="Images/play_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"/>
<asp:ImageButton SkinID="ApplySmall" runat="server" ImageUrl="Images/apply_16.png" ImageAlign="AbsMiddle" Width="16" Height="16"/>
<asp:ImageButton SkinID="VpsDelete" runat="server" ImageUrl="Images/VPS/delete.png" ImageAlign="AbsMiddle" Width="16" Height="16"/> <asp:ImageButton SkinID="VpsDelete" runat="server" ImageUrl="Images/VPS/delete.png" ImageAlign="AbsMiddle" Width="16" Height="16"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -184,7 +184,7 @@ h2.ProductTitle.Huge {margin:0;}
.FormButtonsBarCleanRight {text-align: right;} .FormButtonsBarCleanRight {text-align: right;}
.FormButtonsBarCleanMiddle {float: right;} .FormButtonsBarCleanMiddle {float: right;}
.FormButtonsBarCleanSeparator {padding-right: 30px;} .FormButtonsBarCleanSeparator {padding-right: 30px;}
.FormButtonsBarCleanSeparatorSmall {padding-right: 15px;} .FormButtonsBarCleanSeparatorSmall {padding-right: 3px;}
.GridFooter .Left {float: left;} .GridFooter .Left {float: left;}
.GridFooter .Right {text-align: right;} .GridFooter .Right {text-align: right;}
.FormRow {padding-top: 4px; padding-bottom: 4px;} .FormRow {padding-top: 4px; padding-bottom: 4px;}

View file

@ -3,10 +3,18 @@
<%@ Register Src="UserControls/ServerDetails.ascx" TagName="ServerDetails" TagPrefix="wsp" %> <%@ Register Src="UserControls/ServerDetails.ascx" TagName="ServerDetails" TagPrefix="wsp" %>
<%@ Register Src="UserControls/UserDetails.ascx" TagName="UserDetails" TagPrefix="wsp" %> <%@ Register Src="UserControls/UserDetails.ascx" TagName="UserDetails" TagPrefix="wsp" %>
<%@ Register Src="UserControls/SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %> <%@ Register Src="UserControls/SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %>
<%@ Register Src="UserControls/DomainActions.ascx" TagName="DomainActions" TagPrefix="wsp" %>
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<script src="JavaScript/jquery-1.4.4.min.js" type="text/javascript"></script>
<script language="javascript">
function SelectAllCheckboxes(box) {
$(".NormalGridView tbody :checkbox").attr("checked", $(box).attr("checked"));
}
</script>
<div class="FormButtonsBar"> <div class="FormButtonsBar">
<div class="Left"> <div class="Left">
@ -16,14 +24,32 @@
</div> </div>
<div class="Right"> <div class="Right">
<wsp:SearchBox ID="searchBox" runat="server" /> <table>
<tr>
<td>
<wsp:DomainActions ID="websiteActions" runat="server" GridViewID="gvDomains" CheckboxesName="chkSelectedIds" />
</td>
<td class="FormButtonsBarCleanSeparator"></td>
<td>
<wsp:SearchBox ID="searchBox" runat="server" />
</td>
</tr>
</table>
</div> </div>
</div> </div>
<asp:GridView ID="gvDomains" runat="server" AutoGenerateColumns="False" Width="100%" AllowSorting="True" DataSourceID="odsDomainsPaged" <asp:GridView ID="gvDomains" runat="server" AutoGenerateColumns="False" Width="100%" AllowSorting="True" DataSourceID="odsDomainsPaged"
EmptyDataText="gvDomains" EmptyDataText="gvDomains" DataKeyNames="DomainID"
CssSelectorClass="NormalGridView" AllowPaging="True" OnRowCommand="gvDomains_RowCommand"> CssSelectorClass="NormalGridView" AllowPaging="True" OnRowCommand="gvDomains_RowCommand">
<Columns> <Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="selectAll" Runat="server" onclick="javascript:SelectAllCheckboxes(this);" CssClass="HeaderCheckbox"></asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkSelectedIds" CssClass="GridCheckbox"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="DomainName" HeaderText="gvDomainsName"> <asp:TemplateField SortExpression="DomainName" HeaderText="gvDomainsName">
<ItemStyle Width="45%" Wrap="False"></ItemStyle> <ItemStyle Width="45%" Wrap="False"></ItemStyle>
<ItemTemplate> <ItemTemplate>

View file

@ -55,10 +55,10 @@ namespace WebsitePanel.Portal
// visibility // visibility
chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User); chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User);
gvDomains.Columns[4].Visible = gvDomains.Columns[5].Visible = gvDomains.Columns[5].Visible = gvDomains.Columns[6].Visible =
(PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked; (PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked;
gvDomains.Columns[6].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator); gvDomains.Columns[7].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
gvDomains.Columns[7].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator); gvDomains.Columns[8].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);
if (!IsPostBack) if (!IsPostBack)
{ {

View file

@ -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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -40,6 +12,15 @@ namespace WebsitePanel.Portal {
public partial class Domains { public partial class Domains {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary> /// <summary>
/// btnAddDomain control. /// btnAddDomain control.
/// </summary> /// </summary>
@ -58,6 +39,15 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkRecursive; protected global::System.Web.UI.WebControls.CheckBox chkRecursive;
/// <summary>
/// websiteActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.DomainActions websiteActions;
/// <summary> /// <summary>
/// searchBox control. /// searchBox control.
/// </summary> /// </summary>

View file

@ -36,7 +36,7 @@
<table> <table>
<tr> <tr>
<td> <td>
<wsp:UserActions ID="userActions" runat="server" OnExecutingUserAction="userActions_OnExecutingUserAction" ShowSetMailboxPlan="true" /> <wsp:UserActions ID="userActions" runat="server" GridViewID="gvMailboxes" CheckboxesName="chkSelectedUsersIds" ShowSetMailboxPlan="true" />
</td> </td>
<td class="FormButtonsBarCleanSeparatorSmall"></td> <td class="FormButtonsBarCleanSeparatorSmall"></td>
<td> <td>

View file

@ -271,43 +271,5 @@ namespace WebsitePanel.Portal.ExchangeServer
odsAccountsPaged.SelectParameters["accountTypes"].DefaultValue = string.Join(",", accountTypes); odsAccountsPaged.SelectParameters["accountTypes"].DefaultValue = string.Join(",", accountTypes);
} }
protected void userActions_OnExecutingUserAction(object sender, EventArgs e)
{
// Get checked users
var userIds = Utils.GetCheckboxValuesFromGrid<int>(gvMailboxes, "chkSelectedUsersIds");
if (userActions.SelectedAction != UserActionTypes.None)
{
if (userIds.Count > 0)
{
try
{
var result = userActions.DoUserActions(userIds);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
messageBox.ShowSuccessMessage("ORGANIZATION_USERS_ACTIONS");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_USERS_ACTIONS", ex);
}
// Refresh users grid
gvMailboxes.DataBind();
}
else
{
messageBox.ShowWarningMessage("ORGANIZATION_USERS_ACTIONS");
}
}
userActions.ResetSelection();
}
} }
} }

View file

@ -38,7 +38,7 @@
<table> <table>
<tr> <tr>
<td> <td>
<wsp:UserActions ID="userActions" runat="server" OnExecutingUserAction="userActions_OnExecutingUserAction" /> <wsp:UserActions ID="userActions" runat="server" GridViewID="gvUsers" CheckboxesName="chkSelectedUsersIds" />
</td> </td>
<td class="FormButtonsBarCleanSeparator"></td> <td class="FormButtonsBarCleanSeparator"></td>
<td> <td>

View file

@ -389,43 +389,5 @@ namespace WebsitePanel.Portal.HostedSolution
} }
} }
protected void userActions_OnExecutingUserAction(object sender, EventArgs e)
{
// Get checked users
var userIds = Utils.GetCheckboxValuesFromGrid<int>(gvUsers, "chkSelectedUsersIds");
if (userActions.SelectedAction != UserActionTypes.None)
{
if (userIds.Count > 0)
{
try
{
var result = userActions.DoUserActions(userIds);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
messageBox.ShowSuccessMessage("ORGANIZATION_USERS_ACTIONS");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_USERS_ACTIONS", ex);
}
// Refresh users grid
gvUsers.DataBind();
}
else
{
messageBox.ShowWarningMessage("ORGANIZATION_USERS_ACTIONS");
}
}
userActions.ResetSelection();
}
} }
} }

View file

@ -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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.

View file

@ -43,7 +43,7 @@ namespace WebsitePanel.Portal.RDS
{ {
if (!IsPostBack) if (!IsPostBack)
{ {
servers.HideRefreshButton();
} }
} }

View file

@ -26,6 +26,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using AjaxControlToolkit;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -40,14 +41,31 @@ namespace WebsitePanel.Portal.RDS
{ {
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
servers.Module = Module;
servers.OnRefreshClicked -= OnRefreshClicked;
servers.OnRefreshClicked += OnRefreshClicked;
if (!Page.IsPostBack) if (!Page.IsPostBack)
{ {
var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
litCollectionName.Text = collection.DisplayName; litCollectionName.Text = collection.DisplayName;
} }
} }
private bool SaveRdsServers() private void OnRefreshClicked(object sender, EventArgs e)
{
var rdsServers = (List<RdsServer>)sender;
foreach (var rdsServer in rdsServers)
{
rdsServer.Status = ES.Services.RDS.GetRdsServerStatus(PanelRequest.ItemID, rdsServer.FqdName);
}
servers.BindServers(rdsServers.ToArray());
((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide();
}
private bool SaveRdsServers(bool exit = false)
{ {
try try
{ {
@ -62,6 +80,15 @@ namespace WebsitePanel.Portal.RDS
ES.Services.RDS.EditRdsCollection(PanelRequest.ItemID, collection); ES.Services.RDS.EditRdsCollection(PanelRequest.ItemID, collection);
if (!exit)
{
foreach(var rdsServer in collection.Servers)
{
rdsServer.Status = ES.Services.RDS.GetRdsServerStatus(PanelRequest.ItemID, rdsServer.FqdName);
}
servers.BindServers(collection.Servers.ToArray());
}
} }
catch(Exception ex) catch(Exception ex)
{ {

View file

@ -138,12 +138,21 @@
<data name="btnDelete.Text" xml:space="preserve"> <data name="btnDelete.Text" xml:space="preserve">
<value>Delete</value> <value>Delete</value>
</data> </data>
<data name="btnServerInfoCancel.OnClientClick" xml:space="preserve">
<value>CloseProgressDialog();</value>
</data>
<data name="btnServerInfoCancel.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="gvPopupServerName.HeaderText" xml:space="preserve"> <data name="gvPopupServerName.HeaderText" xml:space="preserve">
<value>Server Name</value> <value>Server Name</value>
</data> </data>
<data name="gvPopupServers.EmptyDataText" xml:space="preserve"> <data name="gvPopupServers.EmptyDataText" xml:space="preserve">
<value>No servers found.</value> <value>No servers found.</value>
</data> </data>
<data name="gvPopupStatus.HeaderText" xml:space="preserve">
<value>Status</value>
</data>
<data name="gvServerName.HeaderText" xml:space="preserve"> <data name="gvServerName.HeaderText" xml:space="preserve">
<value>Server Name</value> <value>Server Name</value>
</data> </data>
@ -153,4 +162,28 @@
<data name="headerAddServers.Text" xml:space="preserve"> <data name="headerAddServers.Text" xml:space="preserve">
<value>Enabled Servers</value> <value>Enabled Servers</value>
</data> </data>
<data name="headerServerInfo.Text" xml:space="preserve">
<value>Server Info</value>
</data>
<data name="lbRestart.Text" xml:space="preserve">
<value>Restart</value>
</data>
<data name="lbShutdown.Text" xml:space="preserve">
<value>Shut Down</value>
</data>
<data name="lbViewInfo.OnClientClick" xml:space="preserve">
<value>ShowProgressDialog('Getting Server Info ...');</value>
</data>
<data name="lbViewInfo.Text" xml:space="preserve">
<value>View Info</value>
</data>
<data name="locFreeSpace" xml:space="preserve">
<value>Free Space:</value>
</data>
<data name="locSize" xml:space="preserve">
<value>Size:</value>
</data>
<data name="locVolumeName.Text" xml:space="preserve">
<value>Volume Name:</value>
</data>
</root> </root>

View file

@ -1,15 +1,17 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSCollectionServers.ascx.cs" Inherits="WebsitePanel.Portal.RDS.UserControls.RDSCollectionServers" %> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSCollectionServers.ascx.cs" Inherits="WebsitePanel.Portal.RDS.UserControls.RDSCollectionServers" %>
<%@ Register Src="../../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %> <%@ Register Src="../../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %>
<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %>
<asp:UpdatePanel ID="UsersUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true"> <asp:UpdatePanel ID="UsersUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate> <ContentTemplate>
<div class="FormButtonsBarClean"> <div class="FormButtonsBarClean">
<asp:Button ID="btnAdd" runat="server" Text="Add..." CssClass="Button1" OnClick="btnAdd_Click" meta:resourcekey="btnAdd" /> <asp:Button ID="btnAdd" runat="server" Text="Add..." CssClass="Button1" OnClick="btnAdd_Click" meta:resourcekey="btnAdd" />
<asp:Button ID="btnDelete" runat="server" Text="Delete" CssClass="Button1" OnClick="btnDelete_Click" meta:resourcekey="btnDelete"/> <asp:Button ID="btnDelete" runat="server" Text="Delete" CssClass="Button1" OnClick="btnDelete_Click" meta:resourcekey="btnDelete"/>
<asp:Button ID="btnRefresh" runat="server" Text="Refresh" CssClass="Button1" OnClick="btnRefresh_Click" OnClientClick="ShowProgressDialog('Refreshing...'); return true;" meta:resourcekey="btnRefresh" />
</div> </div>
<asp:GridView ID="gvServers" runat="server" meta:resourcekey="gvServers" AutoGenerateColumns="False" <asp:GridView ID="gvServers" runat="server" meta:resourcekey="gvServers" AutoGenerateColumns="False"
Width="600px" CssSelectorClass="NormalGridView" Width="600px" CssSelectorClass="NormalGridView"
DataKeyNames="Id"> DataKeyNames="Id" OnRowCommand="gvServers_RowCommand">
<Columns> <Columns>
<asp:TemplateField> <asp:TemplateField>
<HeaderTemplate> <HeaderTemplate>
@ -21,18 +23,139 @@
<ItemStyle Width="10px" /> <ItemStyle Width="10px" />
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvServerName" HeaderText="gvServerName"> <asp:TemplateField meta:resourcekey="gvServerName" HeaderText="gvServerName">
<ItemStyle Width="60%" Wrap="false"> <ItemStyle Width="30%" Wrap="false">
</ItemStyle> </ItemStyle>
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="litFqdName" runat="server" Text='<%# Eval("FqdName") %>'></asp:Literal> <asp:Literal ID="litFqdName" runat="server" Text='<%# Eval("FqdName") %>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvPopupStatus">
<ItemStyle Width="30%" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Literal ID="litStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Literal>
<asp:HiddenField ID="hdnRdsCollectionId" runat="server" Value='<%# Eval("RdsCollectionId") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvViewInfo">
<ItemStyle Width="10%" HorizontalAlign="Right"/>
<ItemTemplate>
<asp:LinkButton OnClientClick="ShowProgressDialog('Getting Server Info ...');return true;" Visible='<%# Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>' CommandName="ViewInfo" CommandArgument='<%# Eval("FqdName")%>' ID="lbViewInfo" runat="server" Text="View Info"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvRestart">
<ItemStyle Width="10%" HorizontalAlign="Right"/>
<ItemTemplate>
<asp:LinkButton ID="lbRestart" CommandName="Restart" CommandArgument='<%# Eval("FqdName")%>' Visible='<%# Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
runat="server" Text="Restart" OnClientClick="return confirm('Are you sure you want to restart selected server?')"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvShutdown">
<ItemStyle Width="10%" HorizontalAlign="Right"/>
<ItemTemplate>
<asp:LinkButton ID="lbShutdown" CommandName="ShutDown" CommandArgument='<%# Eval("FqdName")%>' Visible='<%# Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
runat="server" Text="Shut Down" OnClientClick="return confirm('Are you sure you want to shu down selected server?')"/>
</ItemTemplate>
</asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
<br /> <br />
<asp:Panel ID="ServerInfoPanel" runat="server" CssClass="Popup" style="display:none">
<asp:Panel ID="AddServersPanel" runat="server" CssClass="Popup" style="display:none"> <table class="Popup-Header" cellpadding="0" cellspacing="0">
<tr>
<td class="Popup-HeaderLeft"/>
<td class="Popup-HeaderTitle">
<asp:Localize ID="Localize1" runat="server" meta:resourcekey="headerServerInfo"></asp:Localize>
</td>
<td class="Popup-HeaderRight"/>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br />
<asp:UpdatePanel ID="serverInfoUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="Popup-Scroll" style="height:auto;">
<wsp:CollapsiblePanel id="secServerInfo" runat="server" TargetControlID="panelHardwareInfo" meta:resourcekey="secRdsApplicationEdit" Text=""/>
<asp:Panel runat="server" ID="panelHardwareInfo">
<table>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locProcessor" runat="server" Text="Processor:"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litProcessor" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locLoadPercentage" Text="Load Percentage:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litLoadPercentage" runat="server"/>
</td>
</tr>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locMemoryAllocated" runat="server" Text="Allocated Memory:"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litMemoryAllocated" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locFreeMemory" Text="Free Memory:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litFreeMemory" runat="server"/>
</td>
</tr>
</table>
</asp:Panel>
<wsp:CollapsiblePanel id="secRdsApplicationEdit" runat="server" TargetControlID="panelDiskDrives" meta:resourcekey="secRdsApplicationEdit" Text="Disk Drives"/>
<asp:Panel runat="server" ID="panelDiskDrives">
<table>
<asp:Repeater ID="rpServerDrives" runat="server" EnableViewState="false">
<ItemTemplate>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litDeviceId" runat="server" Text='<%# Eval("DeviceId") %>'/>
</td>
<td class="FormLabel150" style="width: 150px;"/>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locVolumeName" Text="Volume Name:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litVolumeName" Text='<%# Eval("VolumeName") %>' runat="server"/>
</td>
</tr>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locSize" Text="Size:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litSize" Text='<%# Eval("SizeMb") + " MB" %>' runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locFreeSpace" Text="Free Space:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litFreeSpace" Text='<%# Eval("FreeSpaceMb") + " MB" %>' runat="server"/>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</asp:Panel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
</div>
<div class="FormFooter">
<asp:Button ID="btnCancelServerInfo" runat="server" CssClass="Button1" meta:resourcekey="btnServerInfoCancel" Text="Cancel" CausesValidation="false" />
</div>
</div>
</asp:Panel>
<asp:Panel ID="AddServersPanel" runat="server" CssClass="Popup" style="display:none">
<table class="Popup-Header" cellpadding="0" cellspacing="0"> <table class="Popup-Header" cellpadding="0" cellspacing="0">
<tr> <tr>
<td class="Popup-HeaderLeft"></td> <td class="Popup-HeaderLeft"></td>
@ -71,11 +194,11 @@
<ItemStyle Width="10px" /> <ItemStyle Width="10px" />
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvPopupServerName"> <asp:TemplateField meta:resourcekey="gvPopupServerName">
<ItemStyle Width="70%"></ItemStyle> <ItemStyle Width="70%"/>
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="litName" runat="server" Text='<%# Eval("FqdName") %>'></asp:Literal> <asp:Literal ID="litName" runat="server" Text='<%# Eval("FqdName") %>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
@ -91,10 +214,12 @@
</div> </div>
</asp:Panel> </asp:Panel>
<asp:Button ID="btnAddServersFake" runat="server" style="display:none;" /> <asp:Button ID="btnViewInfoFake" runat="server" style="display:none;" />
<ajaxToolkit:ModalPopupExtender ID="AddServersModal" runat="server" <ajaxToolkit:ModalPopupExtender ID="ViewInfoModal" runat="server" TargetControlID="btnViewInfoFake" PopupControlID="ServerInfoPanel"
TargetControlID="btnAddServersFake" PopupControlID="AddServersPanel" BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="btnCancelServerInfo"/>
BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="btnCancelAdd"/>
<asp:Button ID="btnAddServersFake" runat="server" style="display:none;" />
<ajaxToolkit:ModalPopupExtender ID="AddServersModal" runat="server" TargetControlID="btnAddServersFake" PopupControlID="AddServersPanel"
BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="btnCancelAdd"/>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>

View file

@ -35,12 +35,14 @@ using System.Linq;
using WebsitePanel.Providers.Web; using WebsitePanel.Providers.Web;
using WebsitePanel.EnterpriseServer.Base.HostedSolution; using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Providers.RemoteDesktopServices; using WebsitePanel.Providers.RemoteDesktopServices;
using AjaxControlToolkit;
namespace WebsitePanel.Portal.RDS.UserControls namespace WebsitePanel.Portal.RDS.UserControls
{ {
public partial class RDSCollectionServers : WebsitePanelControlBase public partial class RDSCollectionServers : WebsitePanelControlBase
{ {
public const string DirectionString = "DirectionString"; public const string DirectionString = "DirectionString";
public event EventHandler OnRefreshClicked;
protected enum SelectedState protected enum SelectedState
{ {
@ -53,6 +55,17 @@ namespace WebsitePanel.Portal.RDS.UserControls
{ {
BindServers(servers, false); BindServers(servers, false);
} }
public void BindServers(RdsServer[] servers)
{
gvServers.DataSource = servers;
gvServers.DataBind();
}
public void HideRefreshButton()
{
btnRefresh.Visible = false;
}
public List<RdsServer> GetServers() public List<RdsServer> GetServers()
{ {
@ -172,6 +185,13 @@ namespace WebsitePanel.Portal.RDS.UserControls
RdsServer server = new RdsServer(); RdsServer server = new RdsServer();
server.Id = (int)gvServers.DataKeys[i][0]; server.Id = (int)gvServers.DataKeys[i][0];
server.FqdName = ((Literal)row.FindControl("litFqdName")).Text; server.FqdName = ((Literal)row.FindControl("litFqdName")).Text;
server.Status = ((Literal)row.FindControl("litStatus")).Text;
var rdsCollectionId = ((HiddenField)row.FindControl("hdnRdsCollectionId")).Value;
if (!string.IsNullOrEmpty(rdsCollectionId))
{
server.RdsCollectionId = Convert.ToInt32(rdsCollectionId);
}
if (state == SelectedState.All || if (state == SelectedState.All ||
(state == SelectedState.Selected && chkSelect.Checked) || (state == SelectedState.Selected && chkSelect.Checked) ||
@ -209,6 +229,12 @@ namespace WebsitePanel.Portal.RDS.UserControls
protected void BindOrganizationServers() protected void BindOrganizationServers()
{ {
RdsServer[] servers = ES.Services.RDS.GetOrganizationRdsServersPaged(PanelRequest.ItemID, PanelRequest.CollectionID, "FqdName", txtSearchValue.Text, null, 0, 1000).Servers; RdsServer[] servers = ES.Services.RDS.GetOrganizationRdsServersPaged(PanelRequest.ItemID, PanelRequest.CollectionID, "FqdName", txtSearchValue.Text, null, 0, 1000).Servers;
foreach(var rdsServer in servers)
{
rdsServer.Status = ES.Services.RDS.GetRdsServerStatus(PanelRequest.ItemID, rdsServer.FqdName);
}
Array.Sort(servers, CompareAccount); Array.Sort(servers, CompareAccount);
if (Direction == SortDirection.Ascending) if (Direction == SortDirection.Ascending)
@ -240,5 +266,59 @@ namespace WebsitePanel.Portal.RDS.UserControls
{ {
return string.Compare(server1.FqdName, server2.FqdName); return string.Compare(server1.FqdName, server2.FqdName);
} }
protected void gvServers_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ViewInfo")
{
try
{
ShowInfo(e.CommandArgument.ToString());
}
catch (Exception)
{
}
}
else if (e.CommandName == "Restart")
{
Restart(e.CommandArgument.ToString());
}
else if (e.CommandName == "ShutDown")
{
ShutDown(e.CommandArgument.ToString());
}
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
if (OnRefreshClicked != null)
{
OnRefreshClicked(GetServers(), new EventArgs());
}
}
private void ShowInfo(string serverName)
{
ViewInfoModal.Show();
var serverInfo = ES.Services.RDS.GetRdsServerInfo(PanelRequest.ItemID, serverName);
litProcessor.Text = string.Format("{0}x{1} MHz", serverInfo.NumberOfCores, serverInfo.MaxClockSpeed);
litLoadPercentage.Text = string.Format("{0}%", serverInfo.LoadPercentage);
litMemoryAllocated.Text = string.Format("{0} MB", serverInfo.MemoryAllocatedMb);
litFreeMemory.Text = string.Format("{0} MB", serverInfo.FreeMemoryMb);
rpServerDrives.DataSource = serverInfo.Drives;
rpServerDrives.DataBind();
}
private void Restart(string serverName)
{
ES.Services.RDS.RestartRdsServer(PanelRequest.ItemID, serverName);
Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_edit_collection", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID));
}
private void ShutDown(string serverName)
{
ES.Services.RDS.ShutDownRdsServer(PanelRequest.ItemID, serverName);
Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_edit_collection", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID));
}
} }
} }

View file

@ -39,6 +39,15 @@ namespace WebsitePanel.Portal.RDS.UserControls {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Button btnDelete; protected global::System.Web.UI.WebControls.Button btnDelete;
/// <summary>
/// btnRefresh control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnRefresh;
/// <summary> /// <summary>
/// gvServers control. /// gvServers control.
/// </summary> /// </summary>
@ -48,6 +57,159 @@ namespace WebsitePanel.Portal.RDS.UserControls {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.GridView gvServers; protected global::System.Web.UI.WebControls.GridView gvServers;
/// <summary>
/// ServerInfoPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel ServerInfoPanel;
/// <summary>
/// Localize1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize Localize1;
/// <summary>
/// serverInfoUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel serverInfoUpdatePanel;
/// <summary>
/// secServerInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secServerInfo;
/// <summary>
/// panelHardwareInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelHardwareInfo;
/// <summary>
/// locProcessor control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locProcessor;
/// <summary>
/// litProcessor control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litProcessor;
/// <summary>
/// locLoadPercentage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locLoadPercentage;
/// <summary>
/// litLoadPercentage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litLoadPercentage;
/// <summary>
/// locMemoryAllocated control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locMemoryAllocated;
/// <summary>
/// litMemoryAllocated control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litMemoryAllocated;
/// <summary>
/// locFreeMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locFreeMemory;
/// <summary>
/// litFreeMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litFreeMemory;
/// <summary>
/// secRdsApplicationEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secRdsApplicationEdit;
/// <summary>
/// panelDiskDrives control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelDiskDrives;
/// <summary>
/// rpServerDrives control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater rpServerDrives;
/// <summary>
/// btnCancelServerInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnCancelServerInfo;
/// <summary> /// <summary>
/// AddServersPanel control. /// AddServersPanel control.
/// </summary> /// </summary>
@ -129,6 +291,24 @@ namespace WebsitePanel.Portal.RDS.UserControls {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Button btnCancelAdd; protected global::System.Web.UI.WebControls.Button btnCancelAdd;
/// <summary>
/// btnViewInfoFake control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnViewInfoFake;
/// <summary>
/// ViewInfoModal control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::AjaxControlToolkit.ModalPopupExtender ViewInfoModal;
/// <summary> /// <summary>
/// btnAddServersFake control. /// btnAddServersFake control.
/// </summary> /// </summary>

View file

@ -0,0 +1,144 @@
// 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;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Web.UI.WebControls;
namespace WebsitePanel.Portal.UserControls
{
public abstract class ActionListControlBase<TEnum> : WebsitePanelControlBase
{
public event CancelEventHandler ExecutingAction;
public event EventHandler ExecutedAction;
#region Properties
public string GridViewID { get; set; }
public string CheckboxesName { get; set; }
private string _message = "ACTIONS_MESSAGE";
public string Message
{
get { return _message; }
set { _message = value; }
}
#endregion
protected abstract DropDownList ActionsList { get; }
protected abstract int DoAction(List<int> ids);
public TEnum SelectedAction
{
get
{
return (TEnum)(object)Convert.ToInt32(ActionsList.SelectedValue);
}
}
protected GridView GridView
{
get { return Parent.FindControl(GridViewID) as GridView; }
}
public void ResetSelection()
{
ActionsList.ClearSelection();
}
public void RemoveActionItem<TNum>(TNum value)
{
ActionsList.Items.Remove(ActionsList.Items.FindByValue(((int)(object)value).ToString()));
}
protected void FireExecuteAction()
{
if (ExecutingAction != null)
{
var e = new CancelEventArgs();
ExecutingAction(this, e);
if (e.Cancel)
return;
}
DoAction();
if (ExecutedAction != null)
ExecutedAction(this, new EventArgs());
}
protected void DoAction()
{
if (GridView == null || String.IsNullOrWhiteSpace(CheckboxesName))
return;
// Get checked users
var ids = Utils.GetCheckboxValuesFromGrid<int>(GridView, CheckboxesName);
if ((int)(object)SelectedAction != 0)
{
if (ids.Count > 0)
{
try
{
var result = DoAction(ids);
if (result < 0)
{
HostModule.ShowResultMessage(result);
return;
}
HostModule.ShowSuccessMessage(Message);
}
catch (Exception ex)
{
HostModule.ShowErrorMessage(Message, ex);
}
// Refresh users grid
GridView.DataBind();
}
else
{
HostModule.ShowWarningMessage(Message);
}
}
}
}
}

View file

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnApply.Text" xml:space="preserve">
<value>Apply</value>
</data>
<data name="ddlDomainActionsItem.Actions" xml:space="preserve">
<value>- Actions -</value>
</data>
<data name="ddlDomainActionsItem.CreateInstantAlias" xml:space="preserve">
<value>Create Instant Alias</value>
</data>
<data name="ddlDomainActionsItem.DeleteInstantAlias" xml:space="preserve">
<value>Delete Instant Alias</value>
</data>
<data name="ddlDomainActionsItem.DisableDns" xml:space="preserve">
<value>Disable Dns</value>
</data>
<data name="ddlDomainActionsItem.EnableDns" xml:space="preserve">
<value>Enable Dns</value>
</data>
</root>

View file

@ -132,6 +132,9 @@
<data name="btnServiceLevelOk.Text" xml:space="preserve"> <data name="btnServiceLevelOk.Text" xml:space="preserve">
<value>Ok</value> <value>Ok</value>
</data> </data>
<data name="cmdApply.AlternateText" xml:space="preserve">
<value>Apply</value>
</data>
<data name="ddlUserActionsItem.Actions" xml:space="preserve"> <data name="ddlUserActionsItem.Actions" xml:space="preserve">
<value>- Actions -</value> <value>- Actions -</value>
</data> </data>

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnApply.Text" xml:space="preserve">
<value>Apply</value>
</data>
<data name="ddlWebsiteActionsItem.Actions" xml:space="preserve">
<value>- Actions -</value>
</data>
<data name="ddlWebsiteActionsItem.RestartAppPool" xml:space="preserve">
<value>Restart App Pool</value>
</data>
<data name="ddlWebsiteActionsItem.Start" xml:space="preserve">
<value>Start</value>
</data>
<data name="ddlWebsiteActionsItem.Stop" xml:space="preserve">
<value>Stop</value>
</data>
</root>

View file

@ -0,0 +1,37 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DomainActions.ascx.cs" Inherits="WebsitePanel.Portal.DomainActions" %>
<script language="javascript">
function ShowProrgess(btn) {
var action = $(btn).prev().val();
if (action === 1) {
ShowProgressDialog("Enabling Dns...");
} else if (action == 2) {
ShowProgressDialog("Disabling Dns...");
} else if (action == 3) {
ShowProgressDialog("Creating Instant Alias...");
} else if (action == 4) {
ShowProgressDialog("Removing Instant Alias...");
}
}
</script>
<asp:UpdatePanel ID="tblActions" runat="server" CssClass="NormalBold" UpdateMode="Conditional" ChildrenAsTriggers="true" >
<ContentTemplate>
<asp:DropDownList ID="ddlDomainActions" runat="server" CssClass="NormalTextBox" resourcekey="ddlDomainActions" AutoPostBack="True">
<asp:ListItem Value="0">Actions</asp:ListItem>
<asp:ListItem Value="1">EnableDns</asp:ListItem>
<asp:ListItem Value="2">DisableDns</asp:ListItem>
<asp:ListItem Value="3">CreateInstantAlias</asp:ListItem>
<asp:ListItem Value="4">DeleteInstantAlias</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnApply" runat="server" meta:resourcekey="btnApply"
Text="Apply" CssClass="Button1" OnClick="btnApply_Click" OnClientClick="return ShowProrgess(this);" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnApply" />
</Triggers>
</asp:UpdatePanel>

View file

@ -0,0 +1,179 @@
// 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.Collections.Generic;
using System.Drawing;
using System.Linq;
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 Microsoft.Web.Services3.Referral;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Portal.UserControls;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal
{
public enum DomainActionTypes
{
None = 0,
EnableDns = 1,
DisableDns = 2,
CreateInstantAlias = 3,
DeleteInstantAlias = 4,
}
public partial class DomainActions : ActionListControlBase<DomainActionTypes>
{
protected void Page_Load(object sender, EventArgs e)
{
// Remove DNS items if current Hosting plan does not allow it
if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.Dns))
{
RemoveActionItem(DomainActionTypes.EnableDns);
RemoveActionItem(DomainActionTypes.DisableDns);
}
// Remove Instant Alias items if current Hosting plan does not allow it
PackageSettings packageSettings = ES.Services.Packages.GetPackageSettings(PanelSecurity.PackageId, PackageSettings.INSTANT_ALIAS);
if (packageSettings == null || String.IsNullOrEmpty(packageSettings["InstantAlias"]))
{
RemoveActionItem(DomainActionTypes.CreateInstantAlias);
RemoveActionItem(DomainActionTypes.DeleteInstantAlias);
}
// hide control if no actions allowed
if (ActionsList.Items.Count <= 1)
{
Visible = false;
}
}
protected override DropDownList ActionsList
{
get { return ddlDomainActions; }
}
protected override int DoAction(List<int> ids)
{
switch (SelectedAction)
{
case DomainActionTypes.EnableDns:
return EnableDns(true, ids);
case DomainActionTypes.DisableDns:
return EnableDns(false, ids);
case DomainActionTypes.CreateInstantAlias:
return CreateInstantAlias(true, ids);
case DomainActionTypes.DeleteInstantAlias:
return CreateInstantAlias(false, ids);
}
return 0;
}
protected void btnApply_Click(object sender, EventArgs e)
{
switch (SelectedAction)
{
case DomainActionTypes.EnableDns:
case DomainActionTypes.DisableDns:
case DomainActionTypes.CreateInstantAlias:
case DomainActionTypes.DeleteInstantAlias:
FireExecuteAction();
break;
}
}
private int EnableDns(bool enable, List<int> ids)
{
foreach (var id in ids)
{
// load domain
DomainInfo domain = ES.Services.Servers.GetDomain(id);
if (domain == null)
continue;
// load package context
PackageContext cntx = PackagesHelper.GetCachedPackageContext(domain.PackageId);
bool dnsEnabled = cntx.Groups.ContainsKey(ResourceGroups.Dns);
if (!dnsEnabled)
continue;
int result;
if (enable)
result = ES.Services.Servers.EnableDomainDns(id);
else
result = ES.Services.Servers.DisableDomainDns(id);
if (result < 0)
return result;
}
return 0;
}
private int CreateInstantAlias(bool enable, List<int> ids)
{
foreach (var id in ids)
{
// load domain
DomainInfo domain = ES.Services.Servers.GetDomain(id);
if (domain == null)
continue;
// instant alias
bool instantAliasAllowed = !String.IsNullOrEmpty(domain.InstantAliasName);
if (!instantAliasAllowed || domain.IsDomainPointer || domain.IsInstantAlias)
continue;
int result;
if (enable)
result = ES.Services.Servers.CreateDomainInstantAlias("", id);
else
result = ES.Services.Servers.DeleteDomainInstantAlias(id);
if (result < 0)
return result;
}
return 0;
}
}
}

View file

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal {
public partial class DomainActions {
/// <summary>
/// tblActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel tblActions;
/// <summary>
/// ddlDomainActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlDomainActions;
/// <summary>
/// btnApply control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnApply;
}
}

View file

@ -2,6 +2,16 @@
<%@ Register Src="Quota.ascx" TagName="Quota" TagPrefix="wsp" %> <%@ Register Src="Quota.ascx" TagName="Quota" TagPrefix="wsp" %>
<%@ Register Src="ServerDetails.ascx" TagName="ServerDetails" TagPrefix="wsp" %> <%@ Register Src="ServerDetails.ascx" TagName="ServerDetails" TagPrefix="wsp" %>
<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %> <%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %>
<%@ Register Src="WebsiteActions.ascx" TagName="WebsiteActions" TagPrefix="wsp" %>
<script src="JavaScript/jquery-1.4.4.min.js" type="text/javascript"></script>
<script language="javascript">
function SelectAllCheckboxes(box) {
$(".NormalGridView tbody :checkbox").attr("checked", $(box).attr("checked"));
}
</script>
<div class="FormButtonsBar"> <div class="FormButtonsBar">
<div class="Left"> <div class="Left">
<asp:Button ID="btnAddItem" runat="server" Text="btnAddItem" CssClass="Button3" OnClick="btnAddItem_Click" /> <asp:Button ID="btnAddItem" runat="server" Text="btnAddItem" CssClass="Button3" OnClick="btnAddItem_Click" />
@ -9,7 +19,17 @@
meta:resourcekey="chkRecursive" AutoPostBack="true" Checked="True" CssClass="Normal" /> meta:resourcekey="chkRecursive" AutoPostBack="true" Checked="True" CssClass="Normal" />
</div> </div>
<div class="Right"> <div class="Right">
<wsp:SearchBox ID="searchBox" runat="server" /> <table>
<tr>
<td>
<wsp:WebsiteActions ID="websiteActions" runat="server" GridViewID="gvItems" CheckboxesName="chkSelectedIds" Visible="False" />
</td>
<td class="FormButtonsBarCleanSeparator"></td>
<td>
<wsp:SearchBox ID="searchBox" runat="server" />
</td>
</tr>
</table>
</div> </div>
</div> </div>
<asp:Literal ID="litGroupName" runat="server" Visible="false"></asp:Literal> <asp:Literal ID="litGroupName" runat="server" Visible="false"></asp:Literal>
@ -19,9 +39,17 @@
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="gvItems" runat="server" AutoGenerateColumns="False" AllowSorting="True" <asp:GridView ID="gvItems" runat="server" AutoGenerateColumns="False" AllowSorting="True"
DataSourceID="odsItemsPaged" EmptyDataText="gvItems" CssSelectorClass="NormalGridView" DataSourceID="odsItemsPaged" EmptyDataText="gvItems" CssSelectorClass="NormalGridView" DataKeyNames="ItemID"
AllowPaging="True" OnRowCommand="gvItems_RowCommand" OnRowDataBound="gvItems_RowDataBound"> AllowPaging="True" OnRowCommand="gvItems_RowCommand" OnRowDataBound="gvItems_RowDataBound">
<Columns> <Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="selectAll" Runat="server" onclick="javascript:SelectAllCheckboxes(this);" CssClass="HeaderCheckbox"></asp:CheckBox>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkSelectedIds" CssClass="GridCheckbox"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField SortExpression="ItemName" HeaderText="gvItemsName"> <asp:TemplateField SortExpression="ItemName" HeaderText="gvItemsName">
<ItemStyle Width="100%"></ItemStyle> <ItemStyle Width="100%"></ItemStyle>
<ItemTemplate> <ItemTemplate>

View file

@ -91,6 +91,12 @@ namespace WebsitePanel.Portal.UserControls
set { EnsureChildControls(); QuotasPanel.Visible = value; } set { EnsureChildControls(); QuotasPanel.Visible = value; }
} }
public bool ShowActions
{
get { EnsureChildControls(); return QuotasPanel.Visible; }
set { EnsureChildControls(); websiteActions.Visible = value; }
}
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
//HideServiceColumns(gvWebSites); //HideServiceColumns(gvWebSites);
@ -108,11 +114,11 @@ namespace WebsitePanel.Portal.UserControls
// visibility // visibility
chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User); chkRecursive.Visible = (PanelSecurity.SelectedUser.Role != UserRole.User);
gvItems.Columns[1].Visible = !String.IsNullOrEmpty(ViewLinkText); gvItems.Columns[2].Visible = !String.IsNullOrEmpty(ViewLinkText);
gvItems.Columns[2].Visible = gvItems.Columns[3].Visible = gvItems.Columns[3].Visible = gvItems.Columns[4].Visible =
(PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked; (PanelSecurity.SelectedUser.Role != UserRole.User) && chkRecursive.Checked;
gvItems.Columns[4].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator); gvItems.Columns[5].Visible = (PanelSecurity.SelectedUser.Role == UserRole.Administrator);
gvItems.Columns[5].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator); gvItems.Columns[6].Visible = (PanelSecurity.EffectiveUser.Role == UserRole.Administrator);
if (!IsPostBack) if (!IsPostBack)
{ {
@ -206,5 +212,6 @@ namespace WebsitePanel.Portal.UserControls
string localizedLinkText = HostModule.GetLocalizedString(ViewLinkText + ".Text"); string localizedLinkText = HostModule.GetLocalizedString(ViewLinkText + ".Text");
lnkView.Text = localizedLinkText != null ? localizedLinkText : ViewLinkText; lnkView.Text = localizedLinkText != null ? localizedLinkText : ViewLinkText;
} }
} }
} }

View file

@ -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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -58,6 +30,15 @@ namespace WebsitePanel.Portal.UserControls {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkRecursive; protected global::System.Web.UI.WebControls.CheckBox chkRecursive;
/// <summary>
/// websiteActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.WebsiteActions websiteActions;
/// <summary> /// <summary>
/// searchBox control. /// searchBox control.
/// </summary> /// </summary>

View file

@ -14,6 +14,8 @@
ShowProgressDialog('Disabling users...'); ShowProgressDialog('Disabling users...');
} else if (action == 2) { } else if (action == 2) {
ShowProgressDialog('Enabling users...'); ShowProgressDialog('Enabling users...');
} else if (action == 3) {
ShowProgressDialog('Prepare...');
} else if (action == 4) { } else if (action == 4) {
ShowProgressDialog('Setting VIP...'); ShowProgressDialog('Setting VIP...');
} else if (action == 5) { } else if (action == 5) {

View file

@ -42,6 +42,7 @@ using System.Web.UI.HtmlControls;
using Microsoft.Web.Services3.Referral; using Microsoft.Web.Services3.Referral;
using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer;
using WebsitePanel.EnterpriseServer.Base.HostedSolution; using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Portal.UserControls;
using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal namespace WebsitePanel.Portal
@ -57,40 +58,30 @@ namespace WebsitePanel.Portal
SetMailboxPlan = 6 SetMailboxPlan = 6
} }
public partial class UserActions : WebsitePanelControlBase public partial class UserActions : ActionListControlBase<UserActionTypes>
{ {
public event EventHandler ExecutingUserAction; public bool ShowSetMailboxPlan { get; set; }
private bool showSetMailboxPlan = false;
public bool ShowSetMailboxPlan
{
get { return showSetMailboxPlan; }
set { showSetMailboxPlan = value; }
}
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
// Remove Service Level item and VIP item from Action List if current Hosting plan does not allow Service Levels // Remove Service Level item and VIP item from Action List if current Hosting plan does not allow Service Levels
if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.ServiceLevels)) if (!PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId).Groups.ContainsKey(ResourceGroups.ServiceLevels))
{ {
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetServiceLevel).ToString())); RemoveActionItem(UserActionTypes.SetServiceLevel);
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetVIP).ToString())); RemoveActionItem(UserActionTypes.SetVIP);
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.UnsetVIP).ToString())); RemoveActionItem(UserActionTypes.UnsetVIP);
} }
if (!ShowSetMailboxPlan) if (!ShowSetMailboxPlan)
ddlUserActions.Items.Remove(ddlUserActions.Items.FindByValue(((int)UserActionTypes.SetMailboxPlan).ToString())); RemoveActionItem(UserActionTypes.SetMailboxPlan);
} }
public UserActionTypes SelectedAction protected override DropDownList ActionsList
{ {
get get { return ddlUserActions; }
{
return (UserActionTypes)Convert.ToInt32(ddlUserActions.SelectedValue);
}
} }
public int DoUserActions(List<int> userIds) protected override int DoAction(List<int> userIds)
{ {
switch (SelectedAction) switch (SelectedAction)
{ {
@ -99,7 +90,7 @@ namespace WebsitePanel.Portal
case UserActionTypes.Enable: case UserActionTypes.Enable:
return ChangeUsersSettings(userIds, false, null, null); return ChangeUsersSettings(userIds, false, null, null);
case UserActionTypes.SetServiceLevel: case UserActionTypes.SetServiceLevel:
return ChangeUsersSettings(userIds, null, SelectedServiceId, null); return ChangeUsersServiceLevel(userIds);
case UserActionTypes.SetVIP: case UserActionTypes.SetVIP:
return ChangeUsersSettings(userIds, null, null, true); return ChangeUsersSettings(userIds, null, null, true);
case UserActionTypes.UnsetVIP: case UserActionTypes.UnsetVIP:
@ -111,15 +102,45 @@ namespace WebsitePanel.Portal
return 0; return 0;
} }
protected void DoExecutingUserAction() protected int ChangeUsersServiceLevel(List<int> userIds)
{ {
if (ExecutingUserAction != null) if (ddlServiceLevels.SelectedItem == null)
ExecutingUserAction(this, new EventArgs()); return 0;
string levelName = ddlServiceLevels.SelectedItem.Text;
if (string.IsNullOrEmpty(levelName))
return 0;
int levelId;
if (!int.TryParse(ddlServiceLevels.SelectedItem.Value, out levelId))
return 0;
string quotaName = Quotas.SERVICE_LEVELS + levelName;
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (!cntx.Quotas.ContainsKey(quotaName))
return 0;
List<OrganizationUser> users = new List<OrganizationUser>();
foreach (int id in userIds)
users.Add(ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, id));
int usersCount = users.Count - users.Where(x => (x.LevelId == levelId)).Count();
if (!CheckServiceLevelQuota(cntx.Quotas[quotaName], usersCount))
return -1;
return ChangeUsersSettings(userIds, null, levelId, null);
} }
protected void btnModalOk_Click(object sender, EventArgs e) protected void btnModalOk_Click(object sender, EventArgs e)
{ {
DoExecutingUserAction(); FireExecuteAction();
} }
protected void btnModalCancel_OnClick(object sender, EventArgs e) protected void btnModalCancel_OnClick(object sender, EventArgs e)
@ -127,11 +148,6 @@ namespace WebsitePanel.Portal
ResetSelection(); ResetSelection();
} }
public void ResetSelection()
{
ddlUserActions.ClearSelection();
}
protected int ChangeUsersSettings(List<int> userIds, bool? disable, int? serviceLevelId, bool? isVIP) protected int ChangeUsersSettings(List<int> userIds, bool? disable, int? serviceLevelId, bool? isVIP)
{ {
foreach (var userId in userIds) foreach (var userId in userIds)
@ -185,8 +201,6 @@ namespace WebsitePanel.Portal
} }
#region ServiceLevel
protected int SetMailboxPlan(List<int> userIds) protected int SetMailboxPlan(List<int> userIds)
{ {
int planId; int planId;
@ -210,19 +224,20 @@ namespace WebsitePanel.Portal
return 0; return 0;
} }
protected int? SelectedServiceId #region ServiceLevel
{
get
{
if (ddlServiceLevels.SelectedValue == string.Empty)
return null;
return Convert.ToInt32(ddlServiceLevels.SelectedValue);
}
}
protected void FillServiceLevelsList() protected void FillServiceLevelsList()
{ {
if (GridView == null || String.IsNullOrWhiteSpace(CheckboxesName))
return;
List<int> ids = Utils.GetCheckboxValuesFromGrid<int>(GridView, CheckboxesName);
List<OrganizationUser> users = new List<OrganizationUser>();
foreach(int id in ids)
users.Add(ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, id));
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) if (cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels))
@ -231,12 +246,12 @@ namespace WebsitePanel.Portal
foreach (var quota in cntx.Quotas.Where(x => x.Key.Contains(Quotas.SERVICE_LEVELS))) foreach (var quota in cntx.Quotas.Where(x => x.Key.Contains(Quotas.SERVICE_LEVELS)))
{ {
foreach (var serviceLevel in ES.Services.Organizations.GetSupportServiceLevels()) foreach (ServiceLevel serviceLevel in ES.Services.Organizations.GetSupportServiceLevels())
{ {
if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value)) int usersCount = users.Count - users.Where(x => (x.LevelId == serviceLevel.LevelId)).Count();
{
if (quota.Key.Replace(Quotas.SERVICE_LEVELS, "") == serviceLevel.LevelName && CheckServiceLevelQuota(quota.Value, usersCount))
enabledServiceLevels.Add(serviceLevel); enabledServiceLevels.Add(serviceLevel);
}
} }
} }
@ -250,11 +265,11 @@ namespace WebsitePanel.Portal
} }
} }
private bool CheckServiceLevelQuota(QuotaValueInfo quota) private bool CheckServiceLevelQuota(QuotaValueInfo quota, int itemCount)
{ {
if (quota.QuotaAllocatedValue != -1) if (quota.QuotaAllocatedValue != -1)
{ {
return quota.QuotaAllocatedValue > quota.QuotaUsedValue; return quota.QuotaAllocatedValue >= quota.QuotaUsedValue + itemCount;
} }
return true; return true;
@ -270,7 +285,7 @@ namespace WebsitePanel.Portal
case UserActionTypes.Enable: case UserActionTypes.Enable:
case UserActionTypes.SetVIP: case UserActionTypes.SetVIP:
case UserActionTypes.UnsetVIP: case UserActionTypes.UnsetVIP:
DoExecutingUserAction(); FireExecuteAction();
break; break;
case UserActionTypes.SetServiceLevel: case UserActionTypes.SetServiceLevel:
FillServiceLevelsList(); FillServiceLevelsList();

View file

@ -0,0 +1,34 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebsiteActions.ascx.cs" Inherits="WebsitePanel.Portal.WebsiteActions" %>
<script language="javascript">
function ShowProrgess(btn) {
var action = $(btn).prev().val();
if (action === 1) {
ShowProgressDialog("Stopping websites...");
} else if (action == 2) {
ShowProgressDialog("Starting websites...");
} else if (action == 3) {
ShowProgressDialog("Restarting App Pools...");
}
}
</script>
<asp:UpdatePanel ID="tblActions" runat="server" CssClass="NormalBold" UpdateMode="Conditional" ChildrenAsTriggers="true" >
<ContentTemplate>
<asp:DropDownList ID="ddlWebsiteActions" runat="server" CssClass="NormalTextBox" resourcekey="ddlWebsiteActions" AutoPostBack="True">
<asp:ListItem Value="0">Actions</asp:ListItem>
<asp:ListItem Value="1">Stop</asp:ListItem>
<asp:ListItem Value="2">Start</asp:ListItem>
<asp:ListItem Value="3">RestartAppPool</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnApply" runat="server" meta:resourcekey="btnApply"
Text="Apply" CssClass="Button1" OnClick="btnApply_Click" OnClientClick="return ShowProrgess(this);" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnApply" />
</Triggers>
</asp:UpdatePanel>

View file

@ -0,0 +1,125 @@
// 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.Collections.Generic;
using System.Drawing;
using System.Linq;
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 Microsoft.Web.Services3.Referral;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
using WebsitePanel.Portal.UserControls;
using WebsitePanel.Providers;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal
{
public enum WebsiteActionTypes
{
None = 0,
Stop = 1,
Start = 2,
RestartAppPool = 3,
}
public partial class WebsiteActions : ActionListControlBase<WebsiteActionTypes>
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected override DropDownList ActionsList
{
get { return ddlWebsiteActions; }
}
protected override int DoAction(List<int> ids)
{
switch (SelectedAction)
{
case WebsiteActionTypes.Stop:
return ChangeWebsiteState(false, ids);
case WebsiteActionTypes.Start:
return ChangeWebsiteState(true, ids);
case WebsiteActionTypes.RestartAppPool:
return RestartAppPool(ids);
}
return 0;
}
protected void btnApply_Click(object sender, EventArgs e)
{
switch (SelectedAction)
{
case WebsiteActionTypes.Stop:
case WebsiteActionTypes.Start:
case WebsiteActionTypes.RestartAppPool:
FireExecuteAction();
break;
}
}
private int ChangeWebsiteState(bool enable, List<int> ids)
{
foreach (var id in ids)
{
var state = enable ? ServerState.Started : ServerState.Paused;
int result = ES.Services.WebServers.ChangeSiteState(id, state);
if (result < 0)
return result;
}
return 0;
}
private int RestartAppPool(List<int> ids)
{
foreach (var id in ids)
{
int result = ES.Services.WebServers.ChangeAppPoolState(id, AppPoolState.Recycle);
if (result < 0)
return result;
}
return 0;
}
}
}

View file

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal {
public partial class WebsiteActions {
/// <summary>
/// tblActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel tblActions;
/// <summary>
/// ddlWebsiteActions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlWebsiteActions;
/// <summary>
/// btnApply control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnApply;
}
}

View file

@ -1,9 +1,13 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebSites.ascx.cs" Inherits="WebsitePanel.Portal.WebSites" %> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebSites.ascx.cs" Inherits="WebsitePanel.Portal.WebSites" %>
<%@ Register Src="UserControls/SpaceServiceItems.ascx" TagName="SpaceServiceItems" TagPrefix="wsp" %> <%@ Register Src="UserControls/SpaceServiceItems.ascx" TagName="SpaceServiceItems" TagPrefix="wsp" %>
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<wsp:SpaceServiceItems ID="itemsList" runat="server" <wsp:SpaceServiceItems ID="itemsList" runat="server"
CreateButtonText="btnAddWebSite" CreateButtonText="btnAddWebSite"
CreateControlID="add_site" CreateControlID="add_site"
GroupName="Web" GroupName="Web"
TypeName="WebsitePanel.Providers.Web.WebSite, WebsitePanel.Providers.Base" TypeName="WebsitePanel.Providers.Web.WebSite, WebsitePanel.Providers.Base"
QuotaName="Web.Sites" /> QuotaName="Web.Sites"
ShowActions = "True" />

View file

@ -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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -40,6 +12,15 @@ namespace WebsitePanel.Portal {
public partial class WebSites { public partial class WebSites {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary> /// <summary>
/// itemsList control. /// itemsList control.
/// </summary> /// </summary>

View file

@ -843,6 +843,9 @@
<Compile Include="UserControls\DomainControl.ascx.designer.cs"> <Compile Include="UserControls\DomainControl.ascx.designer.cs">
<DependentUpon>DomainControl.ascx</DependentUpon> <DependentUpon>DomainControl.ascx</DependentUpon>
</Compile> </Compile>
<Compile Include="UserControls\ActionListControlBase.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="UserControls\DomainListControlBase.cs"> <Compile Include="UserControls\DomainListControlBase.cs">
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>
</Compile> </Compile>
@ -891,6 +894,20 @@
<Compile Include="UserControls\ItemButtonPanel.ascx.designer.cs"> <Compile Include="UserControls\ItemButtonPanel.ascx.designer.cs">
<DependentUpon>ItemButtonPanel.ascx</DependentUpon> <DependentUpon>ItemButtonPanel.ascx</DependentUpon>
</Compile> </Compile>
<Compile Include="UserControls\DomainActions.ascx.cs">
<DependentUpon>DomainActions.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="UserControls\DomainActions.ascx.designer.cs">
<DependentUpon>DomainActions.ascx</DependentUpon>
</Compile>
<Compile Include="UserControls\WebsiteActions.ascx.cs">
<DependentUpon>WebsiteActions.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="UserControls\WebsiteActions.ascx.designer.cs">
<DependentUpon>WebsiteActions.ascx</DependentUpon>
</Compile>
<Compile Include="UserControls\UserActions.ascx.cs"> <Compile Include="UserControls\UserActions.ascx.cs">
<DependentUpon>UserActions.ascx</DependentUpon> <DependentUpon>UserActions.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>
@ -4480,6 +4497,8 @@
<Content Include="UserControls\PackagePhoneNumbers.ascx" /> <Content Include="UserControls\PackagePhoneNumbers.ascx" />
<Content Include="Lync\UserControls\AllocatePackagePhoneNumbers.ascx" /> <Content Include="Lync\UserControls\AllocatePackagePhoneNumbers.ascx" />
<Content Include="UserControls\ItemButtonPanel.ascx" /> <Content Include="UserControls\ItemButtonPanel.ascx" />
<Content Include="UserControls\DomainActions.ascx" />
<Content Include="UserControls\WebsiteActions.ascx" />
<Content Include="UserControls\UserActions.ascx" /> <Content Include="UserControls\UserActions.ascx" />
<Content Include="UserOrganization.ascx" /> <Content Include="UserOrganization.ascx" />
<Content Include="VPSForPC\MonitoringPage.aspx" /> <Content Include="VPSForPC\MonitoringPage.aspx" />
@ -4550,6 +4569,8 @@
<Content Include="PhoneNumbersAddPhoneNumber.ascx" /> <Content Include="PhoneNumbersAddPhoneNumber.ascx" />
<Content Include="PhoneNumbersEditPhoneNumber.ascx" /> <Content Include="PhoneNumbersEditPhoneNumber.ascx" />
<Content Include="UserControls\App_LocalResources\UserActions.ascx.resx" /> <Content Include="UserControls\App_LocalResources\UserActions.ascx.resx" />
<Content Include="UserControls\App_LocalResources\DomainActions.ascx.resx" />
<EmbeddedResource Include="UserControls\App_LocalResources\WebsiteActions.ascx.resx" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="App_LocalResources\BandwidthReport.ascx.resx"> <Content Include="App_LocalResources\BandwidthReport.ascx.resx">