using System; using System.Data; using System.Collections; using System.Web; using System.Web.UI; using CMS.GlobalHelper; using CMS.PortalControls; using CMS.Reporting; using CMS.WebAnalytics; using CMS.CMSHelper; using CMS.PortalEngine; public partial class CMSWebParts_Reporting_Table : CMSAbstractWebPart { #region "Properties" /// /// Gets or sets table name. /// public string TableName { get { return ValidationHelper.GetString(GetValue("ReportTable"), ""); } set { SetValue("ReportTable", value); } } /// /// Gets or sets the XML schema of parameters dataset. /// public string ParametersXmlSchema { get { return ValidationHelper.GetString(GetValue("ParametersXmlSchema"), String.Empty); } set { SetValue("ParametersXmlSchema", value); } } /// /// Indicates whether enable export /// public bool EnableExport { get { return ValidationHelper.GetBoolean(GetValue("EnableExport"), true); } set { SetValue("EnableExport", value); } } /// /// Enables/disables paging for tables /// public bool EnablePaging { get { return ValidationHelper.GetBoolean(GetValue("EnablePaging"), false); } set { SetValue("EnablePaging", value); } } /// /// If true, chart subscription is enabled /// public bool EnableSubscription { get { return ValidationHelper.GetBoolean(GetValue("EnableSubscription"), false); } set { SetValue("EnableSubscription", value); } } /// /// Page size for paged tables /// public int PageSize { get { return ValidationHelper.GetInteger(GetValue("PageSize"), 0); } set { SetValue("PageSize", value); } } /// /// Gets or sets chart name in format reportname;itemname. /// public string ParametersXmlData { get { return ValidationHelper.GetString(GetValue("ParametersXmlData"), String.Empty); } set { SetValue("ParametersXmlData", value); } } /// /// Interval of time range. /// public HitsIntervalEnum RangeInterval { get { return HitsIntervalEnumFunctions.StringToHitsConversion(ValidationHelper.GetString(GetValue("Range"), "none")); } set { SetValue("Range", HitsIntervalEnumFunctions.HitsConversionToString(value)); } } /// /// Value of range interval. /// public int RangeValue { get { return ValidationHelper.GetInteger(GetValue("RangeValue"), 0); } set { SetValue("RangeValue", value); } } #endregion #region "Methods" /// /// Content loaded event handler. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Initializes the control properties. /// protected void SetupControl() { if (StopProcessing) { // Do nothing } else { string[] items = TableName.Split(';'); if ((items != null) && (items.Length == 2)) { ucTable.Parameter = items[0] + "." + items[1]; ucTable.ReportItemName = items[0] + ";" + items[1]; ucTable.CacheItemName = CacheItemName; ucTable.CacheMinutes = CacheMinutes; ucTable.CacheDependencies = CacheDependencies; ucTable.ItemType = ReportItemType.Graph; ucTable.LoadDefaultParameters(ParametersXmlData, ParametersXmlSchema); ucTable.RangeInterval = RangeInterval; ucTable.RangeValue = RangeValue; ucTable.EnableExport = EnableExport; ucTable.EnablePaging = EnablePaging; ucTable.PageSize = PageSize; ucTable.IsLiveSite = (CMSContext.ViewMode == ViewModeEnum.LiveSite); ; ucTable.EnableSubscription = EnableSubscription; } } } /// /// Reloads data. /// public override void ReloadData() { base.ReloadData(); SetupControl(); ucTable.ReloadData(true); } /// /// Prerenders the control. /// protected override void OnPreRender(EventArgs e) { if (!StopProcessing) { ucTable.ReloadData(true); } // Set visibility of current webpart with dependence on graph visibility Visible = ucTable.Visible; base.OnPreRender(e); } #endregion }