Salome HOME
Tiles is added
[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=main-pane>
50       <div id=article-box>
51         <div id=section>
52           <s:text name="title.prop.study" />
53         </div>
54         <div id=article-body class=text>
55
56           <form name="edit" action="valid-edit" method="post">
57           <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
58
59             <tr height=10><td width=20></td></tr>
60             <tr>
61               <td width=16><img src="<s:url value="/skin/image.downarrow.png"/>" border="none"/></td>
62               <td width=24%><b><s:text name="field.studytitle"/></b></td>
63               <td width=23%></td>
64               <td width=23%></td>
65               <td width=23%></td>
66               <td width=24></td>
67             </tr>
68             <tr height=5><td></td></tr>
69             <tr height=26>
70             
71             <s:if test="actionType eq 'edititle'">
72               <td>
73                 <s:a href="%{#undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="button.cancel"/>"/></s:a>
74               </td>
75               <td colspan=4>
76                 <input type=text size="108" name=title value="<s:property value="studyTitle"/>">
77               </td>
78               <td align=right>
79                 <button type="submit" name="saveTitle" value="" style="width:24px; height:16px; border:0; cursor:pointer; cursor:hand; background:transparent">
80                   <img src="<s:url value="/skin/image.export.png"/>" title="<s:text name="button.save"/>"/>
81                 </button>
82               </td>
83               </s:if>
84               <s:else>
85
86                   <td>
87                 <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>
88               </td>
89               <td colspan=4><s:property value="studyTitle"/></td>
90               </s:else>
91               
92                 </tr>
93             <tr height=10><td width=20></td></tr>
94             <tr>
95               <td><img src="<s:url value="/skin/image.downarrow.png"/>" border="none"/></td>
96               <td><b><s:text name="label.members"/></b></td>
97             </tr>
98             <tr height=5><td></td></tr>    
99             
100             <s:if test="actionType eq 'edibutor'">   
101             <tr>
102               <td>
103                 <s:a href="%{#undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="button.cancel"/>"/></s:a>
104               </td>
105               <td><s:text name="label.presents"/></td>
106               <td colspan=3><s:text name="label.absents"/></td>
107               <td align=right>
108                 <button type="submit" name="saveContributors" value="" style="width:24px; height:16px; border:0; cursor:pointer; cursor:hand; background:transparent">
109                   <img src="<s:url value="/skin/image.export.png"/>" title="<s:text name="button.save"/>"/>
110                 </button>
111               </td>
112             </tr>
113             <tr height=1 bgcolor=#AAAAAA><td colspan=6></td></tr>
114 <%
115 //    Scriptlet implementation is required due to specific iteration
116       ValueStack             stack     = ActionContext.getContext().getValueStack();
117       Object                 stacktop  = stack.peek();
118       StudyPropertiesAction  controler = (StudyPropertiesAction)stacktop;
119
120       Iterator<User>         members   = controler.getContributors().iterator();
121       for (Iterator<User>    staff     = controler.getCandidates().iterator(); staff.hasNext(); ) {
122         out.print("<tr>");
123           if (members.hasNext()) {
124             User  user = members.next();
125             out.print("<td><input type=checkbox name=\"members\" value=\"" + String.valueOf(String.valueOf(user.getIndex())) + "\" checked/></td>");
126             out.print("<td>");
127               out.print(user.toString());
128             out.print("</td>");
129           } else {
130             out.print("<td></td><td></td>");
131           }
132           for (int j=0; j<3; j++) {
133           if (staff.hasNext()) {
134                   User user = staff.next();
135             out.print("<td><input type=checkbox name=\"candidates\" value=\"" + String.valueOf(user.getIndex()) + "\" />&nbsp;");
136               out.print(user.toString());
137             out.print("</td>");
138           } else {
139             out.print("<td></td>");
140           }
141           }
142         out.print("</tr>");
143       }
144       while (members.hasNext()) {
145         User  user = members.next();
146         out.print("<tr>");
147           out.print("<td><input type=checkbox name=\"members\" value=\"" + String.valueOf(user.getIndex()) + "\" checked/></td>");
148           out.print("<td>");
149             out.print(user.toString());
150           out.print("</td>");
151         out.print("</tr>");
152       }%>
153       </s:if>
154           <s:else>
155           <tr>
156               <td></td>
157               <td><s:text name="label.contributor"/></td>
158               <td></td>
159               <td></td>
160               <td><s:text name="label.manager"/></td>
161             </tr>
162             <tr height=1 bgcolor=#AAAAAA><td colspan=6></td></tr>
163             <tr>
164               <td>
165                 <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>
166               </td>
167               <td colspan=3>
168                     <s:if test="contributors.size > 0">
169                       <s:iterator value="contributors" status="counter">
170                         <s:if test="#counter.last"><s:property value="toString()"/></s:if>
171                         <s:else><s:property value="toString()"/>,</s:else>
172                       </s:iterator>
173                     </s:if><s:else>
174                       <s:property value="%{'-'}"/>
175                     </s:else>
176               </td>
177               <td><s:property value="%{author.toString()}"/></td>
178             </tr>
179             </s:else>
180
181             <tr height=15><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.approcycle"/></b></td>
185             </tr>
186             <tr height=5><td></td></tr>
187             <tr>
188               <td></td>
189               <td><s:text name="field.documentype"/></td>
190               <td><s:text name="label.PROMOTION"/></td>
191               <td><s:text name="label.REVIEW"/></td>
192               <td><s:text name="label.APPROVAL"/></td>
193             </tr>
194             <tr height=1 bgcolor=#AAAAAA><td colspan=6></td></tr>
195
196             <s:set var="edited" value="cycle"/>
197             <s:set var="height" value=""/>
198             <s:iterator value="validations" status="counter">
199             <s:url id="edicycle" namespace="/study" action="edit-cycle">
200               <s:param name="cycle" value="documentType"/>
201             </s:url>
202             <s:if test="#counter.last"><s:set var="height" value="24"/></s:if>
203             <tr height="<s:property value="#height"/>">
204               <td>
205                 <s:if test="#todo == 'display'">
206                   <s:if test="#counter.last">
207                     <s:if test="otherDocumentTypes.size > 0">
208                     <s:a href="%{#addcycle}">
209                       <img src="<s:url value="/skin/icon.ed.png"/>" border="none" title="<s:text name="tooltip.addvalidation"/>" />
210                     </s:a>
211                     </s:if>
212                   </s:if><s:else>
213                   <s:a href="%{#edicycle}">
214                     <img src="<s:url value="/skin/icon.ed.png"/>" border="none" title="<s:text name="tooltip.editvalidation"/>" />
215                   </s:a>
216                   </s:else>
217                 </s:if><s:elseif test="#todo == 'edicycle' && documentType == #edited">
218                   <s:a href="%{#undo}"><img src="<s:url value="/skin/icon.undo.png"/>" border="none" title="<s:text name="button.cancel"/>"/></s:a>
219                 </s:elseif>
220               </td>
221               <td>
222               <s:if test="#counter.last">
223                 <s:if test="#todo == 'edicycle' && documentType == #edited">
224                 <select name="documentType" onChange="setType()">
225                   <option value="0">&nbsp;<s:text name="menu.select"/></option>
226                   <s:iterator value="otherDocumentTypes">         
227                     <option value="<s:property value="index"/>"><s:text name="type.document.%{name}"/></option>
228                   </s:iterator>   
229                 </select>
230                 </s:if><s:else>
231                   <s:if test="validations.size > 0"><i><s:text name="label.other"/></i></s:if>
232                   <s:else><i><s:text name="label.all"/></i></s:else>
233                 </s:else>
234               </s:if><s:else>
235                 <s:if test="#todo == 'edicycle' && documentType == #edited">
236                   <input type="hidden" name="documentType" value="<s:property value="documentTypeIndex"/>"/>
237                 </s:if>
238                   <s:text name="type.document.%{documentType}"/>
239               </s:else>
240               </td>
241               <td>
242               <s:if test="#todo == 'edicycle' && documentType == #edited">
243                 <s:set var="selection" value="publisherIndex"/>
244                 <select name="publisher">
245                   <option value="0"><s:text name="label.bytheauthor"/></option>
246                   <s:if test="%{#selection != 0}"><option value="<s:property value="#selection"/>" selected><s:text name="label.me"/></option></s:if>
247                   <s:else><option value="<s:property value="author.index"/>"><s:text name="label.me"/></option></s:else>
248                 </select>
249               </s:if><s:else>
250                 <s:if test="publisherIndex > 0"><s:property value="publisherName"/></s:if>
251                 <s:else><i><s:property value="publisherName"/></i></s:else>
252               </s:else>
253               </td>
254               <td>
255               <s:if test="#todo == 'edicycle' && documentType == #edited">
256                 <s:set var="selection" value="reviewerIndex"/>
257                 <select name="reviewer">
258                   <option value="0">-&nbsp;<s:text name="label.skipped"/>&nbsp;-</option>
259                   <s:iterator value="validationActors">         
260                     <s:if test="%{index == #selection}"><option value="<s:property value="index"/>" selected><s:property value="toString()"/></option></s:if>
261                     <s:else><option value="<s:property value="index"/>"><s:property value="toString()"/></option></s:else>
262                   </s:iterator>   
263                 </select>
264               </s:if><s:else>
265                 <s:if test="reviewerIndex > 0"><s:property value="reviewerName"/></s:if>
266                 <s:else><font color="#A1A192"><i><s:property value="reviewerName"/></i></font></s:else>
267               </s:else>
268               </td>
269               <td>
270               <s:if test="#todo == 'edicycle' && documentType == #edited">
271                 <s:set var="selection" value="approverIndex"/>
272                 <select name="approver">
273                   <option value="0">-&nbsp;<s:text name="label.skipped"/>&nbsp;-</option>
274                   <s:iterator value="validationActors">         
275                     <s:if test="%{index == #selection}"><option value="<s:property value="index"/>" selected><s:property value="toString()"/></option></s:if>
276                     <s:else><option value="<s:property value="index"/>"><s:property value="toString()"/></option></s:else>
277                   </s:iterator>   
278                 </select>
279               </s:if><s:else>
280                 <s:if test="approverIndex > 0"><s:property value="approverName"/></s:if>
281                 <s:else><font color="#A1A192"><i><s:property value="approverName"/></i></font></s:else>
282               </s:else>
283               </td>
284               <td align=right>
285               <s:if test="#todo == 'edicycle' && documentType == #edited">
286                 <button type="submit" name="saveCycle" value="" style="width:24px; height:16px; border:0; cursor:pointer; cursor:hand; background:transparent">
287                   <img src="<s:url value="/skin/image.export.png"/>" title="<s:text name="button.save"/>"/>
288                 </button>
289               </s:if>
290               </td>
291             </tr>
292             </s:iterator>
293             <tr height=3><td></td></tr>
294             </table>
295           </form>
296         </div>
297       </div>
298     </div>
299
300   </body>
301 </html>