use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.
the class PagePublicStart method fillContent.
@Override
protected void fillContent(final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final IRequestWebScopeWithoutResponse aRequestScope = aWPEC.getRequestScope();
if (SMPWebAppConfiguration.isStartPageParticipantsNone()) {
// New in v5.0.4
aNodeList.addChild(info("This SMP has disabled the list of participants."));
} else {
final ISMPServiceGroupManager aSMPServiceGroupMgr = SMPMetaManager.getServiceGroupMgr();
final ICommonsList<ISMPServiceGroup> aServiceGroups = aSMPServiceGroupMgr.getAllSMPServiceGroups();
// Use dynamic or static table?
final boolean bUseDataTables = SMPWebAppConfiguration.isStartPageDynamicTable();
final boolean bShowExtensionDetails = SMPWebAppConfiguration.isStartPageExtensionsShow();
AbstractHCTable<?> aFinalTable;
if (bUseDataTables) {
// Dynamic
final HCTable aTable = new HCTable(new DTCol("Participant ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol(bShowExtensionDetails ? "Extension" : "Extension?").setDataSort(1, 0), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
aFinalTable = aTable;
} else {
// Static
final BootstrapTable aTable = new BootstrapTable();
aTable.setBordered(true);
aTable.setCondensed(true);
aTable.setStriped(true);
aTable.addHeaderRow().addCell("Participant ID").addCell(bShowExtensionDetails ? "Extension" : "Extension?").addCell(EPhotonCoreText.ACTIONS.getDisplayText(aDisplayLocale));
aFinalTable = aTable;
// Sort manually
aServiceGroups.sort(Comparator.comparing(x -> x.getParticipantIdentifier().getURIEncoded()));
}
for (final ISMPServiceGroup aServiceGroup : aServiceGroups) {
final String sDisplayName = aServiceGroup.getParticipantIdentifier().getURIEncoded();
final HCRow aRow = aFinalTable.addBodyRow();
aRow.addCell(sDisplayName);
if (bShowExtensionDetails) {
if (aServiceGroup.extensions().isNotEmpty())
aRow.addCell(code(HCExtHelper.nl2divList(aServiceGroup.getFirstExtensionXML())));
else
aRow.addCell();
} else {
aRow.addCell(EPhotonCoreText.getYesOrNo(aServiceGroup.extensions().isNotEmpty(), aDisplayLocale));
}
final SMPRestDataProvider aDP = new SMPRestDataProvider(aRequestScope, aServiceGroup.getParticipantIdentifier().getURIEncoded());
aRow.addCell(new HCA(new SimpleURL(aDP.getServiceGroupHref(aServiceGroup.getParticipantIdentifier()))).setTitle("Perform SMP query on " + sDisplayName).setTargetBlank().addChild(EFamFamIcon.SCRIPT_GO.getAsNode()));
}
if (aFinalTable.hasBodyRows()) {
aNodeList.addChild(aFinalTable);
if (bUseDataTables) {
final BootstrapDataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aFinalTable);
aNodeList.addChild(aDataTables);
}
} else
aNodeList.addChild(info("This SMP does not manage any participant yet."));
}
}
use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.
the class PageSecureTransportProfiles method showListOfExistingObjects.
@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final HCNodeList aNodeList = aWPEC.getNodeList();
final ISMPTransportProfileManager aTransportProfileMgr = SMPMetaManager.getTransportProfileMgr();
aNodeList.addChild(info("This page lets you create custom transport profiles that can be used in service information endpoints."));
final ICommonsList<ISMPTransportProfile> aList = aTransportProfileMgr.getAllSMPTransportProfiles();
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
aToolbar.addChild(new BootstrapButton().addChild("Create new transport profile").setOnClick(createCreateURL(aWPEC)).setIcon(EDefaultIcon.NEW));
final ICommonsSet<String> aExistingIDs = new CommonsHashSet<>(aList, ISMPTransportProfile::getID);
if (!aExistingIDs.containsAll(DEFAULT_PROFILE_IDS)) {
// Show button only on demand
aToolbar.addChild(new BootstrapButton().addChild("Ensure all default transport profiles").setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_ENSURE_DEFAULT)).setIcon(EDefaultIcon.PLUS));
}
aNodeList.addChild(aToolbar);
final HCTable aTable = new HCTable(new DTCol("ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Name"), new DTCol("Deprecated?"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
for (final ISMPTransportProfile aCurObject : aList) {
final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
final HCRow aRow = aTable.addBodyRow();
aRow.addCell(new HCA(aViewLink).addChild(aCurObject.getID()));
aRow.addCell(aCurObject.getName());
aRow.addCell(EPhotonCoreText.getYesOrNo(aCurObject.isDeprecated(), 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.getID()) : createEmptyAction());
}
final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
aNodeList.addChild(aTable).addChild(aDataTables);
}
use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.
the class SMPRendererSecure method getMenuContent.
@Nonnull
public static IHCNode getMenuContent(@Nonnull final ILayoutExecutionContext aLEC) {
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
final HCNodeList ret = new HCNodeList();
final ISMPSettings aSettings = SMPMetaManager.getSettings();
ret.addChild(BootstrapMenuItemRenderer.createSideBarMenu(aLEC));
final BootstrapSuccessBox aBox = new BootstrapSuccessBox().addClass(CBootstrapCSS.MT_2);
if (SMPMetaManager.getInstance().getBackendConnectionState().isFalse()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" No database connection: ").addChild(new HCA(CAjax.FUNCTION_BACKEND_CONNECTION_RESET.getInvocationURL(aRequestScope)).addChild("Retry")));
aBox.setType(EBootstrapAlertType.DANGER);
}
// Information on SML usage
if (aSettings.isSMLEnabled()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.YES.getAsNode()).addChild(" SML connection is configured."));
if (aSettings.getSMLInfo() == null) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" No SML is selected. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
aBox.setType(EBootstrapAlertType.DANGER);
}
} else {
// Warn only if SML is needed
if (aSettings.isSMLRequired()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" SML connection is NOT configured. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
aBox.setTypeIfWorse(EBootstrapAlertType.WARNING);
}
}
if (aSettings.isDirectoryIntegrationRequired()) {
if (aSettings.isDirectoryIntegrationEnabled()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.YES.getAsNode()).addChild(" Directory support is configured."));
if (StringHelper.hasNoText(aSettings.getDirectoryHostName())) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" No Directory host is provided. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
aBox.setType(EBootstrapAlertType.DANGER);
}
} else {
// Warn only if Directory is needed
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" Directory support is NOT configured. ").addChild(new HCA(aLEC.getLinkToMenuItem(CMenuSecure.MENU_SMP_SETTINGS)).addChild("Fix me")));
aBox.setTypeIfWorse(EBootstrapAlertType.WARNING);
}
}
// Information on certificate
if (!SMPKeyManager.isKeyStoreValid()) {
aBox.addChild(new HCDiv().addChild(EDefaultIcon.NO.getAsNode()).addChild(" Certificate configuration is invalid."));
aBox.setType(EBootstrapAlertType.DANGER);
}
ret.addChild(aBox);
return ret;
}
use of com.helger.html.hc.html.textlevel.HCA 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)));
}
use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.
the class PageSecureServiceGroupMigrationInbound method showSelectedObject.
@Override
protected void showSelectedObject(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPParticipantMigration aSelectedObject) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
aNodeList.addChild(getUIHandler().createActionHeader("Show details of inbound Participant Migration"));
final BootstrapViewForm aForm = new BootstrapViewForm();
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Service Group").setCtrl(new HCA(createViewURL(aWPEC, CMenuSecure.MENU_SERVICE_GROUPS, aSelectedObject.getParticipantIdentifier().getURIEncoded())).addChild(aSelectedObject.getParticipantIdentifier().getURIEncoded())));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Migration state").setCtrl(aSelectedObject.getState().getDisplayName()));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Initiation datetime").setCtrl(PDTToString.getAsString(aSelectedObject.getInitiationDateTime(), aDisplayLocale)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Migration Key").setCtrl(code(aSelectedObject.getMigrationKey())));
aNodeList.addChild(aForm);
}
Aggregations