Exemplo n.º 1
0
        private void MakeFirmaMenu(Person currentPerson)
        {
            TopLevelLtInfoMenuItems = new List <LtInfoMenuItem>
            {
                BuildAboutMenu(currentPerson),
                BuildProjectsMenu(currentPerson),
                BuildFinancialsMenuItem(currentPerson),
                BuildProgramInfoMenu(currentPerson)
            };
            TopLevelLtInfoMenuItems.Add(BuildManageMenu(currentPerson));

            TopLevelLtInfoMenuItems.ForEach(x => x.ExtraTopLevelMenuCssClasses = new List <string> {
                "navigation-root-item"
            });
            TopLevelLtInfoMenuItems.SelectMany(x => x.ChildMenus).ToList().ForEach(x => x.ExtraTopLevelMenuCssClasses = new List <string> {
                "navigation-dropdown-item"
            });

            HelpMenu = new LtInfoMenuItem("Help");
            HelpMenu.AddMenuItem(LtInfoMenuItem.MakeItem("Request Support",
                                                         ModalDialogFormHelper.ModalDialogFormLink("Request Support", RequestSupportUrl, "Request Support", 800,
                                                                                                   "Submit Request", "Cancel", new List <string>(), null, null).ToString(), "ToolHelp"));
            HelpMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.Training()), currentPerson, "Training", "ToolHelp"));
            HelpMenu.AddMenuItem(LtInfoMenuItem.MakeItem("About ProjectFirma",
                                                         @"<a href='http://www.sitkatech.com/products/ProjectFirma/projectfirma-faqs/' target='_blank'>About ProjectFirma <span class='glyphicon glyphicon-new-window'></span></a>", "ExternalHelp"));
        }
Exemplo n.º 2
0
        private static void AddCustomPagesToMenu(FirmaSession currentFirmaSession, FirmaMenuItem menuType, LtInfoMenuItem topLevelMenu, string menuGroupName)
        {
            MultiTenantHelpers.GetCustomPages(menuType).ForEach(x =>
            {
                var isVisible = new CustomPageViewFeature().HasPermission(currentFirmaSession, x).HasPermission;
                if (isVisible)
                {
                    // var customPageUrl = null;
                    switch (menuType.ToEnum)
                    {
                    case FirmaMenuItemEnum.About:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.About(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;

                    case FirmaMenuItemEnum.Projects:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.Project(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;

                    case FirmaMenuItemEnum.ProgramInfo:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.ProgramInfo(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;

                    case FirmaMenuItemEnum.Results:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.Results(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;

                    default:
                        topLevelMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.About(x.CustomPageVanityUrl)), currentFirmaSession, x.CustomPageDisplayName, menuGroupName));
                        break;
                    }
                }
            });
        }
Exemplo n.º 3
0
        private static LtInfoMenuItem BuildProgramInfoMenu(Person currentPerson)
        {
            var programInfoMenu = new LtInfoMenuItem("Program Info");

            programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <PriorityLandscapeController>(c => c.Index()), currentPerson, "Priority Landscapes", "Group2"));
            programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <DNRUplandRegionController>(c => c.Index()), currentPerson, Models.FieldDefinition.DNRUplandRegion.GetFieldDefinitionLabelPluralized(), "Group2"));
            programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <FocusAreaController>(c => c.Index()), currentPerson, Models.FieldDefinition.FocusArea.GetFieldDefinitionLabelPluralized(), "Group2"));
            if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship())
            {
                programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectStewardOrganizationController>(c => c.Index()), currentPerson, $"{Models.FieldDefinition.ProjectStewardOrganizationDisplayName.GetFieldDefinitionLabelPluralized()}", "Group3"));
            }
            programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <OrganizationController>(c => c.Index()), currentPerson, $"{Models.FieldDefinition.Organization.GetFieldDefinitionLabelPluralized()}", "Group3"));


            MultiTenantHelpers.GetCustomPagesByNavigationSection(CustomPageNavigationSectionEnum.ProgramInfo).ForEach(x =>
            {
                var isVisible = x.CustomPageDisplayType == CustomPageDisplayType.Public ||
                                (!currentPerson.IsAnonymousUser &&
                                 x.CustomPageDisplayType == CustomPageDisplayType.Protected);
                if (isVisible)
                {
                    programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.About(x.CustomPageVanityUrl)), currentPerson, x.CustomPageDisplayName, "Group4"));
                }
            });

            return(programInfoMenu);
        }
Exemplo n.º 4
0
        private static LtInfoMenuItem BuildProjectsMenu(Person currentPerson)
        {
            var projectsMenu = new LtInfoMenuItem($"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}");

            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ResultsController>(c => c.ProjectMap()), currentPerson, $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} Map", "Group1"));
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectController>(c => c.Index()), currentPerson, $"Full {Models.FieldDefinition.Project.GetFieldDefinitionLabel()} List", "Group2"));
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProgramInfoController>(c => c.Taxonomy()), currentPerson, MultiTenantHelpers.GetTaxonomySystemName(), "Group2"));
            MultiTenantHelpers.GetClassificationSystems().ForEach(x =>
            {
                projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProgramInfoController>(c => c.ClassificationSystem(x.ClassificationSystemID)), currentPerson, x.ClassificationSystemDefinition, "Group2"));
            });
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectController>(c => c.Proposed()), currentPerson, $"{Models.FieldDefinition.Application.GetFieldDefinitionLabelPluralized()}", "Group3"));
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectController>(c => c.Pending()), currentPerson, $"Pending {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}", "Group3"));

            if (new GrantAllocationAwardLandownerCostShareLineItemViewFeature().HasPermissionByPerson(currentPerson))
            {
                projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <GrantAllocationAwardLandownerCostShareLineItemController>(tac => tac.Index()), currentPerson, "DNR Cost Share Treatments", "Group4"));
            }

            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <InteractionEventController>(iec => iec.Index()), currentPerson, $"Full {Models.FieldDefinition.InteractionEvent.GetFieldDefinitionLabelPluralized()} List", "Group5"));

            MultiTenantHelpers.GetCustomPagesByNavigationSection(CustomPageNavigationSectionEnum.Projects).ForEach(x =>
            {
                var isVisible = x.CustomPageDisplayType == CustomPageDisplayType.Public ||
                                (!currentPerson.IsAnonymousUser &&
                                 x.CustomPageDisplayType == CustomPageDisplayType.Protected);
                if (isVisible)
                {
                    projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.About(x.CustomPageVanityUrl)), currentPerson, x.CustomPageDisplayName, "Group6"));
                }
            });


            return(projectsMenu);
        }
Exemplo n.º 5
0
        private static LtInfoMenuItem BuildProgramInfoMenu(FirmaSession currentFirmaSession)
        {
            var programInfoMenu = new LtInfoMenuItem(FirmaMenuItem.ProgramInfo.GetFirmaMenuItemDisplayName());

            programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProgramInfoController>(c => c.Taxonomy()), currentFirmaSession, MultiTenantHelpers.GetTaxonomySystemName(), "Group1"));

            MultiTenantHelpers.GetClassificationSystems().ForEach(x =>
            {
                programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProgramInfoController>(c => c.ClassificationSystem(x.ClassificationSystemID)), currentFirmaSession, ClassificationSystemModelExtensions.GetClassificationSystemNamePluralized(x), "Group1"));
            });
            programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <PerformanceMeasureController>(c => c.Index()), currentFirmaSession, MultiTenantHelpers.GetPerformanceMeasureNamePluralized(), "Group1"));

            foreach (var geospatialAreaType in HttpRequestStorage.DatabaseEntities.GeospatialAreaTypes.ToList())
            {
                programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <GeospatialAreaController>(c => c.Index(geospatialAreaType)), currentFirmaSession, $"{geospatialAreaType.GeospatialAreaTypeNamePluralized}", "Group2"));
            }

            if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship())
            {
                programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectStewardOrganizationController>(c => c.Index()), currentFirmaSession, $"{FieldDefinitionEnum.ProjectStewardOrganizationDisplayName.ToType().GetFieldDefinitionLabelPluralized()}", "Group3"));
            }
            programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <OrganizationController>(c => c.Index()), currentFirmaSession, $"{FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabelPluralized()}", "Group3"));
            programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <FundingSourceController>(c => c.Index()), currentFirmaSession, $"{FieldDefinitionEnum.FundingSource.ToType().GetFieldDefinitionLabelPluralized()}", "Group3"));

            programInfoMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <WebServicesController>(c => c.Index()), currentFirmaSession, $"Web Services", "Group4"));

            AddCustomPagesToMenu(currentFirmaSession, FirmaMenuItem.ProgramInfo, programInfoMenu, "Group5");

            return(programInfoMenu);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Financials Top-Level menu
        /// </summary>
        private static LtInfoMenuItem BuildFinancialsMenuItem(Person currentPerson)
        {
            var financialsMenu = new LtInfoMenuItem("Financials");

            financialsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <GrantController>(c => c.Index()), currentPerson,
                                                               $"Full {Models.FieldDefinition.Grant.GetFieldDefinitionLabel()} List", "Group1"));

            financialsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <AgreementController>(c => c.Index()), currentPerson, $"Full { Models.FieldDefinition.Agreement.GetFieldDefinitionLabel()} List", "Group2"));

            financialsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <InvoiceController>(c => c.Index()), currentPerson,
                                                               $"Full { Models.FieldDefinition.Invoice.GetFieldDefinitionLabel()} List", "Group3"));

            MultiTenantHelpers.GetCustomPagesByNavigationSection(CustomPageNavigationSectionEnum.Financials).ForEach(x =>
            {
                var isVisible = x.CustomPageDisplayType == CustomPageDisplayType.Public ||
                                (!currentPerson.IsAnonymousUser &&
                                 x.CustomPageDisplayType == CustomPageDisplayType.Protected);
                if (isVisible)
                {
                    financialsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.About(x.CustomPageVanityUrl)), currentPerson, x.CustomPageDisplayName, "Group4"));
                }
            });

            return(financialsMenu);
        }
        public void CanRenderSimpleMenuTest()
        {
            var menuItem1 = new LtInfoMenuItem("url1", "menu1", true, false, null);
            var result    = menuItem1.RenderMenu();

            Approvals.Verify(result);
        }
        public void TopLevelMenuItemWithNoChildrenShouldNotRenderTest()
        {
            var menuItem1 = new LtInfoMenuItem("menu1");
            var result    = menuItem1.RenderMenu().ToString();

            Assert.That(result, Is.EqualTo(string.Empty), "Is top level menu and has no children and has no url, should return empty");
        }
        public void CanRenderBlankMenuTest()
        {
            var menuItem1 = new LtInfoMenuItem("menu1");
            var result    = menuItem1.RenderMenu().ToString();

            Assert.That(result, Is.EqualTo(string.Empty), "No visible menu items, should return empty");
        }
Exemplo n.º 10
0
        private static LtInfoMenuItem BuildProjectsMenu(FirmaSession currentFirmaSession)
        {
            var projectsMenu = new LtInfoMenuItem(FirmaMenuItem.Projects.GetFirmaMenuItemDisplayName());

            // Group 1 - Project map & full project list
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ResultsController>(c => c.ProjectMap()), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Map", "Group1"));
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectController>(c => c.Index()), currentFirmaSession, $"Full {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} List", "Group1"));

            // Group 2 - My Organization's Projects & Organizations Project Finder Page
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectController>(c => c.MyOrganizationsProjects()), currentFirmaSession, $"My {FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()}'s {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", "Group2"));

            if (MultiTenantHelpers.GetTenantAttributeFromCache().EnableMatchmaker&& currentFirmaSession.Person?.Organization != null)
            {
                projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectFinderController>(c => c.Organization(currentFirmaSession.Person.OrganizationID)), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Finder", "Group2"));
            }

            // Group 3 - Proposals and pending projects
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectController>(c => c.Proposed()), currentFirmaSession, $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()}", "Group3"));
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectController>(c => c.Pending()), currentFirmaSession, $"Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", "Group3"));

            // Group 4 - Attachments
            projectsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectAttachmentController>(c => c.ProjectAttachmentIndex()), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Attachments", "Group4"));

            AddCustomPagesToMenu(currentFirmaSession, FirmaMenuItem.Projects, projectsMenu, "Group5");

            return(projectsMenu);
        }
Exemplo n.º 11
0
        /// <summary>
        /// I'm giving Agreements their own menu, but I'm not wedded to this. Move these around if you have a good reason. -- SLG
        /// </summary>
        /// <param name="currentFirmaSession"></param>
        /// <returns></returns>
        private static LtInfoMenuItem BuildAgreementsMenu(FirmaSession currentFirmaSession)
        {
            var agreementsMenu = new LtInfoMenuItem($"{FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabelPluralized()}");

            agreementsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <AgreementController>(c => c.AgreementIndex()), currentFirmaSession, $"Full {FieldDefinitionEnum.Agreement.ToType().GetFieldDefinitionLabel()} List", "Group2"));
            if (new ObligationRequestIndexViewFeature().HasPermissionByFirmaSession(currentFirmaSession))
            {
                agreementsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ObligationRequestController>(c => c.ObligationRequestIndex()), currentFirmaSession, $"Full {FieldDefinitionEnum.ObligationRequest.ToType().GetFieldDefinitionLabel()} List", "Group2"));
            }
            // Obligations treated as part of Agreements for now.
            if (new ObligationViewFeature().HasPermissionByFirmaSession(currentFirmaSession))
            {
                agreementsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ObligationController>(c => c.ObligationIndex()), currentFirmaSession, $"Full {FieldDefinitionEnum.Obligation.ToType().GetFieldDefinitionLabel()} List", "Group2"));
                // For now, not available except on individual grids. If this needs revision, the grid we bring back should be ContractualInvoicesIndex, I think.. And maybe we need to rename underlying objects backing up to the import?
                //agreementsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute<ObligationController>(c => c.ObligationItemBudgetIndex()), currentFirmaSession, $"Full Obligation Item Budgets List", "Group2"));
                agreementsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ObligationController>(c => c.ContractualInvoiceIndex()), currentFirmaSession, $"Full Contractual Invoice List", "Group2"));
            }
            if (new ObligationItemViewFeature().HasPermissionByFirmaSession(currentFirmaSession))
            {
                agreementsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ObligationItemController>(c => c.ObligationItemIndex()), currentFirmaSession, $"Full {FieldDefinitionEnum.ObligationItem.ToType().GetFieldDefinitionLabel()} List", "Group2"));
            }

            if (new PnBudgetViewFeature().HasPermissionByFirmaSession(currentFirmaSession))
            {
                agreementsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <PnBudgetController>(c => c.PnBudgetIndex()), currentFirmaSession, $"Full {ProjectFirmaModels.Models.FieldDefinitionEnum.PnBudget.ToType().GetFieldDefinitionLabel()} List", "Group2"));
            }

            // Adding the Cost Authorities to the Agreements menu for now.
            agreementsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CostAuthorityController>(c => c.CostAuthorityIndex()), currentFirmaSession, $"Full {FieldDefinitionEnum.CostAuthorityWorkBreakdownStructure.ToType().GetFieldDefinitionLabel()} List", "Group2"));
            return(agreementsMenu);
        }
Exemplo n.º 12
0
        private static LtInfoMenuItem BuildManageMenu(FirmaSession currentFirmaSession)
        {
            var manageMenu = new LtInfoMenuItem("Manage");

            // Group 1 - Project Classifications Stuff (taxonomies, classification systems, PMs)
            if (MultiTenantHelpers.IsTaxonomyLevelTrunk())
            {
                manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <TaxonomyTrunkController>(c => c.Manage()), currentFirmaSession, FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabelPluralized(), "Group1"));
            }

            if (!MultiTenantHelpers.IsTaxonomyLevelLeaf())
            {
                manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <TaxonomyBranchController>(c => c.Manage()), currentFirmaSession, FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabelPluralized(), "Group1"));
            }

            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <TaxonomyLeafController>(c => c.Manage()), currentFirmaSession, FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabelPluralized(), "Group1"));
            MultiTenantHelpers.GetClassificationSystems().ForEach(x =>
            {
                manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ClassificationController>(c => c.Index(x.ClassificationSystemID)), currentFirmaSession, ClassificationSystemModelExtensions.GetClassificationSystemNamePluralized(x), "Group1"));
            });
            if (MultiTenantHelpers.TrackAccomplishments())
            {
                manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <PerformanceMeasureController>(c => c.Manage()), currentFirmaSession, MultiTenantHelpers.GetPerformanceMeasureNamePluralized(), "Group1"));
            }

            MultiTenantHelpers.AddTechnicalAssistanceParametersMenuItem(manageMenu, currentFirmaSession, "Group1");
            MultiTenantHelpers.AddEvaluationsMenuItem(manageMenu, currentFirmaSession, "Group1");

            // Group 2 - System Config stuff
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectController>(c => c.FeaturedList()), currentFirmaSession, $"Featured {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", "Group2"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.ManageHomePageImages()), currentFirmaSession, "Homepage Images", "Group2"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.Index()), currentFirmaSession, "Custom Pages", "Group2"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <FieldDefinitionController>(c => c.Index()), currentFirmaSession, "Labels & Definitions", "Group2"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <DocumentLibraryController>(c => c.Index()), currentFirmaSession, "Document Libraries", "Group2"));

            // Group 3
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectFactSheetController>(c => c.Manage()), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Fact Sheets", "Group3"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <TagController>(c => c.Index()), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Tags", "Group3"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectUpdateController>(c => c.Manage()), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Updates", "Group3"));

            // Group 4
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <UserController>(c => c.Index()), currentFirmaSession, "Users", "Group4"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ExcelUploadController>(c => c.ManageExcelUploadsAndEtl()), currentFirmaSession, $"Upload Excel Files / ETL", "Group4"));

            // todo: action item index here
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ActionItemController>(c => c.Index()), currentFirmaSession, $"{FieldDefinitionEnum.ActionItem.ToType().GetFieldDefinitionLabelPluralized()}", "Group4"));

            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <AdminController>(c => c.AdminDetail()), currentFirmaSession, $"Admin", "Group4"));

            // Group 4 - Other

            // Group 5 - Project Firma Configuration stuff
            if (HttpRequestStorage.Tenant == ProjectFirmaModels.Models.Tenant.SitkaTechnologyGroup)
            {
                manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.DemoScript()), currentFirmaSession, "Demo Script", "Group6")); // TODO: poor man's hack until we do tenant specific menu and features
            }

            return(manageMenu);
        }
Exemplo n.º 13
0
        private static LtInfoMenuItem BuildAboutMenu(FirmaSession currentFirmaSession)
        {
            var aboutMenu = new LtInfoMenuItem(FirmaMenuItem.About.GetFirmaMenuItemDisplayName());

            AddCustomPagesToMenu(currentFirmaSession, FirmaMenuItem.About, aboutMenu, "Group1");

            return(aboutMenu);
        }
Exemplo n.º 14
0
        private static LtInfoMenuItem BuildManageMenu(Person currentPerson)
        {
            var manageMenu = new LtInfoMenuItem("Manage");

            // Group 1 - Project Classifications Stuff (taxonomies, classification systems, PMs)
            if (MultiTenantHelpers.IsTaxonomyLevelTrunk())
            {
                manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <TaxonomyTrunkController>(c => c.Manage()), currentPerson, Models.FieldDefinition.TaxonomyTrunk.GetFieldDefinitionLabelPluralized(), "Group1"));
            }

            if (!MultiTenantHelpers.IsTaxonomyLevelLeaf())
            {
                manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <TaxonomyBranchController>(c => c.Manage()), currentPerson, Models.FieldDefinition.TaxonomyBranch.GetFieldDefinitionLabelPluralized(), "Group1"));
            }
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectTypeController>(c => c.Manage()), currentPerson, Models.FieldDefinition.ProjectType.GetFieldDefinitionLabelPluralized(), "Group1"));
            MultiTenantHelpers.GetClassificationSystems().ForEach(x =>
            {
                manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ClassificationController>(c => c.Index(x.ClassificationSystemID)), currentPerson, x.ClassificationSystemNamePluralized, "Group1"));
            });


            // Group 2 - System Config stuff
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <UserController>(c => c.Index()), currentPerson, "Users and Contacts", "Group2"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectController>(c => c.FeaturedList()), currentPerson, $"Featured {Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}", "Group2"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <TagController>(c => c.Index()), currentPerson, $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} Tags", "Group2"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectUpdateController>(c => c.Manage()), currentPerson, $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} Updates", "Group2"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.ManageHomePageImages()), currentPerson, "Homepage Configuration", "Group2"));

            // Group 3 - Content Editing stuff
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <FirmaPageController>(c => c.Index()), currentPerson, "Custom Page Content", "Group3"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <FieldDefinitionController>(c => c.Index()), currentPerson, "Custom Labels & Definitions", "Group3"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.Index()), currentPerson, "Custom Pages", "Group3"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectCustomAttributeTypeController>(c => c.Manage()), currentPerson, "Custom Attributes", "Group3"));

            // Group 4 - Other
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.InternalSetupNotes()), currentPerson, "Internal Setup Notes", "Group4"));
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.StyleGuide()), currentPerson, "Style Guide", "Group4"));

            // Group 5 - Organizations
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <OrganizationAndRelationshipTypeController>(c => c.Index()), currentPerson, Models.FieldDefinition.OrganizationType.GetFieldDefinitionLabelPluralized(), "Group5"));

            // Group 6 - Jobs
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <JobController>(c => c.JobIndex()), currentPerson, Models.FieldDefinition.Job.GetFieldDefinitionLabelPluralized(), "Group6"));

            // Group 7 - JSON APIs
            manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <JsonApiManagementController>(c => c.JsonApiLandingPage()), currentPerson, "JSON APIs", "Group7"));

            // Group 8 - Hangfire menu
            if (currentPerson.IsAdministrator())
            {
                LtInfoMenuItem hangfireMenuItem = new LtInfoMenuItem("/hangfire", "Hangfire", true, false, "Group8");
                manageMenu.AddMenuItem(hangfireMenuItem);
            }

            return(manageMenu);
        }
Exemplo n.º 15
0
        private static LtInfoMenuItem BuildReportsMenu(FirmaSession currentFirmaSession)
        {
            var reportsMenu = new LtInfoMenuItem("Reports");

            reportsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ReportsController>(c => c.Projects()), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", "Group1"));

            if (new FirmaAdminFeature().HasPermission(currentFirmaSession).HasPermission)
            {
                reportsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ReportsController>(c => c.Index()), currentFirmaSession, "Manage Report Templates", "Group2"));
            }

            return(reportsMenu);
        }
Exemplo n.º 16
0
        private static LtInfoMenuItem BuildConfigureMenu(FirmaSession currentFirmaSession)
        {
            var configureMenu = new LtInfoMenuItem("Configure");

            // Group 1 - Projects
            if (MultiTenantHelpers.GetTenantAttributeFromCache().CanManageCustomAttributes)
            {
                configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectCustomAttributeTypeController>(c => c.Manage()), currentFirmaSession, $"{FieldDefinitionEnum.ProjectCustomAttribute.ToType().GetFieldDefinitionLabelPluralized()}", "Group1"));
                configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectCustomAttributeGroupController>(c => c.Manage()), currentFirmaSession, $"{FieldDefinitionEnum.ProjectCustomAttributeGroup.ToType().GetFieldDefinitionLabelPluralized()}", "Group1"));
            }
            configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectCustomGridController>(c => c.ManageProjectCustomGrids()), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Custom Grids", "Group1"));

            if (MultiTenantHelpers.GetTenantAttributeFromCache().UseProjectTimeline)
            {
                var fieldDefinitionForStatus = FieldDefinitionEnum.Status.ToType();
                var statusLabelPluralized    =
                    fieldDefinitionForStatus.GetFieldDefinitionLabel()
                    .Equals("Status", StringComparison.InvariantCultureIgnoreCase)
                        ? "Statuses"
                        : fieldDefinitionForStatus.GetFieldDefinitionLabelPluralized();
                configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ProjectStatusController>(c => c.Manage()), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} {statusLabelPluralized}", "Group1"));
            }

            if (MultiTenantHelpers.GetTenantAttributeFromCache().CanManageCustomAttributes)
            {
                // Group 2 - Funding source
                configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <FundingSourceCustomAttributeTypeController>(c => c.Manage()), currentFirmaSession, $"{FieldDefinitionEnum.FundingSourceCustomAttribute.ToType().GetFieldDefinitionLabelPluralized()}", "Group2"));
            }

            // Group 3 - Attachments
            configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <AttachmentTypeController>(c => c.Index()), currentFirmaSession, $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} {FieldDefinitionEnum.AttachmentType.ToType().GetFieldDefinitionLabelPluralized()}", "Group3"));

            // Group 4 - External Map Layers
            configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <MapLayerController>(c => c.Index()), currentFirmaSession, "Map Layers", "Group4"));

            // Group 5 - Sitka admins only
            configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <OrganizationTypeAndOrganizationRelationshipTypeController>(c => c.Index()), currentFirmaSession, FieldDefinitionEnum.OrganizationType.ToType().GetFieldDefinitionLabelPluralized(), "Group5"));
            configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ContactRelationshipTypeController>(c => c.Index()), currentFirmaSession, FieldDefinitionEnum.ContactType.ToType().GetFieldDefinitionLabelPluralized(), "Group5"));
            configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <TenantController>(c => c.Detail()), currentFirmaSession, "Tenant Configuration", "Group5"));
            if (currentFirmaSession.IsSitkaAdministrator())
            {
                configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.StyleGuide()), currentFirmaSession, "Style Guide", "Group5"));

                // The Site Monitor (Health Check) page is deliberately Anonymous to allow Nagios to hit it easily, but we don't want to advertise it to non-admins.
                configureMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <SiteMonitorController>(c => c.SiteMonitor()), currentFirmaSession, "Site Monitor (Health Checks)", "Group6"));
            }

            return(configureMenu);
        }
Exemplo n.º 17
0
        private static LtInfoMenuItem BuildResultsMenu(FirmaSession firmaSession)
        {
            var resultsMenu = new LtInfoMenuItem(FirmaMenuItem.Results.GetFirmaMenuItemDisplayName());

            if (MultiTenantHelpers.DisplayAccomplishmentDashboard())
            {
                resultsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <ResultsController>(c => c.AccomplishmentsDashboard()), firmaSession, "Accomplishments Dashboard"));
            }
            MultiTenantHelpers.AddTechnicalAssistanceReportMenuItem(resultsMenu, firmaSession);
            MultiTenantHelpers.AddFundingStatusMenuItem(resultsMenu, firmaSession);

            //resultsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute<ResultsController>(c => c.ProjectMap()), currentPerson, $"{Models.FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Map"));
            //resultsMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute<SnapshotController>(c => c.Index()), currentPerson, "System Snapshot", "Group2"));
            AddCustomPagesToMenu(firmaSession, FirmaMenuItem.Results, resultsMenu, "Group2");
            return(resultsMenu);
        }
Exemplo n.º 18
0
        private static LtInfoMenuItem BuildAboutMenu(Person currentPerson)
        {
            var aboutMenu = new LtInfoMenuItem("About");

            MultiTenantHelpers.GetCustomPagesByNavigationSection(CustomPageNavigationSectionEnum.About).ForEach(x =>
            {
                var isVisible = x.CustomPageDisplayType == CustomPageDisplayType.Public ||
                                (!currentPerson.IsAnonymousUser &&
                                 x.CustomPageDisplayType == CustomPageDisplayType.Protected);
                if (isVisible)
                {
                    aboutMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <CustomPageController>(c => c.About(x.CustomPageVanityUrl)), currentPerson, x.CustomPageDisplayName, "Group1"));
                }
            });
            return(aboutMenu);
        }
Exemplo n.º 19
0
        private void MakeFirmaMenu(FirmaSession currentFirmaSession)
        {
            TopLevelLtInfoMenuItems = new List <LtInfoMenuItem>
            {
                BuildAboutMenu(currentFirmaSession),
                BuildProjectsMenu(currentFirmaSession),
                // WARNING: This has been deleted multiple times. We are manually re-adding it. If a conflict occurs here, lets talk - SMG & SLG
                BuildAgreementsMenu(currentFirmaSession),
                //BuildObligationsMenu(currentFirmaSession),
                BuildProgramInfoMenu(currentFirmaSession)
            };

            if (MultiTenantHelpers.DisplayAccomplishmentDashboard() || MultiTenantHelpers.UsesCustomResultsPages(currentFirmaSession))
            {
                TopLevelLtInfoMenuItems.Add(BuildResultsMenu(currentFirmaSession));
            }

            if (MultiTenantHelpers.DisplayReportsLink())
            {
                TopLevelLtInfoMenuItems.Add(BuildReportsMenu(currentFirmaSession));
            }

            TopLevelLtInfoMenuItems.Add(BuildManageMenu(currentFirmaSession));
            TopLevelLtInfoMenuItems.Add(BuildConfigureMenu(currentFirmaSession));

            TopLevelLtInfoMenuItems.ForEach(x => x.ExtraTopLevelMenuCssClasses = new List <string> {
                "navigation-root-item"
            });
            TopLevelLtInfoMenuItems.SelectMany(x => x.ChildMenus).ToList().ForEach(x => x.ExtraTopLevelMenuCssClasses = new List <string> {
                "navigation-dropdown-item"
            });

            HelpMenu = new LtInfoMenuItem("Help");
            HelpMenu.AddMenuItem(LtInfoMenuItem.MakeItem("Request Support",
                                                         ModalDialogFormHelper.ModalDialogFormLink("Request Support", RequestSupportUrl, "Request Support", 800,
                                                                                                   "Submit Request", "Cancel", new List <string>(), null, null).ToString(), "ToolHelp"));
            HelpMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.Training()), currentFirmaSession, "Training", "ToolHelp"));
            HelpMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.InternalSetupNotes()), currentFirmaSession, "Internal Setup Notes", "ToolHelp"));
            HelpMenu.AddMenuItem(LtInfoMenuItem.MakeItem(new SitkaRoute <HomeController>(c => c.ReleaseNotes()), currentFirmaSession, "Release Notes", "ToolHelp"));
            AddCustomPagesToMenu(currentFirmaSession, FirmaMenuItem.Help, HelpMenu, "CustomHelp");
            HelpMenu.AddMenuItem(LtInfoMenuItem.MakeItem("About ProjectFirma",
                                                         @"<a href='http://www.sitkatech.com/products/ProjectFirma/projectfirma-faqs/' target='_blank'>About ProjectFirma <span class='glyphicon glyphicon-new-window'></span></a>", "ExternalHelp"));
        }
        public void CanRenderMenuWithGroupsTest()
        {
            var menuItem1 = new LtInfoMenuItem("menu1");
            var menuItem2 = new LtInfoMenuItem("url2", "menu2", true, false, "1");

            menuItem1.AddMenuItem(menuItem2);
            var menuItem3 = new LtInfoMenuItem("url3", "menu3", true, false, "1");

            menuItem1.AddMenuItem(menuItem3);
            var menuItem4 = new LtInfoMenuItem("url4", "menu4", true, false, "2");

            menuItem1.AddMenuItem(menuItem4);
            var menuItem5 = new LtInfoMenuItem(null, "menu5", true, false, "2");

            menuItem1.AddMenuItem(menuItem5);
            var menuItem6 = new LtInfoMenuItem("url6", "menu6", true, false, null);

            menuItem5.AddMenuItem(menuItem6);
            var menuItem7 = new LtInfoMenuItem("menu7");
            var menuItem8 = new LtInfoMenuItem("url8", "menu8", true, false, "3");

            menuItem7.AddMenuItem(menuItem8);
            var menuItem9 = new LtInfoMenuItem("url9", "menu9", true, false, null);

            menuItem7.AddMenuItem(menuItem9);
            var menuItem10 = new LtInfoMenuItem("menu10");
            var menuItem11 = new LtInfoMenuItem("url11", "menu11", true, false, null);

            menuItem10.AddMenuItem(menuItem11);
            var menuItem12 = new LtInfoMenuItem("url12", "menu12", true, true, null);
            var menuItem13 = new LtInfoMenuItem("menu13");

            var topLevelMenus = new List <LtInfoMenuItem> {
                menuItem1, menuItem7, menuItem10, menuItem12, menuItem13
            };

            var result = string.Join("\r\n", topLevelMenus.Select(x => x.RenderMenu()));

            Approvals.Verify(result);
        }
        public void CanRenderNestedMenuTest()
        {
            var menuItem1 = new LtInfoMenuItem("menu1");
            var menuItem2 = new LtInfoMenuItem("url2", "menu2", true, false, null);

            menuItem1.AddMenuItem(menuItem2);
            var menuItem3 = new LtInfoMenuItem("url3", "menu3", true, false, null);

            menuItem1.AddMenuItem(menuItem3);
            var menuItem4 = new LtInfoMenuItem("url4", "menu4", true, false, null);

            menuItem1.AddMenuItem(menuItem4);
            var menuItem5 = new LtInfoMenuItem(null, "menu5", true, false, null);

            menuItem1.AddMenuItem(menuItem5);
            var menuItem6 = new LtInfoMenuItem("url6", "menu6", true, false, null);

            menuItem5.AddMenuItem(menuItem6);

            var result = menuItem1.RenderMenu();

            Approvals.Verify(result);
        }
Exemplo n.º 22
0
 public void AddMenuItem(LtInfoMenuItem menuItemToAdd)
 {
     Check.Require(!HasUrl, "You cannot add children to a menu item that is a link!");
     ChildMenus.Add(menuItemToAdd);
 }
        public void TopLevelMenuItemThatIsALinkCannotAddChildrenTest()
        {
            var menuItem1 = new LtInfoMenuItem("url1", "menu1", true, true, null);

            Assert.Throws <PreconditionException>(() => menuItem1.AddMenuItem(new LtInfoMenuItem("Some menu item")));
        }
        public void TopLevelMenuItemThatIsNotALinkCanAddChildrenTest()
        {
            var menuItem1 = new LtInfoMenuItem("menu1");

            Assert.DoesNotThrow(() => menuItem1.AddMenuItem(new LtInfoMenuItem("Some menu item")));
        }