<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
-<script>
+
+<script language="JavaScript">
+// Flags whether a validation cycle of a document type has Review state.
+var hasReview = new Array();
+<s:iterator value="reviewable" status="stat">
+hasReview[<s:property value="#stat.index"/>]=<s:property />;
+</s:iterator>
+
$(document).ready(function () {
$("#bring input[name='documentName']").focus();
- <s:if test="%{reference != null}">
+ <s:if test="%{reference == null}">
// if versioning then the document name and state can not be modified.
- $("#bring input[name='documentName']").attr("disabled","disabled");
- $("#bring input[name='documentState']").attr("disabled","disabled");
+ $("#bring input[name='documentName']").prop("disabled", false);
+ $("#bring input[name='documentState']").prop("disabled", false);
</s:if>
+ $("#bring #documentType").change(function () {
+ // Hide or show inDraft according to the selected document type
+ if (hasReview[document.bring.documentType.selectedIndex]) {
+ // Show inDraft
+ $("#bring #documentState option[value='inDRAFT']").show();
+ } else {
+ // Deselect inDraft if it is selected
+ if (document.bring.documentState.value == 'inDRAFT') {
+ document.bring.documentState.selectedIndex = 0;
+ }
+ // Hide inDraft
+ $("#bring #documentState option[value='inDRAFT']").hide();
+ }
+ }).change();
});
</script>
<!-- Import dialog
- =============================================================================================================================
+ ===========================================================================
-->
<div id="article-box">
<div id="section"><s:text name="title.import" /></div>
</tr>
<tr>
<td><s:select theme="simple" name="documentType"
- list="documentTypes" listKey="index"
+ id="documentType" list="documentTypes" listKey="index"
listValue="%{getText('type.document.' + getName())}" /> </td>
- <td><s:if test="%{reference != null}">
- <s:textfield theme="simple" id="documentName" name="documentName"
- disabled="" />
- </s:if> <s:else>
- <s:textfield theme="simple" id="documentName" name="documentName" />
- </s:else></td>
+ <td><s:textfield theme="simple" id="documentName"
+ name="documentName" disabled="true" /></td>
</tr>
<s:if test="defaultDocumentUses.size > 0">
<tr>
<td align="left"><s:submit theme="simple" name="save"
key="button.import" /> <s:select theme="simple" id="documentState"
name="documentState" list="documentStates" listKey="value"
- listValue="%{getText(key)}">
- </s:select></td>
+ listValue="%{getText(key)}" disabled="" /></td>
</tr>
</table>
</form>