use of com.helger.html.hc.impl.HCNodeList in project phoss-directory by phax.
the class PageSecureParticipantCount method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
{
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
aToolbar.addButton("Refresh", aWPEC.getSelfHref(), EDefaultIcon.MAGNIFIER);
aNodeList.addChild(aToolbar);
}
final int nNotDeletedCount = PDMetaManager.getStorageMgr().getContainedParticipantCount();
aNodeList.addChild(h3(nNotDeletedCount + " participants (entities) are contained"));
final int nReIndexCount = PDMetaManager.getIndexerMgr().getReIndexList().getItemCount();
aNodeList.addChild(h3(nReIndexCount + " re-index items are contained"));
final int nDeadCount = PDMetaManager.getIndexerMgr().getDeadList().getItemCount();
aNodeList.addChild(h3(nDeadCount + " dead items are contained"));
if (false)
try {
final Collector aCollector = new AllDocumentsCollector(PDMetaManager.getLucene(), (aDoc, nIdx) -> {
final BootstrapTable aTable = new BootstrapTable();
for (final IndexableField f : aDoc.getFields()) aTable.addBodyRow().addCells(f.name(), f.fieldType().toString(), f.stringValue());
aNodeList.addChild(aTable);
aNodeList.addChild(new HCHR());
});
PDMetaManager.getStorageMgr().searchAtomic(new MatchAllDocsQuery(), aCollector);
} catch (final IOException ex) {
}
}
use of com.helger.html.hc.impl.HCNodeList 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();
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.impl.HCNodeList in project phoss-directory by phax.
the class SecureHTMLProvider method getContent.
@Nonnull
public static IHCNode getContent(@Nonnull final LayoutExecutionContext aLEC) {
final HCNodeList ret = new HCNodeList();
// Header
ret.addChild(_getNavbar(aLEC));
final BootstrapContainer aOuterContainer = ret.addAndReturnChild(new BootstrapContainer().setFluid(true));
// Breadcrumbs
{
final BootstrapBreadcrumb aBreadcrumbs = BootstrapBreadcrumbProvider.createBreadcrumb(aLEC);
aBreadcrumbs.addClasses(CBootstrapCSS.D_NONE, CBootstrapCSS.D_SM_BLOCK);
aOuterContainer.addChild(aBreadcrumbs);
}
// Content
{
final HCDiv aRow = aOuterContainer.addAndReturnChild(new HCDiv().addClass(CBootstrapCSS.D_MD_FLEX));
final HCDiv aCol1 = aRow.addAndReturnChild(new HCDiv().addClass(CBootstrapCSS.D_MD_FLEX).addClass(CBootstrapCSS.MR_2));
final HCDiv aCol2 = aRow.addAndReturnChild(new HCDiv().addClass(CBootstrapCSS.FLEX_FILL));
// left
// We need a wrapper span for easy AJAX content replacement
aCol1.addClass(CBootstrapCSS.D_PRINT_NONE).addChild(new HCSpan().setID(CLayout.LAYOUT_AREAID_MENU).addChild(getMenuContent(aLEC)).addChild(new HCDiv().addChild(new HCSmall().addChild(CDirectoryVersion.BUILD_VERSION))).addChild(new HCDiv().addChild(new HCSmall().addChild(CDirectoryVersion.BUILD_TIMESTAMP))));
aCol1.addChild(new HCDiv().setID(CLayout.LAYOUT_AREAID_SPECIAL));
// content - determine is exactly same as for view
aCol2.addChild(BootstrapPageRenderer.getPageContent(aLEC));
}
return ret;
}
use of com.helger.html.hc.impl.HCNodeList in project phoss-directory by phax.
the class PagePublicSearchExtended method fillContent.
@Override
protected void fillContent(@Nonnull final WebPageExecutionContext aWPEC) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
aNodeList.addChild(info("This is a placeholder page - has no effect yet!"));
final BootstrapViewForm aViewForm = new BootstrapViewForm();
// Add all search fields
for (final EPDSearchField eField : EPDSearchField.values()) {
final HCSearchOperatorSelect aSelect = new HCSearchOperatorSelect(new RequestField(PREFIX_OPERATOR + eField.getFieldName(), ESearchOperator.EQ.getID()), eField.getDataType(), aDisplayLocale);
final HCNodeList aCtrl = _createCtrl(eField, aDisplayLocale);
final BootstrapRow aRow = new BootstrapRow();
aRow.createColumn(2).addChild(aSelect);
aRow.createColumn(10).addChild(aCtrl);
aViewForm.addFormGroup(new BootstrapFormGroup().setLabel(eField.getDisplayText(aDisplayLocale)).setCtrl(aRow));
}
aNodeList.addChild(aViewForm);
}
use of com.helger.html.hc.impl.HCNodeList in project phoss-directory by phax.
the class PagePublicSearchExtended method _createCtrl.
@Nonnull
private static HCNodeList _createCtrl(@Nonnull final EPDSearchField eField, @Nonnull final Locale aDisplayLocale) {
final String sFieldName = eField.getFieldName();
final HCNodeList ret = new HCNodeList();
switch(eField) {
case COUNTRY:
ret.addChild(new HCCountrySelect(new RequestField(PREFIX_SPECIAL + sFieldName), aDisplayLocale));
break;
case REGISTRATION_DATE:
ret.addChild(BootstrapDateTimePicker.create(PREFIX_SPECIAL + sFieldName, aDisplayLocale, EBootstrap4DateTimePickerMode.DATE));
break;
}
// Default to String
ret.addChild(new HCEdit(new RequestField(sFieldName)));
return ret;
}
Aggregations