From 245ed895197e9a7f9af8b352fb8a1e1255b2949d Mon Sep 17 00:00:00 2001 From: mka Date: Mon, 6 May 2013 12:24:35 +0000 Subject: [PATCH] Validation of the screens' input fields are implemented. --- .../Siman-Common/src/test/labels.properties | 7 ++ .../src/test/labels_en.properties | 7 ++ Workspace/Siman-WS/src/labels.properties | 2 + Workspace/Siman-WS/src/labels_en.properties | 2 + .../WebContent/WEB-INF/tiles/tiles-defs.xml | 2 - .../Siman/WebContent/jsp/editKnowledge.jsp | 84 +++++++++++-------- Workspace/Siman/WebContent/sadmin/upload.jsp | 14 +++- Workspace/Siman/WebContent/skin/default.css | 2 +- .../Siman/WebContent/study/copyStudy.jsp | 7 +- .../WebContent/study/displayStudyStep.jsp | 2 - .../study/editScenarioProperties.jsp | 6 +- .../WebContent/study/editStudyProperties.jsp | 4 +- .../Siman/WebContent/study/importDocument.jsp | 20 +++-- .../Siman/WebContent/study/newScenario.jsp | 12 ++- Workspace/Siman/WebContent/study/newStudy.jsp | 60 +++++++++++-- Workspace/Siman/WebContent/study/upload.jsp | 13 ++- Workspace/Siman/src/labels.properties | 2 + Workspace/Siman/src/labels_en.properties | 2 + .../CopyStudyAction-valid-copy-validation.xml | 13 +++ .../src/org/splat/simer/CopyStudyAction.java | 2 +- ...eElementAction-setKnowledge-validation.xml | 8 ++ ...opertiesAction-valid-rename-validation.xml | 8 ++ ...DocumentAction-valid-import-validation.xml | 8 ++ ...NewScenarioAction-valid-add-validation.xml | 8 ++ .../NewStudyAction-valid-new-validation.xml | 5 -- ...PropertiesAction-valid-edit-validation.xml | 8 ++ Workspace/Siman/src/struts.xml | 13 ++- 27 files changed, 237 insertions(+), 84 deletions(-) create mode 100644 Workspace/Siman/src/org/splat/simer/CopyStudyAction-valid-copy-validation.xml create mode 100644 Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction-setKnowledge-validation.xml create mode 100644 Workspace/Siman/src/org/splat/simer/EditScenarioPropertiesAction-valid-rename-validation.xml create mode 100644 Workspace/Siman/src/org/splat/simer/ImportDocumentAction-valid-import-validation.xml create mode 100644 Workspace/Siman/src/org/splat/simer/NewScenarioAction-valid-add-validation.xml create mode 100644 Workspace/Siman/src/org/splat/simer/StudyPropertiesAction-valid-edit-validation.xml diff --git a/Workspace/Siman-Common/src/test/labels.properties b/Workspace/Siman-Common/src/test/labels.properties index 784d347..8611df4 100644 --- a/Workspace/Siman-Common/src/test/labels.properties +++ b/Workspace/Siman-Common/src/test/labels.properties @@ -163,6 +163,8 @@ field.password = Mot de passe field.studytitle = Titre de l''étude field.scenariotitle = Titre du scénario field.documentitle = Titre du document +field.knowledgetitle= Title of the knowledge +field.knowledgevalue= Value of the knowledge field.product = Produit étudié field.among = Parmi field.context = Contexte @@ -277,6 +279,11 @@ message.noindex = Aucune message.nocontext = Aucun contexte de simulation n''est en attente d''approbation. message.emptydocument = Aucun document n''a été créé à cette étape. message.accept.document = Voulez-vous accepter les modifications des documents utilisés ? +message.promote.study = Voulez-vous avancer l’état de cette étude ? +message.review.study = Voulez-vous valider cette étude ? +message.demote.study = Voulez-vous reculer l’état de cette étude ? +message.disapprove.study = Voulez-vous vraiment refuser l'approbation de cette étude? +message.approve.study = All knowledge attached to the study will also be approved. Did you review these knowledge ? message.publish.study = All knowledge attached to the study will also be published. Did you review these knowledge ? message.protect.study = Do you really want to protect the study ? message.promote.document = Voulez-vous promouvoir ce document ? diff --git a/Workspace/Siman-Common/src/test/labels_en.properties b/Workspace/Siman-Common/src/test/labels_en.properties index c355396..1acbfa6 100644 --- a/Workspace/Siman-Common/src/test/labels_en.properties +++ b/Workspace/Siman-Common/src/test/labels_en.properties @@ -164,6 +164,8 @@ field.password = Password field.studytitle = Title of the study field.scenariotitle = Title of the scenario field.documentitle = Title of the document +field.knowledgetitle= Title of the knowledge +field.knowledgevalue= Value of the knowledge field.product = Studied product field.among = Among field.context = Context @@ -278,6 +280,11 @@ message.noindex = All existing studies are already indexed. message.nocontext = No simulation context is pending for approval. message.emptydocument = No document has been created at this step. message.accept.document = Do you really want to accept the modifications of dependent documents ? +message.promote.study = Do you really want to promote this study ? +message.review.study = Do you really want to validate this study ? +message.demote.study = Do you really want to demote this study ? +message.disapprove.study = Do you really want to refuse approval of this study ? +message.approve.study = All knowledge attached to the study will also be approved. Did you review these knowledge ? message.publish.study = All knowledge attached to the study will also be published. Did you review these knowledge ? message.protect.study = Do you really want to protect the study ? message.promote.document = Do you really want to promote this document ? diff --git a/Workspace/Siman-WS/src/labels.properties b/Workspace/Siman-WS/src/labels.properties index a40cc51..8611df4 100644 --- a/Workspace/Siman-WS/src/labels.properties +++ b/Workspace/Siman-WS/src/labels.properties @@ -163,6 +163,8 @@ field.password = Mot de passe field.studytitle = Titre de l''étude field.scenariotitle = Titre du scénario field.documentitle = Titre du document +field.knowledgetitle= Title of the knowledge +field.knowledgevalue= Value of the knowledge field.product = Produit étudié field.among = Parmi field.context = Contexte diff --git a/Workspace/Siman-WS/src/labels_en.properties b/Workspace/Siman-WS/src/labels_en.properties index bad1cf7..1acbfa6 100644 --- a/Workspace/Siman-WS/src/labels_en.properties +++ b/Workspace/Siman-WS/src/labels_en.properties @@ -164,6 +164,8 @@ field.password = Password field.studytitle = Title of the study field.scenariotitle = Title of the scenario field.documentitle = Title of the document +field.knowledgetitle= Title of the knowledge +field.knowledgevalue= Value of the knowledge field.product = Studied product field.among = Among field.context = Context diff --git a/Workspace/Siman/WebContent/WEB-INF/tiles/tiles-defs.xml b/Workspace/Siman/WebContent/WEB-INF/tiles/tiles-defs.xml index 8b95ac4..b6cadea 100644 --- a/Workspace/Siman/WebContent/WEB-INF/tiles/tiles-defs.xml +++ b/Workspace/Siman/WebContent/WEB-INF/tiles/tiles-defs.xml @@ -51,12 +51,10 @@ - - diff --git a/Workspace/Siman/WebContent/jsp/editKnowledge.jsp b/Workspace/Siman/WebContent/jsp/editKnowledge.jsp index 5aa5f60..80979a2 100644 --- a/Workspace/Siman/WebContent/jsp/editKnowledge.jsp +++ b/Workspace/Siman/WebContent/jsp/editKnowledge.jsp @@ -9,6 +9,21 @@ <%@ page import="org.splat.simer.AbstractOpenObject"%> <%@ page import="org.splat.simer.OpenStudy"%> <%@ page import="org.splat.simer.KnowledgeElementFacade"%> + + + <%! private enum Action { addKnowledge, renameKnowledge, editKnowledge }; %><% @@ -21,8 +36,8 @@ %> + - <% for (Iterator knowtypes = knowlist.iterator(); knowtypes.hasNext(); ) { AbstractOpenObject.KnowledgeIterator type = knowtypes.next(); @@ -36,6 +51,13 @@ List knowelms = type.getKnowledgeElements(); for (Iterator iterator = knowelms.iterator(); iterator.hasNext(); ) { KnowledgeElementFacade kelm = iterator.next(); + if (kelm.getIndex().equals(typenumber)) { +%> + + +<% } %> @@ -44,34 +66,26 @@ - +
<% if (kelm.getPresentationState().equals("open")) { %> " border="none" width=18 height=12/> -<% }%> - -<% +<% } if (todo == Action.renameKnowledge && kelm.getIndex().equals(typenumber)) { -%> - -<% } else - if (todo == Action.editKnowledge && kelm.getIndex().equals(typenumber)) { -%> - +%> + " border="none" title="" /> + <%=kelm.getTitle()%> + + +<% } else if (todo == Action.editKnowledge && kelm.getIndex().equals(typenumber)) { +%> + " border="none" title="" /> + <%=kelm.getTitle()%> <% } else { -%> - +%> + /skin/icon.<%=kelm.getProgressState()%>.png + " width=14 height=14 border="none" title=""/> + <%=kelm.getTitle()%> <% } -%> -
- " border="none" title="" /> - - - - - " border="none" title="" /> - <%=kelm.getTitle()%> - /skin/icon.<%=kelm.getProgressState()%>.png - " width=14 height=14 border="none" title=""/> - <%=kelm.getTitle()%>
+%>
- +
*: * - "> + "/> diff --git a/Workspace/Siman/WebContent/study/editStudyProperties.jsp b/Workspace/Siman/WebContent/study/editStudyProperties.jsp index 47d8917..11a738c 100644 --- a/Workspace/Siman/WebContent/study/editStudyProperties.jsp +++ b/Workspace/Siman/WebContent/study/editStudyProperties.jsp @@ -38,8 +38,7 @@
- - + @@ -356,7 +355,6 @@ -
diff --git a/Workspace/Siman/WebContent/study/importDocument.jsp b/Workspace/Siman/WebContent/study/importDocument.jsp index 8c7d22a..899b182 100644 --- a/Workspace/Siman/WebContent/study/importDocument.jsp +++ b/Workspace/Siman/WebContent/study/importDocument.jsp @@ -30,6 +30,17 @@ $(document).ready(function () { $("#bring #documentState option[value='inDRAFT']").hide(); } }).change(); + + //hack for displaying document title error message above field labels + var done=false; + bring.addEventListener("DOMNodeInserted", function(e) { + if(done) { + done = false; + } else { + done = true; + $('[errorfor="documentName"]').insertAfter($('#fieldError')); + } + }); }); @@ -53,19 +64,19 @@ $(document).ready(function () {
-
+ - + - + -
     *
- +
diff --git a/Workspace/Siman/WebContent/study/newScenario.jsp b/Workspace/Siman/WebContent/study/newScenario.jsp index 6c5d922..fa866fd 100644 --- a/Workspace/Siman/WebContent/study/newScenario.jsp +++ b/Workspace/Siman/WebContent/study/newScenario.jsp @@ -25,16 +25,15 @@
-
- + - + - + -
*: * - "> +
*: * "/>
-
+
diff --git a/Workspace/Siman/WebContent/study/newStudy.jsp b/Workspace/Siman/WebContent/study/newStudy.jsp index 7fada94..1d0148a 100644 --- a/Workspace/Siman/WebContent/study/newStudy.jsp +++ b/Workspace/Siman/WebContent/study/newStudy.jsp @@ -25,7 +25,53 @@ create.projectContextId.value = ; setValue(); + + //Studied product validation (based on struts-generated validation) + //relies on javascript included by 'validate="true"' for displaying error messages + document.getElementById("create").addEventListener('submit', function(event) { //cross-browser solution + form = document.getElementById("create"); + + var errors = false; + var continueValidation = true; + + // field name: product + // custom validation function + if (form.elements['projectContext'] && form.elements['projectContextId']) { + field = form.elements['projectContext']; + id = form.elements['projectContextId']; + var error = "The field \'Studied product\' must be filled"; + if (continueValidation + && id.value != null && ( + (id.value == 0 + && field.value != null + && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0) + ) + || id.value == -1 + ) + ) { + addError(field, error); + errors = true; + } + } + if(errors) { + event.preventDefault(); //cross-browser solution + } + }); + + function setDefaultSelection()(event) { + tds = document.getElementById("select"); + tde = document.getElementById("enter"); + tds.style.display = "block"; // Hides the select input + tde.style.display = "none"; // Displays the text input + + create.projectContextId.value = -1; + create.projectContextId.focus(); + + //hide back button + } }); + + + + open-study?selection=0.1 @@ -206,6 +207,8 @@ + + open-study?selection=0.1 @@ -401,6 +404,8 @@ + + step-study @@ -411,6 +416,8 @@ + + page.editstudyproperties @@ -514,6 +521,8 @@ + + step-study @@ -588,6 +597,8 @@ + + study/open-study -- 2.39.2