use of com.helger.html.hc.html.textlevel.HCCode in project phoss-directory by phax.
the class PageSecureAdminSMLConfiguration method showInputForm.
@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMLInfo aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
final boolean bEdit = eFormAction.isEdit();
aForm.addChild(getUIHandler().createActionHeader(bEdit ? "Edit SML configuration '" + aSelectedObject.getDisplayName() + "'" : "Create new SML configuration"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Name").setCtrl(new HCEdit(new RequestField(FIELD_DISPLAY_NAME, aSelectedObject != null ? aSelectedObject.getDisplayName() : null))).setHelpText("The name of the SML configuration. This is for informational purposes only and has no effect on the functionality.").setErrorList(aFormErrors.getListOfField(FIELD_DISPLAY_NAME)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("DNS Zone").setCtrl(new HCEdit(new RequestField(FIELD_DNS_ZONE, aSelectedObject != null ? aSelectedObject.getDNSZone() : null))).setHelpText(new HCTextNode("The name of the DNS Zone that this SML is working upon (e.g. "), new HCCode().addChild("sml.peppolcentral.org"), new HCTextNode("). The value will automatically converted to all-lowercase!")).setErrorList(aFormErrors.getListOfField(FIELD_DNS_ZONE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Management Service URL").setCtrl(new HCEdit(new RequestField(FIELD_MANAGEMENT_ADDRESS_URL, aSelectedObject != null ? aSelectedObject.getManagementServiceURL() : null))).setHelpText("The service URL where the SML management application is running on including the host name. It may not contain the '" + CSMLDefault.MANAGEMENT_SERVICE_METADATA + "' or '" + CSMLDefault.MANAGEMENT_SERVICE_PARTICIPANTIDENTIFIER + "' path elements!").setErrorList(aFormErrors.getListOfField(FIELD_MANAGEMENT_ADDRESS_URL)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Client Certificate required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_CLIENT_CERTIFICATE_REQUIRED, aSelectedObject != null ? aSelectedObject.isClientCertificateRequired() : true))).setHelpText("Check this if this SML requires a client certificate for access. Both Peppol production SML and SMK require a client certificate. Only a locally running SML software may not require a client certificate.").setErrorList(aFormErrors.getListOfField(FIELD_CLIENT_CERTIFICATE_REQUIRED)));
}
use of com.helger.html.hc.html.textlevel.HCCode in project phoss-smp by phax.
the class PageSecureEndpointChangeCertificate method _getCertificateDisplay.
@Nonnull
private static IHCNode _getCertificateDisplay(@Nullable final String sCert, @Nonnull final Locale aDisplayLocale) {
X509Certificate aEndpointCert = null;
try {
aEndpointCert = CertificateHelper.convertStringToCertficate(sCert);
} catch (final Exception ex) {
// Ignore
}
if (aEndpointCert == null) {
final int nDisplayLen = 20;
final String sCertPart = (sCert.length() > nDisplayLen ? sCert.substring(0, 20) + "..." : sCert);
final HCDiv ret = new HCDiv().addChild("Invalid certificate").addChild(sCert.length() > nDisplayLen ? " starting with: " : ": ");
if (sCertPart.length() > 0)
ret.addChild(new HCCode().addChild(sCertPart));
else
ret.addChild(new HCEM().addChild("empty"));
return ret;
}
final HCNodeList ret = new HCNodeList();
ret.addChild(new HCDiv().addChild("Issuer: " + aEndpointCert.getIssuerX500Principal().toString()));
ret.addChild(new HCDiv().addChild("Subject: " + aEndpointCert.getSubjectX500Principal().toString()));
final LocalDateTime aNotBefore = PDTFactory.createLocalDateTime(aEndpointCert.getNotBefore());
ret.addChild(new HCDiv().addChild("Not before: " + PDTToString.getAsString(aNotBefore, aDisplayLocale)));
final LocalDateTime aNotAfter = PDTFactory.createLocalDateTime(aEndpointCert.getNotAfter());
ret.addChild(new HCDiv().addChild("Not after: " + PDTToString.getAsString(aNotAfter, aDisplayLocale)));
return ret;
}
use of com.helger.html.hc.html.textlevel.HCCode in project phoss-smp by phax.
the class PageSecureServiceGroup method showListOfExistingObjects.
@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final HCNodeList aNodeList = aWPEC.getNodeList();
final ISMPServiceGroupManager aServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
final ISMPServiceInformationManager aServiceInfoMgr = SMPMetaManager.getServiceInformationMgr();
final ISMPBusinessCardManager aBCMgr = SMPMetaManager.getBusinessCardMgr();
final ISMPSettings aSettings = SMPMetaManager.getSettings();
final ESMPRESTType eRESTType = SMPServerConfiguration.getRESTType();
final boolean bShowExtensionDetails = SMPWebAppConfiguration.isServiceGroupsExtensionsShow();
final boolean bShowBusinessCardName = CSMP.ENABLE_ISSUE_56 && aSettings.isDirectoryIntegrationEnabled();
final ICommonsList<ISMPServiceGroup> aAllServiceGroups = aServiceGroupMgr.getAllSMPServiceGroups();
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
aToolbar.addButton("Create new Service group", createCreateURL(aWPEC), EDefaultIcon.NEW);
aToolbar.addButton("Refresh", aWPEC.getSelfHref(), EDefaultIcon.REFRESH);
if (aSettings.isSMLRequired() || aSettings.isSMLEnabled()) {
// Disable button if no SML URL is configured
// Disable button if no service group is present
aToolbar.addAndReturnButton("Check DNS state", aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_CHECK_DNS), EDefaultIcon.MAGNIFIER).setDisabled(aSettings.getSMLDNSZone() == null || aAllServiceGroups.isEmpty() || !aSettings.isSMLEnabled());
}
aNodeList.addChild(aToolbar);
final boolean bShowDetails = aAllServiceGroups.size() <= 1000;
final HCTable aTable = new HCTable(new DTCol("Participant ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Owner"), bShowBusinessCardName ? new DTCol("Business Card Name") : null, new DTCol(span(bShowExtensionDetails ? "Ext" : "Ext?").setTitle("Is an Extension present?")), bShowDetails ? new DTCol(span("Docs").setTitle("Number of assigned document types")).setDisplayType(EDTColType.INT, aDisplayLocale) : null, bShowDetails ? new DTCol(span("Procs").setTitle("Number of assigned processes")).setDisplayType(EDTColType.INT, aDisplayLocale) : null, bShowDetails ? new DTCol(span("EPs").setTitle("Number of assigned endpoints")).setDisplayType(EDTColType.INT, aDisplayLocale) : null, new BootstrapDTColAction(aDisplayLocale)).setID(getID());
for (final ISMPServiceGroup aCurObject : aAllServiceGroups) {
final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
final String sDisplayName = aCurObject.getParticipantIdentifier().getURIEncoded();
final HCRow aRow = aTable.addBodyRow();
aRow.addCell(new HCA(aViewLink).addChild(sDisplayName));
aRow.addCell(SMPCommonUI.getOwnerName(aCurObject.getOwnerID()));
if (bShowBusinessCardName) {
IHCNode aName = null;
final ISMPBusinessCard aBC = aBCMgr.getSMPBusinessCardOfServiceGroup(aCurObject);
if (aBC != null) {
final SMPBusinessCardEntity aEntity = aBC.getEntityAtIndex(0);
if (aEntity != null && aEntity.names().isNotEmpty())
aName = HCTextNode.createOnDemand(aEntity.names().getFirst().getName());
}
aRow.addCell(aName);
}
if (bShowExtensionDetails) {
if (aCurObject.extensions().isNotEmpty())
aRow.addCell(new HCCode().addChildren(HCExtHelper.nl2divList(aCurObject.getFirstExtensionXML())));
else
aRow.addCell();
} else {
aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.extensions().isNotEmpty(), aDisplayLocale));
}
if (bShowDetails) {
int nProcesses = 0;
int nEndpoints = 0;
final ICommonsList<ISMPServiceInformation> aSIs = aServiceInfoMgr.getAllSMPServiceInformationOfServiceGroup(aCurObject);
for (final ISMPServiceInformation aSI : aSIs) {
nProcesses += aSI.getProcessCount();
nEndpoints += aSI.getTotalEndpointCount();
}
aRow.addCell(Integer.toString(aSIs.size()));
aRow.addCell(Integer.toString(nProcesses));
aRow.addCell(Integer.toString(nEndpoints));
}
final HCNodeList aActions = new HCNodeList();
aActions.addChildren(createEditLink(aWPEC, aCurObject, "Edit " + sDisplayName), new HCTextNode(" "), createCopyLink(aWPEC, aCurObject, "Copy " + sDisplayName), new HCTextNode(" "), createDeleteLink(aWPEC, aCurObject, "Delete " + sDisplayName), new HCTextNode(" "), new HCA(LinkHelper.getURLWithServerAndContext(aCurObject.getParticipantIdentifier().getURIPercentEncoded())).setTitle("Perform SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
if (eRESTType.isCompleteServiceGroupSupported()) {
aActions.addChildren(new HCTextNode(" "), new HCA(LinkHelper.getURLWithServerAndContext("complete/" + aCurObject.getParticipantIdentifier().getURIPercentEncoded())).setTitle("Perform complete SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_LINK.getAsNode()));
}
aRow.addCell(aActions);
}
final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
aNodeList.addChild(aTable).addChild(aDataTables);
}
use of com.helger.html.hc.html.textlevel.HCCode in project phoss-directory by phax.
the class PDCommonUI method getDocumentTypeIDDetails.
@Nonnull
public static HCUL getDocumentTypeIDDetails(@Nonnull final IPeppolDocumentTypeIdentifierParts aParts) {
final HCUL aUL = new HCUL();
aUL.addItem().addChild("Root namespace: ").addChild(new HCCode().addChild(aParts.getRootNS()));
aUL.addItem().addChild("Local name: ").addChild(new HCCode().addChild(aParts.getLocalName()));
aUL.addItem().addChild("Customization ID: ").addChild(new HCCode().addChild(aParts.getCustomizationID()));
aUL.addItem().addChild("Version: ").addChild(new HCCode().addChild(aParts.getVersion()));
return aUL;
}
use of com.helger.html.hc.html.textlevel.HCCode in project phoss-directory by phax.
the class NiceNameUI method _createFormattedID.
@Nonnull
private static IHCNode _createFormattedID(@Nonnull final String sID, @Nullable final String sName, @Nullable final EBootstrapBadgeType eType, final boolean bIsDeprecated, final boolean bInDetails) {
if (sName == null) {
// No nice name present
if (bInDetails)
return new HCCode().addChild(sID);
return new HCTextNode(sID);
}
final HCNodeList ret = new HCNodeList();
ret.addChild(new BootstrapBadge(eType).addChild(sName));
if (bIsDeprecated) {
ret.addChild(" ").addChild(new BootstrapBadge(EBootstrapBadgeType.WARNING).addChild("Identifier is deprecated"));
}
if (bInDetails) {
ret.addChild(new HCSmall().addChild(" (").addChild(new HCCode().addChild(sID)).addChild(")"));
}
return ret;
}
Aggregations