Commit 6552f4f2 authored by Guillaume Lépine's avatar Guillaume Lépine
Browse files

FORMS-729: Add csv separator config to MultiviwConfig

parent 7c61214f
......@@ -42,6 +42,7 @@ public class MultiviewConfig
boolean _bDisplayFormsTitleColumn;
boolean _bDisplayFormsAssigneeColumn;
String _strCsvSeparator;
/**
* Private constructor for singleton pattern
......@@ -53,6 +54,8 @@ public class MultiviewConfig
String strDisplayFormColumnAssignee = DatastoreService.getDataValue( FormsConstants.DS_KEY_FORM_ASSIGNEE_COLUMN, "false" );
_bDisplayFormsAssigneeColumn = Boolean.parseBoolean( strDisplayFormColumnAssignee );
_strCsvSeparator = DatastoreService.getDataValue( FormsConstants.DS_KEY_FORM_CSV_SEPARATOR, ";" );
}
/**
......@@ -107,6 +110,22 @@ public class MultiviewConfig
_bDisplayFormsAssigneeColumn = bDisplayFormsAssigneeColumn;
}
/**
* @return the strCsvSeparator
*/
public String getCsvSeparator( )
{
return _strCsvSeparator;
}
/**
* @param strCsvSeparator the strCsvSeparator to set
*/
public void setCsvSeparator( String strCsvSeparator )
{
_strCsvSeparator = strCsvSeparator;
}
/**
* Save the config
*/
......@@ -116,5 +135,6 @@ public class MultiviewConfig
DatastoreService.setDataValue( FormsConstants.DS_KEY_FORM_TITLE_COLUMN, strDisplayFormsTitleColumn );
String strDisplayFormsAssigneeColumn = Boolean.toString( _bDisplayFormsAssigneeColumn );
DatastoreService.setDataValue( FormsConstants.DS_KEY_FORM_ASSIGNEE_COLUMN, strDisplayFormsAssigneeColumn );
DatastoreService.setDataValue( FormsConstants.DS_KEY_FORM_CSV_SEPARATOR, _strCsvSeparator );
}
}
......@@ -122,6 +122,7 @@ multiviewForms.action.error=Impossible action
multiview_config.labelDisplayColumnFormTitle=Display the column of form title
multiview_config.labelDisplayColumnFormTitle.help=Tick for displaying the column of form title
multiview_config.labelDisplayColumnCsvSeparator=CSV Separator for export
multiview_config.labelDisplayColumnAssignee=Display the column of the user assigned to the response
multiview_config.labelDisplayColumnAssignee.help=Tick for displaying the column of the user assigned to the response
......
......@@ -119,6 +119,7 @@ multiviewForms.action.error=Action impossible
multiview_config.labelDisplayColumnFormTitle=Afficher la colonne du titre de formulaire
multiview_config.labelDisplayColumnFormTitle.help=Cocher cette case si les gestionnaires peuvent voir la colonne du titre du formulaire
multiview_config.labelDisplayColumnCsvSeparator=S\u00e9parateur CSV pour l'export
multiview_config.labelDisplayColumnAssignee=Afficher la colonne de l'utilisateur assign\u00e9 \u00e0 la r\u00e9ponse
multiview_config.labelDisplayColumnAssignee.help=Cocher cette case si les gestionnaires peuvent voir l'utilisateur assign\u00e9 \u00e0 la r\u00e9ponse
......
......@@ -196,6 +196,7 @@ public final class FormsConstants
// Datastore keys
public static final String DS_KEY_FORM_TITLE_COLUMN = "forms.display.form.columnTitle";
public static final String DS_KEY_FORM_ASSIGNEE_COLUMN = "forms.display.form.columnAssignee";
public static final String DS_KEY_FORM_CSV_SEPARATOR = "forms.display.form.csv.separator";
// Actions forms
public static final String ACTION_FORMS_MANAGE_MULTIVIEW_CONFIG = "multiviewConfig";
......
......@@ -120,6 +120,7 @@ public class MultiviewFormsJspBean extends AbstractJspBean
private static final String PARAMETER_PAGE_INDEX = "page_index";
private static final String PARAMETER_FORMAT_EXPORT = "format_export";
private static final String PARAMETER_DISPLAY_FORMS_TITLE_COLUMN = "display_forms_title_column";
private static final String PARAMETER_DISPLAY_FORMS_CSV_SEPARATOR = "csv_separator";
private static final String PARAMETER_DISPLAY_ASSIGNEE_COLUMN = "display_assignee_column";
private static final String PARAMETER_CHANGE_PANEL = "change_panel";
......@@ -329,6 +330,8 @@ public class MultiviewFormsJspBean extends AbstractJspBean
MultiviewConfig config = MultiviewConfig.getInstance( );
config.setCsvSeparator( request.getParameter( PARAMETER_DISPLAY_FORMS_CSV_SEPARATOR ) );
String strDisplayFormColumnTitle = request.getParameter( PARAMETER_DISPLAY_FORMS_TITLE_COLUMN );
config.setDisplayFormsTitleColumn( strDisplayFormColumnTitle != null );
......
......@@ -22,3 +22,6 @@ INSERT INTO forms_global_action (id_action, code, name_key, description_key, act
--
DELETE FROM core_datastore WHERE entity_key='forms.display.form.columnTitle';
INSERT INTO core_datastore ( entity_key, entity_value ) VALUES( 'forms.display.form.columnTitle', 'true' );
DELETE FROM core_datastore WHERE entity_key='forms.display.form.csv.separator';
INSERT INTO core_datastore ( entity_key, entity_value ) VALUES( 'forms.display.form.csv.separator', ';' );
......@@ -2,4 +2,7 @@ ALTER TABLE forms_form MODIFY availability_start_date TIMESTAMP NULL;
ALTER TABLE forms_form MODIFY availability_end_date TIMESTAMP NULL;
UPDATE forms_action SET icon_url = 'step-forward' WHERE name_key = 'forms.action.params.name';
UPDATE forms_action SET icon_url = 'cog' WHERE name_key = 'forms.action.modify.name';
\ No newline at end of file
UPDATE forms_action SET icon_url = 'cog' WHERE name_key = 'forms.action.modify.name';
DELETE FROM core_datastore WHERE entity_key='forms.display.form.csv.separator';
INSERT INTO core_datastore ( entity_key, entity_value ) VALUES( 'forms.display.form.csv.separator', ';' );
......@@ -5,6 +5,9 @@
<@boxBody>
<@tform method='post' name='save_multiview_config' action='jsp/admin/plugins/forms/MultiviewForms.jsp'>
<@messages errors=errors />
<@formGroup labelKey='#i18n{forms.multiview_config.labelDisplayColumnCsvSeparator}' helpKey='#i18n{forms.multiview_config.labelDisplayColumnCsvSeparator.help}' >
<@input type='text' name='csv_separator' id='csv_separator' value=multiview_config.csvSeparator />
</@formGroup>
<@formGroup labelFor='display_forms_title_column' helpKey='#i18n{forms.multiview_config.labelDisplayColumnFormTitle.help}' >
<@checkBox labelFor='display_forms_title_column' labelKey='#i18n{forms.multiview_config.labelDisplayColumnFormTitle}' name='display_forms_title_column' id='display_forms_title_column' value='1' checked=multiview_config.displayFormsTitleColumn />
</@formGroup>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment