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
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 ?
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
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 ?
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
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
</definition>
<definition name="page.new.study" template="/study/newStudy.jsp">
- <put-attribute name="input_action" value="new-study" type="string"/>
<put-attribute name="valid_action" value="valid-new" type="string"/>
</definition>
<definition name="page.copy.study" template="/study/newStudy.jsp">
- <put-attribute name="input_action" value="new-copy" type="string"/>
<put-attribute name="valid_action" value="valid-copy" type="string"/>
<put-attribute name="source_study" value="/study/copyStudy.jsp"/>
</definition>
<%@ page import="org.splat.simer.AbstractOpenObject"%>
<%@ page import="org.splat.simer.OpenStudy"%>
<%@ page import="org.splat.simer.KnowledgeElementFacade"%>
+
+<script language="JavaScript">
+ //Knowledge value validation
+ $(document).ready(function() {
+ $('#setKnowledge').submit(function(event) {
+ field = document.getElementById('hdnknowledgeValue');
+ document.getElementById('knowledgeValueErrorMessage').style.display = 'none';
+ if(field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
+ event.preventDefault();
+ document.getElementById('knowledgeValueErrorMessage').style.display = 'table-row';
+ }
+ });
+ });
+</script>
+
<%!
private enum Action { addKnowledge, renameKnowledge, editKnowledge };
%><%
%>
<s:url id="undo" namespace="/study" action="step-study"></s:url>
+<s:form name="edit" action="setKnowledge" method="post" validate="true" cssClass="text">
<input type=hidden name=knowledgeType value="<%=typenumber%>"/>
-<table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
<%
for (Iterator<AbstractOpenObject.KnowledgeIterator> knowtypes = knowlist.iterator(); knowtypes.hasNext(); ) {
AbstractOpenObject.KnowledgeIterator type = knowtypes.next();
List<KnowledgeElementFacade> knowelms = type.getKnowledgeElements();
for (Iterator<KnowledgeElementFacade> iterator = knowelms.iterator(); iterator.hasNext(); ) {
KnowledgeElementFacade kelm = iterator.next();
+ if (kelm.getIndex().equals(typenumber)) {
+%> <tr id="knowledgeValueErrorMessage" style="display: none">
+ <td align="center" colspan="2" class="errorMessage">
+ <s:property value='%{getText("message.error.noenteredvalue", "-", getText("field.knowledgevalue"))}'/>
+ </td>
+ </tr>
+<% }
%>
<tr height=20 valign=top>
<td>
<% if (kelm.getPresentationState().equals("open")) {
%> <img src="<s:url value="/skin/image.hold.gif"/>" border="none" width=18 height=12/>
-<% }%> <table cellpadding=0 cellspacing=0 border=0>
- <tr>
-<%
+<% }
if (todo == Action.renameKnowledge && kelm.getIndex().equals(typenumber)) {
-%> <td width=18>
- <s:a href="%{undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" /></s:a>
- </td>
- <td>
- <input type=text size="35" name=knowledgeTitle value="<%=kelm.getTitle()%>" />
- <button type="submit" value="" style="width:24px; height:16px; border:0; cursor:pointer; cursor:hand; background:transparent">
- <img src="<s:url value="/skin/image.export.png"/>" title="<s:text name="button.save"/>"/>
- </button>
- </td>
-<% } else
- if (todo == Action.editKnowledge && kelm.getIndex().equals(typenumber)) {
-%> <td width=18>
- <s:a href="%{undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" /></s:a>
- </td>
- <td><%=kelm.getTitle()%></td>
+%>
+ <s:a href="%{undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" /></s:a>
+ <s:set var="kelmTitle"><%=kelm.getTitle()%></s:set>
+ <s:textfield size="35" name="knowledgeTitle" value="%{kelmTitle}" theme="simple"/>
+ <button type="submit" value="" style="width:24px; height:16px; border:0; cursor:pointer; cursor:hand; background:transparent">
+ <img src="<s:url value="/skin/image.export.png"/>" title="<s:text name="button.save"/>"/>
+ </button>
+<% } else if (todo == Action.editKnowledge && kelm.getIndex().equals(typenumber)) {
+%>
+ <s:a href="%{undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" /></s:a>
+ <%=kelm.getTitle()%>
<% } else {
-%> <td width=18>
- <s:set var="path">/skin/icon.<%=kelm.getProgressState()%>.png</s:set>
- <img src="<s:url value="%{#path}"/>" width=14 height=14 border="none" title=""/>
- </td>
- <td><%=kelm.getTitle()%></td>
+%>
+ <s:set var="path">/skin/icon.<%=kelm.getProgressState()%>.png</s:set>
+ <img src="<s:url value="%{#path}"/>" width=14 height=14 border="none" title=""/>
+ <%=kelm.getTitle()%>
<% }
-%> </tr>
- </table>
+%>
</td>
<!-- Value
}
if (todo == Action.addKnowledge && type.getIndex().equals(typenumber)) {
%> <tr height=5><td></td></tr>
+ <tr id="knowledgeValueErrorMessage" style="display: none">
+ <td align="center" colspan="2" class="errorMessage">
+ <s:property value='%{getText("message.error.noenteredvalue", "-", getText("field.knowledgevalue"))}'/>
+ </td>
+ </tr>
<tr valign=top>
<td>
- <table cellpadding=0 cellspacing=0 border=0>
- <tr>
- <td width=18>
- <s:a href="%{undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" /></s:a>
- </td>
- <td><input type=text size="35" name=knowledgeTitle></td>
- </tr>
- </table>
+ <s:a href="%{undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" /></s:a>
+ <s:textfield size="35" name="knowledgeTitle" theme="simple"/>
</td>
<td>
<script language='JavaScript' type='text/javascript'>
<% }
}
%> <tr height=30 valign=middle><td></td></tr>
-
-</table>
\ No newline at end of file
+</s:form>
\ No newline at end of file
<link href=<s:url value="/skin/default.css"/> rel="stylesheet" type="text/css">
<script language="JavaScript">
- function enableUpload () {
-// ------------------------
- upform.doIt.disabled = false;
+ function updateUploadButton() {
+ if(upform.upload.value == null || upform.upload.value == '') {
+ upform.doIt.disabled = true;
+ } else {
+ upform.doIt.disabled = false;
+ }
}
</script>
</head>
<tr height=10><td></td></tr>
<s:hidden name="nextAction" value="%{nextAction}" />
<s:hidden name="index" value="%{index}" />
- <s:file name="upload" key="field.upload" onchange="enableUpload()" />
+ <tr>
+ <td><s:property value='getText("field.upload")'/>: <span class="error">*</span></td>
+ <td><input type="file" name="upload" onchange="updateUploadButton()" /></td>
+ </tr>
<tr height=10><td></td></tr>
<tr>
<td></td>
color: #000000;
text-decoration: none;
}
-.error {
+.error, .errorMessage {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
<script language="JavaScript">
function selectSourceStudy() {
+ document.forms["create"].action="new-copy";
$("#create").submit();
}
</script>
<tr>
- <td> <s:text name="field.fromStudy" />*:
+ <td> <s:text name="field.fromStudy" />: <span class="error">*</span>
</td>
<td><s:select theme="simple" list="studies" name="fromStudyId"
onchange="selectSourceStudy()" /></td>
</tr>
<tr>
- <td> <s:text name="field.finalStep" />*:
+ <td> <s:text name="field.finalStep" />: <span class="error">*</span>
</td>
<td><s:select theme="simple" list="steps" name="finalStep" /></td>
</tr>
<tr>
- <td> <s:text name="field.fromScenario" />*:
+ <td> <s:text name="field.fromScenario" />: <span class="error">*</span>
</td>
<td><s:select theme="simple" list="scenarios"
name="fromScenarioId" /></td>
<div id=section><s:text name="title.knowledge"/></div>
<div id=article-body class=text>
<s:if test="%{#todo == 'addKnowledge' || #todo == 'renameKnowledge' || #todo == 'editKnowledge'}">
- <form name="edit" action="setKnowledge" method="post">
<jsp:include page="/jsp/editKnowledge.jsp">
<jsp:param name="action" value="<%=action%>" />
<jsp:param name="index" value="<%=type%>" />
</jsp:include>
- </form>
</s:if>
<s:else>
<jsp:include page="/jsp/readKnowledge.jsp">
<!-- Scenario ckecked-in (editable)
--> <s:else>
- <s:form name="property" action="%{rename_scenario}" method="post">
+ <s:form name="property" action="valid-rename" method="post" validate="true">
<table class="text">
<tr>
- <td><s:text name="field.scenariotitle"/>*: </td>
+ <td><s:text name="field.scenariotitle"/>: <span class="error">*</span></td>
<td>
- <input type=text" size="25" name="selectedScenarioTitle" value="<s:property value="selectedScenarioTitle"/>">
+ <s:textfield size="25" name="selectedScenarioTitle" value="%{selectedScenarioTitle}" theme="simple"/>
</td>
<td>
<input type="submit" name="save" value="<s:text name="button.save"/>"/>
</div>
<div id=article-body class=text>
- <s:form name="edit" action="valid-edit" method="post" validate="true">
- <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
+ <s:form name="edit" action="valid-edit" method="post" validate="true" cssClass="text">
<tr height=10><td width=20></td></tr>
<tr>
</tr>
</s:iterator>
<tr height=3><td></td></tr>
- </table>
</s:form>
</div>
</div>
$("#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'));
+ }
+ });
});
</script>
</tr>
</table>
-<form name="bring" id="bring" action="valid-import" method="post">
+<s:form name="bring" id="bring" action="valid-import" method="post" validate="true" cssClass="text">
<s:hidden name="fileName" /> <s:hidden name="reference" /> <s:hidden
name="documentTitle" value="%{documentName}" /> <s:hidden
name="defaultDocumentType" value="%{documentType}" /> <s:hidden
name="defaultDocumentState" value="%{documentState}" /> <s:hidden
name="version" /> <s:hidden name="documentDate" />
-<table cellpadding="0" cellspacing="0" border="0" class="text">
<tr height="15">
<td></td>
</tr>
+ <tr id="fieldError"/>
<tr>
<td align="right"><s:text name="field.documentype" /> </td>
- <td align="left"> <s:text name="field.documentitle" /></td>
+ <td align="left"> <s:text name="field.documentitle" /> <span class="error">*</span></td>
</tr>
<tr>
<td><s:select theme="simple" name="documentType"
name="documentState" list="documentStates" listKey="value"
listValue="%{getText(key)}" disabled="" /></td>
</tr>
-</table>
-</form>
+</s:form>
</div>
</div>
<div id=article-box>
<div id=section><s:text name="title.newscenario"/></div>
<div id=article-body class=text>
- <form name="create" action="valid-add" method="post">
- <table class="text">
+ <s:form name="create" action="valid-add" method="post" cssClass="text" validate="true">
<tr>
- <td><s:text name="field.scenariotitle"/>*: </td>
+ <td><s:text name="field.scenariotitle"/>: <span class="error">*</span></td>
<td>
- <input type=text size="25" name=title value="<s:property value="title"/>">
+ <s:textfield size="25" name="title" value="%{title}" theme="simple"/>
</td>
</tr>
<tr>
- <td><s:text name="field.scenario"/>*: </td>
+ <td><s:text name="field.scenario"/>: <span class="error">*</span></td>
<td>
<s:set var="previous" value="selectedScenarioIndex"/>
<select name="selectedScenario" style="width:204px">
<input type="submit" name="save" value="<s:text name="button.newscenario"/>"/>
</td>
</tr>
- </table>
- </form>
+ </s:form>
</div>
</div>
</body>
create.projectContextId.value = <s:property value="projectContextId"/>;
</s:if>
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
+ }
});
+
+
</script>
<!-- New study dialog
<s:text name="title.newstudy" />
</div>
<div id="top-spacer"></div>
- <form id="create" name="create"
- action="<tiles:getAsString name="input_action"/>" method="post">
- <table class="text">
+ <s:form id="create" name="create"
+ action="%{#request.valid_action}" method="post" validate="true" cssClass="text">
<tr class="error">
<td colspan="3"><s:text name="%{error}" /></td>
</tr>
<tr>
- <td> <s:text name="field.studytitle" />*:
+ <td> <s:text name="field.studytitle" />: <span class="error">*</span>
</td>
<td><s:textfield theme="simple" size="60" name="title" /></td>
</tr>
<tr>
- <td> <s:text name="field.product" />*:
+ <td> <s:text name="field.product" />: <span class="error">*</span>
</td>
<s:if test="projectContextValues.size > 0">
<td id="select"><select name="projectContextId"
<tr>
<td align="right" colspan="2"><s:submit
- action="%{#request.valid_action}" theme="simple" type="button"
+ theme="simple" type="button"
key="button.newstudy" /></td>
</tr>
- </table>
- </form>
+ </s:form>
<div id="top-spacer"></div>
</div>
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<script language="JavaScript">
- function enableUpload () {
- upform.doIt.disabled = false;
+ function updateUploadButton() {
+ if(upform.upload.value == null || upform.upload.value == '') {
+ upform.doIt.disabled = true;
+ } else {
+ upform.doIt.disabled = false;
+ }
}
</script>
<!-- Updload dialog
<tr height=10><td></td></tr>
<s:hidden name="nextAction" value="%{nextAction}" />
<s:hidden name="index" value="%{index}" />
- <s:file name="upload" key="field.upload" onchange="enableUpload()" />
+ <tr>
+ <td><s:property value='getText("field.upload")'/>: <span class="error">*</span></td>
+ <td><input type="file" name="upload" onchange="updateUploadButton()" /></td>
+ </tr>
<tr height=10><td></td></tr>
<tr>
<td></td>
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
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
--- /dev/null
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
+<validators>
+ <field name="title">
+ <field-validator type="requiredstring">
+ <message>${getText("message.error.noenteredvalue", "-", getText("field.studytitle"))}</message>
+ </field-validator>
+ </field>
+ <field name="fromStudyId">
+ <field-validator type="required">
+ <message>${getText("message.error.noenteredvalue", "-", getText("field.fromStudy"))}</message>
+ </field-validator>
+ </field>
+</validators>
\ No newline at end of file
List<Proxy> studies = getSearchService().selectStudiesWhere(filter);
// Fill the studies list
- _studies.put(0L, "");
+ _studies.put(null, "");
for (Proxy study : studies) {
_studies.put(study.getIndex(), study.getTitle());
}
--- /dev/null
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
+<validators>
+ <field name="knowledgeTitle">
+ <field-validator type="requiredstring">
+ <message>${getText("message.error.noenteredvalue", "-", getText("field.knowledgetitle"))}</message>
+ </field-validator>
+ </field>
+</validators>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
+<validators>
+ <field name="selectedScenarioTitle">
+ <field-validator type="requiredstring">
+ <message>${getText("message.error.noenteredvalue", "-", getText("field.scenariotitle"))}</message>
+ </field-validator>
+ </field>
+</validators>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
+<validators>
+ <field name="documentName">
+ <field-validator type="requiredstring">
+ <message>${getText("message.error.noenteredvalue", "-", getText("field.documentitle"))}</message>
+ </field-validator>
+ </field>
+</validators>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
+<validators>
+ <field name="title">
+ <field-validator type="requiredstring">
+ <message>${getText("message.error.noenteredvalue", "-", getText("field.scenariotitle"))}</message>
+ </field-validator>
+ </field>
+</validators>
\ No newline at end of file
<message>${getText("message.error.noenteredvalue", "-", getText("field.studytitle"))}</message>
</field-validator>
</field>
- <field name="projectContext">
- <field-validator type="requiredstring">
- <message>${getText("message.error.noenteredvalue", "-", getText("field.product"))}</message>
- </field-validator>
- </field>
</validators>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
+<validators>
+ <field name="title">
+ <field-validator type="requiredstring">
+ <message>${getText("message.error.noenteredvalue", "-", getText("field.studytitle"))}</message>
+ </field-validator>
+ </field>
+</validators>
\ No newline at end of file
</action>
<action name="valid-new" class="newStudyAction"
method="create">
- <!--interceptor-ref name="siman-validation" /-->
+ <interceptor-ref name="simanBasicStack"/>
+ <interceptor-ref name="siman-validation"/>
<result name="success" type="redirectAction">
open-study?selection=0.1
</result>
</action>
<action name="valid-copy" class="copyStudyAction"
method="create">
+ <interceptor-ref name="simanBasicStack"/>
+ <interceptor-ref name="siman-validation"/>
<result name="success" type="redirectAction">
open-study?selection=0.1
</result>
</action>
<action name="valid-add" class="newScenarioAction"
method="create">
+ <interceptor-ref name="simanBasicStack"/>
+ <interceptor-ref name="siman-validation"/>
<result name="cancel" type="redirectAction">
step-study
</result>
</action>
<action name="valid-edit" class="studyPropertiesAction"
method="edition">
+ <interceptor-ref name="simanBasicStack"/>
+ <interceptor-ref name="siman-validation"/>
<result name="success" type="tiles">
page.editstudyproperties
</result>
</action>
<action name="valid-import" class="importDocumentAction"
method="import">
+ <interceptor-ref name="simanBasicStack"/>
+ <interceptor-ref name="siman-validation"/>
<result name="success" type="redirectAction">
step-study
</result>
</action>
<action name="setKnowledge" class="editKnowledgeElementAction"
method="setKnowledge">
+ <interceptor-ref name="simanBasicStack"/>
+ <interceptor-ref name="siman-validation"/>
<result name="success" type="redirectAction">
study/open-study
</result>