Search in sources :

Example 1 with HCSpan

use of com.helger.html.hc.html.textlevel.HCSpan in project phoss-directory by phax.

the class SecureHTMLProvider method _getNavbar.

@Nonnull
private static IHCNode _getNavbar(@Nonnull final SimpleWebExecutionContext aSWEC) {
    final Locale aDisplayLocale = aSWEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aSWEC.getRequestScope();
    final ISimpleURL aLinkToStartPage = aSWEC.getLinkToMenuItem(aSWEC.getMenuTree().getDefaultMenuItemID());
    final BootstrapNavbar aNavbar = new BootstrapNavbar();
    aNavbar.addBrand(new HCNodeList().addChild(new HCSpan().addClass(AppCommonUI.CSS_CLASS_LOGO1).addChild(CPDPublisher.getApplicationTitle())).addChild(new HCSpan().addClass(AppCommonUI.CSS_CLASS_LOGO2).addChild(" Administration")), aLinkToStartPage);
    final BootstrapNavbarToggleable aToggleable = aNavbar.addAndReturnToggleable();
    {
        final IUser aUser = LoggedInUserManager.getInstance().getCurrentUser();
        aToggleable.addAndReturnText().addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MX_2).addChild("Welcome ").addChild(new HCStrong().addChild(SecurityHelper.getUserDisplayName(aUser, aDisplayLocale)));
        aToggleable.addChild(new BootstrapButton().addClass(CBootstrapCSS.MX_2).addChild("Goto public area").setOnClick(LinkHelper.getURLWithContext(AbstractPublicApplicationServlet.SERVLET_DEFAULT_PATH + "/")));
        aToggleable.addChild(new BootstrapButton().addClass(CBootstrapCSS.MX_2).setOnClick(LinkHelper.getURLWithContext(aRequestScope, LogoutServlet.SERVLET_DEFAULT_PATH)).addChild(EPhotonCoreText.LOGIN_LOGOUT.getDisplayText(aDisplayLocale)));
    }
    return aNavbar;
}
Also used : Locale(java.util.Locale) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) HCSpan(com.helger.html.hc.html.textlevel.HCSpan) HCStrong(com.helger.html.hc.html.textlevel.HCStrong) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapNavbar(com.helger.photon.bootstrap4.navbar.BootstrapNavbar) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapNavbarToggleable(com.helger.photon.bootstrap4.navbar.BootstrapNavbarToggleable) IUser(com.helger.photon.security.user.IUser) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) Nonnull(javax.annotation.Nonnull)

Example 2 with HCSpan

use of com.helger.html.hc.html.textlevel.HCSpan in project phoss-directory by phax.

the class PublicHTMLProvider method _getNavbar.

@Nonnull
private static BootstrapNavbar _getNavbar(@Nonnull final LayoutExecutionContext aLEC) {
    final ISimpleURL aLinkToStartPage = aLEC.getLinkToMenuItem(aLEC.getMenuTree().getDefaultMenuItemID());
    final BootstrapNavbar aNavbar = new BootstrapNavbar();
    final HCImg aImg = AppCommonUI.createLogoImg();
    if (aImg != null)
        aNavbar.addBrand(aImg, aLinkToStartPage);
    aNavbar.addBrand(new HCSpan().addClass(AppCommonUI.CSS_CLASS_LOGO1).addChild(CPDPublisher.getApplicationTitle()), aLinkToStartPage);
    _addNavbarLoginLogout(aLEC, aNavbar);
    return aNavbar;
}
Also used : HCSpan(com.helger.html.hc.html.textlevel.HCSpan) BootstrapNavbar(com.helger.photon.bootstrap4.navbar.BootstrapNavbar) ISimpleURL(com.helger.commons.url.ISimpleURL) HCImg(com.helger.html.hc.html.embedded.HCImg) Nonnull(javax.annotation.Nonnull)

Example 3 with HCSpan

use of com.helger.html.hc.html.textlevel.HCSpan in project phoss-smp by phax.

the class SMPRendererPublic method createDefaultFooter.

/**
 * @param bShowApplicationName
 *        <code>true</code> to show the application name and version,
 *        <code>false</code> to hide it.
 * @param bShowSource
 *        <code>true</code> to show the link to the source, <code>false</code>
 *        to hide it.
 * @param bShowAuthor
 *        <code>true</code> to show the author, <code>false</code> to hide it.
 * @return The footer to be used for /public and /secure. Never
 *         <code>null</code> but maybe empty.
 */
@Nonnull
public static BootstrapContainer createDefaultFooter(final boolean bShowApplicationName, final boolean bShowSource, final boolean bShowAuthor) {
    final BootstrapContainer aContainer = new BootstrapContainer().setID(CLayout.LAYOUT_AREAID_FOOTER).setFluid(true);
    if (bShowApplicationName) {
        aContainer.addChild(new HCP().addChild(CSMP.getApplicationTitleAndVersion() + " with " + SMPServerConfiguration.getRESTType().getDisplayName() + " API"));
    }
    // By
    {
        final HCP aBy = new HCP();
        // Author
        if (bShowAuthor)
            aBy.addChild("Created by ").addChild(HCA_MailTo.createLinkedEmail("philip@helger.com", "Philip Helger"));
        // Source
        if (bShowSource) {
            if (aBy.hasChildren())
                aBy.addChild(" - ");
            aBy.addChild(new HCA(new SimpleURL("https://github.com/phax/phoss-smp")).setTargetBlank().addChild(CSMP.APPLICATION_TITLE + " on GitHub"));
        }
        if (aBy.hasChildren())
            aContainer.addChild(aBy);
    }
    // Imprint
    if (SMPWebAppConfiguration.isImprintEnabled()) {
        final String sImprintText = SMPWebAppConfiguration.getImprintText();
        if (StringHelper.hasText(sImprintText)) {
            final ISimpleURL aImprintHref = SMPWebAppConfiguration.getImprintHref();
            final IHCElementWithChildren<?> aNode;
            if (aImprintHref != null) {
                // Link and text
                final String sImprintTarget = SMPWebAppConfiguration.getImprintTarget();
                final HC_Target aTarget = StringHelper.hasText(sImprintTarget) ? new HC_Target(sImprintTarget) : null;
                aNode = new HCA(aImprintHref).addChild(sImprintText).setTarget(aTarget);
            } else {
                // Text only
                aNode = new HCSpan().addChild(sImprintText);
            }
            // Already trimmed
            final String sImprintCSSClasses = SMPWebAppConfiguration.getImprintCSSClasses();
            if (StringHelper.hasText(sImprintCSSClasses)) {
                final ICommonsSet<String> aUniqueNames = new CommonsHashSet<>(RegExHelper.getSplitToList(sImprintCSSClasses, "\\s+"));
                for (final String sCSSClass : aUniqueNames) aNode.addClass(DefaultCSSClassProvider.create(sCSSClass));
            }
            aContainer.addChild(new HCP().addChild("Imprint ").addChild(aNode));
        }
    }
    return aContainer;
}
Also used : HCSpan(com.helger.html.hc.html.textlevel.HCSpan) BootstrapContainer(com.helger.photon.bootstrap4.layout.BootstrapContainer) HCP(com.helger.html.hc.html.grouping.HCP) HC_Target(com.helger.html.hc.html.HC_Target) HCA(com.helger.html.hc.html.textlevel.HCA) ISimpleURL(com.helger.commons.url.ISimpleURL) CommonsHashSet(com.helger.commons.collection.impl.CommonsHashSet) SimpleURL(com.helger.commons.url.SimpleURL) ISimpleURL(com.helger.commons.url.ISimpleURL) Nonnull(javax.annotation.Nonnull)

Example 4 with HCSpan

use of com.helger.html.hc.html.textlevel.HCSpan in project phoss-smp by phax.

the class SMPRendererSecure method getContent.

@Nonnull
public static IHCNode getContent(@Nonnull final ILayoutExecutionContext aLEC) {
    final HCNodeList ret = new HCNodeList();
    final BootstrapContainer aOuterContainer = ret.addAndReturnChild(new BootstrapContainer().setFluid(true));
    // Header
    aOuterContainer.addChild(_getNavbar(aLEC));
    // Breadcrumbs
    if (false) {
        final BootstrapBreadcrumb aBreadcrumbs = BootstrapBreadcrumbProvider.createBreadcrumb(aLEC);
        aBreadcrumbs.addClasses(CBootstrapCSS.D_NONE, CBootstrapCSS.D_SM_BLOCK);
        aOuterContainer.addChild(aBreadcrumbs);
    }
    // Content
    {
        final HCDiv aRow = aOuterContainer.addAndReturnChild(new HCDiv().addClass(CBootstrapCSS.D_MD_FLEX).addClass(CBootstrapCSS.MT_2));
        final HCDiv aCol1 = aRow.addAndReturnChild(new HCDiv().addClass(CBootstrapCSS.D_MD_FLEX).addClass(CBootstrapCSS.MR_2));
        final HCDiv aCol2 = aRow.addAndReturnChild(new HCDiv().addClass(CBootstrapCSS.FLEX_FILL));
        // left
        // We need a wrapper span for easy AJAX content replacement
        aCol1.addClass(CBootstrapCSS.D_PRINT_NONE).addChild(new HCSpan().setID(CLayout.LAYOUT_AREAID_MENU).addChild(getMenuContent(aLEC)));
        aCol1.addChild(new HCDiv().setID(CLayout.LAYOUT_AREAID_SPECIAL));
        // content - determine is exactly same as for view
        aCol2.addChild(BootstrapPageRenderer.getPageContent(aLEC));
    }
    aOuterContainer.addChild(SMPRendererPublic.createDefaultFooter(true, true, true));
    return ret;
}
Also used : HCDiv(com.helger.html.hc.html.grouping.HCDiv) HCSpan(com.helger.html.hc.html.textlevel.HCSpan) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapContainer(com.helger.photon.bootstrap4.layout.BootstrapContainer) BootstrapBreadcrumb(com.helger.photon.bootstrap4.breadcrumb.BootstrapBreadcrumb) Nonnull(javax.annotation.Nonnull)

Example 5 with HCSpan

use of com.helger.html.hc.html.textlevel.HCSpan in project phoss-smp by phax.

the class SMPRendererSecure method _getNavbar.

@Nonnull
private static IHCNode _getNavbar(@Nonnull final ILayoutExecutionContext aLEC) {
    final Locale aDisplayLocale = aLEC.getDisplayLocale();
    final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
    final ISimpleURL aLinkToStartPage = aLEC.getLinkToMenuItem(aLEC.getMenuTree().getDefaultMenuItemID());
    final BootstrapNavbar aNavbar = new BootstrapNavbar();
    aNavbar.addBrand(SMPRendererPublic.createLogo(aLEC), aLinkToStartPage);
    aNavbar.addBrand(new HCSpan().addChild(CSMP.getApplicationSuffix() + " Administration"), aLinkToStartPage);
    aNavbar.addAndReturnText().addChild(" [" + SMPServerConfiguration.getSMLSMPID() + "]");
    final BootstrapNavbarToggleable aToggleable = aNavbar.addAndReturnToggleable();
    {
        aToggleable.addChild(new BootstrapButton().addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MR_2).setOnClick(LinkHelper.getURLWithContext(AbstractPublicApplicationServlet.SERVLET_DEFAULT_PATH + "/")).addChild("Goto public view"));
        final IUser aUser = aLEC.getLoggedInUser();
        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, LogoutServlet.SERVLET_DEFAULT_PATH)).addChild(EPhotonCoreText.LOGIN_LOGOUT.getDisplayText(aDisplayLocale)));
    }
    return aNavbar;
}
Also used : Locale(java.util.Locale) IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) HCSpan(com.helger.html.hc.html.textlevel.HCSpan) HCStrong(com.helger.html.hc.html.textlevel.HCStrong) BootstrapNavbar(com.helger.photon.bootstrap4.navbar.BootstrapNavbar) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapNavbarToggleable(com.helger.photon.bootstrap4.navbar.BootstrapNavbarToggleable) IUser(com.helger.photon.security.user.IUser) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) Nonnull(javax.annotation.Nonnull)

Aggregations

HCSpan (com.helger.html.hc.html.textlevel.HCSpan)7 Nonnull (javax.annotation.Nonnull)7 ISimpleURL (com.helger.commons.url.ISimpleURL)5 BootstrapNavbar (com.helger.photon.bootstrap4.navbar.BootstrapNavbar)4 HCNodeList (com.helger.html.hc.impl.HCNodeList)3 BootstrapContainer (com.helger.photon.bootstrap4.layout.BootstrapContainer)3 HCDiv (com.helger.html.hc.html.grouping.HCDiv)2 HCStrong (com.helger.html.hc.html.textlevel.HCStrong)2 BootstrapBreadcrumb (com.helger.photon.bootstrap4.breadcrumb.BootstrapBreadcrumb)2 BootstrapButton (com.helger.photon.bootstrap4.button.BootstrapButton)2 BootstrapNavbarToggleable (com.helger.photon.bootstrap4.navbar.BootstrapNavbarToggleable)2 IUser (com.helger.photon.security.user.IUser)2 IRequestWebScopeWithoutResponse (com.helger.web.scope.IRequestWebScopeWithoutResponse)2 Locale (java.util.Locale)2 CommonsHashSet (com.helger.commons.collection.impl.CommonsHashSet)1 SimpleURL (com.helger.commons.url.SimpleURL)1 HC_Target (com.helger.html.hc.html.HC_Target)1 HCImg (com.helger.html.hc.html.embedded.HCImg)1 HCP (com.helger.html.hc.html.grouping.HCP)1 HCA (com.helger.html.hc.html.textlevel.HCA)1