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