]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman/WebContent/study/searchStudy.jsp
Salome HOME
Fix for mantis #0022066: Search form not conform to specifications (SC03): The "I...
[tools/siman.git] / Workspace / Siman / WebContent / study / searchStudy.jsp
1 <%@page language="java" contentType="text/html; charset=ISO-8859-1"
2     pageEncoding="ISO-8859-1"
3 %>
4 <%@page import="org.splat.som.ApplicationRights"%>
5 <%@page import="java.util.ResourceBundle"%>
6 <%@page import="java.text.SimpleDateFormat"%>
7 <%@page import="org.splat.simer.Action"%>
8 <%@page import="com.opensymphony.xwork2.ActionContext"%>
9 <%@taglib prefix="s" uri="/struts-tags"%>
10
11 <!-- Initialization of the context
12      =============================================================================================================================
13   -->
14 <%  
15     ApplicationRights rights    = (ApplicationRights)session.getAttribute("user.rights");
16     Action anAction = (Action)ActionContext.getContext().getActionInvocation().getAction();
17     ResourceBundle    locale    = ResourceBundle.getBundle("som", 
18                 anAction.getApplicationSettings().getCurrentLocale());
19     String            format    = locale.getString("date.format");
20     SimpleDateFormat  tostring  = new SimpleDateFormat(format);
21     String            result    = "uptodate";
22     boolean           connected = false;
23
24     if (rights.getUser() != null)                      connected = true;
25     if (session.getAttribute("search.result") == null) result    = "obsolete";
26 %>
27
28 <s:set var="user"><%=connected%></s:set>
29 <s:set var="format"><%=format%></s:set>
30 <s:set var="today"><%=tostring.format(java.util.Calendar.getInstance().getTime())%></s:set>
31 <script language="JavaScript" type="text/javascript" src="../js/search.js"></script>
32
33 <script>
34 $(document).ready(function () {
35     initialize('<%=result%>');
36 });
37 </script>
38
39 <!-- Search criteria section
40      =============================================================================================================================
41   -->
42       <div id=article-box>
43         <div id=section><s:text name="title.criteria"/></div>
44         <div id="article-body">
45           <form name="search" action="refresh-study" method="post">
46           <input type=hidden name="contextIndex" />
47           <s:set var="match1" value="criteriaMatch"/>
48           <s:set var="match2" value="contextMatch"/>
49           <s:set var="him"    value="author"/>
50
51           <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
52             <tr height=20>
53               <td width=40%>
54                 <b><s:text name="field.among"/></b>&nbsp;&nbsp;&nbsp;
55                 <s:if test="%{#match1 == 'all'}">
56                 <input type=radio name="criteriaMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
57                 &nbsp;
58                 <input type=radio name="criteriaMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
59                 </s:if><s:else>
60                 <input type=radio name="criteriaMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
61                 &nbsp;
62                 <input type=radio name="criteriaMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
63                 </s:else>
64               </td>
65               <td width=60%>|&nbsp;&nbsp;
66                 <b><s:text name="field.context"/></b>&nbsp;&nbsp;&nbsp;
67                 <s:if test="%{#match2 == 'all'}">
68                 <input type=radio name="contextMatch" value="all"  checked onClick="changeFilter()"><s:text name="field.matchall"/>
69                 &nbsp;
70                 <input type=radio name="contextMatch" value="any"          onClick="changeFilter()"><s:text name="field.matchany"/>
71                 </s:if><s:else>
72                 <input type=radio name="contextMatch" value="all"          onClick="changeFilter()"><s:text name="field.matchall"/>
73                 &nbsp;
74                 <input type=radio name="contextMatch" value="any"  checked onClick="changeFilter()"><s:text name="field.matchany"/>
75                 </s:else>
76               </td>
77             </tr>
78             <tr height=1 bgcolor=#AAAAAA><td colspan=2></td></tr>
79           </table>
80
81           <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
82             <tr valign=top>
83               <td width=40%>
84               <table cellpadding=0 cellspacing=0 border=0 class=text>
85                 <tr>
86                   <td colspan=2><s:text name="criterion.study"/>&nbsp;</td>
87                   <td colspan=3 align=center>
88                   <select name="state" style="width: <s:text name="size.search.select"/>" onChange="setState()">
89                     <s:if test="state == 'ANY'">       <option value="ANY"        selected><s:text name="criterion.any" /></option></s:if>
90                     <s:else>                           <option value="ANY"                ><s:text name="criterion.any" /></option></s:else>
91                     <s:if test="#user">
92                       <s:if test="state == 'inWORK'">  <option value="inWORK"     selected><s:text name="criterion.inwork" /></option></s:if>
93                       <s:else>                         <option value="inWORK"             ><s:text name="criterion.inwork" /></option></s:else>
94                       <s:if test="state == 'inDRAFT'"> <option value="inDRAFT"    selected><s:text name="criterion.indraft" /></option></s:if>
95                       <s:else>                         <option value="inDRAFT"            ><s:text name="criterion.indraft" /></option></s:else>
96                       <s:if test="state == 'inCHECK'"> <option value="inCHECK"    selected><s:text name="criterion.incheck" /></option></s:if>
97                       <s:else>                         <option value="inCHECK"            ><s:text name="criterion.incheck" /></option></s:else>
98                     </s:if>
99                     <s:if test="state == 'APPROVED'">  <option value="APPROVED"   selected><s:text name="criterion.approved" /></option></s:if>
100                     <s:else>                           <option value="APPROVED"           ><s:text name="criterion.approved" /></option></s:else>
101                     <s:if test="state == 'TEMPLATE'">  <option value="TEMPLATE"   selected><s:text name="criterion.template" /></option></s:if>
102                     <s:else>                           <option value="TEMPLATE"           ><s:text name="criterion.template" /></option></s:else>
103                   </select>
104                   </td>
105                 </tr>
106                 <tr>
107                   <td colspan=2><s:text name="criterion.author"/>&nbsp;</td>
108                   <td colspan=3 align=center>
109                 <select name="author" style="width: <s:text name="size.search.select"/>" onChange="changeFilter()">
110                   <option value="0"><s:text name="criterion.anybody" /></option>
111                   <s:iterator value="candidates">
112                     <s:if test="%{index == #him}">
113                       <option value="<s:property value="index"/>" selected><s:property value="toString()"/></option>
114                     </s:if><s:else>
115                       <option value="<s:property value="index"/>"><s:property value="toString()"/></option>
116                     </s:else>
117                   </s:iterator>
118                 </select>
119                   </td>
120                 </tr>
121                 <tr>
122                   <s:set var="tipdate">
123                     <s:text name="help.search.date">
124                       <s:param><s:text name="%{#format}"/></s:param>
125                       <s:param><s:text name="%{#today}"/></s:param>
126                     </s:text>
127                   </s:set>
128                   <td><s:text name="field.credate"/>&nbsp;</td>
129                   <td><s:text name="field.after"/>&nbsp;</td>
130                   <td><input type=text name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
131                   <td><s:text name="field.before"/>&nbsp;</td>
132                   <td><input type=text name=before size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
133                 </tr><tr>
134                   <td><s:text name="field.lasdate"/>&nbsp;</td>
135                   <td><s:text name="field.after"/>&nbsp;</td>
136                   <td><input type=text name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" />&nbsp;</td>
137                   <td><s:text name="field.before"/>&nbsp;</td>
138                   <td><input type=text name="before" size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
139                 </tr>
140               </table>
141               <table cellpadding=0 cellspacing=0 border=0 class=text>
142                 <tr>
143                   <td><s:text name="field.contain"/>:&nbsp;</td>
144                   <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>
145                 </tr><tr>
146                   <td><s:text name="field.reference"/>:&nbsp;</td>
147                   <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>
148                 </tr>
149               </table>
150               </td>
151               <td width=60%>
152                 <table cellpadding=0 cellspacing=0 border=0 class=text>
153                   <s:iterator value="simulationContexts">
154                     <tr>
155                       <td><input type=checkbox checked onClick="removeContext('<s:property value="index"/>')">&nbsp;</td>
156                       <td>
157                         <s:if test="%{type.isApproved()}"><s:text name="type.context.%{type.name}"/>:&nbsp;</s:if>
158                         <s:else><s:property value="%{type.name}"/>:&nbsp;</s:else>
159                       </td>
160                       <td><s:property value="value"/></td>
161                     </tr>
162                   </s:iterator>
163
164                   <s:if test="%{actionType == 'setContext'}">
165                     <tr>
166                       <td>
167                         <img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="tooltip.cancel"/>" onClick="cancel()" />&nbsp;
168                       </td>
169                       <td>
170                         <s:if test="%{selectedContextType.isApproved()}"><s:text name="type.context.%{selectedContextType.name}"/>:&nbsp;</s:if>
171                         <s:else><s:property value="%{selectedContextType.name}"/>:&nbsp;</s:else>
172                       </td>
173                       <td>
174                         <select name="contextValue" onChange="submit()">
175                           <option value="-1"><s:text name="menu.select"/></option>
176                           <s:iterator value="contextValueOptions">
177                             <option value="<s:property value="index"/>">&nbsp;<s:property value="value" /></option>
178                           </s:iterator>
179                         </select>
180                       </td>
181                     </tr>
182                   </s:if>
183                 </table>
184
185                 <s:if test="%{actionType != 'setContext'}">
186                         <select name="contextType" onChange="submit()">
187                           <option value="-1"><s:text name="menu.addcontext"/></option>
188                           <s:iterator value="contextTypeOptions">
189                             <option value="<s:property value="index"/>">
190                               <s:if test="%{isApproved()}">&nbsp;<s:text name="type.context.%{name}" /></s:if>
191                               <s:else>&nbsp;<s:property value="%{name}" /></s:else>
192                             </option>
193                           </s:iterator>
194                         </select>
195                 </s:if>
196               </td>
197             </tr>
198           </table>
199
200           <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
201             <tr>
202               <td width=40%></td>
203               <td width=60% align=left><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
204             </tr>
205           </table>
206
207           </form>
208         </div>
209       </div>
210
211 <!-- Result list
212      =============================================================================================================================
213   -->
214       <div id=resulist>
215       <div id=article-box>
216         <div id=section><s:text name="title.result"/></div>
217         <div id=article-body class=text>
218
219           <s:if test="result.size > 0">
220             <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
221             <tr height=20 valign=bottom>
222               <td width=20></td>
223               <td width=80><s:text name="label.reference"/></td>
224               <td><s:text name="label.title"/><img src="<s:url value="/skin/icon.sortup.png"/>" border="none"/></td>
225               <td width=150><s:text name="label.manager"/></td>
226             </tr>
227             <tr height=1 bgcolor=#AAAAAA><td colspan=4></td></tr>
228               <s:iterator value="result">
229                 <tr>
230                   <td><img src="<s:url value="/skin/icon.%{progressState}.png"/>" width=12 height=12 border="none" title=""/></td>
231                   <td><s:property value="reference"/></td>
232                   <td>
233                       <s:url id="open" namespace="/study" action="open-study?selection=0.0">
234                         <s:param name="index" value="%{index}"/>
235                       </s:url>
236                       <s:a href="%{open}" cssClass="link"><s:property value="title"/></s:a>
237                   </td>
238                   <td><s:property value="authorName"/></td>
239                 </tr>
240               </s:iterator>
241             </table>
242           </s:if>
243
244           <s:else>
245             <s:text name="message.nostudy" />
246           </s:else>
247         </div>
248       </div>
249       </div>