Rev 1518 | Rev 1520 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1505 | jmachado | 1 | <%@ page import="jomm.dao.impl.AbstractDao" %> |
2 | <%@ page import="pt.estgp.estgweb.domain.Course" %> |
||
3 | <%@ page import="pt.estgp.estgweb.domain.CourseStudiesPlan" %> |
||
4 | <%@ page import="pt.estgp.estgweb.domain.CourseStudiesPlanImpl" %> |
||
5 | <%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
||
1516 | jmachado | 6 | <%@ page import="pt.estgp.estgweb.services.courses.CoursesService" %> |
1505 | jmachado | 7 | <%@ page import="pt.estgp.estgweb.web.form.courses.CourseStudiesPlansAdminForm" %> |
1516 | jmachado | 8 | <%@ page import="java.util.List" %> |
1505 | jmachado | 9 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
10 | <%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
||
11 | <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
||
12 | <%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
||
13 | <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
||
14 | <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
||
15 | <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
||
16 | <%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm"%> |
||
17 | <% |
||
18 | //todo temos de ter aqui o id do curso para o carregar aqui mesmo |
||
19 | |||
20 | //se queremos barras de navegação então temos de ter ser acedidos de um |
||
21 | //controlador que carregue o necerrário à barra ou então assumimos que |
||
22 | //o curso id esta sempre disponivel nas barras possiveis de chamar |
||
23 | |||
24 | AbstractDao.getCurrentSession().beginTransaction(); |
||
25 | |||
26 | CourseStudiesPlanImpl planoEdicao; |
||
27 | boolean ultimaVersao = true; |
||
28 | Long courseId; |
||
29 | Long studyPlanId; |
||
30 | String versaoPlano = "Não Encontrada"; |
||
31 | Course course; |
||
32 | if(request.getAttribute("CourseStudiesPlansAdminForm") != null) |
||
33 | { |
||
34 | CourseStudiesPlansAdminForm frm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm"); |
||
35 | courseId = frm.getCourseId(); |
||
36 | studyPlanId = frm.getCourseStudiesPlan().getId(); |
||
37 | ultimaVersao = frm.isVersaoVigor(); |
||
38 | course = DaoFactory.getCourseDaoImpl().load(courseId); |
||
39 | planoEdicao = frm.getCourseStudiesPlan(); |
||
40 | } |
||
41 | else |
||
42 | { |
||
43 | courseId = Long.parseLong(request.getParameter("courseId")); |
||
44 | studyPlanId = Long.parseLong(request.getParameter("studyPlanId")); |
||
45 | request.setAttribute("courseId",courseId); |
||
46 | request.setAttribute("studyPlanId",studyPlanId); |
||
47 | |||
48 | |||
49 | course = DaoFactory.getCourseDaoImpl().load(courseId); |
||
50 | planoEdicao = null; |
||
51 | for(CourseStudiesPlan plan:course.getStudiesPlans()) |
||
52 | { |
||
53 | if(plan.getId() == studyPlanId) |
||
54 | { |
||
55 | versaoPlano = plan.getVersion() + ""; |
||
56 | planoEdicao = (CourseStudiesPlanImpl) DaoFactory.getCourseStudiesPlanDaoImpl().narrow(plan); |
||
57 | break; |
||
58 | } |
||
59 | ultimaVersao = false; |
||
60 | } |
||
61 | //provavelmente era mais facil ter um Form Nested com toda a informação, ou então faz-se isso numa pagina propria para editar o plano em questão |
||
62 | } |
||
63 | request.setAttribute("courseId",courseId); |
||
64 | request.setAttribute("studyPlanId",studyPlanId); |
||
65 | request.setAttribute("course",course); |
||
66 | |||
67 | |||
68 | |||
69 | |||
70 | |||
71 | |||
72 | /* |
||
73 | if(planoEdicao != null) |
||
74 | { |
||
75 | |||
76 | |||
77 | } |
||
78 | */ |
||
79 | |||
80 | %> |
||
81 | <div class="panel panel-default"> |
||
82 | <div class="panel-heading"> |
||
83 | Edição do plano de estudos. Versão <%=versaoPlano%> <%=ultimaVersao? "(<u>é a versão em vigor</u>)":""%> do curso de <%=course.getName()%> (<%=course.getCode()%>) |
||
84 | </div> |
||
85 | <div class="panel-body"> |
||
86 | |||
87 | <html:errors/> |
||
88 | <jomm:messages/> |
||
89 | |||
90 | <div class="panel panel-default"> |
||
91 | <div class="panel-heading">Dados do Curso</div> |
||
92 | <div class="panel-body"> |
||
93 | |||
94 | <div class="col-sm-12">Código do Curso <label class="text-info">${course.code}</label></div> |
||
95 | <div class="col-sm-12"> |
||
96 | <table class="tablesorter-blue"> |
||
97 | <thead> |
||
98 | <tr> |
||
99 | <th>Língua</th> |
||
100 | <th>Nome do Curso</th> |
||
101 | <th>Departamento</th> |
||
102 | </tr> |
||
103 | </thead> |
||
104 | <tbody> |
||
105 | <tr> |
||
106 | <td>PT</td> |
||
107 | <td>${course.name}</td> |
||
108 | <td> |
||
109 | <%if(course.getDepartment() != null){%>${course.department.name}<%}%> |
||
110 | </td> |
||
111 | </tr> |
||
112 | <tr> |
||
113 | <td>EN</td> |
||
114 | <td>${course.nameEn}</td> |
||
115 | <td> |
||
116 | <%if(course.getDepartment() != null){%>${course.department.nameEn}<%}%> |
||
117 | |||
118 | </td> |
||
119 | </tr> |
||
120 | <tr> |
||
121 | <td>ES</td> |
||
122 | <td>${course.nameEs}</td> |
||
123 | <td> |
||
124 | <%if(course.getDepartment() != null){%>${course.department.nameEs}<%}%> |
||
125 | </td> |
||
126 | </tr> |
||
127 | <tr> |
||
128 | <td>FR</td> |
||
129 | <td>${course.nameFr}</td> |
||
130 | <td> |
||
131 | <%if(course.getDepartment() != null){%>${course.department.nameFr}<%}%> |
||
132 | </td> |
||
133 | </tr> |
||
134 | </tbody> |
||
135 | </table> |
||
136 | </div> |
||
137 | |||
138 | </div> |
||
139 | </div> |
||
1516 | jmachado | 140 | <html:form action="/user/courseControllerStudiesPlan" styleId="CourseStudiesPlansAdminForm" styleClass="form-horizontal"> |
141 | <div class="panel panel-warning"> |
||
142 | <div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> Clonagem a partir de outro plano de Estudos</div> |
||
143 | <div class="panel-body"> |
||
1505 | jmachado | 144 | |
145 | <div class="form-group"> |
||
1516 | jmachado | 146 | <label class="control-label col-sm-2">Versão Fonte para Clonagem</label> |
1505 | jmachado | 147 | <div class="col-sm-10"> |
1516 | jmachado | 148 | <html:select styleClass="form-control" property="sourcePlanId"> |
149 | <html:option value="">Nenhuma</html:option> |
||
150 | <% |
||
151 | for(CourseStudiesPlan plan:course.getStudiesPlans()) |
||
152 | { |
||
153 | if(plan.getId() != studyPlanId) |
||
154 | { |
||
155 | request.setAttribute("nowPlanId",plan.getId()); |
||
156 | %> |
||
157 | <html:option value="${nowPlanId}">Versão <%=plan.getVersion()%></html:option> |
||
158 | <% |
||
159 | } |
||
160 | |||
161 | } |
||
162 | %> |
||
163 | </html:select> |
||
1505 | jmachado | 164 | </div> |
165 | </div> |
||
1516 | jmachado | 166 | <button class="btn btn-warning" type="button" data-toggle="modal" data-target="#confirm-ModalFunction" data-message="Esta operação vai sobrepor os dados do plano de estudos atual com os dados da versão escolhida!! Tem a certeza que deseja prosseguir?" data-script="set($('#CourseStudiesPlansAdminForm').get(0),'clonarPlano');$('#CourseStudiesPlansAdminForm').get(0).submit();"> |
167 | Clonar para a fonte escolhida |
||
168 | </button> |
||
1505 | jmachado | 169 | |
1507 | jmachado | 170 | |
171 | |||
1516 | jmachado | 172 | </div> |
173 | </div> |
||
1507 | jmachado | 174 | |
175 | |||
1516 | jmachado | 176 | <div class="panel panel-default"> |
177 | <div class="panel-heading">Plano de Estudos |
||
1507 | jmachado | 178 | |
1516 | jmachado | 179 | <button style="margin-left: 4px" type="button" class="btn btn-success pull-right" onclick="set(this.form,'addNewSemestre');this.form.submit()"> |
180 | <span class="glyphicon glyphicon-plus"> </span> Semestre |
||
181 | </button> |
||
182 | </div> |
||
183 | <div class="panel-body"> |
||
1507 | jmachado | 184 | |
185 | |||
1516 | jmachado | 186 | <% |
187 | CourseStudiesPlansAdminForm courseStudiesPlansAdminForm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm"); |
||
188 | //Form ainda não iniciado vai iniciar é a primeira vez |
||
189 | if(courseStudiesPlansAdminForm.getCourseStudiesPlan().getId() <= 0) |
||
190 | { |
||
191 | courseStudiesPlansAdminForm.setCourseStudiesPlan(planoEdicao); |
||
192 | courseStudiesPlansAdminForm.setCourseId(courseId); |
||
193 | courseStudiesPlansAdminForm.setVersaoVigor(ultimaVersao); |
||
194 | courseStudiesPlansAdminForm.setPlanoEstudos(new CoursesService().loadCursoPlanoFromXml(planoEdicao.getXml())); |
||
195 | } |
||
196 | %> |
||
197 | <input type="hidden" name="dispatch" value="savePlano"/> |
||
198 | <html:hidden property="courseId"/> |
||
199 | <html:hidden property="versaoVigor"/> |
||
200 | <html:hidden property="courseStudiesPlan.id"/> |
||
201 | <html:hidden styleId="semestreId" property="semestreId"/> |
||
202 | <html:hidden styleId="perfilId" property="perfilId"/> |
||
1505 | jmachado | 203 | |
1516 | jmachado | 204 | <div class="form-group"> |
205 | <label class="control-label col-sm-2">Versão</label> |
||
206 | <div class="col-sm-10"> |
||
207 | <html:text styleClass="form-control" property="courseStudiesPlan.version" size="3"/> |
||
208 | </div> |
||
209 | </div> |
||
210 | <div class="form-group"> |
||
211 | <label class="control-label col-sm-2">Descrição</label> |
||
212 | <div class="col-sm-10"> |
||
213 | <html:text styleClass="form-control" property="courseStudiesPlan.versionDescription"/> |
||
214 | </div> |
||
215 | </div> |
||
1507 | jmachado | 216 | |
1516 | jmachado | 217 | <% |
218 | int dummyIndexIdUnidades = 0; |
||
219 | int dummyIndexPerfilId = 0; |
||
220 | int dummyIndexSemestreId = 0; |
||
1507 | jmachado | 221 | |
1516 | jmachado | 222 | %> |
223 | <script> |
||
1505 | jmachado | 224 | |
1516 | jmachado | 225 | function sendUpUnidadeCurricular(dummyIndexId) |
226 | { |
||
227 | sendFieldUp("removed",dummyIndexId); |
||
228 | sendFieldUp("siges",dummyIndexId); |
||
229 | sendFieldUp("nome",dummyIndexId); |
||
230 | sendFieldUp("nomeEn",dummyIndexId); |
||
231 | sendFieldUp("nomeEs",dummyIndexId); |
||
232 | sendFieldUp("nomeFr",dummyIndexId); |
||
1507 | jmachado | 233 | |
1516 | jmachado | 234 | sendFieldUp("totalHoras",dummyIndexId); |
235 | sendFieldUp("horasContactoT",dummyIndexId); |
||
236 | sendFieldUp("horasContactoTP",dummyIndexId); |
||
237 | sendFieldUp("horasContactoP",dummyIndexId); |
||
238 | sendFieldUp("horasContactoPL",dummyIndexId); |
||
239 | sendFieldUp("horasContactoPD",dummyIndexId); |
||
240 | sendFieldUp("horasContactoOT",dummyIndexId); |
||
241 | sendFieldUp("horasContactoE",dummyIndexId); |
||
242 | sendFieldUp("horasContactoS",dummyIndexId); |
||
243 | sendFieldUp("horasContactoTC",dummyIndexId); |
||
244 | sendFieldUp("horasContactoO",dummyIndexId); |
||
245 | sendFieldUp("ECTS",dummyIndexId); |
||
246 | sendFieldUp("urlUnidadeCurricular",dummyIndexId); |
||
247 | sendFieldUp("urlFichaCurricular",dummyIndexId); |
||
1507 | jmachado | 248 | |
1516 | jmachado | 249 | } |
250 | function sendDownUnidadeCurricular(dummyIndexId) |
||
251 | { |
||
252 | sendFieldDown("removed",dummyIndexId); |
||
253 | sendFieldDown("siges",dummyIndexId); |
||
254 | sendFieldDown("nome",dummyIndexId); |
||
255 | sendFieldDown("nomeEn",dummyIndexId); |
||
256 | sendFieldDown("nomeEs",dummyIndexId); |
||
257 | sendFieldDown("nomeFr",dummyIndexId); |
||
1507 | jmachado | 258 | |
1516 | jmachado | 259 | sendFieldDown("totalHoras",dummyIndexId); |
260 | sendFieldDown("horasContactoT",dummyIndexId); |
||
261 | sendFieldDown("horasContactoTP",dummyIndexId); |
||
262 | sendFieldDown("horasContactoP",dummyIndexId); |
||
263 | sendFieldDown("horasContactoPL",dummyIndexId); |
||
264 | sendFieldDown("horasContactoPD",dummyIndexId); |
||
265 | sendFieldDown("horasContactoOT",dummyIndexId); |
||
266 | sendFieldDown("horasContactoE",dummyIndexId); |
||
267 | sendFieldDown("horasContactoS",dummyIndexId); |
||
268 | sendFieldDown("horasContactoTC",dummyIndexId); |
||
269 | sendFieldDown("horasContactoO",dummyIndexId); |
||
270 | sendFieldDown("ECTS",dummyIndexId); |
||
271 | sendFieldDown("urlUnidadeCurricular",dummyIndexId); |
||
272 | sendFieldDown("urlFichaCurricular",dummyIndexId); |
||
273 | |||
274 | } |
||
275 | function sendFieldUp(field,dummyIndexId){ |
||
276 | nome = $("#" + field + "dummyIndex" + dummyIndexId).val(); |
||
277 | $("#" + field + "dummyIndex" + (dummyIndexId)).val($("#" + field + "dummyIndex" + (dummyIndexId-1)).val()); |
||
278 | $("#" + field + "dummyIndex" + (dummyIndexId-1)).val(nome); |
||
279 | } |
||
280 | function sendFieldDown(field,dummyIndexId){ |
||
281 | nome = $("#" + field + "dummyIndex" + dummyIndexId).val(); |
||
282 | $("#" + field + "dummyIndex" + (dummyIndexId)).val($("#" + field + "dummyIndex" + (dummyIndexId+1)).val()); |
||
283 | $("#" + field + "dummyIndex" + (dummyIndexId+1)).val(nome); |
||
284 | } |
||
285 | function removeUnit(dummyIndexId) |
||
286 | { |
||
287 | $("#removed" + "dummyIndex" + dummyIndexId).val("true"); |
||
288 | $("#removed" + "dummyIndex" + dummyIndexId).closest("tr").hide("slow"); |
||
289 | |||
290 | } |
||
1517 | jmachado | 291 | |
292 | function sendUpSemestre(dummySemestreId,form) |
||
293 | { |
||
294 | $(form.semestreId).val("semestreDummy" + dummySemestreId); |
||
295 | $(form.dispatch).val("sendUpSemestre"); |
||
296 | form.submit(); |
||
297 | } |
||
298 | function sendDownSemestre(dummySemestreId,form) |
||
299 | { |
||
300 | $(form.semestreId).val("semestreDummy" +dummySemestreId); |
||
301 | $(form.dispatch).val("sendDownSemestre"); |
||
302 | form.submit(); |
||
303 | } |
||
304 | |||
305 | function sendUpPerfil(dummyPerfilId,form,dummySemestreId) |
||
306 | { |
||
307 | form.action = form.action + "#" + dummySemestreId; |
||
308 | $(form.perfilId).val("perfilDummy" + dummyPerfilId); |
||
309 | $(form.dispatch).val("sendUpPerfil"); |
||
310 | form.submit(); |
||
311 | } |
||
312 | function sendDownPerfil(dummyPerfilId,form,dummySemestreId) |
||
313 | { |
||
314 | form.action = form.action + "#" + dummySemestreId; |
||
315 | $(form.perfilId).val("perfilDummy" + dummyPerfilId); |
||
316 | $(form.dispatch).val("sendDownPerfil"); |
||
317 | form.submit(); |
||
318 | } |
||
1516 | jmachado | 319 | </script> |
320 | <nested:notEmpty property="planoEstudos"> |
||
321 | |||
322 | <html:hidden property="planoEstudos.siges"/> |
||
323 | <html:hidden property="planoEstudos.nome"/> |
||
324 | <html:hidden property="planoEstudos.dep"/> |
||
1517 | jmachado | 325 | <nested:size id="tamanhoSemestre" property="planoEstudos.semestre"/> |
326 | <nested:iterate id="semestre" indexId="semestreIndexId" property="planoEstudos.semestre" type="pt.estgp.estgweb.services.courses.xsd.Curso.Semestre"> |
||
327 | <div class="panel panel-primary"> |
||
1516 | jmachado | 328 | <div class="panel-heading"> |
329 | |||
330 | <div class="form-group"> |
||
331 | <% |
||
332 | dummyIndexSemestreId++; |
||
333 | request.setAttribute("dummyIndexSemestreId",dummyIndexSemestreId); |
||
334 | %> |
||
335 | <nested:hidden property="semestreId" value="semestreDummy${dummyIndexSemestreId}"/> |
||
1517 | jmachado | 336 | <div class="col-sm-2"> |
337 | <button type="button" class="btn btn-warning" onclick="sendUpSemestre('<%=dummyIndexSemestreId%>',this.form)"> |
||
338 | <span class="glyphicon glyphicon-arrow-up"> </span> |
||
339 | </button> |
||
340 | <button type="button" class="btn btn-warning" onclick="sendDownSemestre('<%=dummyIndexSemestreId%>',this.form)"> |
||
341 | <span class="glyphicon glyphicon-arrow-down"> </span> |
||
342 | </button> |
||
1516 | jmachado | 343 | <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#confirm-ModalFunction" data-message="Esta operação vai remover todas as unidades e perfis deste semestre!! Tem a certeza que deseja prosseguir? A operação não afeta as unidades nem os cursos do PAE, apenas o plano." data-script="$('#semestreId').val('semestreDummy${dummyIndexSemestreId}');set($('#CourseStudiesPlansAdminForm').get(0),'removeSemestre');$('#CourseStudiesPlansAdminForm').get(0).submit()"> |
344 | <span class="glyphicon glyphicon-remove"> </span> |
||
1507 | jmachado | 345 | </button> |
1505 | jmachado | 346 | </div> |
1516 | jmachado | 347 | <div class="col-sm-1"> |
348 | Duração |
||
349 | </div> |
||
1517 | jmachado | 350 | <div class="col-sm-3"> |
351 | <script> |
||
352 | $(document).ready( |
||
353 | function() |
||
354 | { |
||
355 | showHideSemestreDesc${dummyIndexSemestreId}(); |
||
356 | } |
||
357 | ); |
||
358 | |||
359 | |||
360 | function showHideSemestreDesc${dummyIndexSemestreId}() |
||
361 | { |
||
362 | if($("#selectSemestreDesc${dummyIndexSemestreId}").val()=='OP') |
||
363 | { |
||
364 | $('#semestreDescContainer${dummyIndexSemestreId}').show(); |
||
365 | } |
||
366 | else |
||
367 | { |
||
368 | $('#semestreDescContainer${dummyIndexSemestreId}').hide(); |
||
369 | } |
||
370 | } |
||
371 | </script> |
||
372 | <nested:select styleClass="form-control" property="id" styleId="selectSemestreDesc${dummyIndexSemestreId}" onchange="showHideSemestreDesc${dummyIndexSemestreId}(this)"> |
||
1516 | jmachado | 373 | <html:option value="S1">Semestre 1</html:option> |
374 | <html:option value="S2">Semestre 2</html:option> |
||
375 | <html:option value="S3">Semestre 3</html:option> |
||
376 | <html:option value="S4">Semestre 4</html:option> |
||
377 | <html:option value="S5">Semestre 5</html:option> |
||
378 | <html:option value="S6">Semestre 6</html:option> |
||
379 | <html:option value="T1">Trimestre 1</html:option> |
||
380 | <html:option value="T2">Trimestre 2</html:option> |
||
381 | <html:option value="T3">Trimestre 3</html:option> |
||
382 | <html:option value="T4">Trimestre 4</html:option> |
||
383 | <html:option value="T5">Trimestre 5</html:option> |
||
384 | <html:option value="T6">Trimestre 6</html:option> |
||
385 | <html:option value="T7">Trimestre 7</html:option> |
||
386 | <html:option value="T8">Trimestre 8</html:option> |
||
1517 | jmachado | 387 | <html:option value="OP">Opcionais</html:option> |
1516 | jmachado | 388 | </nested:select> |
1517 | jmachado | 389 | <div id="semestreDescContainer${dummyIndexSemestreId}"> |
390 | Descrição (PT) <nested:text property="semestreDesc" styleClass="form-control"/> |
||
391 | Descrição (EN) <nested:text property="semestreDescEn" styleClass="form-control"/> |
||
392 | Descrição (ES) <nested:text property="semestreDescEs" styleClass="form-control"/> |
||
393 | Descrição (FR) <nested:text property="semestreDescFr" styleClass="form-control"/> |
||
394 | </div> |
||
1516 | jmachado | 395 | </div> |
396 | <div class="col-sm-6"> |
||
1507 | jmachado | 397 | |
1516 | jmachado | 398 | <button style="margin-left: 4px" type="button" class="btn btn-success pull-right" onclick="form.action=form.action+'#semestreDummy${dummyIndexSemestreId}';$('#semestreId').val('semestreDummy${dummyIndexSemestreId}');set(this.form,'addUnidadeSemestre');this.form.submit()"> |
399 | <span class="glyphicon glyphicon-plus"> </span> Unidade |
||
400 | </button> |
||
401 | |||
402 | <button style="margin-left: 4px" type="button" class="btn btn-success pull-right" onclick="form.action=form.action+'#semestreDummy${dummyIndexSemestreId}';$('#semestreId').val('semestreDummy${dummyIndexSemestreId}');set(this.form,'addPerfilSemestre');this.form.submit()"> |
||
403 | <span class="glyphicon glyphicon-plus"> </span> Perfil |
||
404 | </button> |
||
405 | |||
406 | <a name="semestreDummy${dummyIndexSemestreId}"></a> |
||
407 | </div> |
||
408 | </div> |
||
409 | </div> |
||
410 | <div class="panel-body"> |
||
411 | |||
412 | |||
413 | <button class="btn btn-default" data-toggle="collapse" type="button" data-target=".langs">Ver Campos Multingua</button> |
||
1517 | jmachado | 414 | |
415 | <nested:size id="tamanhoPerfil" property="perfil"/> |
||
416 | <nested:iterate id="perfil" indexId="perfilIndexId" property="perfil" type="pt.estgp.estgweb.services.courses.xsd.Curso.Semestre.Perfil"> |
||
1518 | jmachado | 417 | <div class="panel panel-info"> |
1516 | jmachado | 418 | <div class="panel-heading"> |
419 | <div class="form-group"> |
||
1507 | jmachado | 420 | <% |
1516 | jmachado | 421 | dummyIndexPerfilId++; |
422 | request.setAttribute("dummyIndexPerfilId",dummyIndexPerfilId); |
||
1507 | jmachado | 423 | %> |
1516 | jmachado | 424 | <a name="perfilDummy${dummyIndexPerfilId}"></a> |
425 | <nested:hidden property="perfilId" value="perfilDummy${dummyIndexPerfilId}"/> |
||
1517 | jmachado | 426 | <div class="col-sm-2"> |
427 | <button type="button" class="btn btn-warning" onclick="sendUpPerfil('<%=dummyIndexPerfilId%>',this.form,'semestreDummy${dummyIndexSemestreId}')"> |
||
428 | <span class="glyphicon glyphicon-arrow-up"> </span> |
||
429 | </button> |
||
430 | <button type="button" class="btn btn-warning" onclick="sendDownPerfil('<%=dummyIndexPerfilId%>',this.form,'semestreDummy${dummyIndexSemestreId}')"> |
||
431 | <span class="glyphicon glyphicon-arrow-down"> </span> |
||
432 | </button> |
||
1516 | jmachado | 433 | <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#confirm-ModalFunction" data-message="Esta operação vai remover todas as unidades deste perfil!! Tem a certeza que deseja prosseguir? A operação não afeta as unidades nem os cursos do PAE, apenas o plano." data-script="$('#CourseStudiesPlansAdminForm').get(0).action=$('#CourseStudiesPlansAdminForm').get(0).action+'#semestreDummy${dummyIndexSemestreId}';$('#perfilId').val('perfilDummy${dummyIndexPerfilId}');set($('#CourseStudiesPlansAdminForm').get(0),'removePerfil');$('#CourseStudiesPlansAdminForm').get(0).submit()"> |
434 | <span class="glyphicon glyphicon-remove"> </span> |
||
435 | </button> |
||
436 | </div> |
||
437 | <div class="col-sm-1"> |
||
438 | Perfil |
||
439 | </div> |
||
1517 | jmachado | 440 | <div class="col-sm-5"> |
1516 | jmachado | 441 | <nested:text styleClass="form-control" property="nome"/> |
442 | </div> |
||
443 | <div class="col-sm-4"> |
||
444 | <button type="button" class="btn btn-success pull-right" onclick="form.action=form.action+'#perfilDummy${dummyIndexPerfilId}';$('#perfilId').val('perfilDummy${dummyIndexPerfilId}');set(this.form,'addUnidadePerfil');this.form.submit()"> |
||
445 | <span class="glyphicon glyphicon-plus"> </span> Unidade |
||
446 | </button> |
||
447 | </div> |
||
448 | </div> |
||
449 | </div> |
||
450 | <div class="panel-body"> |
||
451 | <table class="tablesorterfiltered"> |
||
452 | <thead> |
||
453 | <tr> |
||
454 | <td></td> |
||
455 | <td></td> |
||
456 | <th>SIGES</th> |
||
457 | <th>Nome</th> |
||
458 | <th>Total</th> |
||
459 | <th>T</th> |
||
460 | <th>TP</th> |
||
461 | <th>P</th> |
||
462 | <th>PL</th> |
||
463 | <th>PD</th> |
||
464 | <th>OT</th> |
||
465 | <th>E</th> |
||
466 | <th>S</th> |
||
467 | <th>TC</th> |
||
468 | <th>O</th> |
||
469 | <th>ECTS</th> |
||
470 | <th>URL UNIDADE</th> |
||
471 | <th>FICHA URL</th> |
||
472 | </tr> |
||
473 | </thead> |
||
474 | <tbody> |
||
475 | <nested:size id="tamanho" property="unidade"/> |
||
476 | <nested:iterate id="unit" indexId="indexId" property="unidade" type="pt.estgp.estgweb.services.courses.xsd.UnidadeType"> |
||
1507 | jmachado | 477 | |
1516 | jmachado | 478 | <% |
479 | dummyIndexIdUnidades++; |
||
480 | request.setAttribute("dummyIndexIdUnidades","dummyIndex" + dummyIndexIdUnidades); |
||
481 | %> |
||
482 | <% |
||
483 | int tamanhoMinus1 = tamanho - 1; |
||
484 | request.setAttribute("tamanhoMinus1",tamanhoMinus1); |
||
1507 | jmachado | 485 | |
1516 | jmachado | 486 | %> |
487 | <tr <nested:equal property="removed" value="true">class="hidden"</nested:equal>> |
||
488 | <td class="text-nowrap"> |
||
489 | |||
1517 | jmachado | 490 | <%-- |
491 | Usando o dummyIndex apenas não colocamos botao de up na primeira de todas as unidades de todos os semestres |
||
492 | Antes usavamos o indexId e trabalhavamos lista a lista considerando semestres e perfis independentes |
||
493 | --%> |
||
494 | <nested:notEqual value="dummyIndex1" name="dummyIndexIdUnidades"> |
||
1516 | jmachado | 495 | <button type="button" class="btn btn-warning" onclick="sendUpUnidadeCurricular(<%=dummyIndexIdUnidades%>)"> |
496 | <span class="glyphicon glyphicon-arrow-up"> </span> |
||
497 | </button> |
||
1517 | jmachado | 498 | </nested:notEqual> |
499 | <% |
||
500 | boolean perfilMaximoAtingido = perfilIndexId >= tamanhoPerfil - 1; |
||
501 | boolean semestreMaximoAtingido = semestreIndexId >= tamanhoSemestre - 1; |
||
502 | boolean tamanhoMaximoAtingido = indexId >= tamanho - 1; |
||
503 | if(!perfilMaximoAtingido || !semestreMaximoAtingido || !tamanhoMaximoAtingido) |
||
504 | { |
||
505 | %> |
||
1516 | jmachado | 506 | <button type="button" class="btn btn-warning" onclick="sendDownUnidadeCurricular(<%=dummyIndexIdUnidades%>)"> |
507 | <span class="glyphicon glyphicon-arrow-down"> </span> |
||
508 | </button> |
||
1517 | jmachado | 509 | <% |
510 | } |
||
511 | %> |
||
1516 | jmachado | 512 | </td> |
513 | <td> |
||
514 | <nested:hidden styleId="removed${dummyIndexIdUnidades}" property="removed"/> |
||
515 | <button type="button" class="btn btn-danger" onclick="removeUnit(<%=dummyIndexIdUnidades%>)"> |
||
516 | <span class="glyphicon glyphicon-remove"> </span> |
||
1507 | jmachado | 517 | </button> |
1516 | jmachado | 518 | </td> |
519 | <td> |
||
1519 | jmachado | 520 | <script> |
521 | $(document).ready( |
||
522 | function() |
||
523 | { |
||
524 | $("#siges${dummyIndexIdUnidades}").focusout( |
||
525 | function(){ |
||
526 | var code = $("#siges${dummyIndexIdUnidades}").val(); |
||
527 | $.getJSON("<%=request.getContextPath()%>/user/courses/courseApiJson.jsp", |
||
528 | { service:"findCourseUnit", |
||
529 | siges: code, |
||
530 | courseSigesCode: "${course.code}" |
||
531 | }, |
||
532 | function(data) |
||
533 | { |
||
534 | if(data.response == "ok") |
||
535 | { |
||
536 | $("#nome${dummyIndexIdUnidades}").val(data.courseUnitName); |
||
537 | $("#sigesResponse${dummyIndexIdUnidades}").html(""); |
||
538 | } |
||
539 | else |
||
540 | { |
||
541 | $("#sigesResponse${dummyIndexIdUnidades}").html("Não encontrado"); |
||
542 | } |
||
543 | } |
||
544 | ); |
||
545 | } |
||
546 | ); |
||
547 | } |
||
548 | ); |
||
549 | </script> |
||
550 | |||
551 | <nested:text styleId="siges${dummyIndexIdUnidades}" styleClass="form-control" property="siges"/> |
||
552 | <div id="sigesResponse${dummyIndexIdUnidades}"></div> |
||
553 | </td> |
||
554 | <td> |
||
1516 | jmachado | 555 | <div> |
556 | <div class="col-sm-1">(PT)</div> |
||
557 | <div class="col-sm-11"><nested:text styleId="nome${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nome"/></div> |
||
1505 | jmachado | 558 | |
1516 | jmachado | 559 | <div class="langs collapse" > |
560 | <div class="col-sm-1">(EN)</div> |
||
561 | <div class="col-sm-11"><nested:text styleId="nomeEn${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeEn"/></div> |
||
562 | <div class="col-sm-1">(ES)</div> |
||
563 | <div class="col-sm-11"><nested:text styleId="nomeEs${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeEs"/></div> |
||
564 | <div class="col-sm-1">(FR)</div> |
||
565 | <div class="col-sm-11"><nested:text styleId="nomeFr${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeFr"/></div> |
||
566 | </div> |
||
1505 | jmachado | 567 | </div> |
568 | |||
1516 | jmachado | 569 | </td> |
570 | <td><nested:text styleClass="form-control" styleId="totalHoras${dummyIndexIdUnidades}" property="totalHoras"/></td> |
||
571 | <td><nested:text styleClass="form-control" styleId="horasContactoT${dummyIndexIdUnidades}" property="horasContacto.t"/></td> |
||
572 | <td><nested:text styleClass="form-control" styleId="horasContactoTP${dummyIndexIdUnidades}" property="horasContacto.TP"/></td> |
||
573 | <td><nested:text styleClass="form-control" styleId="horasContactoP${dummyIndexIdUnidades}" property="horasContacto.p"/></td> |
||
574 | <td><nested:text styleClass="form-control" styleId="horasContactoPL${dummyIndexIdUnidades}" property="horasContacto.PL"/></td> |
||
575 | <td><nested:text styleClass="form-control" styleId="horasContactoPD${dummyIndexIdUnidades}" property="horasContacto.PD"/></td> |
||
576 | <td><nested:text styleClass="form-control" styleId="horasContactoOT${dummyIndexIdUnidades}" property="horasContacto.OT"/></td> |
||
577 | <td><nested:text styleClass="form-control" styleId="horasContactoE${dummyIndexIdUnidades}" property="horasContacto.e"/></td> |
||
578 | <td><nested:text styleClass="form-control" styleId="horasContactoS${dummyIndexIdUnidades}" property="horasContacto.s"/></td> |
||
579 | <td><nested:text styleClass="form-control" styleId="horasContactoTC${dummyIndexIdUnidades}" property="horasContacto.TC"/></td> |
||
580 | <td><nested:text styleClass="form-control" styleId="horasContactoO${dummyIndexIdUnidades}" property="horasContacto.o"/></td> |
||
581 | <td><nested:text styleClass="form-control" styleId="ECTS${dummyIndexIdUnidades}" property="ECTS"/></td> |
||
582 | <td><nested:text styleClass="form-control" styleId="urlUnidadeCurricular${dummyIndexIdUnidades}" style="width:600px" property="urlUnidadeCurricular"/></td> |
||
583 | <td><nested:text styleClass="form-control" styleId="urlFichaCurricular${dummyIndexIdUnidades}" style="width:600px" property="urlFichaCurricular"/></td> |
||
584 | </tr> |
||
585 | </nested:iterate> |
||
586 | </tbody> |
||
587 | </table> |
||
588 | </div> |
||
1505 | jmachado | 589 | </div> |
590 | |||
1516 | jmachado | 591 | </nested:iterate> |
1505 | jmachado | 592 | |
1516 | jmachado | 593 | <nested:notEmpty property="unidade"> |
1507 | jmachado | 594 | |
1516 | jmachado | 595 | <table class="tablesorterfiltered"> |
596 | <thead> |
||
597 | <tr> |
||
598 | <th></th> |
||
599 | <th></th> |
||
600 | <th>SIGES</th> |
||
601 | <th>Nome</th> |
||
602 | <th>Total</th> |
||
603 | <th>T</th> |
||
604 | <th>TP</th> |
||
605 | <th>P</th> |
||
606 | <th>PL</th> |
||
607 | <th>PD</th> |
||
608 | <th>OT</th> |
||
609 | <th>E</th> |
||
610 | <th>S</th> |
||
611 | <th>TC</th> |
||
612 | <th>O</th> |
||
613 | <th>ECTS</th> |
||
614 | <th>URL UNIDADE</th> |
||
615 | <th>FICHA URL</th> |
||
616 | </tr> |
||
617 | </thead> |
||
618 | <tbody> |
||
619 | <nested:size id="tamanho" property="unidade"/> |
||
620 | <nested:iterate id="unit" property="unidade" indexId="indexId" type="pt.estgp.estgweb.services.courses.xsd.UnidadeType"> |
||
621 | <% |
||
622 | dummyIndexIdUnidades++; |
||
623 | request.setAttribute("dummyIndexIdUnidades","dummyIndex" + dummyIndexIdUnidades); |
||
624 | %> |
||
625 | <% |
||
626 | int tamanhoMinus1 = tamanho - 1; |
||
627 | request.setAttribute("tamanhoMinus1",tamanhoMinus1); |
||
1507 | jmachado | 628 | |
1516 | jmachado | 629 | %> |
1507 | jmachado | 630 | |
1516 | jmachado | 631 | <tr <nested:equal property="removed" value="true">class="hidden"</nested:equal>> |
632 | <td class="text-nowrap"> |
||
1507 | jmachado | 633 | |
1517 | jmachado | 634 | <%-- |
635 | Usando o dummyIndex apenas não colocamos botao de up na primeira de todas as unidades de todos os semestres |
||
636 | Antes usavamos o indexId e trabalhavamos lista a lista considerando semestres e perfis independentes |
||
637 | --%> |
||
638 | <nested:notEqual value="dummyIndex1" name="dummyIndexIdUnidades"> |
||
1516 | jmachado | 639 | <button type="button" class="btn btn-warning" onclick="sendUpUnidadeCurricular(<%=dummyIndexIdUnidades%>)"> |
640 | <span class="glyphicon glyphicon-arrow-up"> </span> |
||
641 | </button> |
||
1517 | jmachado | 642 | </nested:notEqual> |
643 | <% |
||
644 | boolean semestreMaximoAtingido = semestreIndexId >= tamanhoSemestre - 1; |
||
645 | boolean tamanhoMaximoAtingido = indexId >= tamanho - 1; |
||
646 | if(!semestreMaximoAtingido || !tamanhoMaximoAtingido) |
||
647 | { |
||
648 | %> |
||
649 | <button type="button" class="btn btn-warning" onclick="sendDownUnidadeCurricular(<%=dummyIndexIdUnidades%>)"> |
||
650 | <span class="glyphicon glyphicon-arrow-down"> </span> |
||
651 | </button> |
||
652 | <% |
||
653 | } |
||
654 | %> |
||
1516 | jmachado | 655 | </td> |
656 | <td> |
||
657 | <nested:hidden styleId="removed${dummyIndexIdUnidades}" property="removed"/> |
||
658 | <button type="button" class="btn btn-danger" onclick="removeUnit(<%=dummyIndexIdUnidades%>)" > |
||
659 | <span class="glyphicon glyphicon-remove"> </span> |
||
1507 | jmachado | 660 | </button> |
1516 | jmachado | 661 | </td> |
662 | <td><nested:text styleId="siges${dummyIndexIdUnidades}" styleClass="form-control" property="siges"/></td> |
||
663 | <td> |
||
664 | <div> |
||
665 | <div class="col-sm-1">(PT)</div> |
||
666 | <div class="col-sm-11"><nested:text styleId="nome${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nome"/></div> |
||
1505 | jmachado | 667 | |
1516 | jmachado | 668 | <div class="langs collapse" > |
669 | <div class="col-sm-1">(EN)</div> |
||
670 | <div class="col-sm-11"><nested:text styleId="nomeEn${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeEn"/></div> |
||
671 | <div class="col-sm-1">(ES)</div> |
||
672 | <div class="col-sm-11"><nested:text styleId="nomeEs${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeEs"/></div> |
||
673 | <div class="col-sm-1">(FR)</div> |
||
674 | <div class="col-sm-11"><nested:text styleId="nomeFr${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeFr"/></div> |
||
675 | </div> |
||
1505 | jmachado | 676 | </div> |
677 | |||
1516 | jmachado | 678 | </td> |
679 | <td><nested:text styleClass="form-control" styleId="totalHoras${dummyIndexIdUnidades}" property="totalHoras"/></td> |
||
680 | <td><nested:text styleClass="form-control" styleId="horasContactoT${dummyIndexIdUnidades}" property="horasContacto.t"/></td> |
||
681 | <td><nested:text styleClass="form-control" styleId="horasContactoTP${dummyIndexIdUnidades}" property="horasContacto.TP"/></td> |
||
682 | <td><nested:text styleClass="form-control" styleId="horasContactoP${dummyIndexIdUnidades}" property="horasContacto.p"/></td> |
||
683 | <td><nested:text styleClass="form-control" styleId="horasContactoPL${dummyIndexIdUnidades}" property="horasContacto.PL"/></td> |
||
684 | <td><nested:text styleClass="form-control" styleId="horasContactoPD${dummyIndexIdUnidades}" property="horasContacto.PD"/></td> |
||
685 | <td><nested:text styleClass="form-control" styleId="horasContactoOT${dummyIndexIdUnidades}" property="horasContacto.OT"/></td> |
||
686 | <td><nested:text styleClass="form-control" styleId="horasContactoE${dummyIndexIdUnidades}" property="horasContacto.e"/></td> |
||
687 | <td><nested:text styleClass="form-control" styleId="horasContactoS${dummyIndexIdUnidades}" property="horasContacto.s"/></td> |
||
688 | <td><nested:text styleClass="form-control" styleId="horasContactoTC${dummyIndexIdUnidades}" property="horasContacto.TC"/></td> |
||
689 | <td><nested:text styleClass="form-control" styleId="horasContactoO${dummyIndexIdUnidades}" property="horasContacto.o"/></td> |
||
690 | <td><nested:text styleClass="form-control" styleId="ECTS${dummyIndexIdUnidades}" property="ECTS"/></td> |
||
691 | <td><nested:text styleClass="form-control" styleId="urlUnidadeCurricular${dummyIndexIdUnidades}" style="width:600px" property="urlUnidadeCurricular"/></td> |
||
692 | <td><nested:text styleClass="form-control" styleId="urlFichaCurricular${dummyIndexIdUnidades}" style="width:600px" property="urlFichaCurricular"/></td> |
||
693 | </tr> |
||
694 | </nested:iterate> |
||
695 | </tbody> |
||
696 | </table> |
||
697 | </nested:notEmpty> |
||
1507 | jmachado | 698 | |
1516 | jmachado | 699 | </div> |
1505 | jmachado | 700 | </div> |
701 | |||
1516 | jmachado | 702 | </nested:iterate> |
1505 | jmachado | 703 | |
1516 | jmachado | 704 | </nested:notEmpty> |
1505 | jmachado | 705 | |
1516 | jmachado | 706 | <a type="button" class="btn btn-danger" href="<%=request.getContextPath()%>/user/adminStudyPlans.do?courseId=${courseId}">Cancelar</a> |
707 | <html:submit styleClass="btn btn-success" >Salvar</html:submit> |
||
1505 | jmachado | 708 | |
709 | |||
710 | |||
1516 | jmachado | 711 | |
712 | </div> |
||
1505 | jmachado | 713 | </div> |
1516 | jmachado | 714 | </html:form> |
1505 | jmachado | 715 | </div> |
716 | </div> |
||
717 | |||
718 | <% |
||
719 | |||
720 | AbstractDao.getCurrentSession().getTransaction().commit(); |
||
721 | %> |
||
722 |