Subversion Repositories bacoAlunos

Rev

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