use of com.helger.html.hc.html.forms.HCEdit 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.forms.HCEdit 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;
}
use of com.helger.html.hc.html.forms.HCEdit 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;
}
use of com.helger.html.hc.html.forms.HCEdit in project phoss-smp by phax.
the class PageSecureBusinessCard method _createContactInputForm.
@Nonnull
private static HCRow _createContactInputForm(@Nonnull final ILayoutExecutionContext aLEC, @Nonnull final String sEntityID, @Nullable final SMPBusinessCardContact aExistingContact, @Nullable final String sExistingID, @Nonnull final FormErrorList aFormErrors) {
final Locale aDisplayLocale = aLEC.getDisplayLocale();
final String sContactID = StringHelper.hasText(sExistingID) ? sExistingID : TMP_ID_PREFIX + Integer.toString(GlobalIDFactory.getNewIntID());
final HCRow aRow = new HCRow();
// Type
{
final String sFieldType = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_CONTACT, sContactID, SUFFIX_TYPE);
final HCEdit aCtrl = new HCEdit(new RequestField(sFieldType, aExistingContact == null ? null : aExistingContact.getType())).setPlaceholder("Contact type");
aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldType), aDisplayLocale));
}
// Name
{
final String sFieldName = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_CONTACT, sContactID, SUFFIX_NAME);
final HCEdit aCtrl = new HCEdit(new RequestField(sFieldName, aExistingContact == null ? null : aExistingContact.getName())).setPlaceholder("Contact name");
aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldName), aDisplayLocale));
}
// Phone number
{
final String sFieldPhone = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_CONTACT, sContactID, SUFFIX_PHONE);
final HCEdit aCtrl = new HCEdit(new RequestField(sFieldPhone, aExistingContact == null ? null : aExistingContact.getPhoneNumber())).setPlaceholder("Contact phone number");
aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldPhone), aDisplayLocale));
}
// Email address
{
final String sFieldEmail = RequestParamMap.getFieldName(PREFIX_ENTITY, sEntityID, PREFIX_CONTACT, sContactID, SUFFIX_EMAIL);
final HCEdit aCtrl = new HCEdit(new RequestField(sFieldEmail, aExistingContact == null ? null : aExistingContact.getEmail())).setPlaceholder("Contact email address");
aCtrl.addClass(CBootstrapCSS.FORM_CONTROL);
aRow.addCell(aCtrl, BootstrapFormHelper.createDefaultErrorNode(aFormErrors.getListOfField(sFieldEmail), aDisplayLocale));
}
aRow.addCell(new BootstrapButton(EBootstrapButtonSize.SMALL).setIcon(EDefaultIcon.DELETE).setOnClick(JQuery.idRef(aRow).remove()));
return aRow;
}
use of com.helger.html.hc.html.forms.HCEdit in project phoss-smp by phax.
the class PageSecureSMLConfiguration method showInputForm.
@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMLInfo aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
final boolean bEdit = eFormAction.isEdit();
aForm.addChild(getUIHandler().createActionHeader(bEdit ? "Edit SML configuration '" + aSelectedObject.getDisplayName() + "'" : "Create new SML configuration"));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Name").setCtrl(new HCEdit(new RequestField(FIELD_DISPLAY_NAME, aSelectedObject != null ? aSelectedObject.getDisplayName() : null))).setHelpText("The name of the SML configuration. This is for informational purposes only and has no effect on the functionality.").setErrorList(aFormErrors.getListOfField(FIELD_DISPLAY_NAME)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("DNS Zone").setCtrl(new HCEdit(new RequestField(FIELD_DNS_ZONE, aSelectedObject != null ? aSelectedObject.getDNSZone() : null))).setHelpText(new HCTextNode("The name of the DNS Zone that this SML is working upon (e.g. "), code("acc.edelivery.tech.ec.europa.eu"), new HCTextNode("). The value will automatically converted to all-lowercase!")).setErrorList(aFormErrors.getListOfField(FIELD_DNS_ZONE)));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Management Service URL").setCtrl(new HCEdit(new RequestField(FIELD_MANAGEMENT_ADDRESS_URL, aSelectedObject != null ? aSelectedObject.getManagementServiceURL() : null))).setHelpText("The service URL where the SML management application is running on including the host name. It may not contain the '" + CSMLDefault.MANAGEMENT_SERVICE_METADATA + "' or '" + CSMLDefault.MANAGEMENT_SERVICE_PARTICIPANTIDENTIFIER + "' path elements!").setErrorList(aFormErrors.getListOfField(FIELD_MANAGEMENT_ADDRESS_URL)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Client Certificate required?").setCtrl(new HCCheckBox(new RequestFieldBoolean(FIELD_CLIENT_CERTIFICATE_REQUIRED, aSelectedObject != null ? aSelectedObject.isClientCertificateRequired() : DEFAULT_CLIENT_CERTIFICATE_REQUIRED))).setHelpText("Check this if this SML requires a client certificate for access. Both Peppol production SML and SMK require a client certificate. Only a locally running SML software may not require a client certificate.").setErrorList(aFormErrors.getListOfField(FIELD_CLIENT_CERTIFICATE_REQUIRED)));
}
Aggregations