Search in sources :

Example 1 with IMenuObject

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

the class SMPRendererPublic method getMenuContent.

@Nonnull
public static IHCNode getMenuContent(@Nonnull final LayoutExecutionContext aLEC) {
    // Main menu
    final IMenuTree aMenuTree = aLEC.getMenuTree();
    final MenuItemDeterminatorCallback aCallback = new MenuItemDeterminatorCallback(aMenuTree, aLEC.getSelectedMenuItemID()) {

        @Override
        protected boolean isMenuItemValidToBeDisplayed(@Nonnull final IMenuObject aMenuObj) {
            // Don't show items that belong to the footer
            if (aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER))
                return false;
            // Use default code
            return super.isMenuItemValidToBeDisplayed(aMenuObj);
        }
    };
    return BootstrapMenuItemRenderer.createSideBarMenu(aLEC, aCallback);
}
Also used : Nonnull(javax.annotation.Nonnull) IMenuTree(com.helger.photon.core.menu.IMenuTree) IMenuObject(com.helger.photon.core.menu.IMenuObject) MenuItemDeterminatorCallback(com.helger.photon.core.menu.MenuItemDeterminatorCallback) Nonnull(javax.annotation.Nonnull)

Example 2 with IMenuObject

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

the class PublicHTMLProvider method getContent.

@Nonnull
public static IHCNode getContent(@Nonnull final LayoutExecutionContext aLEC) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
    final HCNodeList ret = new HCNodeList();
    // Header
    ret.addChild(_getNavbar(aLEC));
    final BootstrapContainer aOuterContainer = ret.addAndReturnChild(new BootstrapContainer().setFluid(false));
    // Content - no menu
    aOuterContainer.addChild(BootstrapPageRenderer.getPageContent(aLEC));
    // Footer
    {
        final BootstrapContainer aDiv = new BootstrapContainer().setFluid(true).setID(CLayout.LAYOUT_AREAID_FOOTER);
        aDiv.addChild(new HCP().addChild(CPDPublisher.getApplication() + " - an ").addChild(new HCA(new SimpleURL(VENDOR_URL)).addChild(VENDOR_NAME)).addChild(" service"));
        if (PDServerConfiguration.getConfig().getAsBoolean("webapp.showtwitter", true)) {
            aDiv.addChild(new HCP().addChild("Follow us on Twitter: ").addChild(new HCA(new SimpleURL("https://twitter.com/PEPPOLDirectory")).addChild("@PEPPOLDirectory")));
        }
        final HCP aP = new HCP().addChild("Download data [");
        aP.addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_BUSINESS_CARDS_XML_FULL)).addChild("BusinessCards XML"));
        aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_BUSINESS_CARDS_XML_NO_DOC_TYPES)).addChild("BusinessCards w/o doctypes XML"));
        if (CPDPublisher.EXPORT_BUSINESS_CARDS_EXCEL) {
            aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_BUSINESS_CARDS_EXCEL)).addChild("BusinessCards Excel"));
        }
        if (CPDPublisher.EXPORT_BUSINESS_CARDS_CSV) {
            aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_BUSINESS_CARDS_CSV)).addChild("BusinessCards CSV"));
        }
        if (CPDPublisher.EXPORT_PARTICIPANTS_XML) {
            aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_PARTICIPANTS_XML)).addChild("Participant IDs XML"));
        }
        if (CPDPublisher.EXPORT_PARTICIPANTS_JSON) {
            aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_PARTICIPANTS_JSON)).addChild("Participant IDs JSON"));
        }
        if (CPDPublisher.EXPORT_PARTICIPANTS_CSV) {
            aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_PARTICIPANTS_CSV)).addChild("Participant IDs CSV"));
        }
        aP.addChild("]");
        aDiv.addChild(aP);
        final BootstrapMenuItemRendererHorz aRenderer = new BootstrapMenuItemRendererHorz(aDisplayLocale);
        final HCUL aUL = aDiv.addAndReturnChild(new HCUL().addClass(CSS_CLASS_FOOTER_LINKS));
        for (final IMenuObject aMenuObj : s_aFooterObjects) {
            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!");
        }
        ret.addChild(aDiv);
    }
    // Google Analytics?
    final String sAccountID = PDServerConfiguration.getConfig().getAsString("webapp.google.analytics.account");
    if (StringHelper.hasText(sAccountID))
        ret.addChild(new HCUniversalAnalytics(sAccountID, false, false, false, false));
    ret.addChild(HCCookieConsent.createBottomDefault("#000", "#0f0", "#0f0", null));
    return ret;
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) HCUniversalAnalytics(com.helger.photon.uicore.html.google.HCUniversalAnalytics) HCA(com.helger.html.hc.html.textlevel.HCA) IMenuItemPage(com.helger.photon.core.menu.IMenuItemPage) IMenuObject(com.helger.photon.core.menu.IMenuObject) SimpleURL(com.helger.commons.url.SimpleURL) ISimpleURL(com.helger.commons.url.ISimpleURL) IMenuItemExternal(com.helger.photon.core.menu.IMenuItemExternal) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) 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) HCP(com.helger.html.hc.html.grouping.HCP) Nonnull(javax.annotation.Nonnull)

Example 3 with IMenuObject

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

the class PublicHTMLProvider method getMenuContent.

@Nonnull
public static IHCNode getMenuContent(@Nonnull final LayoutExecutionContext aLEC) {
    // Main menu
    final IMenuTree aMenuTree = aLEC.getMenuTree();
    final MenuItemDeterminatorCallback aCallback = new MenuItemDeterminatorCallback(aMenuTree, aLEC.getSelectedMenuItemID()) {

        @Override
        protected boolean isMenuItemValidToBeDisplayed(@Nonnull final IMenuObject aMenuObj) {
            // Don't show items that belong to the footer
            if (aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER))
                return false;
            // Use default code
            return super.isMenuItemValidToBeDisplayed(aMenuObj);
        }
    };
    final IHCElement<?> aMenu = BootstrapMenuItemRenderer.createSideBarMenu(aLEC, aCallback);
    return aMenu;
}
Also used : Nonnull(javax.annotation.Nonnull) IMenuTree(com.helger.photon.core.menu.IMenuTree) IMenuObject(com.helger.photon.core.menu.IMenuObject) MenuItemDeterminatorCallback(com.helger.photon.core.menu.MenuItemDeterminatorCallback) Nonnull(javax.annotation.Nonnull)

Example 4 with IMenuObject

use of com.helger.photon.core.menu.IMenuObject 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 5 with IMenuObject

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

the class LayoutAreaContentProviderPublic method getMenuContent.

@Nonnull
public static IHCNode getMenuContent(@Nonnull final LayoutExecutionContext aLEC) {
    // Main menu
    final IMenuTree aMenuTree = aLEC.getMenuTree();
    final MenuItemDeterminatorCallback aCallback = new MenuItemDeterminatorCallback(aMenuTree, aLEC.getSelectedMenuItemID()) {

        @Override
        protected boolean isMenuItemValidToBeDisplayed(@Nonnull final IMenuObject aMenuObj) {
            // Don't show items that belong to the footer
            if (aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER_COL1) || aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER_COL2) || aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER_COL3))
                return false;
            // Use default code
            return super.isMenuItemValidToBeDisplayed(aMenuObj);
        }
    };
    final IHCElement<?> aMenu = BootstrapMenuItemRenderer.createSideBarMenu(aLEC, aCallback);
    // Add PayPal
    HCForm aPayPal = null;
    if (!GlobalDebug.isDebugMode()) {
        aPayPal = new HCForm(new SimpleURL("https://www.paypal.com/cgi-bin/webscr")).setTarget(HC_Target.TOP).addClass(CSS_CLASS_PAYPAL).addClass(CBootstrapCSS.MT_2);
        aPayPal.addChild(new HCHiddenField("cmd", "_s-xclick"));
        aPayPal.addChild(new HCHiddenField("encrypted", "-----BEGIN PKCS7-----MIIHFgYJKoZIhvcNAQcEoIIHBzCCBwMCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG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3ZgaVzPLPteHGCVZ5eU2syP8259AdEC1AFCCUHt2eRg1po6qv2LJoNm-----END PKCS7-----\r\n"));
        aPayPal.addChild(new HCInput().setType(EHCInputType.IMAGE).setSrc(new SimpleURL("https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif")).setName("submit").setAlt("PayPal - The safer, easier way to pay online!"));
        aPayPal.addChild(new HCImg().setAlt("").setSrc(new SimpleURL("https://www.paypalobjects.com/de_DE/i/scr/pixel.gif")).setExtent(1, 1));
    }
    return new HCNodeList().addChild(aMenu).addChild(aPayPal);
}
Also used : HCForm(com.helger.html.hc.html.forms.HCForm) HCInput(com.helger.html.hc.html.forms.HCInput) HCNodeList(com.helger.html.hc.impl.HCNodeList) Nonnull(javax.annotation.Nonnull) HCHiddenField(com.helger.html.hc.html.forms.HCHiddenField) IMenuTree(com.helger.photon.core.menu.IMenuTree) IMenuObject(com.helger.photon.core.menu.IMenuObject) HCImg(com.helger.html.hc.html.embedded.HCImg) MenuItemDeterminatorCallback(com.helger.photon.core.menu.MenuItemDeterminatorCallback) SimpleURL(com.helger.commons.url.SimpleURL) ISimpleURL(com.helger.commons.url.ISimpleURL) Nonnull(javax.annotation.Nonnull)

Aggregations

IMenuObject (com.helger.photon.core.menu.IMenuObject)6 Nonnull (javax.annotation.Nonnull)6 HCNodeList (com.helger.html.hc.impl.HCNodeList)3 IMenuTree (com.helger.photon.core.menu.IMenuTree)3 MenuItemDeterminatorCallback (com.helger.photon.core.menu.MenuItemDeterminatorCallback)3 Locale (java.util.Locale)3 ISimpleURL (com.helger.commons.url.ISimpleURL)2 SimpleURL (com.helger.commons.url.SimpleURL)2 HCUL (com.helger.html.hc.html.grouping.HCUL)2 HCA (com.helger.html.hc.html.textlevel.HCA)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 IMenuItemPage (com.helger.photon.core.menu.IMenuItemPage)2 IMenuSeparator (com.helger.photon.core.menu.IMenuSeparator)2 PDTToString (com.helger.commons.datetime.PDTToString)1 HCImg (com.helger.html.hc.html.embedded.HCImg)1 HCForm (com.helger.html.hc.html.forms.HCForm)1 HCHiddenField (com.helger.html.hc.html.forms.HCHiddenField)1 HCInput (com.helger.html.hc.html.forms.HCInput)1