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"));
}
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;
}
};
}
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;
}
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;
}
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;
}
Aggregations