Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        private static HtmlAnchor CreateOfficePageAnchor(string stateCode, string countyCode,
                                                         string localKey, OfficeClass officeClass, string text)
        {
            var a = new HtmlAnchor
            {
                HRef      = SecureAdminPage.GetUpdateOfficesPageUrl(stateCode, countyCode, localKey, officeClass),
                Target    = "office",
                InnerHtml = text
            };

            return(a);
        }
Exemplo n.º 3
0
        private static void AddOfficesMenu(Control ul)
        {
            // Admins always see an offices menu
            // Masters see it if they are on any Admin page
            string stateCode = null;

            if (SecurePage.IsAdminUser ||
                (SecurePage.IsMasterUser && SecurePage.IsAdminPage))
            {
                stateCode = SecurePage.GetViewStateStateCode();
            }
            if (StateCache.IsValidStateCode(stateCode))
            {
                AddMenuItem(ul, "Offices",
                            SecureAdminPage.GetUpdateOfficesPageUrl(stateCode,
                                                                    SecurePage.GetViewStateCountyCode(), SecurePage.GetViewStateLocalCode()));
            }
        }