Search in sources :

Example 21 with HCTextNode

use of com.helger.html.hc.impl.HCTextNode in project phoss-smp by phax.

the class PageSecureSMPSettings method showInputForm.

@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPSettings aObject, @Nonnull final BootstrapForm aForm, @Nonnull final EWebPageSimpleFormAction eSimpleFormAction, @Nonnull final FormErrorList aFormErrors) {
    final String sDirectoryName = SMPWebAppConfiguration.getDirectoryName();
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    aForm.setLeft(3);
    aForm.addChild(getUIHandler().createDataGroupHeader("REST API"));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("REST writable API disabled?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SMP_REST_WRITABLE_API_DISABLED, aObject.isRESTWritableAPIDisabled()))).setHelpText("If this checkbox is checked, all non-standard writing REST APIs are disabled.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_REST_WRITABLE_API_DISABLED)));
    aForm.addChild(getUIHandler().createDataGroupHeader("SMK/SML"));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML connection required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SML_REQUIRED, aObject.isSMLRequired()))).setHelpText("If this checkbox is checked, warnings are emitted if the SML connection is not enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SML_REQUIRED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML connection enabled?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SML_ACTIVE, aObject.isSMLEnabled()))).setHelpText("If this checkbox is checked, service group changes are propagated to the SML.").setErrorList(aFormErrors.getListOfField(FIELD_SML_ACTIVE)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML configuration").setCtrl(new HCSMLSelect(new RequestField(FIELD_SML_INFO, aObject.getSMLInfoID()), aDisplayLocale, null)).setHelpText(new HCTextNode("Select the SML to operate on. The list of available configurations can be "), new HCA(aWPEC.getLinkToMenuItem(CMenuSecure.MENU_SML_CONFIGURATION)).addChild("customized"), new HCTextNode(".")).setErrorList(aFormErrors.getListOfField(FIELD_SML_INFO)));
    aForm.addChild(getUIHandler().createDataGroupHeader(sDirectoryName));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " connection required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SML_DIRECTORY_INTEGRATION_REQUIRED, aObject.isDirectoryIntegrationRequired()))).setHelpText("If this checkbox is checked, warnings are emitted if the " + sDirectoryName + " connection is not enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SML_DIRECTORY_INTEGRATION_REQUIRED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " integration enabled?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SMP_DIRECTORY_INTEGRATION_ENABLED, aObject.isDirectoryIntegrationEnabled()))).setHelpText("If this checkbox is checked, the " + sDirectoryName + " integration is enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_DIRECTORY_INTEGRATION_ENABLED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " integration automatic update?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_SMP_DIRECTORY_INTEGRATION_AUTO_UPDATE, aObject.isDirectoryIntegrationAutoUpdate()))).setHelpText("If the " + sDirectoryName + " integration is enabled and this checkbox is checked, all business card creations, modifications and deletions are automatically pushed to the " + sDirectoryName + " server.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_DIRECTORY_INTEGRATION_ENABLED)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel(sDirectoryName + " hostname").setCtrl(new HCEdit(new RequestField(FIELD_SMP_DIRECTORY_HOSTNAME, aObject.getDirectoryHostName()))).setHelpText("The " + sDirectoryName + " host where the business cards should be published to. This URL is only used if the " + sDirectoryName + " integration (see above) is enabled.").setErrorList(aFormErrors.getListOfField(FIELD_SMP_DIRECTORY_HOSTNAME)));
}
Also used : Locale(java.util.Locale) HCSMLSelect(com.helger.phoss.smp.ui.secure.hc.HCSMLSelect) RequestFieldBoolean(com.helger.photon.core.form.RequestFieldBoolean) HCA(com.helger.html.hc.html.textlevel.HCA) 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 22 with HCTextNode

use of com.helger.html.hc.impl.HCTextNode in project peppol-practical by phax.

the class PagePublicToolsTestEndpoints method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final TestEndpointManager aTestEndpointMgr = PPMetaManager.getTestEndpointMgr();
    final boolean bUserIsLoggedIn = LoggedInUserManager.getInstance().isUserLoggedInInCurrentSession();
    // Toolbar on top
    final BootstrapButtonToolbar aToolbar = aNodeList.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
    if (bUserIsLoggedIn)
        aToolbar.addButtonNew("Create new test endpoint", createCreateURL(aWPEC));
    else
        aToolbar.addChild(badgeInfo("You need to be logged in to create test endpoints."));
    aNodeList.addChild(info("Test endpoints are special Peppol participant identifiers whose sole purpose is the usage for testing. So if you are a Peppol AccessPoint provider and want to test your implementation you may use the below listed participant identifiers as test recipients."));
    // List existing
    final HCTable aTable = new HCTable(new DTCol("Participant ID"), new DTCol("Company").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Transport profile"), new DTCol("SML"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final TestEndpoint aCurObject : aTestEndpointMgr.getAllActiveTestEndpoints()) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(new HCA(aViewLink).addChild(aCurObject.getDisplayName()));
        aRow.addCell(aCurObject.getCompanyName());
        aRow.addCell(AppHelper.getSMPTransportProfileShortName(aCurObject.getTransportProfile()));
        aRow.addCell(aCurObject.getSML().getDisplayName());
        final IHCCell<?> aActionCell = aRow.addCell();
        if (isActionAllowed(aWPEC, EWebPageFormAction.EDIT, aCurObject))
            aActionCell.addChild(createEditLink(aWPEC, aCurObject));
        else
            aActionCell.addChild(createEmptyAction());
        aActionCell.addChild(new HCTextNode(" "));
        if (isActionAllowed(aWPEC, EWebPageFormAction.DELETE, aCurObject))
            aActionCell.addChild(createDeleteLink(aWPEC, aCurObject));
        else
            aActionCell.addChild(createEmptyAction());
        aActionCell.addChild(new HCTextNode(" "));
        if (bUserIsLoggedIn)
            aActionCell.addChild(createCopyLink(aWPEC, aCurObject));
        else
            aActionCell.addChild(createEmptyAction());
        aActionCell.addChild(new HCTextNode(" "));
        // Visible for all
        aActionCell.addChild(new HCA(_createParticipantInfoURL(aWPEC, aCurObject)).setTitle("Show participant information").addChild(EDefaultIcon.MAGNIFIER.getAsNode()));
    }
    aNodeList.addChild(aTable);
    final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
    aNodeList.addChild(aDataTables);
}
Also used : Locale(java.util.Locale) TestEndpoint(com.helger.peppol.testendpoint.TestEndpoint) HCNodeList(com.helger.html.hc.impl.HCNodeList) HCA(com.helger.html.hc.html.textlevel.HCA) TestEndpointManager(com.helger.peppol.testendpoint.TestEndpointManager) 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) 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 23 with HCTextNode

use of com.helger.html.hc.impl.HCTextNode in project peppol-practical by phax.

the class PageSecureSMLConfiguration method showListOfExistingObjects.

@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final HCNodeList aNodeList = aWPEC.getNodeList();
    final ISMLConfigurationManager aSMLConfigurationMgr = PPMetaManager.getSMLConfigurationMgr();
    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("ID"), new DTCol("Name").setInitialSorting(ESortOrder.ASCENDING), new DTCol("DNS Zone"), new DTCol("Management Service URL"), new DTCol("Client Cert?"), new DTCol("SMP API type"), new DTCol("SMP ID type"), new DTCol("Production?"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
    for (final ISMLConfiguration aCurObject : aSMLConfigurationMgr.getAll()) {
        final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
        final HCRow aRow = aTable.addBodyRow();
        aRow.addCell(aCurObject.getID());
        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(aCurObject.getSMPAPIType().getDisplayName());
        aRow.addCell(aCurObject.getSMPIdentifierType().getDisplayName());
        aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.isProduction(), 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) HCA(com.helger.html.hc.html.textlevel.HCA) ISMLConfiguration(com.helger.peppol.domain.ISMLConfiguration) HCRow(com.helger.html.hc.html.tabular.HCRow) HCTable(com.helger.html.hc.html.tabular.HCTable) ISMLConfigurationManager(com.helger.peppol.app.mgr.ISMLConfigurationManager) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) 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 24 with HCTextNode

use of com.helger.html.hc.impl.HCTextNode in project peppol-practical by phax.

the class PageSecureSMLConfiguration method showInputForm.

@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMLConfiguration aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    final boolean bEdit = eFormAction.isEdit();
    aForm.addChild(getUIHandler().createActionHeader(bEdit ? "Edit SML configuration '" + aSelectedObject.getDisplayName() + "'" : "Create new SML configuration"));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("ID").setCtrl(new HCEdit(new RequestField(FIELD_ID, aSelectedObject != null ? aSelectedObject.getID() : null)).setReadOnly(bEdit)).setHelpText("The internal ID of the SML configuration. This value cannot be edited.").setErrorList(aFormErrors.getListOfField(FIELD_ID)));
    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() : DEFAULT_CLIENT_CERTIFICATE_REQUIRED))).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)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SMP API type").setCtrl(new SMPAPITypeSelect(new RequestField(FIELD_SMP_API_TYPE, aSelectedObject != null ? aSelectedObject.getSMPAPIType().getID() : null), aDisplayLocale)).setErrorList(aFormErrors.getListOfField(FIELD_SMP_API_TYPE)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SMP identifier type").setCtrl(new SMPIdentifierTypeSelect(new RequestField(FIELD_SMP_ID_TYPE, aSelectedObject != null ? aSelectedObject.getSMPIdentifierType().getID() : null), aDisplayLocale)).setErrorList(aFormErrors.getListOfField(FIELD_SMP_ID_TYPE)));
    aForm.addFormGroup(new BootstrapFormGroup().setLabel("Production SML?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_PRODUCTION, aSelectedObject != null ? aSelectedObject.isProduction() : true))).setHelpText("Check this if this SML is a production SML. Don't check e.g. for SMK.").setErrorList(aFormErrors.getListOfField(FIELD_PRODUCTION)));
}
Also used : Locale(java.util.Locale) 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) SMPAPITypeSelect(com.helger.peppol.ui.select.SMPAPITypeSelect) RequestField(com.helger.photon.core.form.RequestField) SMPIdentifierTypeSelect(com.helger.peppol.ui.select.SMPIdentifierTypeSelect)

Example 25 with HCTextNode

use of com.helger.html.hc.impl.HCTextNode in project peppol-practical by phax.

the class AppCommonUI method createViewLink.

@Nonnull
public static IHCNode createViewLink(@Nonnull final IWebPageExecutionContext aWPEC, @Nullable final ITypedObject<String> aObject, @Nullable final String sDisplayName) {
    if (aObject == null)
        return HCTextNode.createOnDemand(sDisplayName);
    final Locale aDisplayLocale = aWPEC.getDisplayLocale();
    if (aObject instanceof IRole) {
        final IRole aTypedObj = (IRole) aObject;
        final String sRealDisplayName = sDisplayName != null ? sDisplayName : aTypedObj.getName();
        final String sMenuItemID = BootstrapPagesMenuConfigurator.MENU_ADMIN_SECURITY_ROLE;
        final IMenuObject aObj = aWPEC.getMenuTree().getItemDataWithID(sMenuItemID);
        if (aObj != null && aObj.matchesDisplayFilter())
            return new HCA(getViewLink(aWPEC, sMenuItemID, aTypedObj)).addChild(sRealDisplayName).setTitle("Show details of role '" + sRealDisplayName + "'");
        return new HCTextNode(sRealDisplayName);
    }
    if (aObject instanceof IUser) {
        final IUser aTypedObj = (IUser) aObject;
        final String sRealDisplayName = sDisplayName != null ? sDisplayName : SecurityHelper.getUserDisplayName(aTypedObj, aDisplayLocale);
        final String sMenuItemID = BootstrapPagesMenuConfigurator.MENU_ADMIN_SECURITY_USER;
        final IMenuObject aObj = aWPEC.getMenuTree().getItemDataWithID(sMenuItemID);
        if (aObj != null && aObj.matchesDisplayFilter())
            return new HCA(getViewLink(aWPEC, sMenuItemID, aTypedObj)).addChild(sRealDisplayName).setTitle("Show details of user '" + sRealDisplayName + "'");
        return new HCTextNode(sRealDisplayName);
    }
    if (aObject instanceof IUserGroup) {
        final IUserGroup aTypedObj = (IUserGroup) aObject;
        final String sRealDisplayName = sDisplayName != null ? sDisplayName : aTypedObj.getName();
        final String sMenuItemID = BootstrapPagesMenuConfigurator.MENU_ADMIN_SECURITY_USER_GROUP;
        final IMenuObject aObj = aWPEC.getMenuTree().getItemDataWithID(sMenuItemID);
        if (aObj != null && aObj.matchesDisplayFilter())
            return new HCA(getViewLink(aWPEC, sMenuItemID, aTypedObj)).addChild(sRealDisplayName).setTitle("Show details of user group '" + sRealDisplayName + "'");
        return new HCTextNode(sRealDisplayName);
    }
    // add other types as desired
    throw new IllegalArgumentException("Unsupported object: " + aObject);
}
Also used : Locale(java.util.Locale) IRole(com.helger.photon.security.role.IRole) IUserGroup(com.helger.photon.security.usergroup.IUserGroup) HCA(com.helger.html.hc.html.textlevel.HCA) IUser(com.helger.photon.security.user.IUser) IMenuObject(com.helger.photon.core.menu.IMenuObject) PDTToString(com.helger.commons.datetime.PDTToString) 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 HCCheckBox (com.helger.html.hc.html.forms.HCCheckBox)5 HCCode (com.helger.html.hc.html.textlevel.HCCode)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