using CMS.GlobalHelper; using CMS.PortalControls; public partial class CMSWebParts_DataSources_XMLDataSource : CMSAbstractWebPart { #region "Properties" /// /// Gets or sets the XML URL. /// public string XmlUrl { get { return ValidationHelper.GetString(GetValue("XmlUrl"), ""); } set { SetValue("XmlUrl", value); srcXml.XmlUrl = value; } } /// /// Gets or sets the XML schema URL. /// public string XmlSchemaUrl { get { return ValidationHelper.GetString(GetValue("XmlSchemaUrl"), ""); } set { SetValue("XmlSchemaUrl", value); srcXml.XmlSchemaUrl = value; } } /// /// Gets or sets WHERE condition. /// public string WhereCondition { get { return ValidationHelper.GetString(GetValue("WhereCondition"), ""); } set { SetValue("WhereCondition", value); srcXml.WhereCondition = value; } } /// /// Gets or sets ORDER BY condition. /// public string OrderBy { get { return ValidationHelper.GetString(GetValue("OrderBy"), ""); } set { SetValue("OrderBy", value); srcXml.OrderBy = value; } } /// /// Gets or sets top N selected documents. /// public int SelectTopN { get { return ValidationHelper.GetInteger(GetValue("SelectTopN"), 0); } set { SetValue("SelectTopN", value); srcXml.TopN = value; } } /// /// Gets or sets the source filter name. /// public string FilterName { get { return ValidationHelper.GetString(GetValue("FilterName"), ""); } set { SetValue("FilterName", value); srcXml.SourceFilterName = value; } } /// /// Gets or sets the cache item name. /// public override string CacheItemName { get { return base.CacheItemName; } set { base.CacheItemName = value; srcXml.CacheItemName = value; } } /// /// Cache dependencies, each cache dependency on a new line. /// public override string CacheDependencies { get { return ValidationHelper.GetString(base.CacheDependencies, srcXml.CacheDependencies); } set { base.CacheDependencies = value; srcXml.CacheDependencies = value; } } /// /// Gets or sets the cache minutes. /// public override int CacheMinutes { get { return base.CacheMinutes; } set { base.CacheMinutes = value; srcXml.CacheMinutes = value; } } /// /// Gets or sets the name of dataset table which will be used as datasource. /// public string TableName { get { return ValidationHelper.GetString(GetValue("TableName"), ""); } set { SetValue("TableName", value); srcXml.TableName = value; } } #endregion #region "Methods" /// /// Content loaded event handler. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Initializes control properties. /// protected void SetupControl() { if (StopProcessing) { // Do nothing } else { srcXml.XmlUrl = XmlUrl; srcXml.XmlSchemaUrl = XmlSchemaUrl; srcXml.WhereCondition = WhereCondition; srcXml.OrderBy = OrderBy; srcXml.TopN = SelectTopN; srcXml.FilterName = ValidationHelper.GetString(GetValue("WebPartControlID"), ClientID); srcXml.SourceFilterName = FilterName; srcXml.CacheItemName = CacheItemName; srcXml.CacheDependencies = CacheDependencies; srcXml.CacheMinutes = CacheMinutes; srcXml.TableName = TableName; } } /// /// Clears cache. /// public override void ClearCache() { srcXml.ClearCache(); } #endregion }