Web Console integration

This commit is contained in:
sergey 2013-05-28 15:50:32 +03:00
parent d933862a05
commit 440af2bf77
25 changed files with 2260 additions and 409 deletions

View file

@ -29,19 +29,18 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using WebsitePanel.Providers.HeliconZoo;
//
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
//
using WebsitePanel.Providers.HeliconZoo;
namespace WebsitePanel.EnterpriseServer {
using System.Xml.Serialization;
using System.Web.Services;
@ -72,9 +71,13 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback SetEnabledEnginesForSiteOperationCompleted;
private System.Threading.SendOrPostCallback IsWebCosoleEnabledOperationCompleted;
private System.Threading.SendOrPostCallback SetWebCosoleEnabledOperationCompleted;
/// <remarks/>
public esHeliconZoo() {
this.Url = "http://localhost:9005/esHeliconZoo.asmx";
this.Url = "http://localhost:9002/esHeliconZoo.asmx";
}
/// <remarks/>
@ -98,6 +101,12 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
public event SetEnabledEnginesForSiteCompletedEventHandler SetEnabledEnginesForSiteCompleted;
/// <remarks/>
public event IsWebCosoleEnabledCompletedEventHandler IsWebCosoleEnabledCompleted;
/// <remarks/>
public event SetWebCosoleEnabledCompletedEventHandler SetWebCosoleEnabledCompleted;
/// <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)]
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/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -516,4 +608,34 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
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);
}

View file

@ -85,6 +85,8 @@ namespace WebsitePanel.EnterpriseServer
allowedEngines.Add( new ShortHeliconZooEngine(){
Name = (string)reader["QuotaName"],
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
private static void UpdateQuotas(int serviceId, HeliconZooEngine[] userEngines)
{
@ -183,7 +200,7 @@ namespace WebsitePanel.EnterpriseServer
DataProvider.AddHeliconZooQuota(groupId, quotaId,
HeliconZooQuotaPrefix+engine.name,
engine.displayName,
order++);
existingQuotas.Count + order++);
}
}

View file

@ -3405,6 +3405,82 @@ namespace WebsitePanel.EnterpriseServer
}
#endregion
#region Helicon Zoo
public static List<WebVirtualDirectory> GetZooApplications(int siteItemId)
{
List<WebVirtualDirectory> dirs = new List<WebVirtualDirectory>();
// load site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
if (siteItem == null)
return dirs;
// truncate home folders
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
WebVirtualDirectory[] vdirs = web.GetZooApplications(siteItem.SiteId);
foreach (WebVirtualDirectory vdir in vdirs)
{
vdir.ContentPath = FilesController.GetVirtualPackagePath(siteItem.PackageId, vdir.ContentPath);
dirs.Add(vdir);
}
return dirs;
}
public static StringResultObject SetZooEnvironmentVariable(int siteItemId, string appName, string envName, string envValue)
{
StringResultObject result = new StringResultObject {IsSuccess = false};
// load site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
if (siteItem == null)
return result;
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
return web.SetZooEnvironmentVariable(siteItem.SiteId, appName, envName, envValue);
}
public static StringResultObject SetZooConsoleEnabled(int siteItemId, string appName)
{
StringResultObject result = new StringResultObject { IsSuccess = false };
// load site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
if (siteItem == null)
return result;
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
return web.SetZooConsoleEnabled(siteItem.SiteId, appName);
}
public static StringResultObject SetZooConsoleDisabled(int siteItemId, string appName)
{
StringResultObject result = new StringResultObject { IsSuccess = false };
// load site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
if (siteItem == null)
return result;
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
return web.SetZooConsoleDisabled(siteItem.SiteId, appName);
}
#endregion
#region WebManagement Access
public static ResultObject GrantWebManagementAccess(int siteItemId, string accountName, string accountPassword)

View file

@ -97,5 +97,17 @@ namespace WebsitePanel.EnterpriseServer
{
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);
}
}
}

View file

@ -79,6 +79,14 @@ namespace WebsitePanel.EnterpriseServer
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]
public GalleryApplicationsResult GetGalleryApplicationsFiltered(int packageId, string pattern)
{

View file

@ -443,6 +443,8 @@ namespace WebsitePanel.EnterpriseServer
#endregion
#region Helicon Ape Users
[WebMethod]
public HtaccessUser[] GetHeliconApeUsers(int siteItemId)
@ -495,6 +497,38 @@ namespace WebsitePanel.EnterpriseServer
}
#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

View file

@ -92,5 +92,7 @@ namespace WebsitePanel.Providers.HeliconZoo
void SwithEnginesEnabled(bool enabled);
string[] GetEnabledEnginesForSite(string siteId);
void SetEnabledEnginesForSite(string siteId, string[] engineNames);
bool IsWebCosoleEnabled();
void SetWebCosoleEnabled(bool enabled);
}
}

View file

@ -121,6 +121,12 @@ namespace WebsitePanel.Providers.Web
void UpdateHeliconApeGroup(string siteId, WebGroup group);
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
bool CheckLoadUserProfile();

View file

@ -78,6 +78,7 @@ namespace WebsitePanel.Providers.Web
private bool redirectPermanent;
private bool sharePointInstalled;
private bool iis7;
private string consoleUrl;
public string AnonymousUsername
{
@ -264,6 +265,12 @@ namespace WebsitePanel.Providers.Web
set { this.iis7 = value; }
}
public string ConsoleUrl
{
get { return consoleUrl; }
set { consoleUrl = value; }
}
#region Web Deploy Publishing Properties
/// <summary>
/// Gets or sets Web Deploy publishing account name

View file

@ -100,6 +100,8 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
}
}
//main engines
foreach (ConfigurationElement item in enginesCollection)
{
HeliconZooEngine newItem = ConvertElementToHeliconZooEngine(item);
@ -107,6 +109,9 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
result.Add(newItem);
}
//userEngines
ConfigurationElement userEngines = heliconZooServer.GetChildElement("userEngines");
ConfigurationElementCollection userEnginesCollection = userEngines.GetCollection();
foreach (ConfigurationElement item in userEnginesCollection)
@ -127,6 +132,17 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
}
//Web console
HeliconZooEngine webConsole = new HeliconZooEngine
{
displayName = "Web console",
name = "console"
};
result.Add(webConsole);
foreach (ConfigurationElement switchboardElement in switchboardCollection)
{
@ -352,6 +368,69 @@ 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 = (bool)switchboardElement.GetAttributeValue("enabled");
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")
{
switchboardElement.SetAttributeValue("enabled", enabled ? "true" : "false");
found = true;
break;
}
}
if (!found)
{
ConfigurationElement element = switchboardCollection.CreateElement();
element.SetAttributeValue("name", "console");
element.SetAttributeValue("enabled", enabled ? "true" : "false");
switchboardCollection.Add(element);
}
srvman.CommitChanges();
}
}
#region private methods
private void ConvertHeliconZooEngineToElement(HeliconZooEngine item, ConfigurationElement engine)

View file

@ -1563,12 +1563,18 @@ namespace WebsitePanel.Providers.Web
/// <returns>virtual directories that belong to site with supplied id.</returns>
public override WebVirtualDirectory[] GetVirtualDirectories(string siteId)
{
using (ServerManager srvman = webObjectsSvc.GetServerManager())
{
return GetVirtualDirectories(srvman, siteId);
}
}
private WebVirtualDirectory[] GetVirtualDirectories(ServerManager srvman, string siteId)
{
// get all virt dirs
@ -1938,7 +1944,6 @@ namespace WebsitePanel.Providers.Web
if (!string.IsNullOrEmpty(siteId))
{
// Check the web site app pool in integrated pipeline mode
WebSite webSite = null;
webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteId);
if (webSite == null)
@ -2585,6 +2590,85 @@ namespace WebsitePanel.Providers.Web
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
#region Secured Helicon Ape Users

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Permissions;
namespace WebsitePanel.Providers.Web.Iis.WebObjects
{
using System;
@ -661,6 +665,171 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
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
}
}
//
return vdirs.ToArray();
}
public void SetZooConsoleEnabled(ServerManager srvman, string siteId, string appName)
{
UInt32 hwidlow = (UInt32)GetVolumeSerial();
UInt64 hwidhi = ((UInt64) hwidlow) << 32;
//try
//{
// hwid = GetVolumeSerial();
//}
//catch (Exception)
//{
// hwid = 0x27356246; //magic
//}
UInt64 secret = (ulong) DateTime.Now.ToFileTime();
UInt64 hw = hwidhi | hwidlow;
secret ^= hw;
string consoleUrl = "console_" + secret.ToString();
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();
}
}
}
[DllImport("kernel32.dll")]
private static extern long GetVolumeInformation(string PathName, StringBuilder VolumeNameBuffer, UInt32 VolumeNameSize, ref UInt32 VolumeSerialNumber, ref UInt32 MaximumComponentLength, ref UInt32 FileSystemFlags, StringBuilder FileSystemNameBuffer, UInt32 FileSystemNameSize);
private static int GetVolumeSerial()
{
new FileIOPermission(PermissionState.Unrestricted).Assert();
string strDriveLetter = new string(Environment.SystemDirectory[0], 1);
uint serNum = 0;
uint maxCompLen = 0;
StringBuilder VolLabel = new StringBuilder(256); // Label
UInt32 VolFlags = new UInt32();
StringBuilder FSName = new StringBuilder(256); // File System Name
strDriveLetter += ":\\";
long Ret = GetVolumeInformation(strDriveLetter, VolLabel, (UInt32)VolLabel.Capacity, ref serNum, ref maxCompLen, ref VolFlags, FSName, (UInt32)FSName.Capacity);
return (int)serNum;
}
public WebVirtualDirectory GetVirtualDirectory(string siteId, string directoryName)
{
//
@ -737,4 +906,6 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
}
}
}
}

View file

@ -2455,6 +2455,33 @@ namespace WebsitePanel.Providers.Web
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
#region Private Helper Methods

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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
// the code is regenerated.
@ -41,6 +41,10 @@ namespace WebsitePanel.Providers.HeliconZoo {
private System.Threading.SendOrPostCallback SetEnabledEnginesForSiteOperationCompleted;
private System.Threading.SendOrPostCallback IsWebCosoleEnabledOperationCompleted;
private System.Threading.SendOrPostCallback SetWebCosoleEnabledOperationCompleted;
/// <remarks/>
public HeliconZoo() {
this.Url = "http://localhost:9003/HeliconZoo.asmx";
@ -64,6 +68,12 @@ namespace WebsitePanel.Providers.HeliconZoo {
/// <remarks/>
public event SetEnabledEnginesForSiteCompletedEventHandler SetEnabledEnginesForSiteCompleted;
/// <remarks/>
public event IsWebCosoleEnabledCompletedEventHandler IsWebCosoleEnabledCompleted;
/// <remarks/>
public event SetWebCosoleEnabledCompletedEventHandler SetWebCosoleEnabledCompleted;
/// <remarks/>
[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)]
@ -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/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -402,4 +491,34 @@ namespace WebsitePanel.Providers.HeliconZoo {
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
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);
}

View file

@ -101,5 +101,17 @@ namespace WebsitePanel.Server
{
ZooProvider.SetEnabledEnginesForSite(siteId, engineNames);
}
[WebMethod, SoapHeader("settings")]
public bool IsWebCosoleEnabled()
{
return ZooProvider.IsWebCosoleEnabled();
}
[WebMethod, SoapHeader("settings")]
public void SetWebCosoleEnabled(bool enabled)
{
ZooProvider.SetWebCosoleEnabled(enabled);
}
}
}

View file

@ -1093,6 +1093,82 @@ namespace WebsitePanel.Server
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
#region Web Application Gallery

View file

@ -123,4 +123,20 @@
<data name="SelectWebEngine.Text" xml:space="preserve">
<value>Select web application engine to set up</value>
</data>
<data name="gvInstalledApplicationsEnableConsole.Header" xml:space="preserve">
<value>Web console</value>
</data>
<data name="gvInstalledApplicationsConsoleUrl.Header" xml:space="preserve">
<value>Web console url</value>
</data>
<data name="btnEnable.Text" xml:space="preserve">
<value>Enable console for 1 day</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>

View file

@ -89,10 +89,12 @@ span.ValidationMessageBlock {
<fieldset>
<legend>
<span>Helicon Zoo engine quotas settings</span>
<span>Helicon Zoo settings</span>
</legend>
<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>
</fieldset>

View file

@ -114,6 +114,8 @@ public partial class HeliconZoo_Settings : WebsitePanelControlBase, IHostingServ
// bind 'Enable quotas' checkbox
bool enabled = ES.Services.HeliconZoo.IsEnginesEnabled(PanelRequest.ServiceId);
QuotasEnabled.Checked = !enabled;
WebCosoleEnabled.Checked = ES.Services.HeliconZoo.IsWebCosoleEnabled(PanelRequest.ServiceId);
}
else
{
@ -139,6 +141,8 @@ public partial class HeliconZoo_Settings : WebsitePanelControlBase, IHostingServ
// save switcher
ES.Services.HeliconZoo.SwithEnginesEnabled(PanelRequest.ServiceId, !QuotasEnabled.Checked);
ES.Services.HeliconZoo.SetWebCosoleEnabled(PanelRequest.ServiceId, WebCosoleEnabled.Checked);
}
protected void ClearEngineForm()

View file

@ -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>
// This code was generated by a tool.
//
@ -84,6 +56,15 @@ public partial class HeliconZoo_Settings {
/// </remarks>
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>
/// QuotasEnabled control.
/// </summary>
@ -94,13 +75,13 @@ public partial class HeliconZoo_Settings {
protected global::System.Web.UI.WebControls.CheckBox QuotasEnabled;
/// <summary>
/// EnginesPanel control.
/// WebCosoleEnabled 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;
protected global::System.Web.UI.WebControls.CheckBox WebCosoleEnabled;
/// <summary>
/// ButtonAddEngine control.

View file

@ -27,13 +27,69 @@
<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"
/>
<asp:Button ID="btnDisable" runat="server"
Text='<%# GetLocalizedString("btnDisable.Text") %>' CssClass="Button1"
CommandArgument='<%# Eval("Name") %>'
CommandName="DisableConsole"
Visible= '<%# !IsNullOrEmpty( (string)Eval("ConsoleUrl")) %>'
/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvInstalledApplicationsConsoleUrl">
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:hyperlink CssClass="MediumBold" NavigateUrl='<%# GetConsoleFullUrl((string)Eval("ConsoleUrl")) %>' runat="server" ID="lnkAppDetails" ToolTip='<%# Eval("ConsoleUrl") %>' Target="_blank">
<%# Eval("ConsoleUrl") %>
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<p>
<asp:Label runat="server" meta:resourcekey="SelectWebEngine" CssClass="NormalBold"></asp:Label>
</p>
<br />
<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">
<Columns>
<asp:TemplateField HeaderText="gvApplicationsApplication">

View file

@ -32,6 +32,7 @@ namespace WebsitePanel.Portal
ViewState["WebSitePackageId"] = site.PackageId;
BindEngines(site);
BindInstalledApplications();
BindApplications();
}
@ -42,12 +43,17 @@ namespace WebsitePanel.Portal
ES.Services.HeliconZoo.GetAllowedHeliconZooQuotasForPackage(site.PackageId);
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);
ViewState["EnabledEnginesNames"] = enabledEngineNames;
//EnabledEnginesList.DataSource = enabledEngineNames;
//EnabledEnginesList.DataBind();
//console allowed in applicationHost.config
ViewState["IsZooWebConsoleEnabled"] = enabledEngineNames.Contains("console", StringComparer.OrdinalIgnoreCase);
List<ShortHeliconZooEngine> allowedEngines = new List<ShortHeliconZooEngine>(allowedEngineArray);
@ -55,18 +61,41 @@ namespace WebsitePanel.Portal
foreach (ShortHeliconZooEngine engine in allowedEngines)
{
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;
//AllowedEnginesList.DataSource = allowedEngines;
//AllowedEnginesList.DataBind();
}
private void BindInstalledApplications()
{
if ((bool) ViewState["IsZooWebConsoleEnabled"])
{
gvInstalledApplications.DataSource = ES.Services.WebServers.GetZooApplications(PanelRequest.ItemID);
gvInstalledApplications.DataBind();
}
else
{
gvInstalledApplications.Visible = false;
lblConsole.Visible = false;
}
}
private void BindApplications()
{
WebAppGalleryHelpers helper = new WebAppGalleryHelpers();
GalleryApplicationsResult result = helper.GetGalleryApplications("ZooTemplate", PanelSecurity.PackageId);
List<GalleryApplication> applications = result.Value as List<GalleryApplication>;
@ -77,19 +106,34 @@ namespace WebsitePanel.Portal
{
foreach (GalleryApplication application in applications)
{
foreach (string keyword in application.Keywords)
{
bool appAlreadyAdded = false;
if (keyword.StartsWith("ZooEngine", StringComparison.OrdinalIgnoreCase))
{
string appEngine = keyword.Substring("ZooEngine".Length);
foreach (ShortHeliconZooEngine engine in allowedEngines)
{
if (!engine.Enabled)
{
continue; //skip
}
if (string.Equals(appEngine, engine.KeywordedName, StringComparison.OrdinalIgnoreCase))
{
filteredApplications.Add(application);
appAlreadyAdded = true;
break;
}
}
if (appAlreadyAdded)
{
break;
}
}
}
}
@ -195,5 +239,44 @@ namespace WebsitePanel.Portal
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;
}
}
}

View file

@ -26,6 +26,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -40,6 +41,24 @@ namespace WebsitePanel.Portal {
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>
/// gvApplications control.
/// </summary>