Subversion Repositories bacoAlunos

Rev

Rev 1535 | Rev 1541 | 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
 
1534 jmachado 90
 
91
 
1505 jmachado 92
            <div class="panel panel-default">
93
                <div class="panel-heading">Dados do Curso</div>
94
                <div class="panel-body">
95
 
96
                    <div class="col-sm-12">Código do Curso <label class="text-info">${course.code}</label></div>
97
                    <div class="col-sm-12">
98
                        <table class="tablesorter-blue">
99
                            <thead>
100
                                <tr>
101
                                    <th>Língua</th>
102
                                    <th>Nome do Curso</th>
103
                                    <th>Departamento</th>
104
                                </tr>
105
                            </thead>
106
                            <tbody>
107
                                <tr>
108
                                    <td>PT</td>
109
                                    <td>${course.name}</td>
110
                                    <td>
111
                                    <%if(course.getDepartment() != null){%>${course.department.name}<%}%>
112
                                    </td>
113
                                </tr>
114
                                <tr>
115
                                    <td>EN</td>
116
                                    <td>${course.nameEn}</td>
117
                                    <td>
118
                                        <%if(course.getDepartment() != null){%>${course.department.nameEn}<%}%>
119
 
120
                                    </td>
121
                                </tr>
122
                                <tr>
123
                                    <td>ES</td>
124
                                    <td>${course.nameEs}</td>
125
                                    <td>
126
                                        <%if(course.getDepartment() != null){%>${course.department.nameEs}<%}%>
127
                                    </td>
128
                                </tr>
129
                                <tr>
130
                                    <td>FR</td>
131
                                    <td>${course.nameFr}</td>
132
                                    <td>
133
                                        <%if(course.getDepartment() != null){%>${course.department.nameFr}<%}%>
134
                                    </td>
135
                                </tr>
136
                            </tbody>
137
                        </table>
138
                   </div>
139
 
140
                </div>
141
            </div>
1534 jmachado 142
            <html:form action="/user/courseControllerStudiesPlan" styleId="CourseStudiesPlansAdminForm" styleClass="form-horizontal"  enctype="multipart/form-data">
143
 
1516 jmachado 144
                <div class="panel panel-warning">
145
                    <div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> Clonagem a partir de outro plano de Estudos</div>
146
                    <div class="panel-body">
1505 jmachado 147
 
148
                            <div class="form-group">
1516 jmachado 149
                                <label class="control-label col-sm-2">Versão Fonte para Clonagem</label>
1505 jmachado 150
                                <div class="col-sm-10">
1516 jmachado 151
                                    <html:select styleClass="form-control" property="sourcePlanId">
152
                                        <html:option value="">Nenhuma</html:option>
153
                                    <%
154
                                        for(CourseStudiesPlan plan:course.getStudiesPlans())
155
                                        {
156
                                            if(plan.getId() != studyPlanId)
157
                                            {
158
                                                request.setAttribute("nowPlanId",plan.getId());
159
                                        %>
160
                                            <html:option value="${nowPlanId}">Versão <%=plan.getVersion()%></html:option>
161
                                        <%
162
                                            }
163
 
164
                                        }
165
                                    %>
166
                                    </html:select>
1505 jmachado 167
                                </div>
168
                            </div>
1516 jmachado 169
                            <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();">
170
                                Clonar para a fonte escolhida
171
                            </button>
1505 jmachado 172
 
1507 jmachado 173
 
174
 
1516 jmachado 175
                    </div>
176
                </div>
1507 jmachado 177
 
1536 jmachado 178
                <%
179
                    CourseStudiesPlansAdminForm courseStudiesPlansAdminForm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm");
180
                    //Form ainda não iniciado vai iniciar é a primeira vez
181
                    if(courseStudiesPlansAdminForm.getCourseStudiesPlan().getId() <= 0)
182
                    {
183
                        courseStudiesPlansAdminForm.setCourseStudiesPlan(planoEdicao);
184
                        courseStudiesPlansAdminForm.setCourseId(courseId);
185
                        courseStudiesPlansAdminForm.setVersaoVigor(ultimaVersao);
186
                        courseStudiesPlansAdminForm.setPlanoEstudos(new CoursesService().loadCursoPlanoFromXml(planoEdicao.getXml()));
187
                    }
188
                %>
1535 jmachado 189
                <logic:notEmpty name="CourseStudiesPlansAdminForm" property="courseStudiesPlan.importLog">
1534 jmachado 190
                    <div class="panel panel-warning">
1536 jmachado 191
                        <div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> LOG DA ULTIMA IMPORTAÇÃO</div>
1534 jmachado 192
                        <div class="panel-body">
193
                            <pre>
1535 jmachado 194
                                <html:hidden name="CourseStudiesPlansAdminForm" property="courseStudiesPlan.importLog"/>
195
                                <bean:write name="CourseStudiesPlansAdminForm" property="courseStudiesPlan.importLog"/>
1536 jmachado 196
 
1534 jmachado 197
                            </pre>
198
                        </div>
199
                    </div>
200
                </logic:notEmpty>
201
                <div class="panel panel-warning">
202
                    <div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> Importar Ficheiro do SIGES em formato TXT: <a href="<%=request.getContextPath()%>/user/courses/9500-Enfermagem.TXT">VEJA UM EXEMPLO DE ENFERMAGEM</a></div>
203
                    <div class="panel-body">
1507 jmachado 204
 
1534 jmachado 205
                        <div class="form-group">
206
                            <label class="control-label col-sm-2">Escolher Ficheiro Exportado do Siges</label>
207
                            <div class="col-sm-10">
208
                                <html:file styleClass="form-control" property="formFileImport"/>
209
                            </div>
210
                        </div>
211
                        <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),'importarPlano');$('#CourseStudiesPlansAdminForm').get(0).submit();">
212
                            Importar o ficheiro sobrepondo esta versão do plano
213
                        </button>
214
                    </div>
215
                </div>
216
 
217
 
1516 jmachado 218
                <div class="panel panel-default">
219
                    <div class="panel-heading">Plano de Estudos
1507 jmachado 220
 
1516 jmachado 221
                        <button style="margin-left: 4px"  type="button" class="btn btn-success pull-right" onclick="set(this.form,'addNewSemestre');this.form.submit()">
222
                            <span class="glyphicon glyphicon-plus"> </span> Semestre
223
                        </button>
224
                    </div>
225
                    <div class="panel-body">
1507 jmachado 226
 
227
 
1516 jmachado 228
                                <input type="hidden" name="dispatch" value="savePlano"/>
229
                                <html:hidden property="courseId"/>
230
                                <html:hidden property="versaoVigor"/>
231
                                <html:hidden property="courseStudiesPlan.id"/>
232
                                <html:hidden styleId="semestreId" property="semestreId"/>
233
                                <html:hidden styleId="perfilId" property="perfilId"/>
1505 jmachado 234
 
1516 jmachado 235
                                <div class="form-group">
236
                                    <label class="control-label col-sm-2">Versão</label>
237
                                    <div class="col-sm-10">
238
                                        <html:text styleClass="form-control" property="courseStudiesPlan.version" size="3"/>
239
                                    </div>
240
                                </div>
241
                                <div class="form-group">
242
                                    <label class="control-label col-sm-2">Descrição</label>
243
                                    <div class="col-sm-10">
244
                                        <html:text styleClass="form-control" property="courseStudiesPlan.versionDescription"/>
245
                                    </div>
246
                                </div>
1507 jmachado 247
 
1534 jmachado 248
 
249
 
250
 
1516 jmachado 251
                                <%
252
                                    int dummyIndexIdUnidades = 0;
253
                                    int dummyIndexPerfilId = 0;
254
                                    int dummyIndexSemestreId = 0;
1507 jmachado 255
 
1516 jmachado 256
                                %>
257
                                <script>
1505 jmachado 258
 
1516 jmachado 259
                                    function sendUpUnidadeCurricular(dummyIndexId)
260
                                    {
261
                                        sendFieldUp("removed",dummyIndexId);
262
                                        sendFieldUp("siges",dummyIndexId);
263
                                        sendFieldUp("nome",dummyIndexId);
264
                                        sendFieldUp("nomeEn",dummyIndexId);
265
                                        sendFieldUp("nomeEs",dummyIndexId);
266
                                        sendFieldUp("nomeFr",dummyIndexId);
1507 jmachado 267
 
1516 jmachado 268
                                        sendFieldUp("totalHoras",dummyIndexId);
269
                                        sendFieldUp("horasContactoT",dummyIndexId);
270
                                        sendFieldUp("horasContactoTP",dummyIndexId);
271
                                        sendFieldUp("horasContactoP",dummyIndexId);
272
                                        sendFieldUp("horasContactoPL",dummyIndexId);
273
                                        sendFieldUp("horasContactoPD",dummyIndexId);
274
                                        sendFieldUp("horasContactoOT",dummyIndexId);
275
                                        sendFieldUp("horasContactoE",dummyIndexId);
276
                                        sendFieldUp("horasContactoS",dummyIndexId);
277
                                        sendFieldUp("horasContactoTC",dummyIndexId);
278
                                        sendFieldUp("horasContactoO",dummyIndexId);
279
                                        sendFieldUp("ECTS",dummyIndexId);
280
                                        sendFieldUp("urlUnidadeCurricular",dummyIndexId);
281
                                        sendFieldUp("urlFichaCurricular",dummyIndexId);
1507 jmachado 282
 
1516 jmachado 283
                                    }
284
                                    function sendDownUnidadeCurricular(dummyIndexId)
285
                                    {
286
                                        sendFieldDown("removed",dummyIndexId);
287
                                        sendFieldDown("siges",dummyIndexId);
288
                                        sendFieldDown("nome",dummyIndexId);
289
                                        sendFieldDown("nomeEn",dummyIndexId);
290
                                        sendFieldDown("nomeEs",dummyIndexId);
291
                                        sendFieldDown("nomeFr",dummyIndexId);
1507 jmachado 292
 
1516 jmachado 293
                                        sendFieldDown("totalHoras",dummyIndexId);
294
                                        sendFieldDown("horasContactoT",dummyIndexId);
295
                                        sendFieldDown("horasContactoTP",dummyIndexId);
296
                                        sendFieldDown("horasContactoP",dummyIndexId);
297
                                        sendFieldDown("horasContactoPL",dummyIndexId);
298
                                        sendFieldDown("horasContactoPD",dummyIndexId);
299
                                        sendFieldDown("horasContactoOT",dummyIndexId);
300
                                        sendFieldDown("horasContactoE",dummyIndexId);
301
                                        sendFieldDown("horasContactoS",dummyIndexId);
302
                                        sendFieldDown("horasContactoTC",dummyIndexId);
303
                                        sendFieldDown("horasContactoO",dummyIndexId);
304
                                        sendFieldDown("ECTS",dummyIndexId);
305
                                        sendFieldDown("urlUnidadeCurricular",dummyIndexId);
306
                                        sendFieldDown("urlFichaCurricular",dummyIndexId);
307
 
308
                                    }
309
                                    function sendFieldUp(field,dummyIndexId){
310
                                        nome = $("#" + field + "dummyIndex" + dummyIndexId).val();
311
                                        $("#" + field + "dummyIndex" + (dummyIndexId)).val($("#" + field + "dummyIndex" + (dummyIndexId-1)).val());
312
                                        $("#" + field + "dummyIndex" + (dummyIndexId-1)).val(nome);
313
                                    }
314
                                    function sendFieldDown(field,dummyIndexId){
315
                                        nome = $("#" + field + "dummyIndex" + dummyIndexId).val();
316
                                        $("#" + field + "dummyIndex" + (dummyIndexId)).val($("#" + field + "dummyIndex" + (dummyIndexId+1)).val());
317
                                        $("#" + field + "dummyIndex" + (dummyIndexId+1)).val(nome);
318
                                    }
319
                                    function removeUnit(dummyIndexId)
320
                                    {
321
                                        $("#removed" + "dummyIndex" + dummyIndexId).val("true");
322
                                        $("#removed" + "dummyIndex" + dummyIndexId).closest("tr").hide("slow");
323
 
324
                                    }
1517 jmachado 325
 
326
                                    function sendUpSemestre(dummySemestreId,form)
327
                                    {
328
                                        $(form.semestreId).val("semestreDummy" + dummySemestreId);
329
                                        $(form.dispatch).val("sendUpSemestre");
330
                                        form.submit();
331
                                    }
332
                                    function sendDownSemestre(dummySemestreId,form)
333
                                    {
334
                                        $(form.semestreId).val("semestreDummy" +dummySemestreId);
335
                                        $(form.dispatch).val("sendDownSemestre");
336
                                        form.submit();
337
                                    }
338
 
339
                                    function sendUpPerfil(dummyPerfilId,form,dummySemestreId)
340
                                    {
341
                                        form.action = form.action + "#" + dummySemestreId;
342
                                        $(form.perfilId).val("perfilDummy" + dummyPerfilId);
343
                                        $(form.dispatch).val("sendUpPerfil");
344
                                        form.submit();
345
                                    }
346
                                    function sendDownPerfil(dummyPerfilId,form,dummySemestreId)
347
                                    {
348
                                        form.action = form.action + "#" + dummySemestreId;
349
                                        $(form.perfilId).val("perfilDummy" + dummyPerfilId);
350
                                        $(form.dispatch).val("sendDownPerfil");
351
                                        form.submit();
352
                                    }
1516 jmachado 353
                                </script>
354
                                <nested:notEmpty  property="planoEstudos">
355
 
1534 jmachado 356
                                    <div class="panel panel-default">
357
                                        <div class="panel-heading">
358
                                            Informação obtida do Siges (Auxiliar)
359
                                        </div>
360
                                        <div class="panel-body">
361
                                            <div class="form-group">
362
                                                <label class="control-label col-sm-2">Ano do Plano no Siges</label>
363
                                                <div class="col-sm-10">
364
                                                    <html:text styleClass="form-control" property="planoEstudos.anoPlanoSiges"/>
365
                                                </div>
366
                                            </div>
367
                                            <div class="form-group">
368
                                                <label class="control-label col-sm-2">Código do Plano no Siges</label>
369
                                                <div class="col-sm-10">
370
                                                    <html:text styleClass="form-control" property="planoEstudos.codigoPlanoSiges"/>
371
                                                </div>
372
                                            </div>
373
                                            <div class="form-group">
374
                                                <label class="control-label col-sm-2">Linha Descritiva do Plano no Siges</label>
375
                                                <div class="col-sm-10">
376
                                                    <html:text styleClass="form-control" property="planoEstudos.descPlanoSiges"/>
377
                                                </div>
378
                                            </div>
379
                                        </div>
380
                                    </div>
381
 
1516 jmachado 382
                                    <html:hidden property="planoEstudos.siges"/>
383
                                    <html:hidden property="planoEstudos.nome"/>
384
                                    <html:hidden property="planoEstudos.dep"/>
1517 jmachado 385
                                    <nested:size id="tamanhoSemestre" property="planoEstudos.semestre"/>
386
                                    <nested:iterate id="semestre" indexId="semestreIndexId" property="planoEstudos.semestre" type="pt.estgp.estgweb.services.courses.xsd.Curso.Semestre">
387
                                        <div class="panel panel-primary">
1516 jmachado 388
                                            <div class="panel-heading">
389
 
390
                                                <div class="form-group">
391
                                                    <%
392
                                                        dummyIndexSemestreId++;
393
                                                        request.setAttribute("dummyIndexSemestreId",dummyIndexSemestreId);
394
                                                    %>
395
                                                    <nested:hidden property="semestreId" value="semestreDummy${dummyIndexSemestreId}"/>
1517 jmachado 396
                                                    <div class="col-sm-2">
397
                                                        <button type="button" class="btn btn-warning" onclick="sendUpSemestre('<%=dummyIndexSemestreId%>',this.form)">
398
                                                            <span class="glyphicon glyphicon-arrow-up"> </span>
399
                                                        </button>
400
                                                        <button type="button" class="btn btn-warning" onclick="sendDownSemestre('<%=dummyIndexSemestreId%>',this.form)">
401
                                                            <span class="glyphicon glyphicon-arrow-down"> </span>
402
                                                        </button>
1516 jmachado 403
                                                        <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()">
404
                                                            <span class="glyphicon glyphicon-remove"> </span>
1507 jmachado 405
                                                        </button>
1505 jmachado 406
                                                    </div>
1516 jmachado 407
                                                    <div class="col-sm-1">
408
                                                        Duração
409
                                                    </div>
1517 jmachado 410
                                                    <div class="col-sm-3">
411
                                                        <script>
412
                                                            $(document).ready(
413
                                                                    function()
414
                                                                    {
415
                                                                        showHideSemestreDesc${dummyIndexSemestreId}();
416
                                                                    }
417
                                                            );
418
 
419
 
420
                                                            function showHideSemestreDesc${dummyIndexSemestreId}()
421
                                                            {
422
                                                                if($("#selectSemestreDesc${dummyIndexSemestreId}").val()=='OP')
423
                                                                {
424
                                                                    $('#semestreDescContainer${dummyIndexSemestreId}').show();
425
                                                                }
426
                                                                else
427
                                                                {
428
                                                                    $('#semestreDescContainer${dummyIndexSemestreId}').hide();
429
                                                                }
430
                                                            }
431
                                                        </script>
432
                                                        <nested:select styleClass="form-control" property="id" styleId="selectSemestreDesc${dummyIndexSemestreId}" onchange="showHideSemestreDesc${dummyIndexSemestreId}(this)">
1516 jmachado 433
                                                            <html:option value="S1">Semestre 1</html:option>
434
                                                            <html:option value="S2">Semestre 2</html:option>
435
                                                            <html:option value="S3">Semestre 3</html:option>
436
                                                            <html:option value="S4">Semestre 4</html:option>
437
                                                            <html:option value="S5">Semestre 5</html:option>
438
                                                            <html:option value="S6">Semestre 6</html:option>
1534 jmachado 439
                                                            <html:option value="S7">Semestre 7</html:option>
440
                                                            <html:option value="S8">Semestre 8</html:option>
1528 jmachado 441
                                                            <html:option value="A1">Anual 1</html:option>
442
                                                            <html:option value="A2">Anual 2</html:option>
443
                                                            <html:option value="A3">Anual 3</html:option>
444
                                                            <html:option value="A4">Anual 4</html:option>
1516 jmachado 445
                                                            <html:option value="T1">Trimestre 1</html:option>
446
                                                            <html:option value="T2">Trimestre 2</html:option>
447
                                                            <html:option value="T3">Trimestre 3</html:option>
448
                                                            <html:option value="T4">Trimestre 4</html:option>
449
                                                            <html:option value="T5">Trimestre 5</html:option>
450
                                                            <html:option value="T6">Trimestre 6</html:option>
451
                                                            <html:option value="T7">Trimestre 7</html:option>
452
                                                            <html:option value="T8">Trimestre 8</html:option>
1517 jmachado 453
                                                            <html:option value="OP">Opcionais</html:option>
1516 jmachado 454
                                                        </nested:select>
1517 jmachado 455
                                                        <div id="semestreDescContainer${dummyIndexSemestreId}">
456
                                                            Descrição (PT) <nested:text property="semestreDesc" styleClass="form-control"/>
457
                                                            Descrição (EN) <nested:text property="semestreDescEn" styleClass="form-control"/>
458
                                                            Descrição (ES) <nested:text property="semestreDescEs" styleClass="form-control"/>
459
                                                            Descrição (FR) <nested:text property="semestreDescFr" styleClass="form-control"/>
460
                                                        </div>
1516 jmachado 461
                                                    </div>
462
                                                    <div class="col-sm-6">
1507 jmachado 463
 
1516 jmachado 464
                                                        <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()">
465
                                                            <span class="glyphicon glyphicon-plus"> </span> Unidade
466
                                                        </button>
467
 
468
                                                        <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()">
469
                                                            <span class="glyphicon glyphicon-plus"> </span> Perfil
470
                                                        </button>
471
 
472
                                                        <a name="semestreDummy${dummyIndexSemestreId}"></a>
473
                                                    </div>
474
                                                </div>
475
                                            </div>
476
                                            <div class="panel-body">
477
 
1521 jmachado 478
                                                <div class="form-group">
1516 jmachado 479
 
1521 jmachado 480
                                                    <div class="col-sm-2">
481
                                                        Notas do Semestre (Pode ser utilizado para mostrar Optativas)
482
                                                    </div>
483
                                                    <div class="col-sm-10">
484
                                                        <nested:textarea property="notas" rows="5" styleClass="form-control"/>
485
                                                    </div>
486
                                                </div>
487
 
1516 jmachado 488
                                                <button class="btn btn-default" data-toggle="collapse" type="button" data-target=".langs">Ver Campos Multingua</button>
1517 jmachado 489
 
490
                                                <nested:size id="tamanhoPerfil" property="perfil"/>
491
                                                <nested:iterate id="perfil" indexId="perfilIndexId" property="perfil" type="pt.estgp.estgweb.services.courses.xsd.Curso.Semestre.Perfil">
1518 jmachado 492
                                                    <div class="panel panel-info">
1516 jmachado 493
                                                        <div class="panel-heading">
494
                                                            <div class="form-group">
1507 jmachado 495
                                                                <%
1516 jmachado 496
                                                                    dummyIndexPerfilId++;
497
                                                                    request.setAttribute("dummyIndexPerfilId",dummyIndexPerfilId);
1507 jmachado 498
                                                                %>
1516 jmachado 499
                                                                <a name="perfilDummy${dummyIndexPerfilId}"></a>
500
                                                                <nested:hidden property="perfilId" value="perfilDummy${dummyIndexPerfilId}"/>
1517 jmachado 501
                                                                <div class="col-sm-2">
502
                                                                    <button type="button" class="btn btn-warning" onclick="sendUpPerfil('<%=dummyIndexPerfilId%>',this.form,'semestreDummy${dummyIndexSemestreId}')">
503
                                                                        <span class="glyphicon glyphicon-arrow-up"> </span>
504
                                                                    </button>
505
                                                                    <button type="button" class="btn btn-warning" onclick="sendDownPerfil('<%=dummyIndexPerfilId%>',this.form,'semestreDummy${dummyIndexSemestreId}')">
506
                                                                        <span class="glyphicon glyphicon-arrow-down"> </span>
507
                                                                    </button>
1516 jmachado 508
                                                                    <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()">
509
                                                                        <span class="glyphicon glyphicon-remove"> </span>
510
                                                                    </button>
511
                                                                </div>
512
                                                                <div class="col-sm-1">
513
                                                                    Perfil
514
                                                                </div>
1517 jmachado 515
                                                                <div class="col-sm-5">
1516 jmachado 516
                                                                    <nested:text styleClass="form-control" property="nome"/>
517
                                                                </div>
518
                                                                <div  class="col-sm-4">
519
                                                                    <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()">
520
                                                                        <span class="glyphicon glyphicon-plus"> </span>  Unidade
521
                                                                    </button>
522
                                                                </div>
523
                                                            </div>
524
                                                        </div>
525
                                                        <div class="panel-body">
526
                                                            <table class="tablesorterfiltered">
527
                                                                <thead>
528
                                                                <tr>
529
                                                                    <td></td>
530
                                                                    <td></td>
531
                                                                    <th>SIGES</th>
532
                                                                    <th>Nome</th>
533
                                                                    <th>Total</th>
534
                                                                    <th>T</th>
535
                                                                    <th>TP</th>
536
                                                                    <th>P</th>
537
                                                                    <th>PL</th>
538
                                                                    <th>PD</th>
539
                                                                    <th>OT</th>
540
                                                                    <th>E</th>
541
                                                                    <th>S</th>
542
                                                                    <th>TC</th>
543
                                                                    <th>O</th>
544
                                                                    <th>ECTS</th>
545
                                                                    <th>URL UNIDADE</th>
546
                                                                    <th>FICHA URL</th>
547
                                                                </tr>
548
                                                                </thead>
549
                                                                <tbody>
550
                                                                <nested:size id="tamanho" property="unidade"/>
551
                                                                <nested:iterate id="unit" indexId="indexId"  property="unidade" type="pt.estgp.estgweb.services.courses.xsd.UnidadeType">
1507 jmachado 552
 
1516 jmachado 553
                                                                    <%
554
                                                                        dummyIndexIdUnidades++;
555
                                                                        request.setAttribute("dummyIndexIdUnidades","dummyIndex" + dummyIndexIdUnidades);
556
                                                                    %>
557
                                                                    <%
558
                                                                        int tamanhoMinus1 = tamanho - 1;
559
                                                                        request.setAttribute("tamanhoMinus1",tamanhoMinus1);
1507 jmachado 560
 
1516 jmachado 561
                                                                    %>
562
                                                                    <tr <nested:equal property="removed" value="true">class="hidden"</nested:equal>>
563
                                                                        <td class="text-nowrap">
564
 
1517 jmachado 565
                                                                            <%--
566
                                                                                Usando o dummyIndex apenas não colocamos botao de up na primeira de todas as unidades de todos os semestres
567
                                                                                Antes usavamos o indexId e trabalhavamos lista a lista considerando semestres e perfis independentes
568
                                                                            --%>
569
                                                                            <nested:notEqual value="dummyIndex1" name="dummyIndexIdUnidades">
1516 jmachado 570
                                                                                <button type="button" class="btn btn-warning" onclick="sendUpUnidadeCurricular(<%=dummyIndexIdUnidades%>)">
571
                                                                                    <span class="glyphicon glyphicon-arrow-up"> </span>
572
                                                                                </button>
1517 jmachado 573
                                                                            </nested:notEqual>
574
                                                                            <%
575
                                                                                boolean perfilMaximoAtingido = perfilIndexId >= tamanhoPerfil - 1;
576
                                                                                boolean semestreMaximoAtingido = semestreIndexId >= tamanhoSemestre - 1;
577
                                                                                boolean tamanhoMaximoAtingido = indexId >= tamanho - 1;
578
                                                                                if(!perfilMaximoAtingido || !semestreMaximoAtingido || !tamanhoMaximoAtingido)
579
                                                                                {
580
                                                                            %>
1516 jmachado 581
                                                                                <button type="button" class="btn btn-warning" onclick="sendDownUnidadeCurricular(<%=dummyIndexIdUnidades%>)">
582
                                                                                    <span class="glyphicon glyphicon-arrow-down"> </span>
583
                                                                                </button>
1517 jmachado 584
                                                                            <%
585
                                                                                }
586
                                                                            %>
1516 jmachado 587
                                                                        </td>
588
                                                                        <td>
589
                                                                            <nested:hidden styleId="removed${dummyIndexIdUnidades}" property="removed"/>
590
                                                                            <button type="button" class="btn btn-danger" onclick="removeUnit(<%=dummyIndexIdUnidades%>)">
591
                                                                                <span class="glyphicon glyphicon-remove"> </span>
1507 jmachado 592
                                                                            </button>
1516 jmachado 593
                                                                        </td>
594
                                                                        <td>
1519 jmachado 595
                                                                            <script>
596
                                                                                $(document).ready(
597
                                                                                        function()
598
                                                                                        {
599
                                                                                            $("#siges${dummyIndexIdUnidades}").focusout(
600
                                                                                                    function(){
601
                                                                                                        var code = $("#siges${dummyIndexIdUnidades}").val();
602
                                                                                                        $.getJSON("<%=request.getContextPath()%>/user/courses/courseApiJson.jsp",
603
                                                                                                                { service:"findCourseUnit",
604
                                                                                                                  siges: code,
605
                                                                                                                  courseSigesCode: "${course.code}"
606
                                                                                                                },
607
                                                                                                                function(data)
608
                                                                                                                {
609
                                                                                                                    if(data.response == "ok")
610
                                                                                                                    {
611
                                                                                                                        $("#nome${dummyIndexIdUnidades}").val(data.courseUnitName);
612
                                                                                                                        $("#sigesResponse${dummyIndexIdUnidades}").html("");
613
                                                                                                                    }
614
                                                                                                                    else
615
                                                                                                                    {
616
                                                                                                                        $("#sigesResponse${dummyIndexIdUnidades}").html("Não encontrado");
617
                                                                                                                    }
618
                                                                                                                }
619
                                                                                                        );
620
                                                                                                    }
621
                                                                                            );
622
                                                                                        }
623
                                                                                );
624
                                                                            </script>
625
 
626
                                                                            <nested:text styleId="siges${dummyIndexIdUnidades}" styleClass="form-control" property="siges"/>
627
                                                                            <div id="sigesResponse${dummyIndexIdUnidades}"></div>
628
                                                                        </td>
629
                                                                        <td>
1516 jmachado 630
                                                                            <div>
631
                                                                                <div class="col-sm-1">(PT)</div>
632
                                                                                <div class="col-sm-11"><nested:text styleId="nome${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nome"/></div>
1505 jmachado 633
 
1516 jmachado 634
                                                                                <div class="langs collapse" >
635
                                                                                    <div class="col-sm-1">(EN)</div>
636
                                                                                    <div class="col-sm-11"><nested:text styleId="nomeEn${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeEn"/></div>
637
                                                                                    <div class="col-sm-1">(ES)</div>
638
                                                                                    <div class="col-sm-11"><nested:text styleId="nomeEs${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeEs"/></div>
639
                                                                                    <div class="col-sm-1">(FR)</div>
640
                                                                                    <div class="col-sm-11"><nested:text styleId="nomeFr${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeFr"/></div>
641
                                                                                </div>
1505 jmachado 642
                                                                            </div>
643
 
1516 jmachado 644
                                                                        </td>
645
                                                                        <td><nested:text styleClass="form-control" styleId="totalHoras${dummyIndexIdUnidades}" property="totalHoras"/></td>
646
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoT${dummyIndexIdUnidades}" property="horasContacto.t"/></td>
647
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoTP${dummyIndexIdUnidades}" property="horasContacto.TP"/></td>
648
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoP${dummyIndexIdUnidades}" property="horasContacto.p"/></td>
649
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoPL${dummyIndexIdUnidades}" property="horasContacto.PL"/></td>
650
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoPD${dummyIndexIdUnidades}" property="horasContacto.PD"/></td>
651
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoOT${dummyIndexIdUnidades}" property="horasContacto.OT"/></td>
652
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoE${dummyIndexIdUnidades}" property="horasContacto.e"/></td>
653
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoS${dummyIndexIdUnidades}" property="horasContacto.s"/></td>
654
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoTC${dummyIndexIdUnidades}" property="horasContacto.TC"/></td>
655
                                                                        <td><nested:text styleClass="form-control" styleId="horasContactoO${dummyIndexIdUnidades}" property="horasContacto.o"/></td>
656
                                                                        <td><nested:text styleClass="form-control" styleId="ECTS${dummyIndexIdUnidades}" property="ECTS"/></td>
657
                                                                        <td><nested:text styleClass="form-control" styleId="urlUnidadeCurricular${dummyIndexIdUnidades}" style="width:600px" property="urlUnidadeCurricular"/></td>
658
                                                                        <td><nested:text styleClass="form-control" styleId="urlFichaCurricular${dummyIndexIdUnidades}" style="width:600px" property="urlFichaCurricular"/></td>
659
                                                                    </tr>
660
                                                                </nested:iterate>
661
                                                                </tbody>
662
                                                            </table>
663
                                                        </div>
1505 jmachado 664
                                                    </div>
665
 
1516 jmachado 666
                                                </nested:iterate>
1505 jmachado 667
 
1516 jmachado 668
                                                <nested:notEmpty property="unidade">
1507 jmachado 669
 
1516 jmachado 670
                                                    <table class="tablesorterfiltered">
671
                                                    <thead>
672
                                                        <tr>
673
                                                            <th></th>
674
                                                            <th></th>
675
                                                            <th>SIGES</th>
676
                                                            <th>Nome</th>
677
                                                            <th>Total</th>
678
                                                            <th>T</th>
679
                                                            <th>TP</th>
680
                                                            <th>P</th>
681
                                                            <th>PL</th>
682
                                                            <th>PD</th>
683
                                                            <th>OT</th>
684
                                                            <th>E</th>
685
                                                            <th>S</th>
686
                                                            <th>TC</th>
687
                                                            <th>O</th>
688
                                                            <th>ECTS</th>
689
                                                            <th>URL UNIDADE</th>
690
                                                            <th>FICHA URL</th>
691
                                                        </tr>
692
                                                    </thead>
693
                                                    <tbody>
694
                                                        <nested:size id="tamanho" property="unidade"/>
695
                                                        <nested:iterate id="unit" property="unidade" indexId="indexId"  type="pt.estgp.estgweb.services.courses.xsd.UnidadeType">
696
                                                            <%
697
                                                                dummyIndexIdUnidades++;
698
                                                                request.setAttribute("dummyIndexIdUnidades","dummyIndex" + dummyIndexIdUnidades);
699
                                                            %>
700
                                                            <%
701
                                                                int tamanhoMinus1 = tamanho - 1;
702
                                                                request.setAttribute("tamanhoMinus1",tamanhoMinus1);
1507 jmachado 703
 
1516 jmachado 704
                                                            %>
1507 jmachado 705
 
1516 jmachado 706
                                                            <tr <nested:equal property="removed" value="true">class="hidden"</nested:equal>>
707
                                                                <td class="text-nowrap">
1507 jmachado 708
 
1517 jmachado 709
                                                                <%--
710
                                                                           Usando o dummyIndex apenas não colocamos botao de up na primeira de todas as unidades de todos os semestres
711
                                                                           Antes usavamos o indexId e trabalhavamos lista a lista considerando semestres e perfis independentes
712
                                                                   --%>
713
                                                                    <nested:notEqual value="dummyIndex1" name="dummyIndexIdUnidades">
1516 jmachado 714
                                                                        <button type="button" class="btn btn-warning" onclick="sendUpUnidadeCurricular(<%=dummyIndexIdUnidades%>)">
715
                                                                            <span class="glyphicon glyphicon-arrow-up"> </span>
716
                                                                        </button>
1517 jmachado 717
                                                                    </nested:notEqual>
718
                                                                    <%
719
                                                                        boolean semestreMaximoAtingido = semestreIndexId >= tamanhoSemestre - 1;
720
                                                                        boolean tamanhoMaximoAtingido = indexId >= tamanho - 1;
721
                                                                        if(!semestreMaximoAtingido || !tamanhoMaximoAtingido)
722
                                                                        {
723
                                                                    %>
724
                                                                    <button type="button" class="btn btn-warning" onclick="sendDownUnidadeCurricular(<%=dummyIndexIdUnidades%>)">
725
                                                                        <span class="glyphicon glyphicon-arrow-down"> </span>
726
                                                                    </button>
727
                                                                    <%
728
                                                                        }
729
                                                                    %>
1516 jmachado 730
                                                                </td>
731
                                                                <td>
732
                                                                    <nested:hidden styleId="removed${dummyIndexIdUnidades}" property="removed"/>
733
                                                                    <button type="button" class="btn btn-danger" onclick="removeUnit(<%=dummyIndexIdUnidades%>)" >
734
                                                                        <span class="glyphicon glyphicon-remove"> </span>
1507 jmachado 735
                                                                    </button>
1516 jmachado 736
                                                                </td>
737
                                                                <td>
1520 jmachado 738
                                                                    <script>
739
                                                                        $(document).ready(
740
                                                                                function()
741
                                                                                {
742
                                                                                    $("#siges${dummyIndexIdUnidades}").focusout(
743
                                                                                            function(){
744
                                                                                                var code = $("#siges${dummyIndexIdUnidades}").val();
745
                                                                                                $.getJSON("<%=request.getContextPath()%>/user/courses/courseApiJson.jsp",
746
                                                                                                        { service:"findCourseUnit",
747
                                                                                                            siges: code,
748
                                                                                                            courseSigesCode: "${course.code}"
749
                                                                                                        },
750
                                                                                                        function(data)
751
                                                                                                        {
752
                                                                                                            if(data.response == "ok")
753
                                                                                                            {
754
                                                                                                                $("#nome${dummyIndexIdUnidades}").val(data.courseUnitName);
755
                                                                                                                $("#sigesResponse${dummyIndexIdUnidades}").html("");
756
                                                                                                            }
757
                                                                                                            else
758
                                                                                                            {
759
                                                                                                                $("#sigesResponse${dummyIndexIdUnidades}").html("Não encontrado");
760
                                                                                                            }
761
                                                                                                        }
762
                                                                                                );
763
                                                                                            }
764
                                                                                    );
765
                                                                                }
766
                                                                        );
767
                                                                    </script>
768
                                                                    <nested:text styleId="siges${dummyIndexIdUnidades}" styleClass="form-control" property="siges"/>
769
                                                                    <div id="sigesResponse${dummyIndexIdUnidades}"></div>
770
                                                                </td>
771
 
772
                                                                <td>
1516 jmachado 773
                                                                    <div>
774
                                                                        <div class="col-sm-1">(PT)</div>
1520 jmachado 775
                                                                        <div class="col-sm-11">
776
                                                                            <nested:text styleId="nome${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nome"/>
777
                                                                        </div>
1505 jmachado 778
 
1516 jmachado 779
                                                                        <div class="langs collapse" >
780
                                                                            <div class="col-sm-1">(EN)</div>
781
                                                                            <div class="col-sm-11"><nested:text styleId="nomeEn${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeEn"/></div>
782
                                                                            <div class="col-sm-1">(ES)</div>
783
                                                                            <div class="col-sm-11"><nested:text styleId="nomeEs${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeEs"/></div>
784
                                                                            <div class="col-sm-1">(FR)</div>
785
                                                                            <div class="col-sm-11"><nested:text styleId="nomeFr${dummyIndexIdUnidades}" style="width:300px" styleClass="form-control" property="nomeFr"/></div>
786
                                                                        </div>
1505 jmachado 787
                                                                    </div>
788
 
1516 jmachado 789
                                                                </td>
790
                                                                <td><nested:text styleClass="form-control" styleId="totalHoras${dummyIndexIdUnidades}" property="totalHoras"/></td>
791
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoT${dummyIndexIdUnidades}" property="horasContacto.t"/></td>
792
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoTP${dummyIndexIdUnidades}" property="horasContacto.TP"/></td>
793
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoP${dummyIndexIdUnidades}" property="horasContacto.p"/></td>
794
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoPL${dummyIndexIdUnidades}" property="horasContacto.PL"/></td>
795
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoPD${dummyIndexIdUnidades}" property="horasContacto.PD"/></td>
796
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoOT${dummyIndexIdUnidades}" property="horasContacto.OT"/></td>
797
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoE${dummyIndexIdUnidades}" property="horasContacto.e"/></td>
798
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoS${dummyIndexIdUnidades}" property="horasContacto.s"/></td>
799
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoTC${dummyIndexIdUnidades}" property="horasContacto.TC"/></td>
800
                                                                <td><nested:text styleClass="form-control" styleId="horasContactoO${dummyIndexIdUnidades}" property="horasContacto.o"/></td>
801
                                                                <td><nested:text styleClass="form-control" styleId="ECTS${dummyIndexIdUnidades}" property="ECTS"/></td>
802
                                                                <td><nested:text styleClass="form-control" styleId="urlUnidadeCurricular${dummyIndexIdUnidades}" style="width:600px" property="urlUnidadeCurricular"/></td>
803
                                                                <td><nested:text styleClass="form-control" styleId="urlFichaCurricular${dummyIndexIdUnidades}" style="width:600px" property="urlFichaCurricular"/></td>
804
                                                            </tr>
805
                                                        </nested:iterate>
806
                                                    </tbody>
807
                                                </table>
808
                                                </nested:notEmpty>
1507 jmachado 809
 
1516 jmachado 810
                                            </div>
1505 jmachado 811
                                        </div>
812
 
1516 jmachado 813
                                    </nested:iterate>
1505 jmachado 814
 
1516 jmachado 815
                                </nested:notEmpty>
1505 jmachado 816
 
1516 jmachado 817
                                <a type="button" class="btn btn-danger" href="<%=request.getContextPath()%>/user/adminStudyPlans.do?courseId=${courseId}">Cancelar</a>
818
                                <html:submit styleClass="btn btn-success" >Salvar</html:submit>
1505 jmachado 819
 
820
 
821
 
1516 jmachado 822
 
823
                    </div>
1505 jmachado 824
                </div>
1516 jmachado 825
            </html:form>
1505 jmachado 826
        </div>
827
    </div>
828
 
829
<%
830
 
831
    AbstractDao.getCurrentSession().getTransaction().commit();
832
%>
833