using System; using System.Data; using System.Collections; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using CMS.GlobalHelper; using CMS.PortalControls; public partial class CMSWebParts_Navigation_cmssitemap : CMSAbstractWebPart { #region "Document properties" /// /// Gets or sets the cache minutes. /// public override int CacheMinutes { get { return base.CacheMinutes; } set { base.CacheMinutes = value; smElem.CacheMinutes = value; } } /// /// Gets or sets the cache item dependencies. /// public override string CacheDependencies { get { return base.CacheDependencies; } set { base.CacheDependencies = value; smElem.CacheDependencies = value; } } /// /// Gets or sets the name of the cache item. If not explicitly specified, the name is automatically /// created based on the control unique ID /// public override string CacheItemName { get { return base.CacheItemName; } set { base.CacheItemName = value; smElem.CacheItemName = value; } } /// /// Gets or sets the value that indicates whether permissions are checked. /// public bool CheckPermissions { get { return ValidationHelper.GetBoolean(GetValue("CheckPermissions"), smElem.CheckPermissions); } set { SetValue("CheckPermissions", value); smElem.CheckPermissions = value; } } /// /// Gets or sets the class names. /// public string ClassNames { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("Classnames"), smElem.ClassNames), smElem.ClassNames); } set { SetValue("ClassNames", value); smElem.ClassNames = value; } } /// /// Gets or sets the value that indicates whether selected documents are combined with default culture. /// public bool CombineWithDefaultCulture { get { return ValidationHelper.GetBoolean(GetValue("CombineWithDefaultCulture"), smElem.CombineWithDefaultCulture); } set { SetValue("CombineWithDefaultCulture", value); smElem.CombineWithDefaultCulture = value; } } /// /// Gets or sets the culture code. /// public string CultureCode { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("CultureCode"), smElem.CultureCode), smElem.CultureCode); } set { SetValue("CultureCode", value); smElem.CultureCode = value; } } /// /// Gets or sets the maximal relative level. /// public int MaxRelativeLevel { get { return ValidationHelper.GetInteger(GetValue("MaxRelativeLevel"), smElem.MaxRelativeLevel); } set { SetValue("MaxRelativeLevel", value); smElem.MaxRelativeLevel = value; } } /// /// Gets or sets the order by clause. /// public string OrderBy { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("OrderBy"), smElem.OrderBy), smElem.OrderBy); } set { SetValue("OrderBy", value); smElem.OrderBy = value; } } /// /// Gets or sets the nodes path. /// public string Path { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("Path"), smElem.Path), smElem.Path); } set { SetValue("Path", value); smElem.Path = value; } } /// /// Gets or sets the value that indicates whether selected documents must be published. /// public bool SelectOnlyPublished { get { return ValidationHelper.GetBoolean(GetValue("SelectOnlyPublished"), smElem.SelectOnlyPublished); } set { SetValue("SelctOnlyPublished", value); smElem.SelectOnlyPublished = value; } } /// /// Gets or sets the site name. /// public string SiteName { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("SiteName"), smElem.SiteName), smElem.SiteName); } set { SetValue("SiteName", value); smElem.SiteName = value; } } /// /// Gets or sets the where condition. /// public string WhereCondition { get { return DataHelper.GetNotEmpty(GetValue("WhereCondition"), smElem.WhereCondition); } set { SetValue("WhereCondition", value); smElem.WhereCondition = value; } } /// /// Gets or sets the value that indicates whether item ID will be rendered. /// public bool RenderLinkTitle { get { return ValidationHelper.GetBoolean(GetValue("RenderLinkTitle"), smElem.RenderLinkTitle); } set { SetValue("RenderLinkTitle", value); smElem.RenderLinkTitle = value; } } /// /// Gets or sets the value that indicates whether text can be wrapped or space is replaced with non breakable space. /// public bool WordWrap { get { return ValidationHelper.GetBoolean(GetValue("WordWrap"), smElem.WordWrap); } set { SetValue("WordWrap", value); smElem.WordWrap = value; } } /// /// Gets or sets the link URL target. /// public string UrlTarget { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("UrlTarget"), smElem.UrlTarget), smElem.UrlTarget); } set { SetValue("UrlTarget", value); smElem.UrlTarget = value; } } /// /// Gets or sets the value that indicates whether control should be hidden if no data found. /// public bool HideControlForZeroRows { get { return ValidationHelper.GetBoolean(GetValue("HideControlForZeroRows"), smElem.HideControlForZeroRows); } set { SetValue("HideControlForZeroRows", value); smElem.HideControlForZeroRows = value; } } /// /// Gets or sets the text which is displayed for zero rows results. /// public string ZeroRowsText { get { return ValidationHelper.GetString(GetValue("ZeroRowsText"), smElem.ZeroRowsText); } set { SetValue("ZeroRowsText", value); smElem.ZeroRowsText = value; } } /// /// Gets or sets the filter name. /// public string FilterName { get { return ValidationHelper.GetString(GetValue("FilterName"), smElem.FilterName); } set { SetValue("FilterName", value); smElem.FilterName = value; } } /// /// Gets or sets the value that indicates whether the sitemap should apply menu inactivation flag. /// public bool ApplyMenuInactivation { get { return ValidationHelper.GetBoolean(GetValue("ApplyMenuInactivation"), true); } set { SetValue("ApplyMenuInactivation", value); } } /// /// Gets or sets property which indicates if menu caption should be HTML encoded. /// public bool EncodeMenuCaption { get { return ValidationHelper.GetBoolean(GetValue("EncodeMenuCaption"), smElem.EncodeMenuCaption); } set { SetValue("EncodeMenuCaption", value); smElem.EncodeMenuCaption = value; } } /// /// Gets or sets the columns to be retrieved from database. /// public string Columns { get { return ValidationHelper.GetString(GetValue("Columns"), smElem.Columns); } set { SetValue("Columns", value); smElem.Columns = value; } } #endregion /// /// Content loaded event handler. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Initializes the control properties. /// protected void SetupControl() { if (StopProcessing) { smElem.StopProcessing = true; } else { smElem.ControlContext = ControlContext; // Set properties from Webpart form smElem.CacheItemName = CacheItemName; smElem.CacheDependencies = CacheDependencies; smElem.CacheMinutes = CacheMinutes; smElem.CheckPermissions = CheckPermissions; smElem.ClassNames = ClassNames; smElem.CombineWithDefaultCulture = CombineWithDefaultCulture; smElem.CultureCode = CultureCode; smElem.MaxRelativeLevel = MaxRelativeLevel; smElem.OrderBy = OrderBy; smElem.Path = Path; smElem.SelectOnlyPublished = SelectOnlyPublished; smElem.SiteName = SiteName; smElem.UrlTarget = UrlTarget; smElem.WhereCondition = WhereCondition; smElem.RenderLinkTitle = RenderLinkTitle; smElem.WordWrap = WordWrap; smElem.ApplyMenuInactivation = ApplyMenuInactivation; smElem.HideControlForZeroRows = HideControlForZeroRows; smElem.ZeroRowsText = ZeroRowsText; smElem.FilterName = FilterName; smElem.EncodeMenuCaption = EncodeMenuCaption; smElem.Columns = Columns; } } /// /// OnPrerender override (Set visibility). /// protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); Visible = smElem.Visible; if (DataHelper.DataSourceIsEmpty(smElem.DataSource) && (smElem.HideControlForZeroRows)) { Visible = false; } } }