diff --git a/src/java/fr/paris/lutece/plugins/forms/business/FormMessage.java b/src/java/fr/paris/lutece/plugins/forms/business/FormMessage.java index 588aba294..34732f57b 100644 --- a/src/java/fr/paris/lutece/plugins/forms/business/FormMessage.java +++ b/src/java/fr/paris/lutece/plugins/forms/business/FormMessage.java @@ -50,6 +50,8 @@ public class FormMessage @Size( max = 3000, message = "#i18n{forms.validation.form.EndMessage.size}" ) private String _strEndMessage; + private String _strLabelEndMessageButton; + /** * @return the _nId */ @@ -118,4 +120,21 @@ public void setEndMessage( String strEndMessage ) this._strEndMessage = strEndMessage; } + /** + * @return the _strLabelEndMessageButton + */ + public String getLabelEndMessageButton( ) + { + return _strLabelEndMessageButton; + } + + /** + * @param strLabelEndMessageButton + * the strLabelEndMessageButton to set + */ + public void setLabelEndMessageButton( String strLabelEndMessageButton ) + { + this._strLabelEndMessageButton = strLabelEndMessageButton; + } + } diff --git a/src/java/fr/paris/lutece/plugins/forms/business/FormMessageDAO.java b/src/java/fr/paris/lutece/plugins/forms/business/FormMessageDAO.java index 00e7b6c7d..77e902f0a 100644 --- a/src/java/fr/paris/lutece/plugins/forms/business/FormMessageDAO.java +++ b/src/java/fr/paris/lutece/plugins/forms/business/FormMessageDAO.java @@ -46,13 +46,13 @@ public final class FormMessageDAO implements IFormMessageDAO { // Constants - private static final String SQL_QUERY_SELECTALL = "SELECT id, id_form, end_message_display, end_message FROM forms_message"; + private static final String SQL_QUERY_SELECTALL = "SELECT id, id_form, end_message_display, end_message, label_end_message_button FROM forms_message"; private static final String SQL_QUERY_SELECT = SQL_QUERY_SELECTALL + " WHERE id = ?"; private static final String SQL_QUERY_SELECT_BY_FORM = SQL_QUERY_SELECTALL + " WHERE id_form = ?"; - private static final String SQL_QUERY_INSERT = "INSERT INTO forms_message ( id_form, end_message_display, end_message ) VALUES ( ?, ?, ? ) "; + private static final String SQL_QUERY_INSERT = "INSERT INTO forms_message ( id_form, end_message_display, end_message, label_end_message_button ) VALUES ( ?, ?, ?, ? ) "; private static final String SQL_QUERY_DELETE = "DELETE FROM forms_message WHERE id = ? "; private static final String SQL_QUERY_DELETE_BY_FORM = "DELETE FROM forms_message WHERE id_form = ? "; - private static final String SQL_QUERY_UPDATE = "UPDATE forms_message SET id_form = ?, end_message_display = ?, end_message = ? WHERE id = ?"; + private static final String SQL_QUERY_UPDATE = "UPDATE forms_message SET id_form = ?, end_message_display = ?, end_message = ?, label_end_message_button = ? WHERE id = ?"; /** * {@inheritDoc } @@ -66,6 +66,7 @@ public void insert( FormMessage formMessage, Plugin plugin ) daoUtil.setInt( nIndex++, formMessage.getIdForm( ) ); daoUtil.setBoolean( nIndex++, formMessage.getEndMessageDisplay( ) ); daoUtil.setString( nIndex++, formMessage.getEndMessage( ) ); + daoUtil.setString( nIndex++, formMessage.getLabelEndMessageButton( ) ); daoUtil.executeUpdate( ); @@ -135,6 +136,7 @@ public void store( FormMessage formMessage, Plugin plugin ) daoUtil.setInt( nIndex++, formMessage.getIdForm( ) ); daoUtil.setBoolean( nIndex++, formMessage.getEndMessageDisplay( ) ); daoUtil.setString( nIndex++, formMessage.getEndMessage( ) ); + daoUtil.setString( nIndex++, formMessage.getLabelEndMessageButton( ) ); daoUtil.setInt( nIndex++, formMessage.getId( ) ); @@ -177,6 +179,7 @@ private FormMessage dataToObject( DAOUtil daoUtil ) formMessage.setIdForm( daoUtil.getInt( "id_form" ) ); formMessage.setEndMessageDisplay( daoUtil.getBoolean( "end_message_display" ) ); formMessage.setEndMessage( daoUtil.getString( "end_message" ) ); + formMessage.setLabelEndMessageButton( daoUtil.getString( "label_end_message_button" ) ); return formMessage; } diff --git a/src/java/fr/paris/lutece/plugins/forms/business/form/panel/FormPanelFactory.java b/src/java/fr/paris/lutece/plugins/forms/business/form/panel/FormPanelFactory.java index 4703eb1ec..343637efa 100644 --- a/src/java/fr/paris/lutece/plugins/forms/business/form/panel/FormPanelFactory.java +++ b/src/java/fr/paris/lutece/plugins/forms/business/form/panel/FormPanelFactory.java @@ -33,6 +33,7 @@ */ package fr.paris.lutece.plugins.forms.business.form.panel; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; @@ -102,10 +103,10 @@ public FormPanel buildFormPanel( IFormPanelConfiguration formPanelConfiguration try { formPanelInitializerClass = Class.forName( strInitializerName ).asSubclass( IFormPanelInitializer.class ); - IFormPanelInitializer formPanelInitializer = formPanelInitializerClass.newInstance( ); + IFormPanelInitializer formPanelInitializer = formPanelInitializerClass.getDeclaredConstructor().newInstance( ); formPanel.getListFormPanelInitializer( ).add( formPanelInitializer ); } - catch( ClassNotFoundException | InstantiationException | IllegalAccessException e ) + catch( ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e ) { AppLogService.error( e ); } diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages.properties index 433d37780..9505b647b 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages.properties @@ -42,9 +42,9 @@ action.name.name=Delete the form action.viewResponses.name=View responses module.forms.documentproducer.actions.extractpdf.name=PDF configuration -action.modify.name=Modify form parameters +action.params.name=Modify form parameters action.delete.name=Delete the form -action.params.name=Edit form steps +action.modify.name=Edit form steps action.publish.name=Edit form publication module.forms.documentproducer.actions.extractpdf.description=Manage PDF configuration for form responses @@ -203,6 +203,7 @@ create_form.labelDisplaySummary.help=Enables a summary page before final saving create_form.labelEndMessageDisplay=End message display create_form.labelEndMessageDisplay.help=The end message will be displayed to the user if this box is checked create_form.labelEndMessage=End message +create_form.labelLabelEndMessageButton=Label of the end message button create_form.labelEndMessage.help=This message will be displayed to the user when submitting the form create_form.labelReturnUrl=Return URL create_form.labelReturnUrl.help=URL called after form submission. If empty and authentication is required, redirect to response detail, otherwise, return to the first step @@ -275,6 +276,7 @@ modify_form.labelDisplaySummary.help=Enables a summary page before final saving modify_form.labelEndMessageDisplay=End message display modify_form.labelEndMessageDisplay.help=The end message will be displayed to the user if this box is checked modify_form.labelEndMessage=End message +modify_form.labelLabelEndMessageButton=Label of the end message button modify_form.labelEndMessage.help=This message will be displayed to the user when submitting the form modify_form.labelReturnUrl=Return URL modify_form.labelReturnUrl.help=URL called after form submission. If empty and authentication is required, redirect to response detail, otherwise, return to the first step diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_ar.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_ar.properties index 93c1b6062..4e8f92111 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_ar.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_ar.properties @@ -42,9 +42,9 @@ action.name.name=\u062d\u0630\u0641 \u0627\u0644\u0646\u0645\u0648\u0630\u062c action.viewResponses.name=\u0639\u0631\u0636 \u0627\u0644\u0631\u062f\u0648\u062f module.forms.documentproducer.actions.extractpdf.name=\u062a\u0643\u0648\u064a\u0646 PDF -action.modify.name=\u062a\u0639\u062f\u064a\u0644 \u0645\u0639\u0644\u0645\u0627\u062a \u0627\u0644\u0646\u0645\u0648\u0630\u062c +action.params.name=\u062a\u0639\u062f\u064a\u0644 \u0645\u0639\u0644\u0645\u0627\u062a \u0627\u0644\u0646\u0645\u0648\u0630\u062c action.delete.name=\u062d\u0630\u0641 \u0627\u0644\u0646\u0645\u0648\u0630\u062c -action.params.name=\u062a\u062d\u0631\u064a\u0631 \u062e\u0637\u0648\u0627\u062a \u0627\u0644\u0646\u0645\u0648\u0630\u062c +action.modify.name=\u062a\u062d\u0631\u064a\u0631 \u062e\u0637\u0648\u0627\u062a \u0627\u0644\u0646\u0645\u0648\u0630\u062c action.publish.name=\u062a\u062d\u0631\u064a\u0631 \u0646\u0634\u0631 \u0627\u0644\u0646\u0645\u0648\u0630\u062c module.forms.documentproducer.actions.extractpdf.description=\u0625\u062f\u0627\u0631\u0629 \u062a\u0643\u0648\u064a\u0646 PDF \u0644\u0631\u062f\u0648\u062f \u0627\u0644\u0646\u0645\u0648\u0630\u062c diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_cz.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_cz.properties index c3f179753..8eadb63ba 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_cz.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_cz.properties @@ -42,9 +42,9 @@ action.name.name=Smazat formul\u00e1\u0159 action.viewResponses.name=Zobrazit odpov\u011bdi module.forms.documentproducer.actions.extractpdf.name=Konfigurace PDF -action.modify.name=Upravit parametry formul\u00e1\u0159e +action.params.name=Upravit parametry formul\u00e1\u0159e action.delete.name=Smazat formul\u00e1\u0159 -action.params.name=Upravit kroky formul\u00e1\u0159e +action.modify.name=Upravit kroky formul\u00e1\u0159e action.publish.name=Upravit publikaci formul\u00e1\u0159e module.forms.documentproducer.actions.extractpdf.description=Spravovat konfiguraci PDF odpov\u011bd\u00ed na formul\u00e1\u0159 diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_de.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_de.properties index e8d2277b2..7bfbd61fe 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_de.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_de.properties @@ -42,9 +42,9 @@ action.name.name=Formular l\u00f6schen action.viewResponses.name=Antworten anzeigen module.forms.documentproducer.actions.extractpdf.name=PDF-Konfiguration -action.modify.name=Formularparameter bearbeiten +action.params.name=Formularparameter bearbeiten action.delete.name=Formular l\u00f6schen -action.params.name=Formularschritte bearbeiten +action.modify.name=Formularschritte bearbeiten action.publish.name=Formularver\u00f6ffentlichung bearbeiten module.forms.documentproducer.actions.extractpdf.description=Konfiguration des PDF der Antworten auf das Formular verwalten diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_dk.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_dk.properties index a64b5f4a0..cf67c4441 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_dk.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_dk.properties @@ -42,9 +42,9 @@ action.name.name=Slet formular action.viewResponses.name=Se svar module.forms.documentproducer.actions.extractpdf.name=Konfiguration af PDF -action.modify.name=Rediger formularparametre +action.params.name=Rediger formularparametre action.delete.name=Slet formular -action.params.name=Rediger formulartrin +action.modify.name=Rediger formulartrin action.publish.name=Rediger formularoffentligg\u00f8relse module.forms.documentproducer.actions.extractpdf.description=H\u00e5ndter konfiguration af PDF for formularsvar diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_es.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_es.properties index ba9fed9cc..b63bd2465 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_es.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_es.properties @@ -42,9 +42,9 @@ action.name.name=Eliminar el formulario action.viewResponses.name=Ver respuestas module.forms.documentproducer.actions.extractpdf.name=Configuraci\u00f3n del PDF -action.modify.name=Modificar par\u00e1metros del formulario +action.params.name=Modificar par\u00e1metros del formulario action.delete.name=Eliminar el formulario -action.params.name=Editar pasos del formulario +action.modify.name=Editar pasos del formulario action.publish.name=Editar la publicaci\u00f3n del formulario module.forms.documentproducer.actions.extractpdf.description=Gestionar la configuraci\u00f3n del PDF de las respuestas al formulario diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fi.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fi.properties index 7f01d6dc4..4a09891b6 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fi.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fi.properties @@ -42,9 +42,9 @@ action.name.name=Poista lomake action.viewResponses.name=N\u00e4yt\u00e4 vastaukset module.forms.documentproducer.actions.extractpdf.name=PDF:n asetukset -action.modify.name=Muokkaa lomakkeen asetuksia +action.params.name=Muokkaa lomakkeen asetuksia action.delete.name=Poista lomake -action.params.name=Muokkaa lomakkeen vaiheita +action.modify.name=Muokkaa lomakkeen vaiheita action.publish.name=Muokkaa lomakkeen julkaisua module.forms.documentproducer.actions.extractpdf.description=Hallitse lomakkeen vastausten PDF-asetuksia diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fr.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fr.properties index fe3ee1467..4ae5a64ac 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fr.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_fr.properties @@ -42,9 +42,9 @@ action.name.name=Supprimer le formulaire action.viewResponses.name=Voir les r\u00e9ponses module.forms.documentproducer.actions.extractpdf.name=Configuration du PDF -action.modify.name=Modifier les param\u00e8tres du formulaire +action.params.name=Modifier les param\u00e8tres du formulaire action.delete.name=Supprimer le formulaire -action.params.name=Editer les \u00e9tapes du formulaire +action.modify.name=Editer les \u00e9tapes du formulaire action.publish.name=Editer la publication du formulaire module.forms.documentproducer.actions.extractpdf.description=G\u00e9rer la configuration du PDF des r\u00e9ponses au formualaire @@ -203,6 +203,7 @@ create_form.labelDisplaySummary.help=Active une page de r\u00e9capitulatif avant create_form.labelEndMessageDisplay=Affichage du message de fin create_form.labelEndMessageDisplay.help=Le message de fin sera affich\u00e9 \u00e0 l'usager si cette case est coch\u00e9e create_form.labelEndMessage=Message de fin +create_form.labelLabelEndMessageButton=Libell\u00e9 du bouton du message de fin create_form.labelEndMessage.help=Ce message sera affich\u00e9 \u00e0 l'usager lors de la soumission du formulaire create_form.labelReturnUrl=URL de retour create_form.labelReturnUrl.help=URL appel\u00e9e apr\u00e8s la soumission d'un formulaire. Si vide et l'authentification est requise, redirection vers le d\u00e9tail de la r\u00e9ponse sinon, retour \u00e0 la premi\u00e8re \u00e9tape @@ -275,6 +276,7 @@ modify_form.labelDisplaySummary.help=Active une page de r\u00e9capitulatif avant modify_form.labelEndMessageDisplay=Affichage du message de fin modify_form.labelEndMessageDisplay.help=Le message de fin sera affich\u00e9 \u00e0 l'usager si cette case est coch\u00e9e modify_form.labelEndMessage=Message de fin +modify_form.labelLabelEndMessageButton=Libell\u00e9 du bouton du message de fin modify_form.labelEndMessage.help=Ce message sera affich\u00e9 \u00e0 l'usager lors de la soumission du formulaire modify_form.labelReturnUrl=URL de retour modify_form.labelReturnUrl.help=URL appel\u00e9e apr\u00e8s la soumission d'un formulaire. Si vide et l'authentification est requise, redirection vers le d\u00e9tail de la r\u00e9ponse sinon, retour \u00e0 la premi\u00e8re \u00e9tape diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_hu.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_hu.properties index 27bb05e90..3337c0c56 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_hu.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_hu.properties @@ -42,9 +42,9 @@ action.name.name=Supprimer le formulaire action.viewResponses.name=Voir les r\u00e9ponses module.forms.documentproducer.actions.extractpdf.name=Configuration du PDF -action.modify.name=Modifier les param\u00e8tres du formulaire +action.params.name=Modifier les param\u00e8tres du formulaire action.delete.name=Supprimer le formulaire -action.params.name=Editer les \u00e9tapes du formulaire +action.modify.name=Editer les \u00e9tapes du formulaire action.publish.name=Editer la publication du formulaire module.forms.documentproducer.actions.extractpdf.description=G\u00e9rer la configuration du PDF des r\u00e9ponses au formualaire diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_it.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_it.properties index 11d18e0ba..53f1630e4 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_it.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_it.properties @@ -42,9 +42,9 @@ action.name.name=Elimina il formulario action.viewResponses.name=Visualizza le risposte module.forms.documentproducer.actions.extractpdf.name=Configurazione del PDF -action.modify.name=Modifica i parametri del formulario +action.params.name=Modifica i parametri del formulario action.delete.name=Elimina il formulario -action.params.name=Modifica i passaggi del formulario +action.modify.name=Modifica i passaggi del formulario action.publish.name=Modifica la pubblicazione del formulario module.forms.documentproducer.actions.extractpdf.description=Gestisci la configurazione del PDF delle risposte al formulario diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_nl.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_nl.properties index 0ef073a1d..ac997cacb 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_nl.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_nl.properties @@ -42,9 +42,9 @@ action.name.name=Formulier verwijderen action.viewResponses.name=Antwoorden bekijken module.forms.documentproducer.actions.extractpdf.name=PDF-configuratie -action.modify.name=Formulierparameters wijzigen +action.params.name=Formulierparameters wijzigen action.delete.name=Formulier verwijderen -action.params.name=Stappen van het formulier bewerken +action.modify.name=Stappen van het formulier bewerken action.publish.name=Publicatie van het formulier bewerken module.forms.documentproducer.actions.extractpdf.description=Beheer de PDF-configuratie van de formulierreacties diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_pt.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_pt.properties index 5716fe558..4470d63ae 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_pt.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_pt.properties @@ -42,9 +42,9 @@ action.name.name=Excluir o formul\u00e1rio action.viewResponses.name=Ver as respostas module.forms.documentproducer.actions.extractpdf.name=Configura\u00e7\u00e3o do PDF -action.modify.name=Modificar os par\u00e2metros do formul\u00e1rio +action.params.name=Modificar os par\u00e2metros do formul\u00e1rio action.delete.name=Excluir o formul\u00e1rio -action.params.name=Editar as etapas do formul\u00e1rio +action.modify.name=Editar as etapas do formul\u00e1rio action.publish.name=Editar a publica\u00e7\u00e3o do formul\u00e1rio module.forms.documentproducer.actions.extractpdf.description=Gerenciar a configura\u00e7\u00e3o do PDF das respostas ao formul\u00e1rio diff --git a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_se.properties b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_se.properties index 010a84eda..325ff66da 100644 --- a/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_se.properties +++ b/src/java/fr/paris/lutece/plugins/forms/resources/forms_messages_se.properties @@ -42,9 +42,9 @@ action.name.name=Radera formul\u00e4ret action.viewResponses.name=Visa svar module.forms.documentproducer.actions.extractpdf.name=Konfiguration av PDF -action.modify.name=\u00c4ndra formul\u00e4rparametrar +action.params.name=\u00c4ndra formul\u00e4rparametrar action.delete.name=Radera formul\u00e4ret -action.params.name=Redigera formul\u00e4rsteg +action.modify.name=Redigera formul\u00e4rsteg action.publish.name=Redigera formul\u00e4rets publicering module.forms.documentproducer.actions.extractpdf.description=Hantera konfigurationen av PDF f\u00f6r svar p\u00e5 formul\u00e4ret diff --git a/src/java/fr/paris/lutece/plugins/forms/service/provider/GenericFormsProvider.java b/src/java/fr/paris/lutece/plugins/forms/service/provider/GenericFormsProvider.java index 1f601a530..e9087395b 100644 --- a/src/java/fr/paris/lutece/plugins/forms/service/provider/GenericFormsProvider.java +++ b/src/java/fr/paris/lutece/plugins/forms/service/provider/GenericFormsProvider.java @@ -35,20 +35,30 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Comparator; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; +import jakarta.enterprise.inject.spi.CDI; import jakarta.servlet.http.HttpServletRequest; import fr.paris.lutece.plugins.forms.business.Form; +import fr.paris.lutece.plugins.forms.business.FormDisplay; +import fr.paris.lutece.plugins.forms.business.FormDisplayHome; import fr.paris.lutece.plugins.forms.business.FormHome; import fr.paris.lutece.plugins.forms.business.FormQuestionResponse; import fr.paris.lutece.plugins.forms.business.FormQuestionResponseHome; import fr.paris.lutece.plugins.forms.business.FormResponse; +import fr.paris.lutece.plugins.forms.business.Group; +import fr.paris.lutece.plugins.forms.business.GroupHome; import fr.paris.lutece.plugins.forms.business.Question; import fr.paris.lutece.plugins.forms.business.QuestionHome; +import fr.paris.lutece.plugins.forms.business.Step; +import fr.paris.lutece.plugins.forms.business.StepHome; +import fr.paris.lutece.plugins.forms.business.Transition; +import fr.paris.lutece.plugins.forms.business.TransitionHome; +import fr.paris.lutece.plugins.forms.service.StepService; import fr.paris.lutece.plugins.forms.service.entrytype.EntryTypeAutomaticFileReading; import fr.paris.lutece.plugins.forms.service.entrytype.EntryTypeCamera; import fr.paris.lutece.plugins.forms.service.entrytype.EntryTypeComment; @@ -56,6 +66,7 @@ import fr.paris.lutece.plugins.forms.service.entrytype.EntryTypeGalleryImage; import fr.paris.lutece.plugins.forms.service.entrytype.EntryTypeImage; import fr.paris.lutece.plugins.forms.util.FormsConstants; +import fr.paris.lutece.plugins.forms.util.FormsUtils; import fr.paris.lutece.plugins.genericattributes.business.Response; import fr.paris.lutece.plugins.genericattributes.service.entrytype.EntryTypeServiceManager; import fr.paris.lutece.plugins.genericattributes.service.entrytype.IEntryTypeService; @@ -67,7 +78,6 @@ import fr.paris.lutece.portal.service.file.FileService; import fr.paris.lutece.portal.service.file.FileServiceException; import fr.paris.lutece.portal.service.file.IFileStoreServiceProvider; -import fr.paris.lutece.portal.service.i18n.I18nService; import fr.paris.lutece.portal.service.util.AppLogService; import fr.paris.lutece.portal.service.util.AppPathService; import fr.paris.lutece.portal.service.util.AppPropertiesService; @@ -80,6 +90,7 @@ public abstract class GenericFormsProvider { // MARKS private static final String MARK_POSITION = "position_"; + private static final String MARK_POSITION_ITERATION = "_"; private static final String MARK_URL_ADMIN_RESPONSE = "url_admin_forms_response_detail"; private static final String MARK_URL_FO_RESPONSE = "url_fo_forms_response_detail"; private static final String MARK_CREATION_DATE = "creation_date"; @@ -150,7 +161,7 @@ public static Map getValuesModel( FormResponse formResponse, Htt if ( file != null && file.getPhysicalFile( ) == null ) { try { - IFileStoreServiceProvider fss = FileService.getInstance( ).getFileStoreServiceProvider( file.getOrigin() ); + IFileStoreServiceProvider fss = CDI.current( ).select( FileService.class ).get( ).getFileStoreServiceProvider( file.getOrigin( ) ); file = fss.getFile(file.getFileKey() ); file.setUrl(fss.getFileDownloadUrlFO( file.getFileKey())); @@ -261,13 +272,37 @@ public static Collection getProviderMarkerDescriptions( Form form ) if ( form != null ) { - List listFormQuestions = QuestionHome.getListQuestionByIdForm( form.getId( ) ); - for ( Question formQuestion : listFormQuestions ) - { - InfoMarker marker = new InfoMarker( MARK_POSITION + formQuestion.getId( ) ); - marker.setDescription( formQuestion.getTitle( ) ); - descriptionMarkersList.add( marker ); + List listSteps = StepHome.getStepsListByForm( form.getId() ); + List listTransitions = TransitionHome.getTransitionsListFromForm( form.getId() ); + listSteps = FormsUtils.sortStepsWithTransitions( listSteps, listTransitions ); + + for ( Step step : listSteps ){ + List listFormDisplay = FormDisplayHome.getFormDisplayListByParent( step.getId(), 0 ); + listFormDisplay.sort( Comparator.comparingInt( FormDisplay::getDisplayOrder ) ); + + for ( FormDisplay composite : listFormDisplay ) + { + if( FormsConstants.MARK_QUESTION.equals( composite.getCompositeType() ) ) + { + descriptionMarkersList.addAll( buildMarkerForQuestion( QuestionHome.findByPrimaryKey( composite.getCompositeId() ) , null )); + } + else if( FormsConstants.MARK_GROUP.equals(composite.getCompositeType()) ) + { + List listFormDisplayGroup = FormDisplayHome.getFormDisplayListByParent( composite.getStepId(), composite.getId() ); + listFormDisplayGroup.sort( Comparator.comparingInt( FormDisplay::getDisplayOrder ) ); + + Group group = GroupHome.findByPrimaryKey( composite.getCompositeId() ); + + for ( FormDisplay compositeGroup : listFormDisplayGroup) + { + if( FormsConstants.MARK_QUESTION.equals(compositeGroup.getCompositeType()) ) + { + descriptionMarkersList.addAll( buildMarkerForQuestion( QuestionHome.findByPrimaryKey( compositeGroup.getCompositeId() ) , group )); + } + } + } + } } } @@ -299,4 +334,27 @@ public static Collection getProviderMarkerDescriptions( Form form ) return descriptionMarkersList; } + + private static Collection buildMarkerForQuestion(Question question, Group group) + { + Collection descriptionMarkersList = new ArrayList<>( ); + + if( group == null || group.getIterationMax() == 1 ) + { + InfoMarker marker = new InfoMarker( MARK_POSITION + question.getId( ) ); + marker.setDescription( question.getTitle( ) ); + descriptionMarkersList.add(marker); + } + else + { + for (int i = 0 ; i < group.getIterationMax(); i++ ) + { + InfoMarker marker = new InfoMarker( MARK_POSITION + question.getId( ) + MARK_POSITION_ITERATION + i ); + marker.setDescription( question.getTitle( ) + " " + ( i + 1 ) ); + descriptionMarkersList.add(marker); + } + } + return descriptionMarkersList; + } + } diff --git a/src/java/fr/paris/lutece/plugins/forms/util/FormsConstants.java b/src/java/fr/paris/lutece/plugins/forms/util/FormsConstants.java index c9877b05a..70efbb3cf 100644 --- a/src/java/fr/paris/lutece/plugins/forms/util/FormsConstants.java +++ b/src/java/fr/paris/lutece/plugins/forms/util/FormsConstants.java @@ -75,6 +75,7 @@ public final class FormsConstants public static final String MARK_FORM_BOTTOM_BREADCRUMB = "formBottomBreadcrumb"; public static final String MARK_QUESTION_CONTENT = "questionContent"; public static final String MARK_INFO = "messageInfo"; + public static final String MARK_LABEL_BUTTON = "labelButton"; public static final String MARK_CONTROL_TEMPLATE = "control_template"; public static final String MARK_CONDITION_TITLE = "modify_condition_title"; public static final String MARK_QUESTION_LIST_RESPONSES = "list_responses"; diff --git a/src/java/fr/paris/lutece/plugins/forms/web/FormXPage.java b/src/java/fr/paris/lutece/plugins/forms/web/FormXPage.java index 9e6491e8f..d8b78b790 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/FormXPage.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/FormXPage.java @@ -489,7 +489,7 @@ private void getFormStepModel( Form form, HttpServletRequest request, Map buildModelForSummary( Form form, HttpServletRequest * Exception * @throws UserNotSignedException * Exception - * @throws AccessDeniedException */ @Action( value = ACTION_SAVE_FORM_RESPONSE ) - public synchronized XPage doSaveFormResponse( HttpServletRequest request ) throws SiteMessageException, UserNotSignedException, AccessDeniedException + public synchronized XPage doSaveFormResponse( HttpServletRequest request ) throws SiteMessageException, UserNotSignedException { IsRequestComingFromAction = true; Form form = null; @@ -820,6 +819,11 @@ private XPage doSaveResponse( HttpServletRequest request, Form form ) throws Sit if ( formMessage.getEndMessageDisplay( ) ) { model.put( FormsConstants.MARK_INFO, formMessage.getEndMessage( ) ); + if( StringUtils.isNotBlank(formMessage.getLabelEndMessageButton( ) ) ) + { + model.put( FormsConstants.MARK_LABEL_BUTTON, formMessage.getLabelEndMessageButton( ) ); + } + } else { @@ -1021,10 +1025,9 @@ private boolean isCaptchaKO( HttpServletRequest request, boolean needValidation * Exception * @throws UserNotSignedException * Exception - * @throws AccessDeniedException */ @Action( value = ACTION_SAVE_FOR_BACKUP ) - public synchronized XPage doSaveForBackup( HttpServletRequest request ) throws SiteMessageException, UserNotSignedException, AccessDeniedException + public synchronized XPage doSaveForBackup( HttpServletRequest request ) throws SiteMessageException, UserNotSignedException { IsRequestComingFromAction = true; diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/AbstractFormQuestionJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/AbstractFormQuestionJspBean.java index 9e4bd6d12..6bc28ddeb 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/AbstractFormQuestionJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/AbstractFormQuestionJspBean.java @@ -34,7 +34,6 @@ package fr.paris.lutece.plugins.forms.web.admin; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -84,9 +83,9 @@ public abstract class AbstractFormQuestionJspBean extends AbstractJspBean { private static final long serialVersionUID = -8828358457153413756L; - private static final Class [ ] ENTRY_TYPE_USER_REF_LIT = { + private static final Set> ENTRY_TYPE_USER_REF_LIST = Set.of( EntryTypeCheckBox.class, EntryTypeRadioButton.class, EntryTypeSelect.class, EntryTypeSelectOrder.class - }; + ); // Actions protected static final String ACTION_CREATE_QUESTION = "createQuestion"; @@ -510,7 +509,7 @@ protected Map initCreateQuestionModel( HttpServletRequest reques model.put( FormsConstants.MARK_ANONYMIZATION_HELP, entryTypeService.getAnonymizationHelpMessage( request.getLocale( ) ) ); - if ( Arrays.asList( ENTRY_TYPE_USER_REF_LIT ).contains( entryTypeService.getClass( ) ) ) + if ( canUseReferenceList( entryTypeService ) ) { model.put( FormsConstants.MARK_REFERENCE_LIST_SELECT, ReferenceListService.getInstance( ).getReferencesList( ) ); } @@ -591,7 +590,8 @@ protected Map initModifyQuestionModel( HttpServletRequest reques _fileStoreProvider.getFileDownloadUrlBO( fieldFile.getValue( ), additionnalData ) ); } } - if ( Arrays.asList( ENTRY_TYPE_USER_REF_LIT ).contains( entryTypeService.getClass( ) ) ) + + if ( canUseReferenceList( entryTypeService ) ) { model.put( FormsConstants.MARK_REFERENCE_LIST_SELECT, ReferenceListService.getInstance( ).getReferencesList( ) ); } @@ -920,4 +920,19 @@ protected IFormDatabaseService getFormDatabaseService( ) } protected abstract IFormDatabaseService initFormDatabaseService( ); + + /** + * Checks if the given entry type service can use reference lists. + * Reference lists are supported by entry types that allow users to select + * from predefined options. + * + * @param entryTypeService + * the entry type service to check + * @return true if the entry type can use reference lists, false otherwise + */ + private boolean canUseReferenceList( IEntryTypeService entryTypeService ) + { + return ENTRY_TYPE_USER_REF_LIST.stream( ) + .anyMatch( clazz -> clazz.isInstance( entryTypeService ) ); + } } diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormControlJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormControlJspBean.java index 337f3744b..dc6071964 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormControlJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormControlJspBean.java @@ -70,7 +70,6 @@ import fr.paris.lutece.plugins.forms.util.FormsConstants; import fr.paris.lutece.plugins.forms.validation.IValidator; import fr.paris.lutece.plugins.genericattributes.business.EntryType; -import fr.paris.lutece.portal.service.admin.AccessDeniedException; import fr.paris.lutece.portal.service.event.EventAction; import fr.paris.lutece.portal.service.event.Type.TypeQualifier; import fr.paris.lutece.portal.service.i18n.I18nService; diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormExportJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormExportJspBean.java index 9eb184709..a18d4fe8a 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormExportJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormExportJspBean.java @@ -233,7 +233,7 @@ public String doModifyExportableQuestion (HttpServletRequest request) throws Ac mapParameters.put(PARAMETER_ACTIVE_TAB_PANNEL_2, "true"); return redirect(request, VIEW_MANAGE_EXPORT, mapParameters); - }; + } @Action( value = ACTION_CREATE_EXPORT_CONFIG, securityTokenDisabled = true ) public String doCreateExportConfig( HttpServletRequest request ) throws AccessDeniedException diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormJspBean.java index aebcbd507..6ebb2a3ac 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormJspBean.java @@ -241,6 +241,7 @@ public String getManageForms( HttpServletRequest request ) List listFormActions; List listAuthorizedFormActions; _form = new Form( ); + _formMessage = new FormMessage( ); _strCurrentPageIndex = AbstractPaginator.getPageIndex( request, AbstractPaginator.PARAMETER_PAGE_INDEX, _strCurrentPageIndex ); _nItemsPerPage = AbstractPaginator.getItemsPerPage( request, AbstractPaginator.PARAMETER_ITEMS_PER_PAGE, _nItemsPerPage, _nDefaultItemsPerPage ); diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormMultiviewConfigJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormMultiviewConfigJspBean.java index 4531259b5..9d3a50931 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormMultiviewConfigJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormMultiviewConfigJspBean.java @@ -34,10 +34,10 @@ package fr.paris.lutece.plugins.forms.web.admin; import java.util.ArrayList; -import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Set; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; @@ -75,18 +75,14 @@ public class FormMultiviewConfigJspBean extends AbstractJspBean { private static final long serialVersionUID = -2505310758526626253L; - private static final Class [ ] FILTERABLE = { + private static final Set> FILTERABLE = Set.of( EntryTypeCheckBox.class, EntryTypeRadioButton.class, EntryTypeSelect.class, EntryTypeDate.class - }; - - private static final List> FILTERABLE_LIST = Arrays.asList( FILTERABLE ); - - private static final Class [ ] NON_DISPLAYABLE = { + ); + + private static final Set> NON_DISPLAYABLE = Set.of( EntryTypeAutomaticFileReading.class, EntryTypeFile.class, EntryTypeGalleryImage.class, EntryTypeImage.class - }; - - private static final List> NON_DISPLAYABLE_LIST = Arrays.asList( NON_DISPLAYABLE ); - + ); + // Templates private static final String TEMPLATE_MANAGE_MULTIVIEW_CONFIG = "/admin/plugins/forms/manage_multiview_config.html"; @@ -138,11 +134,11 @@ public String getManageMultiview( HttpServletRequest request ) throws AccessDeni for ( Question question : questionList ) { IEntryTypeService entryTypeService = EntryTypeServiceManager.getEntryTypeService( question.getEntry( ) ); - if ( FILTERABLE_LIST.contains( entryTypeService.getClass( ) ) ) + if ( isQuestionFilterable( entryTypeService) ) { filterableQuestionList.add( question ); } - if ( NON_DISPLAYABLE_LIST.contains( entryTypeService.getClass() )) + if ( isQuestionNonDisplayable( entryTypeService ) ) { nonDisplayableQuestionList.add(question); } @@ -181,7 +177,7 @@ public String modifyFilterableQuestions( HttpServletRequest request ) throws Acc for ( Question question : questionList ) { IEntryTypeService entryTypeService = EntryTypeServiceManager.getEntryTypeService( question.getEntry( ) ); - if ( FILTERABLE_LIST.contains( entryTypeService.getClass( ) ) ) + if ( isQuestionFilterable( entryTypeService ) ) { question.setFiltrableMultiviewGlobal( request.getParameter( FormsConstants.PARAMETER_FILTERABLE_MULTIVIEW_GLOBAL + "_" + question.getId( ) ) != null ); question.setFiltrableMultiviewFormSelected( request.getParameter( FormsConstants.PARAMETER_FILTERABLE_MULTIVIEW_FORM_SELECTED + "_" + question.getId( ) ) != null ); @@ -230,5 +226,30 @@ public String modifyVisibleQuestions( HttpServletRequest request ) throws Access return redirect( request, VIEW_MANAGE_MULTIVIEW, mapParameters ); } + /** + * Checks whether a question is considered filterable based on its entry type service + * + * @param entryTypeService + * The entry type service to check + * @return {@code true} if question is filterable, {@code false} otherwise + */ + private boolean isQuestionFilterable( IEntryTypeService entryTypeService ) + { + return FILTERABLE.stream( ) + .anyMatch( clazz -> clazz.isInstance( entryTypeService ) ); + } + + /** + * Checks whether a question is considered non-displayable based on its entry type service + * + * @param entryTypeService + * The entry type service to check + * @return {@code true} if the question is non-displayable, {@code false} otherwise + */ + private boolean isQuestionNonDisplayable( IEntryTypeService entryTypeService ) + { + return NON_DISPLAYABLE.stream( ) + .anyMatch( clazz -> clazz.isInstance( entryTypeService ) ); + } } diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormQuestionJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormQuestionJspBean.java index 43d60893e..de569c74c 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormQuestionJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormQuestionJspBean.java @@ -240,10 +240,9 @@ public String getCreateGroup( HttpServletRequest request ) * @param request * The HTTP request * @return The URL to go after performing the action - * @throws AccessDeniedException */ @Action( ACTION_CREATE_GROUP ) - public String doCreateGroup( HttpServletRequest request ) throws AccessDeniedException + public String doCreateGroup( HttpServletRequest request ) { return createGroup( request, VIEW_MANAGE_QUESTIONS ); } @@ -278,10 +277,9 @@ public String getModifyGroup( HttpServletRequest request ) * @param request * The HTTP request * @return The URL to go after performing the action - * @throws AccessDeniedException */ @Action( ACTION_MODIFY_GROUP ) - public String doModifyGroup( HttpServletRequest request ) throws AccessDeniedException + public String doModifyGroup( HttpServletRequest request ) { return modifyGroup( request, VIEW_MANAGE_QUESTIONS ); } @@ -292,10 +290,9 @@ public String doModifyGroup( HttpServletRequest request ) throws AccessDeniedExc * @param request * The HTTP request * @return The URL to go after performing the action - * @throws AccessDeniedException */ @Action( ACTION_CREATE_QUESTION ) - public String doCreateQuestion( HttpServletRequest request ) throws AccessDeniedException + public String doCreateQuestion( HttpServletRequest request ) { try { @@ -393,10 +390,9 @@ public String getModifyQuestion( HttpServletRequest request ) * @param request * The HTTP request * @return The URL to go after performing the action - * @throws AccessDeniedException */ @Action( ACTION_MODIFY_QUESTION ) - public String doModifyQuestion( HttpServletRequest request ) throws AccessDeniedException + public String doModifyQuestion( HttpServletRequest request ) { try { @@ -428,9 +424,14 @@ public String doModifyQuestion( HttpServletRequest request ) throws AccessDenied * @return The URL to go after performing the action * @throws AccessDeniedException */ - @Action( ACTION_SAVE_QUESTION ) + @Action( value = ACTION_SAVE_QUESTION, securityTokenDisabled = true ) public String doSaveQuestion( HttpServletRequest request ) throws AccessDeniedException { + if ( !_securityTokenHandler.validate( request, ACTION_MODIFY_QUESTION ) ) + { + throw new AccessDeniedException( MESSAGE_ERROR_TOKEN ); + } + try { String strReturnUrl = processQuestionUpdate( request ); @@ -455,10 +456,9 @@ public String doSaveQuestion( HttpServletRequest request ) throws AccessDeniedEx * @param request * The HttpServletRequest the request * @return the manage questions page - * @throws AccessDeniedException */ @Action( value = ACTION_DUPLICATE_QUESTION ) - public String doDuplicateQuestion( HttpServletRequest request ) throws AccessDeniedException + public String doDuplicateQuestion( HttpServletRequest request ) { String strReturnUrl = processQuestionDuplication( request ); @@ -621,10 +621,9 @@ private boolean existsCondtionalControlUsingQuestion( FormDisplay formDisplay ) * @param request * The HTTP request * @return The URL to go after performing the action - * @throws AccessDeniedException */ @Action( ACTION_REMOVE_COMPOSITE ) - public String doRemoveComposite( HttpServletRequest request ) throws AccessDeniedException + public String doRemoveComposite( HttpServletRequest request ) { int nIdDisplay = NumberUtils.toInt( request.getParameter( FormsConstants.PARAMETER_ID_DISPLAY ), -1 ); if ( _formDisplay == null || _formDisplay.getId( ) != nIdDisplay ) diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormResponseJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormResponseJspBean.java index fef842955..227f0efb2 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormResponseJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormResponseJspBean.java @@ -303,7 +303,7 @@ public String doSaveFormResponse( HttpServletRequest request ) * The Http request * @return the View */ - @Action( value = ACTION_PREVIOUS_STEP ) + @Action( value = ACTION_PREVIOUS_STEP, securityTokenDisabled = true ) public String doReturnStep( HttpServletRequest request ) { try @@ -330,7 +330,7 @@ public String doReturnStep( HttpServletRequest request ) * The Http request * @return the View */ - @Action( value = ACTION_GO_TO_STEP ) + @Action( value = ACTION_GO_TO_STEP, securityTokenDisabled = true ) public String doGoToStep( HttpServletRequest request ) { try @@ -630,6 +630,11 @@ private String doSaveResponse( HttpServletRequest request, Form form ) if ( formMessage.getEndMessageDisplay( ) ) { model.put( FormsConstants.MARK_INFO, formMessage.getEndMessage( ) ); + if( StringUtils.isNotBlank(formMessage.getLabelEndMessageButton( ) ) ) + { + model.put( FormsConstants.MARK_LABEL_BUTTON, formMessage.getLabelEndMessageButton( ) ); + } + } else { diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormStepJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormStepJspBean.java index 99f548010..c6f11d227 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormStepJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormStepJspBean.java @@ -529,6 +529,13 @@ public String doModifyStep( HttpServletRequest request ) throws AccessDeniedExce addError( ERROR_STEP_NOT_UPDATED, getLocale( ) ); return redirect( request, VIEW_MANAGE_STEPS, FormsConstants.PARAMETER_ID_FORM, nIdForm ); } + + if ( _step.getIdForm() != nIdForm ) + { + addError( ERROR_STEP_NOT_UPDATED, getLocale( ) ); + return redirect( request, VIEW_MANAGE_STEPS, FormsConstants.PARAMETER_ID_FORM, nIdForm ); + } + populate( _step, request, request.getLocale( ) ); if ( !validateStep( _step ) ) diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormTransitionJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormTransitionJspBean.java index 926ef59cb..823bc6733 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormTransitionJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormTransitionJspBean.java @@ -281,10 +281,9 @@ private void buildTransitionModel( Map model ) * @param request * The Http Request * @return The Jsp URL of the process result - * @throws AccessDeniedException */ @Action( ACTION_CREATE_TRANSITION ) - public String doCreateTransition( HttpServletRequest request ) throws AccessDeniedException + public String doCreateTransition( HttpServletRequest request ) { if ( !createTransition( request ) ) { @@ -355,10 +354,9 @@ private boolean createTransition( HttpServletRequest request ) * @param request * The Http Request * @return The Jsp URL of the process result - * @throws AccessDeniedException */ @Action( ACTION_MODIFY_TRANSITION ) - public String doModifyTransition( HttpServletRequest request ) throws AccessDeniedException + public String doModifyTransition( HttpServletRequest request ) { if ( !retrieveTransitionFromRequest( request ) ) { @@ -425,10 +423,9 @@ public String getConfirmRemoveTransition( HttpServletRequest request ) * @param request * The Http request * @return the jsp URL to display the form to manage Transition - * @throws AccessDeniedException */ @Action( ACTION_REMOVE_TRANSITION ) - public String doRemoveTransition( HttpServletRequest request ) throws AccessDeniedException + public String doRemoveTransition( HttpServletRequest request ) { if ( !retrieveTransitionFromRequest( request ) ) { diff --git a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormWorkflowConfigJspBean.java b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormWorkflowConfigJspBean.java index 198098d44..1d5d63391 100644 --- a/src/java/fr/paris/lutece/plugins/forms/web/admin/FormWorkflowConfigJspBean.java +++ b/src/java/fr/paris/lutece/plugins/forms/web/admin/FormWorkflowConfigJspBean.java @@ -79,7 +79,6 @@ public class FormWorkflowConfigJspBean extends AbstractJspBean private static final String MARK_QUESTIONLIST = "questionList"; // Actions - private static final String ACTION_MANAGE_WORKFLOW = "manageWorkflowConfig"; private static final String ACTION_MODIFY_WORKFLOW = "modifyWorkflowConfig"; @Inject diff --git a/src/sql/plugins/forms/plugin/create_db_forms.sql b/src/sql/plugins/forms/plugin/create_db_forms.sql index fc5cf64f7..478d9bca9 100644 --- a/src/sql/plugins/forms/plugin/create_db_forms.sql +++ b/src/sql/plugins/forms/plugin/create_db_forms.sql @@ -204,6 +204,7 @@ id int AUTO_INCREMENT, id_form int NOT NULL, end_message_display SMALLINT, end_message varchar(3000) default '', +label_final_button VARCHAR(255), PRIMARY KEY (id) ); CREATE INDEX index_fm_id_form ON forms_message ( id_form ); diff --git a/src/sql/plugins/forms/plugin/init_db_forms.sql b/src/sql/plugins/forms/plugin/init_db_forms.sql index 3e3ee2f94..0ccf3f653 100644 --- a/src/sql/plugins/forms/plugin/init_db_forms.sql +++ b/src/sql/plugins/forms/plugin/init_db_forms.sql @@ -5,8 +5,8 @@ -- Dumping data for table `forms_action` -- DELETE FROM forms_action; -INSERT INTO forms_action (id_action, name_key, description_key, action_url, icon_url, action_permission, form_state) VALUES (1,'forms.action.modify.name','forms.action.modify.description','jsp/admin/plugins/forms/ManageForms.jsp?view=modifyForm','cog','MODIFY',0); -INSERT INTO forms_action (id_action, name_key, description_key, action_url, icon_url, action_permission, form_state) VALUES (3, 'forms.action.params.name', 'forms.action.params.description', 'jsp/admin/plugins/forms/ManageSteps.jsp?view=manageSteps', 'step-forward', 'PARAM', 0); +INSERT INTO forms_action (id_action, name_key, description_key, action_url, icon_url, action_permission, form_state) VALUES (1,'forms.action.modify.name','forms.action.modify.description', 'jsp/admin/plugins/forms/ManageSteps.jsp?view=manageSteps', 'step-forward','MODIFY',0); +INSERT INTO forms_action (id_action, name_key, description_key, action_url, icon_url, action_permission, form_state) VALUES (3, 'forms.action.params.name', 'forms.action.params.description','jsp/admin/plugins/forms/ManageForms.jsp?view=modifyForm','cog', 'PARAM', 0); INSERT INTO forms_action (id_action, name_key, description_key, action_url, icon_url, action_permission, form_state) VALUES (2,'forms.action.delete.name','forms.action.delete.description','jsp/admin/plugins/forms/ManageForms.jsp?view=confirmRemoveForm','trash','DELETE',0); INSERT INTO forms_action (id_action, name_key, description_key, action_url, icon_url, action_permission, form_state) VALUES (4, 'forms.action.publish.name', 'forms.action.publish.description', 'jsp/admin/plugins/forms/ManageForms.jsp?view=modifyPublication', 'calendar', 'PUBLISH', 0); INSERT INTO forms_action (id_action, name_key, description_key, action_url, icon_url, action_permission, form_state) VALUES (5, 'forms.action.viewResponses.name', 'forms.action.viewResponses.description', 'jsp/admin/plugins/forms/MultiviewForms.jsp?current_selected_panel=forms', 'list-alt', 'VIEW_FORM_RESPONSE', 0); diff --git a/src/sql/plugins/forms/upgrade/update_db_forms-3.1.1-3.1.2.sql b/src/sql/plugins/forms/upgrade/update_db_forms-3.1.1-3.1.2.sql new file mode 100644 index 000000000..d4e62fb69 --- /dev/null +++ b/src/sql/plugins/forms/upgrade/update_db_forms-3.1.1-3.1.2.sql @@ -0,0 +1,8 @@ +--liquibase formatted sql +--changeset forms:update_db_forms-3.1.1-3.1.2.sql +--preconditions onFail:MARK_RAN onError:WARN +UPDATE forms_action SET action_url = 'jsp/admin/plugins/forms/ManageForms.jsp?view=modifyForm', icon_url='cog' WHERE name_key = 'forms.action.params.name'; +UPDATE forms_action SET action_url = 'jsp/admin/plugins/forms/ManageSteps.jsp?view=manageSteps', icon_url='step-forward' WHERE name_key = 'forms.action.modify.name'; + +ALTER TABLE forms_message ADD label_end_message_button VARCHAR(255) default NULL; + diff --git a/webapp/WEB-INF/templates/admin/plugins/forms/create_form.html b/webapp/WEB-INF/templates/admin/plugins/forms/create_form.html index 1c06819b6..cc723774d 100644 --- a/webapp/WEB-INF/templates/admin/plugins/forms/create_form.html +++ b/webapp/WEB-INF/templates/admin/plugins/forms/create_form.html @@ -18,12 +18,16 @@ \ No newline at end of file diff --git a/webapp/WEB-INF/templates/admin/plugins/forms/multiview/view_form_response.html b/webapp/WEB-INF/templates/admin/plugins/forms/multiview/view_form_response.html index 8c6beead0..df6e3ad0e 100644 --- a/webapp/WEB-INF/templates/admin/plugins/forms/multiview/view_form_response.html +++ b/webapp/WEB-INF/templates/admin/plugins/forms/multiview/view_form_response.html @@ -96,7 +96,7 @@

#i18n{forms.multiviewForms.view_record_history.actions}

<@columns sm=3> <@box id='response-right'> - <@boxHeader id='info-box-header' title='' boxTools=true> + <@boxHeader id='info-box-header' title='' class='boxTool' boxTools=true> <@tform method='get' id='form-response-detail-header' type='inline' action='jsp/admin/plugins/forms/MultiviewForms.jsp'> <@input type='hidden' name='page' value='form' /> <@input type='hidden' name='session' value='session' /> diff --git a/webapp/WEB-INF/templates/skin/plugins/forms/entries/fill_entry_type_terms_of_service.html b/webapp/WEB-INF/templates/skin/plugins/forms/entries/fill_entry_type_terms_of_service.html index 14319b634..c3ab0b2f6 100644 --- a/webapp/WEB-INF/templates/skin/plugins/forms/entries/fill_entry_type_terms_of_service.html +++ b/webapp/WEB-INF/templates/skin/plugins/forms/entries/fill_entry_type_terms_of_service.html @@ -11,7 +11,7 @@
checked="checked" class="${entry.CSSClass!}<#if error?? > is-invalid" /> <#assign fieldLink = getFieldByCode( entry, "link" ) > - ${fieldLink.value} + ${fieldLink.value} <#if error?? && error.isDisplayableError> <#if error.mandatoryError>${error.errorMessage} diff --git a/webapp/WEB-INF/templates/skin/plugins/forms/form_submitted_view.html b/webapp/WEB-INF/templates/skin/plugins/forms/form_submitted_view.html index b82d36c51..0be2b7715 100644 --- a/webapp/WEB-INF/templates/skin/plugins/forms/form_submitted_view.html +++ b/webapp/WEB-INF/templates/skin/plugins/forms/form_submitted_view.html @@ -3,4 +3,4 @@ ${messageInfo} - #i18n{forms.form.returnPage} + <#if labelButton?? >${labelButton}<#else>#i18n{forms.form.returnPage} diff --git a/webapp/WEB-INF/templates/skin/plugins/forms/terms_of_service.html b/webapp/WEB-INF/templates/skin/plugins/forms/terms_of_service.html index 5ee727283..34d68d730 100644 --- a/webapp/WEB-INF/templates/skin/plugins/forms/terms_of_service.html +++ b/webapp/WEB-INF/templates/skin/plugins/forms/terms_of_service.html @@ -1,3 +1,66 @@ -
- ${tos} -
+ +
+
+
+

Loading Terms of Service...

+
+
+ + +
+
+
+ ${tos} +
+
+
+ \ No newline at end of file diff --git a/webapp/js/admin/plugins/forms/multiview/forms-multiview.js b/webapp/js/admin/plugins/forms/multiview/forms-multiview.js index debc26b13..82cc06504 100644 --- a/webapp/js/admin/plugins/forms/multiview/forms-multiview.js +++ b/webapp/js/admin/plugins/forms/multiview/forms-multiview.js @@ -20,7 +20,7 @@ function resetForm( ){ function setNavButtons( idResp, labelPrev, labelNext ){ const respUrl=sessionStorage.getItem('multiview_base_url') + '&id_form_response='; - const item_list=sessionStorage.getItem('multiview_current_list'), boxTool=$('#info-box-header .box-tools'); + const item_list=sessionStorage.getItem('multiview_current_list'), boxTool=$('#info-box-header.boxTool'); var response_list=item_list.split(','), maxIdx=response_list.length - 1, currentIdx=response_list.indexOf(idResp); var nNext=currentIdx+1, nPrev=currentIdx-1; if( currentIdx > -1 ){