/// <summary>
 /// Determines if a tab is simply a placeholder in the navigation
 /// </summary>
 public override bool IsPlaceholder(int pageID)
 {
     return
         (bool.Parse(
              UrlBuilderHelper.PageSpecificProperty(pageID, UrlBuilderHelper.IsPlaceHolderID, _cacheMinutes).
              ToString()));
 }
        /// <summary>
        /// Returns the page name that has been specified.
        /// </summary>
        public override string UrlPageName(int pageID)
        {
            string _urlPageName =
                UrlBuilderHelper.PageSpecificProperty(pageID, UrlBuilderHelper.PageNameID, _cacheMinutes).ToString();

            // TODO: URL Firendly names need to be fixed
            if (_urlPageName.Length == 0)
            {
                _urlPageName = _friendlyPageName;
            }

            return(_urlPageName);
        }
 /// <summary>
 /// Clears the cached url element settings
 /// </summary>
 public override void Clear(int pageID)
 {
     UrlBuilderHelper.ClearUrlElements(pageID);
 }
        /// <summary>
        /// Takes a Tab ID and builds the url for get the desidered page (non default)
        /// containing the application path, portal alias, tab ID, and language.
        /// </summary>
        /// <param name="targetPage">Linked page</param>
        /// <param name="pageID">ID of the page</param>
        /// <param name="modID">ID of the module</param>
        /// <param name="culture">Client culture</param>
        /// <param name="customAttributes">Any custom attribute that can be needed. Use the following format...single attribute: paramname--paramvalue . Multiple attributes: paramname--paramvalue/paramname2--paramvalue2/paramname3--paramvalue3 </param>
        /// <param name="currentAlias">Current Alias</param>
        /// <param name="urlKeywords">Add some keywords to uniquely identify this tab. Usual source is UrlKeyword from TabSettings.</param>
        public override string BuildUrl(string targetPage, int pageID, int modID, CultureInfo culture,
                                        string customAttributes, string currentAlias, string urlKeywords)
        {
            bool   _isPlaceHolder = false;
            string _tabLink       = string.Empty;
            string _urlKeywords   = string.Empty;
            string _pageName      = _friendlyPageName;

            // Get Url Elements this helper method (Will either retrieve from cache or database)
            UrlBuilderHelper.GetUrlElements(pageID, _cacheMinutes, ref _isPlaceHolder, ref _tabLink, ref _urlKeywords,
                                            ref _pageName);

            //2_aug_2004 Cory Isakson
            //Begin Navigation Enhancements
            if (!(targetPage.ToLower().EndsWith(_ignoreTargetPage.ToLower())))
            // Do not modify URLs when working with TabLayout Administration Page
            {
                // if it is a placeholder it is not supposed to have any url
                if (_isPlaceHolder)
                {
                    return(string.Empty);
                }

                // if it is a tab link it means it is a link to an external resource
                if (_tabLink.Length != 0)
                {
                    return(_tabLink);
                }
            }
            //End Navigation Enhancements
            StringBuilder sb = new StringBuilder();

            // Obtain ApplicationPath
            if (targetPage.StartsWith("~/"))
            {
                sb.Append(UrlBuilderHelper.ApplicationPath);
                targetPage = targetPage.Substring(2);
            }
            sb.Append("/");

            if (!targetPage.EndsWith(".aspx")) //Images
            {
                sb.Append(targetPage);
                return(sb.ToString());
            }

            HttpContext.Current.Trace.Warn("Target Page = " + targetPage);

            // Separate path
            // If page contains path, or it is not an aspx
            // or handlerFlag is not set: do not use handler
            if (targetPage.LastIndexOf('/') > 0 || !targetPage.EndsWith(".aspx") || _handlerFlag.Length == 0)
            {
                sb.Append(targetPage);
                sb.Append("?");
                // Add pageID to URL
                sb.Append("pageID=");
                sb.Append(pageID.ToString());

                // Add Alias to URL
                if (_aliasInUrl)
                {
                    sb.Append("&alias="); // changed for compatibility with handler
                    sb.Append(currentAlias);
                }

                // Add ModID to URL
                if (modID > 0)
                {
                    sb.Append("&mid=");
                    sb.Append(modID.ToString());
                }

                // Add Language to URL
                if (_langInUrl)
                {
                    sb.Append("&lang=");     // changed for compatibility with handler
                    sb.Append(culture.Name); // manu fix: culture.Name
                }

                // Add custom attributes
                if (customAttributes != null && customAttributes != string.Empty)
                {
                    sb.Append("&");
                    customAttributes = customAttributes.ToString().Replace("/", "&");
                    customAttributes = customAttributes.ToString().Replace(_defaultSplitter, "=");
                    sb.Append(customAttributes);
                }
                return(sb.ToString().Replace("&&", "&"));
            }
            else // use handler
            {
                // Add smarturl tag
                sb.Append(_handlerFlag);
                sb.Append("/");

                // Add custom Keywords to the Url
                if (urlKeywords != null && urlKeywords != string.Empty)
                {
                    sb.Append(urlKeywords);
                    sb.Append("/");
                }
                else
                {
                    urlKeywords = _urlKeywords;

                    // Add custom Keywords to the Url
                    if (urlKeywords != null && urlKeywords.Length != 0)
                    {
                        sb.Append(urlKeywords);
                        sb.Append("/");
                    }
                }

                // Add Alias to URL
                if (_aliasInUrl)
                {
                    sb.Append("alias");
                    sb.Append(_defaultSplitter + currentAlias);
                    sb.Append("/");
                }

                // Add Language to URL
                if (_langInUrl)
                {
                    sb.Append("lang");
                    sb.Append(_defaultSplitter + culture.Name);
                    sb.Append("/");
                }
                // Add ModID to URL
                if (modID > 0)
                {
                    sb.Append("mid");
                    sb.Append(_defaultSplitter + modID.ToString());
                    sb.Append("/");
                }

                // Add custom attributes
                if (customAttributes != null && customAttributes != string.Empty)
                {
                    customAttributes = customAttributes.ToString().Replace("&", "/");
                    customAttributes = customAttributes.ToString().Replace("=", _defaultSplitter);
                    sb.Append(customAttributes);
                    sb.Append("/");
                }

                if (_pageidNoSplitter)
                {
                    // Add pageID to URL
                    sb.Append("pageid");
                    sb.Append(_defaultSplitter + pageID);
                    sb.Append("/");
                }
                else
                {
                    sb.Append(pageID);
                    sb.Append("/");
                }

                // TODO : Need to fix page names rewrites
                // if (targetPage == DefaultPage)
                //		sb.Append(_pageName);
                //	else
                //		sb.Append(targetPage);
                sb.Append(_friendlyPageName);

                //Return page
                return(sb.ToString().Replace("//", "/"));
            }
        }
 /// <summary>
 /// Returns any keywords which are meant to be placed in the url
 /// </summary>
 public override string UrlKeyword(int pageID)
 {
     return
         (UrlBuilderHelper.PageSpecificProperty(pageID, UrlBuilderHelper.UrlKeywordsID, _cacheMinutes).ToString());
 }
 /// <summary>
 /// Returns the URL for a tab that is a link only.
 /// </summary>
 public override string TabLink(int pageID)
 {
     return(UrlBuilderHelper.PageSpecificProperty(pageID, UrlBuilderHelper.TabLinkID, _cacheMinutes));
 }