Search in sources :

Example 6 with IMenuItemPage

use of com.helger.photon.core.menu.IMenuItemPage in project phoss-directory by phax.

the class SecureHTMLProvider method fillBody.

@Override
protected void fillBody(@Nonnull final ISimpleWebExecutionContext aSWEC, @Nonnull final HCHtml aHtml) throws ForcedRedirectException {
    final IRequestWebScopeWithoutResponse aRequestScope = aSWEC.getRequestScope();
    final Locale aDisplayLocale = aSWEC.getDisplayLocale();
    final IMenuItemPage aMenuItem = RequestSettings.getMenuItem(aRequestScope);
    final LayoutExecutionContext aLEC = new LayoutExecutionContext(aSWEC, aMenuItem);
    final HCHead aHead = aHtml.head();
    final HCBody aBody = aHtml.body();
    // Add menu item in page title
    aHead.setPageTitle(StringHelper.getConcatenatedOnDemand(CPDPublisher.getApplicationTitle(), " - ", aMenuItem.getDisplayText(aDisplayLocale)));
    AppCommonUI.addFavIcons(aHead);
    final IHCNode aNode = getContent(aLEC);
    aBody.addChild(aNode);
}
Also used : Locale(java.util.Locale) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) LayoutExecutionContext(com.helger.photon.core.execcontext.LayoutExecutionContext) HCBody(com.helger.html.hc.html.sections.HCBody) HCHead(com.helger.html.hc.html.metadata.HCHead) IMenuItemPage(com.helger.photon.core.menu.IMenuItemPage) IHCNode(com.helger.html.hc.IHCNode)

Example 7 with IMenuItemPage

use of com.helger.photon.core.menu.IMenuItemPage in project phoss-smp by phax.

the class MenuSecure method init.

public static void init(@Nonnull final IMenuTree aMenuTree) {
    final MenuObjectFilterUserAssignedToUserGroup aFilterAdministrators = new MenuObjectFilterUserAssignedToUserGroup(CSMP.USERGROUP_ADMINISTRATORS_ID);
    final IMenuObjectFilter aFilterPeppolDirectory = x -> SMPMetaManager.getSettings().isDirectoryIntegrationEnabled() && SMPMetaManager.hasBusinessCardMgr();
    final IMenuObjectFilter aFilterSMLConnectionActive = x -> SMPMetaManager.getSettings().isSMLEnabled();
    final IMenuObjectFilter aFilterSMLConnectionActiveOrNeeded = x -> SMPMetaManager.getSettings().isSMLEnabled() || SMPMetaManager.getSettings().isSMLRequired();
    {
        final IMenuItemPage aServiceGroups = aMenuTree.createRootItem(new PageSecureServiceGroup(CMenuSecure.MENU_SERVICE_GROUPS));
        aMenuTree.createItem(aServiceGroups, new PageSecureServiceGroupExport(CMenuSecure.MENU_SERVICE_GROUPS_EXPORT));
        aMenuTree.createItem(aServiceGroups, new PageSecureServiceGroupImport(CMenuSecure.MENU_SERVICE_GROUPS_IMPORT));
        aMenuTree.createItem(aServiceGroups, new PageSecureServiceGroupMigrationOutbound(CMenuSecure.MENU_SERVICE_GROUPS_MIGRATE_OUTBOUND));
        aMenuTree.createItem(aServiceGroups, new PageSecureServiceGroupMigrationInbound(CMenuSecure.MENU_SERVICE_GROUPS_MIGRATE_INBOUND));
    }
    {
        final IMenuItemPage aEndpoints = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuSecure.MENU_ENDPOINTS, "Endpoints", aMenuTree));
        aMenuTree.createItem(aEndpoints, new PageSecureEndpointList(CMenuSecure.MENU_ENDPOINT_LIST));
        aMenuTree.createItem(aEndpoints, new PageSecureEndpointTree(CMenuSecure.MENU_ENDPOINT_TREE));
        aMenuTree.createItem(aEndpoints, new PageSecureEndpointChangeURL(CMenuSecure.MENU_ENDPOINTS_CHANGE_URL));
        aMenuTree.createItem(aEndpoints, new PageSecureEndpointChangeCertificate(CMenuSecure.MENU_ENDPOINTS_CHANGE_CERTIFICATE));
    }
    aMenuTree.createRootItem(new PageSecureRedirect(CMenuSecure.MENU_REDIRECTS));
    aMenuTree.createRootItem(new PageSecureBusinessCard(CMenuSecure.MENU_BUSINESS_CARDS)).setDisplayFilter(aFilterPeppolDirectory);
    aMenuTree.createRootItem(new PageSecureCertificateInformation(CMenuSecure.MENU_CERTIFICATE_INFORMATION));
    aMenuTree.createRootItem(new PageSecureTasksProblems(CMenuSecure.MENU_TASKS));
    aMenuTree.createRootSeparator();
    // Administrator
    {
        final IMenuItemPage aAdmin = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuSecure.MENU_ADMIN, "Administration", aMenuTree));
        {
            final IMenuItemPage aAdminSML = aMenuTree.createItem(aAdmin, new BasePageShowChildren<>(CMenuSecure.MENU_SML, "SML", aMenuTree)).setDisplayFilter(aFilterSMLConnectionActiveOrNeeded);
            aMenuTree.createItem(aAdminSML, new PageSecureSMLConfiguration(CMenuSecure.MENU_SML_CONFIGURATION)).setDisplayFilter(aFilterSMLConnectionActiveOrNeeded);
            aMenuTree.createItem(aAdminSML, new PageSecureSMLRegistration(CMenuSecure.MENU_SML_REGISTRATION)).setDisplayFilter(aFilterSMLConnectionActive);
            aMenuTree.createItem(aAdminSML, new PageSecureSMLCertificateUpdate(CMenuSecure.MENU_SML_CERTIFICATE_UPDATE)).setDisplayFilter(aFilterSMLConnectionActive);
        }
        aMenuTree.createItem(aAdmin, new PageSecureSMPSettings(CMenuSecure.MENU_SMP_SETTINGS));
        aMenuTree.createItem(aAdmin, new PageSecureSMPIdentifierMappings(CMenuSecure.MENU_SMP_IDENTIFIER_MAPPINGS));
        aMenuTree.createItem(aAdmin, new PageSecureTransportProfiles(CMenuSecure.MENU_TRANSPORT_PROFILES));
        aMenuTree.createItem(aAdmin, new BasePageSecurityChangePassword<WebPageExecutionContext>(CMenuSecure.MENU_CHANGE_PASSWORD));
        BootstrapPagesMenuConfigurator.addAllItems(aMenuTree, aAdmin, aFilterAdministrators, CSMPServer.DEFAULT_LOCALE);
    }
    // Default menu item
    aMenuTree.setDefaultMenuItemID(CMenuSecure.MENU_SERVICE_GROUPS);
}
Also used : CSMPServer(com.helger.phoss.smp.CSMPServer) MenuObjectFilterUserAssignedToUserGroup(com.helger.photon.core.menu.filter.MenuObjectFilterUserAssignedToUserGroup) WebPageExecutionContext(com.helger.photon.uicore.page.WebPageExecutionContext) BootstrapPagesMenuConfigurator(com.helger.photon.bootstrap4.pages.BootstrapPagesMenuConfigurator) SMPMetaManager(com.helger.phoss.smp.domain.SMPMetaManager) IMenuItemPage(com.helger.photon.core.menu.IMenuItemPage) BasePageSecurityChangePassword(com.helger.photon.bootstrap4.pages.security.BasePageSecurityChangePassword) IMenuTree(com.helger.photon.core.menu.IMenuTree) CSMP(com.helger.phoss.smp.app.CSMP) BasePageShowChildren(com.helger.photon.uicore.page.system.BasePageShowChildren) Nonnull(javax.annotation.Nonnull) Immutable(javax.annotation.concurrent.Immutable) IMenuObjectFilter(com.helger.photon.core.menu.IMenuObjectFilter) IMenuItemPage(com.helger.photon.core.menu.IMenuItemPage) IMenuObjectFilter(com.helger.photon.core.menu.IMenuObjectFilter) BasePageSecurityChangePassword(com.helger.photon.bootstrap4.pages.security.BasePageSecurityChangePassword) BasePageShowChildren(com.helger.photon.uicore.page.system.BasePageShowChildren) MenuObjectFilterUserAssignedToUserGroup(com.helger.photon.core.menu.filter.MenuObjectFilterUserAssignedToUserGroup)

Example 8 with IMenuItemPage

use of com.helger.photon.core.menu.IMenuItemPage in project phoss-smp by phax.

the class SMPRendererPublic method getContent.

@Nonnull
public static IHCNode getContent(@Nonnull final LayoutExecutionContext aLEC) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final HCNodeList ret = new HCNodeList();
    // Header
    ret.addChild(_getNavbar(aLEC));
    final BootstrapContainer aOuterContainer = ret.addAndReturnChild(new BootstrapContainer().setFluid(true));
    // Breadcrumbs
    if (false) {
        final BootstrapBreadcrumb aBreadcrumbs = BootstrapBreadcrumbProvider.createBreadcrumb(aLEC);
        aBreadcrumbs.addClasses(CBootstrapCSS.D_NONE, CBootstrapCSS.D_SM_BLOCK);
        aOuterContainer.addChild(aBreadcrumbs);
    }
    // Content
    aOuterContainer.addChild(BootstrapPageRenderer.getPageContent(aLEC));
    // Footer
    {
        final BootstrapContainer aDiv = createDefaultFooter(SMPWebAppConfiguration.isPublicShowApplicationName(), SMPWebAppConfiguration.isPublicShowSource(), SMPWebAppConfiguration.isPublicShowAuthor());
        {
            final BootstrapMenuItemRendererHorz aRenderer = new BootstrapMenuItemRendererHorz(aDisplayLocale);
            final HCUL aUL = new HCUL().addClass(CSS_CLASS_FOOTER_LINKS);
            for (final IMenuObject aMenuObj : FOOTER_OBJECTS) {
                if (aMenuObj instanceof IMenuSeparator)
                    aUL.addItem(aRenderer.renderSeparator(aLEC, (IMenuSeparator) aMenuObj));
                else if (aMenuObj instanceof IMenuItemPage)
                    aUL.addItem(aRenderer.renderMenuItemPage(aLEC, (IMenuItemPage) aMenuObj, false, false, false));
                else if (aMenuObj instanceof IMenuItemExternal)
                    aUL.addItem(aRenderer.renderMenuItemExternal(aLEC, (IMenuItemExternal) aMenuObj, false, false, false));
                else
                    throw new IllegalStateException("Unsupported menu object type!");
            }
            if (aUL.hasChildren())
                aDiv.addChild(aUL);
        }
        if (aDiv.hasChildren())
            aOuterContainer.addChild(aDiv);
    }
    return ret;
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapMenuItemRendererHorz(com.helger.photon.bootstrap4.uictrls.ext.BootstrapMenuItemRendererHorz) HCUL(com.helger.html.hc.html.grouping.HCUL) IMenuSeparator(com.helger.photon.core.menu.IMenuSeparator) BootstrapContainer(com.helger.photon.bootstrap4.layout.BootstrapContainer) IMenuItemPage(com.helger.photon.core.menu.IMenuItemPage) IMenuObject(com.helger.photon.core.menu.IMenuObject) BootstrapBreadcrumb(com.helger.photon.bootstrap4.breadcrumb.BootstrapBreadcrumb) IMenuItemExternal(com.helger.photon.core.menu.IMenuItemExternal) Nonnull(javax.annotation.Nonnull)

Example 9 with IMenuItemPage

use of com.helger.photon.core.menu.IMenuItemPage in project peppol-practical by phax.

the class AppLayoutHTMLProvider method fillBody.

@Override
protected void fillBody(@Nonnull final ISimpleWebExecutionContext aSWEC, @Nonnull final HCHtml aHtml) throws ForcedRedirectException {
    final IRequestWebScopeWithoutResponse aRequestScope = aSWEC.getRequestScope();
    final Locale aDisplayLocale = aSWEC.getDisplayLocale();
    final IMenuItemPage aMenuItem = RequestSettings.getMenuItem(aRequestScope);
    final LayoutExecutionContext aLEC = new LayoutExecutionContext(aSWEC, aMenuItem);
    final HCHead aHead = aHtml.head();
    final HCBody aBody = aHtml.body();
    // Add menu item in page title
    aHead.setPageTitle(StringHelper.getConcatenatedOnDemand(AppHelper.getApplicationTitle(), " - ", aMenuItem.getDisplayText(aDisplayLocale)));
    final IHCNode aNode = m_aFactory.apply(aLEC);
    aBody.addChild(aNode);
}
Also used : Locale(java.util.Locale) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) LayoutExecutionContext(com.helger.photon.core.execcontext.LayoutExecutionContext) HCBody(com.helger.html.hc.html.sections.HCBody) HCHead(com.helger.html.hc.html.metadata.HCHead) IMenuItemPage(com.helger.photon.core.menu.IMenuItemPage) IHCNode(com.helger.html.hc.IHCNode)

Example 10 with IMenuItemPage

use of com.helger.photon.core.menu.IMenuItemPage in project peppol-practical by phax.

the class MenuSecure method init.

public static void init(@Nonnull final IMenuTree aMenuTree) {
    // We need this additional indirection layer, as the pages are initialized
    // statically!
    final MenuObjectFilterUserAssignedToUserGroup aFilterAdministrators = new MenuObjectFilterUserAssignedToUserGroup(CPPApp.USERGROUP_ADMINISTRATORS_ID);
    final MenuObjectFilterUserHasRole aFilterPeppolSenders = new MenuObjectFilterUserHasRole(CPPApp.ROLE_PEPPOL_SENDERS_ID);
    // CRM
    {
        final IMenuItemPage aCRM = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuSecure.MENU_CRM, "CRM", aMenuTree)).setDisplayFilter(aFilterAdministrators);
        aMenuTree.createItem(aCRM, new PageSecureCRMGroup(CMenuSecure.MENU_CRM_GROUPS)).setDisplayFilter(aFilterAdministrators);
        aMenuTree.createItem(aCRM, new PageSecureCRMSubscriber(CMenuSecure.MENU_CRM_SUBSCRIBERS)).setDisplayFilter(aFilterAdministrators);
    }
    // Peppol
    {
        final IMenuItemPage aPeppol = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuSecure.MENU_PEPPOL, "Peppol", aMenuTree));
        aMenuTree.createItem(aPeppol, new PageSecurePeppolSendAS4(CMenuSecure.MENU_PEPPOL_SEND_AS4)).setDisplayFilter(aFilterPeppolSenders);
    }
    // Comments
    {
        aMenuTree.createRootItem(new PageSecureCommentAdmin(CMenuSecure.MENU_COMMENTS)).setDisplayFilter(aFilterAdministrators);
    }
    // Schematron tools
    {
        aMenuTree.createRootItem(new PageSecureSchematronTools(CMenuSecure.MENU_SCH_TOOLS)).setDisplayFilter(aFilterAdministrators);
    }
    // Administrator
    {
        final IMenuItemPage aAdmin = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuSecure.MENU_ADMIN, "Administration", aMenuTree));
        // Must be accessible for all Config users
        aMenuTree.createItem(aAdmin, new BasePageSecurityChangePassword<WebPageExecutionContext>(CMenuSecure.MENU_ADMIN_CHANGE_PASSWORD));
        // Admins only
        aMenuTree.createItem(aAdmin, new PageSecureAdminAddons(CMenuSecure.MENU_ADMIN_ADDONS)).setDisplayFilter(aFilterAdministrators);
        aMenuTree.createItem(aAdmin, new PageSecureSMLConfiguration(CMenuSecure.MENU_SML_CONFIGURATION)).setDisplayFilter(aFilterAdministrators);
        BootstrapPagesMenuConfigurator.addAllItems(aMenuTree, aAdmin, aFilterAdministrators, CPPApp.DEFAULT_LOCALE);
    }
    // Default menu item
    aMenuTree.setDefaultMenuItemID(CMenuSecure.MENU_COMMENTS);
}
Also used : IMenuItemPage(com.helger.photon.core.menu.IMenuItemPage) MenuObjectFilterUserHasRole(com.helger.photon.core.menu.filter.MenuObjectFilterUserHasRole) BasePageSecurityChangePassword(com.helger.photon.bootstrap4.pages.security.BasePageSecurityChangePassword) WebPageExecutionContext(com.helger.photon.uicore.page.WebPageExecutionContext) BasePageShowChildren(com.helger.photon.uicore.page.system.BasePageShowChildren) MenuObjectFilterUserAssignedToUserGroup(com.helger.photon.core.menu.filter.MenuObjectFilterUserAssignedToUserGroup)

Aggregations

IMenuItemPage (com.helger.photon.core.menu.IMenuItemPage)11 Locale (java.util.Locale)6 IRequestWebScopeWithoutResponse (com.helger.web.scope.IRequestWebScopeWithoutResponse)5 IHCNode (com.helger.html.hc.IHCNode)4 HCHead (com.helger.html.hc.html.metadata.HCHead)4 HCBody (com.helger.html.hc.html.sections.HCBody)4 LayoutExecutionContext (com.helger.photon.core.execcontext.LayoutExecutionContext)4 BasePageShowChildren (com.helger.photon.uicore.page.system.BasePageShowChildren)4 BasePageSecurityChangePassword (com.helger.photon.bootstrap4.pages.security.BasePageSecurityChangePassword)3 MenuObjectFilterUserAssignedToUserGroup (com.helger.photon.core.menu.filter.MenuObjectFilterUserAssignedToUserGroup)3 WebPageExecutionContext (com.helger.photon.uicore.page.WebPageExecutionContext)3 Nonnull (javax.annotation.Nonnull)3 SimpleURL (com.helger.commons.url.SimpleURL)2 HCUL (com.helger.html.hc.html.grouping.HCUL)2 HCNodeList (com.helger.html.hc.impl.HCNodeList)2 BootstrapContainer (com.helger.photon.bootstrap4.layout.BootstrapContainer)2 BootstrapMenuItemRendererHorz (com.helger.photon.bootstrap4.uictrls.ext.BootstrapMenuItemRendererHorz)2 IMenuItemExternal (com.helger.photon.core.menu.IMenuItemExternal)2 IMenuObject (com.helger.photon.core.menu.IMenuObject)2 IMenuSeparator (com.helger.photon.core.menu.IMenuSeparator)2