use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project phoss-smp by phax.
the class PageSecureServiceGroup method showInputForm.
@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final ISMPServiceGroup aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final boolean bEdit = eFormAction.isEdit();
final IIdentifierFactory aIdentifierFactory = SMPMetaManager.getIdentifierFactory();
aForm.setLeft(2);
aForm.addChild(getUIHandler().createActionHeader(bEdit ? "Edit service group '" + aSelectedObject.getID() + "'" : "Create new service group"));
{
final String sDefaultScheme = aIdentifierFactory.getDefaultParticipantIdentifierScheme();
final BootstrapRow aRow = new BootstrapRow();
aRow.createColumn(GS_IDENTIFIER_SCHEME).addChild(new HCEdit(new RequestField(FIELD_PARTICIPANT_ID_SCHEME, aSelectedObject != null ? aSelectedObject.getParticipantIdentifier().getScheme() : sDefaultScheme)).setPlaceholder("Identifier scheme").setReadOnly(bEdit));
aRow.createColumn(GS_IDENTIFIER_VALUE).addChild(new HCEdit(new RequestField(FIELD_PARTICIPANT_ID_VALUE, aSelectedObject != null ? aSelectedObject.getParticipantIdentifier().getValue() : null)).setPlaceholder("Identifier value").setReadOnly(bEdit));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Participant ID").setCtrl(aRow).setHelpText("The participant identifier for which the service group should be created. The left part is the identifier scheme" + (sDefaultScheme == null ? "" : " (default: " + sDefaultScheme + ")") + ", the right part is the identifier value (e.g. 9915:test)").setErrorList(aFormErrors.getListOfFields(FIELD_PARTICIPANT_ID_SCHEME, FIELD_PARTICIPANT_ID_VALUE)));
}
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Owning User").setCtrl(new HCUserSelect(new RequestField(FIELD_OWNING_USER_ID, aSelectedObject != null ? aSelectedObject.getOwnerID() : LoggedInUserManager.getInstance().getCurrentUserID()), aDisplayLocale)).setHelpText("The user who owns this entry. Only this user can make changes via the REST API.").setErrorList(aFormErrors.getListOfField(FIELD_OWNING_USER_ID)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Extension").setCtrl(new HCTextArea(new RequestField(FIELD_EXTENSION, aSelectedObject != null ? aSelectedObject.getFirstExtensionXML() : null))).setHelpText("Optional extension to the service group. If present it must be valid XML content!").setErrorList(aFormErrors.getListOfField(FIELD_EXTENSION)));
}
use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project phoss-smp by phax.
the class PageSecureServiceGroupMigrationInbound method showSelectedObject.
@Override
protected void showSelectedObject(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final ISMPParticipantMigration aSelectedObject) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
aNodeList.addChild(getUIHandler().createActionHeader("Show details of inbound Participant Migration"));
final BootstrapViewForm aForm = new BootstrapViewForm();
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Service Group").setCtrl(new HCA(createViewURL(aWPEC, CMenuSecure.MENU_SERVICE_GROUPS, aSelectedObject.getParticipantIdentifier().getURIEncoded())).addChild(aSelectedObject.getParticipantIdentifier().getURIEncoded())));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Migration state").setCtrl(aSelectedObject.getState().getDisplayName()));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Initiation datetime").setCtrl(PDTToString.getAsString(aSelectedObject.getInitiationDateTime(), aDisplayLocale)));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Migration Key").setCtrl(code(aSelectedObject.getMigrationKey())));
aNodeList.addChild(aForm);
}
use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project peppol-practical by phax.
the class CommentUI method getCreateComment.
@Nonnull
public static IHCNode getCreateComment(@Nonnull final ILayoutExecutionContext aLEC, @Nonnull final String sResultDivID, @Nonnull final ITypedObject<String> aObject, @Nullable final ICommentThread aCommentThread, @Nullable final IComment aParentComment, @Nullable final CommentFormErrors aFormErrors, @Nullable final IHCNode aMessageBox) {
final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
final Locale aDisplayLocale = aLEC.getDisplayLocale();
final IUser aLoggedInUser = LoggedInUserManager.getInstance().getCurrentUser();
final boolean bIsCreateNewThread = aCommentThread == null || aParentComment == null;
final HCDiv aFormContainer = new HCDiv();
if (bIsCreateNewThread)
if (aFormErrors == null || aFormErrors.isEmpty())
aFormContainer.addStyle(CCSSProperties.DISPLAY_NONE);
aFormContainer.addClass(CCommentCSS.CSS_CLASS_COMMENT_CREATE);
if (aFormErrors != null && !aFormErrors.isEmpty())
aFormContainer.addChild(new BootstrapErrorBox().addChild(EPhotonCoreText.ERR_INCORRECT_INPUT.getDisplayText(aDisplayLocale)));
final BootstrapViewForm aForm = aFormContainer.addAndReturnChild(new BootstrapViewForm());
aForm.setTitle(ECommentText.MSG_CREATE_COMMENT.getDisplayText(aDisplayLocale));
HCEdit aEditAuthor = null;
if (aLoggedInUser != null) {
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory(ECommentText.MSG_FIELD_AUTHOR.getDisplayText(aDisplayLocale)).setCtrl(aLoggedInUser.getDisplayName()));
} else {
aEditAuthor = new HCEdit(new RequestField(FIELD_COMMENT_AUTHOR));
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory(ECommentText.MSG_FIELD_AUTHOR.getDisplayText(aDisplayLocale)).setCtrl(aEditAuthor).setHelpText(ECommentText.DESC_FIELD_AUTHOR.getDisplayText(aDisplayLocale)).setErrorList(aFormErrors == null ? null : aFormErrors.getListOfField(FIELD_COMMENT_AUTHOR)));
}
final HCEdit aEditTitle = new HCEdit(new RequestField(FIELD_COMMENT_TITLE));
aForm.addFormGroup(new BootstrapFormGroup().setLabel(ECommentText.MSG_FIELD_TITLE.getDisplayText(aDisplayLocale)).setCtrl(aEditTitle).setHelpText(ECommentText.DESC_FIELD_TITLE.getDisplayText(aDisplayLocale)).setErrorList(aFormErrors == null ? null : aFormErrors.getListOfField(FIELD_COMMENT_TITLE)));
final HCTextAreaAutosize aTextAreaContent = new HCTextAreaAutosize(new RequestField(FIELD_COMMENT_TEXT)).setRows(5);
aForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory(ECommentText.MSG_FIELD_TEXT.getDisplayText(aDisplayLocale)).setCtrl(aTextAreaContent).setHelpText(ECommentText.DESC_FIELD_TEXT.getDisplayText(aDisplayLocale)).setErrorList(aFormErrors == null ? null : aFormErrors.getListOfField(FIELD_COMMENT_TEXT)));
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aLEC);
// What to do on save?
{
final JSAnonymousFunction aOnSuccess = new JSAnonymousFunction();
final JSVar aJSData = aOnSuccess.param("data");
aOnSuccess.body().add(JQuery.idRef(sResultDivID).replaceWith(aJSData.ref(PhotonUnifiedResponse.HtmlHelper.PROPERTY_HTML)));
JQueryInvocation aSaveAction;
if (bIsCreateNewThread) {
// Create a new thread
aSaveAction = new JQueryAjaxBuilder().url(CAjax.COMMENT_CREATE_THREAD.getInvocationURL(aRequestScope)).data(new JSAssocArray().add(AjaxExecutorCommentCreateThread.PARAM_OBJECT_TYPE, aObject.getObjectType().getName()).add(AjaxExecutorCommentCreateThread.PARAM_OBJECT_ID, aObject.getID()).add(AjaxExecutorCommentCreateThread.PARAM_AUTHOR, aLoggedInUser != null ? JSExpr.lit("") : JQuery.idRef(aEditAuthor).val()).add(AjaxExecutorCommentCreateThread.PARAM_TITLE, JQuery.idRef(aEditTitle).val()).add(AjaxExecutorCommentCreateThread.PARAM_TEXT, JQuery.idRef(aTextAreaContent).val())).success(JSJQueryHelper.jqueryAjaxSuccessHandler(aOnSuccess, null)).build();
} else {
// Reply to a previous comment
aSaveAction = new JQueryAjaxBuilder().url(CAjax.COMMENT_ADD.getInvocationURL(aRequestScope)).data(new JSAssocArray().add(AjaxExecutorCommentAdd.PARAM_OBJECT_TYPE, aObject.getObjectType().getName()).add(AjaxExecutorCommentAdd.PARAM_OBJECT_ID, aObject.getID()).add(AjaxExecutorCommentAdd.PARAM_COMMENT_THREAD_ID, aCommentThread.getID()).add(AjaxExecutorCommentAdd.PARAM_COMMENT_ID, aParentComment.getID()).add(AjaxExecutorCommentAdd.PARAM_OBJECT_ID, aObject.getID()).add(AjaxExecutorCommentAdd.PARAM_AUTHOR, aLoggedInUser != null ? JSExpr.lit("") : JQuery.idRef(aEditAuthor).val()).add(AjaxExecutorCommentAdd.PARAM_TITLE, JQuery.idRef(aEditTitle).val()).add(AjaxExecutorCommentAdd.PARAM_TEXT, JQuery.idRef(aTextAreaContent).val())).success(JSJQueryHelper.jqueryAjaxSuccessHandler(aOnSuccess, null)).build();
}
aToolbar.addButtonSave(aDisplayLocale, aSaveAction);
}
BootstrapButton aButtonCreate = null;
if (bIsCreateNewThread) {
// The create button
aButtonCreate = new BootstrapButton().addChild(ECommentText.MSG_CREATE_COMMENT.getDisplayText(aDisplayLocale));
aButtonCreate.setOnClick(new JSStatementList(JQuery.idRef(aFormContainer).show(), JQuery.jQueryThis().disable()));
}
// What to do on cancel?
{
final JSStatementList aCancelAction = new JSStatementList(JQuery.idRefMultiple(aEditTitle, aTextAreaContent).val(""), JQuery.idRef(aFormContainer).hide());
if (aButtonCreate != null)
aCancelAction.add(JQuery.idRef(aButtonCreate).enable());
if (aEditAuthor != null)
aCancelAction.add(JQuery.idRef(aEditAuthor).val(""));
aToolbar.addButtonCancel(aDisplayLocale, aCancelAction);
}
aFormContainer.addChild(aToolbar);
// Show create comment button
final HCNodeList ret = new HCNodeList();
ret.addChild(aButtonCreate);
ret.addChild(aFormContainer);
ret.addChild(aMessageBox);
return ret;
}
use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project peppol-practical by phax.
the class PagePublicToolsTestEndpoints method showInputForm.
@Override
protected void showInputForm(@Nonnull final WebPageExecutionContext aWPEC, @Nullable final TestEndpoint aSelectedObject, @Nonnull final BootstrapForm aForm, final boolean bFormSubmitted, @Nonnull final EWebPageFormAction eFormAction, @Nonnull final FormErrorList aFormErrors) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final BootstrapForm aRealForm = aForm;
aRealForm.setLeft(3);
aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Company name").setCtrl(new HCEdit(new RequestField(FIELD_COMPANY_NAME, aSelectedObject == null ? null : aSelectedObject.getCompanyName()))).setHelpText("The name of the company operating the test AccessPoint").setErrorList(aFormErrors.getListOfField(FIELD_COMPANY_NAME)));
aRealForm.addFormGroup(new BootstrapFormGroup().setLabel("Contact person").setCtrl(new HCEdit(new RequestField(FIELD_CONTACT_PERSON, aSelectedObject == null ? null : aSelectedObject.getContactPerson()))).setHelpText("The contact person being in charge of the test endpoint. This field is free text and may contain an optional email address.").setErrorList(aFormErrors.getListOfField(FIELD_CONTACT_PERSON)));
aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Identifier issuing agency").setCtrl(new ParticipantIdentifierSchemeSelect(new RequestField(FIELD_PARTICIPANT_ID_ISSUER, aSelectedObject == null ? null : aSelectedObject.getParticipantIDIssuer()), aDisplayLocale)).setErrorList(aFormErrors.getListOfField(FIELD_PARTICIPANT_ID_ISSUER)));
aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Identifier value").setCtrl(new HCEdit(new RequestField(FIELD_PARTICIPANT_ID_VALUE, aSelectedObject == null ? null : aSelectedObject.getParticipantIDValue()))).setErrorList(aFormErrors.getListOfField(FIELD_PARTICIPANT_ID_VALUE)));
aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("Transport profile").setCtrl(new SMPTransportProfileSelect(new RequestField(FIELD_TRANSPORT_PROFILE, aSelectedObject == null ? null : aSelectedObject.getTransportProfile().getID()), aDisplayLocale)).setErrorList(aFormErrors.getListOfField(FIELD_TRANSPORT_PROFILE)));
aRealForm.addFormGroup(new BootstrapFormGroup().setLabelMandatory("SML").setCtrl(new SMLConfigurationSelect(new RequestField(FIELD_SML, aSelectedObject == null ? null : aSelectedObject.getSML().getID()), false)).setErrorList(aFormErrors.getListOfField(FIELD_SML)));
}
use of com.helger.photon.bootstrap4.form.BootstrapFormGroup in project peppol-practical by phax.
the class PagePublicToolsTestEndpoints method showSelectedObject.
@Override
protected void showSelectedObject(@Nonnull final WebPageExecutionContext aWPEC, @Nonnull final TestEndpoint aSelectedObject) {
final HCNodeList aNodeList = aWPEC.getNodeList();
final BootstrapViewForm aForm = aNodeList.addAndReturnChild(new BootstrapViewForm());
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Creation").setCtrl(AppCommonUI.getDTAndUser(aWPEC, aSelectedObject.getCreationDateTime(), aSelectedObject.getCreationUserID())));
if (aSelectedObject.getLastModificationDateTime() != null) {
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Last modification").setCtrl(AppCommonUI.getDTAndUser(aWPEC, aSelectedObject.getLastModificationDateTime(), aSelectedObject.getLastModificationUserID())));
}
if (aSelectedObject.getDeletionDateTime() != null) {
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Deletion").setCtrl(AppCommonUI.getDTAndUser(aWPEC, aSelectedObject.getDeletionDateTime(), aSelectedObject.getDeletionUserID())));
}
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Company name").setCtrl(aSelectedObject.getCompanyName()));
if (StringHelper.hasText(aSelectedObject.getContactPerson())) {
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Contact person").setCtrl(aSelectedObject.getContactPerson()));
}
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Participant information").setCtrl(aSelectedObject.getParticipantIDIssuer() + ":" + aSelectedObject.getParticipantIDValue()));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("Transport profile").setCtrl(AppHelper.getSMPTransportProfileShortName(aSelectedObject.getTransportProfile()) + " (" + aSelectedObject.getTransportProfile().getID() + ")"));
aForm.addFormGroup(new BootstrapFormGroup().setLabel("SML").setCtrl(aSelectedObject.getSML().getDisplayName()));
}
Aggregations