Beispiel #1
0
        /// <summary>
        /// This is the recursive function to add all tabs with it's child tabs
        /// </summary>
        private void RecurseSitemap(TabStripDetails tab, int level)
        {
            //only add tabs we have access to
            if (PortalSecurity.IsInRoles(tab.AuthorizedRoles))
            {
                //first add the tab, then add it's children
                list.Add(new SitemapItem(tab.TabID, tab.TabName, Rainbow.HttpUrlBuilder.BuildUrl(tab.TabID), level));

                for (int i = 0; i < tab.Tabs.Count; ++i)
                {
                    RecurseSitemap(tab.Tabs[i], level + 1);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// This function creates from the PortalSettings structure a list with the tabs in the right order
        /// </summary>
        private void MakeSitemap()
        {
            bool currentTabOnly = (Bind == BindOption.BindOptionCurrentChilds);

            PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];

            int level = 0;

            // Add Portal Root when showing all tabs
            if (!currentTabOnly)
            {
                list.Add(new SitemapItem(0, portalSettings.PortalName, Rainbow.HttpUrlBuilder.BuildUrl("~/"), 0));
                level++;
            }

            // Now loop all tabs to find the right ones to init the recursive functions
            for (int i = 0; i < portalSettings.DesktopTabs.Count; ++i)
            {
                TabStripDetails tab = (Rainbow.Configuration.TabStripDetails)portalSettings.DesktopTabs[i];

                //if showing all tabs, look for root tabs
                if (!currentTabOnly)
                {
                    if (tab.ParentTabID == 0)
                    {
                        RecurseSitemap(tab, level);
                    }
                }
                else
                {
                    //else find the current tab
                    int tabID = (showTabID > 0)? showTabID : portalSettings.ActiveTab.TabID;
                    if (tab.TabID == tabID)
                    {
                        RecurseSitemap(tab, level);
                    }
                }
            }
        }