]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Refactoring of study and knowledge search actions and appropriate search pages.
authorrkv <rkv@opencascade.com>
Thu, 28 Feb 2013 11:22:35 +0000 (11:22 +0000)
committerrkv <rkv@opencascade.com>
Thu, 28 Feb 2013 11:22:35 +0000 (11:22 +0000)
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/SearchKnowledgeAction.java
Workspace/Siman/src/org/splat/simer/SearchStudyAction.java

index 301513c0b14ac83a267b0738cc6130b7fc43ad32..22eec3fde8cb53f856c91710a09f3276ccb889cd 100644 (file)
 <script>
 $(document).ready(function () {
     initialize('<s:property value="resultState"/>');
+    // Apply jQueryUI datepicker to appropriate input fields
+    $(".dateinput").datepicker({
+        dateFormat: "<s:text name="date.format"/>".replace("MM","mm").replace("yyyy","yy")
+    });
 });
 </script>
 
@@ -22,36 +26,19 @@ $(document).ready(function () {
         <div id="article-body">
           <form name="search" action="refresh-knowledge" method="post">
           <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%">
                 <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"/>
-                &nbsp;
-                <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"/>
-                &nbsp;
-                <input type="radio" name="criteriaMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
-                </s:else>
+                <s:radio theme="simple" list="matchOptions" name="criteriaMatch"
+            onclick="changeFilter()" />
               </td>
               <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"/>
-                &nbsp;
-                <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"/>
-                &nbsp;
-                <input type="radio" name="contextMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
-                </s:else>
+                <s:radio theme="simple" list="matchOptions" name="contextMatch"
+            onclick="changeFilter()" />
               </td>
             </tr>
             <tr height="1" bgcolor="#AAAAAA"><td colspan="2"></td></tr>
@@ -81,7 +68,7 @@ $(document).ready(function () {
                 <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">
-                    <s:if test="%{index == #him}">
+                    <s:if test="%{index == author}">
                       <option value="<s:property value="index"/>" selected><s:property value="toString()"/></option>
                     </s:if><s:else>
                       <option value="<s:property value="index"/>"><s:property value="toString()"/></option>
@@ -99,9 +86,9 @@ $(document).ready(function () {
                   </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 class="dateinput" onChange="changeFilter()" 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 class="dateinput" onChange="changeFilter()" type="text" name="before" size="7" onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
                 </tr>
                 <tr height=26><td></td></tr>
               </table>
index 22499a3c320fc52b3bcaa9dc6b22fe822bb742b0..0c9f091e9368f57495c65d5bc55be47e2abcb1ab 100644 (file)
@@ -1,19 +1,19 @@
 <%@page language="java" contentType="text/html; charset=ISO-8859-1"
-    pageEncoding="ISO-8859-1"
-%>
+       pageEncoding="ISO-8859-1"%>
 <%@taglib prefix="s" uri="/struts-tags"%>
 
 <!-- Initialization of the context
      =============================================================================================================================
   -->
-<script language="JavaScript" type="text/javascript" src="../js/search.js"></script>
+<script language="JavaScript" type="text/javascript"
+       src="../js/search.js"></script>
 
 <script>
 $(document).ready(function () {
     initialize('<s:property value="resultState"/>');
     // Apply jQueryUI datepicker to appropriate input fields
     $(".dateinput").datepicker({
-        dateFormat: "<s:text name="%{format}"/>".replace("yyyy","yy")
+        dateFormat: "<s:text name="date.format"/>".replace("MM","mm").replace("yyyy","yy")
     });
 });
 </script>
@@ -21,211 +21,202 @@ $(document).ready(function () {
 <!-- Search criteria section
      =============================================================================================================================
   -->
-      <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" />
-          <s:set var="match1" value="criteriaMatch"/>
-          <s:set var="match2" value="contextMatch"/>
-          <s:set var="him"    value="author"/>
+<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" />
 
-          <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"/>
-                &nbsp;
-                <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"/>
-                &nbsp;
-                <input type="radio" name="criteriaMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
-                </s:else>
-              </td>
-              <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"/>
-                &nbsp;
-                <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"/>
-                &nbsp;
-                <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>
-          </table>
+<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:radio theme="simple" list="matchOptions" name="criteriaMatch"
+                       onclick="changeFilter()" /></td>
+               <td width="60%">|&nbsp;&nbsp; <b><s:text name="field.context" /></b>&nbsp;&nbsp;&nbsp;
+               <s:radio theme="simple" list="matchOptions" name="contextMatch"
+                       onclick="changeFilter()" /></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">
-                <tr>
-                  <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="changeFilter()">
-                    <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="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>
-                      <s:else>                         <option value="inDRAFT"            ><s:text name="criterion.indraft" /></option></s:else>
-                      <s:if test="state == 'inCHECK'"> <option value="inCHECK"    selected><s:text name="criterion.incheck" /></option></s:if>
-                      <s:else>                         <option value="inCHECK"            ><s:text name="criterion.incheck" /></option></s:else>
-                    </s:if>
-                    <s:if test="state == 'APPROVED'">  <option value="APPROVED"   selected><s:text name="criterion.approved" /></option></s:if>
-                    <s:else>                           <option value="APPROVED"           ><s:text name="criterion.approved" /></option></s:else>
-                    <s:if test="state == 'TEMPLATE'">  <option value="TEMPLATE"   selected><s:text name="criterion.template" /></option></s:if>
-                    <s:else>                           <option value="TEMPLATE"           ><s:text name="criterion.template" /></option></s:else>
-                  </select>
-                  </td>
-                </tr>
-                <tr>
-                  <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">
-                    <s:if test="%{index == #him}">
-                      <option value="<s:property value="index"/>" selected><s:property value="toString()"/></option>
-                    </s:if><s:else>
-                      <option value="<s:property value="index"/>"><s:property value="toString()"/></option>
-                    </s:else>
-                  </s:iterator>
-                </select>
-                  </td>
-                </tr>
-                <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:text>
-                  </s:set>
-                  <td><s:text name="field.credate"/>&nbsp;</td>
-                  <td><s:text name="field.after"/>&nbsp;</td>
-                  <td><input class="dateinput" onChange="changeFilter()" 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 class="dateinput" onChange="changeFilter()" 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 class="dateinput" onChange="changeFilter()" 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 class="dateinput" onChange="changeFilter()" 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">
-                <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>
-                </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>
-                </tr>
-              </table>
-              </td>
-              <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>
-                        <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>
-                      </td>
-                      <td><s:property value="value"/></td>
-                    </tr>
-                  </s:iterator>
+<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"><s:select name="state"
+                                       list="stateOptions" theme="simple"
+                                       size="%{getText(size.search.select)}" onchange="changeFilter()" />
+                               </td>
+                       </tr>
+                       <tr>
+                               <td colspan="2"><s:text name="criterion.author" />&nbsp;</td>
+                               <td colspan="3" align="center"><select name="author"
+                                       style='width: &amp; lt;' onChange="changeFilter()">
+                                       <option value="0"><s:text name="criterion.anybody" /></option>
+                                       <s:iterator value="candidates">
+                                               <s:if test="%{index == author}">
+                                                       <option value="<s:property value="index"/>" selected><s:property
+                                                               value="toString()" /></option>
+                                               </s:if>
+                                               <s:else>
+                                                       <option value="<s:property value="index"/>"><s:property
+                                                               value="toString()" /></option>
+                                               </s:else>
+                                       </s:iterator>
+                               </select></td>
+                       </tr>
+                       <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:text>
+                               </s:set>
+                               <td><s:text name="field.credate" />&nbsp;</td>
+                               <td><s:text name="field.after" />&nbsp;</td>
+                               <td><input class="dateinput" onChange="changeFilter()"
+                                       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 class="dateinput" onChange="changeFilter()"
+                                       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 class="dateinput" onChange="changeFilter()"
+                                       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 class="dateinput" onChange="changeFilter()"
+                                       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">
+                       <tr>
+                               <td><s:text name="field.contain" />:&nbsp;</td>
+                               <td><input type="text" name=words style='width: &amp; lt;'
+                                       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: &amp; lt;' 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">
+                       <s:iterator value="simulationContexts">
+                               <tr>
+                                       <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></td>
+                                       <td><s:property value="value" /></td>
+                               </tr>
+                       </s:iterator>
 
-                  <s:if test="%{actionType == 'setContext'}">
-                    <tr>
-                      <td>
-                        <img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" onClick="cancel()" />&nbsp;
-                      </td>
-                      <td>
-                        <s:if test="%{selectedContextType.isApproved()}"><s:text name="type.context.%{selectedContextType.name}"/>:&nbsp;</s:if>
-                        <s:else><s:property value="%{selectedContextType.name}"/>:&nbsp;</s:else>
-                      </td>
-                      <td>
-                        <select name="contextValue" onChange="submit()">
-                          <option value="-1"><s:text name="menu.select"/></option>
-                          <s:iterator value="contextValueOptions">
-                            <option value="<s:property value="index"/>">&nbsp;<s:property value="value" /></option>
-                          </s:iterator>
-                        </select>
-                      </td>
-                    </tr>
-                  </s:if>
-                </table>
+                       <s:if test="%{actionType == 'setContext'}">
+                               <tr>
+                                       <td><img src="<s:url value="/skin/icon.undo.png"/>"
+                                               border="none" title="<s:text name="tooltip.cancel"/>"
+                                               onClick="cancel()" />&nbsp;</td>
+                                       <td><s:if test="%{selectedContextType.isApproved()}">
+                                               <s:text name="type.context.%{selectedContextType.name}" />:&nbsp;</s:if>
+                                       <s:else>
+                                               <s:property value="%{selectedContextType.name}" />:&nbsp;</s:else></td>
+                                       <td><select name="contextValue" onChange="submit()">
+                                               <option value="-1"><s:text name="menu.select" /></option>
+                                               <s:iterator value="contextValueOptions">
+                                                       <option value="<s:property value="index"/>">&nbsp;<s:property
+                                                               value="value" /></option>
+                                               </s:iterator>
+                                       </select></td>
+                               </tr>
+                       </s:if>
+               </table>
 
-                <s:if test="%{actionType != 'setContext'}">
-                        <select name="contextType" onChange="submit()">
-                          <option value="-1"><s:text name="menu.addcontext"/></option>
-                          <s:iterator value="contextTypeOptions">
-                            <option value="<s:property value="index"/>">
-                              <s:if test="%{isApproved()}">&nbsp;<s:text name="type.context.%{name}" /></s:if>
-                              <s:else>&nbsp;<s:property value="%{name}" /></s:else>
-                            </option>
-                          </s:iterator>
-                        </select>
-                </s:if>
-              </td>
-            </tr>
-          </table>
+               <s:if test="%{actionType != 'setContext'}">
+                       <select name="contextType" onChange="submit()">
+                               <option value="-1"><s:text name="menu.addcontext" /></option>
+                               <s:iterator value="contextTypeOptions">
+                                       <option value="<s:property value="index"/>"><s:if
+                                               test="%{isApproved()}">&nbsp;<s:text
+                                                       name="type.context.%{name}" />
+                                       </s:if> <s:else>&nbsp;<s:property value="%{name}" />
+                                       </s:else></option>
+                               </s:iterator>
+                       </select>
+               </s:if></td>
+       </tr>
+</table>
 
-          <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>
-            </tr>
-          </table>
+<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>
+       </tr>
+</table>
 
-          </form>
-        </div>
-      </div>
+</form>
+</div>
+</div>
 
 <!-- Result list
      =============================================================================================================================
   -->
-      <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>
-              <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>
-            </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><s:property value="reference"/></td>
-                  <td>
-                      <s:url id="open" namespace="/study" action="open-study?selection=0.0">
-                        <s:param name="index" value="%{index}"/>
-                      </s:url>
-                      <s:a href="%{open}" cssClass="link"><s:property value="title"/></s:a>
-                  </td>
-                  <td><s:property value="authorName"/></td>
-                </tr>
-              </s:iterator>
-            </table>
-          </s:if>
-
-          <s:else>
-            <s:text name="message.nostudy" />
-          </s:else>
-        </div>
-      </div>
-      </div>
+<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>
+                       <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>
+               </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><s:property value="reference" /></td>
+                               <td><s:url id="open" namespace="/study"
+                                       action="open-study?selection=0.0">
+                                       <s:param name="index" value="%{index}" />
+                               </s:url> <s:a href="%{open}" cssClass="link">
+                                       <s:property value="title" />
+                               </s:a></td>
+                               <td><s:property value="authorName" /></td>
+                       </tr>
+               </s:iterator>
+       </table>
+</s:if> <s:else>
+       <s:text name="message.nostudy" />
+</s:else></div>
+</div>
+</div>
index 0e76bbaa42d49e9a3a7a39146382826d7dd284f4..b230240ae74ef527a09b8dae23d6f8dcf2695d1b 100644 (file)
@@ -4,7 +4,9 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.splat.dal.bo.kernel.User;
 import org.splat.dal.bo.som.SimulationContext;
@@ -28,12 +30,10 @@ public abstract class AbstractSearchBaseAction extends Action {
         * Serial version ID.
         */
        private static final long serialVersionUID = 7863055790228544510L;
-
        /**
         * Search result key in the session.
         */
        public static final String RESULT_KEY = "search.result";
-
        /**
         * Context type index, when selected.
         */
@@ -46,7 +46,13 @@ public abstract class AbstractSearchBaseAction extends Action {
         * Context index, when removed.
         */
        protected transient String _cindex = "";
+       /**
+        * Study author to search.
+        */
        protected String _author = null;
+       /**
+        * List of users who can create studies.
+        */
        protected List<Name> _candidates = null;
        /**
         * Context type to be valued.
@@ -77,6 +83,18 @@ public abstract class AbstractSearchBaseAction extends Action {
         * Injected user service.
         */
        private UserService _userService;
+       /**
+        * Simulation context match: "all" or "any".
+        */
+       private String _contextMatch = null;
+       /**
+        * Criteria match: "all" or "any".
+        */
+       private String _criteriaMatch = null;
+       /**
+        * Full text search words.
+        */
+       private String _words = null;
 
        /**
         * Search action modes enumeration.
@@ -319,6 +337,10 @@ public abstract class AbstractSearchBaseAction extends Action {
                this._cindex = value;
        }
 
+       /**
+        * Build the list of study authors. If the current user also can create <BR>
+        * a study then it is placed on the top of the list.
+        */
        protected void setCandidates() {
                _candidates = new ArrayList<Name>();
                List<User> users = getUserService().selectAllUsers();
@@ -358,15 +380,13 @@ public abstract class AbstractSearchBaseAction extends Action {
                int to = 0;
                while (to < types.length - 1) {
                        to += 1;
-                       if (types[to].isAttachedTo(step)) {
-                               continue;
-                       }
-
-                       if (to > from + 1) {
-                               Arrays.sort(types, from, to, compare);
+                       if (!types[to].isAttachedTo(step)) {
+                               if (to > from + 1) {
+                                       Arrays.sort(types, from, to, compare);
+                               }
+                               from = to;
+                               step = getSimulationContextService().getAttachedStep(types[to]);
                        }
-                       from = to;
-                       step = getSimulationContextService().getAttachedStep(types[to]);
                }
                if (to > from) {
                        Arrays.sort(types, from, to + 1, compare);
@@ -386,6 +406,22 @@ public abstract class AbstractSearchBaseAction extends Action {
 
        protected abstract void saveFilter();
 
+       // ==============================================================================================================================
+       // Getters and Setters
+       // ==============================================================================================================================
+       
+       /**
+        * Get match options.
+        * 
+        * @return array of options with key and value properties
+        */
+       public Map<String, String> getMatchOptions() {
+               Map<String, String> options = new LinkedHashMap<String, String>();
+               options.put("all", getText("field.matchall"));
+               options.put("any", getText("field.matchany"));
+               return options;
+       }
+
        /**
         * Get the simulationContextService.
         * 
@@ -424,4 +460,28 @@ public abstract class AbstractSearchBaseAction extends Action {
        public void setUserService(final UserService userService) {
                _userService = userService;
        }
+
+       public String getContextMatch() {
+               return _contextMatch;
+       }
+
+       public String getCriteriaMatch() {
+               return _criteriaMatch;
+       }
+       
+       public void setContextMatch(final String value) {
+               this._contextMatch = value;
+       }
+
+       public void setCriteriaMatch(final String value) {
+               this._criteriaMatch = value;
+       }
+
+       public String getWords() {
+               return _words;
+       }
+
+       public void setWords(final String value) {
+               this._words = value;
+       }
 }
\ No newline at end of file
index 035efd157a379e5fb87922baaf4bb453a7d559a0..522480659162fd02489b9bfceb4c2e4f407e0d25 100644 (file)
@@ -29,22 +29,10 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
         * Knowledge type index when among all.
         */
        private String _state = null;
-       /**
-        * Criteria match: "all" or "any".
-        */
-       private String _criteriaMatch = null;
-       /**
-        * Simulation context match: "all" or "any".
-        */
-       private String _contextMatch = null;
        /**
         * Knowledge reference when among ref.
         */
        private String _reference = null;
-       /**
-        * Full text search words.
-        */
-       private String _words = null;
        /**
         * Available knowledge types filter (initialized below).
         */
@@ -100,8 +88,8 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
                // Search matching all criteria
                sprop.setType(getKnowledgeElementTypeService().selectType(
                                Integer.valueOf(_state)));
-               if (_words.length() > 0) {
-                       sprop.setTitle(_words);
+               if (getWords().length() > 0) {
+                       sprop.setTitle(getWords());
                }
                if (_reference.length() > 0) {
                        sprop.setReference(_reference);
@@ -131,14 +119,6 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
        // Getters
        // ==============================================================================================================================
 
-       public String getContextMatch() {
-               return _contextMatch;
-       }
-
-       public String getCriteriaMatch() {
-               return _criteriaMatch;
-       }
-
        public List<KnowledgeElementType> getKnowledgeTypes() {
                return _knowledgeTypes;
        }
@@ -151,22 +131,6 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
                return _state;
        }
 
-       public String getWords() {
-               return _words;
-       }
-
-       // ==============================================================================================================================
-       // Setters
-       // ==============================================================================================================================
-
-       public void setContextMatch(final String value) {
-               this._contextMatch = value;
-       }
-
-       public void setCriteriaMatch(final String value) {
-               this._criteriaMatch = value;
-       }
-
        public void setReference(final String value) {
                this._reference = value;
        }
@@ -175,14 +139,6 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
                this._state = value;
        }
 
-       public void setWords(final String value) {
-               this._words = value;
-       }
-
-       // ==============================================================================================================================
-       // Implementation of abstract services
-       // ==============================================================================================================================
-
        @Override
        protected List<SimulationContextType> getInvolvedContexts() {
                return getSimulationContextService().selectAllTypes();
@@ -195,12 +151,12 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
                Map<String, Object> filter = (Map<String, Object>) session
                                .get("knowledge.filter"); // A default filter is supposed being set at start
 
-               _criteriaMatch = (String) filter.get("matchamong");
-               _contextMatch = (String) filter.get("matcontext");
+               setCriteriaMatch ((String) filter.get("matchamong"));
+               setContextMatch ((String) filter.get("matcontext"));
                _state = (String) filter.get("type");
                _author = (String) filter.get("author");
                _reference = (String) filter.get("reference");
-               _words = (String) filter.get("title");
+               setWords ((String) filter.get("title"));
                _context = (List<SimulationContext>) filter.get("context");
        }
 
@@ -211,12 +167,12 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction {
                Map<String, Object> filter = (Map<String, Object>) session
                                .get("knowledge.filter"); // A default filter is supposed being set at start
 
-               filter.put("matchamong", this._criteriaMatch);
-               filter.put("matcontext", this._contextMatch);
+               filter.put("matchamong", getCriteriaMatch());
+               filter.put("matcontext", getContextMatch());
                filter.put("type", this._state);
                filter.put("author", this._author);
                filter.put("reference", "");
-               filter.put("title", this._words);
+               filter.put("title", getWords());
 
                _context = (List<SimulationContext>) filter.get("context"); // Only criteria not part of the form
 
index b331929ba5a7540eeccd5a38af463feec97f18ea..070c1de8773c6e23fbcf6a4f13adf64b56e839c5 100644 (file)
@@ -1,5 +1,6 @@
 package org.splat.simer;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -27,22 +28,10 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
         * "In-Work", "In-Draft", "In-Check"...
         */
        private String _state = null;
-       /**
-        * Criteria match: "all" or "any".
-        */
-       private String _criteriaMatch = null;
-       /**
-        * Simulation context match: "all" or "any".
-        */
-       private String _contextMatch = null;
        /**
         * Study reference.
         */
        private String _reference = null;
-       /**
-        * Full text search words.
-        */
-       private String _words = null;
        /**
         * Injected project settings service.
         */
@@ -102,8 +91,8 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
                if (!this._state.equals("ANY")) {
                        sprop.setState(ProgressState.valueOf(this._state));
                }
-               if (_words.length() > 0) {
-                       sprop.setTitle(_words);
+               if (getWords().length() > 0) {
+                       sprop.setTitle(getWords());
                }
                if (_reference.length() > 0) {
                        sprop.setReference(_reference);
@@ -119,8 +108,8 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
                sprop.setActor(getConnectedUser());
 
                _result = getSearchService().selectStudiesWhere(
-                               "all".equals(_criteriaMatch), "all".equals(_contextMatch),
-                               sprop);
+                               "all".equals(getCriteriaMatch()),
+                               "all".equals(getContextMatch()), sprop);
                session.put(RESULT_KEY, _result); // For redisplaying the page without re-executing the search
                return "refresh";
        }
@@ -129,14 +118,6 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
        // Getters
        // ==============================================================================================================================
 
-       public String getContextMatch() {
-               return _contextMatch;
-       }
-
-       public String getCriteriaMatch() {
-               return _criteriaMatch;
-       }
-
        public String getReference() {
                return _reference;
        }
@@ -145,22 +126,6 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
                return _state;
        }
 
-       public String getWords() {
-               return _words;
-       }
-
-       // ==============================================================================================================================
-       // Setters
-       // ==============================================================================================================================
-
-       public void setContextMatch(final String value) {
-               this._contextMatch = value;
-       }
-
-       public void setCriteriaMatch(final String value) {
-               this._criteriaMatch = value;
-       }
-
        public void setReference(final String value) {
                this._reference = value;
        }
@@ -169,14 +134,6 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
                this._state = value;
        }
 
-       public void setWords(final String value) {
-               this._words = value;
-       }
-
-       // ==============================================================================================================================
-       // Implementation of abstract services
-       // ==============================================================================================================================
-
        @Override
        protected List<SimulationContextType> getInvolvedContexts() {
                List<ProjectSettingsService.Step> steps = getProjectSettings()
@@ -194,12 +151,12 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
                Map<String, Object> filter = (Map<String, Object>) session
                                .get("study.filter"); // A default filter is supposed being set at start
 
-               _criteriaMatch = (String) filter.get("matchamong");
-               _contextMatch = (String) filter.get("matcontext");
+               setCriteriaMatch((String) filter.get("matchamong"));
+               setContextMatch((String) filter.get("matcontext"));
                _state = (String) filter.get("state");
                _author = (String) filter.get("author");
                _reference = (String) filter.get("reference");
-               _words = (String) filter.get("title");
+               setWords((String) filter.get("title"));
                _context = (List<SimulationContext>) filter.get("context");
        }
 
@@ -210,17 +167,48 @@ public class SearchStudyAction extends AbstractSearchBaseAction {
                Map<String, Object> filter = (Map<String, Object>) session
                                .get("study.filter"); // A default filter is supposed being set at start
 
-               filter.put("matchamong", this._criteriaMatch);
-               filter.put("matcontext", this._contextMatch);
+               filter.put("matchamong", getCriteriaMatch());
+               filter.put("matcontext", getContextMatch());
                filter.put("state", this._state);
                filter.put("author", this._author);
                filter.put("reference", this._reference);
-               filter.put("title", this._words);
+               filter.put("title", getWords());
 
                _context = (List<SimulationContext>) filter.get("context"); // Only criteria not part of the form
 
        }
 
+       /**
+        * Get match options.
+        * 
+        * @return array of options with key and value properties
+        */
+       public Map<String, String> getStateOptions() {
+               Map<String, String> options = new LinkedHashMap<String, String>();
+               addStateOption(options, "ANY");
+               if (getConnectedUser() != null) {
+                       addStateOption(options, ProgressState.inWORK.name());
+                       addStateOption(options, ProgressState.inDRAFT.name());
+                       addStateOption(options, ProgressState.inCHECK.name());
+               }
+               addStateOption(options, ProgressState.APPROVED.name());
+               addStateOption(options, ProgressState.TEMPLATE.name());
+               return options;
+       }
+
+       /**
+        * Add a state and its translation to the list (map) of options.
+        * 
+        * @param options
+        *            the map of options
+        * @param state
+        *            the state to add
+        */
+       private void addStateOption(final Map<String, String> options,
+                       final String state) {
+               options.put(state, getText("criterion." + state.toLowerCase()));
+       }
+
        /**
         * Get the searchService.
         *