Beispiel #1
0
        private void addCatalogToSiteMap(SiteMapNodeCollection parentNodeCollection,
                                         DbContentCatalog rootCatalog, DbContentCatalog catalog)
        {
            if (!catalog.Enabled || !catalog.MenuEnabled)
            {
                return;
            }

            DbContentClipCollection clips;
            SiteMapNode             catalogMenuNode;
            IconInfo leftIconInfo, rightIconInfo;
            CssInfo  catalogCssInfo;

            clips = catalog.GetMenuEnabledClips();
            clips.Sort(ContentCompareKey.MenuOrder);

            catalogMenuNode = new SiteMapNode();
            parentNodeCollection.Add(catalogMenuNode);

            catalogMenuNode.Text    = catalog.MenuLabel;
            catalogMenuNode.ToolTip = catalog.MenuTooltip;

            if (catalog.DefaultClip != null)
            {
                if (catalog.DefaultClip.OverrideUrl != string.Empty)
                {
                    catalogMenuNode.NavigateUrl = catalog.DefaultClip.OverrideUrl;
                }
                else
                {
                    catalogMenuNode.NavigateUrl = string.Format(_linkFormat, catalog.DefaultClip.ID);
                }

                catalogMenuNode.ID = catalog.DefaultClip.ID.ToString();
            }

            if (catalog.MenuCssClass == "[rootcatalog]")
            {
                catalogCssInfo = new CssInfo(rootCatalog.MenuCssClass);
            }
            else
            {
                catalogCssInfo = new CssInfo(catalog.MenuCssClass);
            }

            if (catalog.MenuLeftIcon == "[rootcatalog]")
            {
                leftIconInfo = new IconInfo(rootCatalog.MenuLeftIcon);
            }
            else
            {
                leftIconInfo = new IconInfo(catalog.MenuLeftIcon);
            }

            if (catalog.MenuRightIcon == "[rootcatalog]")
            {
                rightIconInfo = new IconInfo(rootCatalog.MenuRightIcon);
            }
            else
            {
                rightIconInfo = new IconInfo(catalog.MenuRightIcon);
            }

            DbContentCatalogCollection childCatalogs = catalog.GetCatalogs();

            childCatalogs.Sort(ContentCompareKey.MenuOrder);

            foreach (DbContentCatalog childCatalog in childCatalogs)
            {
                addCatalogToSiteMap(catalogMenuNode.Nodes, rootCatalog, childCatalog);
            }

            addClipsToSiteMap(catalogMenuNode.Nodes, rootCatalog, catalog, clips);
        }
Beispiel #2
0
        private void addCatalogToMenu(ComponentArt.Web.UI.MenuItemCollection parentItemCollection,
                                      DbContentCatalog rootCatalog, DbContentCatalog catalog)
        {
            if (!catalog.Enabled || !catalog.MenuEnabled)
            {
                return;
            }

            DbContentClipCollection clips;

            ComponentArt.Web.UI.MenuItem catalogMenuItem;
            IconInfo leftIconInfo, rightIconInfo;
            CssInfo  catalogCssInfo;

            clips = catalog.GetMenuEnabledClips();
            clips.Sort(ContentCompareKey.MenuOrder);

            catalogMenuItem = new ComponentArt.Web.UI.MenuItem();
            parentItemCollection.Add(catalogMenuItem);

            catalogMenuItem.Text    = catalog.MenuLabel;
            catalogMenuItem.ToolTip = catalog.MenuTooltip;

            if (catalog.DefaultClip != null)
            {
                if (catalog.DefaultClip.OverrideUrl != string.Empty)
                {
                    catalogMenuItem.NavigateUrl = catalog.DefaultClip.OverrideUrl;
                }
                else
                {
                    catalogMenuItem.NavigateUrl = string.Format(_linkFormat, catalog.DefaultClip.ID);
                }

                catalogMenuItem.ID = catalog.DefaultClip.ID.ToString();
            }

            if (catalog.MenuCssClass == "[rootcatalog]" |
                catalog.MenuCssClass == "")
            {
                catalogCssInfo = new CssInfo(rootCatalog.MenuCssClass);
            }
            else
            {
                catalogCssInfo = new CssInfo(catalog.MenuCssClass);
            }

            if (catalog.MenuLeftIcon == "[rootcatalog]" |
                catalog.MenuCssClass == "")
            {
                leftIconInfo = new IconInfo(rootCatalog.MenuLeftIcon);
            }
            else
            {
                leftIconInfo = new IconInfo(catalog.MenuLeftIcon);
            }

            if (catalog.MenuRightIcon == "[rootcatalog]" |
                catalog.MenuCssClass == "")
            {
                rightIconInfo = new IconInfo(rootCatalog.MenuRightIcon);
            }
            else
            {
                rightIconInfo = new IconInfo(catalog.MenuRightIcon);
            }

            catalogCssInfo.SetLook(catalogMenuItem);
            leftIconInfo.SetLeftLook(catalogMenuItem);
            rightIconInfo.SetRightLook(catalogMenuItem);

            DbContentCatalogCollection childCatalogs = catalog.GetCatalogs();;

            childCatalogs.Sort(ContentCompareKey.SortOrder);

            foreach (DbContentCatalog childCatalog in childCatalogs)
            {
                addCatalogToMenu(catalogMenuItem.Items, rootCatalog, childCatalog);
            }

            addClipsToMenu(catalogMenuItem.Items, rootCatalog, catalog, clips);
        }