use of com.helger.html.hc.impl.HCTextNode in project peppol-practical by phax.
the class AppCommonUI method getDTAndUser.
@Nullable
public static IHCNode getDTAndUser(@Nonnull final IWebPageExecutionContext aWPEC, @Nullable final LocalDateTime aDateTime, @Nullable final String sUserID) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
String sDateTime = null;
if (aDateTime != null)
sDateTime = PDTToString.getAsString(aDateTime, aDisplayLocale);
IHCNode aUserName = null;
if (sUserID != null) {
final IUser aUser = PhotonSecurityManager.getUserMgr().getUserOfID(sUserID);
aUserName = createViewLink(aWPEC, aUser);
}
if (sDateTime != null) {
if (aUserName != null) {
// Date and user
return new HCNodeList().addChildren(new HCTextNode("on " + sDateTime + " by "), aUserName);
}
// Date only
return new HCTextNode("on " + sDateTime);
}
if (aUserName != null) {
// User only
return new HCNodeList().addChildren(new HCTextNode("by "), aUserName);
}
// Neither nor
return null;
}
use of com.helger.html.hc.impl.HCTextNode 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.impl.HCTextNode in project phoss-directory by phax.
the class PageSecureAdminSMLConfiguration method showListOfExistingObjects.
@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final HCNodeList aNodeList = aWPEC.getNodeList();
final ISMLInfoManager aSMLInfoMgr = PDPMetaManager.getSMLInfoMgr();
aNodeList.addChild(info("This page lets you create custom SML configurations that can be used for registration."));
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
aToolbar.addButton("Create new SML configuration", createCreateURL(aWPEC), EDefaultIcon.NEW);
aNodeList.addChild(aToolbar);
final HCTable aTable = new HCTable(new DTCol("Name").setInitialSorting(ESortOrder.ASCENDING), new DTCol("DNS Zone"), new DTCol("Management Service URL"), new DTCol("Client Cert?"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
for (final ISMLInfo aCurObject : aSMLInfoMgr.getAll()) {
final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
final HCRow aRow = aTable.addBodyRow();
aRow.addCell(new HCA(aViewLink).addChild(aCurObject.getDisplayName()));
aRow.addCell(aCurObject.getDNSZone());
aRow.addCell(aCurObject.getManagementServiceURL());
aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.isClientCertificateRequired(), aDisplayLocale));
aRow.addCell(createEditLink(aWPEC, aCurObject, "Edit " + aCurObject.getID()), new HCTextNode(" "), createCopyLink(aWPEC, aCurObject, "Copy " + aCurObject.getID()), new HCTextNode(" "), isActionAllowed(aWPEC, EWebPageFormAction.DELETE, aCurObject) ? createDeleteLink(aWPEC, aCurObject, "Delete " + aCurObject.getDisplayName()) : createEmptyAction());
}
final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
aNodeList.addChild(aTable).addChild(aDataTables);
}
use of com.helger.html.hc.impl.HCTextNode in project phoss-smp 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;
}
use of com.helger.html.hc.impl.HCTextNode in project phoss-smp by phax.
the class PageSecureBusinessCard method _createActionCell.
@Nonnull
private IHCNode _createActionCell(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPBusinessCard aCurObject) {
final String sDisplayName = aCurObject.getID();
final HCNodeList ret = new HCNodeList();
if (isActionAllowed(aWPEC, EWebPageFormAction.EDIT, aCurObject))
ret.addChild(new HCA(createEditURL(aWPEC, aCurObject)).setTitle("Edit " + sDisplayName).addChild(EDefaultIcon.EDIT.getAsNode()));
else
ret.addChild(createEmptyAction());
ret.addChild(new HCTextNode(" "));
if (isActionAllowed(aWPEC, EWebPageFormAction.EDIT, aCurObject))
ret.addChild(new HCA(createCopyURL(aWPEC, aCurObject)).setTitle("Create a copy of " + sDisplayName).addChild(EDefaultIcon.COPY.getAsNode()));
else
ret.addChild(createEmptyAction());
ret.addChild(new HCTextNode(" "));
if (isActionAllowed(aWPEC, EWebPageFormAction.DELETE, aCurObject))
ret.addChild(new HCA(createDeleteURL(aWPEC, aCurObject)).setTitle("Delete " + sDisplayName).addChild(EDefaultIcon.DELETE.getAsNode()));
else
ret.addChild(createEmptyAction());
ret.addChild(new HCTextNode(" "));
ret.addChild(new HCA(LinkHelper.getURLWithServerAndContext("businesscard/" + aCurObject.getParticipantIdentifier().getURIPercentEncoded())).setTitle("Perform SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
// When auto update is enabled, there is no need for a manual update
// Change: update possibility always, in case document type was changed
// if (!SMPMetaManager.getSettings ().isPEPPOLDirectoryIntegrationAutoUpdate
// () || GlobalDebug.isDebugMode ())
{
ret.addChildren(new HCTextNode(" "), new HCA(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_PUBLISH_TO_INDEXER).add(CPageParam.PARAM_OBJECT, aCurObject.getID())).setTitle("Update Business Card in " + SMPWebAppConfiguration.getDirectoryName()).addChild(EFamFamIcon.ARROW_RIGHT.getAsNode()));
}
return ret;
}
Aggregations