Subversion Repositories bacoAlunos

Rev

Rev 1520 | Rev 1528 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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