use of com.helger.photon.bootstrap4.dropdown.BootstrapDropdownMenu in project phoss-smp by phax.
the class SMPRendererPublic method _addNavbarLoginLogout.
private static void _addNavbarLoginLogout(@Nonnull final ILayoutExecutionContext aLEC, @Nonnull final BootstrapNavbar aNavbar) {
if (!SMPWebAppConfiguration.isPublicLoginEnabled())
return;
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
final IUser aUser = aLEC.getLoggedInUser();
final BootstrapNavbarToggleable aToggleable = aNavbar.addAndReturnToggleable();
if (aUser != null) {
final Locale aDisplayLocale = aLEC.getDisplayLocale();
aToggleable.addChild(new BootstrapButton().addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MR_2).addChild("Goto manager").setOnClick(LinkHelper.getURLWithContext(AbstractSecureApplicationServlet.SERVLET_DEFAULT_PATH + "/")));
aToggleable.addAndReturnText().addClass(CBootstrapCSS.MX_2).addChild("Logged in as ").addChild(new HCStrong().addChild(SecurityHelper.getUserDisplayName(aUser, aDisplayLocale)));
aToggleable.addChild(new BootstrapButton().addClass(CBootstrapCSS.MX_2).setOnClick(LinkHelper.getURLWithContext(aRequestScope, SMPLogoutServlet.SERVLET_DEFAULT_PATH)).addChild(EPhotonCoreText.LOGIN_LOGOUT.getDisplayText(aDisplayLocale)));
} else {
final BootstrapNavbarNav aNav = aToggleable.addAndReturnNav();
final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
{
final HCDiv aDiv = new HCDiv().addClass(CBootstrapCSS.P_2).addStyle(CCSSProperties.MIN_WIDTH.newValue("400px"));
aDiv.addChild(SMPCommonUI.createViewLoginForm(aLEC, null));
aDropDown.addChild(aDiv);
}
aNav.addItem().addNavDropDown("Login", aDropDown);
}
}
use of com.helger.photon.bootstrap4.dropdown.BootstrapDropdownMenu in project phoss-directory by phax.
the class PublicHTMLProvider method _addNavbarLoginLogout.
private static void _addNavbarLoginLogout(@Nonnull final LayoutExecutionContext aLEC, @Nonnull final BootstrapNavbar aNavbar) {
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
final Locale aDisplayLocale = aLEC.getDisplayLocale();
// Documentation
{
final BootstrapNavbarNav aNav = aNavbar.addAndReturnNav();
final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
aDropDown.createAndAddItem().addChild("Introduction").setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_DOCS_INTRODUCTION));
aDropDown.createAndAddItem().addChild("How to use it").setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_DOCS_HOW_TO));
aDropDown.createAndAddItem().addChild("REST API").setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_DOCS_REST_API));
aDropDown.createAndAddItem().addChild("Export data").setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_DOCS_EXPORT_ALL));
aDropDown.createAndAddItem().addChild("Specification v1.1.1 (PDF)").setHref(LinkHelper.getURLWithContext("/files/PEPPOL-EDN-Directory-1.1.1-2020-10-15.pdf"));
aDropDown.createAndAddItem().addChild("Guide for SMP providers (PDF)").setHref(LinkHelper.getURLWithContext("/files/OpenPEPPOL Directory for SMP providers 2016-12-05.pdf"));
aNav.addItem().addNavDropDown("Documentation", aDropDown);
}
// Support
{
final BootstrapNavbarNav aNav = aNavbar.addAndReturnNav();
final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
if (PDServerConfiguration.isWebAppShowContactPage()) {
final String sTitle = PDServerConfiguration.getWebAppContactTitle("Contact us");
final URL aExternalURL = PDServerConfiguration.getWebAppContactExternalURL();
if (aExternalURL != null)
aDropDown.createAndAddItem().addChild(sTitle).setHref(new SimpleURL(aExternalURL));
else
aDropDown.createAndAddItem().addChild(sTitle).setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_SUPPORT_CONTACT_US));
}
aDropDown.createAndAddItem().addChild("Issue tracker (external)").setHref(new SimpleURL("https://github.com/phax/phoss-directory/issues")).setTargetBlank();
aNav.addItem().addNavDropDown("Support", aDropDown);
}
// About
{
final BootstrapNavbarNav aNav = aNavbar.addAndReturnNav();
final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
aDropDown.createAndAddItem().addChild("About " + CPDPublisher.getApplication()).setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_ABOUT));
aNav.addItem().addNavDropDown("About", aDropDown);
}
final BootstrapNavbarToggleable aToggleable = aNavbar.addAndReturnToggleable();
// Login etc
{
final IUser aUser = LoggedInUserManager.getInstance().getCurrentUser();
if (aUser != null) {
aToggleable.addAndReturnText().addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MR_2).addChild("Welcome ").addChild(new HCStrong().addChild(SecurityHelper.getUserDisplayName(aUser, aDisplayLocale)));
if (SecurityHelper.hasUserRole(aUser.getID(), AppSecurity.ROLE_CONFIG_ID)) {
aToggleable.addChild(new BootstrapButton().addClass(CBootstrapCSS.MR_2).addChild("Goto secure area").setOnClick(LinkHelper.getURLWithContext(AbstractSecureApplicationServlet.SERVLET_DEFAULT_PATH + "/")));
}
aToggleable.addChild(new BootstrapButton().setOnClick(LinkHelper.getURLWithContext(aRequestScope, LogoutServlet.SERVLET_DEFAULT_PATH)).addChild(EPhotonCoreText.LOGIN_LOGOUT.getDisplayText(aDisplayLocale)).addStyle(CCSSProperties.MARGIN_RIGHT.newValue("8px")));
} else {
final BootstrapNavbarNav aNav = aToggleable.addAndReturnNav();
final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
{
final HCDiv aDiv = new HCDiv().addClass(CBootstrapCSS.P_2).addStyle(CCSSProperties.MIN_WIDTH.newValue("400px"));
aDiv.addChild(AppCommonUI.createViewLoginForm(aLEC, null));
aDropDown.addChild(aDiv);
}
aNav.addItem().addNavDropDown("Login", aDropDown);
}
}
}
Aggregations