using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using VwdCms.Configuration;
namespace VwdCms.Admin
{
public class ToolbarBottom : Toolbar
{
private EventHandler _serverClick;
private string _imageUrl = VwdCms.Configuration.Utilities.AdminImageUrl;
private bool _useIconMatrix = false;
private string _labelFontColor = "white";
public bool UseIconMatrix
{
get { return _useIconMatrix; }
set { _useIconMatrix = value; }
}
public string ImageUrl
{
get { return _imageUrl; }
set { _imageUrl = value; }
}
public void ApplyCmsSettings()
{
bool showImg = !VwdCms.Configuration.CmsConfig.Current.CmsSettings.SlowConnection;
if (showImg != this.ShowImages)
{
this.ShowImages = showImg;
this.ClearItems();
this.LoadItems();
}
}
public override void LoadItems()
{
if (!this.ItemsLoaded)
{
ToolbarItem ti = null;
HtmlGenericControl div = null;
CmsConfig cfg = CmsConfig.Current;
CmsHost host = cfg.CurrentHost;
bool demo = host.DemoMode;
this.ShowImages = !cfg.CmsSettings.SlowConnection;
string target = null;
string unavailable = string.Empty;
if (demo)
{
unavailable = " is not available in Demo Mode";
target = "_blank";
}
div = CreateToolbarText(" Tools: ");
ti = new ToolbarItem("tbtTools", null, div);
this.Items.Add(ti.Name, ti);
bool useIconMatrix = this.UseIconMatrix;
ti = new ToolbarItem("MainMenu", _imageUrl + "mainmenu.gif", "VWD-CMS Main Menu", "MM", "../MainMenu.aspx", target, useIconMatrix);
this.Items.Add(ti.Name, ti);
ti = new ToolbarItem("ConfigEditor", _imageUrl + "configeditor.gif", "CMS Configuration Editor" + unavailable, "CE", null, useIconMatrix);
ti.Enabled = !demo;
this.Items.Add(ti.Name, ti);
ti = new ToolbarItem("ServerSettings", _imageUrl + "serversettings.gif", "CMS and IIS Server Settings", "SS", null, useIconMatrix);
this.Items.Add(ti.Name, ti);
ti = new ToolbarItem("SiteMap", _imageUrl + "sitemap.gif", "Site Map Tool", "ST", "SiteMapTool.aspx", target, useIconMatrix);
this.Items.Add(ti.Name, ti);
ti = new ToolbarItem("Backup", _imageUrl + "backup.gif", "Website Backup" + unavailable, "WB", "../Backup/Backup.aspx", null, useIconMatrix);
ti.Enabled = !demo;
this.Items.Add(ti.Name, ti);
ti = new ToolbarItem("Find", _imageUrl + "find.gif", "Find in Files (Search and Replace)" + unavailable, "FF", "Find.aspx", null, useIconMatrix);
ti.Enabled = !demo;
this.Items.Add(ti.Name, ti);
ti = new ToolbarItem("Encoder", _imageUrl + "encode.gif", "Encode and Decode Content", "EN", "Encoder.aspx", "_blank", useIconMatrix);
this.Items.Add(ti.Name, ti);
ti = ToolbarItem.Separator();
this.Items.Add(ti.Name, ti);
div = CreateToolbarText(this.HostName);
ti = new ToolbarItem("tbtHostName", null, div);
this.Items.Add(ti.Name, ti);
ti = ToolbarItem.Separator();
this.Items.Add(ti.Name, ti);
div = CreateToolbarText(this.UserName);
ti = new ToolbarItem("tbtUserName", null, div);
this.Items.Add(ti.Name, ti);
ti = ToolbarItem.Separator();
this.Items.Add(ti.Name, ti);
div = CreateToolbarText(this.ImpersonationLevel);
ti = new ToolbarItem("tbtImpersonation", null, div);
this.Items.Add(ti.Name, ti);
ti = ToolbarItem.Separator();
this.Items.Add(ti.Name, ti);
// client information
string text = null;
HttpBrowserCapabilities browser = this.Page.Request.Browser;
text = browser.Type.Replace(" ", " ");
div = CreateToolbarText(text);
ti = new ToolbarItem("tbtBrowserType", null, div);
this.Items.Add(ti.Name, ti);
ti = ToolbarItem.Separator();
this.Items.Add(ti.Name, ti);
text = "EcmaScript: " + browser.EcmaScriptVersion.ToString().Replace(" ", " ");
div = CreateToolbarText(text);
ti = new ToolbarItem("tbtJavaScript", null, div);
this.Items.Add(ti.Name, ti);
ti = ToolbarItem.Separator();
this.Items.Add(ti.Name, ti);
text = "CSS: " + (browser.SupportsCss ? "Supported" : "Not Supported");
text = text.Replace(" ", " ");
div = CreateToolbarText(text);
ti = new ToolbarItem("tbtCSS", null, div);
this.Items.Add(ti.Name, ti);
ti = ToolbarItem.Separator();
this.Items.Add(ti.Name, ti);
text = "DOM: " + browser.W3CDomVersion.ToString();
text = text.Replace(" ", " ");
div = CreateToolbarText(text);
ti = new ToolbarItem("tbtDOM", null, div);
this.Items.Add(ti.Name, ti);
ti = ToolbarItem.Separator();
this.Items.Add(ti.Name, ti);
text = "Window Size: ";
text = text.Replace(" ", " ");
div = CreateToolbarText(text);
div.ID = "tbtWindowSize";
ti = new ToolbarItem("tbtWindowSize", null, div);
this.Items.Add(ti.Name, ti);
ti = ToolbarItem.Separator();
this.Items.Add(ti.Name, ti);
base.LoadItems();
}
}
private HtmlGenericControl CreateToolbarText(string text)
{
HtmlGenericControl div = new HtmlGenericControl("div");
div.Attributes.Add("class", "VwdCmsAdmin_ToolbarText");
if (!this.ShowImages)
{
div.Style.Add("color", _labelFontColor);
}
div.InnerHtml = text;
return div;
}
public EventHandler ServerClick
{
get { return _serverClick; }
set
{
_serverClick = value;
}
}
public string HostName
{
get { return Convert.ToString(this.ViewState["HostName"]); }
set { this.ViewState["HostName"] = value; }
}
public string UserName
{
get { return Convert.ToString(this.ViewState["UserName"]); }
set { this.ViewState["UserName"] = value; }
}
public string ImpersonationLevel
{
get { return Convert.ToString(this.ViewState["ImpersonationLevel"]); }
set { this.ViewState["ImpersonationLevel"] = value; }
}
}
}