Rev 1338 | Rev 1346 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1337 | jmachado | 1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="pt.estgp.estgweb.domain.CourseUnitImpl" %> |
||
3 | <%@ page import="pt.estgp.estgweb.domain.QuestionarioImpl" %> |
||
4 | <%@ page import="pt.estgp.estgweb.domain.QuestionarioPedagogicoCursoAfeto" %> |
||
5 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
||
6 | <%@ page import="pt.estgp.estgweb.domain.views.CourseView" %> |
||
7 | <%@ page import="pt.estgp.estgweb.utils.ConfigProperties" %> |
||
8 | <%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %> |
||
9 | <%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %> |
||
10 | <%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %> |
||
11 | <%@ page import="java.util.List" %> |
||
12 | <%@ page import="pt.estgp.estgweb.utils.DynamicArrayList" %> |
||
13 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
||
14 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
||
15 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
16 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
17 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
18 | <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
||
19 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
||
20 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
||
21 | <% |
||
22 | String qId = request.getParameter("questionarioId"); |
||
23 | if(qId == null) |
||
24 | qId = request.getParameter("questionario.id"); |
||
25 | Long questionarioId = Long.parseLong(qId); |
||
26 | |||
27 | IServiceManager sm = ServiceManager.getInstance(); |
||
28 | String[] names = {"questionarioId"}; |
||
29 | Object[] args = {questionarioId}; |
||
30 | QuestionarioImpl questionario = (QuestionarioImpl) sm.execute(RequestUtils.getRequester(request, response),"loadQuestionarioAdmin",args,names); |
||
31 | |||
32 | |||
33 | request.setAttribute("Questionario", questionario); |
||
34 | |||
35 | List<String> institutionCodes = ConfigProperties.getListValues("questionario.instituition."); |
||
36 | |||
37 | AbstractDao.getCurrentSession().beginTransaction(); |
||
38 | |||
39 | |||
40 | %> |
||
41 | <jsp:useBean id="Questionario" type="pt.estgp.estgweb.domain.QuestionarioImpl" scope="request"/> |
||
42 | |||
43 | |||
44 | <jsp:include page="/layout/pleaseWait.jsp"/> |
||
45 | |||
46 | <html:form action="/admin/questionariosPaeSelectCourses"> |
||
47 | <html:hidden property="questionario.id" value="${Questionario.id}"/> |
||
48 | <input type="hidden" name="dispatch" value="updateTipologias"/> |
||
49 | |||
50 | <jsp:useBean id="QuestionarioForm" type="pt.estgp.estgweb.web.form.questionarios.QuestionarioForm" scope="request"/> |
||
51 | <% |
||
52 | //Variavel iniciada no serviço de load por chamada do IAnswerProcessor respectivo para inicializar |
||
53 | //as variaveis especificas |
||
54 | List<QuestionarioPedagogicoCursoAfeto> cursosAfetados = DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().find(questionario.getId()); |
||
55 | QuestionarioForm.setCursosAfetos(cursosAfetados); |
||
56 | %> |
||
57 | <div class="container-fluid"> |
||
58 | |||
59 | <style> |
||
60 | td.unidades |
||
61 | { |
||
62 | background-color: dimgray !important; |
||
63 | } |
||
64 | |||
65 | td.tipologias |
||
66 | { |
||
67 | background-color: #baffdc !important; |
||
68 | } |
||
69 | |||
1340 | jmachado | 70 | td.obsContent |
71 | { |
||
72 | background-color: #ffda48 !important; |
||
73 | } |
||
1338 | jmachado | 74 | td.vistaChecked |
75 | { |
||
76 | background-color: #20ff05 !important; |
||
77 | } |
||
78 | td.vistaNotChecked |
||
79 | { |
||
80 | background-color: gray !important; |
||
81 | } |
||
82 | td.usarNotChecked |
||
83 | { |
||
84 | background-color: red !important; |
||
85 | } |
||
86 | td.usarChecked |
||
87 | { |
||
88 | |||
89 | } |
||
90 | |||
91 | |||
92 | @keyframes waitPost { |
||
93 | from { opacity: 1; } |
||
94 | to { opacity: 0; } |
||
95 | } |
||
96 | td.waitPost |
||
97 | { |
||
98 | background-color: yellow !important; |
||
99 | animation: waitPost 0.5s cubic-bezier(.2, 0, 1, 1) infinite alternate; |
||
100 | |||
101 | /* |
||
102 | -webkit-animation-name: waitPost !important; |
||
103 | -webkit-animation-iteration-count: infinite !important; |
||
104 | -webkit-animation-timing-function: cubic-bezier(.5, 0, 1, 1) !important; |
||
105 | -webkit-animation-duration: 1.7s !important;*/ |
||
106 | |||
107 | } |
||
108 | |||
1337 | jmachado | 109 | </style> |
1338 | jmachado | 110 | |
1337 | jmachado | 111 | <div class="panel panel-primary"> |
112 | <div class="panel-heading"> |
||
113 | Selecção de Cursos para o Questionário ${Questionario.id} - Periodo: ${Questionario.semestre} de ${Questionario.year} |
||
114 | </div> |
||
115 | <div class="panel-body"> |
||
116 | <html:errors/> |
||
117 | <jomm:messages/> |
||
118 | |||
119 | |||
120 | <div class="baco-please-wait-target"> |
||
121 | |||
122 | <ul class="nav nav-tabs"> |
||
123 | <li id="institutionsSeparatorsGerarFinal"><a href="javascript:showInstitutionCode('GerarFinal')"><strong><u>Operações</u></strong></a></li> |
||
124 | <% |
||
125 | for(String institutionCode: institutionCodes) |
||
126 | { |
||
127 | String institutionName = ConfigProperties.getProperty("institution.code." + institutionCode); |
||
128 | %> |
||
129 | <li id="institutionsSeparators<%=institutionCode%>"><a href="javascript:showInstitutionCode('<%=institutionCode%>')"><%=institutionName%></a></li> |
||
130 | <% |
||
131 | } |
||
132 | %> |
||
133 | |||
134 | </ul> |
||
135 | <script> |
||
136 | $(document).ready( |
||
137 | function(){ |
||
138 | showInstitutionCode('GerarFinal'); |
||
139 | |||
140 | |||
1338 | jmachado | 141 | <baco:notClearOperation name="Questionario" op="QUESTIONARIO_CHANGE_TIPOLOGIES"> |
142 | $(".checkAll").remove(); |
||
143 | </baco:notClearOperation> |
||
144 | |||
1337 | jmachado | 145 | $(".courseCheck").attr("data-toogle","toggle"); |
146 | $('.courseCheck').bootstrapToggle({ |
||
147 | on: 'Tipologias', |
||
148 | off: 'Simples' |
||
149 | }); |
||
1338 | jmachado | 150 | |
151 | <baco:clearOperation name="Questionario" op="QUESTIONARIO_CHANGE_TIPOLOGIES"> |
||
152 | $('.checkAll').bootstrapToggle({ |
||
153 | on: 'Tipologias', |
||
154 | off: 'Simples' |
||
155 | }); |
||
156 | </baco:clearOperation> |
||
157 | <baco:notClearOperation name="Questionario" op="QUESTIONARIO_CHANGE_TIPOLOGIES"> |
||
158 | $(".courseCheck").prop("disabled",true); |
||
159 | $("#updateTipologiasButton").prop("disabled",true); |
||
160 | </baco:notClearOperation> |
||
1337 | jmachado | 161 | } |
162 | |||
1338 | jmachado | 163 | |
1337 | jmachado | 164 | ); |
165 | |||
166 | function selectAll(code,source) |
||
167 | { |
||
168 | |||
169 | $('#institution' + code).find('.courseCheck').each( |
||
170 | function() |
||
171 | { |
||
172 | if($(source).prop("checked")) |
||
173 | $(this).bootstrapToggle('on'); |
||
174 | else |
||
175 | $(this).bootstrapToggle('off'); |
||
176 | }); |
||
177 | } |
||
178 | |||
179 | |||
180 | function showInstitutionCode(institutionCode) |
||
181 | { |
||
182 | <% |
||
183 | for(String institutionCode: institutionCodes) |
||
184 | { |
||
185 | %> |
||
186 | if(institutionCode == '<%=institutionCode%>') |
||
187 | { |
||
188 | $("#institution<%=institutionCode%>").show(); |
||
189 | $("#institutionsSeparators<%=institutionCode%>").addClass("active"); |
||
190 | } |
||
191 | else |
||
192 | { |
||
193 | $("#institution<%=institutionCode%>").hide(); |
||
194 | $("#institutionsSeparators<%=institutionCode%>").removeClass("active"); |
||
195 | } |
||
196 | <% |
||
197 | } |
||
198 | %> |
||
199 | if(institutionCode == 'GerarFinal') |
||
200 | { |
||
201 | $("#institutionGerarFinal").show(); |
||
202 | $("#institutionsSeparatorsGerarFinal").addClass("active"); |
||
203 | } |
||
204 | else |
||
205 | { |
||
206 | $("#institutionGerarFinal").hide(); |
||
207 | $("#institutionsSeparatorsGerarFinal").removeClass("active"); |
||
208 | } |
||
209 | } |
||
210 | |||
211 | |||
1338 | jmachado | 212 | function setUnidadeAfetaVar(cursoAfetoId,unidadeAfetaId,op,val,targetObject) |
213 | { |
||
214 | $(targetObject).addClass("waitPost"); |
||
215 | $.post("<%=request.getContextPath()%>/admin/questionarios/pedagogicoEstudante/setUnidadeAfetaVar.jsp", |
||
216 | { |
||
217 | "questionarioId" : ${Questionario.id}, |
||
218 | "unidadeAfetaId":unidadeAfetaId, |
||
219 | "op":op, |
||
220 | "val": val |
||
221 | }, |
||
222 | function(data, textStatus) |
||
223 | { |
||
224 | if(data.ok == "ok") |
||
225 | { |
||
226 | $(targetObject).removeClass("waitPost"); |
||
227 | reloadCursoStats(cursoAfetoId); |
||
228 | } |
||
229 | }, |
||
230 | "json"); |
||
231 | } |
||
232 | function reloadCursoStats(cursoAfetoId) |
||
233 | { |
||
234 | |||
235 | $.getJSON("<%=request.getContextPath()%>/admin/questionarios/pedagogicoEstudante/courseInfoJson.jsp?cursoAfetoId="+cursoAfetoId, |
||
236 | function(dataJson) |
||
237 | { |
||
238 | |||
239 | var porVer = dataJson.porVer + " "; |
||
240 | if(dataJson.porVer > 0) |
||
241 | { |
||
242 | porVer += "<span class=\"glyphicon glyphicon-alert\"></span>"; |
||
243 | } |
||
244 | $("#cursoAfetoRow" + cursoAfetoId + " .porVerCount").html(porVer); |
||
245 | |||
246 | var marcadas = dataJson.marcadas + " "; |
||
247 | if(dataJson.marcadas > 0) |
||
248 | { |
||
249 | marcadas += "<span class=\"glyphicon glyphicon-alert\"></span>"; |
||
250 | } |
||
251 | $("#cursoAfetoRow" + cursoAfetoId + " .marcadasCount").html(marcadas); |
||
252 | |||
253 | var observadas = dataJson.observadas + " "; |
||
254 | if(dataJson.observadas > 0) |
||
255 | { |
||
256 | observadas += "<span class=\"glyphicon glyphicon-alert\"></span>"; |
||
257 | } |
||
258 | $("#cursoAfetoRow" + cursoAfetoId + " .observadasCount").html(observadas); |
||
259 | |||
260 | var naoUsadas = dataJson.naoUsadas + " "; |
||
261 | if(dataJson.naoUsadas > 0) |
||
262 | { |
||
263 | naoUsadas += "<span class=\"glyphicon glyphicon-alert\"></span>"; |
||
264 | } |
||
265 | $("#cursoAfetoRow" + cursoAfetoId + " .naoUsadasCount").html(naoUsadas) |
||
266 | |||
267 | $("#cursoAfetoRow" + cursoAfetoId + " .unidadesCount").html(dataJson.unidades); |
||
268 | |||
269 | } |
||
270 | ); |
||
271 | } |
||
272 | |||
1337 | jmachado | 273 | </script> |
274 | |||
275 | <% |
||
276 | for(String institutionCode: institutionCodes) |
||
277 | { |
||
278 | String institutionName = ConfigProperties.getProperty("institution.code." + institutionCode); |
||
279 | |||
280 | |||
281 | %> |
||
282 | |||
283 | |||
284 | <div class="panel panel-default" id="institution<%=institutionCode%>" style="display: none"> |
||
285 | <div class="panel-heading"> |
||
286 | Cursos da <%=institutionName%> |
||
287 | </div> |
||
288 | <div class="panel-body"> |
||
289 | <table class="tablesorter-blue"> |
||
290 | <thead> |
||
291 | <tr> |
||
1338 | jmachado | 292 | <th></th> |
1337 | jmachado | 293 | <th>Codigo</th> |
294 | <th>Tipo de Curso</th> |
||
295 | <th>Curso</th> |
||
296 | <th>Papel Comissão Curso</th> |
||
297 | <th>Unidades</th> |
||
1338 | jmachado | 298 | <th>Alertas </th> |
299 | <th>Por Ver</th> |
||
300 | <th>Não Usadas</th> |
||
301 | <th>Observadas</th> |
||
1337 | jmachado | 302 | <th>Turmas</th> |
1338 | jmachado | 303 | |
1337 | jmachado | 304 | <th class="filter-false" data-sorter="false"> |
305 | <input class="checkAll" type="checkbox" onchange="selectAll('<%=institutionCode%>',this)"> |
||
306 | </th> |
||
307 | |||
308 | </tr> |
||
309 | </thead> |
||
310 | <tbody> |
||
311 | <nested:iterate id="cursoAfeto" name="QuestionarioForm" property="cursosAfetos" type="pt.estgp.estgweb.domain.QuestionarioPedagogicoCursoAfetoImpl" scope="request"> |
||
312 | <% |
||
313 | |||
314 | if(cursoAfeto.getCodigoInstituicao().equals(institutionCode)) |
||
315 | { |
||
316 | int turmasSize = DaoFactory.getCourseDaoImpl().countCoursesUnitsTurmas(questionario.getYear(), cursoAfeto.getCourse().getId()); |
||
317 | CourseView cv = new CourseView(cursoAfeto.getCourse()); |
||
318 | request.setAttribute("CourseView",cv); |
||
319 | request.setAttribute("CursoAfeto",cursoAfeto); |
||
320 | |||
321 | %> |
||
1338 | jmachado | 322 | <tr id="cursoAfetoRow${cursoAfeto.id}"> |
1337 | jmachado | 323 | <td> |
1338 | jmachado | 324 | <script> |
325 | $(document).ready( |
||
326 | |||
327 | function(){ |
||
328 | reloadCursoStats("${cursoAfeto.id}"); |
||
329 | |||
330 | $('#${CursoAfeto.codigoCurso}unidades').on('shown.bs.collapse', function (e) { |
||
331 | if ($(this).is(e.target)) { |
||
332 | $("#${CursoAfeto.codigoCurso}unidadesButton .glyphicon").removeClass("glyphicon-folder-close").addClass("glyphicon-folder-open"); |
||
333 | } |
||
334 | }); |
||
335 | $('#${CursoAfeto.codigoCurso}unidades').on('hidden.bs.collapse', function (e) { |
||
336 | if ($(this).is(e.target)) { |
||
337 | $("#${CursoAfeto.codigoCurso}unidadesButton .glyphicon").removeClass("glyphicon-folder-open").addClass("glyphicon-folder-close"); |
||
338 | } |
||
339 | }); |
||
340 | } |
||
341 | ); |
||
342 | </script> |
||
343 | <button id="${CursoAfeto.codigoCurso}unidadesButton" class="btn btn-default btn-small" type="button" data-toggle="collapse" data-target="#${CursoAfeto.codigoCurso}unidades"><span class="glyphicon glyphicon-folder-close"></span></button> |
||
344 | <script> |
||
345 | $(document).ready( |
||
346 | function(){ |
||
347 | $.post("<%=request.getContextPath()%>/admin/questionarios/pedagogicoEstudante/pedagogicoCourseCheckCursoAfeto.jsp?cursoAfetoId=${CursoAfeto.id}", function(data) { |
||
348 | $("#${CursoAfeto.codigoCurso}unidades .unidades") |
||
349 | .html(data); |
||
350 | evaluateTableSortersInside("#${CursoAfeto.codigoCurso}unidades .unidades"); |
||
351 | }); |
||
352 | } |
||
353 | ); |
||
354 | </script> |
||
355 | </td> |
||
356 | <td> |
||
1337 | jmachado | 357 | <nested:hidden property="id"/> |
358 | ${CourseView.code} |
||
359 | </td> |
||
360 | <td><bean:message key="course.${CourseView.degreeCleanCode}"/></td> |
||
361 | <td>${CourseView.name}</td> |
||
362 | <td> |
||
363 | <logic:notEmpty name="CourseView" property="validationRole"> |
||
364 | <bean:message key="user.role.${CourseView.validationRole}"/> |
||
365 | </logic:notEmpty> |
||
366 | <logic:empty name="CourseView" property="validationRole"> |
||
367 | Papel não atribuido (Corrigir Situação) |
||
368 | </logic:empty> |
||
369 | </td> |
||
1338 | jmachado | 370 | <td class="unidadesCount"> |
1337 | jmachado | 371 | <a href="#" data-href="<%=request.getContextPath()%>/admin/questionarios/pedagogicoEstudante/listCourseUnits.jsp?importYear=${CourseView.importYear}&courseId=${CourseView.id}" data-title="Unidades do Curso de ${CourseView.name} (${CourseView.code})" data-toggle="modal" data-target="#modalAjaxRequest"> |
372 | <%=cursoAfeto.getUnidadesAfetas().size()%> |
||
373 | </a> |
||
374 | </td> |
||
1338 | jmachado | 375 | <td class="marcadasCount"> |
1337 | jmachado | 376 | ${CursoAfeto.marcadas} |
377 | <logic:greaterThan value="0" name="CursoAfeto" property="marcadas"> |
||
378 | <span class="glyphicon glyphicon-alert"></span> |
||
379 | </logic:greaterThan> |
||
380 | </td> |
||
1338 | jmachado | 381 | <td class="porVerCount"> ... </td> |
382 | <td class="naoUsadasCount"> ... </td> |
||
383 | <td class="observadasCount"> ... </td> |
||
1337 | jmachado | 384 | <td> |
385 | <a href="#" data-href="<%=request.getContextPath()%>/admin/questionarios/pedagogicoEstudante/listCourseUnitsTurmas.jsp?importYear=${CourseView.importYear}&courseId=${CourseView.id}" data-title="Turmas do Curso de ${CourseView.name} (${CourseView.code})" data-toggle="modal" data-target="#modalAjaxRequest"> |
||
386 | <%=turmasSize%> |
||
387 | </a> |
||
388 | </td> |
||
1338 | jmachado | 389 | |
1337 | jmachado | 390 | <td> |
391 | <nested:checkbox property="usarTipologias" styleClass="courseCheck"/> |
||
392 | </td> |
||
393 | </tr> |
||
394 | <tr id="${CursoAfeto.codigoCurso}unidades" class="collapse"> |
||
1338 | jmachado | 395 | <td></td> |
396 | <td colspan="11" class="unidades" style="padding-left: 25px"> |
||
1337 | jmachado | 397 | <div class="panel panel-default"> |
398 | <div class="panel-body"> |
||
399 | <p>Por favor aguarde um momento, o sistema está a carregar as unidades curriculares <img src="<%=request.getContextPath()%>/imgs/wait.gif"/></p> |
||
400 | </div> |
||
401 | </div> |
||
402 | </td> |
||
403 | </tr> |
||
404 | <% |
||
405 | } |
||
406 | //DaoFactory.getQuestionarioPedagogicoCursoAfetoDaoImpl().evict(cursoAfeto); |
||
407 | |||
408 | |||
409 | %> |
||
410 | </nested:iterate> |
||
411 | </tbody> |
||
412 | </table> |
||
413 | </div> |
||
414 | </div> |
||
415 | <% |
||
416 | } |
||
417 | %> |
||
418 | |||
419 | |||
420 | <div class="panel panel-primary" id="institutionGerarFinal"> |
||
421 | <div class="panel-heading"> |
||
1338 | jmachado | 422 | Verificação de Atribuições |
1337 | jmachado | 423 | </div> |
424 | <div class="panel-body"> |
||
425 | |||
426 | |||
427 | <div class="col-sm-6"> |
||
1338 | jmachado | 428 | <baco:clearOperation name="Questionario" op="QUESTIONARIO_CHANGE_TIPOLOGIES"> |
429 | <div class="alert alert-warning">Está neste momento no painel de verificações do questionário ${Questionario.id} criado para o periodo ${Questionario.semestre} de ${Questionario.year}</div> |
||
1337 | jmachado | 430 | </baco:clearOperation> |
1338 | jmachado | 431 | <baco:notClearOperation name="Questionario" op="QUESTIONARIO_CHANGE_TIPOLOGIES"> |
432 | <div class="alert alert-warning">Não tem permissão para verificar atribuições no questionário ${Questionario.id} criado para o periodo ${Questionario.semestre} de ${Questionario.year}</div> |
||
433 | </baco:notClearOperation> |
||
1337 | jmachado | 434 | |
435 | <a class="btn btn-default" href="#" data-href="<%=request.getContextPath()%>/admin/questionarios/pedagogicoEstudante/questionarioLogState.jsp?questionarioId=${Questionario.id}" data-title="Registo de mudanças de estado do questionario ${Questionario.id}" data-toggle="modal" data-target="#modalAjaxRequest"> |
||
436 | Registo de Mudanças de Estado |
||
437 | </a> |
||
438 | </div> |
||
439 | <div class="col-sm-6"> |
||
440 | |||
441 | </div> |
||
442 | |||
443 | |||
444 | </div> |
||
445 | |||
446 | </div> |
||
447 | <div class="col-sm-12"> |
||
1338 | jmachado | 448 | |
449 | <button id="updateTipologiasButton" class="btn btn-success">Atualizar Tipologias</button> |
||
1337 | jmachado | 450 | <html:link action="/admin/adminQuestionario?questionario.id=${Questionario.id}#NOWTASK" styleClass="btn btn-danger">Voltar à administração</html:link> |
451 | </div> |
||
452 | </div> |
||
453 | |||
454 | |||
455 | </div> |
||
456 | </div> |
||
457 | </div> |
||
458 | <% |
||
459 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
460 | %> |
||
461 | |||
462 | |||
463 | </html:form> |