Rev 1306 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
671 | jmachado | 1 | <%@ page import="pt.estgp.estgweb.web.form.surveys.SurveysForm" %> |
2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
||
3 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
||
4 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
5 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
6 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
7 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
||
8 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
||
9 | |||
10 | <jsp:useBean id="SurveysForm" type="pt.estgp.estgweb.web.form.surveys.SurveysForm" scope="request"/> |
||
11 | <jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
||
12 | <jomm:messages/> |
||
13 | <html:errors/> |
||
684 | jmachado | 14 | <% |
15 | String fromAction = ""; |
||
16 | String from = ""; |
||
17 | String user = ""; |
||
18 | if (request.getParameter("from") != null) |
||
19 | { |
||
20 | user = "/user"; |
||
21 | fromAction = "From" + request.getParameter("from"); |
||
22 | from = "?from=" + request.getParameter("from"); |
||
23 | } |
||
24 | request.setAttribute("from", from); |
||
25 | request.setAttribute("user", user); |
||
26 | request.setAttribute("fromAction", fromAction); |
||
27 | %> |
||
28 | <html:form action="${user}/submitSurvey${fromAction}${from}"> |
||
671 | jmachado | 29 | <html:hidden property="surveyView.id"/> |
30 | <html:hidden property="surveyView.deletedQuestions"/> |
||
31 | <html:hidden property="surveyView.deletedItems"/> |
||
32 | <html:hidden property="surveyView.deletedCandidates"/> |
||
33 | <html:hidden property="counter"/> |
||
34 | <input type="hidden" name="dispatch"> |
||
35 | <input type="hidden" name="questionId"/> |
||
36 | <input type="hidden" name="itemId"/> |
||
37 | <input type="hidden" name="candidateId"/> |
||
38 | |||
39 | <table class="form"> |
||
40 | <tr> |
||
41 | <th> |
||
42 | <bean:message key="survey.submit.form.title"/> |
||
43 | * |
||
44 | </th> |
||
45 | <td> |
||
46 | <html:text property="surveyView.title"/> |
||
47 | </td> |
||
48 | </tr> |
||
49 | <tr> |
||
50 | <th> |
||
51 | <bean:message key="survey.submit.form.type"/> |
||
52 | </th> |
||
53 | <td> |
||
54 | <logic:greaterThan name="SurveysForm" property="surveyView.id" value="0"> |
||
55 | <html:hidden property="surveyView.type"/> |
||
56 | <bean:message key="surveys.type.${SurveysForm.surveyView.type}"/> |
||
57 | </logic:greaterThan> |
||
58 | |||
59 | <logic:lessEqual name="SurveysForm" property="surveyView.id" value="0"> |
||
60 | <html:select property="surveyView.type" onchange="set(this.form,'changeSurveyType');this.form.submit();"> |
||
61 | <logic:present name="SurveysForm" property="surveyTypes"> |
||
62 | <logic:iterate id="type" name="SurveysForm" property="surveyTypes"> |
||
63 | <html:option value="${type}"> |
||
64 | <bean:message key="surveys.type.${type}"/> |
||
65 | </html:option> |
||
66 | </logic:iterate> |
||
67 | </logic:present> |
||
68 | </html:select> |
||
69 | </logic:lessEqual> |
||
70 | </td> |
||
71 | </tr> |
||
72 | |||
73 | <logic:equal value="general" property="surveyView.type" name="SurveysForm"> |
||
74 | <tr> |
||
75 | <th> |
||
76 | <bean:message key="survey.submit.form.target.roles"/> |
||
77 | </th> |
||
78 | <td> |
||
79 | <logic:greaterThan name="SurveysForm" property="surveyView.id" value="0"> |
||
80 | <html:hidden property="surveyView.targetRoles"/> |
||
81 | <bean:message key="user.role.${SurveysForm.surveyView.targetRoles}"/> |
||
82 | </logic:greaterThan> |
||
83 | |||
84 | <logic:lessEqual name="SurveysForm" property="surveyView.id" value="0"> |
||
85 | <html:select property="surveyView.targetRoles"> |
||
86 | <logic:present name="SurveysForm" property="surveyTargetRoles"> |
||
87 | <logic:iterate id="target" name="SurveysForm" property="surveyTargetRoles"> |
||
88 | <html:option value="${target}"> |
||
89 | <bean:message key="user.role.${target}"/> |
||
90 | </html:option> |
||
91 | </logic:iterate> |
||
92 | </logic:present> |
||
93 | </html:select> |
||
94 | </logic:lessEqual> |
||
95 | </td> |
||
96 | </tr> |
||
97 | </logic:equal> |
||
98 | |||
99 | <logic:equal value="pedagogic" property="surveyView.type" name="SurveysForm"> |
||
100 | <tr> |
||
101 | <th> |
||
102 | <bean:message key="survey.submit.form.target.roles"/> |
||
103 | </th> |
||
104 | <td> |
||
105 | <logic:greaterThan name="SurveysForm" property="surveyView.id" value="0"> |
||
106 | <html:hidden property="surveyView.targetRoles"/> |
||
107 | <bean:message key="surveys.target.pair.${SurveysForm.surveyView.targetRoles}"/> |
||
108 | </logic:greaterThan> |
||
109 | |||
110 | <logic:lessEqual name="SurveysForm" property="surveyView.id" value="0"> |
||
111 | <html:select property="surveyView.targetRoles"> |
||
112 | <logic:present name="SurveysForm" property="surveyTargetPairs"> |
||
113 | <logic:iterate id="target" name="SurveysForm" property="surveyTargetPairs"> |
||
114 | <html:option value="${target}"> |
||
115 | <bean:message key="surveys.target.pair.${target}"/> |
||
116 | </html:option> |
||
117 | </logic:iterate> |
||
118 | </logic:present> |
||
119 | </html:select> |
||
120 | </logic:lessEqual> |
||
121 | </td> |
||
122 | </tr> |
||
123 | </logic:equal> |
||
124 | |||
125 | <tr> |
||
126 | <th> |
||
127 | <bean:message key="survey.submit.form.stats.consult.roles"/> |
||
128 | </th> |
||
129 | <td> |
||
130 | <html:select property="surveyView.statsConsultRoles"> |
||
131 | <html:option value="owner"> |
||
132 | <bean:message key="surveys.stats.consult.owner"/> |
||
133 | </html:option> |
||
134 | <logic:present name="SurveysForm" property="surveyStatsConsultRoles"> |
||
135 | <logic:iterate id="consult" name="SurveysForm" property="surveyStatsConsultRoles"> |
||
136 | <html:option value="${consult}"> |
||
137 | <bean:message key="user.role.${consult}"/> |
||
138 | </html:option> |
||
139 | </logic:iterate> |
||
140 | </logic:present> |
||
141 | </html:select> |
||
142 | </td> |
||
143 | </tr> |
||
144 | |||
145 | <tr> |
||
146 | <th> |
||
147 | <bean:message key="survey.submit.form.start.date"/> |
||
148 | </th> |
||
149 | <td> |
||
150 | <a href="javascript:cal.select(getObjectById('startDate'),'anchord1','yyyy/MM/dd')" name="anchor1" id="anchord1"><html:text styleClass="date" property="startDate" styleId="startDate" readonly="true"/></a> |
||
151 | <input type="button" class="removeButton" onClick="SurveysForm.startDate.value=null;"> |
||
152 | </td> |
||
153 | </tr> |
||
154 | |||
155 | <tr> |
||
156 | <th> |
||
157 | <bean:message key="survey.submit.form.end.date"/> |
||
158 | * |
||
159 | </th> |
||
160 | <td> |
||
161 | <a href="javascript:cal.select(getObjectById('endDate'),'anchord2','yyyy/MM/dd')" name="anchor2" id="anchord2"><html:text styleClass="date" property="endDate" styleId="endDate" readonly="true"/></a> |
||
162 | <input type="button" class="removeButton" onClick="SurveysForm.endDate.value=null;"> |
||
163 | </td> |
||
164 | </tr> |
||
165 | </table> |
||
166 | |||
167 | <bean:message key="survey.submit.form.questions"/> |
||
168 | |||
169 | <hr> |
||
170 | |||
171 | <input type="hidden" name="questionsListSize" value="<%=((SurveysForm)request.getAttribute("SurveysForm")).getSurveyView().getQuestions().size()%>"> |
||
172 | <nested:iterate id="questionView" name="SurveysForm" property="surveyView.questions" indexId="qId"> |
||
173 | <table class="form"> |
||
174 | <input type="hidden" name="itemsListSize${qId}" value="<%=SurveysForm.getSurveyView().getQuestions().get(qId).getItems().size()%>"/> |
||
175 | <input type="hidden" name="candidatesLabelsSize${qId}" value="<%=SurveysForm.getSurveyView().getQuestions().get(qId).getCandidatesLabels().size()%>"/> |
||
176 | <nested:hidden property="id"/> |
||
177 | <nested:hidden property="type"/> |
||
178 | <tr> |
||
179 | <th> |
||
180 | <a name="question${qId}"></a> |
||
181 | <a name="question${questionView.id}"></a> |
||
182 | <bean:message key="survey.submit.form.delete.question"/> |
||
183 | </th> |
||
184 | <td> |
||
185 | <input type="button" class="removeButton" value="" |
||
186 | onclick="SurveysForm.questionId.value='${qId}';confirmAction('Tem a certeza que deseja apagar?',this.form,'removeQuestion');"/> |
||
187 | </td> |
||
188 | </tr> |
||
189 | <tr> |
||
190 | <th> |
||
191 | <bean:message key="survey.submit.form.required.question"/> |
||
192 | </th> |
||
193 | <td> |
||
194 | <nested:checkbox property="required"/> |
||
195 | </td> |
||
196 | </tr> |
||
197 | <tr> |
||
198 | <th> |
||
199 | <bean:message key="survey.submit.form.question"/> |
||
200 | </th> |
||
201 | <td> |
||
202 | <nested:text property="labelpt"/> |
||
203 | </td> |
||
204 | </tr> |
||
205 | <nested:equal name="questionView" value="matrix" property="type"> |
||
206 | <tr> |
||
207 | <th></th> |
||
208 | <td> |
||
209 | <table> |
||
210 | <tr> |
||
211 | <td></td> |
||
212 | <nested:iterate property="candidatesLabels" indexId="cId"> |
||
213 | <td> |
||
214 | <nested:text property="labelpt" styleId="inputVertical"/> |
||
215 | <input type="button" class="removeButton" value="" |
||
216 | onclick="SurveysForm.questionId.value='${qId}'; |
||
217 | SurveysForm.candidateId.value='${cId}'; |
||
218 | set(this.form,'removeCandidateOption'); |
||
219 | SurveysForm.action = SurveysForm.action+'#question${qId}'; |
||
220 | this.form.submit();"/> |
||
221 | </td> |
||
222 | </nested:iterate> |
||
223 | </tr> |
||
224 | <nested:iterate property="items" indexId="iId"> |
||
225 | <input type="hidden" name="candidatesListSize${qId}${iId}" value="<%=SurveysForm.getSurveyView().getQuestions().get(qId).getItems().get(iId).getCandidates().size()%>"/> |
||
226 | <tr> |
||
227 | <td> |
||
228 | <nested:hidden property="id"/> |
||
229 | <nested:text property="labelpt" styleId="inputHorizontal"/> |
||
230 | <input type="button" class="removeButton" value="" |
||
231 | onclick="SurveysForm.questionId.value='${qId}'; |
||
232 | SurveysForm.itemId.value='${iId}'; |
||
233 | set(this.form,'removeItemOption'); |
||
234 | SurveysForm.action = SurveysForm.action+'#question${qId}'; |
||
235 | this.form.submit();"/> |
||
236 | </td> |
||
237 | <nested:iterate property="candidates"> |
||
238 | <td align="center"> |
||
239 | <nested:hidden property="id"/> |
||
240 | <img border="0" src="<%=request.getContextPath()%>/imgs/radiobox.png"/> |
||
241 | </td> |
||
242 | </nested:iterate> |
||
243 | </tr> |
||
244 | </nested:iterate> |
||
245 | </table> |
||
246 | </td> |
||
247 | </tr> |
||
248 | <tr> |
||
249 | <th></th> |
||
250 | <td> |
||
251 | <input type="button" value="<bean:message key="survey.submit.form.add.hoption"/>" |
||
252 | onclick="SurveysForm.questionId.value='${qId}'; |
||
253 | set(this.form,'addItemOption'); |
||
254 | SurveysForm.action = SurveysForm.action+'#question${qId}'; |
||
255 | this.form.submit();"> |
||
256 | <input type="button" value="<bean:message key="survey.submit.form.add.voption"/>" |
||
257 | onclick="SurveysForm.questionId.value='${qId}'; |
||
258 | set(this.form,'addCandidateOption'); |
||
259 | SurveysForm.action = SurveysForm.action+'#question${qId}'; |
||
260 | this.form.submit();"> |
||
261 | </td> |
||
262 | </tr> |
||
263 | </nested:equal> |
||
264 | |||
265 | <nested:notEqual name="questionView" value="matrix" property="type"> |
||
266 | <nested:iterate property="items" indexId="iId"> |
||
267 | <input type="hidden" name="candidatesListSize${qId}${iId}" value="<%=SurveysForm.getSurveyView().getQuestions().get(qId).getItems().get(iId).getCandidates().size()%>"/> |
||
268 | <nested:hidden property="id"/> |
||
269 | <nested:iterate property="candidates" indexId="cId"> |
||
270 | <nested:hidden property="id"/> |
||
271 | <nested:notEqual name="questionView" value="text" property="type"> |
||
272 | <tr> |
||
273 | <th align="right"> |
||
274 | <nested:equal name="questionView" value="radio" property="type"> |
||
275 | <img border="0" src="<%=request.getContextPath()%>/imgs/radiobox.png"/> |
||
276 | </nested:equal> |
||
277 | <nested:equal name="questionView" value="check" property="type"> |
||
278 | <img border="0" src="<%=request.getContextPath()%>/imgs/checkbox.png"/> |
||
279 | </nested:equal> |
||
280 | </th> |
||
281 | <td> |
||
282 | <nested:text property="labelpt" styleId="inputHorizontal"/> |
||
283 | <input type="button" class="removeButton" value="" |
||
284 | onclick="SurveysForm.questionId.value='${qId}'; |
||
285 | SurveysForm.candidateId.value='${cId}'; |
||
286 | set(this.form,'removeCandidateOption'); |
||
287 | SurveysForm.action = SurveysForm.action+'#question${qId}'; |
||
288 | this.form.submit();"/> |
||
289 | </td> |
||
290 | </tr> |
||
291 | </nested:notEqual> |
||
292 | </nested:iterate> |
||
293 | </nested:iterate> |
||
294 | |||
295 | <nested:notEqual name="questionView" value="text" property="type"> |
||
296 | <tr> |
||
297 | <th></th> |
||
298 | <td> |
||
299 | <input type="button" value="<bean:message key="survey.submit.form.add.hoption"/>" |
||
300 | onclick="SurveysForm.questionId.value='${qId}'; |
||
301 | set(this.form,'addCandidateOption'); |
||
302 | SurveysForm.action = SurveysForm.action+'#question${qId}'; |
||
303 | this.form.submit();"> |
||
304 | </td> |
||
305 | </tr> |
||
306 | </nested:notEqual> |
||
307 | </nested:notEqual> |
||
308 | </table> |
||
309 | </nested:iterate> |
||
310 | |||
311 | <br> |
||
312 | <br> |
||
313 | |||
314 | <bean:message key="survey.submit.form.add.question"/> |
||
315 | |||
316 | <html:select property="questionType"> |
||
317 | <logic:present name="SurveysForm" property="surveyQuestionTypes"> |
||
318 | <logic:iterate id="item" name="SurveysForm" property="surveyQuestionTypes"> |
||
319 | <html:option value="${item}"> |
||
320 | <bean:message key="surveys.question.type.${item}"/> |
||
321 | </html:option> |
||
322 | </logic:iterate> |
||
323 | </logic:present> |
||
324 | </html:select> |
||
325 | |||
326 | <input type="button" value="<bean:message key="add"/>" |
||
327 | onclick="set(this.form,'addQuestion'); |
||
328 | SurveysForm.action = SurveysForm.action+'#question<%=SurveysForm.getCounter()%>'; |
||
329 | this.form.submit();"> |
||
330 | |||
331 | <hr> |
||
332 | <input type="button" value="<bean:message key="confirm"/>" |
||
333 | onclick="set(this.form,'save');this.form.submit();"> |
||
334 | </html:form> |