Пример #1
0
        public void Bind()
        {
            DbContentClipCollection rootCatalogClips;
            CssInfo rootCssInfo;

            // Load the catalog to start building a menu from
            rootCatalogClips = __rootCatalog.GetClips();
            rootCatalogClips.Sort(ContentCompareKey.MenuOrder);

            // Set menu css to catalog css properties
            rootCssInfo = new CssInfo(__rootCatalog.MenuCssClass);

            if (__looksEnabled)
            {
                rootCssInfo.SetLook(__menu);
            }

            DbContentCatalogCollection catalogs = __rootCatalog.GetCatalogs();

            catalogs.Sort(ContentCompareKey.MenuOrder);

            for (int catalogIndex = 0; catalogIndex < catalogs.Count; catalogIndex++)
            {
                addCatalogToMenu(__menu.Items, catalogs[catalogIndex]);
            }

            addClipsToMenu(__menu.Items, __rootCatalog, rootCatalogClips);
        }
Пример #2
0
//		Menu clipContextMenu	= new Menu();

        /// <summary>
        /// Ensures that the catalogs are loaded.
        /// </summary>
        private void EnsureCatalogs()
        {
            if (catalogs == null)
            {
                DbContentCatalogManager m = new DbContentCatalogManager();
                catalogs = m.GetCollection(string.Empty, string.Empty, null);
                catalogs.Sort(ContentCompareKey.MenuOrder);
            }
        }
Пример #3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            EnsureChildControls();

            // Cached menus are already Loaded
            if (_cached)
            {
                return;
            }

            DbContentCatalog        rootCatalog;
            DbContentClipCollection rootCatalogClips;
            CssInfo rootCssInfo;

            // Load the catalog to start building a menu from
            rootCatalog      = new DbContentCatalog(_catalogID);
            rootCatalogClips = rootCatalog.GetClips();
            rootCatalogClips.Sort(ContentCompareKey.MenuOrder);

            // Set menu css to catalog css properties
            rootCssInfo = new CssInfo(rootCatalog.MenuCssClass);
            rootCssInfo.SetLook(_menu);

            DbContentCatalogCollection catalogs = rootCatalog.GetCatalogs();

            catalogs.Sort(ContentCompareKey.MenuOrder);

            for (int catalogIndex = 0; catalogIndex < catalogs.Count; catalogIndex++)
            {
                addCatalogToMenu(_menu.Items, rootCatalog, catalogs[catalogIndex]);
            }

            addClipsToMenu(_menu.Items, rootCatalog, rootCatalog, rootCatalogClips);

            _menu.Width = _width;

            MenuCacheControl.SetMenu(_catalogID, _linkFormat, _menu);
        }
Пример #4
0
        protected override void OnLoad(EventArgs e)
        {
            EnsureChildControls();

            // Cached menus are already Loaded
            if (_cached)
            {
                return;
            }

            DbContentCatalog rootCatalog;

//			CssInfo rootCssInfo;

            // Load the catalog to start building a menu from
            rootCatalog = new DbContentCatalog(_catalogID);

            DbContentCatalogCollection catalogs = rootCatalog.GetCatalogs();;

            catalogs.Sort(ContentCompareKey.MenuOrder);

            for (int catalogIndex = 0; catalogIndex < catalogs.Count; catalogIndex++)
            {
                addCatalogToSiteMap(_siteMap.Nodes, rootCatalog, catalogs[catalogIndex]);
            }

            DbContentClipCollection clips = rootCatalog.GetClips();

            clips.Sort(ContentCompareKey.MenuOrder);

            addClipsToSiteMap(_siteMap.Nodes, rootCatalog, rootCatalog, clips);

            _siteMap.Width = _width;

            SiteMapCacheControl.SetSiteMap(_catalogID, _linkFormat, _siteMap);
        }
Пример #5
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);
        }
Пример #6
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);
        }