use of com.helger.html.hc.html.grouping.HCDiv in project phoss-directory by phax.
the class PagePublicSearchSimple method _createInitialSearchForm.
@Nonnull
private BootstrapRow _createInitialSearchForm(final WebPageExecutionContext aWPEC) {
final HCForm aBigQueryBox = new HCForm().setAction(aWPEC.getSelfHref()).setMethod(EHCFormMethod.GET);
final HCEdit aQueryEdit = _createQueryEdit();
aBigQueryBox.addChild(div(aQueryEdit).addClass(CSS_CLASS_BIG_QUERY_BOX));
{
final String sHelpText = "Enter the name, address, ID or any other keyword of the entity you are looking for.";
if (UI_MODE.isUseHelptext())
aBigQueryBox.addChild(div(sHelpText).addClass(CSS_CLASS_BIG_QUERY_HELPTEXT));
else
aQueryEdit.setPlaceholder(sHelpText);
}
{
final BootstrapButton aButton = new BootstrapSubmitButton().addChild("Search " + CPDPublisher.getApplication()).setIcon(EDefaultIcon.MAGNIFIER);
if (UI_MODE.isUseGreenButton())
aButton.setButtonType(EBootstrapButtonType.SUCCESS);
aBigQueryBox.addChild(new HCDiv().addClass(CSS_CLASS_BIG_QUERY_BUTTONS).addChild(aButton));
}
final BootstrapRow aBodyRow = new BootstrapRow();
aBodyRow.createColumn(-1, -1, 1, 2, 3).addClasses(CBootstrapCSS.D_NONE, CBootstrapCSS.D_MD_BLOCK);
aBodyRow.createColumn(12, 12, 10, 8, 6).addChild(aBigQueryBox);
aBodyRow.createColumn(-1, -1, 1, 2, 3).addClasses(CBootstrapCSS.D_NONE, CBootstrapCSS.D_MD_BLOCK);
return aBodyRow;
}
use of com.helger.html.hc.html.grouping.HCDiv in project phoss-directory by phax.
the class PublicHTMLProvider method _addNavbarLoginLogout.
private static void _addNavbarLoginLogout(@Nonnull final LayoutExecutionContext aLEC, @Nonnull final BootstrapNavbar aNavbar) {
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
final Locale aDisplayLocale = aLEC.getDisplayLocale();
// Documentation
{
final BootstrapNavbarNav aNav = aNavbar.addAndReturnNav();
final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
aDropDown.createAndAddItem().addChild("Introduction").setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_DOCS_INTRODUCTION));
aDropDown.createAndAddItem().addChild("How to use it").setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_DOCS_HOW_TO));
aDropDown.createAndAddItem().addChild("REST API").setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_DOCS_REST_API));
aDropDown.createAndAddItem().addChild("Export data").setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_DOCS_EXPORT_ALL));
aDropDown.createAndAddItem().addChild("Specification v1.1.1 (PDF)").setHref(LinkHelper.getURLWithContext("/files/PEPPOL-EDN-Directory-1.1.1-2020-10-15.pdf"));
aDropDown.createAndAddItem().addChild("Guide for SMP providers (PDF)").setHref(LinkHelper.getURLWithContext("/files/OpenPEPPOL Directory for SMP providers 2016-12-05.pdf"));
aNav.addItem().addNavDropDown("Documentation", aDropDown);
}
// Support
{
final BootstrapNavbarNav aNav = aNavbar.addAndReturnNav();
final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
if (PDServerConfiguration.isWebAppShowContactPage()) {
final String sTitle = PDServerConfiguration.getWebAppContactTitle("Contact us");
final URL aExternalURL = PDServerConfiguration.getWebAppContactExternalURL();
if (aExternalURL != null)
aDropDown.createAndAddItem().addChild(sTitle).setHref(new SimpleURL(aExternalURL));
else
aDropDown.createAndAddItem().addChild(sTitle).setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_SUPPORT_CONTACT_US));
}
aDropDown.createAndAddItem().addChild("Issue tracker (external)").setHref(new SimpleURL("https://github.com/phax/phoss-directory/issues")).setTargetBlank();
aNav.addItem().addNavDropDown("Support", aDropDown);
}
// About
{
final BootstrapNavbarNav aNav = aNavbar.addAndReturnNav();
final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
aDropDown.createAndAddItem().addChild("About " + CPDPublisher.getApplication()).setHref(aLEC.getLinkToMenuItem(CMenuPublic.MENU_ABOUT));
aNav.addItem().addNavDropDown("About", aDropDown);
}
final BootstrapNavbarToggleable aToggleable = aNavbar.addAndReturnToggleable();
// Login etc
{
final IUser aUser = LoggedInUserManager.getInstance().getCurrentUser();
if (aUser != null) {
aToggleable.addAndReturnText().addClass(CBootstrapCSS.ML_AUTO).addClass(CBootstrapCSS.MR_2).addChild("Welcome ").addChild(new HCStrong().addChild(SecurityHelper.getUserDisplayName(aUser, aDisplayLocale)));
if (SecurityHelper.hasUserRole(aUser.getID(), AppSecurity.ROLE_CONFIG_ID)) {
aToggleable.addChild(new BootstrapButton().addClass(CBootstrapCSS.MR_2).addChild("Goto secure area").setOnClick(LinkHelper.getURLWithContext(AbstractSecureApplicationServlet.SERVLET_DEFAULT_PATH + "/")));
}
aToggleable.addChild(new BootstrapButton().setOnClick(LinkHelper.getURLWithContext(aRequestScope, LogoutServlet.SERVLET_DEFAULT_PATH)).addChild(EPhotonCoreText.LOGIN_LOGOUT.getDisplayText(aDisplayLocale)).addStyle(CCSSProperties.MARGIN_RIGHT.newValue("8px")));
} else {
final BootstrapNavbarNav aNav = aToggleable.addAndReturnNav();
final BootstrapDropdownMenu aDropDown = new BootstrapDropdownMenu();
{
final HCDiv aDiv = new HCDiv().addClass(CBootstrapCSS.P_2).addStyle(CCSSProperties.MIN_WIDTH.newValue("400px"));
aDiv.addChild(AppCommonUI.createViewLoginForm(aLEC, null));
aDropDown.addChild(aDiv);
}
aNav.addItem().addNavDropDown("Login", aDropDown);
}
}
}
use of com.helger.html.hc.html.grouping.HCDiv 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.html.grouping.HCDiv in project phoss-directory by phax.
the class PDCommonUI method createCertificateDetailsTable.
@Nonnull
public static BootstrapTable createCertificateDetailsTable(@Nonnull final X509Certificate aX509Cert, @Nonnull final LocalDateTime aNowLDT, @Nonnull final Locale aDisplayLocale) {
final LocalDateTime aNotBefore = PDTFactory.createLocalDateTime(aX509Cert.getNotBefore());
final LocalDateTime aNotAfter = PDTFactory.createLocalDateTime(aX509Cert.getNotAfter());
final PublicKey aPublicKey = aX509Cert.getPublicKey();
final BootstrapTable aCertDetails = new BootstrapTable(HCCol.star(), HCCol.star());
aCertDetails.addBodyRow().addCell("Version:").addCell(Integer.toString(aX509Cert.getVersion()));
aCertDetails.addBodyRow().addCell("Subject:").addCell(aX509Cert.getSubjectX500Principal().getName());
aCertDetails.addBodyRow().addCell("Issuer:").addCell(aX509Cert.getIssuerX500Principal().getName());
aCertDetails.addBodyRow().addCell("Serial number:").addCell(aX509Cert.getSerialNumber().toString(16));
aCertDetails.addBodyRow().addCell("Valid from:").addCell(new HCTextNode(PDTToString.getAsString(aNotBefore, aDisplayLocale)), aNowLDT.isBefore(aNotBefore) ? new HCStrong().addChild(" !!!NOT YET VALID!!!") : null);
aCertDetails.addBodyRow().addCell("Valid to:").addCell(new HCTextNode(PDTToString.getAsString(aNotAfter, aDisplayLocale)), aNowLDT.isAfter(aNotAfter) ? new HCStrong().addChild(" !!!NO LONGER VALID!!!") : new HCDiv().addChild("Valid for: " + PDTDisplayHelper.getPeriodTextEN(aNowLDT, aNotAfter)));
if (aPublicKey instanceof RSAPublicKey) {
// Special handling for RSA
aCertDetails.addBodyRow().addCell("Public key:").addCell(aX509Cert.getPublicKey().getAlgorithm() + " (" + ((RSAPublicKey) aPublicKey).getModulus().bitLength() + " bits)");
} else {
// Usually EC or DSA key
aCertDetails.addBodyRow().addCell("Public key:").addCell(aX509Cert.getPublicKey().getAlgorithm());
}
aCertDetails.addBodyRow().addCell("Signature algorithm:").addCell(aX509Cert.getSigAlgName() + " (" + aX509Cert.getSigAlgOID() + ")");
return aCertDetails;
}
use of com.helger.html.hc.html.grouping.HCDiv in project phoss-directory by phax.
the class AppCommonUI method createViewLoginForm.
@Nonnull
public static BootstrapForm createViewLoginForm(@Nonnull final LayoutExecutionContext aLEC, @Nullable final String sPreselectedUserName) {
final Locale aDisplayLocale = aLEC.getDisplayLocale();
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
// Use new IDs for both fields, in case the login stuff is displayed more
// than once!
final String sIDUserName = GlobalIDFactory.getNewStringID();
final String sIDPassword = GlobalIDFactory.getNewStringID();
final String sIDErrorField = GlobalIDFactory.getNewStringID();
final BootstrapForm aForm = new BootstrapForm(aLEC).setAction(aLEC.getSelfHref()).setFormType(EBootstrapFormType.DEFAULT);
aForm.setLeft(3);
// User name field
aForm.addFormGroup(new BootstrapFormGroup().setLabel(EPhotonCoreText.EMAIL_ADDRESS.getDisplayText(aDisplayLocale)).setCtrl(new HCEdit(new RequestField(CLogin.REQUEST_ATTR_USERID, sPreselectedUserName)).setID(sIDUserName)));
// Password field
aForm.addFormGroup(new BootstrapFormGroup().setLabel(EPhotonCoreText.LOGIN_FIELD_PASSWORD.getDisplayText(aDisplayLocale)).setCtrl(new HCEditPassword(CLogin.REQUEST_ATTR_PASSWORD).setID(sIDPassword)));
// Placeholder for error message
aForm.addChild(new HCDiv().setID(sIDErrorField).addStyle(CCSSProperties.MARGIN.newValue("4px 0")));
// Login button
final BootstrapButtonToolbar aToolbar = aForm.addAndReturnChild(new BootstrapButtonToolbar(aLEC));
final JSPackage aOnClick = new JSPackage();
{
final JSAnonymousFunction aJSSuccess = new JSAnonymousFunction();
final JSVar aJSData = aJSSuccess.param("data");
aJSSuccess.body()._if(aJSData.ref(AjaxExecutorPublicLogin.JSON_LOGGEDIN), JSHtml.windowLocationReload(), JQuery.idRef(sIDErrorField).empty().append(aJSData.ref(AjaxExecutorPublicLogin.JSON_HTML)));
aOnClick.add(new JQueryAjaxBuilder().url(CAjax.LOGIN.getInvocationURI(aRequestScope)).method(EHttpMethod.POST).data(new JSAssocArray().add(CLogin.REQUEST_ATTR_USERID, JQuery.idRef(sIDUserName).val()).add(CLogin.REQUEST_ATTR_PASSWORD, JQuery.idRef(sIDPassword).val())).success(aJSSuccess).build());
}
aOnClick._return(false);
aToolbar.addSubmitButton(EPhotonCoreText.LOGIN_BUTTON_SUBMIT.getDisplayText(aDisplayLocale), aOnClick);
return aForm;
}
Aggregations