Salome HOME
Readers section is improved.
[tools/siman.git] / Workspace / Siman / WebContent / study / editStudyProperties.jsp
1 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2     pageEncoding="ISO-8859-1"
3 %>
4 <%@ page import="java.util.Iterator"%>
5 <%@ page import="com.opensymphony.xwork2.util.ValueStack"%>
6 <%@ page import="com.opensymphony.xwork2.ActionContext"%>
7 <%@ page import="org.splat.simer.StudyPropertiesAction"%>
8 <%@ page import="org.splat.dal.bo.kernel.User"%>
9 <%@ taglib prefix="s" uri="/struts-tags"%>
10 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
11
12
13 <s:if test="actionType == null">
14         <s:set var="todo">display</s:set>
15 </s:if>
16 <s:else>
17         <s:set var="todo">
18                 <s:property value="actionType" />
19         </s:set>
20 </s:else>
21
22 <s:url id="edititle" namespace="/study" action="edit-title" />
23 <s:url id="edibutor" namespace="/study" action="edit-contributor" />
24 <s:url id="addcycle" namespace="/study" action="edit-cycle">
25   <s:param name="cycle" value="%{'default'}"/>
26 </s:url>
27 <s:url id="undo"     namespace="/study" action="prop-study" />
28 <html>
29
30   <head>
31     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
32     <link href=<s:url value="/skin/default.css"/> rel="stylesheet" type="text/css">
33     <script language="JavaScript">
34
35     function setType () {
36 //  -------------------
37       var type   = edit.documentType.value;
38 //    if (type == "0") edit.saveCycle.disabled = true;
39 //    else             edit.saveCycle.disabled = false;
40     }
41     </script>
42   </head>
43
44   <body>
45
46 <!-- Properties form
47      =============================================================================================================================
48   -->
49       <div id=article-box>
50         <div id=section>
51           <s:text name="title.prop.study" />
52         </div>
53         <div id=article-body class=text>
54
55           <form name="edit" action="valid-edit" method="post">
56           <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
57
58             <tr height=10><td width=20></td></tr>
59             <tr>
60               <td width=16><img src="<s:url value="/skin/image.downarrow.png"/>" border="none"/></td>
61               <td width=24%><b><s:text name="field.studytitle"/></b></td>
62               <td width=23%></td>
63               <td width=23%></td>
64               <td width=23%></td>
65               <td width=24></td>
66             </tr>
67             <tr height=5><td></td></tr>
68             <tr height=26>
69             
70             <s:if test="actionType eq 'edititle'">
71               <td>
72                 <s:a href="%{#undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="button.cancel"/>"/></s:a>
73               </td>
74               <td colspan=4>
75                 <input type=text size="108" name=title value="<s:property value="studyTitle"/>">
76               </td>
77               <td align=right>
78                 <button type="submit" name="saveTitle" value="" style="width:24px; height:16px; border:0; cursor:pointer; cursor:hand; background:transparent">
79                   <img src="<s:url value="/skin/image.export.png"/>" title="<s:text name="button.save"/>"/>
80                 </button>
81               </td>
82               </s:if>
83               <s:else>
84
85                   <td>
86                 <s:if test="#todo == 'display'"><s:a href="%{#edititle}"><img src="<s:url value="/skin/icon.ed.png"/>" border="none" title="<s:text name="tooltip.edit.title"/>"/></s:a></s:if>
87               </td>
88               <td colspan=4><s:property value="studyTitle"/></td>
89               </s:else>
90               
91                 </tr>
92             <tr height=10><td width=20></td></tr>
93             <tr>
94               <td><img src="<s:url value="/skin/image.downarrow.png"/>" border="none"/></td>
95               <td><b><s:text name="label.members"/></b></td>
96             </tr>
97             <tr height=5><td></td></tr>    
98             
99             <s:if test="actionType eq 'edibutor'">   
100             <tr>
101               <td>
102                 <s:a href="%{#undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="button.cancel"/>"/></s:a>
103               </td>
104               <td><s:text name="label.presents"/></td>
105               <td colspan=3><s:text name="label.absents"/></td>
106               <td align=right>
107                 <button type="submit" name="saveContributors" value="" style="width:24px; height:16px; border:0; cursor:pointer; cursor:hand; background:transparent">
108                   <img src="<s:url value="/skin/image.export.png"/>" title="<s:text name="button.save"/>"/>
109                 </button>
110               </td>
111             </tr>
112             <tr height=1 bgcolor=#AAAAAA><td colspan=6></td></tr>
113 <%
114 //    Scriptlet implementation is required due to specific iteration
115       ValueStack             stack     = ActionContext.getContext().getValueStack();
116       Object                 stacktop  = stack.peek();
117       StudyPropertiesAction  controler = (StudyPropertiesAction)stacktop;
118
119       Iterator<User>         members   = controler.getContributors().iterator();
120       for (Iterator<User>    staff     = controler.getCandidates().iterator(); staff.hasNext(); ) {
121         out.print("<tr>");
122           if (members.hasNext()) {
123             User  user = members.next();
124             out.print("<td><input type=checkbox name=\"members\" value=\"" + String.valueOf(String.valueOf(user.getIndex())) + "\" checked/></td>");
125             out.print("<td>");
126               out.print(user.toString());
127             out.print("</td>");
128           } else {
129             out.print("<td></td><td></td>");
130           }
131           for (int j=0; j<3; j++) {
132           if (staff.hasNext()) {
133                   User user = staff.next();
134             out.print("<td><input type=checkbox name=\"candidates\" value=\"" + String.valueOf(user.getIndex()) + "\" />&nbsp;");
135               out.print(user.toString());
136             out.print("</td>");
137           } else {
138             out.print("<td></td>");
139           }
140           }
141         out.print("</tr>");
142       }
143       while (members.hasNext()) {
144         User  user = members.next();
145         out.print("<tr>");
146           out.print("<td><input type=checkbox name=\"members\" value=\"" + String.valueOf(user.getIndex()) + "\" checked/></td>");
147           out.print("<td>");
148             out.print(user.toString());
149           out.print("</td>");
150         out.print("</tr>");
151       }%>
152       </s:if>
153           <s:else>
154           <tr>
155               <td></td>
156               <td><s:text name="label.contributor"/></td>
157               <td></td>
158               <td></td>
159               <td><s:text name="label.manager"/></td>
160             </tr>
161             <tr height=1 bgcolor=#AAAAAA><td colspan=6></td></tr>
162             <tr>
163               <td>
164                 <s:if test="#todo == 'display'"><s:a href="%{#edibutor}"><img src="<s:url value="/skin/icon.ed.png"/>" border="none" title="<s:text name="tooltip.edit.members"/>"/></s:a></s:if>
165               </td>
166               <td colspan=3>
167                     <s:if test="contributors.size > 0">
168                       <s:iterator value="contributors" status="counter">
169                         <s:if test="#counter.last"><s:property value="toString()"/></s:if>
170                         <s:else><s:property value="toString()"/>,</s:else>
171                       </s:iterator>
172                     </s:if><s:else>
173                       <s:property value="%{'-'}"/>
174                     </s:else>
175               </td>
176               <td><s:property value="%{author.toString()}"/></td>
177             </tr>
178             </s:else>
179
180         <!-- Readers functionality -->
181             <tr height=10><td width=20></td></tr>
182             <tr>
183               <td><img src="<s:url value="/skin/image.downarrow.png"/>" border="none"/></td>
184               <td><b><s:text name="label.readers.section"/></b></td>
185             </tr>
186             <tr height=5><td></td></tr>
187             
188             <s:if test="actionType eq 'editReaders'">
189                   <tr>
190                       <td>
191                         <s:a href="%{#undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="button.cancel"/>"/></s:a>
192                       </td>
193                       
194                       <td><s:text name="label.readers.present"/></td>
195                       <td colspan=3><s:text name="label.readers.absents"/></td>
196                       <td align=right>
197                         <button type="submit" name="saveReaders" value=""
198                             style="width:24px; height:16px; border:0; cursor:pointer; cursor:hand; background:transparent">
199                           <img src="<s:url value="/skin/image.export.png"/>" title="<s:text name="button.save"/>"/>
200                         </button>
201                       </td>
202                   </tr>
203                   <tr height=1 bgcolor=#AAAAAA><td colspan=6></td></tr>
204                   
205             
206               <tr>
207                 <td></td>
208                 <td valign="top">
209                   <table border="0" cellpadding="0" cellspacing="0">
210                   <s:iterator value="readers">
211                     <tr>
212                       <td>
213                         <s:checkbox name="readerIds" fieldValue="%{index}" theme="simple" checked="checked" /> &nbsp;
214                         <s:property value="%{displayName}"/>
215                       </td>
216                     </tr>
217                   </s:iterator>
218                   </table>
219                 </td>
220                 
221                 <td colspan="3" valign="top">
222                   <table border="0" cellpadding="0" cellspacing="0" width="100%">
223                     <tr>
224                       <s:iterator value="candidates" status="status">
225                         <td>
226                           <s:checkbox name="readerIds" fieldValue="%{index}" theme="simple"/> &nbsp;
227                           <s:property value="%{displayName}"/>
228                         </td>
229                         <s:if test="%{(#status.index + 1) % 3 == 0}">
230                             </tr>
231                             <tr>
232                         </s:if>
233                       </s:iterator>
234                     </tr>
235                   </table>
236                 </td>
237                   
238               </tr>
239             </s:if>
240             <s:else>
241               <tr><td/><td><s:text name="label.readers"/></td></tr>
242               <tr height=1 bgcolor=#AAAAAA><td colspan=6></td></tr>
243               <tr>
244                 <td>
245                   <s:if test="#todo == 'display'"> <s:a namespace="/study" action="init-edit-readers" >
246                       <img src="<s:url value="/skin/icon.ed.png"/>" border="none" 
247                             title="<s:text name="tooltip.edit.readers"/>"/>
248                   </s:a> </s:if>
249                 </td>
250                 <td colspan="4">
251                   <s:iterator value="readers" status="counter">
252                     <s:if test="#counter.last"><s:property value="%{displayName}"/></s:if>
253                     <s:else><s:property value="%{displayName}"/>,</s:else>
254                   </s:iterator>
255                 </td>
256               </tr>
257             </s:else>
258
259
260             <tr height=15><td width=20></td></tr>
261             <tr>
262               <td><img src="<s:url value="/skin/image.downarrow.png"/>" border="none"/></td>
263               <td><b><s:text name="label.approcycle"/></b></td>
264             </tr>
265             <tr height=5><td></td></tr>
266             <tr>
267               <td></td>
268               <td><s:text name="field.documentype"/></td>
269               <td><s:text name="label.PROMOTION"/></td>
270               <td><s:text name="label.REVIEW"/></td>
271               <td><s:text name="label.APPROVAL"/></td>
272             </tr>
273             <tr height=1 bgcolor=#AAAAAA><td colspan=6></td></tr>
274
275             <s:set var="edited" value="cycle"/>
276             <s:set var="height" value=""/>
277             <s:iterator value="validations" status="counter">
278             <s:url id="edicycle" namespace="/study" action="edit-cycle">
279               <s:param name="cycle" value="documentType"/>
280             </s:url>
281             <s:if test="#counter.last"><s:set var="height" value="24"/></s:if>
282             <tr height="<s:property value="#height"/>">
283               <td>
284                 <s:if test="#todo == 'display'">
285                   <s:if test="#counter.last">
286                     <s:if test="otherDocumentTypes.size > 0">
287                     <s:a href="%{#addcycle}">
288                       <img src="<s:url value="/skin/icon.ed.png"/>" border="none" title="<s:text name="tooltip.addvalidation"/>" />
289                     </s:a>
290                     </s:if>
291                   </s:if><s:else>
292                   <s:a href="%{#edicycle}">
293                     <img src="<s:url value="/skin/icon.ed.png"/>" border="none" title="<s:text name="tooltip.editvalidation"/>" />
294                   </s:a>
295                   </s:else>
296                 </s:if><s:elseif test="#todo == 'edicycle' && documentType == #edited">
297                   <s:a href="%{#undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="button.cancel"/>"/></s:a>
298                 </s:elseif>
299               </td>
300               <td>
301               <s:if test="#counter.last">
302                 <s:if test="#todo == 'edicycle' && documentType == #edited">
303                 <select name="documentType" onChange="setType()">
304                   <option value="0">&nbsp;<s:text name="menu.select"/></option>
305                   <s:iterator value="otherDocumentTypes">         
306                     <option value="<s:property value="index"/>"><s:text name="type.document.%{name}"/></option>
307                   </s:iterator>   
308                 </select>
309                 </s:if><s:else>
310                   <s:if test="validations.size > 0"><i><s:text name="label.other"/></i></s:if>
311                   <s:else><i><s:text name="label.all"/></i></s:else>
312                 </s:else>
313               </s:if><s:else>
314                 <s:if test="#todo == 'edicycle' && documentType == #edited">
315                   <input type="hidden" name="documentType" value="<s:property value="documentTypeIndex"/>"/>
316                 </s:if>
317                   <s:text name="type.document.%{documentType}"/>
318               </s:else>
319               </td>
320               <td>
321               <s:if test="#todo == 'edicycle' && documentType == #edited">
322                 <s:set var="selection" value="publisherIndex"/>
323                 <select name="publisher">
324                   <option value="0"><s:text name="label.bytheauthor"/></option>
325                   <s:if test="%{#selection != 0}"><option value="<s:property value="#selection"/>" selected><s:text name="label.me"/></option></s:if>
326                   <s:else><option value="<s:property value="author.index"/>"><s:text name="label.me"/></option></s:else>
327                 </select>
328               </s:if><s:else>
329                 <s:if test="publisherIndex > 0"><s:property value="publisherName"/></s:if>
330                 <s:else><i><s:property value="publisherName"/></i></s:else>
331               </s:else>
332               </td>
333               <td>
334               <s:if test="#todo == 'edicycle' && documentType == #edited">
335                 <s:set var="selection" value="reviewerIndex"/>
336                 <select name="reviewer">
337                   <option value="0">-&nbsp;<s:text name="label.skipped"/>&nbsp;-</option>
338                   <s:iterator value="validationActors">         
339                     <s:if test="%{index == #selection}"><option value="<s:property value="index"/>" selected><s:property value="toString()"/></option></s:if>
340                     <s:else><option value="<s:property value="index"/>"><s:property value="toString()"/></option></s:else>
341                   </s:iterator>   
342                 </select>
343               </s:if><s:else>
344                 <s:if test="reviewerIndex > 0"><s:property value="reviewerName"/></s:if>
345                 <s:else><font color="#A1A192"><i><s:property value="reviewerName"/></i></font></s:else>
346               </s:else>
347               </td>
348               <td>
349               <s:if test="#todo == 'edicycle' && documentType == #edited">
350                 <s:set var="selection" value="approverIndex"/>
351                 <select name="approver">
352                   <option value="0">-&nbsp;<s:text name="label.skipped"/>&nbsp;-</option>
353                   <s:iterator value="validationActors">         
354                     <s:if test="%{index == #selection}"><option value="<s:property value="index"/>" selected><s:property value="toString()"/></option></s:if>
355                     <s:else><option value="<s:property value="index"/>"><s:property value="toString()"/></option></s:else>
356                   </s:iterator>   
357                 </select>
358               </s:if><s:else>
359                 <s:if test="approverIndex > 0"><s:property value="approverName"/></s:if>
360                 <s:else><font color="#A1A192"><i><s:property value="approverName"/></i></font></s:else>
361               </s:else>
362               </td>
363               <td align=right>
364               <s:if test="#todo == 'edicycle' && documentType == #edited">
365                 <button type="submit" name="saveCycle" value="" style="width:24px; height:16px; border:0; cursor:pointer; cursor:hand; background:transparent">
366                   <img src="<s:url value="/skin/image.export.png"/>" title="<s:text name="button.save"/>"/>
367                 </button>
368               </s:if>
369               </td>
370             </tr>
371             </s:iterator>
372             <tr height=3><td></td></tr>
373             </table>
374           </form>
375         </div>
376       </div>
377
378   </body>
379 </html>