Salome HOME
JSP are updated to use more struts tags. Javadoc comments are added.
authorrkv <rkv@opencascade.com>
Wed, 13 Feb 2013 11:41:31 +0000 (11:41 +0000)
committerrkv <rkv@opencascade.com>
Wed, 13 Feb 2013 11:41:31 +0000 (11:41 +0000)
Workspace/Siman/WebContent/js/search.js
Workspace/Siman/WebContent/jsp/editKnowledge.jsp
Workspace/Siman/WebContent/login.jsp
Workspace/Siman/WebContent/study/importDocument.jsp
Workspace/Siman/WebContent/study/searchKnowledge.jsp
Workspace/Siman/WebContent/study/searchStudy.jsp
Workspace/Siman/src/org/splat/simer/AbstractSearchBaseAction.java
Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java

index 91956e132c7a2d7774e726addf74b7d1e22c8e9c..69c905bb7c934442828774545f15cd0d59ac1ad9 100644 (file)
@@ -1,5 +1,4 @@
     function initialize (result) {
-//  ----------------------------
       var state = search.state.value;
 
       if (state == "inWORK" || state == "inDRAFT" || state == "inCHECK") {
@@ -11,7 +10,6 @@
     }
 
     function setState () {
-//  --------------------
       var state = search.state.value;
 
       if (state == "inWORK" || state == "inDRAFT" || state == "inCHECK") {
@@ -26,7 +24,6 @@
     }
 
     function changeFilter () {
-//  ------------------------
       var result = document.getElementById("resulist");
 
       search.elements[0].value = "0";      // Marks the result obsolete
     }
 
     function removeContext (index) {
-//  ------------------------------
        search.elements[0].value = index;
        search.submit();
     }
 
     function cancel () {
-//  ------------------
       search.elements[0].value = "-1";
       search.submit();
     }
\ No newline at end of file
index 2ae4fd4b6da89ebea8c4bdb159f3470b914546b4..745e5df750050bce8045962344161b5ad64eaee1 100644 (file)
@@ -21,8 +21,8 @@
 %>
 <s:url id="undo" namespace="/study" action="step-study"></s:url>
 
+<input type=hidden name=knowledgeType value="<%=typenumber%>"/>
 <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
-  <input type=hidden name=knowledgeType value="<%=typenumber%>"/>
 <%
     for (Iterator<AbstractOpenObject.KnowledgeIterator> knowtypes = knowlist.iterator(); knowtypes.hasNext(); ) {
        AbstractOpenObject.KnowledgeIterator type = knowtypes.next();
@@ -77,7 +77,6 @@
 <%
         if (todo == Action.editKnowledge && kelm.getIndex().equals(typenumber)) {
 %>            <td>
-                <input type=hidden name=text>
                 <script language='JavaScript' type='text/javascript'>
 <%        out.print("displayTextEditor('knowledgeValue', '" + kelm.getFullValue() + "', 450, 150);");
 %>              </script>
         </table>
       </td>
       <td>
-        <input type=hidden name=text>
         <script language='JavaScript' type='text/javascript'>
 <%        out.print("displayTextEditor('knowledgeValue', '<p>&nbsp;</p>', 450, 150);");
 %>      </script>
index 5c5f09f1ac1c9ff1372812aec7ee11a8100e00f7..30a641c4d2bb163724f8f06b16691d7bf6de3c67 100644 (file)
@@ -19,13 +19,11 @@ $(document).ready(function () {
                        <tr class="error">
                                <td colspan=2><s:text name="%{errorCode}" /></td>
                        </tr>
-                       <s:set var="valid">
-                               <s:text name="menu.login" />
-                       </s:set>
-                       <s:textfield id="username" name="username" key="field.username" required="true" />
+                       <s:textfield id="username" name="username" key="field.username"
+                               required="true" />
                        <s:password name="password" key="field.password" />
                        <s:hidden name="backMenu" value="%{#parameters.backMenu}" />
-                       <s:submit type="button" value="%{valid}" />
+                       <s:submit type="button" key="menu.login" />
                </s:form></td>
        </tr>
        <tr height=10>
index 957a23bcc5b9d0641e9358f76775709a1861cab8..8d8c00bf10cdbde0815e1f909be597eca8ce432b 100644 (file)
@@ -3,95 +3,83 @@
 <%@ taglib prefix="s" uri="/struts-tags"%>
 <script>
 $(document).ready(function () {
-    $("#bring #documentName").focus();
+    $("#bring input[name='documentName']").focus();
+    <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");
+    </s:if>
 });
 </script>
 
 <!-- Import dialog
      =============================================================================================================================
   -->
-<div id=article-box>
-<div id=section><s:text name="title.import" /></div>
-<div id=article-body class=text>
-<table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
-       <tr height=25 valign=middle>
+<div id="article-box">
+<div id="section"><s:text name="title.import" /></div>
+<div id="article-body" class="text">
+<table width="100%" cellpadding="0" cellspacing="0" border="0"
+       class="text">
+       <tr height="25" valign="middle">
                <td><s:text name="message.upload">
                        <s:param>
                                <s:property value="%{fileName}" />
                        </s:param>
                </s:text></td>
        </tr>
-       <tr height=1 bgcolor=#AAAAAA>
+       <tr height="1" bgcolor="#AAAAAA">
                <td></td>
        </tr>
 </table>
 
 <form name="bring" id="bring" action="valid-import" method="post">
-<s:hidden name="fileName" value="%{fileName}" /> <s:hidden
-       name="reference" value="%{reference}" /> <s:hidden
+<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" value="%{version}" /> <s:hidden name="documentDate"
-       value="%{documentDate}" />
-<table cellpadding=0 cellspacing=0 border=0 class=text>
-       <tr height=15>
+       name="version" /> <s:hidden name="documentDate" />
+<table cellpadding="0" cellspacing="0" border="0" class="text">
+       <tr height="15">
                <td></td>
        </tr>
        <tr>
-               <td align=right><s:text name="field.documentype" />&nbsp;&nbsp;</td>
-               <td align=left>&nbsp;<s:text name="field.documentitle" /></td>
+               <td align="right"><s:text name="field.documentype" />&nbsp;&nbsp;</td>
+               <td align="left">&nbsp;<s:text name="field.documentitle" /></td>
        </tr>
        <tr>
-               <td>
-               <s:select theme="simple" name="documentType" list="documentTypes"
-                       listKey="index" listValue="%{getText('type.document.' + getName())}" />
-               &nbsp;</td>
-               <td><s:set var="setname" value="%{''}" /> <s:if
-                       test="%{reference != null}">
-                       <s:set var="setname" value="%{'disabled'}" />
-               </s:if> <input type="text" name="documentName" id="documentName" size="60"
-                       value="<s:property value="documentName"/>"
-                       <s:property value="%{#setname}"/> /></td>
+               <td><s:select theme="simple" name="documentType"
+                       list="documentTypes" listKey="index"
+                       listValue="%{getText('type.document.' + getName())}" /> &nbsp;</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>
        </tr>
        <s:if test="defaultDocumentUses.size > 0">
                <tr>
-                       <td align=right><s:text name="label.uses" />:</td>
+                       <td align="right"><s:text name="label.uses" />:</td>
                </tr>
                <s:iterator value="defaultDocumentUses">
                        <tr>
-                               <td align=right><input type="checkbox" name="uses"
+                               <td align="right"><input type="checkbox" name="uses"
                                        value="<s:property value="index"/>" checked></td>
                                <td><s:property value="title" /></td>
                        </tr>
                </s:iterator>
        </s:if>
-       <tr height=10>
+       <tr height="10">
                <td></td>
        </tr>
        <tr>
-               <td align=right><input type="submit" name="cancel"
-                       value="<s:text name="button.cancel"/>" />&nbsp;</td>
-               <td align=left><input type="submit" name="save"
-                       value="<s:text name="button.import"/>" /> <select
-                       name="documentState" <s:property value="%{#setname}"/>>
-                       <s:if test="documentState == 'EXTERN'">
-                               <option value="inWORK"><s:text name="label.inWORK" /></option>
-                               <option value="inDRAFT"><s:text name="label.inDRAFT" /></option>
-                               <option value="EXTERN" selected><s:text name="label.EXTERN" /></option>
-                       </s:if>
-                       <s:elseif test="documentState == 'inDRAFT'">
-                               <option value="inWORK"><s:text name="label.inWORK" /></option>
-                               <option value="inDRAFT" selected><s:text
-                                       name="label.inDRAFT" /></option>
-                               <option value="EXTERN"><s:text name="label.EXTERN" /></option>
-                       </s:elseif>
-                       <s:else>
-                               <option value="inWORK" selected><s:text name="label.inWORK" /></option>
-                               <option value="inDRAFT"><s:text name="label.inDRAFT" /></option>
-                               <option value="EXTERN"><s:text name="label.EXTERN" /></option>
-                       </s:else>
-               </select></td>
+               <td align="right"><s:submit theme="simple" name="cancel"
+                       key="button.cancel" />&nbsp;</td>
+               <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>
        </tr>
 </table>
 </form>
index a2fc8872dc8c3d2432679c802014365be9933924..301513c0b14ac83a267b0738cc6130b7fc43ad32 100644 (file)
@@ -1,38 +1,16 @@
 <%@page language="java" contentType="text/html; charset=ISO-8859-1"
     pageEncoding="ISO-8859-1"
 %>
-<%@page import="org.splat.som.ApplicationRights"%>
-<%@page import="java.util.ResourceBundle"%>
-<%@page import="java.text.SimpleDateFormat"%>
-<%@page import="org.splat.simer.Action"%>
-<%@page import="com.opensymphony.xwork2.ActionContext"%>
 <%@taglib prefix="s" uri="/struts-tags"%>
 
 <!-- Initialization of the context
      =============================================================================================================================
   -->
-<% 
-    ApplicationRights rights    = (ApplicationRights)session.getAttribute("user.rights");
-    Action anAction = (Action)ActionContext.getContext().getActionInvocation().getAction();
-    ResourceBundle    locale    = ResourceBundle.getBundle("som", 
-               anAction.getApplicationSettings().getCurrentLocale());
-    String            format    = locale.getString("date.format");
-    SimpleDateFormat  tostring  = new SimpleDateFormat(format);
-    String            result    = "uptodate";
-    boolean           connected = false;
-
-    if (rights.getUser() != null)                      connected = true;
-    if (session.getAttribute("search.result") == null) result    = "obsolete";
-%>
-
-<s:set var="user"><%=connected%></s:set>
-<s:set var="format"><%=format%></s:set>
-<s:set var="today"><%=tostring.format(java.util.Calendar.getInstance().getTime())%></s:set>
 <script language="JavaScript" type="text/javascript" src="../js/search.js"></script>
 
 <script>
 $(document).ready(function () {
-    initialize('<%=result%>');
+    initialize('<s:property value="resultState"/>');
 });
 </script>
 
@@ -43,49 +21,49 @@ $(document).ready(function () {
         <div id=section><s:text name="title.criteria"/></div>
         <div id="article-body">
           <form name="search" action="refresh-knowledge" method="post">
-          <input type=hidden name="contextIndex" />
+          <input type="hidden" name="contextIndex" />
           <s:set var="match1" value="criteriaMatch"/>
           <s:set var="match2" value="contextMatch"/>
           <s:set var="type"   value="state"/>
           <s:set var="him"    value="author"/>
 
-          <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
-            <tr height=20>
-              <td width=40%>
+          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+            <tr height="20">
+              <td width="40%">
                 <b><s:text name="field.among"/></b>&nbsp;&nbsp;&nbsp;
                 <s:if test="%{#match1 == 'all'}">
-                <input type=radio name="criteriaMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
+                <input type="radio" name="criteriaMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
                 &nbsp;
-                <input type=radio name="criteriaMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
+                <input type="radio" name="criteriaMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
                 </s:if><s:else>
-                <input type=radio name="criteriaMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
+                <input type="radio" name="criteriaMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
                 &nbsp;
-                <input type=radio name="criteriaMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
+                <input type="radio" name="criteriaMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
                 </s:else>
               </td>
-              <td width=60%>|&nbsp;&nbsp;
+              <td width="60%">|&nbsp;&nbsp;
                 <b><s:text name="field.context"/></b>&nbsp;&nbsp;&nbsp;
                 <s:if test="%{#match2 == 'all'}">
-                <input type=radio name="contextMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
+                <input type="radio" name="contextMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
                 &nbsp;
-                <input type=radio name="contextMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
+                <input type="radio" name="contextMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
                 </s:if><s:else>
-                <input type=radio name="contextMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
+                <input type="radio" name="contextMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
                 &nbsp;
-                <input type=radio name="contextMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
+                <input type="radio" name="contextMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
                 </s:else>
               </td>
             </tr>
-            <tr height=1 bgcolor=#AAAAAA><td colspan=2></td></tr>
+            <tr height="1" bgcolor="#AAAAAA"><td colspan="2"></td></tr>
           </table>
 
-          <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
-            <tr valign=top>
-              <td width=40%>
-              <table cellpadding=0 cellspacing=0 border=0 class=text>
+          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+            <tr valign="top">
+              <td width="40%">
+              <table cellpadding="0" cellspacing="0" border="0" class="text">
                 <tr>
-                  <td colspan=2><s:text name="criterion.knowledge"/>&nbsp;</td>
-                  <td colspan=3 align=center>
+                  <td colspan="2"><s:text name="criterion.knowledge"/>&nbsp;</td>
+                  <td colspan="3" align="center">
                 <select name="state" style="width: <s:text name="size.search.select"/>" onChange="changeFilter()">
                   <s:iterator value="knowledgeTypes">
                     <s:if test="%{index == #type}">
@@ -98,8 +76,8 @@ $(document).ready(function () {
                   </td>
                 </tr>
                 <tr>
-                  <td colspan=2><s:text name="criterion.author"/>&nbsp;</td>
-                  <td colspan=3 align=center>
+                  <td colspan="2"><s:text name="criterion.author"/>&nbsp;</td>
+                  <td colspan="3" align="center">
                 <select name="author" style="width: <s:text name="size.search.select"/>" onChange="changeFilter()">
                   <option value="0"><s:text name="criterion.anybody" /></option>
                   <s:iterator value="candidates">
@@ -115,33 +93,33 @@ $(document).ready(function () {
                 <tr>
                   <s:set var="tipdate">
                     <s:text name="help.search.date">
-                      <s:param><s:text name="%{#format}"/></s:param>
-                      <s:param><s:text name="%{#today}"/></s:param>
+                      <s:param><s:text name="%{format}"/></s:param>
+                      <s:param><s:text name="%{today}"/></s:param>
                     </s:text>
                   </s:set>
                   <td><s:text name="field.credate"/>&nbsp;</td>
                   <td><s:text name="field.after"/>&nbsp;</td>
-                  <td><input type=text name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
+                  <td><input type="text" name="after" size="7" onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
                   <td><s:text name="field.before"/>&nbsp;</td>
-                  <td><input type=text name=before size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
+                  <td><input type="text" name="before" size="7" onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
                 </tr>
                 <tr height=26><td></td></tr>
               </table>
-              <table cellpadding=0 cellspacing=0 border=0 class=text>
+              <table cellpadding="0" cellspacing="0" border="0" class="text">
                 <tr>
                   <td><s:text name="field.contain"/>:&nbsp;</td>
-                  <td><input type=text name=words style="width: <s:text name="size.search.input"/>" value="<s:property value="%{words}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.title"/>" /></td>
+                  <td><input type="text" name="words" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{words}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.title"/>" /></td>
                 </tr><tr>
                   <td><s:text name="field.reference"/>:&nbsp;</td>
-                  <td><input type=text name="reference" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{reference}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.refid"/>" /></td>
+                  <td><input type="text" name="reference" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{reference}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.refid"/>" /></td>
                 </tr>
               </table>
               </td>
-              <td width=60%>
-                <table cellpadding=0 cellspacing=0 border=0 class=text>
+              <td width="60%">
+                <table cellpadding="0" cellspacing="0" border="0" class="text">
                   <s:iterator value="simulationContexts">
                     <tr>
-                      <td><input type=checkbox checked onClick="removeContext('<s:property value="index"/>')">&nbsp;</td>
+                      <td><input type="checkbox" checked onClick="removeContext('<s:property value="index"/>')">&nbsp;</td>
                       <td>
                         <s:if test="%{type.isApproved()}"><s:text name="type.context.%{type.name}"/>:&nbsp;</s:if>
                         <s:else><s:property value="%{type.name}"/>:&nbsp;</s:else>
@@ -191,10 +169,10 @@ $(document).ready(function () {
             </tr>
           </table>
 
-          <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
+          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
             <tr>
-              <td width=40%></td>
-              <td width=60% align=left><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
+              <td width="40%"></td>
+              <td width="60%" align="left"><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
             </tr>
           </table>
 
@@ -205,23 +183,23 @@ $(document).ready(function () {
 <!-- Result list
      =============================================================================================================================
   -->
-      <div id=resulist>
-      <div id=article-box>
-        <div id=section><s:text name="title.result"/></div>
-        <div id=article-body class=text>
+      <div id="resulist">
+      <div id="article-box">
+        <div id="section"><s:text name="title.result"/></div>
+        <div id="article-body" class="text">
 
           <s:if test="result.size > 0">
-            <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
-            <tr height=20 valign=bottom>
-              <td width=20></td>
-              <td width=80><s:text name="label.reference"/></td>
+            <table width=100% cellpadding="0" cellspacing="0" border="0" class="text">
+            <tr height="20" valign="bottom">
+              <td width="20"></td>
+              <td width="80"><s:text name="label.reference"/></td>
               <td><s:text name="label.title"/><img src="<s:url value="/skin/icon.sortup.png"/>" border="none"/></td>
-              <td width=150><s:text name="label.author"/></td>
+              <td width="150"><s:text name="label.author"/></td>
             </tr>
-            <tr height=1 bgcolor=#AAAAAA><td colspan=4></td></tr>
+            <tr height="1" bgcolor="#AAAAAA"><td colspan="4"></td></tr>
               <s:iterator value="result">
                 <tr>
-                  <td><img src="<s:url value="/skin/icon.%{progressState}.png"/>" width=12 height=12 border="none" title=""/></td>
+                  <td><img src="<s:url value="/skin/icon.%{progressState}.png"/>" width="12" height="12" border="none" title=""/></td>
                   <td><s:property value="reference"/></td>
                   <td>
                       <s:url id="open" namespace="/study" action="open-knowledge?selection=0">
index 67166f5556169e0e3981f76210dfdb736898709a..b2280e124dc1766bf0b92fd8bcd72c9c3be4a2ad 100644 (file)
@@ -1,94 +1,72 @@
 <%@page language="java" contentType="text/html; charset=ISO-8859-1"
     pageEncoding="ISO-8859-1"
 %>
-<%@page import="org.splat.som.ApplicationRights"%>
-<%@page import="java.util.ResourceBundle"%>
-<%@page import="java.text.SimpleDateFormat"%>
-<%@page import="org.splat.simer.Action"%>
-<%@page import="com.opensymphony.xwork2.ActionContext"%>
 <%@taglib prefix="s" uri="/struts-tags"%>
 
 <!-- Initialization of the context
      =============================================================================================================================
   -->
-<%  
-    ApplicationRights rights    = (ApplicationRights)session.getAttribute("user.rights");
-    Action anAction = (Action)ActionContext.getContext().getActionInvocation().getAction();
-    ResourceBundle    locale    = ResourceBundle.getBundle("som", 
-               anAction.getApplicationSettings().getCurrentLocale());
-    String            format    = locale.getString("date.format");
-    SimpleDateFormat  tostring  = new SimpleDateFormat(format);
-    String            result    = "uptodate";
-    boolean           connected = false;
-
-    if (rights.getUser() != null)                      connected = true;
-    if (session.getAttribute("search.result") == null) result    = "obsolete";
-%>
-
-<s:set var="user"><%=connected%></s:set>
-<s:set var="format"><%=format%></s:set>
-<s:set var="today"><%=tostring.format(java.util.Calendar.getInstance().getTime())%></s:set>
 <script language="JavaScript" type="text/javascript" src="../js/search.js"></script>
 
 <script>
 $(document).ready(function () {
-    initialize('<%=result%>');
+    initialize('<s:property value="resultState"/>');
 });
 </script>
 
 <!-- Search criteria section
      =============================================================================================================================
   -->
-      <div id=article-box>
-        <div id=section><s:text name="title.criteria"/></div>
+      <div id="article-box">
+        <div id="section"><s:text name="title.criteria"/></div>
         <div id="article-body">
           <form name="search" action="refresh-study" method="post">
-          <input type=hidden name="contextIndex" />
+          <input type="hidden" name="contextIndex" />
           <s:set var="match1" value="criteriaMatch"/>
           <s:set var="match2" value="contextMatch"/>
           <s:set var="him"    value="author"/>
 
-          <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
-            <tr height=20>
-              <td width=40%>
+          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+            <tr height="20">
+              <td width="40%">
                 <b><s:text name="field.among"/></b>&nbsp;&nbsp;&nbsp;
                 <s:if test="%{#match1 == 'all'}">
-                <input type=radio name="criteriaMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
+                <input type="radio" name="criteriaMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
                 &nbsp;
-                <input type=radio name="criteriaMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
+                <input type="radio" name="criteriaMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
                 </s:if><s:else>
-                <input type=radio name="criteriaMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
+                <input type="radio" name="criteriaMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
                 &nbsp;
-                <input type=radio name="criteriaMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
+                <input type="radio" name="criteriaMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
                 </s:else>
               </td>
-              <td width=60%>|&nbsp;&nbsp;
+              <td width="60%">|&nbsp;&nbsp;
                 <b><s:text name="field.context"/></b>&nbsp;&nbsp;&nbsp;
                 <s:if test="%{#match2 == 'all'}">
-                <input type=radio name="contextMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
+                <input type="radio" name="contextMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
                 &nbsp;
-                <input type=radio name="contextMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
+                <input type="radio" name="contextMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
                 </s:if><s:else>
-                <input type=radio name="contextMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
+                <input type="radio" name="contextMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
                 &nbsp;
-                <input type=radio name="contextMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
+                <input type="radio" name="contextMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
                 </s:else>
               </td>
             </tr>
-            <tr height=1 bgcolor=#AAAAAA><td colspan=2></td></tr>
+            <tr height="1" bgcolor="#AAAAAA"><td colspan="2"></td></tr>
           </table>
 
-          <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
-            <tr valign=top>
-              <td width=40%>
-              <table cellpadding=0 cellspacing=0 border=0 class=text>
+          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+            <tr valign="top">
+              <td width="40%">
+              <table cellpadding="0" cellspacing="0" border="0" class="text">
                 <tr>
-                  <td colspan=2><s:text name="criterion.study"/>&nbsp;</td>
-                  <td colspan=3 align=center>
+                  <td colspan="2"><s:text name="criterion.study"/>&nbsp;</td>
+                  <td colspan="3" align="center">
                   <select name="state" style="width: <s:text name="size.search.select"/>" onChange="setState()">
                     <s:if test="state == 'ANY'">       <option value="ANY"        selected><s:text name="criterion.any" /></option></s:if>
                     <s:else>                           <option value="ANY"                ><s:text name="criterion.any" /></option></s:else>
-                    <s:if test="#user">
+                    <s:if test="connectedUser != null">
                       <s:if test="state == 'inWORK'">  <option value="inWORK"     selected><s:text name="criterion.inwork" /></option></s:if>
                       <s:else>                         <option value="inWORK"             ><s:text name="criterion.inwork" /></option></s:else>
                       <s:if test="state == 'inDRAFT'"> <option value="inDRAFT"    selected><s:text name="criterion.indraft" /></option></s:if>
@@ -104,8 +82,8 @@ $(document).ready(function () {
                   </td>
                 </tr>
                 <tr>
-                  <td colspan=2><s:text name="criterion.author"/>&nbsp;</td>
-                  <td colspan=3 align=center>
+                  <td colspan="2"><s:text name="criterion.author"/>&nbsp;</td>
+                  <td colspan="3" align="center">
                 <select name="author" style="width: <s:text name="size.search.select"/>" onChange="changeFilter()">
                   <option value="0"><s:text name="criterion.anybody" /></option>
                   <s:iterator value="candidates">
@@ -121,38 +99,38 @@ $(document).ready(function () {
                 <tr>
                   <s:set var="tipdate">
                     <s:text name="help.search.date">
-                      <s:param><s:text name="%{#format}"/></s:param>
-                      <s:param><s:text name="%{#today}"/></s:param>
+                      <s:param><s:text name="%{format}"/></s:param>
+                      <s:param><s:text name="%{today}"/></s:param>
                     </s:text>
                   </s:set>
                   <td><s:text name="field.credate"/>&nbsp;</td>
                   <td><s:text name="field.after"/>&nbsp;</td>
-                  <td><input type=text name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
+                  <td><input type="text" name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
                   <td><s:text name="field.before"/>&nbsp;</td>
-                  <td><input type=text name=before size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
+                  <td><input type="text" name=before size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
                 </tr><tr>
                   <td><s:text name="field.lasdate"/>&nbsp;</td>
                   <td><s:text name="field.after"/>&nbsp;</td>
-                  <td><input type=text name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
+                  <td><input type="text" name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
                   <td><s:text name="field.before"/>&nbsp;</td>
-                  <td><input type=text name="before" size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
+                  <td><input type="text" name="before" size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
                 </tr>
               </table>
-              <table cellpadding=0 cellspacing=0 border=0 class=text>
+              <table cellpadding="0" cellspacing="0" border="0" class="text">
                 <tr>
                   <td><s:text name="field.contain"/>:&nbsp;</td>
-                  <td><input type=text name=words style="width: <s:text name="size.search.input"/>" value="<s:property value="%{words}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.title"/>" /></td>
+                  <td><input type="text" name=words style="width: <s:text name="size.search.input"/>" value="<s:property value="%{words}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.title"/>" /></td>
                 </tr><tr>
                   <td><s:text name="field.reference"/>:&nbsp;</td>
-                  <td><input type=text name="reference" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{reference}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.refid"/>" /></td>
+                  <td><input type="text" name="reference" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{reference}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.refid"/>" /></td>
                 </tr>
               </table>
               </td>
-              <td width=60%>
-                <table cellpadding=0 cellspacing=0 border=0 class=text>
+              <td width="60%">
+                <table cellpadding="0" cellspacing="0" border="0" class="text">
                   <s:iterator value="simulationContexts">
                     <tr>
-                      <td><input type=checkbox checked onClick="removeContext('<s:property value="index"/>')">&nbsp;</td>
+                      <td><input type="checkbox" checked onClick="removeContext('<s:property value="index"/>')">&nbsp;</td>
                       <td>
                         <s:if test="%{type.isApproved()}"><s:text name="type.context.%{type.name}"/>:&nbsp;</s:if>
                         <s:else><s:property value="%{type.name}"/>:&nbsp;</s:else>
@@ -197,10 +175,10 @@ $(document).ready(function () {
             </tr>
           </table>
 
-          <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
+          <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
             <tr>
-              <td width=40%></td>
-              <td width=60% align=left><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
+              <td width="40%"></td>
+              <td width="60%" align="left"><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
             </tr>
           </table>
 
@@ -211,20 +189,20 @@ $(document).ready(function () {
 <!-- Result list
      =============================================================================================================================
   -->
-      <div id=resulist>
-      <div id=article-box>
-        <div id=section><s:text name="title.result"/></div>
-        <div id=article-body class=text>
+      <div id="resulist">
+      <div id="article-box">
+        <div id="section"><s:text name="title.result"/></div>
+        <div id="article-body" class="text">
 
           <s:if test="result.size > 0">
-            <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
-            <tr height=20 valign=bottom>
-              <td width=20></td>
-              <td width=80><s:text name="label.reference"/></td>
+            <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+            <tr height="20" valign="bottom">
+              <td width="20"></td>
+              <td width="80"><s:text name="label.reference"/></td>
               <td><s:text name="label.title"/><img src="<s:url value="/skin/icon.sortup.png"/>" border="none"/></td>
-              <td width=150><s:text name="label.manager"/></td>
+              <td width="150"><s:text name="label.manager"/></td>
             </tr>
-            <tr height=1 bgcolor=#AAAAAA><td colspan=4></td></tr>
+            <tr height="1" bgcolor="#AAAAAA"><td colspan="4"></td></tr>
               <s:iterator value="result">
                 <tr>
                   <td><img src="<s:url value="/skin/icon.%{progressState}.png"/>" width=12 height=12 border="none" title=""/></td>
index c966268f8016fa86ee21fbe7e34026c8f45f5c16..276ca13387f43b0d8268f37304f6298cc869dd0f 100644 (file)
@@ -1,5 +1,6 @@
 package org.splat.simer;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
@@ -16,6 +17,11 @@ import org.splat.service.dto.Proxy;
 import org.splat.service.technical.ProjectSettingsService;
 import org.splat.som.ApplicationRights;
 
+/**
+ * Base search action class used for searching studies and knowledge.
+ * 
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
 public abstract class AbstractSearchBaseAction extends Action {
 
        /**
@@ -58,6 +64,9 @@ public abstract class AbstractSearchBaseAction extends Action {
         * Current contexts search criteria.
         */
        protected transient List<SimulationContext> _context;
+       /**
+        * List of found objects.
+        */
        protected transient List<Proxy> _result;
        /**
         * Injected simulation context service.
@@ -69,6 +78,9 @@ public abstract class AbstractSearchBaseAction extends Action {
         */
        private UserService _userService;
 
+       /**
+        * Search action modes enumeration.
+        */
        enum UserAction {
                refreshResult, selectContextType, selectContextValue, cancelSelect, removeContext
        }
@@ -77,6 +89,11 @@ public abstract class AbstractSearchBaseAction extends Action {
        // Action methods
        // ==============================================================================================================================
 
+       /**
+        * Perform actions according to the current mode.
+        * 
+        * @return action result or ERROR if failed
+        */
        public String doSubmitForm() {
                // Identification of the user action
                UserAction action = UserAction.refreshResult;
@@ -118,6 +135,11 @@ public abstract class AbstractSearchBaseAction extends Action {
                return done;
        }
 
+       /**
+        * Add a selected context type to the search filter. Obsolete the current result if necessary.
+        * 
+        * @return "selectype"
+        */
        @SuppressWarnings("unchecked")
        protected String doSelectContextType() {
                SimulationContext.Properties sprop = new SimulationContext.Properties();
@@ -129,11 +151,17 @@ public abstract class AbstractSearchBaseAction extends Action {
                if (_cindex.length() > 0 && Integer.valueOf(_cindex) == 0) {
                        getSession().remove(RESULT_KEY);
                } else {
-                       _result = (List<Proxy>) getSession().get(RESULT_KEY); // We keep the previous result search, if valid
+                       // We keep the previous result search, if valid
+                       _result = (List<Proxy>) getSession().get(RESULT_KEY);
                }
                return "selectype";
        }
 
+       /**
+        * Add a selected context to the search filter. Obsolete the current result.
+        * 
+        * @return "refresh"
+        */
        protected String doAddContext() {
                SimulationContext selected = getSimulationContextService()
                                .selectSimulationContext(Integer.valueOf(_cvalue));
@@ -144,6 +172,11 @@ public abstract class AbstractSearchBaseAction extends Action {
                return "refresh";
        }
 
+       /**
+        * Remove context from the search filter.
+        * 
+        * @return "refresh"
+        */
        protected String doRemoveContext() {
                int index = Integer.valueOf(_cindex);
                for (Iterator<SimulationContext> selected = _context.iterator(); selected
@@ -158,6 +191,10 @@ public abstract class AbstractSearchBaseAction extends Action {
                return "refresh";
        }
 
+       /**
+        * 
+        * @return
+        */
        @SuppressWarnings("unchecked")
        protected String doCancel() {
                _result = (List<Proxy>) getSession().get(RESULT_KEY); // Current result search
@@ -169,6 +206,41 @@ public abstract class AbstractSearchBaseAction extends Action {
        // Getters
        // ==============================================================================================================================
 
+       /**
+        * Get date format string.
+        * 
+        * @return date format string
+        */
+       public String getFormat() {
+               return getText("date.format");
+       }
+
+       /**
+        * Get formatted today date as a string.
+        * 
+        * @return current date as a string
+        */
+       public String getToday() {
+               SimpleDateFormat tostring = new SimpleDateFormat(getFormat(),
+                               getApplicationSettings().getCurrentLocale());
+               return tostring.format(java.util.Calendar.getInstance().getTime());
+       }
+
+       /**
+        * Get search result state.
+        * 
+        * @return "obsolete" if there is no results in the session, otherwise "uptodate"
+        */
+       public String getResultState() {
+               String result;
+               if (getSession().get(RESULT_KEY) == null) {
+                       result = "obsolete";
+               } else {
+                       result = "uptodate";
+               }
+               return result;
+       }
+
        public String getAuthor() {
                return _author;
        }
@@ -193,6 +265,11 @@ public abstract class AbstractSearchBaseAction extends Action {
                return _context;
        }
 
+       /**
+        * Get list of found objects.
+        * 
+        * @return list of found objects
+        */
        public List<Proxy> getResult() {
                return _result;
        }
@@ -235,6 +312,12 @@ public abstract class AbstractSearchBaseAction extends Action {
                }
        }
 
+       /**
+        * Build available context types list with localized names.
+        * 
+        * @param critext
+        *            context types already used in the search filter
+        */
        protected void setContextTypeOptions(
                        final List<SimulationContextType> critext) {
                for (Iterator<SimulationContext> i = _context.iterator(); i.hasNext();) {
index faf4dfe9cf42146190b7c34253e4d36f6cb3652c..1b376a440f86e0cf9cba38fd38c945f4eed2c546 100644 (file)
@@ -38,7 +38,13 @@ public class ImportDocumentAction extends UploadBaseNextAction {
         */
        private static final long serialVersionUID = 2587822564883588556L;
 
+       /**
+        * Sorted list of document types for the selected study step.
+        */
        private transient List<DocumentType> _documentTypes = null;
+       /**
+        * The selected document type.
+        */
        private long _documentType = 0;
        /**
         * Reference extracted from the imported file, if exist.
@@ -109,7 +115,7 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                // Set the document type by default
                deftype = getApplicationSettings().getDefaultDocumentType(step, filext);
                if (deftype != null) {
-                       setDefaultDocumentType(Long.toString(deftype.getIndex()));
+                       setDefaultDocumentType(deftype.getIndex());
                }
                defuses = new ArrayList<Document>();
                state = ProgressState.inWORK;
@@ -196,7 +202,8 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                                                ResourceBundle locale = ResourceBundle.getBundle("som",
                                                                getApplicationSettings().getCurrentLocale());
                                                SimpleDateFormat check = new SimpleDateFormat(locale
-                                                               .getString("date.format"));
+                                                               .getString("date.format"),
+                                                               getApplicationSettings().getCurrentLocale());
                                                try {
                                                        check.parse(_documentDate);
                                                } catch (ParseException e) {
@@ -257,80 +264,82 @@ public class ImportDocumentAction extends UploadBaseNextAction {
         * @return SUCCESS if ok, "cancel" - if canceled, ERROR - if error
         */
        public String doImport() {
+               String result = ERROR;
 
                initializationScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU,
                                Constants.TRUE);
 
                if (action == ToDo.cancel) {
-                       return "cancel";
-               }
-               if (_documentType == 0) {
+                       result = "cancel";
+               } else if (_documentType == 0) {
                        setErrorCode("message.error.import.type");
 
                        initializationFullScreenContext(Constants.STUDY_MENU,
                                        Constants.STUDY_MENU, Constants.TRUE, Constants.NONE,
                                        Constants.STUDY_MENU);
-
-                       return ERROR;
-               }
-               try {
-                       // Getting user inputs
-                       mystudy = getOpenStudy();
-                       User user = getConnectedUser();
-                       Step step = mystudy.getSelectedStep();
-                       Date docdate = null;
-                       if (_documentDate.length() > 0) {
-                               ResourceBundle locale = ResourceBundle.getBundle("som",
-                                               getApplicationSettings().getCurrentLocale());
-                               SimpleDateFormat get = new SimpleDateFormat(locale
-                                               .getString("date.format"));
-                               docdate = get.parse(_documentDate);
-                       }
-                       // Creation of uses relations
-                       List<Long> uses = new ArrayList<Long>();
-                       if (docuses != null) {
-                               String[] list = docuses.split(",");
-                               for (int i = 0; i < list.length; i++) {
-                                       uses.add(Long.valueOf(list[i].trim()));
+               } else {
+                       try {
+                               // Getting user inputs
+                               mystudy = getOpenStudy();
+                               User user = getConnectedUser();
+                               Step step = mystudy.getSelectedStep();
+                               Date docdate = null;
+                               if (_documentDate.length() > 0) {
+                                       ResourceBundle locale = ResourceBundle.getBundle("som",
+                                                       getApplicationSettings().getCurrentLocale());
+                                       SimpleDateFormat get = new SimpleDateFormat(locale
+                                                       .getString("date.format"), getApplicationSettings()
+                                                       .getCurrentLocale());
+                                       docdate = get.parse(_documentDate);
                                }
-                       }
-                       if (LOG.isDebugEnabled()) {
-                               LOG
-                                               .debug("Document to be imported uses documents with following ids:");
-                               for (Long usesId : uses) {
-                                       LOG.debug("#" + usesId);
+                               // Creation of uses relations
+                               List<Long> uses = new ArrayList<Long>();
+                               if (docuses != null) {
+                                       String[] list = docuses.split(",");
+                                       for (int i = 0; i < list.length; i++) {
+                                               uses.add(Long.valueOf(list[i].trim()));
+                                       }
                                }
-                       }
-                       Publication addoc = getPublicationService().createDoc(
-                                       mystudy.getIndex(), step, _documentType, user.getIndex(),
-                                       filename, docname, state, _reference, _version, docdate,
-                                       uses);
+                               if (LOG.isDebugEnabled()) {
+                                       LOG
+                                                       .debug("Document to be imported uses documents with following ids:");
+                                       for (Long usesId : uses) {
+                                               LOG.debug("#" + usesId);
+                                       }
+                               }
+                               Publication addoc = getPublicationService().createDoc(
+                                               mystudy.getIndex(), step, _documentType,
+                                               user.getIndex(), filename, docname, state, _reference,
+                                               _version, docdate, uses);
 
-                       if (_reference.length() > 0) { // Importation of a not foreign document
-                               mystudy.updateSimulationContexts(); // In case of simulation contexts extracted from the imported document
+                               if (_reference.length() > 0) { // Importation of a not foreign document
+                                       mystudy.updateSimulationContexts(); // In case of simulation contexts extracted from the imported document
+                               }
+
+                               // Creation of derived the document formats
+                               // Document ndoc = addoc.value();
+                               // Converter send = getApplicationSettings().getConverter(ndoc.getType(), ndoc.getFormat());
+                               //
+                               // if (send != null) send.converts(addoc); // Asynchronous process
+
+                               mystudy.add(addoc); // Updates the presentation
+                               result = SUCCESS;
+                       } catch (FileNotFoundException error) {
+                               LOG.error("Reason:", error);
+                               setErrorCode("message.error.import.file");
+                       } catch (Exception error) {
+                               LOG.error("Reason:", error);
+                               setErrorCode("message.error.internal");
                        }
 
-                       // Creation of derived the document formats
-                       // Document ndoc = addoc.value();
-                       // Converter send = getApplicationSettings().getConverter(ndoc.getType(), ndoc.getFormat());
-                       //
-                       // if (send != null) send.converts(addoc); // Asynchronous process
-
-                       mystudy.add(addoc); // Updates the presentation
-                       return SUCCESS;
-               } catch (FileNotFoundException error) {
-                       LOG.error("Reason:", error);
-                       setErrorCode("message.error.import.file");
-               } catch (Exception error) {
-                       LOG.error("Reason:", error);
-                       setErrorCode("message.error.internal");
+                       if (!SUCCESS.equals(result)) {
+                               initializationFullScreenContext(Constants.STUDY_MENU,
+                                               Constants.STUDY_MENU, Constants.TRUE, Constants.NONE,
+                                               Constants.STUDY_MENU);
+                       }
                }
 
-               initializationFullScreenContext(Constants.STUDY_MENU,
-                               Constants.STUDY_MENU, Constants.TRUE, Constants.NONE,
-                               Constants.STUDY_MENU);
-
-               return ERROR;
+               return result;
        }
 
        // ==============================================================================================================================
@@ -346,6 +355,11 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                return _documentDate;
        }
 
+       /**
+        * Get sorted list of document types valid for the selected study step.
+        * 
+        * @return sorted list of document types
+        */
        public List<DocumentType> getDocumentTypes() {
                return _documentTypes;
        }
@@ -397,6 +411,12 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                this.docname = name; // Name entered by the user if enabled
        }
 
+       /**
+        * Set the default title if no title was defined.
+        * 
+        * @param name
+        *            the default document title
+        */
        public void setDocumentTitle(final String name) { // Called even if DocumentName is enabled
                if (this.docname == null) {
                        this.docname = name;
@@ -409,19 +429,31 @@ public class ImportDocumentAction extends UploadBaseNextAction {
         * @param value
         *            the id as string
         */
-       public void setDocumentType(final String value) {
-               this._documentType = Integer.valueOf(value);
+       public void setDocumentType(final Long value) {
+               this._documentType = value;
        }
 
+       /**
+        * Set the default state if no state was selected.
+        * 
+        * @param state
+        *            the default state
+        */
        public void setDefaultDocumentState(final String state) { // Called even if DocumentState is enabled
                if (this.state == null) {
                        this.state = ProgressState.valueOf(state);
                }
        }
 
-       public void setDefaultDocumentType(final String value) { // Called even if DocumentType is enabled
+       /**
+        * Set the default type if no type was selected.
+        * 
+        * @param value
+        *            the default document type id
+        */
+       public void setDefaultDocumentType(final Long value) { // Called even if DocumentType is enabled
                if (this._documentType == 0) {
-                       this._documentType = Integer.valueOf(value);
+                       this._documentType = value;
                }
        }
 
@@ -561,4 +593,17 @@ public class ImportDocumentAction extends UploadBaseNextAction {
                        final DocumentTypeService documentTypeService) {
                _documentTypeService = documentTypeService;
        }
+
+       /**
+        * Get sorted list of available document states.
+        * 
+        * @return the documentStates
+        */
+       public List<ProgressState> getDocumentStates() {
+               List<ProgressState> states = new ArrayList<ProgressState>();
+               states.add(ProgressState.inWORK);
+               states.add(ProgressState.inDRAFT);
+               states.add(ProgressState.EXTERN);
+               return states;
+       }
 }
\ No newline at end of file