using System; using System.Data; using System.Web; using System.Web.UI; using CMS.CMSHelper; using CMS.GlobalHelper; using CMS.PortalControls; public partial class CMSWebParts_Navigation_cmsbreadcrumbs : CMSAbstractWebPart { #region "Document properties" /// /// Gets or sets the cache minutes. /// public override int CacheMinutes { get { return ValidationHelper.GetInteger(GetValue("CacheMinutes"), bcElem.CacheMinutes); } set { SetValue("CacheMinutes", value); bcElem.CacheMinutes = value; } } /// /// Gets or sets the value that indicates whether permissions are checked. /// public bool CheckPermissions { get { return ValidationHelper.GetBoolean(GetValue("CheckPermissions"), bcElem.CheckPermissions); } set { SetValue("CheckPermissions", 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"), bcElem.CombineWithDefaultCulture); } set { SetValue("CombineWithDefaultCulture", value); bcElem.CombineWithDefaultCulture = value; } } /// /// Gets or sets the culture code. /// public string CultureCode { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("CultureCode"), bcElem.CultureCode), bcElem.CultureCode); } set { SetValue("CultureCode", value); bcElem.CultureCode = value; } } /// /// Gets or sets the nodes alias path. /// public string Path { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("Path"), bcElem.Path), bcElem.Path); } set { SetValue("Path", value); bcElem.Path = CMSContext.ResolveCurrentPath(value); } } /// /// Gets or sets the value that indicates whether selected documents must be published. /// public bool SelectOnlyPublished { get { return ValidationHelper.GetBoolean(GetValue("SelectOnlyPublished"), bcElem.SelectOnlyPublished); } set { SetValue("SelctOnlyPublished", value); bcElem.SelectOnlyPublished = value; } } /// /// Gets or sets the site name. /// public string SiteName { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("SiteName"), bcElem.SiteName), bcElem.SiteName); } set { SetValue("SiteName", value); bcElem.SiteName = value; } } /// /// Gets or sets the value that indicates whether the link name should be encoded. /// public bool EncodeName { get { return ValidationHelper.GetBoolean(GetValue("EncodeName"), bcElem.EncodeName); } set { SetValue("EncodeName", value); bcElem.EncodeName = value; } } /// /// Filter name. /// public string FilterName { get { return ValidationHelper.GetString(GetValue("FilterName"), bcElem.FilterName); } set { SetValue("FilterName", value); bcElem.FilterName = value; } } #endregion #region "Public properties" /// /// Gets or sets the where condition. /// public string WhereCondition { get { return ValidationHelper.GetString(GetValue("WhereCondition"), bcElem.WhereCondition); } set { SetValue("WhereCondition", value); bcElem.WhereCondition = value; } } /// /// Gets or sets the value that indicates whether breadcrumbs is rendered with rtl direction for specific languages. /// public bool UseRtlBehaviour { get { return ValidationHelper.GetBoolean(GetValue("UseRtlBehaviour"), bcElem.UseRtlBehaviour); } set { SetValue("UseRtlBehaviour", value); bcElem.UseRtlBehaviour = value; } } /// /// Gets or sets the breadcrumb separator. /// public string BreadcrumbSeparator { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("BreadCrumbSeparator"), bcElem.BreadCrumbSeparator), bcElem.BreadCrumbSeparator); } set { SetValue("BreadCrumbSeparator", value); bcElem.BreadCrumbSeparator = value; } } /// /// Gets or sets the default path. /// public string DefaultPath { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("DefaultPath"), bcElem.DefaultPath), bcElem.DefaultPath); } set { SetValue("DefaultPath", value); if (!String.IsNullOrEmpty(value)) { bcElem.DefaultPath = CMSContext.ResolveCurrentPath(value); } else { bcElem.DefaultPath = value; } } } /// /// Gets or sets the selected nodes starting path. /// public string SelectNodesStartPath { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("SelectNodesStartPath"), bcElem.StartingPath), bcElem.StartingPath); } set { SetValue("SelectNodesStartPath", value); if (!String.IsNullOrEmpty(value)) { bcElem.StartingPath = CMSContext.ResolveCurrentPath(value); } else { bcElem.StartingPath = value; } } } /// /// Gets or sets the value that indicates whether current item is displayed. /// public bool ShowCurrentItem { get { return ValidationHelper.GetBoolean(GetValue("ShowCurrentItem"), bcElem.ShowCurrentItem); } set { SetValue("ShowCurrentItem", value); bcElem.ShowCurrentItem = value; } } /// /// Gets or sets the value that indicates whether current item is link. /// public bool ShowCurrentItemAsLink { get { return ValidationHelper.GetBoolean(GetValue("ShowCurrentItemAsLink"), bcElem.ShowCurrentItemAsLink); } set { SetValue("ShowCurrentItemAsLink", value); bcElem.ShowCurrentItemAsLink = value; } } /// /// Gets or sets the URL target. /// public string UrlTarget { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("UrlTarget"), bcElem.UrlTarget), bcElem.UrlTarget); } set { SetValue("UrlTarget", value); bcElem.UrlTarget = value; } } /// /// Gets or sets the breadcrumb separator for RTL culture. /// public string BreadcrumbSeparatorRTL { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("BreadCrumbSeparatorRTL"), bcElem.BreadCrumbSeparatorRTL), bcElem.BreadCrumbSeparatorRTL); } set { SetValue("BreadCrumbSeparatorRTL", value); bcElem.BreadCrumbSeparatorRTL = value; } } /// /// Gets or sets the class names. /// public string ClassNames { get { return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("Classnames"), bcElem.ClassNames), bcElem.ClassNames); } set { SetValue("ClassNames", value); bcElem.ClassNames = value; } } /// /// Gets or sets the value that indicates whether document menu item properties are applied. /// public bool ApplyMenuDesign { get { return ValidationHelper.GetBoolean(GetValue("ApplyMenuDesign"), bcElem.ApplyMenuDesign); } set { SetValue("ApplyMenuDesign", value); } } /// /// Gets or sets the value that indicates whether link title is rendered. /// public bool RenderLinkTitle { get { return ValidationHelper.GetBoolean(GetValue("RenderLinkTitle"), bcElem.RenderLinkTitle); } set { SetValue("RenderLinkTitle", value); bcElem.RenderLinkTitle = value; } } /// /// Gets or sets the value that indicates whether the document value ShowInNavigation is ignored. /// public bool IgnoreShowInNavigation { get { return ValidationHelper.GetBoolean(GetValue("IgnoreShowInNavigation"), bcElem.IgnoreShowInNavigation); } set { SetValue("IgnoreShowInNavigation", value); bcElem.IgnoreShowInNavigation = 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"), bcElem.HideControlForZeroRows); } set { SetValue("HideControlForZeroRows", value); bcElem.HideControlForZeroRows = value; } } /// /// Gets or sets the text which is displayed for zero rows results. /// public string ZeroRowsText { get { return ValidationHelper.GetString(GetValue("ZeroRowsText"), bcElem.ZeroRowsText); } set { SetValue("ZeroRowsText", value); bcElem.ZeroRowsText = value; } } /// /// Gets or sets the columns to be retrieved from database. /// public string Columns { get { return ValidationHelper.GetString(GetValue("Columns"), bcElem.Columns); } set { SetValue("Columns", value); bcElem.Columns = value; } } /// /// Gets or sets the cache item name. /// public override string CacheItemName { get { return base.CacheItemName; } set { base.CacheItemName = value; bcElem.CacheItemName = value; } } /// /// Gets or sets the cache item dependencies. /// public override string CacheDependencies { get { return base.CacheDependencies; } set { base.CacheDependencies = value; bcElem.CacheDependencies = value; } } #endregion /// /// Content loaded event handler. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Initializes the control properties. /// protected void SetupControl() { if (StopProcessing) { bcElem.StopProcessing = true; } else { bcElem.ControlContext = ControlContext; // Document properties bcElem.CacheItemName = CacheItemName; bcElem.CacheDependencies = CacheDependencies; bcElem.CacheMinutes = CacheMinutes; bcElem.CheckPermissions = CheckPermissions; bcElem.CombineWithDefaultCulture = CombineWithDefaultCulture; bcElem.CultureCode = CultureCode; bcElem.Path = Path; bcElem.SelectOnlyPublished = SelectOnlyPublished; bcElem.SiteName = SiteName; bcElem.BreadCrumbSeparator = BreadcrumbSeparator; bcElem.DefaultPath = DefaultPath; bcElem.StartingPath = SelectNodesStartPath; bcElem.ShowCurrentItem = ShowCurrentItem; bcElem.ShowCurrentItemAsLink = ShowCurrentItemAsLink; bcElem.UrlTarget = UrlTarget; bcElem.RenderLinkTitle = RenderLinkTitle; bcElem.IgnoreShowInNavigation = IgnoreShowInNavigation; bcElem.UseRtlBehaviour = UseRtlBehaviour; bcElem.BreadCrumbSeparatorRTL = BreadcrumbSeparatorRTL; bcElem.ClassNames = ClassNames; bcElem.ApplyMenuDesign = ApplyMenuDesign; bcElem.WhereCondition = WhereCondition; bcElem.FilterName = FilterName; bcElem.EncodeName = EncodeName; bcElem.HideControlForZeroRows = HideControlForZeroRows; bcElem.ZeroRowsText = ZeroRowsText; bcElem.Columns = Columns; } } /// /// OnPrerender override (Set visibility). /// protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); Visible = bcElem.Visible && !StopProcessing; if (DataHelper.DataSourceIsEmpty(bcElem.DataSource) && bcElem.HideControlForZeroRows) { Visible = false; } } }