use of com.helger.html.hc.html.forms.HCEdit in project phoss-smp by phax.
the class PageSecureTransportProfiles method showInputForm.
@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMPTransportProfile 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 transport profile '" + aSelectedObject.getID() + "'" : "Create new transport profile"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("ID").setCtrl(new HCEdit(new RequestField(FIELD_ID, aSelectedObject != null ? aSelectedObject.getID() : null)).setReadOnly(bEdit)).setHelpText("The ID of the transport profile to be used in SMP endpoints.").setErrorList(aFormErrors.getListOfField(FIELD_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Name").setCtrl(new HCEdit(new RequestField(FIELD_NAME, aSelectedObject != null ? aSelectedObject.getName() : null))).setHelpText("The name of the transport profile").setErrorList(aFormErrors.getListOfField(FIELD_NAME)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Deprecated?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_DEPRECATED, aSelectedObject != null ? aSelectedObject.isDeprecated() : DEFAULT_DEPRECATED))).setHelpText("Is the transport profile deprecated?").setErrorList(aFormErrors.getListOfField(FIELD_DEPRECATED)));
}
use of com.helger.html.hc.html.forms.HCEdit in project peppol-practical by phax.
the class PagePublicToolsIdentifierInformation method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final FormErrorList aFormErrors = new FormErrorList();
final boolean bShowInput = true;
boolean bShowHeader = true;
if (aWPEC.hasAction(CPageParam.ACTION_PERFORM)) {
// Validate fields
final String sIDType = aWPEC.params().getAsString(FIELD_ID_TYPE);
final EIDType eIDType = EIDType.getFromIDOrNull(sIDType);
String sIDValue = aWPEC.params().getAsStringTrimmed(FIELD_ID_VALUE);
final boolean bDecodeValue = aWPEC.params().isCheckBoxChecked(FIELD_ID_DECODE, DEFAULT_DECODE);
if (bDecodeValue) {
// Try decoding - else stick with the original
sIDValue = URLHelper.urlDecodeOrDefault(sIDValue, sIDValue);
}
if (StringHelper.hasNoText(sIDType))
aFormErrors.addFieldError(FIELD_ID_TYPE, "An identifier type must be selected");
else if (eIDType == null)
aFormErrors.addFieldError(FIELD_ID_TYPE, "An identifier type must be selected");
if (StringHelper.hasNoText(sIDValue))
aFormErrors.addFieldError(FIELD_ID_VALUE, "An identifier value must be provided");
if (aFormErrors.isEmpty()) {
STATS_COUNT.increment();
STATS_ID_TYPE.increment(eIDType.getID());
bShowHeader = false;
LOGGER.info("Checking identifier type " + eIDType.name() + " for value '" + sIDValue + "'");
final ErrorList aIDErrors = new ErrorList();
final ICommonsList<KVPair> aDetails = new CommonsArrayList<>();
// Perform the main validation
eIDType.getValidator().validate(sIDValue, aIDErrors, aDetails);
final IHCNode aDetailsNode;
if (aDetails.isEmpty())
aDetailsNode = null;
else {
final HCUL aULDetails = new HCUL();
for (final KVPair aPair : aDetails) aULDetails.addAndReturnItem(aPair.getKey() + ": ").addChild(aPair.hasValue() ? code(aPair.getValue()) : badgeInfo("empty string"));
aDetailsNode = new HCNodeList().addChild(div("Determined details are:")).addChild(aULDetails);
}
if (aIDErrors.containsNoError()) {
STATS_COUNT_SUCCESS.increment();
final IHCNode aWarningsNode;
final EBootstrapAlertType eAlertType;
if (aIDErrors.isEmpty()) {
// No errors, no warnings
eAlertType = EBootstrapAlertType.SUCCESS;
aWarningsNode = null;
} else {
// No errors but warnings
eAlertType = EBootstrapAlertType.WARNING;
final HCUL aUL = new HCUL();
for (final IError aError : aIDErrors) aUL.addItem(aError.getAsString(aDisplayLocale));
aWarningsNode = new HCNodeList().addChild(div("But there are some warnings:")).addChild(aUL);
}
aNodeList.addChild(new BootstrapBox(eAlertType).addChild(div("The identifier ").addChild(code(sIDValue)).addChild(" is valid according to the rules of '" + eIDType.getDisplayName() + "'")).addChild(aWarningsNode).addChild(aDetailsNode));
LOGGER.info(aIDErrors.isEmpty() ? "success" : "success with warning");
} else {
// At least one error
final HCUL aUL = new HCUL();
for (final IError aError : aIDErrors) aUL.addItem(aError.getAsString(aDisplayLocale));
aNodeList.addChild(error(div("The identifier ").addChild(code(sIDValue)).addChild(" is NOT valid according to the rules of '" + eIDType.getDisplayName() + "'")).addChild(aUL).addChild(aDetailsNode));
LOGGER.info("failure");
}
}
}
if (bShowInput) {
if (bShowHeader) {
final ICommonsOrderedMap<String, String> aRuleSets = new CommonsLinkedHashMap<>();
aRuleSets.put("Peppol Policy for use of Identifiers v" + IDENTIFIER_POLICY_VERSION, "https://docs.peppol.eu/edelivery/");
aRuleSets.put("Peppol Participant Identifier Code List v" + EPredefinedParticipantIdentifierScheme.CODE_LIST_VERSION, "https://docs.peppol.eu/edelivery/codelists/");
aRuleSets.put("Peppol Document Type Identifier Code List v" + EPredefinedDocumentTypeIdentifier.CODE_LIST_VERSION, "https://docs.peppol.eu/edelivery/codelists/");
aRuleSets.put("Peppol Process Identifier Code List v" + EPredefinedProcessIdentifier.CODE_LIST_VERSION, "https://docs.peppol.eu/edelivery/codelists/");
final HCUL aULRules = new HCUL();
for (final Map.Entry<String, String> aEntry : aRuleSets.entrySet()) aULRules.addAndReturnItem(aEntry.getKey() + " - ").addChild(new HCA(new SimpleURL(aEntry.getValue())).setTargetBlank().addChild("see details"));
aNodeList.addChild(info(div("This page lets you verify identifiers against official rules. Current rule sets are:")).addChild(aULRules));
}
final HCExtSelect aTypeSelect = new HCExtSelect(new RequestField(FIELD_ID_TYPE));
for (final EIDType e : EIDType.values()) aTypeSelect.addOption(e.getID(), e.getDisplayName());
aTypeSelect.addOptionPleaseSelect(aDisplayLocale);
final BootstrapForm aForm = aNodeList.addAndReturnChild(getUIHandler().createFormSelf(aWPEC).setFormType(EBootstrapFormType.DEFAULT).setMethod(EHCFormMethod.GET).setLeft(2));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Identifier type").setCtrl(aTypeSelect).setErrorList(aFormErrors.getListOfField(FIELD_ID_TYPE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Identifier value").setCtrl(new HCEdit(new RequestField(FIELD_ID_VALUE)).setPlaceholder("scheme::value")).setHelpText(div("The identifier value to be checked for consistency. It MUST contain the scheme (like ").addChild(code(PeppolIdentifierHelper.PARTICIPANT_SCHEME_ISO6523_ACTORID_UPIS)).addChild(", ").addChild(code(PeppolIdentifierHelper.DOCUMENT_TYPE_SCHEME_BUSDOX_DOCID_QNS)).addChild(" or ").addChild(code(PeppolIdentifierHelper.PROCESS_SCHEME_CENBII_PROCID_UBL)).addChild(") AND the value as one long string")).setErrorList(aFormErrors.getListOfField(FIELD_ID_VALUE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Try to URL decode the identifier value?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_ID_DECODE, DEFAULT_DECODE))).setErrorList(aFormErrors.getListOfField(FIELD_ID_DECODE)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addSubmitButton("Check identifier");
}
}
use of com.helger.html.hc.html.forms.HCEdit in project peppol-practical by phax.
the class PagePublicToolsParticipantInformation method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final ISMLConfigurationManager aSMLConfigurationMgr = PPMetaManager.getSMLConfigurationMgr();
final FormErrorList aFormErrors = new FormErrorList();
final boolean bShowInput = true;
String sParticipantIDScheme = DEFAULT_ID_SCHEME;
String sParticipantIDValue = null;
if (aWPEC.hasAction(CPageParam.ACTION_PERFORM)) {
// Validate fields
sParticipantIDScheme = StringHelper.trim(aWPEC.params().getAsString(FIELD_ID_SCHEME));
sParticipantIDValue = StringHelper.trim(aWPEC.params().getAsString(FIELD_ID_VALUE));
final String sSMLID = StringHelper.trim(aWPEC.params().getAsString(FIELD_SML));
final ISMLConfiguration aSMLConfiguration = aSMLConfigurationMgr.getSMLInfoOfID(sSMLID);
final boolean bSMLAutoDetect = ISMLConfigurationManager.ID_AUTO_DETECT.equals(sSMLID);
final boolean bQueryBusinessCard = aWPEC.params().isCheckBoxChecked(PARAM_QUERY_BUSINESS_CARD, DEFAULT_QUERY_BUSINESS_CARD);
final boolean bShowTime = aWPEC.params().isCheckBoxChecked(PARAM_SHOW_TIME, DEFAULT_SHOW_TIME);
final boolean bXSDValidation = aWPEC.params().isCheckBoxChecked(PARAM_XSD_VALIDATION, DEFAULT_XSD_VALIDATION);
final boolean bVerifySignatures = aWPEC.params().isCheckBoxChecked(PARAM_VERIFY_SIGNATURES, DEFAULT_VERIFY_SIGNATURES);
final IIdentifierFactory aIF = aSMLConfiguration != null ? aSMLConfiguration.getSMPIdentifierType().getIdentifierFactory() : SimpleIdentifierFactory.INSTANCE;
// Legacy URL params?
if (aWPEC.params().containsKey("idscheme") && aWPEC.params().containsKey("idvalue")) {
sParticipantIDScheme = DEFAULT_ID_SCHEME;
sParticipantIDValue = StringHelper.trim(aWPEC.params().getAsString("idscheme")) + ":" + StringHelper.trim(aWPEC.params().getAsString("idvalue"));
}
if (StringHelper.hasNoText(sParticipantIDScheme))
aFormErrors.addFieldError(FIELD_ID_SCHEME, "Please provide an identifier scheme");
else if (!aIF.isParticipantIdentifierSchemeValid(sParticipantIDScheme))
aFormErrors.addFieldError(FIELD_ID_SCHEME, "The participant identifier scheme '" + sParticipantIDScheme + "' is not valid!");
if (StringHelper.hasNoText(sParticipantIDValue))
aFormErrors.addFieldError(FIELD_ID_VALUE, "Please provide an identifier value");
else if (!aIF.isParticipantIdentifierValueValid(sParticipantIDValue))
aFormErrors.addFieldError(FIELD_ID_VALUE, "The participant identifier value '" + sParticipantIDValue + "' is not valid!");
if (aSMLConfiguration == null && !bSMLAutoDetect)
aFormErrors.addFieldError(FIELD_SML, "A valid SML must be selected!");
if (aFormErrors.isEmpty()) {
_queryParticipant(aWPEC, sParticipantIDScheme, sParticipantIDValue, aSMLConfiguration, bSMLAutoDetect, bQueryBusinessCard, bShowTime, bXSDValidation, bVerifySignatures);
}
}
if (bShowInput) {
final BootstrapForm aForm = aNodeList.addAndReturnChild(getUIHandler().createFormSelf(aWPEC).setMethod(EHCFormMethod.GET).setLeft(3));
aForm.addChild(info().addChildren(div("Show all processes, document types and endpoints of a participant."), div("You may want to try scheme ").addChild(code(DEFAULT_ID_SCHEME)).addChild(" and value ").addChild(code("9915:test")).addChild(" on ").addChild(code("SMK")).addChild(" as an example.")));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Identifier scheme").setCtrl(new HCEdit(new RequestField(FIELD_ID_SCHEME, sParticipantIDScheme)).setPlaceholder("Identifier scheme")).setHelpText(div("The most common identifier scheme is ").addChild(code(DEFAULT_ID_SCHEME))).setErrorList(aFormErrors.getListOfField(FIELD_ID_SCHEME)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Identifier value").setCtrl(new HCEdit(new RequestField(FIELD_ID_VALUE, sParticipantIDValue)).setPlaceholder("Identifier value")).setHelpText(div("The identifier value must look like ").addChild(code("9915:test"))).setErrorList(aFormErrors.getListOfField(FIELD_ID_VALUE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML to use").setCtrl(new SMLConfigurationSelect(new RequestField(FIELD_SML, ISMLConfigurationManager.ID_AUTO_DETECT), true)).setErrorList(aFormErrors.getListOfField(FIELD_SML)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Query Business Card?").setCtrl(new HCCheckBox(new RequestFieldBoolean(PARAM_QUERY_BUSINESS_CARD, DEFAULT_QUERY_BUSINESS_CARD))).setErrorList(aFormErrors.getListOfField(PARAM_QUERY_BUSINESS_CARD)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Show query duration?").setCtrl(new HCCheckBox(new RequestFieldBoolean(PARAM_SHOW_TIME, DEFAULT_SHOW_TIME))).setErrorList(aFormErrors.getListOfField(PARAM_SHOW_TIME)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Enable XML Schema validation of responses?").setCtrl(new HCCheckBox(new RequestFieldBoolean(PARAM_XSD_VALIDATION, DEFAULT_XSD_VALIDATION))).setErrorList(aFormErrors.getListOfField(PARAM_XSD_VALIDATION)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Verify signatures of SMP responses?").setCtrl(new HCCheckBox(new RequestFieldBoolean(PARAM_VERIFY_SIGNATURES, DEFAULT_VERIFY_SIGNATURES))).setErrorList(aFormErrors.getListOfField(PARAM_VERIFY_SIGNATURES)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addSubmitButton("Show details");
}
}
use of com.helger.html.hc.html.forms.HCEdit in project peppol-practical by phax.
the class PagePublicToolsSMPSML method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final FormErrorList aFormErrors = new FormErrorList();
final boolean bShowInput = true;
aNodeList.addChild(warn("Note: as of ").addChild(new HCA(new SimpleURL("https://github.com/phax/phoss-smp")).addChild("phoss SMP server 5.0.0 beta 1")).addChild(" this registration feature is contained directly in the SMP software! So you don't need to send your certificates over the Internet anymore!"));
if (aWPEC.hasAction(CPageParam.ACTION_PERFORM)) {
if (aWPEC.hasSubAction(SUBACTION_SMP_REGISTER))
_registerSMPtoSML(aWPEC, aFormErrors);
else if (aWPEC.hasSubAction(SUBACTION_SMP_UPDATE))
_updateSMPatSML(aWPEC, aFormErrors);
else if (aWPEC.hasSubAction(SUBACTION_SMP_DELETE))
_deleteSMPfromSML(aWPEC, aFormErrors);
else if (aWPEC.hasSubAction(SUBACTION_SMP_UPDATE_CERT))
_updateSMPCertAtSML(aWPEC, aFormErrors);
}
if (bShowInput) {
final int nLeft = 3;
final BootstrapTabBox aTabBox = new BootstrapTabBox();
// Register SMP at SML
{
final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC);
aForm.setEncTypeFileUpload().setLeft(nLeft);
aForm.addChild(info("Register a new SMP to the SML. This must only be done once per SMP!"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new SMLConfigurationSelect(new RequestField(FIELD_SML_ID), false)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SMP ID").setCtrl(new HCEdit(new RequestField(FIELD_SMP_ID)).setPlaceholder("Your SMP ID")).setHelpText(HELPTEXT_SMP_ID).setErrorList(aFormErrors.getListOfField(FIELD_SMP_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Physical address").setCtrl(new HCEdit(new RequestField(FIELD_PHYSICAL_ADDRESS)).setPlaceholder("The IPv4 address of your SMP. E.g. 1.2.3.4")).setHelpText(HELPTEXT_PHYSICAL_ADDRESS).setErrorList(aFormErrors.getListOfField(FIELD_PHYSICAL_ADDRESS)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Logical address").setCtrl(new HCEdit(new RequestField(FIELD_LOGICAL_ADDRESS)).setPlaceholder("The domain name of your SMP server. E.g. http://smp.example.org")).setHelpText(HELPTEXT_LOGICAL_ADDRESS).setErrorList(aFormErrors.getListOfField(FIELD_LOGICAL_ADDRESS)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SMP key store").setCtrl(new BootstrapFileUpload(FIELD_KEYSTORE, aDisplayLocale)).setHelpText(HELPTEXT_KEYSTORE).setErrorList(aFormErrors.getListOfField(FIELD_KEYSTORE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP key store password").setCtrl(new HCEditPassword(FIELD_KEYSTORE_PW).setPlaceholder("The password for the SMP keystore. May be empty.")).setHelpText(HELPTEXT_KEYSTORE_PW).setErrorList(aFormErrors.getListOfField(FIELD_KEYSTORE_PW)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_REGISTER);
aToolbar.addSubmitButton("Register SMP at SML");
aTabBox.addTab("register", "Register SMP to SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_REGISTER));
}
// Update SMP at SML
{
final BootstrapForm aForm = getUIHandler().createFormSelf(aWPEC);
aForm.setEncTypeFileUpload().setLeft(nLeft);
aForm.addChild(info("Update an existing SMP at the SML. This must only be done when either the IP address or the host name of the SMP changed!"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new SMLConfigurationSelect(new RequestField(FIELD_SML_ID), false)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SMP ID").setCtrl(new HCEdit(new RequestField(FIELD_SMP_ID)).setPlaceholder("Your SMP ID")).setHelpText(HELPTEXT_SMP_ID).setErrorList(aFormErrors.getListOfField(FIELD_SMP_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Physical address").setCtrl(new HCEdit(new RequestField(FIELD_PHYSICAL_ADDRESS)).setPlaceholder("The IPv4 address of your SMP. E.g. 1.2.3.4")).setHelpText(HELPTEXT_PHYSICAL_ADDRESS).setErrorList(aFormErrors.getListOfField(FIELD_PHYSICAL_ADDRESS)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Logical address").setCtrl(new HCEdit(new RequestField(FIELD_LOGICAL_ADDRESS)).setPlaceholder("The domain name of your SMP server. E.g. http://smp.example.org")).setHelpText(HELPTEXT_LOGICAL_ADDRESS).setErrorList(aFormErrors.getListOfField(FIELD_LOGICAL_ADDRESS)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SMP key store").setCtrl(new BootstrapFileUpload(FIELD_KEYSTORE, aDisplayLocale)).setHelpText(HELPTEXT_KEYSTORE).setErrorList(aFormErrors.getListOfField(FIELD_KEYSTORE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP key store password").setCtrl(new HCEditPassword(FIELD_KEYSTORE_PW).setPlaceholder("The password for the SMP keystore. May be empty.")).setHelpText(HELPTEXT_KEYSTORE_PW).setErrorList(aFormErrors.getListOfField(FIELD_KEYSTORE_PW)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_UPDATE);
aToolbar.addSubmitButton("Update SMP at SML");
aTabBox.addTab("update", "Update SMP at SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_UPDATE));
}
// Delete SMP from SML
{
final BootstrapForm aForm = getUIHandler().createFormFileUploadSelf(aWPEC);
aForm.setLeft(nLeft);
aForm.addChild(info("Delete an existing SMP from the SML."));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new SMLConfigurationSelect(new RequestField(FIELD_SML_ID), false)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SMP ID").setCtrl(new HCEdit(new RequestField(FIELD_SMP_ID)).setPlaceholder("Your SMP ID")).setHelpText(HELPTEXT_SMP_ID).setErrorList(aFormErrors.getListOfField(FIELD_SMP_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SMP key store").setCtrl(new BootstrapFileUpload(FIELD_KEYSTORE, aDisplayLocale)).setHelpText(HELPTEXT_KEYSTORE).setErrorList(aFormErrors.getListOfField(FIELD_KEYSTORE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SMP key store password").setCtrl(new HCEditPassword(FIELD_KEYSTORE_PW).setPlaceholder("The password for the SMP keystore. May be empty.")).setHelpText(HELPTEXT_KEYSTORE_PW).setErrorList(aFormErrors.getListOfField(FIELD_KEYSTORE_PW)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_DELETE);
aToolbar.addSubmitButton("Delete SMP from SML");
aTabBox.addTab("delete", "Delete SMP from SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_DELETE));
}
// Update SMP certificate in SML
{
final BootstrapForm aForm = getUIHandler().createFormFileUploadSelf(aWPEC);
aForm.setLeft(nLeft);
aForm.addChild(info().addChildren(div("Prepare the update of your Peppol SMP certificate in the future."), div("This works only if your SMP certificate is NOT expired yet." + " If your SMP certificate is already expired contact CEF-EDELIVERY-SUPPORT@ec.europa.eu with your SMP ID, the new certificate and the requested exchange date!"), div("Note: this is a custom extension that only works with the CEF SML instances!")));
aForm.addChild(warn("It is your responsibility to update the Peppol certificate in your SMP at the specified time!"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new SMLConfigurationSelect(new RequestField(FIELD_SML_ID), false)).setErrorList(aFormErrors.getListOfField(FIELD_SML_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Existing/old SMP key store").setCtrl(new BootstrapFileUpload(FIELD_KEYSTORE, aDisplayLocale)).setHelpText(HELPTEXT_KEYSTORE).setErrorList(aFormErrors.getListOfField(FIELD_KEYSTORE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Existing/old SMP key store password").setCtrl(new HCEditPassword(FIELD_KEYSTORE_PW).setPlaceholder("The password for the existing SMP keystore. May be empty.")).setHelpText(HELPTEXT_KEYSTORE_PW).setErrorList(aFormErrors.getListOfField(FIELD_KEYSTORE_PW)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Certificate migration date").setCtrl(BootstrapDateTimePicker.create(FIELD_PM_MIGRATION_DATE, aDisplayLocale, EBootstrap4DateTimePickerMode.DATE).setMinDate(PDTFactory.getCurrentLocalDate().plusDays(1))).setHelpText("The SML will replace the certificate at this date." + " It must be in the future and within the validity period of the provided new public certificate." + " If not provided, the 'valid from' part of the certificate is used.").setErrorList(aFormErrors.getListOfField(FIELD_PM_MIGRATION_DATE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("New public certificate").setCtrl(new HCTextAreaAutosize(new RequestField(FIELD_PM_PUBLIC_CERT)).setRows(5)).setHelpText(span("Paste the public part of your new certificate here (using PEM encoding)." + " Do NOT paste your new private key here." + " Must start with ").addChild(code(CertificateHelper.BEGIN_CERTIFICATE)).addChild(" and end with ").addChild(code(CertificateHelper.END_CERTIFICATE))).setErrorList(aFormErrors.getListOfField(FIELD_PM_PUBLIC_CERT)));
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addHiddenField(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aToolbar.addHiddenField(CPageParam.PARAM_SUBACTION, SUBACTION_SMP_UPDATE_CERT);
aToolbar.addSubmitButton("Prepare certificate update");
aTabBox.addTab("updatecert", "Update SMP certificate at SML", aForm, aWPEC.hasSubAction(SUBACTION_SMP_UPDATE_CERT));
}
aNodeList.addChild(aTabBox);
}
}
use of com.helger.html.hc.html.forms.HCEdit in project peppol-practical by phax.
the class PageSecureCRMGroup method showInputForm.
@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ICRMGroup aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
aForm.addChild(getUIHandler().createActionHeader(eFormAction.isEdit() ? "Edit CRM group" : "Create new CRM group"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Name").setCtrl(new HCEdit(new RequestField(FIELD_NAME, aSelectedObject == null ? null : aSelectedObject.getDisplayName()))).setErrorList(aFormErrors.getListOfField(FIELD_NAME)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Sender email address").setCtrl(new HCEdit(new RequestField(FIELD_SENDER_EMAIL_ADDRESS, aSelectedObject == null ? null : aSelectedObject.getSenderEmailAddress()))).setErrorList(aFormErrors.getListOfField(FIELD_SENDER_EMAIL_ADDRESS)));
}
Aggregations