using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CMS.CMSHelper; using CMS.GlobalHelper; using CMS.PortalControls; using CMS.PortalEngine; using CMS.SettingsProvider; using CMS.WebAnalytics; public partial class CMSWebParts_WebAnalytics_AnalyticsBrowserCapabilities : CMSAbstractWebPart { #region "Properties" /// /// Indicates whether log resolution. /// public bool LogResolution { get { return ValidationHelper.GetBoolean(GetValue("LogResolution"), false); } set { SetValue("LogResolution", value); } } /// /// Indicates whether log color depth. /// public bool LogColorDepth { get { return ValidationHelper.GetBoolean(GetValue("LogColorDepth"), false); } set { SetValue("LogColorDepth", value); } } /// /// Indicates whether log resolution. /// public bool LogOperatingSystem { get { return ValidationHelper.GetBoolean(GetValue("LogOperatingSystem"), false); } set { SetValue("LogOperatingSystem", value); } } /// /// Indicates whether log flash. /// public bool LogFlash { get { return ValidationHelper.GetBoolean(GetValue("LogFlash"), false); } set { SetValue("LogFlash", value); } } /// /// Indicates whether log silverlight. /// public bool LogSilverlight { get { return ValidationHelper.GetBoolean(GetValue("LogSilverlight"), false); } set { SetValue("LogSilverlight", value); } } /// /// Indicates whether log java. /// public bool LogJava { get { return ValidationHelper.GetBoolean(GetValue("LogJava"), false); } set { SetValue("LogJava", value); } } #endregion #region "Methods" /// /// Content loaded event handler /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Initializes the control properties. /// protected void SetupControl() { if (!StopProcessing && AnalyticsHelper.IsLoggingEnabled(CMSContext.CurrentSiteName, CMSContext.CurrentAliasPath)) { // If already in session or livesite .. do not register info calling if ((SessionHelper.GetValue("BrowserCapatibilities") == null) && (ViewMode == ViewModeEnum.LiveSite)) { Guid checkGuid = Guid.NewGuid(); String parameters = String.Format("{0},{1},{2},{3},{4},{5},'{6}','{7}'", LogResolution.ToString().ToLowerCSafe(), LogColorDepth.ToString().ToLowerCSafe(), LogOperatingSystem.ToString().ToLowerCSafe(), LogSilverlight.ToString().ToLowerCSafe(), LogJava.ToString().ToLowerCSafe(), LogFlash.ToString().ToLowerCSafe() , ResolveUrl("~/CMSModules/WebAnalytics/Pages/Content/AnalyticsLog.aspx"), checkGuid.ToString()); ScriptHelper.RegisterStartupScript(this, typeof(string), "BrowserCapatibilitiesInit", ScriptHelper.GetScript("collectBrowserData(" + parameters + ")")); ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/BrowserCapabilities.js"); SessionHelper.SetValue("BrowserCapatibilities", checkGuid.ToString()); } } } /// /// Reload control's data. /// public override void ReloadData() { base.ReloadData(); SetupControl(); } #endregion }