use of com.helger.photon.core.menu.IMenuTree in project phoss-smp by phax.
the class SMPRendererPublic method getMenuContent.
@Nonnull
public static IHCNode getMenuContent(@Nonnull final LayoutExecutionContext aLEC) {
// Main menu
final IMenuTree aMenuTree = aLEC.getMenuTree();
final MenuItemDeterminatorCallback aCallback = new MenuItemDeterminatorCallback(aMenuTree, aLEC.getSelectedMenuItemID()) {
@Override
protected boolean isMenuItemValidToBeDisplayed(@Nonnull final IMenuObject aMenuObj) {
// Don't show items that belong to the footer
if (aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER))
return false;
// Use default code
return super.isMenuItemValidToBeDisplayed(aMenuObj);
}
};
return BootstrapMenuItemRenderer.createSideBarMenu(aLEC, aCallback);
}
use of com.helger.photon.core.menu.IMenuTree in project phoss-directory by phax.
the class PublicHTMLProvider method getMenuContent.
@Nonnull
public static IHCNode getMenuContent(@Nonnull final LayoutExecutionContext aLEC) {
// Main menu
final IMenuTree aMenuTree = aLEC.getMenuTree();
final MenuItemDeterminatorCallback aCallback = new MenuItemDeterminatorCallback(aMenuTree, aLEC.getSelectedMenuItemID()) {
@Override
protected boolean isMenuItemValidToBeDisplayed(@Nonnull final IMenuObject aMenuObj) {
// Don't show items that belong to the footer
if (aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER))
return false;
// Use default code
return super.isMenuItemValidToBeDisplayed(aMenuObj);
}
};
final IHCElement<?> aMenu = BootstrapMenuItemRenderer.createSideBarMenu(aLEC, aCallback);
return aMenu;
}
use of com.helger.photon.core.menu.IMenuTree in project phoss-smp by phax.
the class MenuSecure method init.
public static void init(@Nonnull final IMenuTree aMenuTree) {
final MenuObjectFilterUserAssignedToUserGroup aFilterAdministrators = new MenuObjectFilterUserAssignedToUserGroup(CSMP.USERGROUP_ADMINISTRATORS_ID);
final IMenuObjectFilter aFilterPeppolDirectory = x -> SMPMetaManager.getSettings().isDirectoryIntegrationEnabled() && SMPMetaManager.hasBusinessCardMgr();
final IMenuObjectFilter aFilterSMLConnectionActive = x -> SMPMetaManager.getSettings().isSMLEnabled();
final IMenuObjectFilter aFilterSMLConnectionActiveOrNeeded = x -> SMPMetaManager.getSettings().isSMLEnabled() || SMPMetaManager.getSettings().isSMLRequired();
{
final IMenuItemPage aServiceGroups = aMenuTree.createRootItem(new PageSecureServiceGroup(CMenuSecure.MENU_SERVICE_GROUPS));
aMenuTree.createItem(aServiceGroups, new PageSecureServiceGroupExport(CMenuSecure.MENU_SERVICE_GROUPS_EXPORT));
aMenuTree.createItem(aServiceGroups, new PageSecureServiceGroupImport(CMenuSecure.MENU_SERVICE_GROUPS_IMPORT));
aMenuTree.createItem(aServiceGroups, new PageSecureServiceGroupMigrationOutbound(CMenuSecure.MENU_SERVICE_GROUPS_MIGRATE_OUTBOUND));
aMenuTree.createItem(aServiceGroups, new PageSecureServiceGroupMigrationInbound(CMenuSecure.MENU_SERVICE_GROUPS_MIGRATE_INBOUND));
}
{
final IMenuItemPage aEndpoints = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuSecure.MENU_ENDPOINTS, "Endpoints", aMenuTree));
aMenuTree.createItem(aEndpoints, new PageSecureEndpointList(CMenuSecure.MENU_ENDPOINT_LIST));
aMenuTree.createItem(aEndpoints, new PageSecureEndpointTree(CMenuSecure.MENU_ENDPOINT_TREE));
aMenuTree.createItem(aEndpoints, new PageSecureEndpointChangeURL(CMenuSecure.MENU_ENDPOINTS_CHANGE_URL));
aMenuTree.createItem(aEndpoints, new PageSecureEndpointChangeCertificate(CMenuSecure.MENU_ENDPOINTS_CHANGE_CERTIFICATE));
}
aMenuTree.createRootItem(new PageSecureRedirect(CMenuSecure.MENU_REDIRECTS));
aMenuTree.createRootItem(new PageSecureBusinessCard(CMenuSecure.MENU_BUSINESS_CARDS)).setDisplayFilter(aFilterPeppolDirectory);
aMenuTree.createRootItem(new PageSecureCertificateInformation(CMenuSecure.MENU_CERTIFICATE_INFORMATION));
aMenuTree.createRootItem(new PageSecureTasksProblems(CMenuSecure.MENU_TASKS));
aMenuTree.createRootSeparator();
// Administrator
{
final IMenuItemPage aAdmin = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuSecure.MENU_ADMIN, "Administration", aMenuTree));
{
final IMenuItemPage aAdminSML = aMenuTree.createItem(aAdmin, new BasePageShowChildren<>(CMenuSecure.MENU_SML, "SML", aMenuTree)).setDisplayFilter(aFilterSMLConnectionActiveOrNeeded);
aMenuTree.createItem(aAdminSML, new PageSecureSMLConfiguration(CMenuSecure.MENU_SML_CONFIGURATION)).setDisplayFilter(aFilterSMLConnectionActiveOrNeeded);
aMenuTree.createItem(aAdminSML, new PageSecureSMLRegistration(CMenuSecure.MENU_SML_REGISTRATION)).setDisplayFilter(aFilterSMLConnectionActive);
aMenuTree.createItem(aAdminSML, new PageSecureSMLCertificateUpdate(CMenuSecure.MENU_SML_CERTIFICATE_UPDATE)).setDisplayFilter(aFilterSMLConnectionActive);
}
aMenuTree.createItem(aAdmin, new PageSecureSMPSettings(CMenuSecure.MENU_SMP_SETTINGS));
aMenuTree.createItem(aAdmin, new PageSecureSMPIdentifierMappings(CMenuSecure.MENU_SMP_IDENTIFIER_MAPPINGS));
aMenuTree.createItem(aAdmin, new PageSecureTransportProfiles(CMenuSecure.MENU_TRANSPORT_PROFILES));
aMenuTree.createItem(aAdmin, new BasePageSecurityChangePassword<WebPageExecutionContext>(CMenuSecure.MENU_CHANGE_PASSWORD));
BootstrapPagesMenuConfigurator.addAllItems(aMenuTree, aAdmin, aFilterAdministrators, CSMPServer.DEFAULT_LOCALE);
}
// Default menu item
aMenuTree.setDefaultMenuItemID(CMenuSecure.MENU_SERVICE_GROUPS);
}
use of com.helger.photon.core.menu.IMenuTree in project peppol-practical by phax.
the class LayoutAreaContentProviderPublic method getMenuContent.
@Nonnull
public static IHCNode getMenuContent(@Nonnull final LayoutExecutionContext aLEC) {
// Main menu
final IMenuTree aMenuTree = aLEC.getMenuTree();
final MenuItemDeterminatorCallback aCallback = new MenuItemDeterminatorCallback(aMenuTree, aLEC.getSelectedMenuItemID()) {
@Override
protected boolean isMenuItemValidToBeDisplayed(@Nonnull final IMenuObject aMenuObj) {
// Don't show items that belong to the footer
if (aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER_COL1) || aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER_COL2) || aMenuObj.attrs().containsKey(CMenuPublic.FLAG_FOOTER_COL3))
return false;
// Use default code
return super.isMenuItemValidToBeDisplayed(aMenuObj);
}
};
final IHCElement<?> aMenu = BootstrapMenuItemRenderer.createSideBarMenu(aLEC, aCallback);
// Add PayPal
HCForm aPayPal = null;
if (!GlobalDebug.isDebugMode()) {
aPayPal = new HCForm(new SimpleURL("https://www.paypal.com/cgi-bin/webscr")).setTarget(HC_Target.TOP).addClass(CSS_CLASS_PAYPAL).addClass(CBootstrapCSS.MT_2);
aPayPal.addChild(new HCHiddenField("cmd", "_s-xclick"));
aPayPal.addChild(new HCHiddenField("encrypted", "-----BEGIN PKCS7-----MIIHFgYJKoZIhvcNAQcEoIIHBzCCBwMCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYB264gQyjDLx9HWYW1cHWhU+CfJWnYlcREqN2qSqHBSfe9bRPGHQRfTi2w15g8tAowYhIy2SHBmVIDpEAKDDZNqepeLcXtImq+mIrWC3D7RKe8JBta9WmgrmnmirqcOTm/BQ43FJY9umAAT/lqR8vnAfw0xkf6Su7MtPJak5JjYMDELMAkGBSsOAwIaBQAwgZMGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQI6p30GFWFH6iAcKcGODtOg05P2W3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lX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAIFfOlaagFrl71+jq6OKidbWFSE+Q4FqROvdgIONth+8kSK//Y/4ihuE4Ymvzn5ceE3S/iBSQQMjyvb+s2TWbQYDwcp129OPIbD9epdr4tJOUNiSojw7BHwYRiPh58S1xGlFgHFXwrEBb3dgNbMUa+u4qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xNDA5MjYwNjU1MjlaMCMGCSqGSIb3DQEJBDEWBBT0zM7TjTnq1Xd0zY6Pq8OJMqvPDzANBgkqhkiG9w0BAQEFAASBgJ8Zpcr0O+hJ5o2oZi0gR/HrIWhfXtHoV5hQF/riujzYCuUwVpAtHTNPyjNWwYcor/UVub2lDCRPJt36iBotZuFEgzOsnhv1PVAAdNKMxSuvEFjP1gOkA3ZgaVzPLPteHGCVZ5eU2syP8259AdEC1AFCCUHt2eRg1po6qv2LJoNm-----END PKCS7-----\r\n"));
aPayPal.addChild(new HCInput().setType(EHCInputType.IMAGE).setSrc(new SimpleURL("https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif")).setName("submit").setAlt("PayPal - The safer, easier way to pay online!"));
aPayPal.addChild(new HCImg().setAlt("").setSrc(new SimpleURL("https://www.paypalobjects.com/de_DE/i/scr/pixel.gif")).setExtent(1, 1));
}
return new HCNodeList().addChild(aMenu).addChild(aPayPal);
}
use of com.helger.photon.core.menu.IMenuTree in project peppol-practical by phax.
the class PageSecureAdminAddons method _handleAction.
@Nullable
private IHCNode _handleAction(@Nullable final String sAction) {
if (ACTION_EXPIRE_PAGE_CACHE.equals(sAction)) {
final IMenuTree aPublicMenuTree = PhotonGlobalState.state(CApplicationID.APP_ID_PUBLIC).getMenuTree();
// Bulk modify
final MutableInt aCounterUpdated = new MutableInt(0);
final MutableInt aCounterNoNeed = new MutableInt(0);
aPublicMenuTree.iterateAllMenuObjects(aMenuObj -> {
if (aMenuObj instanceof IMenuItemPage) {
final IMenuItemPage aMenuItemPage = (IMenuItemPage) aMenuObj;
if (aMenuItemPage.getPage() instanceof IWebPageResourceContent) {
final IWebPageResourceContent aPageViewExternal = (IWebPageResourceContent) aMenuItemPage.getPage();
if (aPageViewExternal.isReadEveryTime())
aCounterNoNeed.inc();
else {
aPageViewExternal.updateFromResource();
aCounterUpdated.inc();
}
}
}
});
final String sMsg = aCounterUpdated.intValue() + " pages were reloaded." + (aCounterNoNeed.isGT0() ? " On " + aCounterNoNeed.intValue() + " pages no action was necessary because they are set to reload every time." : "");
LOGGER.info(sMsg);
AuditHelper.onAuditExecuteSuccess("page-reload", aCounterUpdated.getAsInteger(), aCounterNoNeed.getAsInteger());
return success(sMsg);
}
return null;
}
Aggregations