Search in sources :

Example 11 with HCTextNode

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;
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) IUser(com.helger.photon.security.user.IUser) PDTToString(com.helger.commons.datetime.PDTToString) HCTextNode(com.helger.html.hc.impl.HCTextNode) IHCNode(com.helger.html.hc.IHCNode) Nullable(javax.annotation.Nullable)

Example 12 with HCTextNode

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)));
}
Also used : HCCode(com.helger.html.hc.html.textlevel.HCCode) RequestFieldBoolean(com.helger.photon.core.form.RequestFieldBoolean) HCEdit(com.helger.html.hc.html.forms.HCEdit) HCCheckBox(com.helger.html.hc.html.forms.HCCheckBox) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) HCTextNode(com.helger.html.hc.impl.HCTextNode) RequestField(com.helger.photon.core.form.RequestField)

Example 13 with HCTextNode

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);
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) ISMLInfo(com.helger.peppol.sml.ISMLInfo) HCA(com.helger.html.hc.html.textlevel.HCA) HCRow(com.helger.html.hc.html.tabular.HCRow) HCTable(com.helger.html.hc.html.tabular.HCTable) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) ISMLInfoManager(com.helger.pd.publisher.app.ISMLInfoManager) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) HCTextNode(com.helger.html.hc.impl.HCTextNode) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)

Example 14 with HCTextNode

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;
}
Also used : HCNodeList(com.helger.html.hc.impl.HCNodeList) BootstrapBadge(com.helger.photon.bootstrap4.badge.BootstrapBadge) HCCode(com.helger.html.hc.html.textlevel.HCCode) HCSmall(com.helger.html.hc.html.textlevel.HCSmall) HCTextNode(com.helger.html.hc.impl.HCTextNode) Nonnull(javax.annotation.Nonnull)

Example 15 with HCTextNode

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;
}
Also used : HCNodeList(com.helger.html.hc.impl.HCNodeList) HCA(com.helger.html.hc.html.textlevel.HCA) PDTToString(com.helger.commons.datetime.PDTToString) PDTFromString(com.helger.commons.datetime.PDTFromString) HCTextNode(com.helger.html.hc.impl.HCTextNode) Nonnull(javax.annotation.Nonnull)

Aggregations

HCTextNode (com.helger.html.hc.impl.HCTextNode)25 HCNodeList (com.helger.html.hc.impl.HCNodeList)17 Locale (java.util.Locale)15 HCA (com.helger.html.hc.html.textlevel.HCA)14 ISimpleURL (com.helger.commons.url.ISimpleURL)11 HCRow (com.helger.html.hc.html.tabular.HCRow)11 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)11 HCTable (com.helger.html.hc.html.tabular.HCTable)10 BootstrapDTColAction (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction)10 BootstrapDataTables (com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)10 DataTables (com.helger.photon.uictrls.datatables.DataTables)10 DTCol (com.helger.photon.uictrls.datatables.column.DTCol)10 Nonnull (javax.annotation.Nonnull)8 HCCode (com.helger.html.hc.html.textlevel.HCCode)6 HCCheckBox (com.helger.html.hc.html.forms.HCCheckBox)5 BootstrapFormGroup (com.helger.photon.bootstrap4.form.BootstrapFormGroup)5 RequestField (com.helger.photon.core.form.RequestField)5 RequestFieldBoolean (com.helger.photon.core.form.RequestFieldBoolean)5 HCEdit (com.helger.html.hc.html.forms.HCEdit)4 HCDiv (com.helger.html.hc.html.grouping.HCDiv)4