private void AddLocalsMenu(Control ul) { // County Admins always see a local menu // Masters and State Admins see it if they are on a County or Local Admin page string stateCode = null; string countyCode = null; if (SecurePage.IsCountyAdminUser || (SecurePage.IsMasterUser || SecurePage.IsStateAdminUser) && (SecurePage.IsCountyAdminPage || SecurePage.IsLocalAdminPage)) { stateCode = SecurePage.FindStateCode(); countyCode = SecurePage.FindCountyCode(); } var template = "/admin/{page}?state={StateCode}&county={CountyCode}&local={LocalKey}"; if (SecurePage.IsStateAdminUser) { template = "/admin/{page}?county={CountyCode}&local={LocalKey}"; } else if (SecurePage.IsCountyAdminUser) { template = "/admin/{page}?local={LocalKey}"; } template = GetMenuPage(template); if (stateCode != null && countyCode != null) { AddMenuItem(ul, "Locals", GetLocalsMenu(template, stateCode, countyCode)); } }
private void AddCountiesMenu(Control ul) { // State Admins always see a counties menu // Masters see it if they are on a page with a state code var stateCode = SecurePage.FindStateCode(); if (!StateCache.IsValidStateCode(stateCode)) { return; } var template = Empty; if (SecurePage.IsMasterUser && !IsNullOrWhiteSpace(stateCode)) { template = "/admin/{page}?state={StateCode}&county={CountyCode}"; } else if (SecurePage.IsStateAdminUser) { template = "/admin/{page}?county={CountyCode}"; } if (!IsNullOrWhiteSpace(template)) { template = GetMenuPage(template); AddMenuItem(ul, " Counties", GetCountiesMenu(template, stateCode)); } }
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); } }
private static void AddJurisdictionsMenu(Control ul) { var stateCode = SecurePage.FindStateCode(); AddMenuItem(ul, "Jurisdictions", SecureAdminPage.GetUpdateJurisdictionsPageUrl(stateCode, SecurePage.FindCountyCode(), SecurePage.FindLocalKey())); }
private static void AddElectionsMenu(Control ul) { // Admins always see an elections menu // Masters see it if they are on any Admin page string stateCode = null; if (SecurePage.IsMasterUser && SecurePage.IsAdminPage) { stateCode = SecurePage.FindStateCode(); } if (SecurePage.IsAdminUser || StateCache.IsValidStateCode(stateCode)) { AddMenuItem(ul, "Elections", SecureAdminPage.GetUpdateElectionsPageUrl(stateCode, SecurePage.FindCountyCode(), SecurePage.FindLocalKey())); } }