Merge
This commit is contained in:
commit
66070ddc66
147 changed files with 223854 additions and 595 deletions
|
@ -41,7 +41,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public const int LIMITED = 2;
|
||||
public const int ESS = 22;
|
||||
|
||||
// CRM 2013
|
||||
// CRM 2013/2015
|
||||
public const int PROFESSIONAL = 0;
|
||||
public const int BASIC = 2;
|
||||
public const int ESSENTIAL = 5;
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public const string Exchange = "Exchange";
|
||||
public const string HostedOrganizations = "Hosted Organizations";
|
||||
public const string HostedCRM = "Hosted CRM";
|
||||
public const string HostedCRM2013 = "Hosted CRM2013";
|
||||
public const string HostedCRM2013 = "Hosted CRM2013"; // CRM 2013/2015
|
||||
public const string VPS = "VPS";
|
||||
public const string BlackBerry = "BlackBerry";
|
||||
public const string OCS = "OCS";
|
||||
|
|
|
@ -81,6 +81,16 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
|
||||
private System.Threading.SendOrPostCallback SetEnterpriseFolderSettingsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetEnterpriseFolderGeneralSettingsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetEnterpriseFolderPermissionSettingsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetFolderOwaAccountsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetFolderOwaAccountsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetStatisticsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetStatisticsByOrganizationOperationCompleted;
|
||||
|
@ -169,6 +179,21 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
/// <remarks/>
|
||||
public event SetEnterpriseFolderSettingsCompletedEventHandler SetEnterpriseFolderSettingsCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event SetEnterpriseFolderGeneralSettingsCompletedEventHandler SetEnterpriseFolderGeneralSettingsCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event SetEnterpriseFolderPermissionSettingsCompletedEventHandler SetEnterpriseFolderPermissionSettingsCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetFolderOwaAccountsCompletedEventHandler GetFolderOwaAccountsCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event SetFolderOwaAccountsCompletedEventHandler SetFolderOwaAccountsCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventHandler GetUserEnterpriseFolderWithOwaEditPermissionCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetStatisticsCompletedEventHandler GetStatisticsCompleted;
|
||||
|
||||
|
@ -1223,6 +1248,237 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetEnterpriseFolderGeneralSettings", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public void SetEnterpriseFolderGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) {
|
||||
this.Invoke("SetEnterpriseFolderGeneralSettings", new object[] {
|
||||
itemId,
|
||||
folder,
|
||||
directoyBrowsingEnabled,
|
||||
quota,
|
||||
quotaType});
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginSetEnterpriseFolderGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("SetEnterpriseFolderGeneralSettings", new object[] {
|
||||
itemId,
|
||||
folder,
|
||||
directoyBrowsingEnabled,
|
||||
quota,
|
||||
quotaType}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void EndSetEnterpriseFolderGeneralSettings(System.IAsyncResult asyncResult) {
|
||||
this.EndInvoke(asyncResult);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetEnterpriseFolderGeneralSettingsAsync(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType) {
|
||||
this.SetEnterpriseFolderGeneralSettingsAsync(itemId, folder, directoyBrowsingEnabled, quota, quotaType, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetEnterpriseFolderGeneralSettingsAsync(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType, object userState) {
|
||||
if ((this.SetEnterpriseFolderGeneralSettingsOperationCompleted == null)) {
|
||||
this.SetEnterpriseFolderGeneralSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetEnterpriseFolderGeneralSettingsOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("SetEnterpriseFolderGeneralSettings", new object[] {
|
||||
itemId,
|
||||
folder,
|
||||
directoyBrowsingEnabled,
|
||||
quota,
|
||||
quotaType}, this.SetEnterpriseFolderGeneralSettingsOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnSetEnterpriseFolderGeneralSettingsOperationCompleted(object arg) {
|
||||
if ((this.SetEnterpriseFolderGeneralSettingsCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.SetEnterpriseFolderGeneralSettingsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetEnterpriseFolderPermissionSetting" +
|
||||
"s", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public void SetEnterpriseFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions) {
|
||||
this.Invoke("SetEnterpriseFolderPermissionSettings", new object[] {
|
||||
itemId,
|
||||
folder,
|
||||
permissions});
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginSetEnterpriseFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("SetEnterpriseFolderPermissionSettings", new object[] {
|
||||
itemId,
|
||||
folder,
|
||||
permissions}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void EndSetEnterpriseFolderPermissionSettings(System.IAsyncResult asyncResult) {
|
||||
this.EndInvoke(asyncResult);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetEnterpriseFolderPermissionSettingsAsync(int itemId, SystemFile folder, ESPermission[] permissions) {
|
||||
this.SetEnterpriseFolderPermissionSettingsAsync(itemId, folder, permissions, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetEnterpriseFolderPermissionSettingsAsync(int itemId, SystemFile folder, ESPermission[] permissions, object userState) {
|
||||
if ((this.SetEnterpriseFolderPermissionSettingsOperationCompleted == null)) {
|
||||
this.SetEnterpriseFolderPermissionSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetEnterpriseFolderPermissionSettingsOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("SetEnterpriseFolderPermissionSettings", new object[] {
|
||||
itemId,
|
||||
folder,
|
||||
permissions}, this.SetEnterpriseFolderPermissionSettingsOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnSetEnterpriseFolderPermissionSettingsOperationCompleted(object arg) {
|
||||
if ((this.SetEnterpriseFolderPermissionSettingsCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.SetEnterpriseFolderPermissionSettingsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetFolderOwaAccounts", 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 OrganizationUser[] GetFolderOwaAccounts(int itemId, SystemFile folder) {
|
||||
object[] results = this.Invoke("GetFolderOwaAccounts", new object[] {
|
||||
itemId,
|
||||
folder});
|
||||
return ((OrganizationUser[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetFolderOwaAccounts(int itemId, SystemFile folder, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetFolderOwaAccounts", new object[] {
|
||||
itemId,
|
||||
folder}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public OrganizationUser[] EndGetFolderOwaAccounts(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((OrganizationUser[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetFolderOwaAccountsAsync(int itemId, SystemFile folder) {
|
||||
this.GetFolderOwaAccountsAsync(itemId, folder, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetFolderOwaAccountsAsync(int itemId, SystemFile folder, object userState) {
|
||||
if ((this.GetFolderOwaAccountsOperationCompleted == null)) {
|
||||
this.GetFolderOwaAccountsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFolderOwaAccountsOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetFolderOwaAccounts", new object[] {
|
||||
itemId,
|
||||
folder}, this.GetFolderOwaAccountsOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetFolderOwaAccountsOperationCompleted(object arg) {
|
||||
if ((this.GetFolderOwaAccountsCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetFolderOwaAccountsCompleted(this, new GetFolderOwaAccountsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetFolderOwaAccounts", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public void SetFolderOwaAccounts(int itemId, SystemFile folder, OrganizationUser[] users) {
|
||||
this.Invoke("SetFolderOwaAccounts", new object[] {
|
||||
itemId,
|
||||
folder,
|
||||
users});
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginSetFolderOwaAccounts(int itemId, SystemFile folder, OrganizationUser[] users, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("SetFolderOwaAccounts", new object[] {
|
||||
itemId,
|
||||
folder,
|
||||
users}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void EndSetFolderOwaAccounts(System.IAsyncResult asyncResult) {
|
||||
this.EndInvoke(asyncResult);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetFolderOwaAccountsAsync(int itemId, SystemFile folder, OrganizationUser[] users) {
|
||||
this.SetFolderOwaAccountsAsync(itemId, folder, users, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetFolderOwaAccountsAsync(int itemId, SystemFile folder, OrganizationUser[] users, object userState) {
|
||||
if ((this.SetFolderOwaAccountsOperationCompleted == null)) {
|
||||
this.SetFolderOwaAccountsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetFolderOwaAccountsOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("SetFolderOwaAccounts", new object[] {
|
||||
itemId,
|
||||
folder,
|
||||
users}, this.SetFolderOwaAccountsOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnSetFolderOwaAccountsOperationCompleted(object arg) {
|
||||
if ((this.SetFolderOwaAccountsCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.SetFolderOwaAccountsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetUserEnterpriseFolderWithOwaEditPe" +
|
||||
"rmission", 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[] GetUserEnterpriseFolderWithOwaEditPermission(int itemId, int[] accountIds) {
|
||||
object[] results = this.Invoke("GetUserEnterpriseFolderWithOwaEditPermission", new object[] {
|
||||
itemId,
|
||||
accountIds});
|
||||
return ((string[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetUserEnterpriseFolderWithOwaEditPermission(int itemId, int[] accountIds, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetUserEnterpriseFolderWithOwaEditPermission", new object[] {
|
||||
itemId,
|
||||
accountIds}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public string[] EndGetUserEnterpriseFolderWithOwaEditPermission(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((string[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetUserEnterpriseFolderWithOwaEditPermissionAsync(int itemId, int[] accountIds) {
|
||||
this.GetUserEnterpriseFolderWithOwaEditPermissionAsync(itemId, accountIds, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetUserEnterpriseFolderWithOwaEditPermissionAsync(int itemId, int[] accountIds, object userState) {
|
||||
if ((this.GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted == null)) {
|
||||
this.GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetUserEnterpriseFolderWithOwaEditPermission", new object[] {
|
||||
itemId,
|
||||
accountIds}, this.GetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetUserEnterpriseFolderWithOwaEditPermissionOperationCompleted(object arg) {
|
||||
if ((this.GetUserEnterpriseFolderWithOwaEditPermissionCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetUserEnterpriseFolderWithOwaEditPermissionCompleted(this, new GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetStatistics", 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 OrganizationStatistics GetStatistics(int itemId) {
|
||||
|
@ -2053,6 +2309,70 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void SetEnterpriseFolderSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void SetEnterpriseFolderGeneralSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void SetEnterpriseFolderPermissionSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetFolderOwaAccountsCompletedEventHandler(object sender, GetFolderOwaAccountsCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetFolderOwaAccountsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetFolderOwaAccountsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public OrganizationUser[] Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((OrganizationUser[])(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void SetFolderOwaAccountsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventHandler(object sender, GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetUserEnterpriseFolderWithOwaEditPermissionCompletedEventArgs(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 GetStatisticsCompletedEventHandler(object sender, GetStatisticsCompletedEventArgs e);
|
||||
|
|
|
@ -4543,6 +4543,69 @@ namespace WebsitePanel.EnterpriseServer
|
|||
);
|
||||
}
|
||||
|
||||
public static void DeleteAllEnterpriseFolderOwaUsers(int itemId, int folderId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteAllEnterpriseFolderOwaUsers",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@FolderID", folderId)
|
||||
);
|
||||
}
|
||||
|
||||
public static int AddEnterpriseFolderOwaUser(int itemId, int folderId, int accountId)
|
||||
{
|
||||
SqlParameter id = new SqlParameter("@ESOwsaUserId", SqlDbType.Int);
|
||||
id.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddEnterpriseFolderOwaUser",
|
||||
id,
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@FolderID", folderId),
|
||||
new SqlParameter("@AccountId", accountId)
|
||||
);
|
||||
|
||||
// read identity
|
||||
return Convert.ToInt32(id.Value);
|
||||
}
|
||||
|
||||
public static IDataReader GetEnterpriseFolderOwaUsers(int itemId, int folderId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetEnterpriseFolderOwaUsers",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@FolderID", folderId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetEnterpriseFolderId(int itemId, string folderName)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetEnterpriseFolderId",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@FolderName", folderName)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetUserEnterpriseFolderWithOwaEditPermission(int itemId, int accountId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetUserEnterpriseFolderWithOwaEditPermission",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Support Service Levels
|
||||
|
|
|
@ -32,6 +32,7 @@ using System.Collections.Specialized;
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using WebsitePanel.Providers;
|
||||
using WebsitePanel.Providers.DNS;
|
||||
|
@ -385,7 +386,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
var idn = new IdnMapping();
|
||||
|
||||
if (itemType == typeof(DnsZone))
|
||||
items.AddRange(dns.GetZones().Select(z => idn.GetUnicode(z)));
|
||||
items.AddRange(dns.GetZones().Select(z =>
|
||||
Encoding.UTF8.GetByteCount(z) == z.Length ? // IsASCII
|
||||
idn.GetUnicode(z) : z ));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,16 @@ namespace WebsitePanel.EnterpriseServer
|
|||
StartESBackgroundTaskInternal("SET_ENTERPRISE_FOLDER_SETTINGS", itemId, folder, permissions, directoyBrowsingEnabled, quota, quotaType);
|
||||
}
|
||||
|
||||
public static void SetESGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType)
|
||||
{
|
||||
SetESGeneralSettingsInternal("SET_ENTERPRISE_FOLDER_GENERAL_SETTINGS", itemId, folder, directoyBrowsingEnabled, quota, quotaType);
|
||||
}
|
||||
|
||||
public static void SetESFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions)
|
||||
{
|
||||
SetESFolderPermissionSettingsInternal("SET_ENTERPRISE_FOLDER_GENERAL_SETTINGS", itemId, folder, permissions);
|
||||
}
|
||||
|
||||
public static int AddWebDavAccessToken(WebDavAccessToken accessToken)
|
||||
{
|
||||
return DataProvider.AddWebDavAccessToken(accessToken);
|
||||
|
@ -257,6 +267,69 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return rootFolders;
|
||||
}
|
||||
|
||||
protected static void SetESGeneralSettingsInternal(string taskName, int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType)
|
||||
{
|
||||
// load organization
|
||||
var org = OrganizationController.GetOrganization(itemId);
|
||||
|
||||
try
|
||||
{
|
||||
TaskManager.StartTask("ENTERPRISE_STORAGE", taskName, org.PackageId);
|
||||
|
||||
EnterpriseStorageController.SetFRSMQuotaOnFolder(itemId, folder.Name, quota, quotaType);
|
||||
EnterpriseStorageController.SetDirectoryBrowseEnabled(itemId, folder.Url, directoyBrowsingEnabled);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// log error
|
||||
TaskManager.WriteError(ex, "Error executing enterprise storage background task");
|
||||
}
|
||||
finally
|
||||
{
|
||||
// complete task
|
||||
try
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static void SetESFolderPermissionSettingsInternal(string taskName, int itemId, SystemFile folder, ESPermission[] permissions)
|
||||
{
|
||||
// load organization
|
||||
var org = OrganizationController.GetOrganization(itemId);
|
||||
|
||||
new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
TaskManager.StartTask("ENTERPRISE_STORAGE", taskName, org.PackageId);
|
||||
|
||||
EnterpriseStorageController.SetFolderPermission(itemId, folder.Name, permissions);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// log error
|
||||
TaskManager.WriteError(ex, "Error executing enterprise storage background task");
|
||||
}
|
||||
finally
|
||||
{
|
||||
// complete task
|
||||
try
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}).Start();
|
||||
}
|
||||
|
||||
protected static void StartESBackgroundTaskInternal(string taskName, int itemId, SystemFile folder, ESPermission[] permissions, bool directoyBrowsingEnabled, int quota, QuotaType quotaType)
|
||||
{
|
||||
// load organization
|
||||
|
@ -1265,6 +1338,87 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return null;
|
||||
}
|
||||
|
||||
public static OrganizationUser[] GetFolderOwaAccounts(int itemId, string folderName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var folderId = GetFolderId(itemId, folderName);
|
||||
|
||||
var users = ObjectUtils.CreateListFromDataReader<OrganizationUser>(DataProvider.GetEnterpriseFolderOwaUsers(itemId, folderId));
|
||||
|
||||
return users.ToArray();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetFolderOwaAccounts(int itemId, string folderName, OrganizationUser[] users)
|
||||
{
|
||||
try
|
||||
{
|
||||
var folderId = GetFolderId(itemId, folderName);
|
||||
|
||||
DataProvider.DeleteAllEnterpriseFolderOwaUsers(itemId, folderId);
|
||||
|
||||
foreach (var user in users)
|
||||
{
|
||||
DataProvider.AddEnterpriseFolderOwaUser(itemId, folderId, user.AccountId);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
protected static int GetFolderId(int itemId, string folderName)
|
||||
{
|
||||
try
|
||||
{
|
||||
GetFolder(itemId, folderName);
|
||||
|
||||
var dataReader = DataProvider.GetEnterpriseFolderId(itemId, folderName);
|
||||
|
||||
while (dataReader.Read())
|
||||
{
|
||||
return (int)dataReader[0];
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<string> GetUserEnterpriseFolderWithOwaEditPermission(int itemId, List<int> accountIds)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = new List<string>();
|
||||
|
||||
|
||||
foreach (var accountId in accountIds)
|
||||
{
|
||||
var reader = DataProvider.GetUserEnterpriseFolderWithOwaEditPermission(itemId, accountId);
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
result.Add(Convert.ToString(reader["FolderName"]));
|
||||
}
|
||||
}
|
||||
|
||||
return result.Distinct().ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
#region WebDav portal
|
||||
|
||||
public static string GetWebDavPortalUserSettingsByAccountId(int accountId)
|
||||
|
|
|
@ -1074,10 +1074,14 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
private static void CheckNumericQuota(PackageContext cntx, List<string> errors, string quotaName, int currentVal, int val, string messageKey)
|
||||
private static void CheckNumericQuota(PackageContext cntx, List<string> errors, string quotaName, long currentVal, long val, string messageKey)
|
||||
{
|
||||
CheckQuotaValue(cntx, errors, quotaName, currentVal, val, messageKey);
|
||||
}
|
||||
private static void CheckNumericQuota(PackageContext cntx, List<string> errors, string quotaName, int currentVal, int val, string messageKey)
|
||||
{
|
||||
CheckQuotaValue(cntx, errors, quotaName, Convert.ToInt64(currentVal), Convert.ToInt64(val), messageKey);
|
||||
}
|
||||
|
||||
private static void CheckNumericQuota(PackageContext cntx, List<string> errors, string quotaName, int val, string messageKey)
|
||||
{
|
||||
|
@ -1094,7 +1098,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
CheckQuotaValue(cntx, errors, quotaName, 0, -1, messageKey);
|
||||
}
|
||||
|
||||
private static void CheckQuotaValue(PackageContext cntx, List<string> errors, string quotaName, int currentVal, int val, string messageKey)
|
||||
private static void CheckQuotaValue(PackageContext cntx, List<string> errors, string quotaName, long currentVal, long val, string messageKey)
|
||||
{
|
||||
if (!cntx.Quotas.ContainsKey(quotaName))
|
||||
return;
|
||||
|
@ -1111,7 +1115,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
errors.Add(messageKey);
|
||||
else if (quota.QuotaTypeId == 2)
|
||||
{
|
||||
int maxValue = quota.QuotaAllocatedValue - quota.QuotaUsedValue + currentVal;
|
||||
long maxValue = quota.QuotaAllocatedValue - quota.QuotaUsedValue + currentVal;
|
||||
if(val > maxValue)
|
||||
errors.Add(messageKey + ":" + maxValue);
|
||||
}
|
||||
|
@ -1795,8 +1799,9 @@ namespace WebsitePanel.EnterpriseServer
|
|||
else if (state == VirtualMachineRequestedState.Reboot)
|
||||
{
|
||||
// shutdown first
|
||||
ResultObject shutdownResult = ChangeVirtualMachineState(itemId, VirtualMachineRequestedState.ShutDown);
|
||||
if(!shutdownResult.IsSuccess)
|
||||
ResultObject shutdownResult = ChangeVirtualMachineState(itemId,
|
||||
VirtualMachineRequestedState.ShutDown);
|
||||
if (!shutdownResult.IsSuccess)
|
||||
{
|
||||
TaskManager.CompleteResultTask(res);
|
||||
return shutdownResult;
|
||||
|
@ -1817,20 +1822,29 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
JobResult result = vps.ChangeVirtualMachineState(machine.VirtualMachineId, state);
|
||||
|
||||
// check return
|
||||
if (result.ReturnValue != ReturnCode.JobStarted)
|
||||
if (result.Job.JobState == ConcreteJobState.Completed)
|
||||
{
|
||||
LogReturnValueResult(res, result);
|
||||
TaskManager.CompleteResultTask(res);
|
||||
TaskManager.CompleteTask();
|
||||
return res;
|
||||
}
|
||||
|
||||
// wait for completion
|
||||
if (!JobCompleted(vps, result.Job))
|
||||
else
|
||||
{
|
||||
LogJobResult(res, result.Job);
|
||||
TaskManager.CompleteResultTask(res);
|
||||
return res;
|
||||
// check return
|
||||
if (result.ReturnValue != ReturnCode.JobStarted)
|
||||
{
|
||||
LogReturnValueResult(res, result);
|
||||
TaskManager.CompleteResultTask(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
// wait for completion
|
||||
if (!JobCompleted(vps, result.Job))
|
||||
{
|
||||
LogJobResult(res, result.Job);
|
||||
TaskManager.CompleteResultTask(res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,6 +196,36 @@ namespace WebsitePanel.EnterpriseServer
|
|||
EnterpriseStorageController.StartSetEnterpriseFolderSettingsBackgroundTask(itemId, folder, permissions, directoyBrowsingEnabled, quota, quotaType);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void SetEnterpriseFolderGeneralSettings(int itemId, SystemFile folder, bool directoyBrowsingEnabled, int quota, QuotaType quotaType)
|
||||
{
|
||||
EnterpriseStorageController.SetESGeneralSettings(itemId, folder, directoyBrowsingEnabled, quota, quotaType);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void SetEnterpriseFolderPermissionSettings(int itemId, SystemFile folder, ESPermission[] permissions)
|
||||
{
|
||||
EnterpriseStorageController.SetESFolderPermissionSettings(itemId, folder, permissions);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public OrganizationUser[] GetFolderOwaAccounts(int itemId, SystemFile folder)
|
||||
{
|
||||
return EnterpriseStorageController.GetFolderOwaAccounts(itemId, folder.Name);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void SetFolderOwaAccounts(int itemId, SystemFile folder, OrganizationUser[] users)
|
||||
{
|
||||
EnterpriseStorageController.SetFolderOwaAccounts(itemId, folder.Name, users);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<string> GetUserEnterpriseFolderWithOwaEditPermission(int itemId, List<int> accountIds)
|
||||
{
|
||||
return EnterpriseStorageController.GetUserEnterpriseFolderWithOwaEditPermission(itemId, accountIds);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Statistics
|
||||
|
|
|
@ -145,6 +145,7 @@ namespace WebsitePanel.Providers.OS
|
|||
}
|
||||
|
||||
public string RelativeUrl { get; set; }
|
||||
public string Summary { get; set; }
|
||||
|
||||
public string DriveLetter
|
||||
{
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public enum AutomaticStartAction
|
||||
{
|
||||
Undefined = 100,
|
||||
Nothing = 0,
|
||||
StartIfRunning = 1,
|
||||
Start = 2,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public enum AutomaticStopAction
|
||||
{
|
||||
Undefined = 100,
|
||||
TurnOff = 0,
|
||||
Save = 1,
|
||||
ShutDown = 2,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public class BiosInfo
|
||||
{
|
||||
public bool NumLockEnabled { get; set; }
|
||||
public string[] StartupOrder { get; set; }
|
||||
public bool BootFromCD { get; set; }
|
||||
}
|
||||
}
|
|
@ -42,6 +42,9 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
Completed = 7,
|
||||
Terminated = 8,
|
||||
Killed = 9,
|
||||
Exception = 10
|
||||
Exception = 10,
|
||||
|
||||
NotStarted = 11,
|
||||
Failed = 12,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public enum ControllerType
|
||||
{
|
||||
IDE = 0,
|
||||
SCSI = 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public class DvdDriveInfo
|
||||
{
|
||||
public ControllerType ControllerType { get; set; }
|
||||
public int ControllerNumber { get; set; }
|
||||
public int ControllerLocation { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Id { get; set; }
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public class MemoryInfo
|
||||
{
|
||||
public bool DynamicMemoryEnabled { get; set; }
|
||||
public Int64 Startup { get; set; }
|
||||
public Int64 Minimum { get; set; }
|
||||
public Int64 Maximum { get; set; }
|
||||
public int Buffer { get; set; }
|
||||
public int Priority { get; set; }
|
||||
}
|
||||
}
|
|
@ -35,9 +35,10 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
public enum OperationalStatus
|
||||
{
|
||||
None = 0,
|
||||
OK = 2,
|
||||
Ok = 2,
|
||||
Error = 6,
|
||||
NoContact = 12,
|
||||
LostCommunication = 13
|
||||
LostCommunication = 13,
|
||||
Paused = 15
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public enum VirtualHardDiskFormat
|
||||
{
|
||||
VHD = 0,
|
||||
VHDX = 1
|
||||
}
|
||||
}
|
|
@ -40,5 +40,15 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
public long MaxInternalSize { get; set; }
|
||||
public string ParentPath { get; set; }
|
||||
public VirtualHardDiskType DiskType { get; set; }
|
||||
public bool SupportPersistentReservations { get; set; }
|
||||
public ulong MaximumIOPS { get; set; }
|
||||
public ulong MinimumIOPS { get; set; }
|
||||
public ControllerType VHDControllerType { get; set; }
|
||||
public int ControllerNumber { get; set; }
|
||||
public int ControllerLocation { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Path { get; set; }
|
||||
public VirtualHardDiskFormat DiskFormat { get; set; }
|
||||
public bool Attached { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,8 +69,8 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
public int CpuUsage { get; set; }
|
||||
|
||||
[Persistent]
|
||||
public int RamSize { get; set; }
|
||||
public int RamUsage { get; set; }
|
||||
public long RamSize { get; set; }
|
||||
public long RamUsage { get; set; }
|
||||
[Persistent]
|
||||
public int HddSize { get; set; }
|
||||
public LogicalDisk[] HddLogicalDisks { get; set; }
|
||||
|
@ -123,5 +123,24 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
|
||||
// for GetVirtualMachineEx used in import method
|
||||
public VirtualMachineNetworkAdapter[] Adapters { get; set; }
|
||||
|
||||
[Persistent]
|
||||
public VirtualHardDiskInfo[] Disks { get; set; }
|
||||
|
||||
[Persistent]
|
||||
public string Status { get; set; }
|
||||
|
||||
[Persistent]
|
||||
public string ReplicationState { get; set; }
|
||||
|
||||
[Persistent]
|
||||
public int Generation { get; set; }
|
||||
|
||||
[Persistent]
|
||||
public int ProcessorCount { get; set; }
|
||||
|
||||
[Persistent]
|
||||
public string ParentSnapshotId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,5 +36,6 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
{
|
||||
public string Name { get; set; }
|
||||
public string MacAddress { get; set; }
|
||||
public string SwitchName { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
public string Id { get; set; }
|
||||
public string CheckPointId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string VMName { get; set; }
|
||||
public string ParentId { get; set; }
|
||||
public DateTime Created { get; set; }
|
||||
public bool IsCurrent { get; set; }
|
||||
|
|
|
@ -34,8 +34,9 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
{
|
||||
public enum VirtualMachineState
|
||||
{
|
||||
/*
|
||||
Unknown = 0,
|
||||
Started = 2, // start
|
||||
Running = 2, // start
|
||||
Off = 3, // turn off
|
||||
Reset = 10, // reset
|
||||
Paused = 32768, // pause
|
||||
|
@ -47,5 +48,36 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
Stopping = 32774,
|
||||
Deleted = 32775,
|
||||
Pausing = 32776
|
||||
*/
|
||||
Snapshotting = 32771,
|
||||
Migrating = 32772,
|
||||
Deleted = 32775,
|
||||
|
||||
Unknown = 0,
|
||||
Other = 1,
|
||||
Running = 2,
|
||||
Off = 3,
|
||||
Stopping = 32774, // new 4
|
||||
Saved = 32769, // new 6
|
||||
Paused = 32768, // new 9
|
||||
Starting = 32770, // new 10
|
||||
Reset = 10, // new 11
|
||||
Saving = 32773, // new 32773
|
||||
Pausing = 32776, // new 32776
|
||||
Resuming = 32777,
|
||||
FastSaved = 32779,
|
||||
FastSaving = 32780,
|
||||
RunningCritical = 32781,
|
||||
OffCritical = 32782,
|
||||
StoppingCritical = 32783,
|
||||
SavedCritical = 32784,
|
||||
PausedCritical = 32785,
|
||||
StartingCritical = 32786,
|
||||
ResetCritical = 32787,
|
||||
SavingCritical = 32788,
|
||||
PausingCritical = 32789,
|
||||
ResumingCritical = 32790,
|
||||
FastSavedCritical = 32791,
|
||||
FastSavingCritical = 32792
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,5 +37,6 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
{
|
||||
[Persistent]
|
||||
public string SwitchId { get; set; }
|
||||
public string SwitchType { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,6 +288,9 @@
|
|||
<Compile Include="Statistics\StatsServer.cs" />
|
||||
<Compile Include="Statistics\StatsSite.cs" />
|
||||
<Compile Include="Statistics\StatsUser.cs" />
|
||||
<Compile Include="Virtualization\AutomaticStopAction.cs" />
|
||||
<Compile Include="Virtualization\AutomaticStartAction.cs" />
|
||||
<Compile Include="Virtualization\BiosInfo.cs" />
|
||||
<Compile Include="Virtualization\ChangeJobStateReturnCode.cs" />
|
||||
<Compile Include="Virtualization\ConcreteJob.cs">
|
||||
<SubType>Code</SubType>
|
||||
|
@ -298,6 +301,7 @@
|
|||
<Compile Include="Virtualization\ConcreteJobState.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Virtualization\ControllerType.cs" />
|
||||
<Compile Include="Virtualization\IVirtualizationServer.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -308,6 +312,8 @@
|
|||
<Compile Include="Virtualization\KvpExchangeDataItem.cs" />
|
||||
<Compile Include="Virtualization\LibraryItem.cs" />
|
||||
<Compile Include="Virtualization\LogicalDisk.cs" />
|
||||
<Compile Include="Virtualization\DvdDriveInfo.cs" />
|
||||
<Compile Include="Virtualization\MemoryInfo.cs" />
|
||||
<Compile Include="Virtualization\MonitoredObjectAlert.cs" />
|
||||
<Compile Include="Virtualization\MonitoredObjectEvent.cs" />
|
||||
<Compile Include="Virtualization\MountedDiskInfo.cs" />
|
||||
|
@ -322,6 +328,7 @@
|
|||
<Compile Include="Virtualization\ThumbnailSize.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Virtualization\VirtualHardDiskFormat.cs" />
|
||||
<Compile Include="Virtualization\VirtualHardDiskInfo.cs" />
|
||||
<Compile Include="Virtualization\VirtualHardDiskType.cs" />
|
||||
<Compile Include="Virtualization\VirtualMachine.cs">
|
||||
|
|
|
@ -304,7 +304,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage
|
|||
var rootFolder = Path.Combine(settings.LocationDrive + ":\\", settings.HomeFolder);
|
||||
rootFolder = Path.Combine(rootFolder, organizationId);
|
||||
|
||||
var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND ({1})",
|
||||
var wsSql = string.Format(@"SELECT System.FileName, System.DateModified, System.Size, System.Kind, System.ItemPathDisplay, System.ItemType, System.Search.AutoSummary FROM SYSTEMINDEX WHERE System.FileName LIKE '%{0}%' AND ({1})",
|
||||
searchText, string.Join(" OR ", searchPaths.Select(x => string.Format("{0} = '{1}'", recursive ? "SCOPE" : "DIRECTORY", Path.Combine(rootFolder, x))).ToArray()));
|
||||
|
||||
conn.Open();
|
||||
|
@ -318,7 +318,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage
|
|||
var file = new SystemFile {Name = reader[0] as string};
|
||||
|
||||
file.Changed = file.CreatedDate = reader[1] is DateTime ? (DateTime)reader[1] : new DateTime();
|
||||
file.Size = reader[2] is long ? (long) reader[2] : 0;
|
||||
file.Size = reader[2] is Decimal ? Convert.ToInt64((Decimal) reader[2]) : 0;
|
||||
|
||||
var kind = reader[3] is IEnumerable ? ((IEnumerable)reader[3]).Cast<string>().ToList() : null;
|
||||
var itemType = reader[5] as string ?? string.Empty;
|
||||
|
@ -342,6 +342,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage
|
|||
}
|
||||
}
|
||||
|
||||
file.Summary = SanitizeXmlString(reader[6] as string);
|
||||
|
||||
result.Add(file);
|
||||
}
|
||||
}
|
||||
|
@ -352,6 +354,36 @@ namespace WebsitePanel.Providers.EnterpriseStorage
|
|||
}
|
||||
|
||||
|
||||
public string SanitizeXmlString(string xml)
|
||||
{
|
||||
if (xml == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var buffer = new StringBuilder(xml.Length);
|
||||
|
||||
foreach (char c in xml.Where(c => IsLegalXmlChar(c)))
|
||||
{
|
||||
buffer.Append(c);
|
||||
}
|
||||
|
||||
return buffer.ToString();
|
||||
}
|
||||
|
||||
public bool IsLegalXmlChar(int character)
|
||||
{
|
||||
return
|
||||
(
|
||||
character == 0x9 /* == '\t' == 9 */ ||
|
||||
character == 0xA /* == '\n' == 10 */ ||
|
||||
character == 0xD /* == '\r' == 13 */ ||
|
||||
(character >= 0x20 && character <= 0xD7FF) ||
|
||||
(character >= 0xE000 && character <= 0xFFFD) ||
|
||||
(character >= 0x10000 && character <= 0x10FFFF)
|
||||
);
|
||||
}
|
||||
|
||||
#region HostingServiceProvider methods
|
||||
|
||||
public override string[] Install()
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2015, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
|
||||
|
||||
namespace WebsitePanel.Providers.HostedSolution
|
||||
{
|
||||
public class CRMProvider2015 : CRMBase
|
||||
{
|
||||
|
||||
public override bool IsInstalled()
|
||||
{
|
||||
|
||||
return CRMServerVersion.StartsWith("7.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
// Copyright (c) 2015, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.Server.Utils;
|
||||
using System.Text;
|
||||
using System.Management.Automation.Runspaces;
|
||||
|
||||
namespace WebsitePanel.Providers.HostedSolution
|
||||
{
|
||||
public class HostedSolutionLog
|
||||
{
|
||||
public static string LogPrefix = "HostedSolution";
|
||||
|
||||
public static void LogStart(string message, params object[] args)
|
||||
{
|
||||
string text = String.Format(message, args);
|
||||
Log.WriteStart("{0} {1}", LogPrefix, text);
|
||||
}
|
||||
|
||||
public static void LogEnd(string message, params object[] args)
|
||||
{
|
||||
string text = String.Format(message, args);
|
||||
Log.WriteEnd("{0} {1}", LogPrefix, text);
|
||||
}
|
||||
|
||||
public static void LogInfo(string message)
|
||||
{
|
||||
Log.WriteInfo("{0} {1}", LogPrefix, message);
|
||||
}
|
||||
|
||||
public static void LogInfo(string message, params object[] args)
|
||||
{
|
||||
string text = String.Format(message, args);
|
||||
Log.WriteInfo("{0} {1}", LogPrefix, text);
|
||||
}
|
||||
|
||||
public static void LogWarning(string message)
|
||||
{
|
||||
Log.WriteWarning("{0} {1}", LogPrefix, message);
|
||||
}
|
||||
|
||||
public static void LogWarning(string message, params object[] args)
|
||||
{
|
||||
string text = String.Format(message, args);
|
||||
Log.WriteWarning("{0} {1}", LogPrefix, text);
|
||||
}
|
||||
|
||||
public static void LogError(Exception ex)
|
||||
{
|
||||
Log.WriteError(LogPrefix, ex);
|
||||
}
|
||||
|
||||
public static void LogError(string message, Exception ex)
|
||||
{
|
||||
string text = String.Format("{0} {1}", LogPrefix, message);
|
||||
Log.WriteError(text, ex);
|
||||
}
|
||||
|
||||
public static void DebugInfo(string message, params object[] args)
|
||||
{
|
||||
string text = String.Format(message, args);
|
||||
Log.WriteInfo("{0} {1}", LogPrefix, text);
|
||||
}
|
||||
|
||||
public static void EndLog(string message, ResultObject res, string errorCode, Exception ex)
|
||||
{
|
||||
if (res != null)
|
||||
{
|
||||
res.IsSuccess = false;
|
||||
|
||||
if (!string.IsNullOrEmpty(errorCode))
|
||||
res.ErrorCodes.Add(errorCode);
|
||||
}
|
||||
|
||||
if (ex != null)
|
||||
LogError(ex);
|
||||
|
||||
|
||||
//LogRecord.
|
||||
LogEnd(message);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void EndLog(string message, ResultObject res, string errorCode)
|
||||
{
|
||||
EndLog(message, res, errorCode, null);
|
||||
}
|
||||
|
||||
public static void EndLog(string message, ResultObject res)
|
||||
{
|
||||
EndLog(message, res, null);
|
||||
}
|
||||
|
||||
public static void EndLog(string message)
|
||||
{
|
||||
EndLog(message, null);
|
||||
}
|
||||
|
||||
internal static T StartLog<T>(string message) where T : ResultObject, new()
|
||||
{
|
||||
LogStart(message);
|
||||
T res = new T();
|
||||
res.IsSuccess = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void DebugCommand(Command cmd)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(cmd.CommandText);
|
||||
foreach (CommandParameter parameter in cmd.Parameters)
|
||||
{
|
||||
string formatString = " -{0} {1}";
|
||||
if (parameter.Value is string)
|
||||
formatString = " -{0} '{1}'";
|
||||
else if (parameter.Value is bool)
|
||||
formatString = " -{0} ${1}";
|
||||
sb.AppendFormat(formatString, parameter.Name, parameter.Value);
|
||||
}
|
||||
Log.WriteInfo("{0} {1}", LogPrefix, sb.ToString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,64 @@
|
|||
// 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.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WebsitePanel.Providers.HostedSolution.Crm2013")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WebsitePanel.Providers.HostedSolution.Crm2013")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("111E4961-46B0-4323-9EEB-8FE1DD1D48F6")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,105 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{96EC3A56-5598-4B2D-A1F2-2E0DB6BA2AB6}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WebsitePanel.Providers.HostedSolution.Crm2015</RootNamespace>
|
||||
<AssemblyName>WebsitePanel.Providers.HostedSolution.Crm2015</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\WebsitePanel.Server\bin\Crm2015\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\WebsitePanel.Server\bin\Crm2015\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Crm.Sdk.Proxy, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Lib\References\Microsoft\CRM2015\Microsoft.Crm.Sdk.Proxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xrm.Client">
|
||||
<HintPath>..\..\Lib\References\Microsoft\CRM2015\Microsoft.Xrm.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xrm.Client.CodeGeneration">
|
||||
<HintPath>..\..\Lib\References\Microsoft\CRM2015\Microsoft.Xrm.Client.CodeGeneration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xrm.Portal">
|
||||
<HintPath>..\..\Lib\References\Microsoft\CRM2015\Microsoft.Xrm.Portal.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xrm.Portal.Files">
|
||||
<HintPath>..\..\Lib\References\Microsoft\CRM2015\Microsoft.Xrm.Portal.Files.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Lib\References\Microsoft\CRM2015\Microsoft.Xrm.Sdk.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xrm.Sdk.Deployment, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Lib\References\Microsoft\CRM2015\Microsoft.Xrm.Sdk.Deployment.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Xrm.Sdk.Workflow">
|
||||
<HintPath>..\..\Lib\References\Microsoft\CRM2015\Microsoft.Xrm.Sdk.Workflow.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Lib\System.Management.Automation.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CRMBase.cs" />
|
||||
<Compile Include="CRMProvider2015.cs" />
|
||||
<Compile Include="HostedSolutionLog.cs" />
|
||||
<Compile Include="MyOrganizationCrmSdkTypes.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WebsitePanel.Providers.Base\WebsitePanel.Providers.Base.csproj">
|
||||
<Project>{684C932A-6C75-46AC-A327-F3689D89EB42}</Project>
|
||||
<Name>WebsitePanel.Providers.Base</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\WebsitePanel.Server.Utils\WebsitePanel.Server.Utils.csproj">
|
||||
<Project>{E91E52F3-9555-4D00-B577-2B1DBDD87CA7}</Project>
|
||||
<Name>WebsitePanel.Server.Utils</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
public const Int64 Size1G = 0x40000000;
|
||||
public const Int64 Size1M = 0x100000;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
static class PSObjectExtension
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public static object GetProperty(this PSObject obj, string name)
|
||||
{
|
||||
return obj.Members[name].Value;
|
||||
}
|
||||
public static T GetProperty<T>(this PSObject obj, string name)
|
||||
{
|
||||
return (T)obj.Members[name].Value;
|
||||
}
|
||||
public static T GetEnum<T>(this PSObject obj, string name) where T : struct
|
||||
{
|
||||
return (T)Enum.Parse(typeof(T), GetProperty(obj, name).ToString());
|
||||
}
|
||||
public static int GetInt(this PSObject obj, string name)
|
||||
{
|
||||
return Convert.ToInt32(obj.Members[name].Value);
|
||||
}
|
||||
public static long GetLong(this PSObject obj, string name)
|
||||
{
|
||||
return Convert.ToInt64(obj.Members[name].Value);
|
||||
}
|
||||
public static string GetString(this PSObject obj, string name)
|
||||
{
|
||||
return obj.Members[name].Value == null ? "" : obj.Members[name].Value.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
|
||||
public static ManagementObject Invoke(this PSObject obj, string name, object argument)
|
||||
{
|
||||
return obj.Invoke(name, new[] {argument});
|
||||
}
|
||||
public static ManagementObject Invoke(this PSObject obj, string name, params object[] arguments)
|
||||
{
|
||||
var results = (ManagementObjectCollection)obj.Methods[name].Invoke(arguments);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
return (ManagementObject) result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public static class BiosHelper
|
||||
{
|
||||
public static BiosInfo Get(PowerShellManager powerShell, string name, int generation)
|
||||
{
|
||||
BiosInfo info = new BiosInfo();
|
||||
|
||||
// for Win2012R2+ and Win8.1+
|
||||
if (generation == 2)
|
||||
{
|
||||
Command cmd = new Command("Get-VMFirmware");
|
||||
|
||||
cmd.Parameters.Add("VMName", name);
|
||||
|
||||
Collection<PSObject> result = powerShell.Execute(cmd, false);
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
info.NumLockEnabled = true;
|
||||
|
||||
List<string> startupOrders = new List<string>();
|
||||
info.BootFromCD = false;
|
||||
|
||||
foreach (dynamic item in (IEnumerable)result[0].GetProperty("BootOrder"))
|
||||
{
|
||||
string bootType = item.BootType.ToString();
|
||||
|
||||
// bootFromCD
|
||||
if (!startupOrders.Any() && bootType == "Drive")
|
||||
{
|
||||
var device = item.Device;
|
||||
info.BootFromCD = device.GetType().Name == "DvdDrive";
|
||||
}
|
||||
|
||||
// startupOrders
|
||||
startupOrders.Add(bootType);
|
||||
}
|
||||
|
||||
info.StartupOrder = startupOrders.ToArray();
|
||||
}
|
||||
}
|
||||
// for others win and linux
|
||||
else
|
||||
{
|
||||
Command cmd = new Command("Get-VMBios");
|
||||
|
||||
cmd.Parameters.Add("VMName", name);
|
||||
|
||||
Collection<PSObject> result = powerShell.Execute(cmd, false);
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
info.NumLockEnabled = Convert.ToBoolean(result[0].GetProperty("NumLockEnabled"));
|
||||
|
||||
List<string> startupOrders = new List<string>();
|
||||
|
||||
foreach (var item in (IEnumerable)result[0].GetProperty("StartupOrder"))
|
||||
startupOrders.Add(item.ToString());
|
||||
|
||||
info.StartupOrder = startupOrders.ToArray();
|
||||
info.BootFromCD = false;
|
||||
if (info.StartupOrder != null && info.StartupOrder.Length > 0)
|
||||
info.BootFromCD = info.StartupOrder[0] == "CD";
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public static void Update(PowerShellManager powerShell, VirtualMachine vm, bool bootFromCD, bool numLockEnabled)
|
||||
{
|
||||
// for Win2012R2+ and Win8.1+
|
||||
if (vm.Generation == 2)
|
||||
{
|
||||
Command cmd = new Command("Set-VMFirmware");
|
||||
|
||||
cmd.Parameters.Add("VMName", vm.Name);
|
||||
if (bootFromCD)
|
||||
cmd.Parameters.Add("FirstBootDevice", DvdDriveHelper.GetPS(powerShell, vm.Name));
|
||||
else
|
||||
cmd.Parameters.Add("FirstBootDevice", HardDriveHelper.GetPS(powerShell, vm.Name).FirstOrDefault());
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
// for others win and linux
|
||||
else
|
||||
{
|
||||
Command cmd = new Command("Set-VMBios");
|
||||
|
||||
cmd.Parameters.Add("VMName", vm.Name);
|
||||
var bootOrder = bootFromCD
|
||||
? new[] { "CD", "IDE", "LegacyNetworkAdapter", "Floppy" }
|
||||
: new[] { "IDE", "CD", "LegacyNetworkAdapter", "Floppy" };
|
||||
cmd.Parameters.Add("StartupOrder", bootOrder);
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public static class DvdDriveHelper
|
||||
{
|
||||
public static DvdDriveInfo Get(PowerShellManager powerShell, string vmName)
|
||||
{
|
||||
DvdDriveInfo info = null;
|
||||
|
||||
PSObject result = GetPS(powerShell, vmName);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
info = new DvdDriveInfo();
|
||||
info.Id = result.GetString("Id");
|
||||
info.Name = result.GetString("Name");
|
||||
info.ControllerType = result.GetEnum<ControllerType>("ControllerType");
|
||||
info.ControllerNumber = result.GetInt("ControllerNumber");
|
||||
info.ControllerLocation = result.GetInt("ControllerLocation");
|
||||
info.Path = result.GetString("Path");
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
public static PSObject GetPS(PowerShellManager powerShell, string vmName)
|
||||
{
|
||||
Command cmd = new Command("Get-VMDvdDrive");
|
||||
|
||||
cmd.Parameters.Add("VMName", vmName);
|
||||
|
||||
Collection<PSObject> result = powerShell.Execute(cmd, false);
|
||||
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
return result[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Set(PowerShellManager powerShell, string vmName, string path)
|
||||
{
|
||||
var dvd = Get(powerShell, vmName);
|
||||
|
||||
Command cmd = new Command("Set-VMDvdDrive");
|
||||
|
||||
cmd.Parameters.Add("VMName", vmName);
|
||||
cmd.Parameters.Add("Path", path);
|
||||
cmd.Parameters.Add("ControllerNumber", dvd.ControllerNumber);
|
||||
cmd.Parameters.Add("ControllerLocation", dvd.ControllerLocation);
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
|
||||
public static void Update(PowerShellManager powerShell, VirtualMachine vm, bool dvdDriveShouldBeInstalled)
|
||||
{
|
||||
if (!vm.DvdDriveInstalled && dvdDriveShouldBeInstalled)
|
||||
Add(powerShell, vm.Name);
|
||||
else if (vm.DvdDriveInstalled && !dvdDriveShouldBeInstalled)
|
||||
Remove(powerShell, vm.Name);
|
||||
}
|
||||
|
||||
public static void Add(PowerShellManager powerShell, string vmName)
|
||||
{
|
||||
Command cmd = new Command("Add-VMDvdDrive");
|
||||
|
||||
cmd.Parameters.Add("VMName", vmName);
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
|
||||
public static void Remove(PowerShellManager powerShell, string vmName)
|
||||
{
|
||||
var dvd = Get(powerShell, vmName);
|
||||
|
||||
Command cmd = new Command("Remove-VMDvdDrive");
|
||||
|
||||
cmd.Parameters.Add("VMName", vmName);
|
||||
cmd.Parameters.Add("ControllerNumber", dvd.ControllerNumber);
|
||||
cmd.Parameters.Add("ControllerLocation", dvd.ControllerLocation);
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public static class HardDriveHelper
|
||||
{
|
||||
public static VirtualHardDiskInfo[] Get(PowerShellManager powerShell, string vmname)
|
||||
{
|
||||
List<VirtualHardDiskInfo> disks = new List<VirtualHardDiskInfo>();
|
||||
|
||||
Collection<PSObject> result = GetPS(powerShell, vmname);
|
||||
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
foreach (PSObject d in result)
|
||||
{
|
||||
VirtualHardDiskInfo disk = new VirtualHardDiskInfo();
|
||||
|
||||
disk.SupportPersistentReservations = Convert.ToBoolean(d.GetProperty("SupportPersistentReservations"));
|
||||
disk.MaximumIOPS = Convert.ToUInt64(d.GetProperty("MaximumIOPS"));
|
||||
disk.MinimumIOPS = Convert.ToUInt64(d.GetProperty("MinimumIOPS"));
|
||||
disk.VHDControllerType = d.GetEnum<ControllerType>("ControllerType");
|
||||
disk.ControllerNumber = Convert.ToInt32(d.GetProperty("ControllerNumber"));
|
||||
disk.ControllerLocation = Convert.ToInt32(d.GetProperty("ControllerLocation"));
|
||||
disk.Path = d.GetProperty("Path").ToString();
|
||||
disk.Name = d.GetProperty("Name").ToString();
|
||||
|
||||
GetVirtualHardDiskDetail(powerShell, disk.Path, ref disk);
|
||||
|
||||
disks.Add(disk);
|
||||
}
|
||||
}
|
||||
return disks.ToArray();
|
||||
}
|
||||
|
||||
//public static VirtualHardDiskInfo GetByPath(PowerShellManager powerShell, string vhdPath)
|
||||
//{
|
||||
// VirtualHardDiskInfo info = null;
|
||||
// var vmNames = new List<string>();
|
||||
|
||||
// Command cmd = new Command("Get-VM");
|
||||
|
||||
// Collection<PSObject> result = powerShell.Execute(cmd, false);
|
||||
|
||||
// if (result == null || result.Count == 0)
|
||||
// return null;
|
||||
|
||||
// vmNames = result.Select(r => r.GetString("Name")).ToList();
|
||||
// var drives = vmNames.SelectMany(n => Get(powerShell, n));
|
||||
|
||||
// return drives.FirstOrDefault(d=>d.Path == vhdPath);
|
||||
//}
|
||||
|
||||
public static Collection<PSObject> GetPS(PowerShellManager powerShell, string vmname)
|
||||
{
|
||||
Command cmd = new Command("Get-VMHardDiskDrive");
|
||||
cmd.Parameters.Add("VMName", vmname);
|
||||
|
||||
return powerShell.Execute(cmd, false);
|
||||
}
|
||||
|
||||
public static void GetVirtualHardDiskDetail(PowerShellManager powerShell, string path, ref VirtualHardDiskInfo disk)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Command cmd = new Command("Get-VHD");
|
||||
cmd.Parameters.Add("Path", path);
|
||||
Collection<PSObject> result = powerShell.Execute(cmd, false);
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
disk.DiskFormat = result[0].GetEnum<VirtualHardDiskFormat>("VhdFormat");
|
||||
disk.DiskType = result[0].GetEnum<VirtualHardDiskType>("VhdType");
|
||||
disk.ParentPath = result[0].GetProperty<string>("ParentPath");
|
||||
disk.MaxInternalSize = Convert.ToInt64(result[0].GetProperty("Size"));
|
||||
disk.FileSize = Convert.ToInt64(result[0].GetProperty("FileSize"));
|
||||
disk.Attached = disk.InUse = Convert.ToBoolean(result[0].GetProperty("Attached"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public static class JobHelper
|
||||
{
|
||||
public static JobResult CreateSuccessResult(ReturnCode returnCode = ReturnCode.OK)
|
||||
{
|
||||
return new JobResult
|
||||
{
|
||||
Job = new ConcreteJob {JobState = ConcreteJobState.Completed},
|
||||
ReturnValue = returnCode
|
||||
};
|
||||
}
|
||||
|
||||
public static JobResult CreateResultFromPSResults(Collection<PSObject> objJob)
|
||||
{
|
||||
if (objJob == null || objJob.Count == 0)
|
||||
return null;
|
||||
|
||||
JobResult result = new JobResult();
|
||||
|
||||
result.Job = CreateFromPSObject(objJob);
|
||||
result.ReturnValue = ReturnCode.JobStarted;
|
||||
|
||||
switch (result.Job.JobState)
|
||||
{
|
||||
case ConcreteJobState.Failed:
|
||||
result.ReturnValue = ReturnCode.Failed;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ConcreteJob CreateFromPSObject(Collection<PSObject> objJob)
|
||||
{
|
||||
if (objJob == null || objJob.Count == 0)
|
||||
return null;
|
||||
|
||||
ConcreteJob job = new ConcreteJob();
|
||||
job.Id = objJob[0].GetProperty<int>("Id").ToString();
|
||||
job.JobState = objJob[0].GetEnum<ConcreteJobState>("JobStateInfo");
|
||||
job.Caption = objJob[0].GetProperty<string>("Name");
|
||||
job.Description = objJob[0].GetProperty<string>("Command");
|
||||
job.StartTime = objJob[0].GetProperty<DateTime>("PSBeginTime");
|
||||
job.ElapsedTime = objJob[0].GetProperty<DateTime?>("PSEndTime") ?? DateTime.Now;
|
||||
|
||||
// PercentComplete
|
||||
job.PercentComplete = 0;
|
||||
var progress = (PSDataCollection<ProgressRecord>)objJob[0].GetProperty("Progress");
|
||||
if (progress != null && progress.Count > 0)
|
||||
job.PercentComplete = progress[0].PercentComplete;
|
||||
|
||||
// Errors
|
||||
var errors = (PSDataCollection<ErrorRecord>)objJob[0].GetProperty("Error");
|
||||
if (errors != null && errors.Count > 0)
|
||||
{
|
||||
job.ErrorDescription = errors[0].ErrorDetails.Message + ". " + errors[0].ErrorDetails.RecommendedAction;
|
||||
job.ErrorCode = errors[0].Exception != null ? -1 : 0;
|
||||
}
|
||||
|
||||
return job;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public static class NetworkAdapterHelper
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const string EXTERNAL_NETWORK_ADAPTER_NAME = "External Network Adapter";
|
||||
private const string PRIVATE_NETWORK_ADAPTER_NAME = "Private Network Adapter";
|
||||
private const string MANAGEMENT_NETWORK_ADAPTER_NAME = "Management Network Adapter";
|
||||
|
||||
#endregion
|
||||
|
||||
public static VirtualMachineNetworkAdapter[] Get(PowerShellManager powerShell, string vmName)
|
||||
{
|
||||
List<VirtualMachineNetworkAdapter> adapters = new List<VirtualMachineNetworkAdapter>();
|
||||
|
||||
Command cmd = new Command("Get-VMNetworkAdapter");
|
||||
if (!string.IsNullOrEmpty(vmName)) cmd.Parameters.Add("VMName", vmName);
|
||||
|
||||
Collection<PSObject> result = powerShell.Execute(cmd, false);
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
foreach (PSObject psAdapter in result)
|
||||
{
|
||||
VirtualMachineNetworkAdapter adapter = new VirtualMachineNetworkAdapter();
|
||||
|
||||
adapter.Name = psAdapter.GetString("Name");
|
||||
adapter.MacAddress = psAdapter.GetString("MacAddress");
|
||||
adapter.SwitchName = psAdapter.GetString("SwitchName");
|
||||
|
||||
adapters.Add(adapter);
|
||||
}
|
||||
}
|
||||
return adapters.ToArray();
|
||||
}
|
||||
|
||||
public static VirtualMachineNetworkAdapter Get(PowerShellManager powerShell, string vmName, string macAddress)
|
||||
{
|
||||
var adapters = Get(powerShell, vmName);
|
||||
return adapters.FirstOrDefault(a => a.MacAddress == macAddress);
|
||||
}
|
||||
|
||||
public static void Update(PowerShellManager powerShell, VirtualMachine vm)
|
||||
{
|
||||
// External NIC
|
||||
if (!vm.ExternalNetworkEnabled && !String.IsNullOrEmpty(vm.ExternalNicMacAddress))
|
||||
{
|
||||
Delete(powerShell, vm.Name, vm.ExternalNicMacAddress);
|
||||
vm.ExternalNicMacAddress = null; // reset MAC
|
||||
}
|
||||
else if (vm.ExternalNetworkEnabled && !String.IsNullOrEmpty(vm.ExternalNicMacAddress)
|
||||
&& Get(powerShell,vm.Name,vm.ExternalNicMacAddress) == null)
|
||||
{
|
||||
Add(powerShell, vm.Name, vm.ExternalSwitchId, vm.ExternalNicMacAddress, EXTERNAL_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter);
|
||||
}
|
||||
|
||||
// Private NIC
|
||||
if (!vm.PrivateNetworkEnabled && !String.IsNullOrEmpty(vm.PrivateNicMacAddress))
|
||||
{
|
||||
Delete(powerShell, vm.Name, vm.PrivateNicMacAddress);
|
||||
vm.PrivateNicMacAddress = null; // reset MAC
|
||||
}
|
||||
else if (vm.PrivateNetworkEnabled && !String.IsNullOrEmpty(vm.PrivateNicMacAddress)
|
||||
&& Get(powerShell, vm.Name, vm.PrivateNicMacAddress) == null)
|
||||
{
|
||||
Add(powerShell, vm.Name, vm.PrivateSwitchId, vm.PrivateNicMacAddress, PRIVATE_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Add(PowerShellManager powerShell, string vmName, string switchId, string macAddress, string adapterName, bool legacyAdapter)
|
||||
{
|
||||
Command cmd = new Command("Add-VMNetworkAdapter");
|
||||
|
||||
cmd.Parameters.Add("VMName", vmName);
|
||||
cmd.Parameters.Add("Name", adapterName);
|
||||
cmd.Parameters.Add("SwitchName", switchId);
|
||||
|
||||
if (String.IsNullOrEmpty(macAddress))
|
||||
cmd.Parameters.Add("DynamicMacAddress");
|
||||
else
|
||||
cmd.Parameters.Add("StaticMacAddress", macAddress);
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
public static void Delete(PowerShellManager powerShell, string vmName, string macAddress)
|
||||
{
|
||||
var networkAdapter = Get(powerShell, vmName, macAddress);
|
||||
|
||||
if (networkAdapter == null)
|
||||
return;
|
||||
|
||||
Command cmd = new Command("Remove-VMNetworkAdapter");
|
||||
|
||||
cmd.Parameters.Add("VMName", vmName);
|
||||
cmd.Parameters.Add("Name", networkAdapter.Name);
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public static class SnapshotHelper
|
||||
{
|
||||
public static VirtualMachineSnapshot GetFromPS(PSObject psObject, string runningSnapshotId = null)
|
||||
{
|
||||
var snapshot = new VirtualMachineSnapshot
|
||||
{
|
||||
Id = psObject.GetString("Id"),
|
||||
Name = psObject.GetString("Name"),
|
||||
VMName = psObject.GetString("VMName"),
|
||||
ParentId = psObject.GetString("ParentSnapshotId"),
|
||||
Created = psObject.GetProperty<DateTime>("CreationTime")
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(snapshot.ParentId))
|
||||
snapshot.ParentId = null; // for capability
|
||||
|
||||
if (!String.IsNullOrEmpty(runningSnapshotId))
|
||||
snapshot.IsCurrent = snapshot.Id == runningSnapshotId;
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
public static VirtualMachineSnapshot GetFromWmi(ManagementBaseObject objSnapshot)
|
||||
{
|
||||
if (objSnapshot == null || objSnapshot.Properties.Count == 0)
|
||||
return null;
|
||||
|
||||
VirtualMachineSnapshot snapshot = new VirtualMachineSnapshot();
|
||||
snapshot.Id = (string)objSnapshot["InstanceID"];
|
||||
snapshot.Name = (string)objSnapshot["ElementName"];
|
||||
|
||||
string parentId = (string)objSnapshot["Parent"];
|
||||
if (!String.IsNullOrEmpty(parentId))
|
||||
{
|
||||
int idx = parentId.IndexOf("Microsoft:");
|
||||
snapshot.ParentId = parentId.Substring(idx, parentId.Length - idx - 1);
|
||||
snapshot.ParentId = snapshot.ParentId.ToLower().Replace("microsoft:", "");
|
||||
}
|
||||
if (!String.IsNullOrEmpty(snapshot.Id))
|
||||
{
|
||||
snapshot.Id = snapshot.Id.ToLower().Replace("microsoft:", "");
|
||||
}
|
||||
snapshot.Created = Wmi.ToDateTime((string)objSnapshot["CreationTime"]);
|
||||
|
||||
if (string.IsNullOrEmpty(snapshot.ParentId))
|
||||
snapshot.ParentId = null; // for capability
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
public static void Delete(PowerShellManager powerShell, VirtualMachineSnapshot snapshot, bool includeChilds)
|
||||
{
|
||||
Command cmd = new Command("Remove-VMSnapshot");
|
||||
cmd.Parameters.Add("VMName", snapshot.VMName);
|
||||
cmd.Parameters.Add("Name", snapshot.Name);
|
||||
if (includeChilds) cmd.Parameters.Add("IncludeAllChildSnapshots", true);
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public static class VirtualMachineHelper
|
||||
{
|
||||
public static OperationalStatus GetVMHeartBeatStatus(PowerShellManager powerShell, string name)
|
||||
{
|
||||
OperationalStatus status = OperationalStatus.None;
|
||||
|
||||
Command cmd = new Command("Get-VMIntegrationService");
|
||||
|
||||
cmd.Parameters.Add("VMName", name);
|
||||
cmd.Parameters.Add("Name", "HeartBeat");
|
||||
|
||||
Collection<PSObject> result = powerShell.Execute(cmd, false);
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
var statusString = result[0].GetProperty("PrimaryOperationalStatus");
|
||||
|
||||
if (statusString != null)
|
||||
status = (OperationalStatus)Enum.Parse(typeof(OperationalStatus), statusString.ToString());
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
public static int GetVMProcessors(PowerShellManager powerShell, string name)
|
||||
{
|
||||
|
||||
int procs = 0;
|
||||
|
||||
Command cmd = new Command("Get-VMProcessor");
|
||||
|
||||
cmd.Parameters.Add("VMName", name);
|
||||
|
||||
Collection<PSObject> result = powerShell.Execute(cmd, false);
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
procs = Convert.ToInt32(result[0].GetProperty("Count"));
|
||||
|
||||
}
|
||||
return procs;
|
||||
}
|
||||
|
||||
public static MemoryInfo GetVMMemory(PowerShellManager powerShell, string name)
|
||||
{
|
||||
MemoryInfo info = new MemoryInfo();
|
||||
|
||||
Command cmd = new Command("Get-VMMemory");
|
||||
|
||||
cmd.Parameters.Add("VMName", name);
|
||||
|
||||
Collection<PSObject> result = powerShell.Execute(cmd, false);
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
info.DynamicMemoryEnabled = Convert.ToBoolean(result[0].GetProperty("DynamicMemoryEnabled"));
|
||||
info.Startup = Convert.ToInt64(result[0].GetProperty("Startup")) / Constants.Size1M;
|
||||
info.Minimum = Convert.ToInt64(result[0].GetProperty("Minimum")) / Constants.Size1M;
|
||||
info.Maximum = Convert.ToInt64(result[0].GetProperty("Maximum")) / Constants.Size1M;
|
||||
info.Buffer = Convert.ToInt32(result[0].GetProperty("Buffer"));
|
||||
info.Priority = Convert.ToInt32(result[0].GetProperty("Priority"));
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
public static void UpdateProcessors(PowerShellManager powerShell, VirtualMachine vm, int cpuCores, int cpuLimitSettings, int cpuReserveSettings, int cpuWeightSettings)
|
||||
{
|
||||
Command cmd = new Command("Set-VMProcessor");
|
||||
|
||||
cmd.Parameters.Add("VMName", vm.Name);
|
||||
cmd.Parameters.Add("Count", cpuCores);
|
||||
cmd.Parameters.Add("Maximum", Convert.ToInt64(cpuLimitSettings * 1000));
|
||||
cmd.Parameters.Add("Reserve", Convert.ToInt64(cpuReserveSettings * 1000));
|
||||
cmd.Parameters.Add("RelativeWeight", cpuWeightSettings);
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
|
||||
public static void UpdateMemory(PowerShellManager powerShell, VirtualMachine vm, long ramMB)
|
||||
{
|
||||
Command cmd = new Command("Set-VMMemory");
|
||||
|
||||
cmd.Parameters.Add("VMName", vm.Name);
|
||||
cmd.Parameters.Add("StartupBytes", ramMB * Constants.Size1M);
|
||||
|
||||
powerShell.Execute(cmd, false);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,159 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
public class PowerShellManager : IDisposable
|
||||
{
|
||||
protected static InitialSessionState session = null;
|
||||
|
||||
protected Runspace RunSpace { get; set; }
|
||||
|
||||
public PowerShellManager()
|
||||
{
|
||||
OpenRunspace();
|
||||
}
|
||||
|
||||
protected void OpenRunspace()
|
||||
{
|
||||
HostedSolutionLog.LogStart("OpenRunspace");
|
||||
|
||||
if (session == null)
|
||||
{
|
||||
session = InitialSessionState.CreateDefault();
|
||||
session.ImportPSModule(new[] {"Hyper-V"});
|
||||
}
|
||||
|
||||
Runspace runSpace = RunspaceFactory.CreateRunspace(session);
|
||||
runSpace.Open();
|
||||
runSpace.SessionStateProxy.SetVariable("ConfirmPreference", "none");
|
||||
|
||||
RunSpace = runSpace;
|
||||
|
||||
HostedSolutionLog.LogEnd("OpenRunspace");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (RunSpace != null && RunSpace.RunspaceStateInfo.State == RunspaceState.Opened)
|
||||
{
|
||||
RunSpace.Close();
|
||||
RunSpace = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HostedSolutionLog.LogError("Runspace error", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<PSObject> Execute(Command cmd)
|
||||
{
|
||||
return Execute(cmd, true);
|
||||
}
|
||||
|
||||
public Collection<PSObject> Execute(Command cmd, bool useDomainController)
|
||||
{
|
||||
object[] errors;
|
||||
return Execute(cmd, useDomainController, out errors);
|
||||
}
|
||||
|
||||
public Collection<PSObject> Execute(Command cmd, out object[] errors)
|
||||
{
|
||||
return Execute(cmd, true, out errors);
|
||||
}
|
||||
|
||||
public Collection<PSObject> Execute(Command cmd, bool useDomainController, out object[] errors)
|
||||
{
|
||||
HostedSolutionLog.LogStart("Execute");
|
||||
List<object> errorList = new List<object>();
|
||||
|
||||
HostedSolutionLog.DebugCommand(cmd);
|
||||
Collection<PSObject> results = null;
|
||||
// Create a pipeline
|
||||
Pipeline pipeLine = RunSpace.CreatePipeline();
|
||||
using (pipeLine)
|
||||
{
|
||||
// Add the command
|
||||
pipeLine.Commands.Add(cmd);
|
||||
// Execute the pipeline and save the objects returned.
|
||||
results = pipeLine.Invoke();
|
||||
|
||||
// Log out any errors in the pipeline execution
|
||||
// NOTE: These errors are NOT thrown as exceptions!
|
||||
// Be sure to check this to ensure that no errors
|
||||
// happened while executing the command.
|
||||
if (pipeLine.Error != null && pipeLine.Error.Count > 0)
|
||||
{
|
||||
foreach (object item in pipeLine.Error.ReadToEnd())
|
||||
{
|
||||
errorList.Add(item);
|
||||
string errorMessage = string.Format("Invoke error: {0}", item);
|
||||
HostedSolutionLog.LogWarning(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
pipeLine = null;
|
||||
errors = errorList.ToArray();
|
||||
HostedSolutionLog.LogEnd("Execute");
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the identity of the object from the shell execution result
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetResultObjectIdentity(Collection<PSObject> result)
|
||||
{
|
||||
HostedSolutionLog.LogStart("GetResultObjectIdentity");
|
||||
if (result == null)
|
||||
throw new ArgumentNullException("result", "Execution result is not specified");
|
||||
|
||||
if (result.Count < 1)
|
||||
throw new ArgumentException("Execution result is empty", "result");
|
||||
|
||||
if (result.Count > 1)
|
||||
throw new ArgumentException("Execution result contains more than one object", "result");
|
||||
|
||||
PSMemberInfo info = result[0].Members["Identity"];
|
||||
if (info == null)
|
||||
throw new ArgumentException("Execution result does not contain Identity property", "result");
|
||||
|
||||
string ret = info.Value.ToString();
|
||||
HostedSolutionLog.LogEnd("GetResultObjectIdentity");
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static string GetResultObjectDN(Collection<PSObject> result)
|
||||
{
|
||||
HostedSolutionLog.LogStart("GetResultObjectDN");
|
||||
if (result == null)
|
||||
throw new ArgumentNullException("result", "Execution result is not specified");
|
||||
|
||||
if (result.Count < 1)
|
||||
throw new ArgumentException("Execution result does not contain any object");
|
||||
|
||||
if (result.Count > 1)
|
||||
throw new ArgumentException("Execution result contains more than one object");
|
||||
|
||||
PSMemberInfo info = result[0].Members["DistinguishedName"];
|
||||
if (info == null)
|
||||
throw new ArgumentException("Execution result does not contain DistinguishedName property", "result");
|
||||
|
||||
string ret = info.Value.ToString();
|
||||
HostedSolutionLog.LogEnd("GetResultObjectDN");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WebsitePanel.Providers.Virtualization.HyperV2012R2")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("WebsitePanel.Providers.Virtualization.HyperV2012R2")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("959c2614-2d69-4e4f-9e77-bd868e5afd4b")]
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WebsitePanel.Providers.Virtualization.HyperV2012R2</RootNamespace>
|
||||
<AssemblyName>WebsitePanel.Providers.Virtualization.HyperV2012R2</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\WebsitePanel.Server\bin\HyperV2012R2\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Storage.Vds">
|
||||
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Storage.Vds.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Lib\References\Microsoft\Windows2012\System.Management.Automation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\VersionInfo.cs">
|
||||
<Link>VersionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Extensions\PSObjectExtension.cs" />
|
||||
<Compile Include="Helpers\BiosHelper.cs" />
|
||||
<Compile Include="Helpers\HardDriveHelper.cs" />
|
||||
<Compile Include="Helpers\NetworkAdapterHelper.cs" />
|
||||
<Compile Include="Helpers\DvdDriveHelper.cs" />
|
||||
<Compile Include="Helpers\JobHelper.cs" />
|
||||
<Compile Include="Helpers\SnapshotHelper.cs" />
|
||||
<Compile Include="PowerShellManager.cs" />
|
||||
<Compile Include="HyperV2012R2.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Helpers\VirtualMachineHelper.cs" />
|
||||
<Compile Include="Wmi.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WebsitePanel.Providers.Base\WebsitePanel.Providers.Base.csproj">
|
||||
<Project>{684c932a-6c75-46ac-a327-f3689d89eb42}</Project>
|
||||
<Name>WebsitePanel.Providers.Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\WebsitePanel.Providers.HostedSolution\WebsitePanel.Providers.HostedSolution.csproj">
|
||||
<Project>{a06de5e4-4331-47e1-8f46-7b846146b559}</Project>
|
||||
<Name>WebsitePanel.Providers.HostedSolution</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\WebsitePanel.Server.Utils\WebsitePanel.Server.Utils.csproj">
|
||||
<Project>{e91e52f3-9555-4d00-b577-2b1dbdd87ca7}</Project>
|
||||
<Name>WebsitePanel.Server.Utils</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,295 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Management;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace WebsitePanel.Providers.Virtualization
|
||||
{
|
||||
internal class Wmi
|
||||
{
|
||||
string nameSpace = null;
|
||||
string computerName = null;
|
||||
ManagementScope scope = null;
|
||||
|
||||
public Wmi(string nameSpace) : this(nameSpace, null)
|
||||
{
|
||||
}
|
||||
|
||||
public Wmi(string computerName, string nameSpace)
|
||||
{
|
||||
this.nameSpace = nameSpace;
|
||||
this.computerName = computerName;
|
||||
}
|
||||
|
||||
internal ManagementObjectCollection ExecuteWmiQuery(string query, params object[] args)
|
||||
{
|
||||
if (args != null && args.Length > 0)
|
||||
query = String.Format(query, args);
|
||||
|
||||
ManagementObjectSearcher searcher = new ManagementObjectSearcher(GetScope(),
|
||||
new ObjectQuery(query));
|
||||
return searcher.Get();
|
||||
}
|
||||
|
||||
internal ManagementObject GetWmiObject(string className, string filter, params object[] args)
|
||||
{
|
||||
ManagementObjectCollection col = GetWmiObjects(className, filter, args);
|
||||
ManagementObjectCollection.ManagementObjectEnumerator enumerator = col.GetEnumerator();
|
||||
return enumerator.MoveNext() ? (ManagementObject)enumerator.Current : null;
|
||||
}
|
||||
|
||||
internal ManagementObject GetWmiObject(string className)
|
||||
{
|
||||
return GetWmiObject(className, null);
|
||||
}
|
||||
|
||||
internal ManagementObjectCollection GetWmiObjects(string className, string filter, params object[] args)
|
||||
{
|
||||
string query = "select * from " + className;
|
||||
if (!String.IsNullOrEmpty(filter))
|
||||
query += " where " + filter;
|
||||
return ExecuteWmiQuery(query, args);
|
||||
}
|
||||
|
||||
internal ManagementObjectCollection GetWmiObjects(string className)
|
||||
{
|
||||
return GetWmiObjects(className, null);
|
||||
}
|
||||
|
||||
internal ManagementObject GetWmiObjectByPath(string path)
|
||||
{
|
||||
return new ManagementObject(GetScope(), new ManagementPath(path), null);
|
||||
}
|
||||
|
||||
internal ManagementClass GetWmiClass(string className)
|
||||
{
|
||||
return new ManagementClass(GetScope(), new ManagementPath(className), null);
|
||||
}
|
||||
|
||||
internal ManagementObject GetRelatedWmiObject(ManagementObject obj, string className)
|
||||
{
|
||||
ManagementObjectCollection col = obj.GetRelated(className);
|
||||
ManagementObjectCollection.ManagementObjectEnumerator enumerator = col.GetEnumerator();
|
||||
enumerator.MoveNext();
|
||||
return (ManagementObject)enumerator.Current;
|
||||
}
|
||||
|
||||
internal void Dump(ManagementBaseObject obj)
|
||||
{
|
||||
#if DEBUG
|
||||
foreach (PropertyData prop in obj.Properties)
|
||||
{
|
||||
string typeName = prop.Value == null ? "null" : prop.Value.GetType().ToString();
|
||||
Debug.WriteLine(prop.Name + ": " + prop.Value + " (" + typeName + ")");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Converts a given datetime in DMTF format to System.DateTime object.
|
||||
internal static System.DateTime ToDateTime(string dmtfDate)
|
||||
{
|
||||
System.DateTime initializer = System.DateTime.MinValue;
|
||||
int year = initializer.Year;
|
||||
int month = initializer.Month;
|
||||
int day = initializer.Day;
|
||||
int hour = initializer.Hour;
|
||||
int minute = initializer.Minute;
|
||||
int second = initializer.Second;
|
||||
long ticks = 0;
|
||||
string dmtf = dmtfDate;
|
||||
System.DateTime datetime = System.DateTime.MinValue;
|
||||
string tempString = string.Empty;
|
||||
if (String.IsNullOrEmpty(dmtf))
|
||||
{
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
else if ((dmtf.Length != 25))
|
||||
{
|
||||
throw new System.ArgumentOutOfRangeException();
|
||||
}
|
||||
try
|
||||
{
|
||||
tempString = dmtf.Substring(0, 4);
|
||||
if (("****" != tempString))
|
||||
{
|
||||
year = int.Parse(tempString);
|
||||
}
|
||||
tempString = dmtf.Substring(4, 2);
|
||||
if (("**" != tempString))
|
||||
{
|
||||
month = int.Parse(tempString);
|
||||
}
|
||||
tempString = dmtf.Substring(6, 2);
|
||||
if (("**" != tempString))
|
||||
{
|
||||
day = int.Parse(tempString);
|
||||
}
|
||||
tempString = dmtf.Substring(8, 2);
|
||||
if (("**" != tempString))
|
||||
{
|
||||
hour = int.Parse(tempString);
|
||||
}
|
||||
tempString = dmtf.Substring(10, 2);
|
||||
if (("**" != tempString))
|
||||
{
|
||||
minute = int.Parse(tempString);
|
||||
}
|
||||
tempString = dmtf.Substring(12, 2);
|
||||
if (("**" != tempString))
|
||||
{
|
||||
second = int.Parse(tempString);
|
||||
}
|
||||
tempString = dmtf.Substring(15, 6);
|
||||
if (("******" != tempString))
|
||||
{
|
||||
ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
|
||||
}
|
||||
if (((((((((year < 0)
|
||||
|| (month < 0))
|
||||
|| (day < 0))
|
||||
|| (hour < 0))
|
||||
|| (minute < 0))
|
||||
|| (minute < 0))
|
||||
|| (second < 0))
|
||||
|| (ticks < 0)))
|
||||
{
|
||||
throw new System.ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
throw new System.ArgumentOutOfRangeException(null, e.Message);
|
||||
}
|
||||
|
||||
if (year == 0
|
||||
&& month == 0
|
||||
&& day == 0
|
||||
&& hour == 0
|
||||
&& minute == 0
|
||||
&& second == 0
|
||||
&& ticks == 0)
|
||||
return DateTime.MinValue;
|
||||
|
||||
datetime = new System.DateTime(year, month, day, hour, minute, second, 0);
|
||||
datetime = datetime.AddTicks(ticks);
|
||||
System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(datetime);
|
||||
int UTCOffset = 0;
|
||||
int OffsetToBeAdjusted = 0;
|
||||
long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)));
|
||||
tempString = dmtf.Substring(22, 3);
|
||||
if ((tempString != "******"))
|
||||
{
|
||||
tempString = dmtf.Substring(21, 4);
|
||||
try
|
||||
{
|
||||
UTCOffset = int.Parse(tempString);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
throw new System.ArgumentOutOfRangeException(null, e.Message);
|
||||
}
|
||||
OffsetToBeAdjusted = ((int)((OffsetMins - UTCOffset)));
|
||||
datetime = datetime.AddMinutes(((double)(OffsetToBeAdjusted)));
|
||||
}
|
||||
return datetime;
|
||||
}
|
||||
|
||||
// Converts a given System.DateTime object to DMTF datetime format.
|
||||
internal string ToDmtfDateTime(System.DateTime date)
|
||||
{
|
||||
string utcString = string.Empty;
|
||||
System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(date);
|
||||
long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)));
|
||||
if ((System.Math.Abs(OffsetMins) > 999))
|
||||
{
|
||||
date = date.ToUniversalTime();
|
||||
utcString = "+000";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((tickOffset.Ticks >= 0))
|
||||
{
|
||||
utcString = string.Concat("+", ((System.Int64)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute))).ToString().PadLeft(3, '0'));
|
||||
}
|
||||
else
|
||||
{
|
||||
string strTemp = ((System.Int64)(OffsetMins)).ToString();
|
||||
utcString = string.Concat("-", strTemp.Substring(1, (strTemp.Length - 1)).PadLeft(3, '0'));
|
||||
}
|
||||
}
|
||||
string dmtfDateTime = ((System.Int32)(date.Year)).ToString().PadLeft(4, '0');
|
||||
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Month)).ToString().PadLeft(2, '0'));
|
||||
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Day)).ToString().PadLeft(2, '0'));
|
||||
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Hour)).ToString().PadLeft(2, '0'));
|
||||
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Minute)).ToString().PadLeft(2, '0'));
|
||||
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Second)).ToString().PadLeft(2, '0'));
|
||||
dmtfDateTime = string.Concat(dmtfDateTime, ".");
|
||||
System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0);
|
||||
long microsec = ((long)((((date.Ticks - dtTemp.Ticks)
|
||||
* 1000)
|
||||
/ System.TimeSpan.TicksPerMillisecond)));
|
||||
string strMicrosec = ((System.Int64)(microsec)).ToString();
|
||||
if ((strMicrosec.Length > 6))
|
||||
{
|
||||
strMicrosec = strMicrosec.Substring(0, 6);
|
||||
}
|
||||
dmtfDateTime = string.Concat(dmtfDateTime, strMicrosec.PadLeft(6, '0'));
|
||||
dmtfDateTime = string.Concat(dmtfDateTime, utcString);
|
||||
return dmtfDateTime;
|
||||
}
|
||||
|
||||
public ManagementScope GetScope()
|
||||
{
|
||||
if (scope != null)
|
||||
return scope;
|
||||
|
||||
// create new scope
|
||||
if (String.IsNullOrEmpty(computerName))
|
||||
{
|
||||
// local
|
||||
scope = new ManagementScope(nameSpace);
|
||||
}
|
||||
else
|
||||
{
|
||||
// remote
|
||||
ConnectionOptions options = new ConnectionOptions();
|
||||
|
||||
string path = String.Format(@"\\{0}\{1}", computerName, nameSpace);
|
||||
scope = new ManagementScope(path, options);
|
||||
}
|
||||
|
||||
// connect
|
||||
scope.Connect();
|
||||
return scope;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -488,7 +488,7 @@ namespace WebsitePanel.Providers.Virtualization
|
|||
return vm;
|
||||
}
|
||||
|
||||
private void UpdateVirtualMachineGeneralSettings(string vmId, ManagementObject objVM, int cpuCores, int ramMB, bool bootFromCD, bool numLockEnabled)
|
||||
private void UpdateVirtualMachineGeneralSettings(string vmId, ManagementObject objVM, int cpuCores, long ramMB, bool bootFromCD, bool numLockEnabled)
|
||||
{
|
||||
// request management service
|
||||
ManagementObject objVmsvc = GetVirtualSystemManagementService();
|
||||
|
@ -1989,10 +1989,10 @@ exit", Convert.ToInt32(objDisk["Index"])));
|
|||
|
||||
#region Stop
|
||||
else if (!started &&
|
||||
(vps.State == VirtualMachineState.Started
|
||||
(vps.State == VirtualMachineState.Running
|
||||
|| vps.State == VirtualMachineState.Paused))
|
||||
{
|
||||
if (vps.State == VirtualMachineState.Started)
|
||||
if (vps.State == VirtualMachineState.Running)
|
||||
{
|
||||
// try to shutdown the system
|
||||
ReturnCode code = ShutDownVirtualMachine(vm.VirtualMachineId, true, "Virtual Machine has been suspended from WebsitePanel");
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace WebsitePanel.Providers.Web.Iis
|
|||
X509CertificateCollection existCerts2 = storeMy.Certificates.Find(X509FindType.FindBySerialNumber, servercert.SerialNumber, false);
|
||||
var certData = existCerts2[0].Export(X509ContentType.Pfx);
|
||||
storeMy.Close();
|
||||
var x509Cert = new X509Certificate2(certData);
|
||||
var x509Cert = new X509Certificate2(certData, string.Empty, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
|
||||
|
||||
if (UseCCS)
|
||||
{
|
||||
|
@ -176,10 +176,10 @@ namespace WebsitePanel.Providers.Web.Iis
|
|||
if (UseCCS)
|
||||
{
|
||||
// We need to use this constructor or we won't be able to export this certificate
|
||||
x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.Exportable);
|
||||
x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
|
||||
|
||||
var certData = x509Cert.Export(X509ContentType.Pfx);
|
||||
var convertedCert = new X509Certificate2(certData, string.Empty, X509KeyStorageFlags.Exportable);
|
||||
var convertedCert = new X509Certificate2(certData, string.Empty, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
|
||||
|
||||
// Attempts to move certificate to CCS UNC path
|
||||
try
|
||||
|
@ -205,7 +205,7 @@ namespace WebsitePanel.Providers.Web.Iis
|
|||
}
|
||||
else
|
||||
{
|
||||
x509Cert = new X509Certificate2(certificate, password);
|
||||
x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
|
||||
|
||||
// Step 1: Register X.509 certificate in the store
|
||||
// Trying to keep X.509 store open as less as possible
|
||||
|
@ -278,7 +278,7 @@ namespace WebsitePanel.Providers.Web.Iis
|
|||
// Read certificate data from file
|
||||
var certData = new byte[fileStream.Length];
|
||||
fileStream.Read(certData, 0, (int) fileStream.Length);
|
||||
var convertedCert = new X509Certificate2(certData, CCSCommonPassword, X509KeyStorageFlags.Exportable);
|
||||
var convertedCert = new X509Certificate2(certData, CCSCommonPassword, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet);
|
||||
|
||||
fileStream.Close();
|
||||
|
||||
|
@ -311,7 +311,7 @@ namespace WebsitePanel.Providers.Web.Iis
|
|||
{
|
||||
hostNames.AddRange(certificate.Extensions.Cast<X509Extension>()
|
||||
.Where(e => e.Oid.Value == "2.5.29.17") // Subject Alternative Names
|
||||
.SelectMany(e => e.Format(true).Split(new[] {"\r\n", "\n", "\n"}, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Split('=')[1])));
|
||||
.SelectMany(e => e.Format(true).Split(new[] {"\r\n", "\n", "\n"}, StringSplitOptions.RemoveEmptyEntries).Where(s => s.Contains("=")).Select(s => s.Split('=')[1])).Where(s => !s.Contains(" ")));
|
||||
}
|
||||
|
||||
var simpleName = certificate.GetNameInfo(X509NameType.SimpleName, false);
|
||||
|
@ -320,7 +320,20 @@ namespace WebsitePanel.Providers.Web.Iis
|
|||
hostNames.Add(simpleName);
|
||||
}
|
||||
|
||||
// For every hostname (only one if using old school dedicated IP binding)
|
||||
var wildcardHostName = hostNames.SingleOrDefault(h => h.StartsWith("*."));
|
||||
|
||||
// If a wildcard certificate is used
|
||||
if (wildcardHostName != null)
|
||||
{
|
||||
if (!dedicatedIp)
|
||||
{
|
||||
// If using a wildcard ssl and not a dedicated IP, we take all the matching bindings on the site and use it to bind to SSL also.
|
||||
hostNames.Remove(wildcardHostName);
|
||||
hostNames.AddRange(website.Bindings.Where(b => !string.IsNullOrEmpty(b.Host) && b.Host.EndsWith(wildcardHostName.Substring(2))).Select(b => b.Host));
|
||||
}
|
||||
}
|
||||
|
||||
// For every hostname
|
||||
foreach (var hostName in hostNames)
|
||||
{
|
||||
var bindingInformation = string.Format("{0}:443:{1}", website.SiteIPAddress ?? "*", dedicatedIp ? "" : hostName);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30723.0
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching Application Block", "Caching Application Block", "{C8E6F2E4-A5B8-486A-A56E-92D864524682}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
|
@ -154,6 +154,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Host
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Mail.IceWarp", "WebsitePanel.Providers.Mail.IceWarp\WebsitePanel.Providers.Mail.IceWarp.csproj", "{95EA2D6E-278C-4A74-97DB-946362C4DEEA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Virtualization.HyperV2012R2", "WebsitePanel.Providers.Virtualization.HyperV-2012R2\WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj", "{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -774,6 +776,16 @@ Global
|
|||
{95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -1,51 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<!-- Custom configuration sections -->
|
||||
<configSections>
|
||||
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3"/>
|
||||
<section name="websitepanel.server" type="WebsitePanel.Server.ServerConfiguration, WebsitePanel.Server"/>
|
||||
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings,Microsoft.Practices.EnterpriseLibrary.Caching"/>
|
||||
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
|
||||
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
</sectionGroup>
|
||||
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<appSettings>
|
||||
<add key="WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag" value="false"/>
|
||||
<add key="WebsitePanel.Exchange.ClearQueryBaseDN" value="false"/>
|
||||
<add key="WebsitePanel.Exchange.enableSP2abp" value="false"/>
|
||||
<add key="SCVMMServerName" value=""/>
|
||||
<add key="SCVMMServerPort" value=""/>
|
||||
<add key="WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag" value="false" />
|
||||
<add key="WebsitePanel.Exchange.ClearQueryBaseDN" value="false" />
|
||||
<add key="WebsitePanel.Exchange.enableSP2abp" value="false" />
|
||||
<add key="SCVMMServerName" value="" />
|
||||
<add key="SCVMMServerPort" value="" />
|
||||
</appSettings>
|
||||
<system.diagnostics>
|
||||
<switches>
|
||||
<add name="Log" value="2"/>
|
||||
<add name="Log" value="2" />
|
||||
<!-- 0 - Off, 1 - Error, 2 - Warning, 3 - Info, 4 - Verbose -->
|
||||
</switches>
|
||||
<trace autoflush="true">
|
||||
<listeners>
|
||||
<add name="DefaultListener" type="WebsitePanel.Server.Utils.EventLogTraceListener, WebsitePanel.Server.Utils" initializeData="WebsitePanel"/>
|
||||
<add name="DefaultListener" type="WebsitePanel.Server.Utils.EventLogTraceListener, WebsitePanel.Server.Utils" initializeData="WebsitePanel" />
|
||||
<!-- Writes log to the file
|
||||
<add name="DefaultListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="WebsitePanel.Server.log" />
|
||||
-->
|
||||
<remove name="Default"/>
|
||||
<remove name="Default" />
|
||||
</listeners>
|
||||
</trace>
|
||||
</system.diagnostics>
|
||||
<!-- Caching Configuration -->
|
||||
<cachingConfiguration defaultCacheManager="Default Cache Manager">
|
||||
<backingStores>
|
||||
<add name="inMemory" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching"/>
|
||||
<add name="inMemory" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching" />
|
||||
</backingStores>
|
||||
<cacheManagers>
|
||||
<add name="Default Cache Manager" expirationPollFrequencyInSeconds="43200" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="inMemory"/>
|
||||
<add name="Default Cache Manager" expirationPollFrequencyInSeconds="43200" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="inMemory" />
|
||||
</cacheManagers>
|
||||
</cachingConfiguration>
|
||||
<!-- WebsitePanel Configuration -->
|
||||
|
@ -53,85 +42,85 @@
|
|||
<!-- Security settings -->
|
||||
<security>
|
||||
<!-- Perform security check -->
|
||||
<enabled value="true"/>
|
||||
<enabled value="true" />
|
||||
<!-- Server password -->
|
||||
<password value="+uxnDOdf55yuH6iZYXgYAxsfIBw="/>
|
||||
<password value="+uxnDOdf55yuH6iZYXgYAxsfIBw=" />
|
||||
</security>
|
||||
</websitepanel.server>
|
||||
<system.web>
|
||||
<!-- Disable any authentication -->
|
||||
<authentication mode="None"/>
|
||||
<authentication mode="None" />
|
||||
<!-- Correct HTTP runtime settings -->
|
||||
<httpRuntime executionTimeout="3600" maxRequestLength="16384"/>
|
||||
<httpRuntime executionTimeout="3600" maxRequestLength="16384" />
|
||||
<!-- Set globalization settings -->
|
||||
<globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8"/>
|
||||
<globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" />
|
||||
<!-- Web Services settings -->
|
||||
<webServices>
|
||||
<protocols>
|
||||
<remove name="HttpPost"/>
|
||||
<remove name="HttpPostLocalhost"/>
|
||||
<remove name="HttpGet"/>
|
||||
<remove name="HttpPost" />
|
||||
<remove name="HttpPostLocalhost" />
|
||||
<remove name="HttpGet" />
|
||||
</protocols>
|
||||
<soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3"/>
|
||||
<soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3" />
|
||||
</webServices>
|
||||
<compilation debug="true">
|
||||
<assemblies>
|
||||
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</controls>
|
||||
</pages>
|
||||
<httpHandlers>
|
||||
<remove verb="*" path="*.asmx"/>
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<remove verb="*" path="*.asmx" />
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</httpModules>
|
||||
</system.web>
|
||||
<!-- WSE 3.0 settings -->
|
||||
<microsoft.web.services3>
|
||||
<diagnostics>
|
||||
<trace enabled="false" input="InputTrace.webinfo" output="OutputTrace.webinfo"/>
|
||||
<trace enabled="false" input="InputTrace.webinfo" output="OutputTrace.webinfo" />
|
||||
</diagnostics>
|
||||
<messaging>
|
||||
<maxMessageLength value="-1"/>
|
||||
<mtom serverMode="optional" clientMode="On"/>
|
||||
<maxMessageLength value="-1" />
|
||||
<mtom serverMode="optional" clientMode="On" />
|
||||
</messaging>
|
||||
<security>
|
||||
<securityTokenManager>
|
||||
<add type="WebsitePanel.Server.ServerUsernameTokenManager, WebsitePanel.Server" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken"/>
|
||||
<add type="WebsitePanel.Server.ServerUsernameTokenManager, WebsitePanel.Server" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken" />
|
||||
</securityTokenManager>
|
||||
<timeToleranceInSeconds value="86400"/>
|
||||
<timeToleranceInSeconds value="86400" />
|
||||
</security>
|
||||
<policy fileName="WsePolicyCache.Config"/>
|
||||
<policy fileName="WsePolicyCache.Config" />
|
||||
</microsoft.web.services3>
|
||||
<system.serviceModel>
|
||||
<bindings>
|
||||
<wsHttpBinding>
|
||||
<binding name="WSHttpBinding_IVirtualMachineManagementService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="10485760" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
|
||||
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
|
||||
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
|
||||
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
|
||||
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
|
||||
<security mode="Message">
|
||||
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
|
||||
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/>
|
||||
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
|
||||
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
|
||||
</security>
|
||||
</binding>
|
||||
<binding name="WSHttpBinding_IMonitoringService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="10485760" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
|
||||
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
|
||||
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
|
||||
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
|
||||
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
|
||||
<security mode="Message">
|
||||
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
|
||||
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/>
|
||||
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
|
||||
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
|
||||
</security>
|
||||
</binding>
|
||||
</wsHttpBinding>
|
||||
|
@ -140,40 +129,40 @@
|
|||
<system.codedom>
|
||||
<compilers>
|
||||
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
<providerOption name="CompilerVersion" value="v3.5" />
|
||||
<providerOption name="WarnAsError" value="false" />
|
||||
</compiler>
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<validation validateIntegratedModeConfiguration="false" />
|
||||
<modules>
|
||||
<remove name="ScriptModule"/>
|
||||
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<remove name="ScriptModule" />
|
||||
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</modules>
|
||||
<handlers>
|
||||
<remove name="WebServiceHandlerFactory-Integrated"/>
|
||||
<remove name="ScriptHandlerFactory"/>
|
||||
<remove name="ScriptHandlerFactoryAppServices"/>
|
||||
<remove name="ScriptResource"/>
|
||||
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<remove name="WebServiceHandlerFactory-Integrated" />
|
||||
<remove name="ScriptHandlerFactory" />
|
||||
<remove name="ScriptHandlerFactoryAppServices" />
|
||||
<remove name="ScriptResource" />
|
||||
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
<runtime>
|
||||
<assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
|
||||
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
|
||||
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="bin/Crm2011;bin/Crm2013;bin/Exchange2013;bin/Sharepoint2013;bin/Lync2013;bin/Lync2013HP;bin/Dns2012;bin/IceWarp;bin/IIs80"/>
|
||||
<probing privatePath="bin/Crm2011;bin/Crm2013;bin/Exchange2013;bin/Sharepoint2013;bin/Lync2013;bin/Lync2013HP;bin/Dns2012;bin/IceWarp;bin/IIs80;bin/HyperV2012R2" />
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -13,12 +13,14 @@ namespace WebsitePanel.WebDav.Core.Config.Entities
|
|||
{
|
||||
IsEnabled = ConfigSection.OfficeOnline.IsEnabled;
|
||||
Url = ConfigSection.OfficeOnline.Url;
|
||||
NewFilePath = ConfigSection.OfficeOnline.CobaltNewFilePath;
|
||||
CobaltFileTtl = ConfigSection.OfficeOnline.CobaltFileTtl;
|
||||
_officeExtensions = ConfigSection.OfficeOnline.Cast<OfficeOnlineElement>().ToList();
|
||||
}
|
||||
|
||||
public bool IsEnabled { get; private set; }
|
||||
public string Url { get; private set; }
|
||||
public string NewFilePath { get; private set; }
|
||||
public int CobaltFileTtl { get; private set; }
|
||||
|
||||
public IEnumerator<OfficeOnlineElement> GetEnumerator()
|
||||
|
|
|
@ -45,6 +45,16 @@ namespace WebsitePanel.WebDav.Core.Config.Entities
|
|||
}
|
||||
}
|
||||
|
||||
public string OwaEditFoldersSessionKey
|
||||
{
|
||||
get
|
||||
{
|
||||
SessionKeysElement sessionKey =
|
||||
_sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.OwaEditFoldersSessionKey);
|
||||
return sessionKey != null ? sessionKey.Value : null;
|
||||
}
|
||||
}
|
||||
|
||||
public string WebDavRootFoldersPermissions
|
||||
{
|
||||
get
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
private const string OwaViewKey = "OwaView";
|
||||
private const string OwaEditorKey = "OwaEditor";
|
||||
private const string OwaMobileViewKey = "OwaMobileView";
|
||||
private const string OwaNewFileViewKey = "OwaNewFileView";
|
||||
|
||||
[ConfigurationProperty(ExtensionKey, IsKey = true, IsRequired = true)]
|
||||
public string Extension
|
||||
|
@ -37,5 +38,12 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
get { return this[OwaMobileViewKey].ToString(); }
|
||||
set { this[OwaMobileViewKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(OwaNewFileViewKey, IsKey = true, IsRequired = true)]
|
||||
public string OwaNewFileView
|
||||
{
|
||||
get { return this[OwaNewFileViewKey].ToString(); }
|
||||
set { this[OwaNewFileViewKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
private const string UrlKey = "url";
|
||||
private const string IsEnabledKey = "isEnabled";
|
||||
private const string CobaltFileTtlKey = "cobaltFileTtl";
|
||||
private const string CobaltNewFilePathKey = "cobaltNewFilePath";
|
||||
|
||||
[ConfigurationProperty(UrlKey, IsKey = true, IsRequired = true)]
|
||||
public string Url
|
||||
|
@ -24,6 +25,13 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
set { this[IsEnabledKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(CobaltNewFilePathKey, IsKey = true, IsRequired = true)]
|
||||
public string CobaltNewFilePath
|
||||
{
|
||||
get { return this[CobaltNewFilePathKey].ToString(); }
|
||||
set { this[CobaltNewFilePathKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(CobaltFileTtlKey, IsKey = true, IsRequired = true)]
|
||||
public int CobaltFileTtl
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
|||
public const string WebDavRootFolderPermissionsKey = "WebDavRootFolderPermissionsKey";
|
||||
public const string ResourseRenderCountKey = "ResourseRenderCountSessionKey";
|
||||
public const string ItemIdSessionKey = "ItemId";
|
||||
public const string OwaEditFoldersSessionKey = "OwaEditFoldersSession";
|
||||
|
||||
[ConfigurationProperty(KeyKey, IsKey = true, IsRequired = true)]
|
||||
public string Key
|
||||
|
|
|
@ -37,6 +37,10 @@ namespace WebsitePanel.WebDav.Core.Entities.Owa
|
|||
public bool RestrictedWebViewOnly { get; set; }
|
||||
[DataMember]
|
||||
public string ClientUrl { get; set; }
|
||||
[DataMember]
|
||||
public bool CloseButtonClosesWindow { get; set; }
|
||||
//[DataMember]
|
||||
//public string CloseUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public bool UserCanNotWriteRelative { get; set; }
|
||||
|
||||
|
@ -59,8 +63,7 @@ namespace WebsitePanel.WebDav.Core.Entities.Owa
|
|||
//public string BreadcrumbFolderUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string ClientUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public bool CloseButtonClosesWindow { get; set; }
|
||||
|
||||
//[DataMember]
|
||||
//public string CloseUrl { get; set; }
|
||||
//[DataMember]
|
||||
|
|
|
@ -3,11 +3,19 @@ using System.Linq;
|
|||
|
||||
namespace WebsitePanel.WebDav.Core.Extensions
|
||||
{
|
||||
static class UriExtensions
|
||||
public static class UriExtensions
|
||||
{
|
||||
public static Uri Append(this Uri uri, params string[] paths)
|
||||
{
|
||||
return new Uri(paths.Aggregate(uri.AbsoluteUri, (current, path) => string.Format("{0}/{1}", current.TrimEnd('/'), path.TrimStart('/'))));
|
||||
}
|
||||
|
||||
public static string ToStringPath(this Uri uri)
|
||||
{
|
||||
var hostStart = uri.ToString().IndexOf(uri.Host, System.StringComparison.Ordinal);
|
||||
var hostLength = uri.Host.Length;
|
||||
|
||||
return uri.ToString().Substring(hostStart + hostLength, uri.ToString().Length - hostStart - hostLength);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -148,7 +148,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
public IResource GetResource(string name)
|
||||
{
|
||||
IHierarchyItem item =
|
||||
_children.Single(i => i.DisplayName.Trim('/') == name.Trim('/'));
|
||||
_children.Single(i => i.DisplayName.ToLowerInvariant().Trim('/') == name.ToLowerInvariant().Trim('/'));
|
||||
var resource = new WebDavResource();
|
||||
resource.SetCredentials(_credentials);
|
||||
resource.SetHierarchyItem(item);
|
||||
|
@ -295,11 +295,11 @@ namespace WebsitePanel.WebDav.Core
|
|||
{
|
||||
XmlResponseList = XmlDoc.GetElementsByTagName("d:response");
|
||||
}
|
||||
var children = new WebDavHierarchyItem[XmlResponseList.Count];
|
||||
var children = new WebDavResource[XmlResponseList.Count];
|
||||
int counter = 0;
|
||||
foreach (XmlNode XmlCurrentResponse in XmlResponseList)
|
||||
{
|
||||
var item = new WebDavHierarchyItem();
|
||||
var item = new WebDavResource();
|
||||
item.SetCredentials(_credentials);
|
||||
|
||||
foreach (XmlNode XmlCurrentNode in XmlCurrentResponse.ChildNodes)
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
long ContentLength { get; }
|
||||
long AllocatedSpace { get; set; }
|
||||
string ContentType { get; }
|
||||
string Summary { get; set; }
|
||||
|
||||
void Download(string filename);
|
||||
byte[] Download();
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
SendChunked = false;
|
||||
AllowWriteStreamBuffering = false;
|
||||
|
||||
IsRootItem = item.IsRootItem;
|
||||
SetCredentials(credentials);
|
||||
SetHierarchyItem(item);
|
||||
}
|
||||
|
@ -88,6 +89,8 @@ namespace WebsitePanel.WebDav.Core
|
|||
}
|
||||
}
|
||||
|
||||
public string Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Downloads content of the resource to a file specified by filename
|
||||
/// </summary>
|
||||
|
@ -257,7 +260,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
{
|
||||
get
|
||||
{
|
||||
string displayName = _href.AbsoluteUri.Trim('/').Replace(_baseUri.AbsoluteUri.Trim('/'), "");
|
||||
string displayName = _href.ToString().Trim('/').Replace(_baseUri.ToString().Trim('/'), "");
|
||||
displayName = Regex.Replace(displayName, "\\/$", "");
|
||||
Match displayNameMatch = Regex.Match(displayName, "([\\/]+)$");
|
||||
if (displayNameMatch.Success)
|
||||
|
@ -480,7 +483,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
{
|
||||
_href = href;
|
||||
|
||||
var baseUrl = href.AbsoluteUri.Remove(href.AbsoluteUri.Length - href.Segments.Last().Length);
|
||||
var baseUrl = href.ToString().Remove(href.ToString().Length - href.ToString().Trim('/').Split('/').Last().Length);
|
||||
|
||||
_baseUri = new Uri(baseUrl);
|
||||
}
|
||||
|
|
|
@ -19,5 +19,6 @@ namespace WebsitePanel.WebDav.Core.Interfaces.Managers
|
|||
string GetFileUrl(string path);
|
||||
void DeleteResource(string path);
|
||||
void LockFile(string path);
|
||||
string GetFileFolderPath(string path);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using System.Web.Mvc;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Entities.Owa;
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace WebsitePanel.WebDav.Core.Interfaces.Owa
|
|||
{
|
||||
public interface IWopiServer
|
||||
{
|
||||
CheckFileInfo GetCheckFileInfo(string path);
|
||||
FileResult GetFile(string path);
|
||||
CheckFileInfo GetCheckFileInfo(WebDavAccessToken token);
|
||||
byte[] GetFileBytes(int accessTokenId);
|
||||
}
|
||||
}
|
|
@ -50,9 +50,9 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
children = ConnectToWebDavServer().Select(x => new WebDavResource
|
||||
{
|
||||
Href = new Uri(x.Url),
|
||||
ItemType = ItemType.Folder,
|
||||
ContentLength = x.Size,
|
||||
AllocatedSpace = x.FRSMQuotaMB,
|
||||
ItemType = ItemType.Folder,
|
||||
ContentLength = x.Size * 1024 * 1024,
|
||||
AllocatedSpace = (long)x.FRSMQuotaMB * 1024 * 1024,
|
||||
IsRootItem = true
|
||||
}).ToArray();
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
|
||||
public bool IsFile(string path)
|
||||
{
|
||||
string folder = GetFileFolder(path);
|
||||
string folder = GetFileFolderPath(path);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(folder))
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
{
|
||||
try
|
||||
{
|
||||
string folder = GetFileFolder(path);
|
||||
string folder = GetFileFolderPath(path);
|
||||
|
||||
var resourceName = GetResourceName(path);
|
||||
|
||||
|
@ -212,7 +212,7 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
path = RemoveLeadingFromPath(path, "edit");
|
||||
path = RemoveLeadingFromPath(path, WspContext.User.OrganizationId);
|
||||
|
||||
string folderPath = GetFileFolder(path);
|
||||
string folderPath = GetFileFolderPath(path);
|
||||
|
||||
OpenFolder(folderPath);
|
||||
|
||||
|
@ -232,7 +232,7 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
{
|
||||
try
|
||||
{
|
||||
string folder = GetFileFolder(path);
|
||||
string folder = GetFileFolderPath(path);
|
||||
|
||||
var resourceName = GetResourceName(path);
|
||||
|
||||
|
@ -240,9 +240,9 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
|
||||
return _currentFolder.GetResource(resourceName);
|
||||
}
|
||||
catch (InvalidOperationException exception)
|
||||
catch (Exception)
|
||||
{
|
||||
throw new ResourceNotFoundException("Resource not found", exception);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
{
|
||||
try
|
||||
{
|
||||
string folder = GetFileFolder(path);
|
||||
string folder = GetFileFolderPath(path);
|
||||
|
||||
var resourceName = GetResourceName(path);
|
||||
|
||||
|
@ -270,7 +270,7 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
{
|
||||
try
|
||||
{
|
||||
string folder = GetFileFolder(path);
|
||||
string folder = GetFileFolderPath(path);
|
||||
|
||||
var resourceName = GetResourceName(path);
|
||||
|
||||
|
@ -345,6 +345,7 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
webDavitem.SetLastModified(file.Changed);
|
||||
webDavitem.ContentLength = file.Size;
|
||||
webDavitem.AllocatedSpace = file.FRSMQuotaMB;
|
||||
webDavitem.Summary = file.Summary;
|
||||
|
||||
convertResult.Add(webDavitem);
|
||||
}
|
||||
|
@ -372,7 +373,7 @@ namespace WebsitePanel.WebDav.Core.Managers
|
|||
targetStream.Write(buffer, 0, n);
|
||||
}
|
||||
|
||||
private string GetFileFolder(string path)
|
||||
public string GetFileFolderPath(string path)
|
||||
{
|
||||
path = path.TrimEnd('/');
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Caching;
|
||||
using System.Web;
|
||||
using Cobalt;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
|
@ -72,9 +74,20 @@ namespace WebsitePanel.WebDav.Core.Owa
|
|||
|
||||
var token = _tokenManager.GetToken(accessTokenId);
|
||||
|
||||
var fileBytes = _webDavManager.GetFileBytes(token.FilePath);
|
||||
Atom atom;
|
||||
|
||||
var atom = new AtomFromByteArray(fileBytes);
|
||||
if (_webDavManager.FileExist(token.FilePath))
|
||||
{
|
||||
var fileBytes = _webDavManager.GetFileBytes(token.FilePath);
|
||||
|
||||
atom = new AtomFromByteArray(fileBytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
var filePath = HttpContext.Current.Server.MapPath(WebDavAppConfigManager.Instance.OfficeOnline.NewFilePath + Path.GetExtension(token.FilePath));
|
||||
|
||||
atom = new AtomFromByteArray(File.ReadAllBytes(filePath));
|
||||
}
|
||||
|
||||
Cobalt.Metrics o1;
|
||||
cobaltFile.GetCobaltFilePartition(FilePartitionId.Content).SetStream(RootId.Default.Value, atom, out o1);
|
||||
|
|
|
@ -6,6 +6,8 @@ using System.Runtime.Serialization.Json;
|
|||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Cobalt;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Entities.Owa;
|
||||
|
@ -22,25 +24,30 @@ namespace WebsitePanel.WebDav.Core.Owa
|
|||
private readonly IWebDavManager _webDavManager;
|
||||
private readonly IAccessTokenManager _tokenManager;
|
||||
private readonly IWebDavAuthorizationService _webDavAuthorizationService;
|
||||
private readonly IWopiFileManager _fileManager;
|
||||
|
||||
public WopiServer(IWebDavManager webDavManager, IAccessTokenManager tokenManager, IWebDavAuthorizationService webDavAuthorizationService)
|
||||
|
||||
public WopiServer(IWebDavManager webDavManager, IAccessTokenManager tokenManager, IWebDavAuthorizationService webDavAuthorizationService, IWopiFileManager fileManager)
|
||||
{
|
||||
_webDavManager = webDavManager;
|
||||
_tokenManager = tokenManager;
|
||||
_webDavAuthorizationService = webDavAuthorizationService;
|
||||
_fileManager = fileManager;
|
||||
}
|
||||
|
||||
public CheckFileInfo GetCheckFileInfo(string path)
|
||||
public CheckFileInfo GetCheckFileInfo(WebDavAccessToken token)
|
||||
{
|
||||
var resource = _webDavManager.GetResource(path);
|
||||
var resource = _webDavManager.GetResource(token.FilePath);
|
||||
|
||||
var readOnly = _webDavAuthorizationService.GetPermissions(WspContext.User, path).HasFlag(WebDavPermissions.Write) == false;
|
||||
var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, token.FilePath);
|
||||
|
||||
var readOnly = permissions.HasFlag(WebDavPermissions.Write) == false || permissions.HasFlag(WebDavPermissions.OwaEdit) == false;
|
||||
|
||||
var cFileInfo = new CheckFileInfo
|
||||
{
|
||||
BaseFileName = resource.DisplayName.Split(new []{'/'},StringSplitOptions.RemoveEmptyEntries).LastOrDefault(),
|
||||
BaseFileName = resource == null ? token.FilePath.Split('/').Last() : resource.DisplayName.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault(),
|
||||
OwnerId = WspContext.User.Login,
|
||||
Size = resource.ContentLength,
|
||||
Size = resource == null ? 0 : resource.ContentLength,
|
||||
Version = DateTime.Now.ToString("s"),
|
||||
SupportsCoauth = true,
|
||||
SupportsCobalt = true,
|
||||
|
@ -51,17 +58,34 @@ namespace WebsitePanel.WebDav.Core.Owa
|
|||
SupportsUpdate = true,
|
||||
UserCanWrite = !readOnly,
|
||||
ReadOnly = readOnly,
|
||||
RestrictedWebViewOnly = false
|
||||
RestrictedWebViewOnly = false,
|
||||
CloseButtonClosesWindow = true
|
||||
};
|
||||
|
||||
if (resource != null)
|
||||
{
|
||||
cFileInfo.ClientUrl = _webDavManager.GetFileUrl(token.FilePath);
|
||||
}
|
||||
|
||||
return cFileInfo;
|
||||
}
|
||||
|
||||
public FileResult GetFile(string path)
|
||||
public byte[] GetFileBytes(int accessTokenId)
|
||||
{
|
||||
var fileBytes = _webDavManager.GetFileBytes(path);
|
||||
var token = _tokenManager.GetToken(accessTokenId);
|
||||
|
||||
return new FileContentResult(fileBytes, MediaTypeNames.Application.Octet);
|
||||
if (_webDavManager.FileExist(token.FilePath))
|
||||
{
|
||||
return _webDavManager.GetFileBytes(token.FilePath);
|
||||
}
|
||||
|
||||
var cobaltFile = _fileManager.Get(token.FilePath) ?? _fileManager.Create(accessTokenId);
|
||||
|
||||
var stream = new MemoryStream();
|
||||
|
||||
new GenericFda(cobaltFile.CobaltEndpoint, null).GetContentStream().CopyTo(stream);
|
||||
|
||||
return stream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,8 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization.Enums
|
|||
Empty = 0,
|
||||
None = 1,
|
||||
Read = 2,
|
||||
Write = 4
|
||||
Write = 4,
|
||||
OwaRead = 8,
|
||||
OwaEdit = 16
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Cobalt;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
|
@ -54,6 +55,17 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization
|
|||
}
|
||||
}
|
||||
|
||||
var owaEditFolders = GetOwaFoldersWithEditPermission(principal);
|
||||
|
||||
if (owaEditFolders.Contains(rootFolder))
|
||||
{
|
||||
resultPermissions |= WebDavPermissions.OwaEdit;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultPermissions |= WebDavPermissions.OwaRead;
|
||||
}
|
||||
|
||||
return resultPermissions;
|
||||
}
|
||||
|
||||
|
@ -105,5 +117,41 @@ namespace WebsitePanel.WebDav.Core.Security.Authorization
|
|||
|
||||
return groups ?? new ExchangeAccount[0];
|
||||
}
|
||||
|
||||
private IEnumerable<string> GetOwaFoldersWithEditPermission(WspPrincipal principal)
|
||||
{
|
||||
var folders = HttpContext.Current.Session != null ? HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] as IEnumerable<string> : null;
|
||||
|
||||
if (folders != null)
|
||||
{
|
||||
return folders;
|
||||
}
|
||||
|
||||
var accountsIds = new List<int>();
|
||||
|
||||
accountsIds.Add(principal.AccountId);
|
||||
|
||||
var groups = GetUserSecurityGroups(principal);
|
||||
|
||||
accountsIds.AddRange(groups.Select(x=>x.AccountId));
|
||||
|
||||
try
|
||||
{
|
||||
folders = WspContext.Services.EnterpriseStorage.GetUserEnterpriseFolderWithOwaEditPermission(principal.ItemId, accountsIds.ToArray());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//TODO remove try catch when es &portal will be updated
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
|
||||
if (HttpContext.Current.Session != null)
|
||||
{
|
||||
HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.OwaEditFoldersSessionKey] = folders;
|
||||
}
|
||||
|
||||
return folders;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,6 +35,10 @@ namespace WebsitePanel.WebDavPortal
|
|||
"~/Scripts/appScripts/wsp.js"
|
||||
));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/appScripts-webdav").Include(
|
||||
"~/Scripts/appScripts/wsp-webdav.js"
|
||||
));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/bigIconsScripts").Include(
|
||||
"~/Scripts/appScripts/recalculateResourseHeight.js"
|
||||
));
|
||||
|
|
|
@ -46,6 +46,32 @@ namespace WebsitePanel.WebDavPortal
|
|||
|
||||
#region Enterprise storage
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.ItemExist,
|
||||
url: "storage/item-exist/{org}/{*pathPart}",
|
||||
defaults:
|
||||
new { controller = "FileSystem", action = "ItemExist", pathPart = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.NewWebDavItem,
|
||||
url: "storage/new/{org}/{*pathPart}",
|
||||
defaults:
|
||||
new { controller = "FileSystem", action = "NewWebDavItem", pathPart = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.SearchFiles,
|
||||
url: "storage/search/{org}/{*pathPart}",
|
||||
defaults: new { controller = "FileSystem", action = "SearchFiles", pathPart = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.SearchFilesContent,
|
||||
url: "storage/ajax/search/{org}/{*pathPart}",
|
||||
defaults: new { controller = "FileSystem", action = "SearchFilesContent", pathPart = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.ChangeWebDavViewType,
|
||||
url: "storage/change-view-type/{viewType}",
|
||||
|
|
|
@ -12,6 +12,9 @@ namespace WebsitePanel.WebDavPortal.UI.Routes
|
|||
public const string ShowContentDetails = "ShowContentDetailsRoute";
|
||||
public const string ShowOfficeOnlinePath_ = "ShowOfficeOnlineRoute";
|
||||
public const string ViewOfficeOnline = "ViewOfficeOnlineRoute";
|
||||
public const string NewFileOfficeOnline = "NewFileOfficeOnlineRoute";
|
||||
public const string NewWebDavItem = "NewWebDavItemRoute";
|
||||
public const string ItemExist = "ItemExistRoute";
|
||||
public const string EditOfficeOnline = "EditOfficeOnlineRoute";
|
||||
|
||||
public const string ShowAdditionalContent = "ShowAdditionalContentRoute";
|
||||
|
@ -21,5 +24,8 @@ namespace WebsitePanel.WebDavPortal.UI.Routes
|
|||
public const string DeleteFiles = "DeleteFilesRoute";
|
||||
|
||||
public const string DownloadFile = "DownloadFileRoute";
|
||||
|
||||
public const string SearchFiles = "SearchFilesRoute";
|
||||
public const string SearchFilesContent = "SearchFilesPostRoute";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
namespace WebsitePanel.WebDavPortal.Constants
|
||||
{
|
||||
public class Formtas
|
||||
{
|
||||
public const string DateFormatWithTime = "MM/dd/yyyy hh:mm tt";
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -60,6 +60,17 @@ tr.selected-file {
|
|||
|
||||
.table-icon {
|
||||
height: 30px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.column-name .file-info {
|
||||
display: inline-block;
|
||||
padding-left: 5px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.table-icon.search {
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.noselect {
|
||||
|
@ -77,6 +88,8 @@ tr.selected-file {
|
|||
|
||||
#webdav-items-table .file-link {
|
||||
padding-left: 5px;
|
||||
padding-top: 5px;
|
||||
display: inline-block;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
|
@ -86,6 +99,12 @@ tr.selected-file {
|
|||
height: 32px;
|
||||
}
|
||||
|
||||
#summary.summary {
|
||||
font-size: 11px;
|
||||
color: rgb(152, 152, 152);
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.drag-and-drop-area input {
|
||||
/* IE 8 */
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
||||
|
@ -233,17 +252,22 @@ tr.selected-file {
|
|||
|
||||
.file-actions-menu .file-deletion {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.file-actions-menu .file-upload {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.create-new-item {
|
||||
margin-top: -2px;
|
||||
}
|
||||
|
||||
#message-area {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
#processDialog .dialog-text {
|
||||
#processDialog .dialog-text, .container .dialog-text{
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
@ -252,16 +276,41 @@ tr.selected-file {
|
|||
width: 200px;
|
||||
}
|
||||
|
||||
.search-block {
|
||||
float: right;
|
||||
.dataTables_processing {
|
||||
width: 185px !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
left: 43% !important;
|
||||
background: initial !important;
|
||||
background-color: #FFFFFF !important;
|
||||
border: 1px solid #CDCDCD;
|
||||
height: 44px !important;
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.search-block input, .search-block label {
|
||||
.breadcrumb-wsp {
|
||||
display: inline-block;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.search-block {
|
||||
float: right;
|
||||
margin-right: 10px !important;
|
||||
width: 36%;
|
||||
}
|
||||
|
||||
.search-block input{
|
||||
display: inline-block;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.search-block label {
|
||||
display: inline-block;
|
||||
width: initial;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
|
||||
.elements-container {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
@ -295,6 +344,25 @@ tr.selected-file {
|
|||
display: block;
|
||||
}
|
||||
|
||||
.column-name {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.column-name #quota {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 20%;
|
||||
}
|
||||
|
||||
|
||||
.small-processing {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#filenameForm input {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Theme Mods */
|
||||
|
||||
input,div{border-radius:0px!important;}
|
||||
|
@ -361,4 +429,10 @@ div#breadcrumb_wrapper a:last-child {
|
|||
.header-portal-title {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.navbar-right {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
|
@ -54,22 +54,24 @@ namespace WebsitePanel.WebDavPortal.Controllers.Api
|
|||
{
|
||||
var token = _tokenManager.GetToken(accessTokenId);
|
||||
|
||||
var fileInfo = _wopiServer.GetCheckFileInfo(token.FilePath);
|
||||
var fileInfo = _wopiServer.GetCheckFileInfo(token);
|
||||
|
||||
var urlPart = Url.Route(FileSystemRouteNames.ShowContentPath, new { org = WspContext.User.OrganizationId, pathPart = token.FilePath });
|
||||
if (fileInfo.Size <= 1)
|
||||
{
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
var urlPart = Url.Route(FileSystemRouteNames.ShowContentPath, new {org = WspContext.User.OrganizationId, pathPart = token.FilePath});
|
||||
var url = new Uri(Request.RequestUri, urlPart).ToString();
|
||||
|
||||
fileInfo.DownloadUrl = url;
|
||||
fileInfo.ClientUrl = _webDavManager.GetFileUrl(token.FilePath);
|
||||
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
public HttpResponseMessage GetFile(int accessTokenId)
|
||||
{
|
||||
var token = _tokenManager.GetToken(accessTokenId);
|
||||
|
||||
var bytes = _webDavManager.GetFileBytes(token.FilePath);
|
||||
var bytes = _wopiServer.GetFileBytes(accessTokenId);
|
||||
|
||||
var result = new HttpResponseMessage(HttpStatusCode.OK);
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ using WebsitePanel.WebDavPortal.Models.Common.Enums;
|
|||
using WebsitePanel.WebDavPortal.Models.FileSystem;
|
||||
using WebsitePanel.WebDavPortal.UI;
|
||||
using WebsitePanel.WebDavPortal.UI.Routes;
|
||||
using WebsitePanel.WebDav.Core.Extensions;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Controllers
|
||||
|
||||
|
@ -143,7 +144,6 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult GetContentDetails(string org, string pathPart, [ModelBinder(typeof (JqueryDataTableModelBinder))] JqueryDataTableRequest dtRequest)
|
||||
{
|
||||
|
@ -151,16 +151,16 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
|
||||
if (string.IsNullOrEmpty(dtRequest.Search.Value) == false)
|
||||
{
|
||||
folderItems = _webdavManager.SearchFiles(WspContext.User.ItemId, pathPart, dtRequest.Search.Value, WspContext.User.Login, true).Select(x => new WebDavResource(null, x));
|
||||
folderItems = _webdavManager.SearchFiles(WspContext.User.ItemId, pathPart, dtRequest.Search.Value, WspContext.User.Login, true).Cast<WebDavResource>();
|
||||
}
|
||||
else
|
||||
{
|
||||
folderItems = _webdavManager.OpenFolder(pathPart).Select(x=>new WebDavResource(null, x));
|
||||
folderItems = _webdavManager.OpenFolder(pathPart).Cast<WebDavResource>();
|
||||
}
|
||||
|
||||
var tableItems = Mapper.Map<IEnumerable<WebDavResource>, IEnumerable<ResourceTableItemModel>>(folderItems).ToList();
|
||||
|
||||
FillContentModel(tableItems);
|
||||
FillContentModel(tableItems, org);
|
||||
|
||||
var orders = dtRequest.Orders.ToList();
|
||||
orders.Insert(0, new JqueryDataTableOrder{Column = 3, Ascending = false});
|
||||
|
@ -184,6 +184,24 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
return PartialView("_ResourseCollectionPartial", result);
|
||||
}
|
||||
|
||||
public ActionResult SearchFiles(string org, string pathPart, string searchValue)
|
||||
{
|
||||
if (string.IsNullOrEmpty(searchValue))
|
||||
{
|
||||
return RedirectToRoute(FileSystemRouteNames.ShowContentPath);
|
||||
}
|
||||
|
||||
var model = new ModelForWebDav
|
||||
{
|
||||
UrlSuffix = pathPart,
|
||||
Permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart),
|
||||
UserSettings = _userSettingsManager.GetUserSettings(WspContext.User.AccountId),
|
||||
SearchValue = searchValue
|
||||
};
|
||||
|
||||
return View("ShowContentSearchResultTable", model);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult DownloadFile(string org, string pathPart)
|
||||
{
|
||||
|
@ -285,6 +303,36 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
return Json(model);
|
||||
}
|
||||
|
||||
public ActionResult NewWebDavItem(string org, string pathPart)
|
||||
{
|
||||
var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart);
|
||||
|
||||
var owaOpener = WebDavAppConfigManager.Instance.OfficeOnline.FirstOrDefault(x => x.Extension == Path.GetExtension(pathPart));
|
||||
|
||||
if (permissions.HasFlag(WebDavPermissions.Write) == false || (owaOpener != null && permissions.HasFlag(WebDavPermissions.OwaEdit) == false))
|
||||
{
|
||||
return new RedirectToRouteResult(FileSystemRouteNames.ShowContentPath, null);
|
||||
}
|
||||
|
||||
if (owaOpener != null)
|
||||
{
|
||||
return ShowOfficeDocument(org, pathPart, owaOpener.OwaNewFileView);
|
||||
}
|
||||
|
||||
return new RedirectToRouteResult(FileSystemRouteNames.ShowContentPath, null);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult ItemExist(string org, string pathPart, string newItemName)
|
||||
{
|
||||
var exist = _webdavManager.FileExist(string.Format("{0}/{1}", pathPart.TrimEnd('/'), newItemName.Trim('/')));
|
||||
|
||||
return new JsonResult()
|
||||
{
|
||||
Data = !exist
|
||||
};
|
||||
}
|
||||
|
||||
#region Owa Actions
|
||||
|
||||
public ActionResult ShowOfficeDocument(string org, string pathPart, string owaOpenerUri)
|
||||
|
@ -318,7 +366,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
{
|
||||
var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart);
|
||||
|
||||
if (permissions.HasFlag(WebDavPermissions.Write) == false || Request.Browser.IsMobileDevice)
|
||||
if (permissions.HasFlag(WebDavPermissions.Write) == false || permissions.HasFlag(WebDavPermissions.OwaEdit) == false || Request.Browser.IsMobileDevice)
|
||||
{
|
||||
return new RedirectToRouteResult(FileSystemRouteNames.ViewOfficeOnline, null);
|
||||
}
|
||||
|
@ -327,19 +375,21 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
|
||||
return ShowOfficeDocument(org, pathPart, owaOpener.OwaEditor);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void FillContentModel(IEnumerable<ResourceTableItemModel> items)
|
||||
private void FillContentModel(IEnumerable<ResourceTableItemModel> items, string organizationId)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
var opener = _openerManager[Path.GetExtension(item.DisplayName)];
|
||||
//var pathPart = item.Href.ToString().Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/');
|
||||
var pathPart = item.Href.ToStringPath().Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/');
|
||||
|
||||
switch (opener)
|
||||
{
|
||||
case FileOpenerType.OfficeOnline:
|
||||
{
|
||||
var pathPart = item.Href.AbsolutePath.Replace("/" + WspContext.User.OrganizationId, "").TrimStart('/');
|
||||
item.Url = string.Concat(Url.RouteUrl(FileSystemRouteNames.EditOfficeOnline, new {org = WspContext.User.OrganizationId, pathPart = ""}), pathPart);
|
||||
break;
|
||||
}
|
||||
|
@ -350,6 +400,11 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
var folderPath = Server.UrlDecode(_webdavManager.GetFileFolderPath(pathPart));
|
||||
|
||||
item.FolderUrlAbsoluteString = Server.UrlDecode(Url.RouteUrl(FileSystemRouteNames.ShowContentPath, new {org = organizationId, pathPart = folderPath}, Request.Url.Scheme));
|
||||
item.FolderUrlLocalString = Url.RouteUrl(FileSystemRouteNames.ShowContentPath, new { org = organizationId, pathPart = folderPath });
|
||||
|
||||
if (Request.Browser.IsMobileDevice)
|
||||
{
|
||||
item.IsTargetBlank = false;
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Helpers
|
||||
{
|
||||
public class ViewDataHelper
|
||||
{
|
||||
public static string BytesToSize(long bytes)
|
||||
{
|
||||
if (bytes == 0)
|
||||
{
|
||||
return string.Format("0 {0}", Resources.UI.Byte);
|
||||
}
|
||||
|
||||
var k = 1024;
|
||||
|
||||
var sizes = new[]
|
||||
{
|
||||
Resources.UI.Bytes,
|
||||
Resources.UI.KilobyteShort,
|
||||
Resources.UI.MegabyteShort,
|
||||
Resources.UI.GigabyteShort,
|
||||
Resources.UI.TerabyteShort,
|
||||
Resources.UI.PetabyteShort,
|
||||
Resources.UI.ExabyteShort
|
||||
};
|
||||
|
||||
var i = (int) Math.Floor(Math.Log(bytes)/Math.Log(k));
|
||||
return string.Format("{0} {1}", Math.Round(bytes/Math.Pow(k, i), 3), sizes[i]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ using AutoMapper;
|
|||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Extensions;
|
||||
using WebsitePanel.WebDavPortal.Constants;
|
||||
using WebsitePanel.WebDavPortal.FileOperations;
|
||||
using WebsitePanel.WebDavPortal.Models.FileSystem;
|
||||
|
||||
|
@ -43,9 +44,12 @@ namespace WebsitePanel.WebDavPortal.Mapping.Profiles.Webdav
|
|||
.ForMember(ti => ti.IconHref, x => x.MapFrom(hi => hi.ItemType == ItemType.Folder ? WebDavAppConfigManager.Instance.FileIcons.FolderPath.Trim('~') : WebDavAppConfigManager.Instance.FileIcons[Path.GetExtension(hi.DisplayName.Trim('/'))].Trim('~')))
|
||||
.ForMember(ti => ti.IsTargetBlank, x => x.MapFrom(hi => openerManager.GetIsTargetBlank(hi)))
|
||||
.ForMember(ti => ti.LastModified, x => x.MapFrom(hi => hi.LastModified))
|
||||
.ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString("dd/MM/yyyy hh:mm tt")))
|
||||
.ForMember(ti => ti.LastModifiedFormated, x => x.MapFrom(hi => hi.LastModified == DateTime.MinValue ? "--" : (new WebDavResource(null, hi)).LastModified.ToString(Formtas.DateFormatWithTime)))
|
||||
|
||||
.ForMember(ti => ti.Summary, x => x.MapFrom(hi => hi.Summary))
|
||||
.ForMember(ti => ti.IsRoot, x => x.MapFrom(hi => hi.IsRootItem))
|
||||
.ForMember(ti => ti.Size, x => x.MapFrom(hi => hi.ContentLength))
|
||||
.ForMember(ti => ti.Quota, x => x.MapFrom(hi => hi.AllocatedSpace))
|
||||
.ForMember(ti => ti.IsFolder, x => x.MapFrom(hi => hi.ItemType == ItemType.Folder));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,16 @@ namespace WebsitePanel.WebDavPortal.Models.FileSystem
|
|||
public bool IsTargetBlank { get; set; }
|
||||
public bool IsFolder { get; set; }
|
||||
public long Size { get; set; }
|
||||
public bool IsRoot { get; set; }
|
||||
public long Quota { get; set; }
|
||||
public string Type { get; set; }
|
||||
public DateTime LastModified { get; set; }
|
||||
public string LastModifiedFormated { get; set; }
|
||||
public string IconHref { get; set; }
|
||||
public string FolderUrlAbsoluteString { get; set; }
|
||||
public string FolderUrlLocalString { get; set; }
|
||||
public string FolderName { get; set; }
|
||||
public string Summary { get; set; }
|
||||
|
||||
public override dynamic this[int index]
|
||||
{
|
||||
|
|
|
@ -69,6 +69,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Byte.
|
||||
/// </summary>
|
||||
public static string Byte {
|
||||
get {
|
||||
return ResourceManager.GetString("Byte", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bytes.
|
||||
/// </summary>
|
||||
public static string Bytes {
|
||||
get {
|
||||
return ResourceManager.GetString("Bytes", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cancel.
|
||||
/// </summary>
|
||||
|
@ -105,6 +123,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Create.
|
||||
/// </summary>
|
||||
public static string Create {
|
||||
get {
|
||||
return ResourceManager.GetString("Create", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Delete.
|
||||
/// </summary>
|
||||
|
@ -141,6 +168,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Please enter file name.
|
||||
/// </summary>
|
||||
public static string EnterFileName {
|
||||
get {
|
||||
return ResourceManager.GetString("EnterFileName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error.
|
||||
/// </summary>
|
||||
|
@ -150,6 +186,42 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to EB.
|
||||
/// </summary>
|
||||
public static string ExabyteShort {
|
||||
get {
|
||||
return ResourceManager.GetString("ExabyteShort", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Excel workbook.
|
||||
/// </summary>
|
||||
public static string ExcelWorkbook {
|
||||
get {
|
||||
return ResourceManager.GetString("ExcelWorkbook", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to File.
|
||||
/// </summary>
|
||||
public static string File {
|
||||
get {
|
||||
return ResourceManager.GetString("File", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to File name.
|
||||
/// </summary>
|
||||
public static string FileName {
|
||||
get {
|
||||
return ResourceManager.GetString("FileName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to File Upload.
|
||||
/// </summary>
|
||||
|
@ -168,6 +240,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Info.
|
||||
/// </summary>
|
||||
public static string Info {
|
||||
get {
|
||||
return ResourceManager.GetString("Info", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to File already exist.
|
||||
/// </summary>
|
||||
public static string ItemExist {
|
||||
get {
|
||||
return ResourceManager.GetString("ItemExist", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} items was removed..
|
||||
/// </summary>
|
||||
|
@ -177,6 +267,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to KB.
|
||||
/// </summary>
|
||||
public static string KilobyteShort {
|
||||
get {
|
||||
return ResourceManager.GetString("KilobyteShort", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to MB.
|
||||
/// </summary>
|
||||
public static string MegabyteShort {
|
||||
get {
|
||||
return ResourceManager.GetString("MegabyteShort", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Modified.
|
||||
/// </summary>
|
||||
|
@ -222,6 +330,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to PB.
|
||||
/// </summary>
|
||||
public static string PetabyteShort {
|
||||
get {
|
||||
return ResourceManager.GetString("PetabyteShort", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Please wait....
|
||||
/// </summary>
|
||||
|
@ -231,6 +348,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Powerpoint presentation.
|
||||
/// </summary>
|
||||
public static string PowerPointPresentation {
|
||||
get {
|
||||
return ResourceManager.GetString("PowerPointPresentation", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Processing.
|
||||
/// </summary>
|
||||
|
@ -258,6 +384,24 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Search Documents.
|
||||
/// </summary>
|
||||
public static string SearchDocuments {
|
||||
get {
|
||||
return ResourceManager.GetString("SearchDocuments", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Search Results.
|
||||
/// </summary>
|
||||
public static string SearchResults {
|
||||
get {
|
||||
return ResourceManager.GetString("SearchResults", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select files to upload.
|
||||
/// </summary>
|
||||
|
@ -285,6 +429,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to TB.
|
||||
/// </summary>
|
||||
public static string TerabyteShort {
|
||||
get {
|
||||
return ResourceManager.GetString("TerabyteShort", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Type.
|
||||
/// </summary>
|
||||
|
@ -303,6 +456,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Word document.
|
||||
/// </summary>
|
||||
public static string WordDocument {
|
||||
get {
|
||||
return ResourceManager.GetString("WordDocument", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Yes.
|
||||
/// </summary>
|
||||
|
|
|
@ -120,6 +120,12 @@
|
|||
<data name="Actions" xml:space="preserve">
|
||||
<value>Actions</value>
|
||||
</data>
|
||||
<data name="Byte" xml:space="preserve">
|
||||
<value>Byte</value>
|
||||
</data>
|
||||
<data name="Bytes" xml:space="preserve">
|
||||
<value>Bytes</value>
|
||||
</data>
|
||||
<data name="Cancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
|
@ -132,6 +138,9 @@
|
|||
<data name="Confirm" xml:space="preserve">
|
||||
<value>Confirm</value>
|
||||
</data>
|
||||
<data name="Create" xml:space="preserve">
|
||||
<value>Create</value>
|
||||
</data>
|
||||
<data name="Delete" xml:space="preserve">
|
||||
<value>Delete</value>
|
||||
</data>
|
||||
|
@ -144,18 +153,45 @@
|
|||
<data name="DialogsContentConfrimFileDeletion" xml:space="preserve">
|
||||
<value>Are you sure you want to delete {0} item(s)?</value>
|
||||
</data>
|
||||
<data name="EnterFileName" xml:space="preserve">
|
||||
<value>Please enter file name</value>
|
||||
</data>
|
||||
<data name="Error" xml:space="preserve">
|
||||
<value>Error</value>
|
||||
</data>
|
||||
<data name="ExabyteShort" xml:space="preserve">
|
||||
<value>EB</value>
|
||||
</data>
|
||||
<data name="ExcelWorkbook" xml:space="preserve">
|
||||
<value>Excel workbook</value>
|
||||
</data>
|
||||
<data name="File" xml:space="preserve">
|
||||
<value>File</value>
|
||||
</data>
|
||||
<data name="FileName" xml:space="preserve">
|
||||
<value>File name</value>
|
||||
</data>
|
||||
<data name="FileUpload" xml:space="preserve">
|
||||
<value>File Upload</value>
|
||||
</data>
|
||||
<data name="GigabyteShort" xml:space="preserve">
|
||||
<value>Gb</value>
|
||||
</data>
|
||||
<data name="Info" xml:space="preserve">
|
||||
<value>Info</value>
|
||||
</data>
|
||||
<data name="ItemExist" xml:space="preserve">
|
||||
<value>File already exist</value>
|
||||
</data>
|
||||
<data name="ItemsWasRemovedFormat" xml:space="preserve">
|
||||
<value>{0} items was removed.</value>
|
||||
</data>
|
||||
<data name="KilobyteShort" xml:space="preserve">
|
||||
<value>KB</value>
|
||||
</data>
|
||||
<data name="MegabyteShort" xml:space="preserve">
|
||||
<value>MB</value>
|
||||
</data>
|
||||
<data name="Modified" xml:space="preserve">
|
||||
<value>Modified</value>
|
||||
</data>
|
||||
|
@ -171,9 +207,15 @@
|
|||
<data name="OrDragAndDropFilesHere" xml:space="preserve">
|
||||
<value>or drag and drop files here.</value>
|
||||
</data>
|
||||
<data name="PetabyteShort" xml:space="preserve">
|
||||
<value>PB</value>
|
||||
</data>
|
||||
<data name="PleaseWaitWithDots" xml:space="preserve">
|
||||
<value>Please wait...</value>
|
||||
</data>
|
||||
<data name="PowerPointPresentation" xml:space="preserve">
|
||||
<value>Powerpoint presentation</value>
|
||||
</data>
|
||||
<data name="Processing" xml:space="preserve">
|
||||
<value>Processing</value>
|
||||
</data>
|
||||
|
@ -183,6 +225,12 @@
|
|||
<data name="Search" xml:space="preserve">
|
||||
<value>Search</value>
|
||||
</data>
|
||||
<data name="SearchDocuments" xml:space="preserve">
|
||||
<value>Search Documents</value>
|
||||
</data>
|
||||
<data name="SearchResults" xml:space="preserve">
|
||||
<value>Search Results</value>
|
||||
</data>
|
||||
<data name="SelectFilesToUpload" xml:space="preserve">
|
||||
<value>Select files to upload</value>
|
||||
</data>
|
||||
|
@ -192,12 +240,18 @@
|
|||
<data name="Table" xml:space="preserve">
|
||||
<value>Table</value>
|
||||
</data>
|
||||
<data name="TerabyteShort" xml:space="preserve">
|
||||
<value>TB</value>
|
||||
</data>
|
||||
<data name="Type" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="Upload" xml:space="preserve">
|
||||
<value>Upload</value>
|
||||
</data>
|
||||
<data name="WordDocument" xml:space="preserve">
|
||||
<value>Word document</value>
|
||||
</data>
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Yes</value>
|
||||
</data>
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
function CheckAuthenticationExpiration(authcookieName, logoutUrl) {
|
||||
var c = $.cookie(authcookieName);
|
||||
|
||||
function CheckAuthenticationExpiration(authTimeOutCookieName, authCookieName, logoutUrl) {
|
||||
var c = $.cookie(authTimeOutCookieName);
|
||||
|
||||
if (c != null && c != "" && !isNaN(c)) {
|
||||
var now = new Date();
|
||||
var ms = parseInt(c, 10);
|
||||
var expiration = new Date().setTime(ms);
|
||||
if (now > expiration) {
|
||||
$.removeCookie(authTimeOutCookieName, { path: '/' });
|
||||
window.location.replace(logoutUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function StartAuthExpirationCheckTimer(authcookieName, logoutUrl) {
|
||||
function StartAuthExpirationCheckTimer(authTimeOutCookieName, authCookieName, logoutUrl) {
|
||||
setInterval(function() {
|
||||
CheckAuthenticationExpiration(authcookieName, logoutUrl);
|
||||
CheckAuthenticationExpiration(authTimeOutCookieName, authCookieName, logoutUrl);
|
||||
}, 20000);
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
function WspDialogs() {
|
||||
this.settings = { dialogId: "#confirm-dialog", processDialogId: "#processDialog" };
|
||||
this.settings = {
|
||||
dialogId: "#confirm-dialog",
|
||||
processDialogId: "#processDialog",
|
||||
inlineProcessDialog: '.glyphicon-refresh'
|
||||
};
|
||||
}
|
||||
|
||||
WspDialogs.prototype =
|
||||
|
@ -36,6 +40,14 @@ WspDialogs.prototype =
|
|||
|
||||
hideProcessDialog: function() {
|
||||
$(this.settings.processDialogId).modal('hide');
|
||||
}
|
||||
},
|
||||
|
||||
showInlineProcessing: function(itemId) {
|
||||
$(itemId).parent().find(this.settings.inlineProcessDialog).show();
|
||||
},
|
||||
|
||||
hideInlineProcessing: function (itemId) {
|
||||
$(itemId).parent().find(this.settings.inlineProcessDialog).hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
function WspFileBrowser() {
|
||||
this.settings = { deletionBlockSelector: ".file-actions-menu .file-deletion", deletionUrl: "storage/files-group-action/delete" };
|
||||
this.table = null;
|
||||
this.settings = {
|
||||
deletionBlockSelector: ".file-actions-menu .file-deletion",
|
||||
deletionUrl: "storage/files-group-action/delete",
|
||||
fileExistUrl: "storage/fileExist",
|
||||
textDateModified: "Date modified",
|
||||
textSize: "Size",
|
||||
textItemExist: "File already exists",
|
||||
textItemExistFunc: function() {
|
||||
return textItemExist;
|
||||
} ,
|
||||
createNewItemDialogId: "#createNewItemDialog",
|
||||
createNewItemButtonId: "#create-button",
|
||||
createNewItemTitleId: '#create-dalog-label',
|
||||
processingDialogDom: '<div><img src="/Content/Images/indicator_medium.gif"><h4 class="dialog-text">Please wait...</h4></div>'
|
||||
};
|
||||
this.itemsTable = null;
|
||||
this.searchTable = null;
|
||||
}
|
||||
|
||||
WspFileBrowser.prototype = {
|
||||
|
@ -34,7 +49,8 @@ WspFileBrowser.prototype = {
|
|||
}).get();
|
||||
},
|
||||
|
||||
deleteSelectedItems: function(e) {
|
||||
deleteSelectedItems: function (e) {
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: wsp.fileBrowser.settings.deletionUrl,
|
||||
|
@ -45,7 +61,7 @@ WspFileBrowser.prototype = {
|
|||
|
||||
wsp.fileBrowser.clearDeletedItems(model.DeletedFiles);
|
||||
wsp.fileBrowser.refreshDeletionBlock();
|
||||
wsp.fileBrowser.refreshDataTable();
|
||||
wsp.fileBrowser.refreshDataTable(wsp.fileBrowser.itemsTable);
|
||||
|
||||
wsp.dialogs.hideProcessDialog();
|
||||
},
|
||||
|
@ -53,7 +69,7 @@ WspFileBrowser.prototype = {
|
|||
wsp.messages.addErrorMessage(errorThrown);
|
||||
|
||||
wsp.fileBrowser.refreshDeletionBlock();
|
||||
wsp.fileBrowser.refreshDataTable();
|
||||
wsp.fileBrowser.refreshDataTable(wsp.fileBrowser.itemsTable);
|
||||
|
||||
wsp.dialogs.hideProcessDialog();
|
||||
}
|
||||
|
@ -79,17 +95,19 @@ WspFileBrowser.prototype = {
|
|||
},
|
||||
|
||||
initDataTable: function (tableId, ajaxUrl) {
|
||||
this.table = $(tableId).dataTable({
|
||||
this.itemsTable = $(tableId).dataTable({
|
||||
"ajax": ajaxUrl,
|
||||
"processing": false,
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
"dom": 'rtlp',
|
||||
"columnDefs": [
|
||||
{
|
||||
"render": function(data, type, row) {
|
||||
return '<img class="table-icon" src="' + row.IconHref + '"/>' +
|
||||
'<a href="' + row.Url + '" ' + (row.IsTargetBlank ? 'target="_blank"' : '') + ' class="file-link ' + (row.IsFolder ? 'processing-dialog':'') + '" title="' + row.DisplayName + '">' +
|
||||
return '<div class="column-name"><img class="table-icon" src="' + row.IconHref + '"/>' +
|
||||
'<a href="' + row.Url + '" ' + (row.IsTargetBlank ? 'target="_blank"' : '') + ' class="file-link" title="' + row.DisplayName + '">' +
|
||||
row.DisplayName +
|
||||
'</a>';
|
||||
'</a>' + (row.IsRoot ? '<span id="quota">' + wsp.fileBrowser.bytesToSize(row.Size) + ' / ' + wsp.fileBrowser.bytesToSize(row.Quota) + '</span>' : '')
|
||||
+'</div>';
|
||||
},
|
||||
"targets": 0
|
||||
},
|
||||
|
@ -114,31 +132,88 @@ WspFileBrowser.prototype = {
|
|||
"createdRow": function(row, data, index) {
|
||||
$(row).addClass('element-container');
|
||||
},
|
||||
"fnPreDrawCallback": function () {
|
||||
// gather info to compose a message
|
||||
wsp.dialogs.showProcessDialog();
|
||||
return true;
|
||||
},
|
||||
"fnDrawCallback": function () {
|
||||
// in case your overlay needs to be put away automatically you can put it here
|
||||
wsp.dialogs.hideProcessDialog();
|
||||
"oLanguage": {
|
||||
"sProcessing": this.settings.processingDialogDom
|
||||
}
|
||||
});
|
||||
|
||||
$(tableId).removeClass('dataTable');
|
||||
|
||||
var oTable = this.table;
|
||||
$(tableId+'_filter input').unbind();
|
||||
$(tableId+'_filter input').bind('keyup', function (e) {
|
||||
if (e.keyCode == 13) {
|
||||
oTable.fnFilter(this.value);
|
||||
}
|
||||
});
|
||||
//var oTable = this.table;
|
||||
|
||||
//$(searchInputId).bind('keyup', function (e) {
|
||||
// if (e.keyCode == 13) {
|
||||
// oTable.fnFilter(this.value);
|
||||
// }
|
||||
//});
|
||||
|
||||
//$(searchInputId).keydown(function (event) {
|
||||
// if (event.keyCode == 13) {
|
||||
// event.preventDefault();
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// return true;
|
||||
//});
|
||||
|
||||
},
|
||||
|
||||
refreshDataTable: function () {
|
||||
if (this.table != null) {
|
||||
this.table.fnDraw(false);
|
||||
initSearchDataTable: function (tableId, ajaxUrl, initSearch) {
|
||||
|
||||
var settings = this.settings;
|
||||
var classThis = this;
|
||||
|
||||
this.searchTable = $(tableId).dataTable({
|
||||
"ajax": ajaxUrl,
|
||||
"processing": true,
|
||||
"serverSide": true,
|
||||
"oSearch": { "sSearch": initSearch },
|
||||
"dom": 'rtlp',
|
||||
"columnDefs": [
|
||||
{
|
||||
"render": function (data, type, row) {
|
||||
return '<div class="column-name">' +
|
||||
'<img class="table-icon search" src="' + row.IconHref + '"/>' +
|
||||
'<div class="file-info">' +
|
||||
'<a href="' + row.Url + '" ' + (row.IsTargetBlank ? 'target="_blank"' : '') + ' class="file-link" title="' + row.DisplayName + '">' +
|
||||
row.DisplayName +
|
||||
'</a>' +
|
||||
'<div id="summary" class="summary">' + (row.Summary ? (row.Summary + '').substring(0, 500) + '...' : '') + '</div>' +
|
||||
'<div>' +
|
||||
'<a href="' + row.FolderUrlLocalString + '" ' + 'target="_blank" class="file-link" >' +
|
||||
row.FolderUrlAbsoluteString +
|
||||
'</a>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
},
|
||||
"targets": 0
|
||||
},
|
||||
{
|
||||
"render": function (data, type, row) {
|
||||
return '<div>' +settings.textDateModified+': '+ row.LastModifiedFormated+ '</div>' +
|
||||
'<div>' + settings.textSize + ': ' + classThis.bytesToSize(row.Size) + '</div>';
|
||||
},
|
||||
"orderable": false,
|
||||
"width": "25%",
|
||||
"targets": 1
|
||||
}
|
||||
],
|
||||
"createdRow": function (row, data, index) {
|
||||
$(row).addClass('element-container');
|
||||
},
|
||||
"oLanguage": {
|
||||
"sProcessing": this.settings.processingDialogDom
|
||||
}
|
||||
});
|
||||
|
||||
$(tableId).removeClass('dataTable');
|
||||
|
||||
},
|
||||
|
||||
refreshDataTable: function (table) {
|
||||
if (table != null) {
|
||||
table.fnDraw(false);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -186,6 +261,48 @@ WspFileBrowser.prototype = {
|
|||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
bytesToSize: function(bytes) {
|
||||
if (bytes == 0) return '0 Byte';
|
||||
var k = 1024;
|
||||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
var i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
|
||||
},
|
||||
|
||||
showCreateNewItemDialog: function (extension, target, title) {
|
||||
$(this.settings.createNewItemButtonId).data('extension', extension);
|
||||
$(this.settings.createNewItemButtonId).data('target', target);
|
||||
|
||||
$(this.settings.createNewItemDialogId + " input").val("");
|
||||
|
||||
$(this.settings.createNewItemTitleId).text($(this.settings.createNewItemTitleId).data('title') + " " + title);
|
||||
|
||||
$(this.settings.createNewItemDialogId).modal();
|
||||
},
|
||||
|
||||
hideCreateNewItemDialog: function () {
|
||||
$(this.settings.createNewItemDialogId).modal('hide');
|
||||
},
|
||||
|
||||
uniqueFileNameFieldRule: function(fieldId) {
|
||||
|
||||
return {
|
||||
url: this.settings.fileExistUrl,
|
||||
type: "post",
|
||||
data: {
|
||||
newItemName: function() {
|
||||
return $(fieldId).val() + $(wsp.fileBrowser.settings.createNewItemButtonId).data('extension');
|
||||
}
|
||||
},
|
||||
beforeSend: function(response) {
|
||||
wsp.dialogs.showInlineProcessing(fieldId);
|
||||
},
|
||||
complete: function() {
|
||||
wsp.dialogs.hideInlineProcessing(fieldId);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
//Toggle file select + Ctrl multiselect
|
||||
$(document).on('click', '.element-container', function (e) {
|
||||
if (e.ctrlKey) {
|
||||
$(this).toggleClass("selected-file");
|
||||
} else {
|
||||
|
||||
wsp.fileBrowser.clearAllSelectedItems();
|
||||
|
||||
wsp.fileBrowser.selectItem(this);
|
||||
}
|
||||
|
||||
wsp.fileBrowser.refreshDeletionBlock();
|
||||
});
|
||||
|
||||
$(document).on('touchstart', '.element-container', function (e) {
|
||||
var now = new Date().getTime();
|
||||
var lastTouch = $(this).data('lastTouch') || now + 1;
|
||||
var delta = now - lastTouch;
|
||||
|
||||
if (delta < 300 && delta > 0) {
|
||||
wsp.fileBrowser.openItem(this);
|
||||
$(this).data('lastTouch', 0);
|
||||
}
|
||||
|
||||
$(this).data('lastTouch', now);
|
||||
});
|
||||
|
||||
//Double click file open
|
||||
$(document).on('dblclick', '.element-container', function (e) {
|
||||
wsp.fileBrowser.openItem(this);
|
||||
|
||||
var links = $(this).find('.file-link');
|
||||
|
||||
if (links.length != 0 && $(links[0]).hasClass('processing-dialog')) {
|
||||
wsp.dialogs.showProcessDialog();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//Delete button click
|
||||
$(document).on('click', '.file-deletion #delete-button', function (e) {
|
||||
var dialogId = $(this).data('target');
|
||||
var buttonText = $(this).data('target-positive-button-text');
|
||||
var content = $(this).data('target-content');
|
||||
var title = $(this).data('target-title-text');
|
||||
|
||||
content = jQuery.validator.format(content, wsp.fileBrowser.getSelectedItemsCount());
|
||||
|
||||
wsp.dialogs.showConfirmDialog(title, content, buttonText, wsp.fileBrowser.deleteSelectedItems, dialogId);
|
||||
});
|
||||
|
||||
|
||||
$(document).click(function (event) {
|
||||
if (!$(event.target).closest('.element-container, .prevent-deselect').length) {
|
||||
wsp.fileBrowser.clearAllSelectedItems();
|
||||
wsp.fileBrowser.refreshDeletionBlock();
|
||||
}
|
||||
});
|
||||
|
||||
$('#drag-and-drop-area').click(function (e) {
|
||||
$('#file-input').click();
|
||||
});
|
||||
|
||||
$('#drag-and-drop-area #file-input').click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#create-button").click(function (e) {
|
||||
|
||||
if ($('#filenameForm').valid()) {
|
||||
|
||||
var fileName = $('#createNewItemDialog #filename').val() + $(this).data('extension');
|
||||
|
||||
$(this).attr('href', $(this).data('href') + '/' + fileName);
|
||||
|
||||
$(this).attr('target', $(this).data('target'));
|
||||
|
||||
wsp.fileBrowser.hideCreateNewItemDialog();
|
||||
//;
|
||||
} else {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#filenameForm').validate({
|
||||
onkeyup: false,
|
||||
onclick: false,
|
||||
async: false,
|
||||
rules: {
|
||||
filename: {
|
||||
required: true,
|
||||
synchronousRemote: wsp.fileBrowser.uniqueFileNameFieldRule("#filename")
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
filename: {
|
||||
synchronousRemote: wsp.fileBrowser.settings.textItemExist
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#filename').keydown(function (event) {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
$(".create-new-item li a").click(function () {
|
||||
|
||||
$("#filenameForm").clearValidation();
|
||||
|
||||
wsp.fileBrowser.showCreateNewItemDialog($(this).data('extension'), $(this).data('target'), $(this).text());
|
||||
|
||||
$("#filename").focus();
|
||||
});
|
|
@ -10,72 +10,84 @@ $(document).on('click', '.processing-dialog', function (e) {
|
|||
});
|
||||
|
||||
|
||||
//Toggle file select + Ctrl multiselect
|
||||
$(document).on('click', '.element-container', function (e) {
|
||||
if (e.ctrlKey) {
|
||||
$(this).toggleClass("selected-file");
|
||||
} else {
|
||||
$(document).ready(function() {
|
||||
//bootstrap jquery validate styles fix
|
||||
$.validator.setDefaults({
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-group').addClass('has-error');
|
||||
},
|
||||
unhighlight: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-error');
|
||||
},
|
||||
errorElement: 'span',
|
||||
errorClass: 'help-block',
|
||||
errorPlacement: function(error, element) {
|
||||
if (element.parent('.input-group').length) {
|
||||
error.insertAfter(element.parent());
|
||||
} else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
wsp.fileBrowser.clearAllSelectedItems();
|
||||
$.validator.addMethod("synchronousRemote", function(value, element, param) {
|
||||
if (this.optional(element)) {
|
||||
return "dependency-mismatch";
|
||||
}
|
||||
|
||||
wsp.fileBrowser.selectItem(this);
|
||||
}
|
||||
var previous = this.previousValue(element);
|
||||
if (!this.settings.messages[element.name]) {
|
||||
this.settings.messages[element.name] = {};
|
||||
}
|
||||
previous.originalMessage = this.settings.messages[element.name].remote;
|
||||
this.settings.messages[element.name].remote = previous.message;
|
||||
|
||||
wsp.fileBrowser.refreshDeletionBlock();
|
||||
});
|
||||
param = typeof param === "string" && { url: param } || param;
|
||||
|
||||
$(document).on('touchstart', '.element-container', function(e) {
|
||||
var now = new Date().getTime();
|
||||
var lastTouch = $(this).data('lastTouch') || now + 1;
|
||||
var delta = now - lastTouch;
|
||||
if (previous.old === value) {
|
||||
return previous.valid;
|
||||
}
|
||||
|
||||
if (delta < 300 && delta > 0) {
|
||||
wsp.fileBrowser.openItem(this);
|
||||
$(this).data('lastTouch', 0);
|
||||
}
|
||||
|
||||
$(this).data('lastTouch', now);
|
||||
});
|
||||
|
||||
//Double click file open
|
||||
$(document).on('dblclick', '.element-container', function (e) {
|
||||
wsp.fileBrowser.openItem(this);
|
||||
|
||||
var links = $(this).find('.file-link');
|
||||
|
||||
if (links.length != 0 && $(links[0]).hasClass('processing-dialog')) {
|
||||
wsp.dialogs.showProcessDialog();
|
||||
}
|
||||
previous.old = value;
|
||||
var validator = this;
|
||||
this.startRequest(element);
|
||||
var data = {};
|
||||
data[element.name] = value;
|
||||
var valid = "pending";
|
||||
$.ajax($.extend(true, {
|
||||
url: param,
|
||||
async: false,
|
||||
mode: "abort",
|
||||
port: "validate" + element.name,
|
||||
dataType: "json",
|
||||
data: data,
|
||||
success: function(response) {
|
||||
validator.settings.messages[element.name].remote = previous.originalMessage;
|
||||
valid = response === true || response === "true";
|
||||
if (valid) {
|
||||
var submitted = validator.formSubmitted;
|
||||
validator.prepareElement(element);
|
||||
validator.formSubmitted = submitted;
|
||||
validator.successList.push(element);
|
||||
delete validator.invalid[element.name];
|
||||
validator.showErrors();
|
||||
} else {
|
||||
var errors = {};
|
||||
var message = response || validator.defaultMessage(element, "remote");
|
||||
errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
|
||||
validator.invalid[element.name] = true;
|
||||
validator.showErrors(errors);
|
||||
}
|
||||
previous.valid = valid;
|
||||
validator.stopRequest(element, valid);
|
||||
}
|
||||
}, param));
|
||||
return valid;
|
||||
}, "Please fix this field.");
|
||||
});
|
||||
|
||||
|
||||
//Delete button click
|
||||
$(document).on('click', '.file-deletion #delete-button', function (e) {
|
||||
var dialogId = $(this).data('target');
|
||||
var buttonText = $(this).data('target-positive-button-text');
|
||||
var content = $(this).data('target-content');
|
||||
var title = $(this).data('target-title-text');
|
||||
|
||||
content = jQuery.validator.format(content, wsp.fileBrowser.getSelectedItemsCount());
|
||||
|
||||
wsp.dialogs.showConfirmDialog(title, content, buttonText, wsp.fileBrowser.deleteSelectedItems, dialogId);
|
||||
});
|
||||
|
||||
|
||||
$(document).click(function(event) {
|
||||
if (!$(event.target).closest('.element-container, .prevent-deselect').length) {
|
||||
wsp.fileBrowser.clearAllSelectedItems();
|
||||
wsp.fileBrowser.refreshDeletionBlock();
|
||||
}
|
||||
});
|
||||
|
||||
$('#drag-and-drop-area').click(function (e) {
|
||||
$('#file-input').click();
|
||||
});
|
||||
|
||||
$('#drag-and-drop-area #file-input').click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
$.fn.clearValidation = function () { var v = $(this).validate(); $('[name]', this).each(function () { v.successList.push(this); v.showErrors(); }); v.resetForm(); v.reset(); $(this).find('.form-group').removeClass('has-error'); };
|
||||
|
||||
|
||||
function isMobileDevice() {
|
||||
|
|
|
@ -25,9 +25,15 @@ else
|
|||
|
||||
|
||||
@section scripts{
|
||||
|
||||
<script>
|
||||
wsp.fileBrowser.setSettings({ deletionUrl: "@Url.RouteUrl(FileSystemRouteNames.DeleteFiles)" });
|
||||
wsp.fileBrowser.setSettings({
|
||||
deletionUrl: "@Url.RouteUrl(FileSystemRouteNames.DeleteFiles)",
|
||||
fileExistUrl: "@Url.RouteUrl(FileSystemRouteNames.ItemExist)",
|
||||
textItemExist: "@UI.ItemExist." });
|
||||
</script>
|
||||
|
||||
@Scripts.Render("~/bundles/appScripts-webdav")
|
||||
|
||||
@if (Model.UserSettings.WebDavViewType == FolderViewTypes.BigIcons)
|
||||
{
|
||||
|
@ -47,15 +53,37 @@ else
|
|||
{
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
wsp.fileBrowser.setSettings({ deletionUrl: "@Url.RouteUrl(FileSystemRouteNames.DeleteFiles)" });
|
||||
wsp.fileBrowser.initDataTable('#webdav-items-table', '@Url.RouteUrl(FileSystemRouteNames.ShowContentDetails)');
|
||||
});
|
||||
</script>
|
||||
}
|
||||
}
|
||||
|
||||
@section popups
|
||||
{
|
||||
@Html.Partial("_ProcessDialog", null)
|
||||
@Html.Partial("_ConfirmDialog")
|
||||
@section popups{
|
||||
<div id="createNewItemDialog" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-process-dialog-title" data-backdrop="static" data-keyboard="false" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="create-dalog-label" data-title="@UI.Create">@UI.Create</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<form id="filenameForm">
|
||||
<div class="form-group has-feedback">
|
||||
<label for="filename">@UI.FileName</label>
|
||||
<input type="text" class="form-control" id="filename" name="filename" autofocus required placeholder="@UI.EnterFileName">
|
||||
<span class="glyphicon glyphicon-refresh glyphicon-spin form-control-feedback small-processing" aria-hidden="true"></span>
|
||||
<span id="inputProcessingStatus" class="sr-only">(processing)</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">@UI.Cancel</button>
|
||||
<a href="@Url.RouteUrl(FileSystemRouteNames.NewWebDavItem)" data-href="@Url.RouteUrl(FileSystemRouteNames.NewWebDavItem)" id="create-button" class="btn btn-success danger">@UI.Create</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
@using WebsitePanel.WebDavPortal.Resources
|
||||
@using WebsitePanel.WebDavPortal.UI.Routes
|
||||
@model WebsitePanel.WebDavPortal.Models.ModelForWebDav
|
||||
|
||||
|
||||
@Html.Partial("_ShowContentTopMenu", Model)
|
||||
|
||||
<div class="prevent-deselect container">
|
||||
<table id="search-items-table" class="display table table-striped table-bordered noselect" cellspacing="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>@UI.File</th>
|
||||
<th>@UI.Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@section scripts
|
||||
{
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
wsp.fileBrowser.setSettings({ deletionUrl: "@Url.RouteUrl(FileSystemRouteNames.DeleteFiles)" });
|
||||
wsp.fileBrowser.initSearchDataTable('#search-items-table', '@Url.RouteUrl(FileSystemRouteNames.ShowContentDetails)', '@Model.SearchValue');
|
||||
});
|
||||
</script>
|
||||
@Scripts.Render("~/bundles/appScripts-webdav")
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
@using WebsitePanel.WebDav.Core.Config
|
||||
@using WebsitePanel.WebDavPortal.FileOperations
|
||||
@using Ninject;
|
||||
@using WebsitePanel.WebDavPortal.Helpers
|
||||
@using WebsitePanel.WebDavPortal.Resources
|
||||
@using WebsitePanel.WebDavPortal.UI
|
||||
@using WebsitePanel.WebDavPortal.UI.Routes
|
||||
|
@ -63,7 +64,7 @@
|
|||
<p class="progress-text">@percent%</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>@Math.Round(Convert.ToDecimal(resource.ContentLength) / 1024, 2) / @Math.Round(Convert.ToDecimal(resource.AllocatedSpace) / 1024, 2) @UI.GigabyteShort</p>
|
||||
<p>@ViewDataHelper.BytesToSize(resource.ContentLength) / @ViewDataHelper.BytesToSize(resource.AllocatedSpace)</p>
|
||||
}
|
||||
|
||||
<div class="selected-element-overlay">
|
||||
|
|
|
@ -3,21 +3,6 @@
|
|||
@using WebsitePanel.WebDavPortal.UI.Routes
|
||||
@model WebsitePanel.WebDavPortal.Models.ModelForWebDav
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="search-block navbar-right">
|
||||
<div>
|
||||
@using (Html.BeginRouteForm(FileSystemRouteNames.ShowContentPath))
|
||||
{
|
||||
<label>
|
||||
@UI.Search:
|
||||
</label>
|
||||
@Html.TextBoxFor(x => x.SearchValue, new { @class = "form-control input-sm"})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
|
|
|
@ -15,8 +15,3 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
@section popups
|
||||
{
|
||||
@Html.Partial("_ProcessDialog", null)
|
||||
@Html.Partial("_ConfirmDialog")
|
||||
}
|
|
@ -10,42 +10,82 @@
|
|||
@if (Model != null)
|
||||
{
|
||||
string header = WspContext.User.OrganizationId;
|
||||
<a href="/@header/" class="processing-dialog">@header</a>
|
||||
string[] elements = Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0; i < elements.Length; i++)
|
||||
{
|
||||
<span style="top: 2px;"> / </span>
|
||||
<a href="@string.Concat("/" + header + "/", string.Join("/", elements.Take(i + 1)))" class="processing-dialog">@elements[i]</a>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="container file-actions-menu prevent-deselect">
|
||||
@if (Model.Permissions.HasFlag(WebDavPermissions.Write))
|
||||
{
|
||||
<div class="file-deletion navbar-left">
|
||||
<a id="delete-button" class="btn btn-danger btn-sm active" role="button"
|
||||
data-target="#confirm-dialog"
|
||||
data-target-positive-button-text="@UI.Delete"
|
||||
data-target-title-text="@UI.DeleteFileQuestion"
|
||||
data-target-content="@UI.DialogsContentConfrimFileDeletion">@UI.Delete</a>
|
||||
string[] elements = string.IsNullOrEmpty(Model.UrlSuffix)? new string[0]: Model.UrlSuffix.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
<div class="breadcrumb-wsp">
|
||||
@if (String.IsNullOrEmpty(Model.SearchValue))
|
||||
{
|
||||
<a href="/@header/" class="processing-dialog">@header</a>
|
||||
|
||||
for (int i = 0; i < elements.Length; i++)
|
||||
{
|
||||
<span style="top: 2px;"> / </span>
|
||||
<a href="@string.Concat("/" + header + "/", string.Join("/", elements.Take(i + 1)))" class="processing-dialog">@elements[i]</a>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<a href="@Url.RouteUrl(FileSystemRouteNames.ShowContentPath)" class="processing-dialog">@(elements.Any() ?elements.Last():WspContext.User.OrganizationId)</a>
|
||||
<span style="top: 2px;"> / </span>
|
||||
<span>@UI.SearchResults</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="search-block navbar-right">
|
||||
<div>
|
||||
@using (Html.BeginRouteForm(FileSystemRouteNames.SearchFiles, FormMethod.Post))
|
||||
{
|
||||
<div>
|
||||
<label>
|
||||
@UI.SearchDocuments:
|
||||
</label>
|
||||
@Html.TextBox("searchValue", Model.SearchValue, new { @class = "form-control input-sm" })
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="file-upload navbar-right">
|
||||
@if (Request.Browser.IsMobileDevice == false)
|
||||
</div>
|
||||
@if (string.IsNullOrEmpty(Model.SearchValue))
|
||||
{
|
||||
<div class="container file-actions-menu prevent-deselect">
|
||||
@if (Model.Permissions.HasFlag(WebDavPermissions.Write))
|
||||
{
|
||||
<div class="btn-toolbar change-view-block" role="toolbar">
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default" title="@UI.Details" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new { viewType = FolderViewTypes.BigIcons, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix })"><span class="glyphicon glyphicon-th-large" aria-hidden="true"></span></a>
|
||||
<a class="btn btn-default" title="@UI.Table" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new { viewType = FolderViewTypes.Table, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix })"><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
<div class="file-deletion navbar-left">
|
||||
<a id="delete-button" class="btn btn-danger btn-sm active" role="button"
|
||||
data-target="#confirm-dialog"
|
||||
data-target-positive-button-text="@UI.Delete"
|
||||
data-target-title-text="@UI.DeleteFileQuestion"
|
||||
data-target-content="@UI.DialogsContentConfrimFileDeletion">@UI.Delete</a>
|
||||
</div>
|
||||
<div class="dropdown create-new-item navbar-left">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
|
||||
@UI.Create
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" data-extension=".docx" data-target="_blank">@UI.WordDocument</a></li>
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" data-extension=".xlsx" data-target="_blank">@UI.ExcelWorkbook</a></li>
|
||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#" data-extension=".pptx" data-target="_blank">@UI.PowerPointPresentation</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.Permissions.HasFlag(WebDavPermissions.Write))
|
||||
{
|
||||
<a id="upload-button" class="btn btn-success btn-sm active" href="@Url.RouteUrl(FileSystemRouteNames.UploadFile)" role="button">@UI.FileUpload</a>
|
||||
}
|
||||
<div class="file-upload navbar-right">
|
||||
@if (Request.Browser.IsMobileDevice == false)
|
||||
{
|
||||
<div class="btn-toolbar change-view-block" role="toolbar">
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default" title="@UI.Details" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new {viewType = FolderViewTypes.BigIcons, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix})"><span class="glyphicon glyphicon-th-large" aria-hidden="true"></span></a>
|
||||
<a class="btn btn-default" title="@UI.Table" href="@Url.RouteUrl(FileSystemRouteNames.ChangeWebDavViewType, new {viewType = FolderViewTypes.Table, org = WspContext.User.OrganizationId, pathPart = Model.UrlSuffix})"><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.Permissions.HasFlag(WebDavPermissions.Write))
|
||||
{
|
||||
<a id="upload-button" class="btn btn-success btn-sm active" href="@Url.RouteUrl(FileSystemRouteNames.UploadFile)" role="button">@UI.FileUpload</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -47,6 +47,9 @@
|
|||
</div>
|
||||
|
||||
<div class="prevent-deselect">
|
||||
@Html.Partial("_ProcessDialog", null)
|
||||
@Html.Partial("_ConfirmDialog")
|
||||
|
||||
@RenderSection("popups", required: false)
|
||||
</div>
|
||||
|
||||
|
@ -62,9 +65,9 @@
|
|||
@Scripts.Render("~/bundles/authScripts")
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
StartAuthExpirationCheckTimer("@WebDavAppConfigManager.Instance.AuthTimeoutCookieName", "@Url.RouteUrl(AccountRouteNames.Logout)");
|
||||
});
|
||||
$(document).ready(function () {
|
||||
StartAuthExpirationCheckTimer("@WebDavAppConfigManager.Instance.AuthTimeoutCookieName", "@FormsAuthentication.FormsCookieName", "@Url.RouteUrl(AccountRouteNames.Logout)");
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
<add key="ResourseRenderCountSessionKey" value="ResourseRenderCount" />
|
||||
<add key="ItemIdSessionKey" value="ItemId" />
|
||||
<add key="UserGroupsKey" value="UserGroups" />
|
||||
<add key="OwaEditFoldersSession" value="OwaEditFolders"/>
|
||||
</sessionKeys>
|
||||
<fileIcons defaultPath="~/Content/Images/other-icon.png" folderPath="~/Content/Images/folder_100x100.png">
|
||||
<add extension=".txt" path="~/Content/Images/txt-icon.png" />
|
||||
|
@ -84,13 +85,13 @@
|
|||
<add browser="InternetExplorer;IE" version="8" />
|
||||
<add browser="Safari" version="4" />
|
||||
</owaSupportedBrowsers>
|
||||
<officeOnline isEnabled="True" url="https://vir-owa.virtuworks.net" cobaltFileTtl="1">
|
||||
<add extension=".doc" OwaView="wv/wordviewerframe.aspx?" OwaEditor="wv/wordviewerframe.aspx?" OwaMobileView="wv/mWord.aspx?wdMobileHost=3&"/>
|
||||
<add extension=".docx" OwaView="wv/wordviewerframe.aspx?" OwaEditor="we/wordeditorframe.aspx?" OwaMobileView="wv/mWord.aspx?wdMobileHost=3&"/>
|
||||
<add extension=".xls" OwaView="x/_layouts/xlviewerinternal.aspx?" OwaEditor="x/_layouts/xlviewerinternal.aspx?edit=1&" OwaMobileView="x/_layouts/mobile/mXL.aspx?wdMobileHost=3&"/>
|
||||
<add extension=".xlsx" OwaView="x/_layouts/xlviewerinternal.aspx?" OwaEditor="x/_layouts/xlviewerinternal.aspx?edit=1&" OwaMobileView="x/_layouts/mobile/mXL.aspx?wdMobileHost=3&" />
|
||||
<add extension=".ppt" OwaView="p/PowerPointFrame.aspx?" OwaEditor="p/PowerPointFrame.aspx?" OwaMobileView="p/mPPT.aspx?wdMobileHost=3&"/>
|
||||
<add extension=".pptx" OwaView="p/PowerPointFrame.aspx?" OwaEditor="p/PowerPointFrame.aspx?PowerPointView=EditView&" OwaMobileView="p/mPPT.aspx?wdMobileHost=3&"/>
|
||||
<officeOnline isEnabled="True" url="https://vir-owa.virtuworks.net" cobaltFileTtl="1" cobaltNewFilePath="~/Content/OwaFiles/New">
|
||||
<add extension=".doc" OwaView="wv/wordviewerframe.aspx?" OwaEditor="wv/wordviewerframe.aspx?" OwaMobileView="wv/mWord.aspx?wdMobileHost=3&" OwaNewFileView="we/wordeditorframe.aspx?new=1&"/>
|
||||
<add extension=".docx" OwaView="wv/wordviewerframe.aspx?" OwaEditor="we/wordeditorframe.aspx?" OwaMobileView="wv/mWord.aspx?wdMobileHost=3&" OwaNewFileView="we/wordeditorframe.aspx?new=1&"/>
|
||||
<add extension=".xls" OwaView="x/_layouts/xlviewerinternal.aspx?" OwaEditor="x/_layouts/xlviewerinternal.aspx?edit=1&" OwaMobileView="x/_layouts/mobile/mXL.aspx?wdMobileHost=3&" OwaNewFileView="x/_layouts/xlviewerinternal.aspx?new=1&"/>
|
||||
<add extension=".xlsx" OwaView="x/_layouts/xlviewerinternal.aspx?" OwaEditor="x/_layouts/xlviewerinternal.aspx?edit=1&" OwaMobileView="x/_layouts/mobile/mXL.aspx?wdMobileHost=3&" OwaNewFileView="x/_layouts/xlviewerinternal.aspx?edit=1&"/>
|
||||
<add extension=".ppt" OwaView="p/PowerPointFrame.aspx?" OwaEditor="p/PowerPointFrame.aspx?" OwaMobileView="p/mPPT.aspx?wdMobileHost=3&" OwaNewFileView="p/PowerPointFrame.aspx?PowerPointView=EditView&New=1&"/>
|
||||
<add extension=".pptx" OwaView="p/PowerPointFrame.aspx?" OwaEditor="p/PowerPointFrame.aspx?PowerPointView=EditView&" OwaMobileView="p/mPPT.aspx?wdMobileHost=3&" OwaNewFileView="p/PowerPointFrame.aspx?PowerPointView=EditView&New=1&"/>
|
||||
</officeOnline>
|
||||
<typeOpener>
|
||||
<add extension=".jpg" mimeType="image/jpeg" isTargetBlank="true" />
|
||||
|
|
|
@ -165,6 +165,7 @@
|
|||
<Compile Include="Configurations\ActionSelectors\OwaActionSelector.cs" />
|
||||
<Compile Include="Configurations\Constraints\OrganizationRouteConstraint.cs" />
|
||||
<Compile Include="Configurations\ControllerConfigurations\OwaControllerConfiguration.cs" />
|
||||
<Compile Include="Constants\Formtas.cs" />
|
||||
<Compile Include="Controllers\AccountController.cs" />
|
||||
<Compile Include="Controllers\ErrorController.cs" />
|
||||
<Compile Include="Controllers\FileSystemController.cs" />
|
||||
|
@ -183,6 +184,7 @@
|
|||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helpers\DataTableHelper.cs" />
|
||||
<Compile Include="Helpers\ViewDataHelper.cs" />
|
||||
<Compile Include="HttpHandlers\AccessTokenHandler.cs" />
|
||||
<Compile Include="HttpHandlers\FileTransferRequestHandler.cs" />
|
||||
<Compile Include="Mapping\AutoMapperPortalConfiguration.cs" />
|
||||
|
@ -369,6 +371,8 @@
|
|||
<Content Include="Content\bootstrap.css.map" />
|
||||
<Content Include="Content\DataTables-1.10.4\css\dataTables.responsive.scss" />
|
||||
<Content Include="Content\DataTables-1.10.4\css\dataTables.jqueryui.scss" />
|
||||
<Content Include="Content\OwaFiles\Empty.docx" />
|
||||
<Content Include="Content\OwaFiles\Empty.pptx" />
|
||||
<None Include="Scripts\jquery-2.1.1.intellisense.js" />
|
||||
<Content Include="Scripts\appScripts\authentication.js" />
|
||||
<Content Include="Scripts\appScripts\dialogs.js" />
|
||||
|
@ -376,6 +380,7 @@
|
|||
<Content Include="Scripts\appScripts\messages.js" />
|
||||
<Content Include="Scripts\appScripts\recalculateResourseHeight.js" />
|
||||
<Content Include="Scripts\appScripts\uploadingData2.js" />
|
||||
<Content Include="Scripts\appScripts\wsp-webdav.js" />
|
||||
<Content Include="Scripts\appScripts\wsp.js" />
|
||||
<Content Include="Scripts\bootstrap.js" />
|
||||
<Content Include="Scripts\bootstrap.min.js" />
|
||||
|
@ -459,6 +464,7 @@
|
|||
<Content Include="Views\FileSystem\_ShowContentTopMenu.cshtml" />
|
||||
<Content Include="Views\FileSystem\_ShowContentBigIcons.cshtml" />
|
||||
<Content Include="Views\FileSystem\UploadFiles.cshtml" />
|
||||
<Content Include="Views\FileSystem\ShowContentSearchResultTable.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\FileSystem\Enums\" />
|
||||
|
|
|
@ -135,6 +135,7 @@
|
|||
<Control key="enterprisestorage_folders" />
|
||||
<Control key="create_enterprisestorage_folder" general_key="enterprisestorage_folders" />
|
||||
<Control key="enterprisestorage_folder_settings" general_key="enterprisestorage_folders" />
|
||||
<Control key="enterprisestorage_folder_settings_general" general_key="enterprisestorage_folders" />
|
||||
|
||||
<Control key="enterprisestorage_drive_maps" />
|
||||
<Control key="create_enterprisestorage_drive_map" general_key="enterprisestorage_drive_maps" />
|
||||
|
|
|
@ -564,6 +564,9 @@
|
|||
<Control key="enterprisestorage_folders" src="WebsitePanel/ExchangeServer/EnterpriseStorageFolders.ascx" title="Enterprise Storage Folders" type="View" />
|
||||
<Control key="create_enterprisestorage_folder" src="WebsitePanel/ExchangeServer/EnterpriseStorageCreateFolder.ascx" title="Create New ES Folder" type="View" />
|
||||
<Control key="enterprisestorage_folder_settings" src="WebsitePanel/ExchangeServer/EnterpriseStorageFolderGeneralSettings.ascx" title="Edit ES Folder" type="View" />
|
||||
<Control key="enterprisestorage_folder_settings_folder_permissions" src="WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsFolderPermissions.ascx" title="Edit ES Folder" type="View" />
|
||||
<Control key="enterprisestorage_folder_settings_owa_editing" src="WebsitePanel/ExchangeServer/EnterpriseStorageFolderSettingsOwaEditing.ascx" title="Edit ES Folder" type="View" />
|
||||
|
||||
<Control key="enterprisestorage_drive_maps" src="WebsitePanel/ExchangeServer/EnterpriseStorageDriveMaps.ascx" title="Enterprise Storage Drive Maps" type="View" />
|
||||
<Control key="create_enterprisestorage_drive_map" src="WebsitePanel/ExchangeServer/EnterpriseStorageCreateDriveMap.ascx" title="Create New ES Drive Map" type="View" />
|
||||
|
||||
|
|
|
@ -5465,7 +5465,7 @@
|
|||
<value>ESS licenses per organization</value>
|
||||
</data>
|
||||
<data name="ResourceGroup.Hosted CRM2013" xml:space="preserve">
|
||||
<value>Hosted CRM 2013</value>
|
||||
<value>Hosted CRM 2013/2015</value>
|
||||
</data>
|
||||
<data name="HostedCRM.USER_QUOTA_HAS_BEEN_REACHED2013_0" xml:space="preserve">
|
||||
<value>CRM users quota (Professional license) has been reached.</value>
|
||||
|
|
|
@ -54,9 +54,9 @@ legend {font-weight:700; color:#428bca; padding:0 4px;}
|
|||
legend span.NormalBold {display:inline;}
|
||||
.Tabs {width:100%;}
|
||||
.Separator {display:none;}
|
||||
.Tabs span {display:table; table-layout:fixed; width:100%; table-layout:fixed;}
|
||||
.Tabs span {display:table; table-layout:fixed; min-width:100%; table-layout:fixed;}
|
||||
.Tabs span span {display:table-cell; width:15%; text-align:center; padding:0;}
|
||||
.Tabs a {display:block; padding:10px 0; text-decoration:none; border-bottom:1px solid #ddd;}
|
||||
.Tabs a {display:block; padding:10px 5px; text-decoration:none; border-bottom:1px solid #ddd;}
|
||||
.Tabs a:Hover {background:#eee; text-decoration:none;}
|
||||
.Tabs a.ActiveTab {border:1px solid #ddd; border-bottom:none; color:#555; margin-bottom:-1px;}
|
||||
.Tabs a.ActiveTab:hover {background:none;}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue