/// <summary>
        /// Call for page with associated FirmaPage
        /// </summary>
        protected FirmaViewData(Person currentPerson, Models.FirmaPage firmaPage)
        {
            FirmaPage = firmaPage;

            CurrentPerson = currentPerson;
            FirmaHomeUrl  = SitkaRoute <HomeController> .BuildUrlFromExpression(c => c.Index());

            LogInUrl  = FirmaHelpers.GenerateLogInUrlWithReturnUrl();
            LogOutUrl = FirmaHelpers.GenerateLogOutUrlWithReturnUrl();

            RequestSupportUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(c => c.Support());

            MakeFirmaMenu(currentPerson);

            FullProjectListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Index());

            ProjectSearchUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Search(UrlTemplate.Parameter1String));

            ProjectFindUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Find(string.Empty));

            var currentPersonCanManage = new FirmaPageManageFeature().HasPermission(currentPerson, firmaPage).HasPermission;

            ViewPageContentViewData = firmaPage != null ? new ViewPageContentViewData(firmaPage, currentPersonCanManage) : null;
            CustomFooterViewData    =
                new ViewPageContentViewData(Models.FirmaPage.GetFirmaPageByPageType(FirmaPageType.CustomFooter),
                                            currentPersonCanManage);
            TenantName          = MultiTenantHelpers.GetTenantName();
            TenantDisplayName   = MultiTenantHelpers.GetTenantDisplayName();
            TenantBannerLogoUrl = MultiTenantHelpers.GetTenantBannerLogoUrl();
        }
Esempio n. 2
0
        /// <summary>
        /// Call for page with associated FirmaPage
        /// </summary>
        protected FirmaViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage)
        {
            FirmaPage = firmaPage;

            //CurrentPerson = currentPerson;
            CurrentFirmaSession = currentFirmaSession;
            FirmaHomeUrl        = SitkaRoute <HomeController> .BuildUrlFromExpression(c => c.Index());

            LogInUrl  = FirmaHelpers.GenerateLogInUrl();
            LogOutUrl = FirmaHelpers.GenerateLogOutUrlWithReturnUrl();

            CurrentUrl         = HttpContext.Current.Request.Url;
            ForgotPasswordUrl  = FirmaHelpers.GenerateForgotPasswordUrlWithReturnUrl(CurrentUrl.AbsoluteUri);
            RegisterAccountUrl = FirmaHelpers.GenerateCreateAccountWithReturnUrl(CurrentUrl.AbsoluteUri);

            QaUrl    = MultiTenantHelpers.GetRelativeUrlForEnvironment(CurrentUrl, FirmaEnvironmentType.Qa);
            LocalUrl = MultiTenantHelpers.GetRelativeUrlForEnvironment(CurrentUrl, FirmaEnvironmentType.Local);
            ProdUrl  = MultiTenantHelpers.GetRelativeUrlForEnvironment(CurrentUrl, FirmaEnvironmentType.Prod);

            TenantSimples = MultiTenantHelpers.GetAllTenantSimples().Where(ts => ts.ShowTenantInSwitcherDropdown).ToList();

            RequestSupportUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(c => c.Support());

            MakeFirmaMenu(currentFirmaSession);

            FullProjectListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Index());

            ProjectSearchUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Search(UrlTemplate.Parameter1String));

            ProjectFindUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Find(string.Empty));

            var currentPersonCanManage = new FirmaPageManageFeature().HasPermission(currentFirmaSession, firmaPage).HasPermission;

            ViewPageContentViewData = firmaPage != null ? new ViewPageContentViewData(firmaPage, currentPersonCanManage) : null;
            CustomFooterViewData    = new CustomFooterViewData(FirmaPageTypeEnum.CustomFooter.GetFirmaPage(), currentPersonCanManage, this.CurrentFirmaSession);
            TenantName             = MultiTenantHelpers.GetTenantName();
            TenantShortDisplayName = MultiTenantHelpers.GetTenantShortDisplayName();
            TenantBannerLogoUrl    = MultiTenantHelpers.GetTenantBannerLogoUrl();
            TenantToolDisplayName  = MultiTenantHelpers.GetToolDisplayName();
            ShowTenantDropdown     =
                // Tenant dropdown can be globally disabled if necessary. (Reclamation needs this, and so might other hard-ish forks.)
                FirmaWebConfiguration.TenantDropdownEnabled &&
                (FirmaWebConfiguration.FirmaEnvironment.FirmaEnvironmentType == FirmaEnvironmentType.Local ||
                 CurrentFirmaSession.IsSitkaAdministrator());
            ShowEnvironmentLabel    = FirmaWebConfiguration.FirmaEnvironment.FirmaEnvironmentType != FirmaEnvironmentType.Prod;
            ShowEnvironmentDropdown =
                FirmaWebConfiguration.FirmaEnvironment.FirmaEnvironmentType == FirmaEnvironmentType.Local ||
                CurrentFirmaSession.IsSitkaAdministrator();
            FirmaIncludesViewData = new FirmaIncludesViewData();
        }