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

@ -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)
@ -126,6 +131,17 @@ namespace WebsitePanel.Providers.Web.HeliconZoo
result.Add(newItem);
}
//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)