Rev 1346 | Rev 1404 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1326 | jmachado | 1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
||
3 | <%@ page import="pt.estgp.estgweb.domain.views.CourseView" %> |
||
4 | <%@ page import="pt.estgp.estgweb.utils.ConfigProperties" %> |
||
5 | <%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %> |
||
6 | <%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %> |
||
7 | <%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %> |
||
8 | <%@ page import="java.util.List" %> |
||
1327 | jmachado | 9 | <%@ page import="pt.estgp.estgweb.web.form.configuration.SchedulleTasksForm" %> |
10 | <%@ page import="pt.estgp.estgweb.domain.*" %> |
||
1328 | jmachado | 11 | <%@ page import="pt.estgp.estgweb.services.jobs.ServiceJob" %> |
12 | <%@ page import="pt.estgp.estgweb.services.questionarios.pedagogico.UpdateCoursesAndUnitsJobService" %> |
||
13 | <%@ page import="pt.estgp.estgweb.web.form.questionarios.QuestionarioForm" %> |
||
1326 | jmachado | 14 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
15 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
||
16 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
17 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
18 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
19 | <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
||
20 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
||
21 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
||
22 | <% |
||
1337 | jmachado | 23 | String qId = request.getParameter("questionarioId"); |
24 | if(qId == null) |
||
25 | qId = request.getParameter("questionario.id"); |
||
26 | Long questionarioId = Long.parseLong(qId); |
||
27 | |||
1326 | jmachado | 28 | IServiceManager sm = ServiceManager.getInstance(); |
29 | String[] names = {"questionarioId"}; |
||
30 | Object[] args = {questionarioId}; |
||
31 | QuestionarioImpl questionario = (QuestionarioImpl) sm.execute(RequestUtils.getRequester(request, response),"loadQuestionarioAdmin",args,names); |
||
1327 | jmachado | 32 | |
1328 | jmachado | 33 | |
1326 | jmachado | 34 | request.setAttribute("Questionario", questionario); |
35 | |||
36 | |||
37 | AbstractDao.getCurrentSession().beginTransaction(); |
||
1328 | jmachado | 38 | JobServiceTaskImpl job = questionario.getCourseSelectionTaskId() > 0 ? |
39 | (JobServiceTaskImpl) DaoFactory.getJobServiceTaskDaoImpl().load(questionario.getCourseSelectionTaskId()) : |
||
40 | null; |
||
41 | request.setAttribute("Job", job); |
||
1326 | jmachado | 42 | |
43 | List<String> institutionCodes = ConfigProperties.getListValues("questionario.instituition."); |
||
44 | |||
45 | %> |
||
1328 | jmachado | 46 | |
47 | |||
48 | |||
1346 | jmachado | 49 | <html:form action="/user/questionariosPaeSelectCourses"> |
1328 | jmachado | 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 | QuestionarioForm.setCoursesSelectedIds(questionario.getAfetacoesVarCoursesSelectionForJob()); |
||
55 | %> |
||
1326 | jmachado | 56 | <div class="container-fluid"> |
57 | <script> |
||
1328 | jmachado | 58 | $(document).ready( |
59 | function() |
||
60 | { |
||
61 | <baco:clearOperation name="Questionario" op="QUESTIONARIO_SCHEDULLE_SELECT_COURSES"> |
||
1337 | jmachado | 62 | $(".courseCheck").attr("data-toogle","toggle"); |
1328 | jmachado | 63 | $('.courseCheck').bootstrapToggle({ |
1337 | jmachado | 64 | on: 'Sim', |
65 | off: 'Não' |
||
1328 | jmachado | 66 | }); |
67 | $('.checkAll').bootstrapToggle({ |
||
1337 | jmachado | 68 | on: 'Sim', |
69 | off: 'Não' |
||
1328 | jmachado | 70 | }); |
71 | </baco:clearOperation> |
||
72 | <baco:notClearOperation name="Questionario" op="QUESTIONARIO_SCHEDULLE_SELECT_COURSES"> |
||
73 | $('.courseCheck').bootstrapToggle('disable'); |
||
74 | $('.checkAll').bootstrapToggle('disable'); |
||
75 | </baco:notClearOperation> |
||
76 | |||
77 | } |
||
78 | |||
79 | ); |
||
80 | |||
1326 | jmachado | 81 | function selectAll(code,source) |
82 | { |
||
1333 | jmachado | 83 | |
1326 | jmachado | 84 | $('#institution' + code).find('.courseCheck').each( |
85 | function() |
||
86 | { |
||
1333 | jmachado | 87 | if($(source).prop("checked")) |
88 | $(this).bootstrapToggle('on'); |
||
89 | else |
||
90 | $(this).bootstrapToggle('off'); |
||
1326 | jmachado | 91 | }); |
92 | } |
||
93 | </script> |
||
1327 | jmachado | 94 | |
95 | <div class="panel panel-primary"> |
||
96 | <div class="panel-heading"> |
||
97 | Selecção de Cursos para o Questionário ${Questionario.id} - Periodo: ${Questionario.semestre} de ${Questionario.year} |
||
98 | </div> |
||
99 | <div class="panel-body"> |
||
100 | <html:errors/> |
||
101 | <jomm:messages/> |
||
102 | |||
1328 | jmachado | 103 | <div class="baco-please-wait"> |
1327 | jmachado | 104 | |
1328 | jmachado | 105 | </div> |
106 | <div class="baco-please-wait-target"> |
||
1327 | jmachado | 107 | |
1328 | jmachado | 108 | <ul class="nav nav-tabs"> |
109 | <li id="institutionsSeparatorsGerarFinal"><a href="javascript:showInstitutionCode('GerarFinal')"><strong><u>Operações</u></strong></a></li> |
||
1327 | jmachado | 110 | <% |
1328 | jmachado | 111 | for(String institutionCode: institutionCodes) |
1327 | jmachado | 112 | { |
1328 | jmachado | 113 | String institutionName = ConfigProperties.getProperty("institution.code." + institutionCode); |
1327 | jmachado | 114 | %> |
1354 | jmachado | 115 | <li id="institutionsSeparators<%=institutionCode%>"><a href="javascript:showInstitutionCode('<%=institutionCode%>')"><%=institutionName%></a></li> |
1326 | jmachado | 116 | <% |
117 | } |
||
118 | %> |
||
119 | |||
1328 | jmachado | 120 | </ul> |
121 | <script> |
||
122 | $(document).ready( |
||
123 | function(){ |
||
124 | showInstitutionCode('GerarFinal'); |
||
125 | } |
||
126 | ); |
||
1326 | jmachado | 127 | |
128 | |||
1328 | jmachado | 129 | function showInstitutionCode(institutionCode) |
130 | { |
||
1327 | jmachado | 131 | <% |
1328 | jmachado | 132 | for(String institutionCode: institutionCodes) |
133 | { |
||
134 | %> |
||
135 | if(institutionCode == '<%=institutionCode%>') |
||
1327 | jmachado | 136 | { |
1328 | jmachado | 137 | $("#institution<%=institutionCode%>").show(); |
138 | $("#institutionsSeparators<%=institutionCode%>").addClass("active"); |
||
139 | } |
||
140 | else |
||
141 | { |
||
142 | $("#institution<%=institutionCode%>").hide(); |
||
143 | $("#institutionsSeparators<%=institutionCode%>").removeClass("active"); |
||
144 | } |
||
1327 | jmachado | 145 | <% |
146 | } |
||
1328 | jmachado | 147 | %> |
148 | if(institutionCode == 'GerarFinal') |
||
149 | { |
||
150 | $("#institutionGerarFinal").show(); |
||
151 | $("#institutionsSeparatorsGerarFinal").addClass("active"); |
||
152 | } |
||
1327 | jmachado | 153 | else |
154 | { |
||
1328 | jmachado | 155 | $("#institutionGerarFinal").hide(); |
156 | $("#institutionsSeparatorsGerarFinal").removeClass("active"); |
||
157 | } |
||
158 | } |
||
159 | </script> |
||
160 | |||
161 | <% |
||
162 | for(String institutionCode: institutionCodes) |
||
163 | { |
||
164 | String institutionName = ConfigProperties.getProperty("institution.code." + institutionCode); |
||
165 | List<Course> courses = DaoFactory.getCourseDaoImpl().findCoursesWithUnitsIn(questionario.getYear(),institutionCode,questionario.getSemestre()); |
||
166 | %> |
||
167 | <div class="panel panel-default" id="institution<%=institutionCode%>" style="display: none"> |
||
168 | <div class="panel-heading"> |
||
169 | Cursos da <%=institutionName%> |
||
170 | </div> |
||
171 | <div class="panel-body"> |
||
172 | <table class="tablesorterfiltered"> |
||
173 | <thead> |
||
174 | <tr> |
||
175 | <th>Codigo</th> |
||
176 | <th>Tipo de Curso</th> |
||
177 | <th>Curso</th> |
||
178 | <th>Papel Comissão Curso</th> |
||
179 | <th>Unidades</th> |
||
180 | <th>Turmas</th> |
||
181 | <th class="filter-false" data-sorter="false"> |
||
182 | <input class="checkAll" type="checkbox" onchange="selectAll('<%=institutionCode%>',this)"> |
||
183 | </th> |
||
184 | </tr> |
||
185 | </thead> |
||
186 | <tbody> |
||
187 | <% |
||
188 | for(Course course: courses) |
||
189 | { |
||
190 | int unitsSize=DaoFactory.getCourseDaoImpl().countCoursesUnits(questionario.getYear(), course.getId()); |
||
191 | int turmasSize = DaoFactory.getCourseDaoImpl().countCoursesUnitsTurmas(questionario.getYear(), course.getId()); |
||
192 | CourseView cv = new CourseView(course); |
||
193 | request.setAttribute("CourseView",cv); |
||
1327 | jmachado | 194 | %> |
1328 | jmachado | 195 | <tr> |
196 | <td>${CourseView.code}</td> |
||
197 | <td><bean:message key="course.${CourseView.degreeCleanCode}"/></td> |
||
198 | <td>${CourseView.name}</td> |
||
199 | <td> |
||
200 | <logic:notEmpty name="CourseView" property="validationRole"> |
||
201 | <bean:message key="user.role.${CourseView.validationRole}"/> |
||
202 | </logic:notEmpty> |
||
203 | <logic:empty name="CourseView" property="validationRole"> |
||
204 | Papel não atribuido (Corrigir Situação) |
||
205 | </logic:empty> |
||
206 | </td> |
||
207 | <td> |
||
1346 | jmachado | 208 | <a href="#" data-href="<%=request.getContextPath()%>/user/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"> |
1328 | jmachado | 209 | <%=unitsSize%> |
210 | </a> |
||
211 | </td> |
||
212 | <td> |
||
1346 | jmachado | 213 | <a href="#" data-href="<%=request.getContextPath()%>/user/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"> |
1328 | jmachado | 214 | <%=turmasSize%> |
215 | </a> |
||
216 | </td> |
||
217 | <td> |
||
218 | <html:multibox property="coursesSelectedIds" value="${CourseView.id}" styleClass="courseCheck"/> |
||
219 | </td> |
||
220 | </tr> |
||
1327 | jmachado | 221 | <% |
222 | } |
||
223 | %> |
||
1328 | jmachado | 224 | </tbody> |
225 | </table> |
||
226 | </div> |
||
227 | </div> |
||
228 | <% |
||
229 | } |
||
230 | %> |
||
1327 | jmachado | 231 | |
232 | |||
1328 | jmachado | 233 | <div class="panel panel-primary" id="institutionGerarFinal"> |
234 | <div class="panel-heading"> |
||
235 | Atribuição de Cursos e Unidades ao Questionário |
||
236 | </div> |
||
237 | <div class="panel-body"> |
||
238 | |||
239 | |||
240 | <div class="col-sm-6"> |
||
241 | <baco:clearOperation name="Questionario" op="QUESTIONARIO_SCHEDULLE_SELECT_COURSES"> |
||
242 | <div class="alert alert-warning">Esta operação vai associar todos os cursos seleccionados e respectivas unidades curriculares |
||
243 | ao questionário ${Questionario.id} criado para o periodo ${Questionario.semestre} de ${Questionario.year}</div> |
||
244 | <div class="alert alert-info alert-small">Esta operação poderá ser revertida ou então repetida para atualizar os cursos alvo do questionário</div> |
||
245 | <div class="alert alert-info alert-small">Esta operação poderá demorar alguns instantes</div> |
||
246 | <html:hidden property="questionario.id" value="${Questionario.id}"/> |
||
247 | <input type="hidden" name="questionarioId" value="${Questionario.id}"/> |
||
248 | <input type="hidden" name="dispatch" value="selectCourses"/> |
||
249 | </baco:clearOperation> |
||
250 | |||
251 | |||
252 | |||
253 | <baco:clearOperation name="Questionario" op="QUESTIONARIO_SCHEDULLE_SELECT_COURSES"> |
||
254 | <button class="btn btn-warning" type="button" onclick="this.form.submit()">Associar Cursos e Unidades Curriculares</button> |
||
255 | </baco:clearOperation> |
||
256 | <baco:notClearOperation name="Questionario" op="QUESTIONARIO_SCHEDULLE_SELECT_COURSES"> |
||
257 | <baco:clearOperation name="Questionario" op="QUESTIONARIO_SCHEDULLE_SEE_SELECT_COURSES"> |
||
258 | <div class="alert alert-warning">O sistema agendou a atribuição de cursos e unidades ao questionário ${Questionario.id} criado para o periodo ${Questionario.semestre} de ${Questionario.year}. Veja o progresso em baixo, caso não termine no final de 30 minutos esta tarefa ficará de novo disponivel</div> |
||
259 | </baco:clearOperation> |
||
260 | <baco:notClearOperation name="Questionario" op="QUESTIONARIO_SCHEDULLE_SEE_SELECT_COURSES"> |
||
261 | <div class="alert alert-warning">Não têm autorização para ver esta secção</div> |
||
262 | </baco:notClearOperation> |
||
263 | |||
264 | </baco:notClearOperation> |
||
1346 | jmachado | 265 | <a class="btn btn-default" href="#" data-href="<%=request.getContextPath()%>/user/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"> |
1333 | jmachado | 266 | Registo de Mudanças de Estado |
267 | </a> |
||
1327 | jmachado | 268 | </div> |
1328 | jmachado | 269 | <div class="col-sm-6"> |
270 | <baco:clearOperation name="Questionario" op="QUESTIONARIO_SCHEDULLE_SEE_SELECT_COURSES"> |
||
271 | <% |
||
272 | if(job != null) |
||
273 | { |
||
274 | SchedulleTasksForm schedulleTasksForm = new SchedulleTasksForm(); |
||
275 | schedulleTasksForm.setJobServiceTask(job); |
||
276 | schedulleTasksForm.setId(job.getId()); |
||
277 | request.setAttribute("SchedulleTasksForm",schedulleTasksForm); |
||
278 | %> |
||
1346 | jmachado | 279 | <div class="task-log task-log-xs" data-href="<%=request.getContextPath()%>/user/questionarioPedagogicoStartChooseCourses.do?questionarioId=${Questionario.id}"> |
1328 | jmachado | 280 | <jsp:include page="/admin/configuration/taskLog.jsp"/> |
281 | </div> |
||
282 | <% |
||
283 | } |
||
284 | else |
||
285 | { |
||
286 | %> |
||
287 | <div class="alert alert-danger">O sistema não conseguiu encontrar a tarefa de atribuição nas tarefas agendadas, por favor verifique em todos os logs de tarefas <html:link action="/user/configurationJobTasks">Aqui</html:link> </div> |
||
288 | <% |
||
289 | } |
||
290 | %> |
||
291 | </baco:clearOperation> |
||
292 | </div> |
||
1327 | jmachado | 293 | |
294 | |||
1328 | jmachado | 295 | </div> |
1327 | jmachado | 296 | |
1328 | jmachado | 297 | </div> |
298 | <div class="col-sm-12"> |
||
1346 | jmachado | 299 | <html:link action="/user/adminQuestionario?questionario.id=${Questionario.id}#NOWTASK" styleClass="btn btn-danger">Voltar à administração</html:link> |
1328 | jmachado | 300 | </div> |
1327 | jmachado | 301 | </div> |
1328 | jmachado | 302 | </div> |
1327 | jmachado | 303 | </div> |
1326 | jmachado | 304 | </div> |
305 | <% |
||
306 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
307 | %> |
||
1327 | jmachado | 308 | |
309 | </html:form> |