Subversion Repositories bacoAlunos

Rev

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