use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.
the class PageSecureTasksProblems method _checkSMLConfiguration.
private void _checkSMLConfiguration(@Nonnull final HCOL aOL) {
final ISMPSettings aSMPSettings = SMPMetaManager.getSettings();
final String sSMPID = SMPServerConfiguration.getSMLSMPID();
if (aSMPSettings.isSMLEnabled()) {
final ISMLInfo aSMLInfo = aSMPSettings.getSMLInfo();
if (aSMLInfo == null) {
aOL.addItem(_createError("No SML is selected in the SMP settings."), div("All creations and deletions of service groups needs to be repeated when the SML connection is active!"));
} else {
// Check if this SMP is already registered
final String sPublisherDNSName = sSMPID + "." + aSMLInfo.getPublisherDNSZone();
try {
InetAddress.getByName(sPublisherDNSName);
// On success, ignore
} catch (final UnknownHostException ex) {
// continue
aOL.addItem(_createWarning("It seems like this SMP was not yet registered to the SML."), div("This is a one-time action that should be performed once. It requires a valid SMP certificate to work."), div("The registration check was performed with the URL ").addChild(new HCA().setHref(new SimpleURL("http://" + sPublisherDNSName)).setTargetBlank().addChild(code(sPublisherDNSName))));
}
}
} else {
if (aSMPSettings.isSMLRequired())
aOL.addItem(_createError("The connection to the SML is not enabled."), div("All creations and deletions of service groups needs to be repeated when the SML connection is active!"));
}
}
use of com.helger.html.hc.html.textlevel.HCA in project phoss-directory by phax.
the class PageSecureParticipantList 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 (aWPEC.hasAction(CPageParam.ACTION_DELETE)) {
final String sParticipantID = aRequestScope.params().getAsString(FIELD_PARTICIPANT_ID);
final IIdentifierFactory aIdentifierFactory = PDMetaManager.getIdentifierFactory();
final IParticipantIdentifier aParticipantID = aIdentifierFactory.parseParticipantIdentifier(sParticipantID);
if (aParticipantID != null) {
boolean bSuccess = false;
try {
bSuccess = PDMetaManager.getStorageMgr().deleteEntry(aParticipantID, null, false) > 0;
} catch (final IOException ex) {
// ignore
}
if (bSuccess)
aNodeList.addChild(info("The participant ID '" + aParticipantID.getURIEncoded() + "' was deleted"));
else
aNodeList.addChild(error("Error deleting participant ID '" + aParticipantID.getURIEncoded() + "'"));
}
}
final ICommonsSortedMap<IParticipantIdentifier, MutableInt> aAllIDs = PDMetaManager.getStorageMgr().getAllContainedParticipantIDs(EQueryMode.NON_DELETED_ONLY);
aNodeList.addChild(h3(aAllIDs.size() + " participants (=Business Cards) are contained"));
int nMaxEntries;
if (aWPEC.params().containsKey(PARAM_SHOW_ALL))
nMaxEntries = Integer.MAX_VALUE;
else {
nMaxEntries = aWPEC.params().getAsInt(PARAM_MAX_ENTRIES, -1);
if (nMaxEntries <= 0) {
// Avoid negative entry count
nMaxEntries = 500;
}
if (aAllIDs.size() > nMaxEntries) {
aNodeList.addChild(info("Showing only the first " + nMaxEntries + " participant(s), to avoid too much load on the server. Use the parameter '" + PARAM_SHOW_ALL + "' to show all participants, or '" + PARAM_MAX_ENTRIES + "' to specify a maximum number of entries."));
}
}
final HCTable aTable = new HCTable(new DTCol("ID").setInitialSorting(ESortOrder.ASCENDING), new DTCol("Entities").setDisplayType(EDTColType.INT, aDisplayLocale), new BootstrapDTColAction()).setID(getID());
for (final Map.Entry<IParticipantIdentifier, MutableInt> aEntry : aAllIDs.entrySet()) {
final String sParticipantID = aEntry.getKey().getURIEncoded();
final HCRow aRow = aTable.addBodyRow();
aRow.addCell(sParticipantID);
aRow.addCell(Integer.toString(aEntry.getValue().intValue()));
final IHCCell<?> aActionCell = aRow.addCell();
final ISimpleURL aShowDetails = aWPEC.getLinkToMenuItem(CApplicationID.APP_ID_PUBLIC, CMenuPublic.MENU_SEARCH_SIMPLE).add(PagePublicSearchSimple.FIELD_QUERY, sParticipantID).add(CPageParam.PARAM_ACTION, CPageParam.ACTION_VIEW).add(PagePublicSearchSimple.FIELD_PARTICIPANT_ID, sParticipantID);
aActionCell.addChild(new HCA(aShowDetails).addChild("Search"));
aActionCell.addChild(" ");
final ISimpleURL aReIndex = aWPEC.getLinkToMenuItem(CMenuSecure.MENU_INDEX_MANUALLY).add(PageSecureIndexManually.FIELD_PARTICIPANT_ID, sParticipantID).add(CPageParam.PARAM_ACTION, CPageParam.ACTION_PERFORM);
aActionCell.addChild(new HCA(aReIndex).addChild("Reindex"));
aActionCell.addChild(" ");
final ISimpleURL aDelete = aWPEC.getSelfHref().add(FIELD_PARTICIPANT_ID, sParticipantID).add(CPageParam.PARAM_ACTION, CPageParam.ACTION_DELETE);
aActionCell.addChild(new HCA(aDelete).addChild("Delete"));
if (aTable.getBodyRowCount() >= nMaxEntries) {
LOGGER.info("Stopping rendering after " + nMaxEntries + " entries");
break;
}
}
aNodeList.addChild(aTable).addChild(BootstrapDataTables.createDefaultDataTables(aWPEC, aTable));
}
use of com.helger.html.hc.html.textlevel.HCA in project phoss-directory by phax.
the class AbstractPageSecureReIndex method showListOfExistingObjects.
@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
// Add toolbar
{
final BootstrapButtonToolbar aToolbar = aNodeList.addAndReturnChild(new BootstrapButtonToolbar(aWPEC));
aToolbar.addChild(new BootstrapButton().addChild("Refresh").setIcon(EDefaultIcon.REFRESH).setOnClick(aWPEC.getSelfHref()));
aToolbar.addChild(new BootstrapButton().addChild("Delete all entries").setIcon(EDefaultIcon.DELETE).setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_DELETE_ALL)));
aToolbar.addChild(span("Current server time: " + PDTToString.getAsString(PDTFactory.getCurrentLocalTime(), aDisplayLocale)).addClass(PDCommonUI.CSS_CLASS_VERTICAL_PADDED_TEXT));
}
final HCTable aTable = new HCTable(new DTCol("Reg date").setDisplayType(EDTColType.DATETIME, aDisplayLocale).setInitialSorting(ESortOrder.DESCENDING), new DTCol("Participant"), new DTCol("Action"), new DTCol("Retries").setDisplayType(EDTColType.INT, aDisplayLocale), m_bDeadIndex ? null : new DTCol("Next retry").setDisplayType(EDTColType.DATETIME, aDisplayLocale), new DTCol("Last retry").setDisplayType(EDTColType.DATETIME, aDisplayLocale), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
for (final IReIndexWorkItem aItem : getReIndexWorkItemList().getAllItems()) {
final ISimpleURL aViewLink = createViewURL(aWPEC, aItem);
final IIndexerWorkItem aWorkItem = aItem.getWorkItem();
final HCRow aRow = aTable.addBodyRow();
aRow.addCell(new HCA(aViewLink).addChild(PDTToString.getAsString(aWorkItem.getCreationDateTime(), aDisplayLocale)));
aRow.addCell(aWorkItem.getParticipantID().getURIEncoded());
aRow.addCell(aWorkItem.getType().getDisplayName());
aRow.addCell(Integer.toString(aItem.getRetryCount()));
if (!m_bDeadIndex)
aRow.addCell(PDTToString.getAsString(aItem.getNextRetryDT(), aDisplayLocale));
aRow.addCell(PDTToString.getAsString(aItem.getMaxRetryDT(), aDisplayLocale));
final IHCCell<?> aActionCell = aRow.addCell();
if (m_bDeadIndex) {
aActionCell.addChild(new HCA(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_REINDEX_NOW).add(CPageParam.PARAM_OBJECT, aItem.getID())).setTitle("Re-index the entry now").addChild(EDefaultIcon.NEXT.getAsNode()));
aActionCell.addChild(" ");
}
aActionCell.addChild(createDeleteLink(aWPEC, aItem));
}
aNodeList.addChild(aTable);
aNodeList.addChild(BootstrapDataTables.createDefaultDataTables(aWPEC, aTable));
}
use of com.helger.html.hc.html.textlevel.HCA in project phoss-directory by phax.
the class PublicHTMLProvider method getContent.
@Nonnull
public static IHCNode getContent(@Nonnull final LayoutExecutionContext aLEC) {
final Locale aDisplayLocale = aLEC.getDisplayLocale();
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
final HCNodeList ret = new HCNodeList();
// Header
ret.addChild(_getNavbar(aLEC));
final BootstrapContainer aOuterContainer = ret.addAndReturnChild(new BootstrapContainer().setFluid(false));
// Content - no menu
aOuterContainer.addChild(BootstrapPageRenderer.getPageContent(aLEC));
// Footer
{
final BootstrapContainer aDiv = new BootstrapContainer().setFluid(true).setID(CLayout.LAYOUT_AREAID_FOOTER);
aDiv.addChild(new HCP().addChild(CPDPublisher.getApplication() + " - an ").addChild(new HCA(new SimpleURL(VENDOR_URL)).addChild(VENDOR_NAME)).addChild(" service"));
if (PDServerConfiguration.getConfig().getAsBoolean("webapp.showtwitter", true)) {
aDiv.addChild(new HCP().addChild("Follow us on Twitter: ").addChild(new HCA(new SimpleURL("https://twitter.com/PEPPOLDirectory")).addChild("@PEPPOLDirectory")));
}
final HCP aP = new HCP().addChild("Download data [");
aP.addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_BUSINESS_CARDS_XML_FULL)).addChild("BusinessCards XML"));
aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_BUSINESS_CARDS_XML_NO_DOC_TYPES)).addChild("BusinessCards w/o doctypes XML"));
if (CPDPublisher.EXPORT_BUSINESS_CARDS_EXCEL) {
aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_BUSINESS_CARDS_EXCEL)).addChild("BusinessCards Excel"));
}
if (CPDPublisher.EXPORT_BUSINESS_CARDS_CSV) {
aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_BUSINESS_CARDS_CSV)).addChild("BusinessCards CSV"));
}
if (CPDPublisher.EXPORT_PARTICIPANTS_XML) {
aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_PARTICIPANTS_XML)).addChild("Participant IDs XML"));
}
if (CPDPublisher.EXPORT_PARTICIPANTS_JSON) {
aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_PARTICIPANTS_JSON)).addChild("Participant IDs JSON"));
}
if (CPDPublisher.EXPORT_PARTICIPANTS_CSV) {
aP.addChild(" | ").addChild(new HCA(LinkHelper.getURLWithContext(aRequestScope, ExportServlet.SERVLET_DEFAULT_PATH + ExportDeliveryHttpHandler.SPECIAL_PARTICIPANTS_CSV)).addChild("Participant IDs CSV"));
}
aP.addChild("]");
aDiv.addChild(aP);
final BootstrapMenuItemRendererHorz aRenderer = new BootstrapMenuItemRendererHorz(aDisplayLocale);
final HCUL aUL = aDiv.addAndReturnChild(new HCUL().addClass(CSS_CLASS_FOOTER_LINKS));
for (final IMenuObject aMenuObj : s_aFooterObjects) {
if (aMenuObj instanceof IMenuSeparator)
aUL.addItem(aRenderer.renderSeparator(aLEC, (IMenuSeparator) aMenuObj));
else if (aMenuObj instanceof IMenuItemPage)
aUL.addItem(aRenderer.renderMenuItemPage(aLEC, (IMenuItemPage) aMenuObj, false, false, false));
else if (aMenuObj instanceof IMenuItemExternal)
aUL.addItem(aRenderer.renderMenuItemExternal(aLEC, (IMenuItemExternal) aMenuObj, false, false, false));
else
throw new IllegalStateException("Unsupported menu object type!");
}
ret.addChild(aDiv);
}
// Google Analytics?
final String sAccountID = PDServerConfiguration.getConfig().getAsString("webapp.google.analytics.account");
if (StringHelper.hasText(sAccountID))
ret.addChild(new HCUniversalAnalytics(sAccountID, false, false, false, false));
ret.addChild(HCCookieConsent.createBottomDefault("#000", "#0f0", "#0f0", null));
return ret;
}
use of com.helger.html.hc.html.textlevel.HCA in project phoss-smp by phax.
the class AbstractPageSecureEndpoint method showSelectedObject.
@Override
protected void showSelectedObject(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPServiceInformation aSelectedObject) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final IDocumentTypeIdentifier aDocumentTypeID = aSelectedObject.getDocumentTypeIdentifier();
final ISMPProcess aSelectedProcess = aWPEC.getRequestScope().attrs().getCastedValue(REQUEST_ATTR_PROCESS);
final ISMPEndpoint aSelectedEndpoint = aWPEC.getRequestScope().attrs().getCastedValue(REQUEST_ATTR_ENDPOINT);
final LocalDateTime aNowLDT = PDTFactory.getCurrentLocalDateTime();
aNodeList.addChild(getUIHandler().createActionHeader("Show details of endpoint"));
final BootstrapViewForm aForm = new BootstrapViewForm();
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Service group").setCtrl(new HCA(createViewURL(aWPEC, CMenuSecure.MENU_SERVICE_GROUPS, aSelectedObject.getServiceGroup())).addChild(aSelectedObject.getServiceGroupID())));
// Document type identifier
{
final HCNodeList aCtrl = new HCNodeList();
aCtrl.addChild(div(NiceNameUI.getDocumentTypeID(aDocumentTypeID, true)));
try {
final IPeppolDocumentTypeIdentifierParts aParts = PeppolDocumentTypeIdentifierParts.extractFromIdentifier(aDocumentTypeID);
aCtrl.addChild(SMPCommonUI.getDocumentTypeIDDetails(aParts));
} catch (final IllegalArgumentException ex) {
if (false)
aCtrl.addChild(error("Failed to parse document type identifier: " + ex.getMessage()));
}
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Document type ID").setCtrl(aCtrl));
}
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Process ID").setCtrl(NiceNameUI.getProcessID(aSelectedObject.getDocumentTypeIdentifier(), aSelectedProcess.getProcessIdentifier(), true)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Transport profile").setCtrl(new HCA(createViewURL(aWPEC, CMenuSecure.MENU_TRANSPORT_PROFILES, aSelectedEndpoint.getTransportProfile())).addChild(NiceNameUI.getTransportProfile(aSelectedEndpoint.getTransportProfile(), true))));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Endpoint reference").setCtrl(StringHelper.hasText(aSelectedEndpoint.getEndpointReference()) ? HCA.createLinkedWebsite(aSelectedEndpoint.getEndpointReference(), HC_Target.BLANK) : em("none")));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Requires business level signature").setCtrl(EPhotonCoreText.getYesOrNo(aSelectedEndpoint.isRequireBusinessLevelSignature(), aDisplayLocale)));
if (aSelectedEndpoint.hasMinimumAuthenticationLevel())
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Minimum authentication level").setCtrl(aSelectedEndpoint.getMinimumAuthenticationLevel()));
if (aSelectedEndpoint.hasServiceActivationDateTime()) {
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Not before").setCtrl(PDTToString.getAsString(aSelectedEndpoint.getServiceActivationDateTime(), aDisplayLocale)));
}
if (aSelectedEndpoint.hasServiceExpirationDateTime()) {
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Not after").setCtrl(PDTToString.getAsString(aSelectedEndpoint.getServiceExpirationDateTime(), aDisplayLocale)));
}
if (aSelectedEndpoint.hasCertificate()) {
final X509Certificate aEndpointCert = CertificateHelper.convertStringToCertficateOrNull(aSelectedEndpoint.getCertificate());
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Certificate").setCtrl(aEndpointCert == null ? strong("!!!FAILED TO INTERPRETE!!!") : SMPCommonUI.createCertificateDetailsTable(null, aEndpointCert, aNowLDT, aDisplayLocale).setResponsive(true)));
}
if (aSelectedEndpoint.hasServiceDescription())
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Service description").setCtrl(aSelectedEndpoint.getServiceDescription()));
if (aSelectedEndpoint.hasTechnicalContactUrl())
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Technical contact").setCtrl(HCA_MailTo.createLinkedEmail(aSelectedEndpoint.getTechnicalContactUrl())));
if (aSelectedEndpoint.hasTechnicalInformationUrl())
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Technical information").setCtrl(HCA.createLinkedWebsite(aSelectedEndpoint.getTechnicalInformationUrl(), HC_Target.BLANK)));
if (aSelectedEndpoint.extensions().isNotEmpty())
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Extension").setCtrl(SMPCommonUI.getExtensionDisplay(aSelectedEndpoint)));
aNodeList.addChild(aForm);
}
Aggregations