merge
This commit is contained in:
commit
8d06b1c1cf
31 changed files with 8030 additions and 679 deletions
|
@ -29,19 +29,18 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:2.0.50727.5456
|
// Runtime Version:2.0.50727.5466
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
using WebsitePanel.Providers.HeliconZoo;
|
||||||
|
|
||||||
//
|
//
|
||||||
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
|
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
|
||||||
//
|
//
|
||||||
|
|
||||||
using WebsitePanel.Providers.HeliconZoo;
|
|
||||||
|
|
||||||
namespace WebsitePanel.EnterpriseServer {
|
namespace WebsitePanel.EnterpriseServer {
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using System.Web.Services;
|
using System.Web.Services;
|
||||||
|
@ -72,9 +71,13 @@ namespace WebsitePanel.EnterpriseServer {
|
||||||
|
|
||||||
private System.Threading.SendOrPostCallback SetEnabledEnginesForSiteOperationCompleted;
|
private System.Threading.SendOrPostCallback SetEnabledEnginesForSiteOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback IsWebCosoleEnabledOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback SetWebCosoleEnabledOperationCompleted;
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public esHeliconZoo() {
|
public esHeliconZoo() {
|
||||||
this.Url = "http://localhost:9005/esHeliconZoo.asmx";
|
this.Url = "http://localhost:9002/esHeliconZoo.asmx";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
|
@ -98,6 +101,12 @@ namespace WebsitePanel.EnterpriseServer {
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public event SetEnabledEnginesForSiteCompletedEventHandler SetEnabledEnginesForSiteCompleted;
|
public event SetEnabledEnginesForSiteCompletedEventHandler SetEnabledEnginesForSiteCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event IsWebCosoleEnabledCompletedEventHandler IsWebCosoleEnabledCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event SetWebCosoleEnabledCompletedEventHandler SetWebCosoleEnabledCompleted;
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetEngines", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetEngines", 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 HeliconZooEngine[] GetEngines(int serviceId) {
|
public HeliconZooEngine[] GetEngines(int serviceId) {
|
||||||
|
@ -395,6 +404,89 @@ namespace WebsitePanel.EnterpriseServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/IsWebCosoleEnabled", 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 bool IsWebCosoleEnabled(int serviceId) {
|
||||||
|
object[] results = this.Invoke("IsWebCosoleEnabled", new object[] {
|
||||||
|
serviceId});
|
||||||
|
return ((bool)(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginIsWebCosoleEnabled(int serviceId, System.AsyncCallback callback, object asyncState) {
|
||||||
|
return this.BeginInvoke("IsWebCosoleEnabled", new object[] {
|
||||||
|
serviceId}, callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public bool EndIsWebCosoleEnabled(System.IAsyncResult asyncResult) {
|
||||||
|
object[] results = this.EndInvoke(asyncResult);
|
||||||
|
return ((bool)(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void IsWebCosoleEnabledAsync(int serviceId) {
|
||||||
|
this.IsWebCosoleEnabledAsync(serviceId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void IsWebCosoleEnabledAsync(int serviceId, object userState) {
|
||||||
|
if ((this.IsWebCosoleEnabledOperationCompleted == null)) {
|
||||||
|
this.IsWebCosoleEnabledOperationCompleted = new System.Threading.SendOrPostCallback(this.OnIsWebCosoleEnabledOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("IsWebCosoleEnabled", new object[] {
|
||||||
|
serviceId}, this.IsWebCosoleEnabledOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnIsWebCosoleEnabledOperationCompleted(object arg) {
|
||||||
|
if ((this.IsWebCosoleEnabledCompleted != null)) {
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.IsWebCosoleEnabledCompleted(this, new IsWebCosoleEnabledCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetWebCosoleEnabled", 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 SetWebCosoleEnabled(int serviceId, bool enabled) {
|
||||||
|
this.Invoke("SetWebCosoleEnabled", new object[] {
|
||||||
|
serviceId,
|
||||||
|
enabled});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginSetWebCosoleEnabled(int serviceId, bool enabled, System.AsyncCallback callback, object asyncState) {
|
||||||
|
return this.BeginInvoke("SetWebCosoleEnabled", new object[] {
|
||||||
|
serviceId,
|
||||||
|
enabled}, callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void EndSetWebCosoleEnabled(System.IAsyncResult asyncResult) {
|
||||||
|
this.EndInvoke(asyncResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void SetWebCosoleEnabledAsync(int serviceId, bool enabled) {
|
||||||
|
this.SetWebCosoleEnabledAsync(serviceId, enabled, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void SetWebCosoleEnabledAsync(int serviceId, bool enabled, object userState) {
|
||||||
|
if ((this.SetWebCosoleEnabledOperationCompleted == null)) {
|
||||||
|
this.SetWebCosoleEnabledOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetWebCosoleEnabledOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("SetWebCosoleEnabled", new object[] {
|
||||||
|
serviceId,
|
||||||
|
enabled}, this.SetWebCosoleEnabledOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSetWebCosoleEnabledOperationCompleted(object arg) {
|
||||||
|
if ((this.SetWebCosoleEnabledCompleted != null)) {
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.SetWebCosoleEnabledCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public new void CancelAsync(object userState) {
|
public new void CancelAsync(object userState) {
|
||||||
base.CancelAsync(userState);
|
base.CancelAsync(userState);
|
||||||
|
@ -516,4 +608,34 @@ namespace WebsitePanel.EnterpriseServer {
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
public delegate void SetEnabledEnginesForSiteCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
public delegate void SetEnabledEnginesForSiteCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
|
public delegate void IsWebCosoleEnabledCompletedEventHandler(object sender, IsWebCosoleEnabledCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
|
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||||
|
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||||
|
public partial class IsWebCosoleEnabledCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||||
|
|
||||||
|
private object[] results;
|
||||||
|
|
||||||
|
internal IsWebCosoleEnabledCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||||
|
base(exception, cancelled, userState) {
|
||||||
|
this.results = results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public bool Result {
|
||||||
|
get {
|
||||||
|
this.RaiseExceptionIfNecessary();
|
||||||
|
return ((bool)(this.results[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
|
public delegate void SetWebCosoleEnabledCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -85,6 +85,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
allowedEngines.Add( new ShortHeliconZooEngine(){
|
allowedEngines.Add( new ShortHeliconZooEngine(){
|
||||||
Name = (string)reader["QuotaName"],
|
Name = (string)reader["QuotaName"],
|
||||||
DisplayName= (string)reader["QuotaDescription"],
|
DisplayName= (string)reader["QuotaDescription"],
|
||||||
|
Enabled = true
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +122,21 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static bool IsWebCosoleEnabled(int serviceId)
|
||||||
|
{
|
||||||
|
HeliconZoo zooServer = new HeliconZoo();
|
||||||
|
ServiceProviderProxy.Init(zooServer, serviceId);
|
||||||
|
return zooServer.IsWebCosoleEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetWebCosoleEnabled(int serviceId, bool enabled)
|
||||||
|
{
|
||||||
|
HeliconZoo zooServer = new HeliconZoo();
|
||||||
|
ServiceProviderProxy.Init(zooServer, serviceId);
|
||||||
|
zooServer.SetWebCosoleEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region private helpers
|
#region private helpers
|
||||||
private static void UpdateQuotas(int serviceId, HeliconZooEngine[] userEngines)
|
private static void UpdateQuotas(int serviceId, HeliconZooEngine[] userEngines)
|
||||||
{
|
{
|
||||||
|
@ -183,7 +200,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
DataProvider.AddHeliconZooQuota(groupId, quotaId,
|
DataProvider.AddHeliconZooQuota(groupId, quotaId,
|
||||||
HeliconZooQuotaPrefix+engine.name,
|
HeliconZooQuotaPrefix+engine.name,
|
||||||
engine.displayName,
|
engine.displayName,
|
||||||
order++);
|
existingQuotas.Count + order++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,822 @@
|
||||||
|
// Copyright (c) 2012, Outercurve Foundation.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
// list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from this
|
||||||
|
// software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Data;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
using WebsitePanel.Server;
|
||||||
|
using WebsitePanel.Providers;
|
||||||
|
using WebsitePanel.Providers.OS;
|
||||||
|
using OS = WebsitePanel.Providers.OS;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
|
||||||
|
namespace WebsitePanel.EnterpriseServer
|
||||||
|
{
|
||||||
|
public class OperatingSystemController : IImportController, IBackupController
|
||||||
|
{
|
||||||
|
private const int FILE_BUFFER_LENGTH = 5000000; // ~5MB
|
||||||
|
|
||||||
|
private static OS.OperatingSystem GetOS(int serviceId)
|
||||||
|
{
|
||||||
|
OS.OperatingSystem os = new OS.OperatingSystem();
|
||||||
|
ServiceProviderProxy.Init(os, serviceId);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region ODBC DSNs
|
||||||
|
public static DataSet GetRawOdbcSourcesPaged(int packageId,
|
||||||
|
string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
||||||
|
{
|
||||||
|
return PackageController.GetRawPackageItemsPaged(packageId, ResourceGroups.Os, typeof(SystemDSN),
|
||||||
|
true, filterColumn, filterValue, sortColumn, startRow, maximumRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<SystemDSN> GetOdbcSources(int packageId, bool recursive)
|
||||||
|
{
|
||||||
|
List<ServiceProviderItem> items = PackageController.GetPackageItemsByType(
|
||||||
|
packageId, ResourceGroups.Os, typeof(SystemDSN), recursive);
|
||||||
|
|
||||||
|
return items.ConvertAll<SystemDSN>(
|
||||||
|
new Converter<ServiceProviderItem, SystemDSN>(ConvertItemToSystemDSN));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SystemDSN ConvertItemToSystemDSN(ServiceProviderItem item)
|
||||||
|
{
|
||||||
|
return (SystemDSN)item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string[] GetInstalledOdbcDrivers(int packageId)
|
||||||
|
{
|
||||||
|
// load service item
|
||||||
|
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os);
|
||||||
|
OS.OperatingSystem os = GetOS(serviceId);
|
||||||
|
return os.GetInstalledOdbcDrivers();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SystemDSN GetOdbcSource(int itemId)
|
||||||
|
{
|
||||||
|
// load meta item
|
||||||
|
SystemDSN item = (SystemDSN)PackageController.GetPackageItem(itemId);
|
||||||
|
|
||||||
|
// load service item
|
||||||
|
OS.OperatingSystem os = GetOS(item.ServiceId);
|
||||||
|
SystemDSN dsn = os.GetDSN(item.Name);
|
||||||
|
|
||||||
|
// add common properties
|
||||||
|
dsn.Id = item.Id;
|
||||||
|
dsn.PackageId = item.PackageId;
|
||||||
|
dsn.ServiceId = item.ServiceId;
|
||||||
|
|
||||||
|
if(dsn.Driver == "MsAccess" || dsn.Driver == "Excel" || dsn.Driver == "Text")
|
||||||
|
dsn.DatabaseName = FilesController.GetVirtualPackagePath(item.PackageId, dsn.DatabaseName);
|
||||||
|
|
||||||
|
return dsn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int AddOdbcSource(SystemDSN item)
|
||||||
|
{
|
||||||
|
// check account
|
||||||
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||||
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
|
// check package
|
||||||
|
int packageCheck = SecurityContext.CheckPackage(item.PackageId, DemandPackage.IsActive);
|
||||||
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
|
// check quota
|
||||||
|
QuotaValueInfo quota = PackageController.GetPackageQuota(item.PackageId, Quotas.OS_ODBC);
|
||||||
|
if (quota.QuotaExhausted)
|
||||||
|
return BusinessErrorCodes.ERROR_OS_DSN_RESOURCE_QUOTA_LIMIT;
|
||||||
|
|
||||||
|
// check if mail resource is available
|
||||||
|
int serviceId = PackageController.GetPackageServiceId(item.PackageId, ResourceGroups.Os);
|
||||||
|
if (serviceId == 0)
|
||||||
|
return BusinessErrorCodes.ERROR_OS_RESOURCE_UNAVAILABLE;
|
||||||
|
|
||||||
|
// check package items
|
||||||
|
if (PackageController.GetPackageItemByName(item.PackageId, item.Name, typeof(SystemDSN)) != null)
|
||||||
|
return BusinessErrorCodes.ERROR_OS_DSN_PACKAGE_ITEM_EXISTS;
|
||||||
|
|
||||||
|
// place log record
|
||||||
|
TaskManager.StartTask("ODBC_DSN", "ADD", item.Name);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// check service items
|
||||||
|
OS.OperatingSystem os = GetOS(serviceId);
|
||||||
|
if (os.GetDSN(item.Name) != null)
|
||||||
|
return BusinessErrorCodes.ERROR_OS_DSN_SERVICE_ITEM_EXISTS;
|
||||||
|
|
||||||
|
string[] dbNameParts = item.DatabaseName.Split('|');
|
||||||
|
string groupName = null;
|
||||||
|
if (dbNameParts.Length > 1)
|
||||||
|
{
|
||||||
|
item.DatabaseName = dbNameParts[0];
|
||||||
|
groupName = dbNameParts[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// get database server address
|
||||||
|
item.DatabaseServer = GetDatabaseServerName(groupName, item.PackageId);
|
||||||
|
|
||||||
|
if (item.Driver == "MsAccess" || item.Driver == "Excel" || item.Driver == "Text")
|
||||||
|
item.DatabaseName = FilesController.GetFullPackagePath(item.PackageId, item.DatabaseName);
|
||||||
|
|
||||||
|
// add service item
|
||||||
|
os.CreateDSN(item);
|
||||||
|
|
||||||
|
// save item
|
||||||
|
item.DatabasePassword = CryptoUtils.Encrypt(item.DatabasePassword);
|
||||||
|
item.ServiceId = serviceId;
|
||||||
|
int itemId = PackageController.AddPackageItem(item);
|
||||||
|
|
||||||
|
TaskManager.ItemId = itemId;
|
||||||
|
|
||||||
|
return itemId;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw TaskManager.WriteError(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
TaskManager.CompleteTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int UpdateOdbcSource(SystemDSN item)
|
||||||
|
{
|
||||||
|
// check account
|
||||||
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||||
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
|
// load original meta item
|
||||||
|
SystemDSN origItem = (SystemDSN)PackageController.GetPackageItem(item.Id);
|
||||||
|
if (origItem == null)
|
||||||
|
return BusinessErrorCodes.ERROR_OS_DSN_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
|
// check package
|
||||||
|
int packageCheck = SecurityContext.CheckPackage(origItem.PackageId, DemandPackage.IsActive);
|
||||||
|
if (packageCheck < 0) return packageCheck;
|
||||||
|
|
||||||
|
// place log record
|
||||||
|
TaskManager.StartTask("ODBC_DSN", "UPDATE", origItem.Name);
|
||||||
|
TaskManager.ItemId = item.Id;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// get service
|
||||||
|
OS.OperatingSystem os = GetOS(origItem.ServiceId);
|
||||||
|
|
||||||
|
// password
|
||||||
|
item.Driver = origItem.Driver;
|
||||||
|
item.Name = origItem.Name;
|
||||||
|
|
||||||
|
if (item.DatabasePassword == "")
|
||||||
|
item.DatabasePassword = CryptoUtils.Decrypt(origItem.DatabasePassword);
|
||||||
|
|
||||||
|
string[] dbNameParts = item.DatabaseName.Split('|');
|
||||||
|
string groupName = null;
|
||||||
|
if (dbNameParts.Length > 1)
|
||||||
|
{
|
||||||
|
item.DatabaseName = dbNameParts[0];
|
||||||
|
groupName = dbNameParts[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// get database server address
|
||||||
|
item.DatabaseServer = GetDatabaseServerName(groupName, item.PackageId);
|
||||||
|
|
||||||
|
if (item.Driver == "MsAccess" || item.Driver == "Excel" || item.Driver == "Text")
|
||||||
|
item.DatabaseName = FilesController.GetFullPackagePath(origItem.PackageId, item.DatabaseName);
|
||||||
|
|
||||||
|
// update service item
|
||||||
|
os.UpdateDSN(item);
|
||||||
|
|
||||||
|
// update meta item
|
||||||
|
if (item.DatabasePassword != "")
|
||||||
|
{
|
||||||
|
item.DatabasePassword = CryptoUtils.Encrypt(item.DatabasePassword);
|
||||||
|
PackageController.UpdatePackageItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw TaskManager.WriteError(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
TaskManager.CompleteTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetDatabaseServerName(string groupName, int packageId)
|
||||||
|
{
|
||||||
|
int sqlServiceId = PackageController.GetPackageServiceId(packageId, groupName);
|
||||||
|
if (sqlServiceId > 0)
|
||||||
|
{
|
||||||
|
StringDictionary sqlSettings = ServerController.GetServiceSettings(sqlServiceId);
|
||||||
|
return sqlSettings["ExternalAddress"];
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int DeleteOdbcSource(int itemId)
|
||||||
|
{
|
||||||
|
// check account
|
||||||
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo);
|
||||||
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
|
// load original meta item
|
||||||
|
SystemDSN origItem = (SystemDSN)PackageController.GetPackageItem(itemId);
|
||||||
|
if (origItem == null)
|
||||||
|
return BusinessErrorCodes.ERROR_OS_DSN_PACKAGE_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
|
// place log record
|
||||||
|
TaskManager.StartTask("ODBC_DSN", "DELETE", origItem.Name);
|
||||||
|
TaskManager.ItemId = itemId;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// get service
|
||||||
|
OS.OperatingSystem os = GetOS(origItem.ServiceId);
|
||||||
|
|
||||||
|
// delete service item
|
||||||
|
os.DeleteDSN(origItem.Name);
|
||||||
|
|
||||||
|
// delete meta item
|
||||||
|
PackageController.DeletePackageItem(origItem.Id);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw TaskManager.WriteError(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
TaskManager.CompleteTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private static WindowsServer GetServerService(int serverId)
|
||||||
|
{
|
||||||
|
WindowsServer winServer = new WindowsServer();
|
||||||
|
ServiceProviderProxy.ServerInit(winServer, serverId);
|
||||||
|
return winServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Terminal Services Sessions
|
||||||
|
public static TerminalSession[] GetTerminalServicesSessions(int serverId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetTerminalServicesSessions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int CloseTerminalServicesSession(int serverId, int sessionId)
|
||||||
|
{
|
||||||
|
// check account
|
||||||
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsAdmin
|
||||||
|
| DemandAccount.IsActive);
|
||||||
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
|
// load server info
|
||||||
|
ServerInfo server = ServerController.GetServerById(serverId);
|
||||||
|
|
||||||
|
// place log record
|
||||||
|
TaskManager.StartTask("SERVER", "RESET_TERMINAL_SESSION", sessionId);
|
||||||
|
TaskManager.ItemId = serverId;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetServerService(serverId).CloseTerminalServicesSession(sessionId);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw TaskManager.WriteError(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
TaskManager.CompleteTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Windows Processes
|
||||||
|
public static WindowsProcess[] GetWindowsProcesses(int serverId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetWindowsProcesses();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int TerminateWindowsProcess(int serverId, int pid)
|
||||||
|
{
|
||||||
|
// check account
|
||||||
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsAdmin
|
||||||
|
| DemandAccount.IsActive);
|
||||||
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
|
// load server info
|
||||||
|
ServerInfo server = ServerController.GetServerById(serverId);
|
||||||
|
|
||||||
|
// place log record
|
||||||
|
TaskManager.StartTask("SERVER", "TERMINATE_SYSTEM_PROCESS", pid);
|
||||||
|
TaskManager.ItemId = serverId;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetServerService(serverId).TerminateWindowsProcess(pid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw TaskManager.WriteError(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
TaskManager.CompleteTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Windows Services
|
||||||
|
public static WindowsService[] GetWindowsServices(int serverId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetWindowsServices();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int ChangeWindowsServiceStatus(int serverId, string id, WindowsServiceStatus status)
|
||||||
|
{
|
||||||
|
// check account
|
||||||
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsAdmin
|
||||||
|
| DemandAccount.IsActive);
|
||||||
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
|
// load server info
|
||||||
|
ServerInfo server = ServerController.GetServerById(serverId);
|
||||||
|
|
||||||
|
// place log record
|
||||||
|
TaskManager.StartTask("SERVER", "CHANGE_WINDOWS_SERVICE_STATUS", id);
|
||||||
|
TaskManager.ItemId = serverId;
|
||||||
|
TaskManager.WriteParameter("New Status", status);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetServerService(serverId).ChangeWindowsServiceStatus(id, status);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw TaskManager.WriteError(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
TaskManager.CompleteTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check If FSRM Role services were installed
|
||||||
|
public static bool CheckFileServicesInstallation(int serviceId)
|
||||||
|
{
|
||||||
|
OS.OperatingSystem os = GetOS(serviceId);
|
||||||
|
return os.CheckFileServicesInstallation();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Web Platform Installer
|
||||||
|
|
||||||
|
public static bool CheckLoadUserProfile(int serverId)
|
||||||
|
{
|
||||||
|
int serviceId = getWebServiceId(serverId);
|
||||||
|
if (serviceId != -1)
|
||||||
|
{
|
||||||
|
return WebServerController.GetWebServer(serviceId).CheckLoadUserProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getWebServiceId(int serverId)
|
||||||
|
{
|
||||||
|
DataSet dsServices = ServerController.GetRawServicesByServerId(serverId);
|
||||||
|
|
||||||
|
int webGroup = -1;
|
||||||
|
|
||||||
|
if (dsServices.Tables.Count < 1) return -1;
|
||||||
|
|
||||||
|
foreach (DataRow r in dsServices.Tables[0].Rows)
|
||||||
|
{
|
||||||
|
if (r["GroupName"].ToString() == "Web")
|
||||||
|
{
|
||||||
|
webGroup = (int)r["GroupID"];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (webGroup == -1) return -1;
|
||||||
|
|
||||||
|
foreach (DataRow r in dsServices.Tables[1].Rows)
|
||||||
|
{
|
||||||
|
if ((int)r["GroupID"] == webGroup)
|
||||||
|
{
|
||||||
|
return (int)r["ServiceID"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void EnableLoadUserProfile(int serverId)
|
||||||
|
{
|
||||||
|
int serviceId = getWebServiceId(serverId);
|
||||||
|
if (serviceId != -1)
|
||||||
|
{
|
||||||
|
WebServerController.GetWebServer(serviceId).EnableLoadUserProfile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void InitWPIFeeds(int serverId, string feedUrls)
|
||||||
|
{
|
||||||
|
GetServerService(serverId).InitWPIFeeds(feedUrls);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WPITab[] GetWPITabs(int serverId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetWPITabs();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WPIKeyword[] GetWPIKeywords(int serverId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetWPIKeywords();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WPIProduct[] GetWPIProducts(int serverId, string tabId, string keywordId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetWPIProducts(tabId, keywordId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WPIProduct[] GetWPIProductsFiltered(int serverId, string keywordId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetWPIProductsFiltered(keywordId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WPIProduct GetWPIProductById(int serverId, string productdId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetWPIProductById(productdId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static WPIProduct[] GetWPIProductsWithDependencies(int serverId, string[] products)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetWPIProductsWithDependencies(products);
|
||||||
|
}
|
||||||
|
public static void InstallWPIProducts(int serverId, string[] products)
|
||||||
|
{
|
||||||
|
GetServerService(serverId).InstallWPIProducts(products);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CancelInstallWPIProducts(int serverId)
|
||||||
|
{
|
||||||
|
GetServerService(serverId).CancelInstallWPIProducts();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetWPIStatus(int serverId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetWPIStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string WpiGetLogFileDirectory(int serverId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).WpiGetLogFileDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SettingPair[] WpiGetLogsInDirectory(int serverId, string Path)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).WpiGetLogsInDirectory(Path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Event Viewer
|
||||||
|
public static string[] GetLogNames(int serverId)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetLogNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SystemLogEntry[] GetLogEntries(int serverId, string logName)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetLogEntries(logName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SystemLogEntriesPaged GetLogEntriesPaged(int serverId, string logName, int startRow, int maximumRows)
|
||||||
|
{
|
||||||
|
return GetServerService(serverId).GetLogEntriesPaged(logName, startRow, maximumRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int ClearLog(int serverId, string logName)
|
||||||
|
{
|
||||||
|
// check account
|
||||||
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsAdmin
|
||||||
|
| DemandAccount.IsActive);
|
||||||
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
|
TaskManager.StartTask("SERVER", "CLEAR_EVENT_LOG", logName);
|
||||||
|
TaskManager.ItemId = serverId;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetServerService(serverId).ClearLog(logName);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw TaskManager.WriteError(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
TaskManager.CompleteTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Server Reboot
|
||||||
|
public static int RebootSystem(int serverId)
|
||||||
|
{
|
||||||
|
// check account
|
||||||
|
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsAdmin
|
||||||
|
| DemandAccount.IsActive);
|
||||||
|
if (accountCheck < 0) return accountCheck;
|
||||||
|
|
||||||
|
// load server info
|
||||||
|
ServerInfo server = ServerController.GetServerById(serverId);
|
||||||
|
|
||||||
|
// place log record
|
||||||
|
TaskManager.StartTask("SERVER", "REBOOT");
|
||||||
|
TaskManager.ItemId = serverId;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetServerService(serverId).RebootSystem();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw TaskManager.WriteError(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
TaskManager.CompleteTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IImportController Members
|
||||||
|
|
||||||
|
public List<string> GetImportableItems(int packageId, int itemTypeId, Type itemType,
|
||||||
|
ResourceGroupInfo group)
|
||||||
|
{
|
||||||
|
List<string> items = new List<string>();
|
||||||
|
|
||||||
|
// get service id
|
||||||
|
int serviceId = PackageController.GetPackageServiceId(packageId, group.GroupName);
|
||||||
|
if (serviceId == 0)
|
||||||
|
return items;
|
||||||
|
|
||||||
|
OS.OperatingSystem os = GetOS(serviceId);
|
||||||
|
if (itemType == typeof(SystemDSN))
|
||||||
|
items.AddRange(os.GetDSNNames());
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ImportItem(int packageId, int itemTypeId, Type itemType,
|
||||||
|
ResourceGroupInfo group, string itemName)
|
||||||
|
{
|
||||||
|
// get service id
|
||||||
|
int serviceId = PackageController.GetPackageServiceId(packageId, group.GroupName);
|
||||||
|
if (serviceId == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (itemType == typeof(SystemDSN))
|
||||||
|
{
|
||||||
|
// save DSN info
|
||||||
|
SystemDSN dsn = new SystemDSN();
|
||||||
|
dsn.Name = itemName;
|
||||||
|
dsn.ServiceId = serviceId;
|
||||||
|
dsn.PackageId = packageId;
|
||||||
|
PackageController.AddPackageItem(dsn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IBackupController Members
|
||||||
|
|
||||||
|
public int BackupItem(string tempFolder, System.Xml.XmlWriter writer, ServiceProviderItem item, ResourceGroupInfo group)
|
||||||
|
{
|
||||||
|
if (item is HomeFolder)
|
||||||
|
{
|
||||||
|
// backup home folder files
|
||||||
|
string backupName = String.Format("SpaceFiles_{0}_{1}.zip",
|
||||||
|
item.Id, DateTime.Now.Ticks);
|
||||||
|
|
||||||
|
// get the list of remote files
|
||||||
|
List<SystemFile> files = FilesController.GetFiles(item.PackageId, "\\", true);
|
||||||
|
|
||||||
|
string[] zipFiles = new string[files.Count];
|
||||||
|
for(int i = 0; i < zipFiles.Length; i++)
|
||||||
|
zipFiles[i] = files[i].Name;
|
||||||
|
|
||||||
|
// zip remote files
|
||||||
|
FilesController.ZipFiles(item.PackageId, zipFiles, backupName);
|
||||||
|
|
||||||
|
// download zipped file
|
||||||
|
string localBackupPath = Path.Combine(tempFolder, backupName);
|
||||||
|
|
||||||
|
byte[] buffer = null;
|
||||||
|
FileStream stream = new FileStream(localBackupPath, FileMode.Create, FileAccess.Write);
|
||||||
|
|
||||||
|
int offset = 0;
|
||||||
|
long length = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
// read remote content
|
||||||
|
buffer = FilesController.GetFileBinaryChunk(item.PackageId, backupName, offset, FILE_BUFFER_LENGTH);
|
||||||
|
|
||||||
|
// write remote content
|
||||||
|
stream.Write(buffer, 0, buffer.Length);
|
||||||
|
|
||||||
|
length += buffer.Length;
|
||||||
|
offset += FILE_BUFFER_LENGTH;
|
||||||
|
}
|
||||||
|
while (buffer.Length == FILE_BUFFER_LENGTH);
|
||||||
|
stream.Close();
|
||||||
|
|
||||||
|
// delete zipped file
|
||||||
|
if (FilesController.FileExists(item.PackageId, backupName))
|
||||||
|
FilesController.DeleteFiles(item.PackageId, new string[] { backupName });
|
||||||
|
|
||||||
|
// add file pointer
|
||||||
|
BackupController.WriteFileElement(writer, "SpaceFiles", backupName, length);
|
||||||
|
|
||||||
|
// store meta item
|
||||||
|
XmlSerializer serializer = new XmlSerializer(typeof(HomeFolder));
|
||||||
|
serializer.Serialize(writer, item);
|
||||||
|
}
|
||||||
|
else if (item is SystemDSN)
|
||||||
|
{
|
||||||
|
// backup ODBC DSN
|
||||||
|
OS.OperatingSystem os = GetOS(item.ServiceId);
|
||||||
|
|
||||||
|
// read DSN info
|
||||||
|
SystemDSN itemDsn = item as SystemDSN;
|
||||||
|
SystemDSN dsn = os.GetDSN(item.Name);
|
||||||
|
dsn.DatabasePassword = itemDsn.DatabasePassword;
|
||||||
|
|
||||||
|
XmlSerializer serializer = new XmlSerializer(typeof(SystemDSN));
|
||||||
|
serializer.Serialize(writer, dsn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int RestoreItem(string tempFolder, System.Xml.XmlNode itemNode, int itemId, Type itemType, string itemName, int packageId, int serviceId, ResourceGroupInfo group)
|
||||||
|
{
|
||||||
|
if (itemType == typeof(HomeFolder))
|
||||||
|
{
|
||||||
|
OS.OperatingSystem os = GetOS(serviceId);
|
||||||
|
|
||||||
|
// extract meta item
|
||||||
|
XmlSerializer serializer = new XmlSerializer(typeof(HomeFolder));
|
||||||
|
HomeFolder homeFolder = (HomeFolder)serializer.Deserialize(
|
||||||
|
new XmlNodeReader(itemNode.SelectSingleNode("HomeFolder")));
|
||||||
|
|
||||||
|
// create home folder if required
|
||||||
|
if (!os.DirectoryExists(homeFolder.Name))
|
||||||
|
{
|
||||||
|
os.CreatePackageFolder(homeFolder.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy database backup to remote server
|
||||||
|
XmlNode fileNode = itemNode.SelectSingleNode("File[@name='SpaceFiles']");
|
||||||
|
string backupFileName = fileNode.Attributes["path"].Value;
|
||||||
|
long backupFileLength = Int64.Parse(fileNode.Attributes["size"].Value);
|
||||||
|
string localBackupFilePath = Path.Combine(tempFolder, backupFileName);
|
||||||
|
|
||||||
|
if (new FileInfo(localBackupFilePath).Length != backupFileLength)
|
||||||
|
return -3;
|
||||||
|
|
||||||
|
FileStream stream = new FileStream(localBackupFilePath, FileMode.Open, FileAccess.Read);
|
||||||
|
byte[] buffer = new byte[FILE_BUFFER_LENGTH];
|
||||||
|
|
||||||
|
int readBytes = 0;
|
||||||
|
long length = 0;
|
||||||
|
string remoteBackupPath = Path.Combine(homeFolder.Name, backupFileName);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
// read package file
|
||||||
|
readBytes = stream.Read(buffer, 0, FILE_BUFFER_LENGTH);
|
||||||
|
length += readBytes;
|
||||||
|
|
||||||
|
if (readBytes < FILE_BUFFER_LENGTH)
|
||||||
|
// resize buffer
|
||||||
|
Array.Resize<byte>(ref buffer, readBytes);
|
||||||
|
|
||||||
|
// write remote backup file
|
||||||
|
os.AppendFileBinaryContent(remoteBackupPath, buffer);
|
||||||
|
}
|
||||||
|
while (readBytes == FILE_BUFFER_LENGTH);
|
||||||
|
stream.Close();
|
||||||
|
|
||||||
|
// unzip files
|
||||||
|
os.UnzipFiles(remoteBackupPath, homeFolder.Name);
|
||||||
|
|
||||||
|
// delete archive
|
||||||
|
if (os.FileExists(remoteBackupPath))
|
||||||
|
os.DeleteFile(remoteBackupPath);
|
||||||
|
|
||||||
|
// add meta-item if required
|
||||||
|
if (PackageController.GetPackageItemByName(packageId, itemName, typeof(HomeFolder)) == null)
|
||||||
|
{
|
||||||
|
homeFolder.PackageId = packageId;
|
||||||
|
homeFolder.ServiceId = serviceId;
|
||||||
|
PackageController.AddPackageItem(homeFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (itemType == typeof(SystemDSN))
|
||||||
|
{
|
||||||
|
OS.OperatingSystem os = GetOS(serviceId);
|
||||||
|
|
||||||
|
// extract meta item
|
||||||
|
XmlSerializer serializer = new XmlSerializer(typeof(SystemDSN));
|
||||||
|
SystemDSN dsn = (SystemDSN)serializer.Deserialize(
|
||||||
|
new XmlNodeReader(itemNode.SelectSingleNode("SystemDSN")));
|
||||||
|
|
||||||
|
// create DSN if required
|
||||||
|
if (os.GetDSN(itemName) == null)
|
||||||
|
{
|
||||||
|
dsn.DatabasePassword = CryptoUtils.Decrypt(dsn.DatabasePassword);
|
||||||
|
os.CreateDSN(dsn);
|
||||||
|
|
||||||
|
// restore password
|
||||||
|
dsn.DatabasePassword = CryptoUtils.Encrypt(dsn.DatabasePassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add meta-item if required
|
||||||
|
if (PackageController.GetPackageItemByName(packageId, itemName, typeof(SystemDSN)) == null)
|
||||||
|
{
|
||||||
|
dsn.PackageId = packageId;
|
||||||
|
dsn.ServiceId = serviceId;
|
||||||
|
PackageController.AddPackageItem(dsn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -97,5 +97,17 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
HeliconZooController.SetEnabledEnginesForSite(siteId, packageId, engines);
|
HeliconZooController.SetEnabledEnginesForSite(siteId, packageId, engines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public bool IsWebCosoleEnabled(int serviceId)
|
||||||
|
{
|
||||||
|
return HeliconZooController.IsWebCosoleEnabled(serviceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public void SetWebCosoleEnabled(int serviceId, bool enabled)
|
||||||
|
{
|
||||||
|
HeliconZooController.SetWebCosoleEnabled(serviceId, enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -752,6 +752,12 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return OperatingSystemController.GetWPIProductsFiltered(serverId, keywordId);
|
return OperatingSystemController.GetWPIProductsFiltered(serverId, keywordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public WPIProduct GetWPIProductById(int serverId, string productdId)
|
||||||
|
{
|
||||||
|
InitWPIFeeds(serverId);
|
||||||
|
return OperatingSystemController.GetWPIProductById(serverId, productdId);
|
||||||
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public WPIProduct[] GetWPIProductsWithDependencies(int serverId, string[] products)
|
public WPIProduct[] GetWPIProductsWithDependencies(int serverId, string[] products)
|
||||||
|
|
|
@ -79,6 +79,14 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
return WebAppGalleryController.GetGalleryApplications(packageId, categoryId);
|
return WebAppGalleryController.GetGalleryApplications(packageId, categoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public GalleryApplicationsResult GetInstaledApplications(int packageId, string categoryId)
|
||||||
|
{
|
||||||
|
WebAppGalleryController.InitFeeds(SecurityContext.User.UserId, packageId);
|
||||||
|
return WebAppGalleryController.GetGalleryApplications(packageId, categoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public GalleryApplicationsResult GetGalleryApplicationsFiltered(int packageId, string pattern)
|
public GalleryApplicationsResult GetGalleryApplicationsFiltered(int packageId, string pattern)
|
||||||
{
|
{
|
||||||
|
|
|
@ -443,6 +443,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Helicon Ape Users
|
#region Helicon Ape Users
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public HtaccessUser[] GetHeliconApeUsers(int siteItemId)
|
public HtaccessUser[] GetHeliconApeUsers(int siteItemId)
|
||||||
|
@ -495,6 +497,38 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Helicon Zoo
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public List<WebVirtualDirectory> GetZooApplications(int siteItemId)
|
||||||
|
{
|
||||||
|
return WebServerController.GetZooApplications(siteItemId);
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public StringResultObject SetZooEnvironmentVariable(int siteItemId, string appName, string envName, string envValue)
|
||||||
|
{
|
||||||
|
return WebServerController.SetZooEnvironmentVariable(siteItemId, appName, envName, envValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public StringResultObject SetZooConsoleEnabled(int siteItemId, string appName)
|
||||||
|
{
|
||||||
|
return WebServerController.SetZooConsoleEnabled(siteItemId, appName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public StringResultObject SetZooConsoleDisabled(int siteItemId, string appName)
|
||||||
|
{
|
||||||
|
return WebServerController.SetZooConsoleDisabled(siteItemId, appName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region WebManagement Access
|
#region WebManagement Access
|
||||||
|
|
||||||
|
|
|
@ -92,5 +92,7 @@ namespace WebsitePanel.Providers.HeliconZoo
|
||||||
void SwithEnginesEnabled(bool enabled);
|
void SwithEnginesEnabled(bool enabled);
|
||||||
string[] GetEnabledEnginesForSite(string siteId);
|
string[] GetEnabledEnginesForSite(string siteId);
|
||||||
void SetEnabledEnginesForSite(string siteId, string[] engineNames);
|
void SetEnabledEnginesForSite(string siteId, string[] engineNames);
|
||||||
|
bool IsWebCosoleEnabled();
|
||||||
|
void SetWebCosoleEnabled(bool enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,12 @@ namespace WebsitePanel.Providers.Web
|
||||||
void UpdateHeliconApeGroup(string siteId, WebGroup group);
|
void UpdateHeliconApeGroup(string siteId, WebGroup group);
|
||||||
void DeleteHeliconApeGroup(string siteId, string groupName);
|
void DeleteHeliconApeGroup(string siteId, string groupName);
|
||||||
|
|
||||||
|
// Helicon Zoo
|
||||||
|
WebVirtualDirectory[] GetZooApplications(string siteId);
|
||||||
|
StringResultObject SetZooEnvironmentVariable(string siteId, string appName, string envName, string envValue);
|
||||||
|
StringResultObject SetZooConsoleEnabled(string siteId, string appName);
|
||||||
|
StringResultObject SetZooConsoleDisabled(string siteId, string appName);
|
||||||
|
|
||||||
|
|
||||||
// web app gallery
|
// web app gallery
|
||||||
bool CheckLoadUserProfile();
|
bool CheckLoadUserProfile();
|
||||||
|
|
|
@ -78,6 +78,7 @@ namespace WebsitePanel.Providers.Web
|
||||||
private bool redirectPermanent;
|
private bool redirectPermanent;
|
||||||
private bool sharePointInstalled;
|
private bool sharePointInstalled;
|
||||||
private bool iis7;
|
private bool iis7;
|
||||||
|
private string consoleUrl;
|
||||||
|
|
||||||
public string AnonymousUsername
|
public string AnonymousUsername
|
||||||
{
|
{
|
||||||
|
@ -264,6 +265,12 @@ namespace WebsitePanel.Providers.Web
|
||||||
set { this.iis7 = value; }
|
set { this.iis7 = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string ConsoleUrl
|
||||||
|
{
|
||||||
|
get { return consoleUrl; }
|
||||||
|
set { consoleUrl = value; }
|
||||||
|
}
|
||||||
|
|
||||||
#region Web Deploy Publishing Properties
|
#region Web Deploy Publishing Properties
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets Web Deploy publishing account name
|
/// Gets or sets Web Deploy publishing account name
|
||||||
|
|
|
@ -95,11 +95,15 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
{
|
{
|
||||||
if ((string)switchboardElement.GetAttributeValue("name") == "*")
|
if ((string)switchboardElement.GetAttributeValue("name") == "*")
|
||||||
{
|
{
|
||||||
switchboardDisabledDefault = !(bool)switchboardElement.GetAttributeValue("enabled");
|
bool isEnabled = GetSwitchBoardValue(switchboardElement);
|
||||||
|
|
||||||
|
switchboardDisabledDefault = !isEnabled ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//main engines
|
||||||
|
|
||||||
foreach (ConfigurationElement item in enginesCollection)
|
foreach (ConfigurationElement item in enginesCollection)
|
||||||
{
|
{
|
||||||
HeliconZooEngine newItem = ConvertElementToHeliconZooEngine(item);
|
HeliconZooEngine newItem = ConvertElementToHeliconZooEngine(item);
|
||||||
|
@ -107,6 +111,9 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
result.Add(newItem);
|
result.Add(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//userEngines
|
||||||
|
|
||||||
ConfigurationElement userEngines = heliconZooServer.GetChildElement("userEngines");
|
ConfigurationElement userEngines = heliconZooServer.GetChildElement("userEngines");
|
||||||
ConfigurationElementCollection userEnginesCollection = userEngines.GetCollection();
|
ConfigurationElementCollection userEnginesCollection = userEngines.GetCollection();
|
||||||
foreach (ConfigurationElement item in userEnginesCollection)
|
foreach (ConfigurationElement item in userEnginesCollection)
|
||||||
|
@ -127,13 +134,25 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Web console
|
||||||
|
HeliconZooEngine webConsole = new HeliconZooEngine
|
||||||
|
{
|
||||||
|
displayName = "Web console",
|
||||||
|
name = "console"
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
result.Add(webConsole);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach (ConfigurationElement switchboardElement in switchboardCollection)
|
foreach (ConfigurationElement switchboardElement in switchboardCollection)
|
||||||
{
|
{
|
||||||
HeliconZooEngine item = Collection_GetHeliconZooEngineByName(result, (string)switchboardElement.GetAttributeValue("name"));
|
HeliconZooEngine item = Collection_GetHeliconZooEngineByName(result, (string)switchboardElement.GetAttributeValue("name"));
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
item.disabled = !(bool)switchboardElement.GetAttributeValue("enabled");
|
bool isEnabled = GetSwitchBoardValue(switchboardElement);
|
||||||
|
item.disabled = !isEnabled;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -149,6 +168,17 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool GetSwitchBoardValue(ConfigurationElement switchboardElement)
|
||||||
|
{
|
||||||
|
return (0 == String.Compare((string)switchboardElement.GetAttributeValue("value"),
|
||||||
|
"Enabled", StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetSwitchBoardValue(ConfigurationElement switchboardElement, bool enabled)
|
||||||
|
{
|
||||||
|
switchboardElement.SetAttributeValue("value", enabled ? "Enabled" : "Disabled");
|
||||||
|
}
|
||||||
|
|
||||||
HeliconZooEngine Collection_GetHeliconZooEngineByName(List<HeliconZooEngine> collection, string name)
|
HeliconZooEngine Collection_GetHeliconZooEngineByName(List<HeliconZooEngine> collection, string name)
|
||||||
{
|
{
|
||||||
foreach (HeliconZooEngine r in collection)
|
foreach (HeliconZooEngine r in collection)
|
||||||
|
@ -184,14 +214,6 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
switchboardCollection.Clear();
|
switchboardCollection.Clear();
|
||||||
|
|
||||||
|
|
||||||
//Disable all engines, by default for WSP
|
|
||||||
/*
|
|
||||||
ConfigurationElement disableAll = switchboardCollection.CreateElement();
|
|
||||||
disableAll.SetAttributeValue("name", "*");
|
|
||||||
disableAll.SetAttributeValue("enabled", "false");
|
|
||||||
switchboardCollection.Add(disableAll);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
foreach(HeliconZooEngine item in userEngines)
|
foreach(HeliconZooEngine item in userEngines)
|
||||||
{
|
{
|
||||||
|
@ -202,12 +224,7 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
enginesCollection.Add(engine);
|
enginesCollection.Add(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
ConfigurationElement disable = switchboardCollection.CreateElement();
|
|
||||||
disable.SetAttributeValue("name", item.name );
|
|
||||||
disable.SetAttributeValue("enabled", item.disabled? "false": "true" );
|
|
||||||
switchboardCollection.Add(disable);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
srvman.CommitChanges();
|
srvman.CommitChanges();
|
||||||
|
@ -233,7 +250,7 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
{
|
{
|
||||||
if ((string) switchboardElement.GetAttributeValue("name") == "*")
|
if ((string) switchboardElement.GetAttributeValue("name") == "*")
|
||||||
{
|
{
|
||||||
isEnginesEnabled = (bool) switchboardElement.GetAttributeValue("enabled");
|
isEnginesEnabled = GetSwitchBoardValue(switchboardElement);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,7 +275,7 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
{
|
{
|
||||||
if ((string)switchboardElement.GetAttributeValue("name") == "*")
|
if ((string)switchboardElement.GetAttributeValue("name") == "*")
|
||||||
{
|
{
|
||||||
switchboardElement.SetAttributeValue("enabled", enabled ? "true" : "false");
|
switchboardElement.SetAttributeValue("value", enabled ? "Enabed" : "Disabled");
|
||||||
wildCardFound = true;
|
wildCardFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -268,7 +285,7 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
{
|
{
|
||||||
ConfigurationElement element = switchboardCollection.CreateElement();
|
ConfigurationElement element = switchboardCollection.CreateElement();
|
||||||
element.SetAttributeValue("name", "*");
|
element.SetAttributeValue("name", "*");
|
||||||
element.SetAttributeValue("enabled", enabled ? "true" : "false");
|
SetSwitchBoardValue(element, enabled);
|
||||||
switchboardCollection.Add(element);
|
switchboardCollection.Add(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,8 +322,9 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
|
|
||||||
foreach (ConfigurationElement element in switchboardCollection)
|
foreach (ConfigurationElement element in switchboardCollection)
|
||||||
{
|
{
|
||||||
string enabled = element.GetAttributeValue("enabled").ToString();
|
|
||||||
if (string.Equals(enabled, "true", StringComparison.OrdinalIgnoreCase))
|
bool isEnabled = GetSwitchBoardValue(element);
|
||||||
|
if (isEnabled)
|
||||||
{
|
{
|
||||||
engines.Add(element.GetAttributeValue("name").ToString());
|
engines.Add(element.GetAttributeValue("name").ToString());
|
||||||
}
|
}
|
||||||
|
@ -334,14 +352,14 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
|
|
||||||
ConfigurationElement elementDisableAll = switchboardCollection.CreateElement();
|
ConfigurationElement elementDisableAll = switchboardCollection.CreateElement();
|
||||||
elementDisableAll.SetAttributeValue("name", "*");
|
elementDisableAll.SetAttributeValue("name", "*");
|
||||||
elementDisableAll.SetAttributeValue("enabled", "false");
|
SetSwitchBoardValue(elementDisableAll, false);
|
||||||
switchboardCollection.Add(elementDisableAll);
|
switchboardCollection.Add(elementDisableAll);
|
||||||
|
|
||||||
foreach (string engineName in engineNames)
|
foreach (string engineName in engineNames)
|
||||||
{
|
{
|
||||||
ConfigurationElement element = switchboardCollection.CreateElement();
|
ConfigurationElement element = switchboardCollection.CreateElement();
|
||||||
element.SetAttributeValue("name", engineName);
|
element.SetAttributeValue("name", engineName);
|
||||||
element.SetAttributeValue("enabled", "true");
|
SetSwitchBoardValue(element, true);
|
||||||
switchboardCollection.Add(element);
|
switchboardCollection.Add(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +370,72 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsWebCosoleEnabled()
|
||||||
|
{
|
||||||
|
bool isEnginesEnabled = true;
|
||||||
|
|
||||||
|
using (var srvman = new ServerManager())
|
||||||
|
{
|
||||||
|
Configuration appConfig = srvman.GetApplicationHostConfiguration();
|
||||||
|
|
||||||
|
ConfigurationSection heliconZooServer = appConfig.GetSection("system.webServer/heliconZooServer");
|
||||||
|
|
||||||
|
//switchboard
|
||||||
|
ConfigurationElement switchboard = heliconZooServer.GetChildElement("switchboard");
|
||||||
|
ConfigurationElementCollection switchboardCollection = switchboard.GetCollection();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (ConfigurationElement switchboardElement in switchboardCollection)
|
||||||
|
{
|
||||||
|
if ((string)switchboardElement.GetAttributeValue("name") == "console")
|
||||||
|
{
|
||||||
|
isEnginesEnabled = GetSwitchBoardValue(switchboardElement);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isEnginesEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetWebCosoleEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
using (var srvman = new ServerManager())
|
||||||
|
{
|
||||||
|
Configuration appConfig = srvman.GetApplicationHostConfiguration();
|
||||||
|
|
||||||
|
ConfigurationSection heliconZooServer = appConfig.GetSection("system.webServer/heliconZooServer");
|
||||||
|
|
||||||
|
ConfigurationElement switchboard = heliconZooServer.GetChildElement("switchboard");
|
||||||
|
ConfigurationElementCollection switchboardCollection = switchboard.GetCollection();
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
foreach (ConfigurationElement switchboardElement in switchboardCollection)
|
||||||
|
{
|
||||||
|
if ((string)switchboardElement.GetAttributeValue("name") == "console")
|
||||||
|
{
|
||||||
|
SetSwitchBoardValue(switchboardElement, enabled);
|
||||||
|
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
ConfigurationElement element = switchboardCollection.CreateElement();
|
||||||
|
element.SetAttributeValue("name", "console");
|
||||||
|
SetSwitchBoardValue(element, enabled);
|
||||||
|
switchboardCollection.Add(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
srvman.CommitChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region private methods
|
#region private methods
|
||||||
|
|
||||||
private void ConvertHeliconZooEngineToElement(HeliconZooEngine item, ConfigurationElement engine)
|
private void ConvertHeliconZooEngineToElement(HeliconZooEngine item, ConfigurationElement engine)
|
||||||
|
|
|
@ -1563,12 +1563,18 @@ namespace WebsitePanel.Providers.Web
|
||||||
/// <returns>virtual directories that belong to site with supplied id.</returns>
|
/// <returns>virtual directories that belong to site with supplied id.</returns>
|
||||||
public override WebVirtualDirectory[] GetVirtualDirectories(string siteId)
|
public override WebVirtualDirectory[] GetVirtualDirectories(string siteId)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
using (ServerManager srvman = webObjectsSvc.GetServerManager())
|
using (ServerManager srvman = webObjectsSvc.GetServerManager())
|
||||||
{
|
{
|
||||||
return GetVirtualDirectories(srvman, siteId);
|
return GetVirtualDirectories(srvman, siteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private WebVirtualDirectory[] GetVirtualDirectories(ServerManager srvman, string siteId)
|
private WebVirtualDirectory[] GetVirtualDirectories(ServerManager srvman, string siteId)
|
||||||
{
|
{
|
||||||
// get all virt dirs
|
// get all virt dirs
|
||||||
|
@ -1938,7 +1944,6 @@ namespace WebsitePanel.Providers.Web
|
||||||
if (!string.IsNullOrEmpty(siteId))
|
if (!string.IsNullOrEmpty(siteId))
|
||||||
{
|
{
|
||||||
// Check the web site app pool in integrated pipeline mode
|
// Check the web site app pool in integrated pipeline mode
|
||||||
|
|
||||||
WebSite webSite = null;
|
WebSite webSite = null;
|
||||||
webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteId);
|
webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteId);
|
||||||
if (webSite == null)
|
if (webSite == null)
|
||||||
|
@ -2585,6 +2590,85 @@ namespace WebsitePanel.Providers.Web
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Helicon Zoo
|
||||||
|
|
||||||
|
public override WebVirtualDirectory[] GetZooApplications(string siteId)
|
||||||
|
{
|
||||||
|
using (ServerManager srvman = webObjectsSvc.GetServerManager())
|
||||||
|
{
|
||||||
|
return webObjectsSvc.GetZooApplications(srvman, siteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override StringResultObject SetZooEnvironmentVariable(string siteId, string appName, string envName, string envValue)
|
||||||
|
{
|
||||||
|
StringResultObject result = new StringResultObject();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (ServerManager srvman = webObjectsSvc.GetServerManager())
|
||||||
|
{
|
||||||
|
webObjectsSvc.SetZooEnvironmentVariable(srvman, siteId, appName, envName, envValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.IsSuccess = true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
result.AddError("Exception", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override StringResultObject SetZooConsoleEnabled(string siteId, string appName)
|
||||||
|
{
|
||||||
|
StringResultObject result = new StringResultObject();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (ServerManager srvman = webObjectsSvc.GetServerManager())
|
||||||
|
{
|
||||||
|
webObjectsSvc.SetZooConsoleEnabled(srvman, siteId, appName);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.IsSuccess = true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
result.AddError("Exception", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override StringResultObject SetZooConsoleDisabled(string siteId, string appName)
|
||||||
|
{
|
||||||
|
StringResultObject result = new StringResultObject();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (ServerManager srvman = webObjectsSvc.GetServerManager())
|
||||||
|
{
|
||||||
|
webObjectsSvc.SetZooConsoleDisabled(srvman, siteId, appName);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.IsSuccess = true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
result.AddError("Exception", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Secured Helicon Ape Users
|
#region Secured Helicon Ape Users
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Permissions;
|
||||||
|
|
||||||
namespace WebsitePanel.Providers.Web.Iis.WebObjects
|
namespace WebsitePanel.Providers.Web.Iis.WebObjects
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
|
@ -661,6 +665,137 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
|
||||||
return vdirs.ToArray();
|
return vdirs.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WebVirtualDirectory[] GetZooApplications(ServerManager srvman, string siteId)
|
||||||
|
{
|
||||||
|
if (!SiteExists(srvman, siteId))
|
||||||
|
return new WebVirtualDirectory[] { };
|
||||||
|
|
||||||
|
var vdirs = new List<WebVirtualDirectory>();
|
||||||
|
var iisObject = srvman.Sites[siteId];
|
||||||
|
//
|
||||||
|
foreach (var item in iisObject.Applications)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
Configuration cfg = item.GetWebConfiguration();
|
||||||
|
string location = siteId + ConfigurationUtility.GetQualifiedVirtualPath(item.Path);
|
||||||
|
ConfigurationSection section = cfg.GetSection("system.webServer/heliconZoo", location);
|
||||||
|
|
||||||
|
if (section.GetCollection().Count > 0)
|
||||||
|
{
|
||||||
|
WebVirtualDirectory vdir = new WebVirtualDirectory
|
||||||
|
{
|
||||||
|
Name = ConfigurationUtility.GetNonQualifiedVirtualPath(item.Path),
|
||||||
|
ContentPath = item.VirtualDirectories[0].PhysicalPath
|
||||||
|
};
|
||||||
|
|
||||||
|
ConfigurationElement zooAppElement = section.GetCollection()[0];
|
||||||
|
ConfigurationElementCollection envColl = zooAppElement.GetChildElement("environmentVariables").GetCollection();
|
||||||
|
|
||||||
|
foreach (ConfigurationElement env in envColl)
|
||||||
|
{
|
||||||
|
if ((string) env.GetAttributeValue("name") == "CONSOLE_URL")
|
||||||
|
{
|
||||||
|
vdir.ConsoleUrl = ConfigurationUtility.GetQualifiedVirtualPath(item.Path);
|
||||||
|
if (!vdir.ConsoleUrl.EndsWith("/"))
|
||||||
|
{
|
||||||
|
vdir.ConsoleUrl += "/";
|
||||||
|
}
|
||||||
|
vdir.ConsoleUrl += (string)env.GetAttributeValue("value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vdirs.Add(vdir);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
//there is no zoo
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
return vdirs.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetZooConsoleEnabled(ServerManager srvman, string siteId, string appName)
|
||||||
|
{
|
||||||
|
|
||||||
|
Random random = new Random((int) DateTime.Now.Ticks);
|
||||||
|
byte[] bytes = new byte[8];
|
||||||
|
random.NextBytes(bytes);
|
||||||
|
string consoleUrl = "console_" + Convert.ToBase64String(bytes);
|
||||||
|
SetZooEnvironmentVariable(srvman, siteId, appName, "CONSOLE_URL", consoleUrl);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetZooConsoleDisabled(ServerManager srvman, string siteId, string appName)
|
||||||
|
{
|
||||||
|
SetZooEnvironmentVariable(srvman, siteId, appName, "CONSOLE_URL", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void SetZooEnvironmentVariable(ServerManager srvman, string siteId, string appName, string envName, string envValue)
|
||||||
|
{
|
||||||
|
if (!SiteExists(srvman, siteId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
var iisObject = srvman.Sites[siteId];
|
||||||
|
//
|
||||||
|
foreach (var item in iisObject.Applications)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (appName == ConfigurationUtility.GetNonQualifiedVirtualPath(item.Path))
|
||||||
|
{
|
||||||
|
Configuration cfg = item.GetWebConfiguration();
|
||||||
|
ConfigurationSection section = cfg.GetSection("system.webServer/heliconZoo");
|
||||||
|
ConfigurationElement zooAppElement = section.GetCollection()[0];
|
||||||
|
ConfigurationElementCollection envColl = zooAppElement.GetChildElement("environmentVariables").GetCollection();
|
||||||
|
|
||||||
|
//remove all CONSOLE_URLs
|
||||||
|
for (int i = 0; i < envColl.Count; )
|
||||||
|
{
|
||||||
|
if (String.Compare(envColl[i].GetAttributeValue("name").ToString(), envName, StringComparison.OrdinalIgnoreCase) == 0)
|
||||||
|
{
|
||||||
|
envColl.RemoveAt(i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not set empty value
|
||||||
|
if (!string.IsNullOrEmpty(envValue))
|
||||||
|
{
|
||||||
|
ConfigurationElement el = envColl.CreateElement();
|
||||||
|
el.SetAttributeValue("name", envName);
|
||||||
|
el.SetAttributeValue("value", envValue);
|
||||||
|
envColl.Add(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
srvman.CommitChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public WebVirtualDirectory GetVirtualDirectory(string siteId, string directoryName)
|
public WebVirtualDirectory GetVirtualDirectory(string siteId, string directoryName)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -737,4 +872,6 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2455,6 +2455,33 @@ namespace WebsitePanel.Providers.Web
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Helicon Zoo
|
||||||
|
public virtual WebVirtualDirectory[] GetZooApplications(string siteId)
|
||||||
|
{
|
||||||
|
return new WebVirtualDirectory[] { };
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual StringResultObject SetZooEnvironmentVariable(string siteId, string appName, string envName, string envValue)
|
||||||
|
{
|
||||||
|
//pass
|
||||||
|
return new StringResultObject();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual StringResultObject SetZooConsoleEnabled(string siteId, string appName)
|
||||||
|
{
|
||||||
|
return new StringResultObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual StringResultObject SetZooConsoleDisabled(string siteId, string appName)
|
||||||
|
{
|
||||||
|
return new StringResultObject();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Helper Methods
|
#region Private Helper Methods
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:2.0.50727.5456
|
// Runtime Version:2.0.50727.5466
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
@ -41,6 +41,10 @@ namespace WebsitePanel.Providers.HeliconZoo {
|
||||||
|
|
||||||
private System.Threading.SendOrPostCallback SetEnabledEnginesForSiteOperationCompleted;
|
private System.Threading.SendOrPostCallback SetEnabledEnginesForSiteOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback IsWebCosoleEnabledOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback SetWebCosoleEnabledOperationCompleted;
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public HeliconZoo() {
|
public HeliconZoo() {
|
||||||
this.Url = "http://localhost:9003/HeliconZoo.asmx";
|
this.Url = "http://localhost:9003/HeliconZoo.asmx";
|
||||||
|
@ -64,6 +68,12 @@ namespace WebsitePanel.Providers.HeliconZoo {
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public event SetEnabledEnginesForSiteCompletedEventHandler SetEnabledEnginesForSiteCompleted;
|
public event SetEnabledEnginesForSiteCompletedEventHandler SetEnabledEnginesForSiteCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event IsWebCosoleEnabledCompletedEventHandler IsWebCosoleEnabledCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event SetWebCosoleEnabledCompletedEventHandler SetWebCosoleEnabledCompleted;
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetEngines", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetEngines", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
@ -307,6 +317,85 @@ namespace WebsitePanel.Providers.HeliconZoo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/IsWebCosoleEnabled", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
public bool IsWebCosoleEnabled() {
|
||||||
|
object[] results = this.Invoke("IsWebCosoleEnabled", new object[0]);
|
||||||
|
return ((bool)(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginIsWebCosoleEnabled(System.AsyncCallback callback, object asyncState) {
|
||||||
|
return this.BeginInvoke("IsWebCosoleEnabled", new object[0], callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public bool EndIsWebCosoleEnabled(System.IAsyncResult asyncResult) {
|
||||||
|
object[] results = this.EndInvoke(asyncResult);
|
||||||
|
return ((bool)(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void IsWebCosoleEnabledAsync() {
|
||||||
|
this.IsWebCosoleEnabledAsync(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void IsWebCosoleEnabledAsync(object userState) {
|
||||||
|
if ((this.IsWebCosoleEnabledOperationCompleted == null)) {
|
||||||
|
this.IsWebCosoleEnabledOperationCompleted = new System.Threading.SendOrPostCallback(this.OnIsWebCosoleEnabledOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("IsWebCosoleEnabled", new object[0], this.IsWebCosoleEnabledOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnIsWebCosoleEnabledOperationCompleted(object arg) {
|
||||||
|
if ((this.IsWebCosoleEnabledCompleted != null)) {
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.IsWebCosoleEnabledCompleted(this, new IsWebCosoleEnabledCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SetWebCosoleEnabled", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
public void SetWebCosoleEnabled(bool enabled) {
|
||||||
|
this.Invoke("SetWebCosoleEnabled", new object[] {
|
||||||
|
enabled});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginSetWebCosoleEnabled(bool enabled, System.AsyncCallback callback, object asyncState) {
|
||||||
|
return this.BeginInvoke("SetWebCosoleEnabled", new object[] {
|
||||||
|
enabled}, callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void EndSetWebCosoleEnabled(System.IAsyncResult asyncResult) {
|
||||||
|
this.EndInvoke(asyncResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void SetWebCosoleEnabledAsync(bool enabled) {
|
||||||
|
this.SetWebCosoleEnabledAsync(enabled, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void SetWebCosoleEnabledAsync(bool enabled, object userState) {
|
||||||
|
if ((this.SetWebCosoleEnabledOperationCompleted == null)) {
|
||||||
|
this.SetWebCosoleEnabledOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetWebCosoleEnabledOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("SetWebCosoleEnabled", new object[] {
|
||||||
|
enabled}, this.SetWebCosoleEnabledOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSetWebCosoleEnabledOperationCompleted(object arg) {
|
||||||
|
if ((this.SetWebCosoleEnabledCompleted != null)) {
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.SetWebCosoleEnabledCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public new void CancelAsync(object userState) {
|
public new void CancelAsync(object userState) {
|
||||||
base.CancelAsync(userState);
|
base.CancelAsync(userState);
|
||||||
|
@ -402,4 +491,34 @@ namespace WebsitePanel.Providers.HeliconZoo {
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
public delegate void SetEnabledEnginesForSiteCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
public delegate void SetEnabledEnginesForSiteCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
|
public delegate void IsWebCosoleEnabledCompletedEventHandler(object sender, IsWebCosoleEnabledCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
|
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||||
|
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||||
|
public partial class IsWebCosoleEnabledCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||||
|
|
||||||
|
private object[] results;
|
||||||
|
|
||||||
|
internal IsWebCosoleEnabledCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||||
|
base(exception, cancelled, userState) {
|
||||||
|
this.results = results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public bool Result {
|
||||||
|
get {
|
||||||
|
this.RaiseExceptionIfNecessary();
|
||||||
|
return ((bool)(this.results[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
|
public delegate void SetWebCosoleEnabledCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,10 +26,11 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:2.0.50727.42
|
// Runtime Version:2.0.50727.5466
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
@ -39,8 +40,7 @@
|
||||||
//
|
//
|
||||||
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
|
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
|
||||||
//
|
//
|
||||||
namespace WebsitePanel.Server
|
namespace WebsitePanel.Server {
|
||||||
{
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Web.Services;
|
using System.Web.Services;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
@ -73,6 +73,8 @@ namespace WebsitePanel.Server
|
||||||
|
|
||||||
private System.Threading.SendOrPostCallback GetWPIProductsFilteredOperationCompleted;
|
private System.Threading.SendOrPostCallback GetWPIProductsFilteredOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback GetWPIProductByIdOperationCompleted;
|
||||||
|
|
||||||
private System.Threading.SendOrPostCallback GetWPITabsOperationCompleted;
|
private System.Threading.SendOrPostCallback GetWPITabsOperationCompleted;
|
||||||
|
|
||||||
private System.Threading.SendOrPostCallback InitWPIFeedsOperationCompleted;
|
private System.Threading.SendOrPostCallback InitWPIFeedsOperationCompleted;
|
||||||
|
@ -132,6 +134,9 @@ namespace WebsitePanel.Server
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public event GetWPIProductsFilteredCompletedEventHandler GetWPIProductsFilteredCompleted;
|
public event GetWPIProductsFilteredCompletedEventHandler GetWPIProductsFilteredCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event GetWPIProductByIdCompletedEventHandler GetWPIProductByIdCompleted;
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public event GetWPITabsCompletedEventHandler GetWPITabsCompleted;
|
public event GetWPITabsCompletedEventHandler GetWPITabsCompleted;
|
||||||
|
|
||||||
|
@ -496,6 +501,47 @@ namespace WebsitePanel.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetWPIProductById", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
public WPIProduct GetWPIProductById(string productdId) {
|
||||||
|
object[] results = this.Invoke("GetWPIProductById", new object[] {
|
||||||
|
productdId});
|
||||||
|
return ((WPIProduct)(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginGetWPIProductById(string productdId, System.AsyncCallback callback, object asyncState) {
|
||||||
|
return this.BeginInvoke("GetWPIProductById", new object[] {
|
||||||
|
productdId}, callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public WPIProduct EndGetWPIProductById(System.IAsyncResult asyncResult) {
|
||||||
|
object[] results = this.EndInvoke(asyncResult);
|
||||||
|
return ((WPIProduct)(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void GetWPIProductByIdAsync(string productdId) {
|
||||||
|
this.GetWPIProductByIdAsync(productdId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void GetWPIProductByIdAsync(string productdId, object userState) {
|
||||||
|
if ((this.GetWPIProductByIdOperationCompleted == null)) {
|
||||||
|
this.GetWPIProductByIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetWPIProductByIdOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("GetWPIProductById", new object[] {
|
||||||
|
productdId}, this.GetWPIProductByIdOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGetWPIProductByIdOperationCompleted(object arg) {
|
||||||
|
if ((this.GetWPIProductByIdCompleted != null)) {
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.GetWPIProductByIdCompleted(this, new GetWPIProductByIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetWPITabs", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetWPITabs", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
public WPITab[] GetWPITabs() {
|
public WPITab[] GetWPITabs() {
|
||||||
|
@ -1237,6 +1283,32 @@ namespace WebsitePanel.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
|
public delegate void GetWPIProductByIdCompletedEventHandler(object sender, GetWPIProductByIdCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
|
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||||
|
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||||
|
public partial class GetWPIProductByIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||||
|
|
||||||
|
private object[] results;
|
||||||
|
|
||||||
|
internal GetWPIProductByIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||||
|
base(exception, cancelled, userState) {
|
||||||
|
this.results = results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public WPIProduct Result {
|
||||||
|
get {
|
||||||
|
this.RaiseExceptionIfNecessary();
|
||||||
|
return ((WPIProduct)(this.results[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||||
public delegate void GetWPITabsCompletedEventHandler(object sender, GetWPITabsCompletedEventArgs e);
|
public delegate void GetWPITabsCompletedEventHandler(object sender, GetWPITabsCompletedEventArgs e);
|
||||||
|
|
|
@ -267,6 +267,20 @@ namespace WebsitePanel.Server.Code
|
||||||
return products;
|
return products;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Product GetWPIProductById(string productId)
|
||||||
|
{
|
||||||
|
foreach (Product product in _productManager.Products)
|
||||||
|
{
|
||||||
|
if (0 == String.Compare(product.ProductId, productId, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return null; //not found
|
||||||
|
}
|
||||||
|
|
||||||
public List<Product> GetProductsToInstall(IEnumerable<string> productIdsToInstall)
|
public List<Product> GetProductsToInstall(IEnumerable<string> productIdsToInstall)
|
||||||
{
|
{
|
||||||
List<Product> productsToInstall = new List<Product>();
|
List<Product> productsToInstall = new List<Product>();
|
||||||
|
@ -582,7 +596,6 @@ namespace WebsitePanel.Server.Code
|
||||||
private void Initialize()
|
private void Initialize()
|
||||||
{
|
{
|
||||||
// create cache folder if not exists
|
// create cache folder if not exists
|
||||||
//_webPIinstallersFolder = Environment.ExpandEnvironmentVariables(@"%LocalAppData%\Microsoft\Web Platform Installer\installers");
|
|
||||||
_webPIinstallersFolder = Path.Combine(
|
_webPIinstallersFolder = Path.Combine(
|
||||||
Environment.ExpandEnvironmentVariables("%SystemRoot%"),
|
Environment.ExpandEnvironmentVariables("%SystemRoot%"),
|
||||||
"Temp\\zoo.wpi\\AppData\\Local\\Microsoft\\Web Platform Installer\\installers");
|
"Temp\\zoo.wpi\\AppData\\Local\\Microsoft\\Web Platform Installer\\installers");
|
||||||
|
|
|
@ -101,5 +101,17 @@ namespace WebsitePanel.Server
|
||||||
{
|
{
|
||||||
ZooProvider.SetEnabledEnginesForSite(siteId, engineNames);
|
ZooProvider.SetEnabledEnginesForSite(siteId, engineNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WebMethod, SoapHeader("settings")]
|
||||||
|
public bool IsWebCosoleEnabled()
|
||||||
|
{
|
||||||
|
return ZooProvider.IsWebCosoleEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod, SoapHeader("settings")]
|
||||||
|
public void SetWebCosoleEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
ZooProvider.SetWebCosoleEnabled(enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1093,6 +1093,82 @@ namespace WebsitePanel.Server
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Helicon Zoo
|
||||||
|
|
||||||
|
[WebMethod, SoapHeader("settings")]
|
||||||
|
public WebVirtualDirectory[] GetZooApplications(string siteId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.WriteStart("'{0}' GetZooApplications", ProviderSettings.ProviderName);
|
||||||
|
WebVirtualDirectory[] result = WebProvider.GetZooApplications(siteId);
|
||||||
|
Log.WriteEnd("'{0}' GetZooApplications", ProviderSettings.ProviderName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.WriteError(String.Format("'{0}' GetZooApplications", ProviderSettings.ProviderName), ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod, SoapHeader("settings")]
|
||||||
|
public StringResultObject SetZooEnvironmentVariable(string siteId, string appName, string envName, string envValue)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.WriteStart("'{0}' SetZooEnvironmentVariable", ProviderSettings.ProviderName);
|
||||||
|
StringResultObject result = WebProvider.SetZooEnvironmentVariable(siteId, appName, envName, envValue);
|
||||||
|
Log.WriteEnd("'{0}' SetZooEnvironmentVariable", ProviderSettings.ProviderName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.WriteError(String.Format("'{0}' SetZooEnvironmentVariable", ProviderSettings.ProviderName), ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod, SoapHeader("settings")]
|
||||||
|
public StringResultObject SetZooConsoleEnabled(string siteId, string appName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.WriteStart("'{0}' SetZooConsoleEnabled", ProviderSettings.ProviderName);
|
||||||
|
StringResultObject result = WebProvider.SetZooConsoleEnabled(siteId, appName);
|
||||||
|
Log.WriteEnd("'{0}' SetZooConsoleEnabled", ProviderSettings.ProviderName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.WriteError(String.Format("'{0}' SetZooConsoleEnabled", ProviderSettings.ProviderName), ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod, SoapHeader("settings")]
|
||||||
|
public StringResultObject SetZooConsoleDisabled(string siteId, string appName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.WriteStart("'{0}' SetZooConsoleDisabled", ProviderSettings.ProviderName);
|
||||||
|
StringResultObject result = WebProvider.SetZooConsoleDisabled(siteId, appName);
|
||||||
|
Log.WriteEnd("'{0}' SetZooConsoleDisabled", ProviderSettings.ProviderName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.WriteError(String.Format("'{0}' SetZooConsoleDisabled", ProviderSettings.ProviderName), ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Web Application Gallery
|
#region Web Application Gallery
|
||||||
|
|
|
@ -360,20 +360,50 @@ namespace WebsitePanel.Server
|
||||||
{
|
{
|
||||||
foreach (WPIProduct product in products)
|
foreach (WPIProduct product in products)
|
||||||
{
|
{
|
||||||
string installedHostingPackageVersion = GetInstalledHostingPackageVersion(product.ProductId);
|
string hostingPackageName = product.ProductId;
|
||||||
if (!string.IsNullOrEmpty(installedHostingPackageVersion) && string.Compare(product.Version, installedHostingPackageVersion, StringComparison.OrdinalIgnoreCase) > 0)
|
CheckProductForUpdate(hostingPackageName, product);
|
||||||
{
|
|
||||||
product.IsUpgrade = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetInstalledHostingPackageVersion(string productId)
|
private void CheckProductForUpdate(string hostingPackageName, WPIProduct product)
|
||||||
{
|
{
|
||||||
string installedVersion = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Helicon\\Zoo", productId+"Version", string.Empty) as string;
|
string installedHostingPackageVersion = GetInstalledHostingPackageVersion(hostingPackageName);
|
||||||
|
if (!string.IsNullOrEmpty(installedHostingPackageVersion))
|
||||||
|
{
|
||||||
|
//6
|
||||||
|
//3.0.90.383
|
||||||
|
if (CompareVersions(product.Version, installedHostingPackageVersion) > 0)
|
||||||
|
{
|
||||||
|
product.IsUpgrade = true;
|
||||||
|
product.IsInstalled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private decimal CompareVersions(string newVersion, string oldVersion)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var version1 = new Version(newVersion);
|
||||||
|
var version2 = new Version(oldVersion);
|
||||||
|
|
||||||
|
return version1.CompareTo(version2);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
return String.Compare(newVersion,oldVersion, StringComparison.Ordinal);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetInstalledHostingPackageVersion(string hostingPackageName)
|
||||||
|
{
|
||||||
|
string installedVersion = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Helicon\\Zoo", hostingPackageName + "Version", string.Empty) as string;
|
||||||
if (string.IsNullOrEmpty(installedVersion))
|
if (string.IsNullOrEmpty(installedVersion))
|
||||||
{
|
{
|
||||||
installedVersion = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Helicon\\Zoo", productId + "Version", string.Empty) as string;
|
installedVersion = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Helicon\\Zoo", hostingPackageName + "Version", string.Empty) as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
return installedVersion;
|
return installedVersion;
|
||||||
|
@ -480,6 +510,33 @@ namespace WebsitePanel.Server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public WPIProduct GetWPIProductById(string productdId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.WriteStart("GetWPIProductById");
|
||||||
|
WpiHelper wpi = GetWpiFeed();
|
||||||
|
|
||||||
|
Product product = wpi.GetWPIProductById(productdId);
|
||||||
|
WPIProduct wpiProduct = ProductToWPIProduct(product);
|
||||||
|
|
||||||
|
if (wpiProduct.ProductId == "HeliconZooModule")
|
||||||
|
{
|
||||||
|
/*null string = HeliconZooModule in registry*/
|
||||||
|
CheckProductForUpdate("", wpiProduct);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.WriteEnd("GetWPIProductById");
|
||||||
|
return wpiProduct;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.WriteError("GetWPIProductById", ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
public WPITab[] GetWPITabs()
|
public WPITab[] GetWPITabs()
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,4 +123,18 @@
|
||||||
<data name="SelectWebEngine.Text" xml:space="preserve">
|
<data name="SelectWebEngine.Text" xml:space="preserve">
|
||||||
<value>Select web application engine to set up</value>
|
<value>Select web application engine to set up</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="gvInstalledApplicationsEnableConsole.Header" xml:space="preserve">
|
||||||
|
<value>Web console</value>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<data name="btnEnable.Text" xml:space="preserve">
|
||||||
|
<value>Enable</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnDisable.Text" xml:space="preserve">
|
||||||
|
<value>Disable</value>
|
||||||
|
</data>
|
||||||
|
<data name="EnableWebConsole.Text" xml:space="preserve">
|
||||||
|
<value>Enable web console</value>
|
||||||
|
</data>
|
||||||
|
|
||||||
</root>
|
</root>
|
|
@ -89,10 +89,12 @@ span.ValidationMessageBlock {
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>
|
<legend>
|
||||||
<span>Helicon Zoo engine quotas settings</span>
|
<span>Helicon Zoo settings</span>
|
||||||
</legend>
|
</legend>
|
||||||
<div class="FormBody">
|
<div class="FormBody">
|
||||||
<asp:CheckBox runat="server" ID="QuotasEnabled" Text="Enable Quotas"/>
|
<asp:CheckBox runat="server" ID="QuotasEnabled" Text="Enable hosting plan controls for web engines."/>
|
||||||
|
<br />
|
||||||
|
<asp:CheckBox runat="server" ID="WebCosoleEnabled" Text="Enable web console."/>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public partial class HeliconZoo_Settings : WebsitePanelControlBase, IHostingServ
|
||||||
|
|
||||||
private void BindHostingPackages()
|
private void BindHostingPackages()
|
||||||
{
|
{
|
||||||
// TODO: try...catch?
|
|
||||||
WPIProduct[] products = null;
|
WPIProduct[] products = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -92,6 +92,12 @@ public partial class HeliconZoo_Settings : WebsitePanelControlBase, IHostingServ
|
||||||
|
|
||||||
private void BindEngines()
|
private void BindEngines()
|
||||||
{
|
{
|
||||||
|
WPIProduct zooModule = ES.Services.Servers.GetWPIProductById(PanelRequest.ServerId, "HeliconZooModule");
|
||||||
|
if (!zooModule.IsInstalled || zooModule.IsUpgrade)
|
||||||
|
{
|
||||||
|
HostModule.ShowWarningMessage("Zoo Module is not installed or out-of-date. To proceed press 'Add' or 'Update' next to Helicon Zoo Module below, then press 'Install'.");
|
||||||
|
}
|
||||||
|
|
||||||
// get all engines from IIS
|
// get all engines from IIS
|
||||||
HeliconZooEngine[] engineList = ES.Services.HeliconZoo.GetEngines(PanelRequest.ServiceId);
|
HeliconZooEngine[] engineList = ES.Services.HeliconZoo.GetEngines(PanelRequest.ServiceId);
|
||||||
|
|
||||||
|
@ -114,6 +120,8 @@ public partial class HeliconZoo_Settings : WebsitePanelControlBase, IHostingServ
|
||||||
// bind 'Enable quotas' checkbox
|
// bind 'Enable quotas' checkbox
|
||||||
bool enabled = ES.Services.HeliconZoo.IsEnginesEnabled(PanelRequest.ServiceId);
|
bool enabled = ES.Services.HeliconZoo.IsEnginesEnabled(PanelRequest.ServiceId);
|
||||||
QuotasEnabled.Checked = !enabled;
|
QuotasEnabled.Checked = !enabled;
|
||||||
|
|
||||||
|
WebCosoleEnabled.Checked = ES.Services.HeliconZoo.IsWebCosoleEnabled(PanelRequest.ServiceId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -139,6 +147,8 @@ public partial class HeliconZoo_Settings : WebsitePanelControlBase, IHostingServ
|
||||||
|
|
||||||
// save switcher
|
// save switcher
|
||||||
ES.Services.HeliconZoo.SwithEnginesEnabled(PanelRequest.ServiceId, !QuotasEnabled.Checked);
|
ES.Services.HeliconZoo.SwithEnginesEnabled(PanelRequest.ServiceId, !QuotasEnabled.Checked);
|
||||||
|
|
||||||
|
ES.Services.HeliconZoo.SetWebCosoleEnabled(PanelRequest.ServiceId, WebCosoleEnabled.Checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ClearEngineForm()
|
protected void ClearEngineForm()
|
||||||
|
@ -390,7 +400,15 @@ public partial class HeliconZoo_Settings : WebsitePanelControlBase, IHostingServ
|
||||||
|
|
||||||
private static WPIProduct[] RequestHostingPackages()
|
private static WPIProduct[] RequestHostingPackages()
|
||||||
{
|
{
|
||||||
return ES.Services.Servers.GetWPIProducts(PanelRequest.ServerId, null, "ZooPackage");
|
List<WPIProduct> result = new List<WPIProduct>();
|
||||||
|
result.Add(ES.Services.Servers.GetWPIProductById(PanelRequest.ServerId, "HeliconZooModule"));
|
||||||
|
result.AddRange(ES.Services.Servers.GetWPIProducts(PanelRequest.ServerId, null, "ZooPackage"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return result.ToArray();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string AddUpgradeRemoveText(WPIProduct wpiProduct)
|
protected string AddUpgradeRemoveText(WPIProduct wpiProduct)
|
||||||
|
|
|
@ -1,32 +1,4 @@
|
||||||
// Copyright (c) 2012, Outercurve Foundation.
|
//------------------------------------------------------------------------------
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
// are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// - Redistributions of source code must retain the above copyright notice, this
|
|
||||||
// list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
|
||||||
// contributors may be used to endorse or promote products derived from this
|
|
||||||
// software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
//
|
//
|
||||||
|
@ -84,6 +56,15 @@ public partial class HeliconZoo_Settings {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.Label HostingPackagesLoadingError;
|
protected global::System.Web.UI.WebControls.Label HostingPackagesLoadingError;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EnginesPanel control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.Panel EnginesPanel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// QuotasEnabled control.
|
/// QuotasEnabled control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -94,13 +75,13 @@ public partial class HeliconZoo_Settings {
|
||||||
protected global::System.Web.UI.WebControls.CheckBox QuotasEnabled;
|
protected global::System.Web.UI.WebControls.CheckBox QuotasEnabled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// EnginesPanel control.
|
/// WebCosoleEnabled control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Auto-generated field.
|
/// Auto-generated field.
|
||||||
/// To modify move field declaration from designer file to code-behind file.
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.Panel EnginesPanel;
|
protected global::System.Web.UI.WebControls.CheckBox WebCosoleEnabled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ButtonAddEngine control.
|
/// ButtonAddEngine control.
|
||||||
|
|
|
@ -27,13 +27,73 @@
|
||||||
<br
|
<br
|
||||||
--%>
|
--%>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<asp:Label ID="lblConsole" runat="server" meta:resourcekey="EnableWebConsole" CssClass="NormalBold"></asp:Label>
|
||||||
|
</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<%--<asp:GridView id="gvInstalledApplications" runat="server" AutoGenerateColumns="True" AllowPaging="true"
|
||||||
|
ShowHeader="false" CssSelectorClass="LightGridView" EmptyDataText="gvInstalledApplications.Empty"
|
||||||
|
>
|
||||||
|
</asp:GridView>--%>
|
||||||
|
|
||||||
|
<asp:GridView ID="gvInstalledApplications" runat="server"
|
||||||
|
EnableViewState="True" AutoGenerateColumns="false"
|
||||||
|
ShowHeader="true" CssSelectorClass="NormalGridView"
|
||||||
|
EmptyDataText="gvVirtualDirectories"
|
||||||
|
onrowcommand="gvInstalledApplications_RowCommand">
|
||||||
|
<Columns>
|
||||||
|
<asp:BoundField DataField="Name" HeaderText="Name">
|
||||||
|
<ItemStyle Width="60%" />
|
||||||
|
</asp:BoundField>
|
||||||
|
|
||||||
|
<asp:TemplateField HeaderText="gvInstalledApplicationsEnableConsole">
|
||||||
|
<ItemStyle HorizontalAlign="Center" />
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:Button ID="btnEnable" runat="server"
|
||||||
|
Text='<%# GetLocalizedString("btnEnable.Text") %>' CssClass="Button1"
|
||||||
|
CommandArgument='<%# Eval("Name") %>'
|
||||||
|
CommandName="EnableConsole"
|
||||||
|
Visible= '<%# IsNullOrEmpty( (string)Eval("ConsoleUrl")) %>'
|
||||||
|
/>
|
||||||
|
|
||||||
|
<asp:Button ID="btnDisable" runat="server"
|
||||||
|
Text='<%# GetLocalizedString("btnDisable.Text") %>' CssClass="Button1"
|
||||||
|
CommandArgument='<%# Eval("Name") %>'
|
||||||
|
CommandName="DisableConsole"
|
||||||
|
Visible= '<%# !IsNullOrEmpty( (string)Eval("ConsoleUrl")) %>'
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<asp:hyperlink
|
||||||
|
CssClass="MediumBold"
|
||||||
|
NavigateUrl='<%# GetConsoleFullUrl((string)Eval("ConsoleUrl")) %>'
|
||||||
|
runat="server"
|
||||||
|
ID="lnkAppDetails"
|
||||||
|
ToolTip='<%# Eval("ConsoleUrl") %>'
|
||||||
|
Target="_blank"
|
||||||
|
Visible= '<%# !IsNullOrEmpty( (string)Eval("ConsoleUrl")) %>'>
|
||||||
|
Open console
|
||||||
|
</asp:hyperlink>
|
||||||
|
|
||||||
|
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
|
||||||
|
|
||||||
|
</Columns>
|
||||||
|
</asp:GridView>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<asp:Label runat="server" meta:resourcekey="SelectWebEngine" CssClass="NormalBold"></asp:Label>
|
<asp:Label runat="server" meta:resourcekey="SelectWebEngine" CssClass="NormalBold"></asp:Label>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
||||||
<asp:GridView id="gvApplications" runat="server" AutoGenerateColumns="False" AllowPaging="true"
|
<asp:GridView id="gvApplications" runat="server" AutoGenerateColumns="False" AllowPaging="true"
|
||||||
ShowHeader="false" CssSelectorClass="LightGridView" EmptyDataText="gvApplications" OnRowCommand="gvApplications_RowCommand"
|
ShowHeader="false" CssSelectorClass="LightGridView" EmptyDataText="There are no applications" OnRowCommand="gvApplications_RowCommand"
|
||||||
OnPageIndexChanging="gvApplications_PageIndexChanging">
|
OnPageIndexChanging="gvApplications_PageIndexChanging">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:TemplateField HeaderText="gvApplicationsApplication">
|
<asp:TemplateField HeaderText="gvApplicationsApplication">
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
@ -32,6 +33,19 @@ namespace WebsitePanel.Portal
|
||||||
ViewState["WebSitePackageId"] = site.PackageId;
|
ViewState["WebSitePackageId"] = site.PackageId;
|
||||||
|
|
||||||
BindEngines(site);
|
BindEngines(site);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BindInstalledApplications();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
lblConsole.Text = "Zoo Module is not installed. Please ask your system administrator to install Zoo on the server to Configuration\\Server\\Web Application Engines.";
|
||||||
|
lblConsole.ForeColor = Color.Red;
|
||||||
|
lblConsole.Font.Size = 16;
|
||||||
|
|
||||||
|
return; // Exit
|
||||||
|
}
|
||||||
|
|
||||||
BindApplications();
|
BindApplications();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +56,17 @@ namespace WebsitePanel.Portal
|
||||||
ES.Services.HeliconZoo.GetAllowedHeliconZooQuotasForPackage(site.PackageId);
|
ES.Services.HeliconZoo.GetAllowedHeliconZooQuotasForPackage(site.PackageId);
|
||||||
Array.Sort(allowedEngineArray, new ShortHeliconZooEngineComparer());
|
Array.Sort(allowedEngineArray, new ShortHeliconZooEngineComparer());
|
||||||
|
|
||||||
// get enabled engines for this site
|
|
||||||
|
|
||||||
|
|
||||||
|
// get enabled engines for this site from applicationHost.config
|
||||||
string[] enabledEngineNames = ES.Services.HeliconZoo.GetEnabledEnginesForSite(site.SiteId, site.PackageId);
|
string[] enabledEngineNames = ES.Services.HeliconZoo.GetEnabledEnginesForSite(site.SiteId, site.PackageId);
|
||||||
ViewState["EnabledEnginesNames"] = enabledEngineNames;
|
ViewState["EnabledEnginesNames"] = enabledEngineNames;
|
||||||
|
|
||||||
//EnabledEnginesList.DataSource = enabledEngineNames;
|
//console allowed in applicationHost.config
|
||||||
//EnabledEnginesList.DataBind();
|
ViewState["IsZooWebConsoleEnabled"] = enabledEngineNames.Contains("console", StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<ShortHeliconZooEngine> allowedEngines = new List<ShortHeliconZooEngine>(allowedEngineArray);
|
List<ShortHeliconZooEngine> allowedEngines = new List<ShortHeliconZooEngine>(allowedEngineArray);
|
||||||
|
@ -55,18 +74,51 @@ namespace WebsitePanel.Portal
|
||||||
foreach (ShortHeliconZooEngine engine in allowedEngines)
|
foreach (ShortHeliconZooEngine engine in allowedEngines)
|
||||||
{
|
{
|
||||||
engine.Name = engine.Name.Replace("HeliconZoo.", "");
|
engine.Name = engine.Name.Replace("HeliconZoo.", "");
|
||||||
engine.Enabled = enabledEngineNames.Contains(engine.Name, StringComparer.OrdinalIgnoreCase);
|
//engine.Enabled = enabledEngineNames.Contains(engine.Name, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
if (engine.Name == "console")
|
||||||
|
{
|
||||||
|
//console allowed in hosting plan
|
||||||
|
ViewState["IsZooWebConsoleEnabled"] = engine.Enabled;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewState["AllowedEngines"] = allowedEngines;
|
ViewState["AllowedEngines"] = allowedEngines;
|
||||||
|
|
||||||
//AllowedEnginesList.DataSource = allowedEngines;
|
}
|
||||||
//AllowedEnginesList.DataBind();
|
|
||||||
|
private void BindInstalledApplications()
|
||||||
|
{
|
||||||
|
ViewState["IsZooEnabled"] = false;
|
||||||
|
var installedApplications = ES.Services.WebServers.GetZooApplications(PanelRequest.ItemID);
|
||||||
|
ViewState["IsZooEnabled"] = true;
|
||||||
|
|
||||||
|
if ((bool) ViewState["IsZooWebConsoleEnabled"])
|
||||||
|
{
|
||||||
|
gvInstalledApplications.DataSource = installedApplications;
|
||||||
|
gvInstalledApplications.DataBind();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HideInstalledApplications();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HideInstalledApplications()
|
||||||
|
{
|
||||||
|
gvInstalledApplications.Visible = false;
|
||||||
|
lblConsole.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindApplications()
|
private void BindApplications()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
WebAppGalleryHelpers helper = new WebAppGalleryHelpers();
|
WebAppGalleryHelpers helper = new WebAppGalleryHelpers();
|
||||||
|
|
||||||
GalleryApplicationsResult result = helper.GetGalleryApplications("ZooTemplate", PanelSecurity.PackageId);
|
GalleryApplicationsResult result = helper.GetGalleryApplications("ZooTemplate", PanelSecurity.PackageId);
|
||||||
|
|
||||||
List<GalleryApplication> applications = result.Value as List<GalleryApplication>;
|
List<GalleryApplication> applications = result.Value as List<GalleryApplication>;
|
||||||
|
@ -77,19 +129,34 @@ namespace WebsitePanel.Portal
|
||||||
{
|
{
|
||||||
foreach (GalleryApplication application in applications)
|
foreach (GalleryApplication application in applications)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
foreach (string keyword in application.Keywords)
|
foreach (string keyword in application.Keywords)
|
||||||
{
|
{
|
||||||
|
bool appAlreadyAdded = false;
|
||||||
if (keyword.StartsWith("ZooEngine", StringComparison.OrdinalIgnoreCase))
|
if (keyword.StartsWith("ZooEngine", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
string appEngine = keyword.Substring("ZooEngine".Length);
|
string appEngine = keyword.Substring("ZooEngine".Length);
|
||||||
|
|
||||||
foreach (ShortHeliconZooEngine engine in allowedEngines)
|
foreach (ShortHeliconZooEngine engine in allowedEngines)
|
||||||
{
|
{
|
||||||
|
if (!engine.Enabled)
|
||||||
|
{
|
||||||
|
continue; //skip
|
||||||
|
}
|
||||||
|
|
||||||
if (string.Equals(appEngine, engine.KeywordedName, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(appEngine, engine.KeywordedName, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
|
||||||
filteredApplications.Add(application);
|
filteredApplications.Add(application);
|
||||||
|
appAlreadyAdded = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (appAlreadyAdded)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,6 +187,11 @@ namespace WebsitePanel.Portal
|
||||||
|
|
||||||
private void UpdatedAllowedEngines()
|
private void UpdatedAllowedEngines()
|
||||||
{
|
{
|
||||||
|
if (!(bool) ViewState["IsZooEnabled"])
|
||||||
|
{
|
||||||
|
return; // exit;
|
||||||
|
}
|
||||||
|
|
||||||
List<ShortHeliconZooEngine> allowedEngines = (List<ShortHeliconZooEngine>)ViewState["AllowedEngines"];
|
List<ShortHeliconZooEngine> allowedEngines = (List<ShortHeliconZooEngine>)ViewState["AllowedEngines"];
|
||||||
string[] enabledEngineNames = (string[])ViewState["EnabledEnginesNames"];
|
string[] enabledEngineNames = (string[])ViewState["EnabledEnginesNames"];
|
||||||
|
|
||||||
|
@ -195,5 +267,44 @@ namespace WebsitePanel.Portal
|
||||||
|
|
||||||
return "~/Default.aspx?" + String.Join("&", url.ToArray());
|
return "~/Default.aspx?" + String.Join("&", url.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void gvInstalledApplications_RowCommand(object sender, GridViewCommandEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.CommandName == "EnableConsole")
|
||||||
|
{
|
||||||
|
UpdatedAllowedEngines();
|
||||||
|
|
||||||
|
string appName = e.CommandArgument.ToString();
|
||||||
|
|
||||||
|
ES.Services.WebServers.SetZooConsoleEnabled(PanelRequest.ItemID, appName);
|
||||||
|
|
||||||
|
BindInstalledApplications();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.CommandName == "DisableConsole")
|
||||||
|
{
|
||||||
|
UpdatedAllowedEngines();
|
||||||
|
|
||||||
|
string appName = e.CommandArgument.ToString();
|
||||||
|
|
||||||
|
ES.Services.WebServers.SetZooConsoleDisabled(PanelRequest.ItemID, appName);
|
||||||
|
|
||||||
|
BindInstalledApplications();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected bool IsNullOrEmpty(string value)
|
||||||
|
{
|
||||||
|
return string.IsNullOrEmpty(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string GetConsoleFullUrl(string consoleUrl)
|
||||||
|
{
|
||||||
|
WebSite site = ES.Services.WebServers.GetWebSite(PanelRequest.ItemID);
|
||||||
|
return "http://" + site.Name + consoleUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,6 +26,7 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
|
@ -40,6 +41,24 @@ namespace WebsitePanel.Portal {
|
||||||
|
|
||||||
public partial class WebSitesHeliconZooControl {
|
public partial class WebSitesHeliconZooControl {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// lblConsole control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.Label lblConsole;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// gvInstalledApplications control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.GridView gvInstalledApplications;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// gvApplications control.
|
/// gvApplications control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue