private static void AddMasterOfficesMenu(Control parent) { // Masters only see it if they are on an Admin page if (!SecurePage.IsMasterUser) { return; } string stateCode = null; if (SecurePage.IsAdminPage) { stateCode = SecurePage.FindStateCode(); } if (StateCache.IsValidStateCode(stateCode)) { var ul = CreateDropdownMenu(); var countyCode = SecurePage.FindCountyCode(); var localKey = SecurePage.FindLocalKey(); AddMenuItem(ul, "Manage Offices, Office Templates and Incumbents", SecureAdminPage.GetUpdateOfficesPageUrl(stateCode, countyCode, localKey)); AddMenuItem(ul, "Offices Report", SecureAdminPage.GetOfficesPageUrl(stateCode, countyCode, localKey)); AddMenuItem(ul, "Incumbents Report", SecureAdminPage.GetOfficialsPageUrl(stateCode, countyCode, localKey)); AddMenuItem(ul, "Download County or Local Offices CSV", SecureAdminPage.GetAdminFolderPageUrl("DownloadOfficesCsv", "state", stateCode)); AddMenuItem(parent, "Offices", ul); } }
protected void Page_Load(object sender, EventArgs e) { _SecureAdminPage = VotePage.GetPage <SecureAdminPage>(); if (_SecureAdminPage == null) { throw new VoteException( "The SelectJurisdictionButton control can only be used in the" + " SecureAdminPage class"); } if (!IsPostBack) { Page.IncludeCss("~/css/vote/controls/SelectJurisdictionButton.css"); if (IsNullOrWhiteSpace(AdminPageName)) { var match = Regex.Match(VotePage.CurrentPath, @"/([^./]+)\."); if (!match.Success) { throw new VoteException("Missing AdminPageName"); } AdminPageName = match.Groups[1].Value; } StateLink.NavigateUrl = SecureAdminPage.GetAdminFolderPageUrl(AdminPageName, "state", _SecureAdminPage.StateCode); StateLink.Text = "► " + StateCache.GetStateName(_SecureAdminPage.StateCode); switch (_SecureAdminPage.AdminPageLevel) { case AdminPageLevel.State: if (AddClasses) { Container.AddCssClasses("state"); } break; case AdminPageLevel.County: StateLink.Visible = true; if (AddClasses) { Container.AddCssClasses("county"); } break; case AdminPageLevel.Local: StateLink.Visible = true; if (AddClasses) { Container.AddCssClasses("local"); } CountyLink.Visible = true; CountyLink.NavigateUrl = SecureAdminPage.GetAdminFolderPageUrl(AdminPageName, "state", _SecureAdminPage.StateCode, "county", _SecureAdminPage.CountyCode); CountyLink.Text = "► " + CountyCache.GetCountyName(_SecureAdminPage.StateCode, _SecureAdminPage.CountyCode); break; } } }