private void InitialiseMenu()
        {
            // Don't bother initialising again if we've done it already
            if (m_Initialised)
            {
                return;
            }

            // Assume we're initialised now, as we're going to
            // run the initialise process below to do stuff.
            m_Initialised = true;

            // Add the basic admin pages.  These are available to all users
            // so we don't bother to include them in the Admin Navigation XML
            // file, as this is not required.
            DropDownMenu1.Items.Add(new DropDownMenuItem("« Catalogue", "~/SearchResults.aspx"));
            DropDownMenu1.Items.Add(new DropDownMenuItem("Admin Home", "~/Admin/Default.aspx"));

            // Get the parent page, which has the ID of the selected navigation item
            BaseAdminPage parentPage = (BaseAdminPage)Page;

            m_CurrentPageId = parentPage.PageId.ToLower();

            // Get a list of all the admin sections available to the current user
            IEnumerable <AdminSection> adminSections = AdminNavigationManager.GetAdminSectionsForUser(SessionInfo.Current.User);

            foreach (AdminSection adminSection in adminSections)
            {
                // Create the root level menu item.  This will correspond to
                // each AdminSection specified in the Admin Navigation XML file
                DropDownMenuItem rootMenuItem = new DropDownMenuItem {
                    Text = adminSection.Name, Visible = adminSection.VisibleOnNavigation
                };

                // Now iterate through all of the pages in the admin section and add
                // these to the item.  This will also add any child pages.
                foreach (AdminSectionPage adminSectionPage in adminSection.AdminSectionPages)
                {
                    AddItems(rootMenuItem, adminSectionPage);
                }

                var visibleCount = (from item in rootMenuItem.Items
                                    where (item.Visible)
                                    select item).Count();

                if (visibleCount > 0)
                {
                    DropDownMenu1.Items.Add(rootMenuItem);
                }
            }

            // Assume we're on the homepage if no page ID is specified
            if (parentPage.PageId == string.Empty)
            {
                m_CurrentItem = DropDownMenu1.Items[1];
            }
        }
Exemple #2
0
 public AP_ADMIN_ADSSteps(BaseAdminPage baseAdminPage,
                          LoginAdminPage loginAdminPage,
                          Context context,
                          MenuDashboardPage menuDashboardPage
                          )
 {
     _baseAdminPage     = baseAdminPage;
     _loginAdminPage    = loginAdminPage;
     _context           = context;
     _menuDashboardPage = menuDashboardPage;
 }