Search in sources :

Example 1 with HCDiv

use of com.helger.html.hc.html.grouping.HCDiv in project phoss-directory by phax.

the class PageSecureParticipantActions method _showDuplicateIDs.

private void _showDuplicateIDs(@Nonnull final WebPageExecutionContext aWPEC) {
    // This method can take a couple of minutes
    LOGGER.info("Showing all duplicate participant identifiers");
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final ICommonsMap<IParticipantIdentifier, ICommonsSortedSet<String>> aDupMap = _getDuplicateSourceMap();
    final HCNodeList aNL = new HCNodeList();
    for (final Map.Entry<IParticipantIdentifier, ICommonsSortedSet<String>> aEntry : aDupMap.entrySet()) {
        final ICommonsSortedSet<String> aSet = aEntry.getValue();
        final IParticipantIdentifier aPI = aEntry.getKey();
        final String sDesiredVersion = aPI.getURIEncoded();
        final HCDiv aDiv = div("Found " + aSet.size() + " duplicate IDs for ").addChild(code(sDesiredVersion)).addChild(":");
        final HCOL aOL = aDiv.addAndReturnChild(new HCOL());
        for (final String sVersion : aSet.getSorted(IComparator.getComparatorCollating(aDisplayLocale))) {
            final boolean bIsDesired = sDesiredVersion.equals(sVersion);
            final IHCLI<?> aLI = aOL.addAndReturnItem(code(sVersion));
            if (bIsDesired)
                aLI.addChild(" ").addChild(badgeSuccess("desired version"));
        }
        aNL.addChild(aDiv);
    }
    if (aNL.hasChildren()) {
        final String sMsg = "Found duplicate entries for " + aDupMap.size() + " " + (aDupMap.size() == 1 ? "participant" : "participants");
        LOGGER.info(sMsg);
        aNL.addChildAt(0, h2(sMsg));
        aWPEC.postRedirectGetInternal(aNL);
    } else
        aWPEC.postRedirectGetInternal(success("Found no duplicate entries"));
}
Also used : Locale(java.util.Locale) HCDiv(com.helger.html.hc.html.grouping.HCDiv) HCNodeList(com.helger.html.hc.impl.HCNodeList) PDTToString(com.helger.commons.datetime.PDTToString) ICommonsSortedSet(com.helger.commons.collection.impl.ICommonsSortedSet) HCOL(com.helger.html.hc.html.grouping.HCOL) Map(java.util.Map) ICommonsMap(com.helger.commons.collection.impl.ICommonsMap) CommonsHashMap(com.helger.commons.collection.impl.CommonsHashMap) IParticipantIdentifier(com.helger.peppolid.IParticipantIdentifier)

Example 2 with HCDiv

use of com.helger.html.hc.html.grouping.HCDiv in project phoss-directory by phax.

the class PDLoginManager method createLoginScreen.

@Override
protected IHTMLProvider createLoginScreen(final boolean bLoginError, @Nonnull final ICredentialValidationResult aLoginResult) {
    return new BootstrapLoginHTMLProvider(bLoginError, aLoginResult, getPageTitle()) {

        @Override
        @Nullable
        protected IHCNode createFormFooter(@Nonnull final ISimpleWebExecutionContext aSWEC) {
            final HCDiv aDiv = new HCDiv().addClass(CBootstrapCSS.D_FLEX).addClass(CBootstrapCSS.MT_5);
            aDiv.addChild(new HCSmall().addChild(CPDPublisher.getApplicationTitleWithVersion() + " / " + CDirectoryVersion.BUILD_TIMESTAMP));
            return aDiv;
        }
    };
}
Also used : HCDiv(com.helger.html.hc.html.grouping.HCDiv) BootstrapLoginHTMLProvider(com.helger.photon.bootstrap4.uictrls.ext.BootstrapLoginHTMLProvider) Nonnull(javax.annotation.Nonnull) HCSmall(com.helger.html.hc.html.textlevel.HCSmall) ISimpleWebExecutionContext(com.helger.photon.core.execcontext.ISimpleWebExecutionContext)

Example 3 with HCDiv

use of com.helger.html.hc.html.grouping.HCDiv in project phoss-smp by phax.

the class PageSecureBusinessCard method showBusinessCardEntity.

@Nonnull
public static IHCNode showBusinessCardEntity(@Nonnull final SMPBusinessCardEntity aEntity, final int nIndex, @Nonnull final Locale aDisplayLocale) {
    final BootstrapCard aPanel = new BootstrapCard();
    aPanel.createAndAddHeader().addChild("Business Entity " + nIndex);
    final BootstrapViewForm aForm2 = aPanel.createAndAddBody().addAndReturnChild(new BootstrapViewForm());
    aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Name").setCtrl(aEntity.names().getFirst().getName()));
    {
        final Locale aCountry = CountryCache.getInstance().getCountry(aEntity.getCountryCode());
        final HCNodeList aCtrl = new HCNodeList();
        final EFamFamFlagIcon eIcon = EFamFamFlagIcon.getFromIDOrNull(aCountry.getCountry());
        if (eIcon != null) {
            aCtrl.addChild(eIcon.getAsNode());
            aCtrl.addChild(" ");
        }
        aCtrl.addChild(aCountry.getDisplayCountry(aDisplayLocale) + " [" + aEntity.getCountryCode() + "]");
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Country code").setCtrl(aCtrl));
    }
    if (aEntity.hasGeographicalInformation()) {
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Geographical information").setCtrl(HCExtHelper.nl2divList(aEntity.getGeographicalInformation())));
    }
    if (aEntity.identifiers().isNotEmpty()) {
        final BootstrapTable aTable = new BootstrapTable(HCCol.star(), HCCol.star());
        aTable.addHeaderRow().addCells("Scheme", "Value");
        for (final SMPBusinessCardIdentifier aIdentifier : aEntity.identifiers()) aTable.addBodyRow().addCells(aIdentifier.getScheme(), aIdentifier.getValue());
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Identifiers").setCtrl(aTable));
    }
    if (aEntity.websiteURIs().isNotEmpty()) {
        final HCNodeList aNL = new HCNodeList();
        for (final String sWebsiteURI : aEntity.websiteURIs()) aNL.addChild(new HCDiv().addChild(HCA.createLinkedWebsite(sWebsiteURI)));
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Website URIs").setCtrl(aNL));
    }
    if (aEntity.contacts().isNotEmpty()) {
        final BootstrapTable aTable = new BootstrapTable(HCCol.star(), HCCol.star(), HCCol.star(), HCCol.star());
        aTable.addHeaderRow().addCells("Type", "Name", "Phone number", "Email address");
        for (final SMPBusinessCardContact aContact : aEntity.contacts()) {
            final HCRow aBodyRow = aTable.addBodyRow();
            aBodyRow.addCells(aContact.getType(), aContact.getName(), aContact.getPhoneNumber());
            aBodyRow.addCell(HCA_MailTo.createLinkedEmail(aContact.getEmail()));
        }
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Contacts").setCtrl(aTable));
    }
    if (aEntity.hasAdditionalInformation()) {
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Additional information").setCtrl(HCExtHelper.nl2divList(aEntity.getAdditionalInformation())));
    }
    if (aEntity.hasRegistrationDate()) {
        aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Registration date").setCtrl(PDTToString.getAsString(aEntity.getRegistrationDate(), aDisplayLocale)));
    }
    return aPanel;
}
Also used : Locale(java.util.Locale) HCDiv(com.helger.html.hc.html.grouping.HCDiv) SMPBusinessCardContact(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardContact) BootstrapCard(com.helger.photon.bootstrap4.card.BootstrapCard) HCNodeList(com.helger.html.hc.impl.HCNodeList) EFamFamFlagIcon(com.helger.photon.uictrls.famfam.EFamFamFlagIcon) BootstrapTable(com.helger.photon.bootstrap4.table.BootstrapTable) BootstrapViewForm(com.helger.photon.bootstrap4.form.BootstrapViewForm) HCRow(com.helger.html.hc.html.tabular.HCRow) PDTToString(com.helger.commons.datetime.PDTToString) PDTFromString(com.helger.commons.datetime.PDTFromString) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) SMPBusinessCardIdentifier(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardIdentifier) Nonnull(javax.annotation.Nonnull)

Example 4 with HCDiv

use of com.helger.html.hc.html.grouping.HCDiv in project phoss-smp by phax.

the class SMPCommonUI method createCertificateDetailsTable.

@Nonnull
public static BootstrapTable createCertificateDetailsTable(@Nullable final String sAlias, @Nonnull final X509Certificate aX509Cert, @Nonnull final LocalDateTime aNowLDT, @Nonnull final Locale aDisplayLocale) {
    final LocalDateTime aNotBefore = PDTFactory.createLocalDateTime(aX509Cert.getNotBefore());
    final LocalDateTime aNotAfter = PDTFactory.createLocalDateTime(aX509Cert.getNotAfter());
    final PublicKey aPublicKey = aX509Cert.getPublicKey();
    final BootstrapTable aCertDetails = new BootstrapTable(new HCCol().addStyle(CCSSProperties.WIDTH.newValue("12rem")), HCCol.star());
    aCertDetails.setResponsive(true);
    if (StringHelper.hasText(sAlias))
        aCertDetails.addBodyRow().addCell("Alias:").addCell(sAlias);
    aCertDetails.addBodyRow().addCell("Version:").addCell(Integer.toString(aX509Cert.getVersion()));
    aCertDetails.addBodyRow().addCell("Subject:").addCell(aX509Cert.getSubjectX500Principal().getName());
    aCertDetails.addBodyRow().addCell("Issuer:").addCell(aX509Cert.getIssuerX500Principal().getName());
    aCertDetails.addBodyRow().addCell("Serial number:").addCell(aX509Cert.getSerialNumber().toString() + " / 0x" + _inGroupsOf(aX509Cert.getSerialNumber().toString(16), 4));
    aCertDetails.addBodyRow().addCell("Valid from:").addCell(new HCTextNode(PDTToString.getAsString(aNotBefore, aDisplayLocale) + " "), aNowLDT.isBefore(aNotBefore) ? new BootstrapBadge(EBootstrapBadgeType.DANGER).addChild("!!!NOT YET VALID!!!") : null);
    aCertDetails.addBodyRow().addCell("Valid to:").addCell(new HCTextNode(PDTToString.getAsString(aNotAfter, aDisplayLocale) + " "), aNowLDT.isAfter(aNotAfter) ? new BootstrapBadge(EBootstrapBadgeType.DANGER).addChild("!!!NO LONGER VALID!!!") : new HCDiv().addChild("Valid for: " + PDTDisplayHelper.getPeriodTextEN(aNowLDT, aNotAfter)));
    if (aPublicKey instanceof RSAPublicKey) {
        // Special handling for RSA
        aCertDetails.addBodyRow().addCell("Public key:").addCell(aX509Cert.getPublicKey().getAlgorithm() + " (" + ((RSAPublicKey) aPublicKey).getModulus().bitLength() + " bits)");
    } else {
        // Usually EC or DSA key
        aCertDetails.addBodyRow().addCell("Public key:").addCell(aX509Cert.getPublicKey().getAlgorithm());
    }
    aCertDetails.addBodyRow().addCell("Signature algorithm:").addCell(aX509Cert.getSigAlgName() + " (" + aX509Cert.getSigAlgOID() + ")");
    return aCertDetails;
}
Also used : LocalDateTime(java.time.LocalDateTime) HCDiv(com.helger.html.hc.html.grouping.HCDiv) HCCol(com.helger.html.hc.html.tabular.HCCol) BootstrapBadge(com.helger.photon.bootstrap4.badge.BootstrapBadge) BootstrapTable(com.helger.photon.bootstrap4.table.BootstrapTable) RSAPublicKey(java.security.interfaces.RSAPublicKey) RSAPublicKey(java.security.interfaces.RSAPublicKey) PublicKey(java.security.PublicKey) HCTextNode(com.helger.html.hc.impl.HCTextNode) Nonnull(javax.annotation.Nonnull)

Example 5 with HCDiv

use of com.helger.html.hc.html.grouping.HCDiv in project phoss-smp by phax.

the class SMPLoginHTMLProvider method createPageHeader.

@Override
@Nonnull
protected IHCNode createPageHeader(@Nonnull final ISimpleWebExecutionContext aSWEC, @Nullable final IHCNode aPageTitle) {
    final HCNodeList ret = new HCNodeList();
    ret.addChild(new HCDiv().addClass(CBootstrapCSS.MB_3).addChild(SMPRendererPublic.createLogoBig(aSWEC)));
    ret.addChild(new BootstrapPageHeader().addChild("Administration - Login"));
    return ret;
}
Also used : HCDiv(com.helger.html.hc.html.grouping.HCDiv) HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapPageHeader(com.helger.photon.bootstrap4.utils.BootstrapPageHeader) Nonnull(javax.annotation.Nonnull)

Aggregations

HCDiv (com.helger.html.hc.html.grouping.HCDiv)20 Nonnull (javax.annotation.Nonnull)13 HCNodeList (com.helger.html.hc.impl.HCNodeList)11 Locale (java.util.Locale)9 BootstrapTable (com.helger.photon.bootstrap4.table.BootstrapTable)6 IRequestWebScopeWithoutResponse (com.helger.web.scope.IRequestWebScopeWithoutResponse)6 PDTToString (com.helger.commons.datetime.PDTToString)5 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)5 BootstrapButton (com.helger.photon.bootstrap4.button.BootstrapButton)5 HCEdit (com.helger.html.hc.html.forms.HCEdit)4 HCTextNode (com.helger.html.hc.impl.HCTextNode)4 ICommonsList (com.helger.commons.collection.impl.ICommonsList)3 ICommonsMap (com.helger.commons.collection.impl.ICommonsMap)3 ISimpleURL (com.helger.commons.url.ISimpleURL)3 HCA (com.helger.html.hc.html.textlevel.HCA)3 HCSmall (com.helger.html.hc.html.textlevel.HCSmall)3 HCStrong (com.helger.html.hc.html.textlevel.HCStrong)3 JQueryAjaxBuilder (com.helger.html.jquery.JQueryAjaxBuilder)3 JSAnonymousFunction (com.helger.html.jscode.JSAnonymousFunction)3 JSAssocArray (com.helger.html.jscode.JSAssocArray)3