use of com.helger.photon.core.menu.IMenuItemPage in project phoss-smp by phax.
the class SMPLayoutHTMLProvider method fillBody.
@Override
protected void fillBody(@Nonnull final ISimpleWebExecutionContext aSWEC, @Nonnull final HCHtml aHtml) {
final IRequestWebScopeWithoutResponse aRequestScope = aSWEC.getRequestScope();
final Locale aDisplayLocale = aSWEC.getDisplayLocale();
final IMenuItemPage aMenuItem = RequestSettings.getMenuItem(aRequestScope);
final LayoutExecutionContext aLEC = new LayoutExecutionContext(aSWEC, aMenuItem);
final HCHead aHead = aHtml.head();
final HCBody aBody = aHtml.body();
// Add menu item in page title
aHead.setPageTitle(StringHelper.getConcatenatedOnDemand(CSMP.getApplicationTitle(), " - ", aMenuItem.getDisplayText(aDisplayLocale)));
try {
final IHCNode aNode = m_aFactory.apply(aLEC);
aBody.addChild(aNode);
} catch (final ForcedRedirectException ex) {
throw ex;
} catch (final RuntimeException ex) {
new InternalErrorBuilder().setDisplayLocale(aDisplayLocale).setRequestScope(aRequestScope).setThrowable(ex).setUIErrorHandlerFor(aBody).handle();
}
}
use of com.helger.photon.core.menu.IMenuItemPage in project peppol-practical by phax.
the class MenuPublic method init.
public static void init(@Nonnull final IMenuTree aMenuTree) {
// Common stuff
aMenuTree.createRootItem(new AppPageViewExternal(CMenuPublic.MENU_INDEX, "Overview", new ClassPathResource("viewpages/en/index.xml")));
// News stuff
{
aMenuTree.createRootItem(new AppPageViewExternal(CMenuPublic.MENU_NEWS, "News", new ClassPathResource("viewpages/en/news.xml")));
}
// Setup stuff
{
final IMenuItemPage aSetup = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuPublic.MENU_DOCS, "Technical documentation", aMenuTree));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_SETUP_AP_PH, "Setup Peppol AP", new ClassPathResource("viewpages/en/docs_setup_ap.xml")));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_SETUP_SMP_PHOSS, "Setup phoss SMP", new ClassPathResource("viewpages/en/docs_setup_smp_phoss.xml")));
if (false)
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_SETUP_SMP_CIPA, "Setup CIPA SMP (deprecated)", new ClassPathResource("viewpages/en/invisible/docs_setup_smp_cipa.xml")));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_SMP_SML_INTERPLAY, "SMP and SML interactions", new ClassPathResource("viewpages/en/docs_smp_sml_interplay.xml")));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_SML_SUPPORT, "SML support", new ClassPathResource("viewpages/en/docs_sml_support.xml")));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_DOC_EXCHANGE, "Document exchange explained", new ClassPathResource("viewpages/en/docs_document_exchange.xml")));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_PEPPOL_PKI, "Peppol PKI explained", new ClassPathResource("viewpages/en/docs_peppol_pki.xml")));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_PEPPOL_CERT_UPDATE, "Peppol Certificate update", new ClassPathResource("viewpages/en/docs_peppol_cert_update.xml")));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_PEPPOL_DICT, "Peppol Dictionary/Abbreviations", new ClassPathResource("viewpages/en/docs_peppol_dict.xml")));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_DOCS_SOFTWARE_VENDORS, "Software Vendors and Solutions", new ClassPathResource("viewpages/en/docs_software_vendors.xml")));
// Not needed any more
if (false)
aMenuTree.createItem(aSetup, new AppPageViewExternal("docs-sml-migration", "SML migration information", new ClassPathResource("viewpages/en/invisible/docs_sml_migration.xml")));
}
// Tools stuff
{
final IMenuItemPage aSetup = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuPublic.MENU_TOOLS, "Tools", aMenuTree));
aMenuTree.createItem(aSetup, new PagePublicToolsParticipantInformation(CMenuPublic.MENU_TOOLS_PARTICIPANT_INFO));
aMenuTree.createItem(aSetup, new PagePublicToolsIdentifierInformation(CMenuPublic.MENU_TOOLS_ID_INFO));
aMenuTree.createItem(aSetup, new PagePublicToolsSMPSML(CMenuPublic.MENU_TOOLS_SMP_SML));
aMenuTree.createItem(aSetup, new PagePublicToolsTestEndpoints(CMenuPublic.MENU_TOOLS_TEST_ENDPOINTS));
aMenuTree.createItem(aSetup, new AppPageViewExternal(CMenuPublic.MENU_TOOLS_REST_API, "REST API", new ClassPathResource("viewpages/en/rest_api.xml")));
}
// Validation stuff
{
final IMenuItemPage aValidation = aMenuTree.createRootItem(new BasePageShowChildren<WebPageExecutionContext>(CMenuPublic.MENU_VALIDATION, "Document Validation", aMenuTree));
final IMenuItemPage aUpload = aMenuTree.createItem(aValidation, new PagePublicToolsDocumentValidation(CMenuPublic.MENU_VALIDATION_UPLOAD));
aMenuTree.createRedirect("validation-bis2", aUpload);
aMenuTree.createItem(aValidation, new AppPageViewExternal(CMenuPublic.MENU_VALIDATION_DVS, "Document Validation (WebService)", new ClassPathResource("viewpages/en/validation_dvs.xml")));
}
// EN 16931 - CEN/TC 434
{
aMenuTree.createRootItem(new AppPageViewExternal(CMenuPublic.MENU_EN16931, "EN 16931 - CEN/TC 434", new ClassPathResource("viewpages/en/en16931.xml")));
}
aMenuTree.createRootSeparator();
// Newsletter stuff
{
aMenuTree.createRootItem(new PagePublicNewsletterSubscribe(CMenuPublic.MENU_NEWSLETTER_SUBSCRIBE));
aMenuTree.createRootItem(new PagePublicNewsletterUnsubscribe(CMenuPublic.MENU_NEWSLETTER_UNSUBSCRIBE)).attrs().putIn(CMenuPublic.FLAG_FOOTER_COL2, true);
}
// Contact form
{
aMenuTree.createRootItem(new PagePublicContact(CMenuPublic.MENU_CONTACT));
}
aMenuTree.createRootSeparator();
// Register/Login stuff
{
aMenuTree.createRootItem(new PagePublicLogin(CMenuPublic.MENU_LOGIN)).setDisplayFilter(new MenuObjectFilterNoUserLoggedIn());
aMenuTree.createRootItem(new PagePublicSignUp(CMenuPublic.MENU_SIGN_UP)).setDisplayFilter(new MenuObjectFilterNoUserLoggedIn());
}
// Logged in user stuff
{
aMenuTree.createRootItem(new BasePageSecurityChangePassword<WebPageExecutionContext>(CMenuPublic.MENU_CHANGE_PASSWORD)).setDisplayFilter(new MenuObjectFilterUserLoggedIn());
}
aMenuTree.createRootSeparator();
// External stuff
{
aMenuTree.createRootItem(CMenuPublic.MENU_PEPPOL_SERVICE_DESK, new SimpleURL("https://openpeppol.atlassian.net/servicedesk/customer/portal/1"), new ConstantHasDisplayText("OpenPeppol Service Desk (external)"));
}
// Set default
aMenuTree.setDefaultMenuItemID(CMenuPublic.MENU_NEWS);
}
use of com.helger.photon.core.menu.IMenuItemPage in project phoss-directory by phax.
the class PublicHTMLProvider method fillBody.
@Override
protected void fillBody(@Nonnull final ISimpleWebExecutionContext aSWEC, @Nonnull final HCHtml aHtml) throws ForcedRedirectException {
final IRequestWebScopeWithoutResponse aRequestScope = aSWEC.getRequestScope();
final Locale aDisplayLocale = aSWEC.getDisplayLocale();
final IMenuItemPage aMenuItem = RequestSettings.getMenuItem(aRequestScope);
final LayoutExecutionContext aLEC = new LayoutExecutionContext(aSWEC, aMenuItem);
final HCHead aHead = aHtml.head();
final HCBody aBody = aHtml.body();
// Add menu item in page title
aHead.setPageTitle(StringHelper.getConcatenatedOnDemand(CPDPublisher.getApplicationTitle(), " - ", aMenuItem.getDisplayText(aDisplayLocale)));
AppCommonUI.addFavIcons(aHead);
final IHCNode aNode = getContent(aLEC);
aBody.addChild(aNode);
}
use of com.helger.photon.core.menu.IMenuItemPage 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.photon.core.menu.IMenuItemPage in project phoss-directory by phax.
the class MenuSecure method init.
public static void init(@Nonnull final IMenuTree aMenuTree) {
// We need this additional indirection layer, as the pages are initialized
// statically!
final MenuObjectFilterUserAssignedToUserGroup aFilterAdministrators = new MenuObjectFilterUserAssignedToUserGroup(AppSecurity.USERGROUP_ADMINISTRATORS_ID);
// Indexer
{
final IMenuItemPage aIndexer = aMenuTree.createRootItem(new BasePageShowChildren<>(CMenuSecure.MENU_INDEXER, "Indexer", aMenuTree));
aMenuTree.createItem(aIndexer, new PageSecureParticipantCount(CMenuSecure.MENU_PARTICIPANT_COUNT));
aMenuTree.createItem(aIndexer, new PageSecureParticipantList(CMenuSecure.MENU_PARTICIPANT_LIST));
aMenuTree.createItem(aIndexer, new PageSecureParticipantActions(CMenuSecure.MENU_PARTICIPANT_ACTIONS));
aMenuTree.createItem(aIndexer, new PageSecureIndexManually(CMenuSecure.MENU_INDEX_MANUALLY));
aMenuTree.createItem(aIndexer, new PageSecureIndexImport(CMenuSecure.MENU_INDEX_IMPORT));
aMenuTree.createItem(aIndexer, new PageSecureDeleteManually(CMenuSecure.MENU_DELETE_MANUALLY));
aMenuTree.createSeparator(aIndexer);
aMenuTree.createItem(aIndexer, new PageSecureListIndex(CMenuSecure.MENU_LIST_INDEX));
aMenuTree.createItem(aIndexer, new PageSecureListReIndex(CMenuSecure.MENU_LIST_RE_INDEX));
aMenuTree.createItem(aIndexer, new PageSecureListDeadIndex(CMenuSecure.MENU_LIST_DEAD_INDEX));
}
// Administrator
{
final IMenuItemPage aAdmin = aMenuTree.createRootItem(new BasePageShowChildren<>(CMenuSecure.MENU_ADMIN, "Administration", aMenuTree));
aMenuTree.createItem(aAdmin, new BasePageSecurityChangePassword<>(CMenuSecure.MENU_ADMIN_CHANGE_PASSWORD));
aMenuTree.createItem(aAdmin, new PageSecureAdminSMLConfiguration(CMenuSecure.MENU_ADMIN_SML_CONFIGURATION));
aMenuTree.createItem(aAdmin, new PageSecureAdminLuceneInformation(CMenuSecure.MENU_ADMIN_LUCENE_INFO));
BootstrapPagesMenuConfigurator.addAllItems(aMenuTree, aAdmin, aFilterAdministrators, AppCommonUI.DEFAULT_LOCALE);
}
// Default menu item
aMenuTree.setDefaultMenuItemID(CMenuSecure.MENU_INDEXER);
}
Aggregations