Subversion Repositories bacoAlunos

Rev

Rev 1771 | Rev 1773 | 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" %>
1771 jmachado 7
<%@ page import="pt.estgp.estgweb.services.courses.xsd.Curso" %>
8
<%@ page import="pt.estgp.estgweb.services.courses.xsd.CursoImpl" %>
1505 jmachado 9
<%@ page import="pt.estgp.estgweb.web.form.courses.CourseStudiesPlansAdminForm" %>
10
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
11
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
12
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
13
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
14
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
15
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
16
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
17
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm"%>
18
<%
1771 jmachado 19
 
20
 
21
    //TODO NOVO JSON
22
    //O SALVAR TEM DE SER UMA FuncTION E DEIXAR DE SER UM SUBMIT PARA PODERMOS TRASNFERIR O JSON
23
    //PARA UMA VAR DE TEXTO
24
 
1505 jmachado 25
    //todo temos de ter aqui o id do curso para o carregar aqui mesmo
26
 
27
    //se queremos barras de navegação então temos de ter ser acedidos de um
28
    //controlador que carregue o necerrário à barra ou então assumimos que
29
    //o curso id esta sempre disponivel nas barras possiveis de chamar
30
 
31
    AbstractDao.getCurrentSession().beginTransaction();
32
 
33
    CourseStudiesPlanImpl planoEdicao;
34
    boolean ultimaVersao = true;
35
    Long courseId;
36
    Long studyPlanId;
37
    String versaoPlano = "Não Encontrada";
38
    Course course;
39
    if(request.getAttribute("CourseStudiesPlansAdminForm") != null)
40
    {
41
        CourseStudiesPlansAdminForm frm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm");
42
        courseId = frm.getCourseId();
43
        studyPlanId = frm.getCourseStudiesPlan().getId();
44
        ultimaVersao = frm.isVersaoVigor();
45
        course = DaoFactory.getCourseDaoImpl().load(courseId);
46
        planoEdicao = frm.getCourseStudiesPlan();
47
    }
48
    else
49
    {
50
        courseId = Long.parseLong(request.getParameter("courseId"));
51
        studyPlanId = Long.parseLong(request.getParameter("studyPlanId"));
52
        request.setAttribute("courseId",courseId);
53
        request.setAttribute("studyPlanId",studyPlanId);
54
 
55
 
56
        course = DaoFactory.getCourseDaoImpl().load(courseId);
57
        planoEdicao = null;
58
        for(CourseStudiesPlan plan:course.getStudiesPlans())
59
        {
60
            if(plan.getId() == studyPlanId)
61
            {
62
                versaoPlano = plan.getVersion() + "";
63
                planoEdicao = (CourseStudiesPlanImpl) DaoFactory.getCourseStudiesPlanDaoImpl().narrow(plan);
64
                break;
65
            }
66
            ultimaVersao = false;
67
        }
68
        //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
69
    }
70
    request.setAttribute("courseId",courseId);
71
    request.setAttribute("studyPlanId",studyPlanId);
72
    request.setAttribute("course",course);
1684 jmachado 73
    request.setAttribute("courseSigesCode",course.getCode());
1505 jmachado 74
 
75
 
76
 
77
 
78
 
79
 
80
    /*
81
    if(planoEdicao != null)
82
    {
83
 
84
 
85
    }
86
    */
87
 
88
%>
1771 jmachado 89
    <div class="panel panel-default" id="planoApp" ng-app="planoApp" ng-controller="planoController">
1505 jmachado 90
        <div class="panel-heading">
91
            Edição do plano de estudos. Versão <%=versaoPlano%> <%=ultimaVersao? "(<u>é a versão em vigor</u>)":""%> do curso de <%=course.getName()%> (<%=course.getCode()%>)
92
        </div>
93
        <div class="panel-body">
94
 
95
            <html:errors/>
96
            <jomm:messages/>
97
 
1534 jmachado 98
 
99
 
1505 jmachado 100
            <div class="panel panel-default">
101
                <div class="panel-heading">Dados do Curso</div>
102
                <div class="panel-body">
103
 
104
                    <div class="col-sm-12">Código do Curso <label class="text-info">${course.code}</label></div>
105
                    <div class="col-sm-12">
106
                        <table class="tablesorter-blue">
107
                            <thead>
108
                                <tr>
109
                                    <th>Língua</th>
110
                                    <th>Nome do Curso</th>
111
                                    <th>Departamento</th>
112
                                </tr>
113
                            </thead>
114
                            <tbody>
115
                                <tr>
116
                                    <td>PT</td>
117
                                    <td>${course.name}</td>
118
                                    <td>
119
                                    <%if(course.getDepartment() != null){%>${course.department.name}<%}%>
120
                                    </td>
121
                                </tr>
122
                                <tr>
123
                                    <td>EN</td>
124
                                    <td>${course.nameEn}</td>
125
                                    <td>
126
                                        <%if(course.getDepartment() != null){%>${course.department.nameEn}<%}%>
127
 
128
                                    </td>
129
                                </tr>
130
                                <tr>
131
                                    <td>ES</td>
132
                                    <td>${course.nameEs}</td>
133
                                    <td>
134
                                        <%if(course.getDepartment() != null){%>${course.department.nameEs}<%}%>
135
                                    </td>
136
                                </tr>
137
                                <tr>
138
                                    <td>FR</td>
139
                                    <td>${course.nameFr}</td>
140
                                    <td>
141
                                        <%if(course.getDepartment() != null){%>${course.department.nameFr}<%}%>
142
                                    </td>
143
                                </tr>
144
                            </tbody>
145
                        </table>
146
                   </div>
147
 
148
                </div>
149
            </div>
1534 jmachado 150
            <html:form action="/user/courseControllerStudiesPlan" styleId="CourseStudiesPlansAdminForm" styleClass="form-horizontal"  enctype="multipart/form-data">
151
 
1516 jmachado 152
                <div class="panel panel-warning">
153
                    <div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> Clonagem a partir de outro plano de Estudos</div>
154
                    <div class="panel-body">
1505 jmachado 155
 
156
                            <div class="form-group">
1516 jmachado 157
                                <label class="control-label col-sm-2">Versão Fonte para Clonagem</label>
1505 jmachado 158
                                <div class="col-sm-10">
1516 jmachado 159
                                    <html:select styleClass="form-control" property="sourcePlanId">
160
                                        <html:option value="">Nenhuma</html:option>
161
                                    <%
162
                                        for(CourseStudiesPlan plan:course.getStudiesPlans())
163
                                        {
164
                                            if(plan.getId() != studyPlanId)
165
                                            {
166
                                                request.setAttribute("nowPlanId",plan.getId());
167
                                        %>
168
                                            <html:option value="${nowPlanId}">Versão <%=plan.getVersion()%></html:option>
169
                                        <%
170
                                            }
171
 
172
                                        }
173
                                    %>
174
                                    </html:select>
1505 jmachado 175
                                </div>
176
                            </div>
1516 jmachado 177
                            <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();">
178
                                Clonar para a fonte escolhida
179
                            </button>
1505 jmachado 180
 
1507 jmachado 181
 
182
 
1516 jmachado 183
                    </div>
184
                </div>
1507 jmachado 185
 
1684 jmachado 186
                <script>
187
                    function createFichasUrls()
188
                    {
189
                        $("[data-unit-ficha-url-target-id]").each(
190
                                function()
191
                                {
192
                                    var targetId = $(this).attr("data-unit-ficha-url-target-id");
193
                                    var sigesUnit = $(this).attr("data-unit-siges-code");
194
                                    var sigesCourse = $(this).attr("data-course-siges-code");
195
                                    var unitSemestre = $(this).attr("data-unit-semestre");
196
                                    var sigesUrlInput = $("#" + targetId);
197
                                    var urlPattern = $("#urlPadraoFicha").val();
198
                                    var targetsType = $("#urlPadraoFichaAlvo option:selected").val();
199
                                    if(targetsType == "all" || sigesUrlInput.val() == "")
200
                                    {
201
                                        urlPattern = urlPattern.replace("{SIGES_CURSO}",'${courseSigesCode}');
202
                                        urlPattern = urlPattern.replace("{SIGES_UNIT}",sigesUnit);
203
                                        urlPattern = urlPattern.replace("{UNIT_SEMESTRE}",unitSemestre);
204
 
205
                                        $("#" + targetId).val(urlPattern);
206
                                    }
207
                                }
208
                        );
209
                        alert("URLS gerados com Sucesso, Necessita de SALVAR o Plano.");
210
                    }
211
                </script>
212
 
213
                <div class="panel panel-warning">
214
                    <div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> Ferramenta Auxiliar de Auto-Preenchimento de URL's de Fichas</div>
215
                    <div class="panel-body">
216
 
217
                        <div class="form-group">
218
                            <label class="control-label col-sm-2">URL Padrão</label>
219
                            <div class="col-sm-10">
220
                                <p>exemplo para a ESTG: http://www.estgp.pt/startLoadCourseUnitProgramSiges.do?unitCode={SIGES_UNIT}&courseCode={SIGES_CURSO}&semestre={UNIT_SEMESTRE}</p>
221
                                <p>Nenhum dos campos é obrigatório, o sistema substitui se existir no padrão, Na estg o Semestre é obrigatório para diferenciar unidades que são lecionadas em ambos os semestres</p>
222
                                <p>O semestre presente neste sistema e que vai ser preenchido vai de S1 a S6 e de T1 a T8 ou A, portanto se o semestre for usado à que ter isto em atenção</p>
1771 jmachado 223
                                <input type="text" class="form-control" id="urlPadraoFicha" placeholder="http://exemplo.com/exemplo/{SIGES_CURSO}/{UNIT_SEMESTRE}/{SIGES_UNIT}.pdf">
1684 jmachado 224
                            </div>
225
                        </div>
226
                        <div class="form-group">
227
                            <label class="control-label col-sm-2">Alvos</label>
228
                            <div class="col-sm-10">
229
                                <select id="urlPadraoFichaAlvo">
230
                                    <option value="all">Todos</option>
231
                                    <option value="onlyEmpty">Apenas Vazios</option>
232
                                </select>
233
                            </div>
234
                        </div>
235
                        <button class="btn btn-warning" type="button" data-toggle="modal" onclick="createFichasUrls()">
236
                            Gerar URL's de Fichas
237
                        </button>
238
 
239
 
240
 
241
                    </div>
242
                </div>
243
 
1536 jmachado 244
                <%
245
                    CourseStudiesPlansAdminForm courseStudiesPlansAdminForm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm");
1771 jmachado 246
                    //Isto corre sempre que se entra no Editor a primeira vez e não apenas quando é um plano novo
1536 jmachado 247
                    //Form ainda não iniciado vai iniciar é a primeira vez
248
                    if(courseStudiesPlansAdminForm.getCourseStudiesPlan().getId() <= 0)
249
                    {
250
                        courseStudiesPlansAdminForm.setCourseStudiesPlan(planoEdicao);
251
                        courseStudiesPlansAdminForm.setCourseId(courseId);
252
                        courseStudiesPlansAdminForm.setVersaoVigor(ultimaVersao);
1771 jmachado 253
                        Curso cPlanoDoXml2Json = new CoursesService().loadCursoPlanoFromXml(planoEdicao.getXml());
254
                        if(cPlanoDoXml2Json == null)
255
                            courseStudiesPlansAdminForm.setPlanoEstudos(new CursoImpl());
256
                        else
257
                            courseStudiesPlansAdminForm.setPlanoEstudos(new CoursesService().loadCursoPlanoFromXml(planoEdicao.getXml()));
1536 jmachado 258
                    }
1771 jmachado 259
                    //LINHA NOVA PARA JSON DE INTERFACE
260
                    courseStudiesPlansAdminForm.setPlanoEstudosJsonInterface(CursoImpl.toJson(courseStudiesPlansAdminForm.getPlanoEstudos()));
1536 jmachado 261
                %>
1535 jmachado 262
                <logic:notEmpty name="CourseStudiesPlansAdminForm" property="courseStudiesPlan.importLog">
1534 jmachado 263
                    <div class="panel panel-warning">
1536 jmachado 264
                        <div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> LOG DA ULTIMA IMPORTAÇÃO</div>
1534 jmachado 265
                        <div class="panel-body">
266
                            <pre>
1535 jmachado 267
                                <html:hidden name="CourseStudiesPlansAdminForm" property="courseStudiesPlan.importLog"/>
268
                                <bean:write name="CourseStudiesPlansAdminForm" property="courseStudiesPlan.importLog"/>
1536 jmachado 269
 
1534 jmachado 270
                            </pre>
271
                        </div>
272
                    </div>
273
                </logic:notEmpty>
274
                <div class="panel panel-warning">
275
                    <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>
276
                    <div class="panel-body">
1541 jmachado 277
                        <div class="col-md-6">
278
                            <div class="panel panel-default">
279
                                <div class="panel-body">
280
                                    <div class="form-group">
281
                                        <label class="control-label col-sm-2">Escolher Ficheiro Exportado do Siges</label>
282
                                        <div class="col-sm-10">
283
                                            <html:file styleClass="form-control" property="formFileImport"/>
284
                                        </div>
285
                                    </div>
1771 jmachado 286
                                    <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="angular.element($('#planoApp')).scope().fundirPlano();">
1541 jmachado 287
                                        Importar o ficheiro sobrepondo esta versão do plano
288
                                    </button>
289
                                </div>
1534 jmachado 290
                            </div>
291
                        </div>
1541 jmachado 292
                        <div class="col-md-6">
293
                            <div class="panel panel-default">
294
                                <div class="panel-body">
295
                                    <div class="form-group">
296
                                        <label class="control-label col-sm-2">Escolher Ficheiro Exportado do Siges Com Ramos</label>
297
                                        <div class="col-sm-10">
1542 jmachado 298
                                            <html:file styleClass="form-control" property="formFileImport2"/>
1541 jmachado 299
                                        </div>
300
                                    </div>
1771 jmachado 301
                                    <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="angular.element($('#planoApp')).scope().fundirPlano();">
1541 jmachado 302
                                        FUNDIR o ficheiro com esta versão do plano
303
                                    </button>
304
                                </div>
305
                            </div>
306
                        </div>
307
 
308
 
1534 jmachado 309
                    </div>
310
                </div>
311
 
312
 
1516 jmachado 313
                <div class="panel panel-default">
1771 jmachado 314
                    <div class="panel-heading">Plano de Estudos</div>
1516 jmachado 315
                    <div class="panel-body">
1507 jmachado 316
 
317
 
1516 jmachado 318
                                <input type="hidden" name="dispatch" value="savePlano"/>
319
                                <html:hidden property="courseId"/>
320
                                <html:hidden property="versaoVigor"/>
321
                                <html:hidden property="courseStudiesPlan.id"/>
322
                                <html:hidden styleId="semestreId" property="semestreId"/>
323
                                <html:hidden styleId="perfilId" property="perfilId"/>
1771 jmachado 324
                                <html:hidden styleId="planoEstudosJsonInterface" property="planoEstudosJsonInterface"/>
1505 jmachado 325
 
1516 jmachado 326
                                <div class="form-group">
327
                                    <label class="control-label col-sm-2">Versão</label>
328
                                    <div class="col-sm-10">
329
                                        <html:text styleClass="form-control" property="courseStudiesPlan.version" size="3"/>
330
                                    </div>
331
                                </div>
332
                                <div class="form-group">
333
                                    <label class="control-label col-sm-2">Descrição</label>
334
                                    <div class="col-sm-10">
335
                                        <html:text styleClass="form-control" property="courseStudiesPlan.versionDescription"/>
336
                                    </div>
337
                                </div>
1507 jmachado 338
 
1534 jmachado 339
 
340
 
341
 
1507 jmachado 342
 
1505 jmachado 343
 
1507 jmachado 344
 
1771 jmachado 345
                                    <div>
346
                                        <script>
347
                                            var planoApp = angular.module('planoApp', ['ui.tree']);
348
                                            GLOBAL_BacoAngularAppDependencies.push('planoApp');
349
                                            planoApp.controller('planoController',  function ($scope) {
350
                                                $scope.treeOptions = {
351
                                                    accept: function(sourceNodeScope, destNodesScope, destIndex) {
1507 jmachado 352
 
1771 jmachado 353
                                                        //if(destNodesScope)
354
                                                        //console.log(destNodesScope);
355
                                                        //console.log(sourceNodeScope);
356
                                                        //console.log(destIndex);
357
                                                        //console.log(destNodesScope.$parent.$modelValue.title);
358
                                                        //console.log(destNodesScope.$modelValue[0].type);
359
                                                        if(sourceNodeScope.$modelValue.type == destNodesScope.$modelValue[0].type)
360
                                                            return true;
361
                                                        return false;
362
                                                    },
363
                                                    dropped: function(e) {
364
                                                        //console.log (e.source.nodeScope.$modelValue);
365
                                                        //alert ("Largado o nó com nome: " + e.source.nodeScope.$modelValue.name + " sobre " + e.dest.nodesScope.$parent.$modelValue.name);
366
                                                    }
367
                                                };
368
                                                $scope.json = <%=courseStudiesPlansAdminForm.getPlanoEstudosJsonInterface()%>
1507 jmachado 369
 
1771 jmachado 370
                                                $scope.confView =
371
                                                {
372
                                                    "SIGES" : true ,
373
                                                    "Nome" : true ,
374
                                                    "ECTS" : true,
375
                                                    "Total" : true ,
376
                                                    "T" : true ,
377
                                                    "TP" : true ,
378
                                                    "P" : true ,
379
                                                    "PL" : true ,
380
                                                    "PD" : true ,
381
                                                    "OT" : true ,
382
                                                    "E" : true ,
383
                                                    "S" : true ,
384
                                                    "TC" : true ,
385
                                                    "O" : true ,
386
                                                    "URL_UNIDADE" : true ,
387
                                                    "FICHA_URL" : true
388
                                                }
1516 jmachado 389
 
1771 jmachado 390
                                                $scope.submeterForm = function()
391
                                                {
392
                                                    $("#planoEstudosJsonInterface").val(
393
                                                            JSON.stringify($scope.json)
394
                                                    );
395
                                                    $("#CourseStudiesPlansAdminForm").submit();
396
                                                }
1516 jmachado 397
 
1771 jmachado 398
                                                $scope.fundirPlano = function()
399
                                                {
400
                                                    set($("#CourseStudiesPlansAdminForm").get(0),"mergePlano");
401
                                                    $scope.submeterForm();
402
                                                }
1517 jmachado 403
 
1771 jmachado 404
                                                $scope.importarPlano = function()
405
                                                {
406
                                                    set($("#CourseStudiesPlansAdminForm").get(0),"importarPlano");
407
                                                    $scope.submeterForm();
408
                                                }
409
                                                $scope.salvar = function()
410
                                                {
411
                                                    set($("#CourseStudiesPlansAdminForm").get(0),"savePlano");
412
                                                    $scope.submeterForm();
413
                                                }
1517 jmachado 414
 
1771 jmachado 415
                                                $scope.removeSemestre = function($index)
416
                                                {
417
                                                    if(confirm("Tem a certeza que deseja remover o Semestre " + $scope.json.semestre[$index].id + "?"))
418
                                                        $scope.json.semestre.splice($index,1);
419
                                                }
420
                                                $scope.removePerfil = function(semestre,$index)
421
                                                {
422
                                                    if(confirm("Tem a certeza que deseja remover o Perfil " + semestre.perfil[$index].nome + "?"))
423
                                                        semestre.perfil.splice($index,1);
424
                                                }
425
                                                $scope.removeUnidade = function(semestreOuperfil,$index)
426
                                                {
427
                                                    if(confirm("Tem a certeza que deseja remover a Unidade " + semestreOuperfil.unidade[$index].nome + "?"))
428
                                                    semestreOuperfil.unidade.splice($index,1);
429
                                                }
430
                                                $scope.addSemestre = function()
431
                                                {
432
                                                    $scope.json.semestre.push(
433
                                                            {
434
                                                                "id": "S1",
435
                                                                "notas": null,
436
                                                                "perfil": [],
437
                                                                "semestreDesc": "Semestre 1",
438
                                                                "semestreDescEn": "Semester 1",
439
                                                                "semestreDescEs": "Semestre 1",
440
                                                                "semestreDescFr": "Semestre 1",
441
                                                                "semestreId": null,
442
                                                                "unidade": [],
443
                                                                "type" : "semestre"
444
                                                            }
445
                                                    );
446
                                                }
1516 jmachado 447
 
1771 jmachado 448
                                                $scope.addPerfil = function(semestre)
449
                                                {
450
                                                    semestre.perfil.push(
451
                                                            {
452
                                                                "nome": "",
453
                                                                "perfilId": null,
454
                                                                "unidade" : [],
455
                                                                "type" : "perfil"
456
                                                            }
457
                                                    );
458
                                                }
459
 
460
                                                $scope.addUnidade = function(semestreOuPerfil)
461
                                                {
462
                                                    semestreOuPerfil.unidade.push(
463
                                                            {
464
                                                                "dep": "",
465
                                                                "ects": "",
466
                                                                "nome": "",
467
                                                                "nomeEn": null,
468
                                                                "nomeEs": null,
469
                                                                "nomeFr": null,
470
                                                                "obs": "",
471
                                                                "removed": null,
472
                                                                "siges": null,
473
                                                                "totalHoras": 0,
474
                                                                "urlFichaCurricular": "",
475
                                                                "urlUnidadeCurricular": "",
476
                                                                "type": "unidade"
477
                                                            }
478
                                                    );
479
                                                }
480
                                            });
481
 
482
 
483
                                        </script>
484
                                        <div class="panel panel-info">
485
                                            <div class="panel-heading">Configuração de Visualização</div>
486
                                            <div class="panel-body">
487
                                                <table class="table">
488
                                                    <thead>
489
                                                        <tr>
490
                                                            <th>SIGES</th>
491
                                                            <th>Nome</th>
492
                                                            <th>ECTS</th>
493
                                                            <th>Total</th>
494
                                                            <th>T</th>
495
                                                            <th>TP</th>
496
                                                            <th>P</th>
497
                                                            <th>PL</th>
498
                                                            <th>PD</th>
499
                                                            <th>OT</th>
500
                                                            <th>E</th>
501
                                                            <th>S</th>
502
                                                            <th>TC</th>
503
                                                            <th>O</th>
504
 
505
                                                            <th>URL UNIDADE</th>
506
                                                            <th>FICHA URL</th>
507
                                                        </tr>
508
                                                    </thead>
509
                                                    <tbody>
510
                                                    <tr>
511
                                                        <td><input type="checkbox" ng-model="confView.SIGES"></td>
512
                                                        <td><input type="checkbox" ng-model="confView.Nome"></td>
513
                                                        <td><input type="checkbox" ng-model="confView.ECTS"></td>
514
                                                        <td><input type="checkbox" ng-model="confView.Total"></td>
515
                                                        <td><input type="checkbox" ng-model="confView.T"></td>
516
                                                        <td><input type="checkbox" ng-model="confView.TP"></td>
517
                                                        <td><input type="checkbox" ng-model="confView.P"></td>
518
                                                        <td><input type="checkbox" ng-model="confView.PL"></td>
519
                                                        <td><input type="checkbox" ng-model="confView.PD"></td>
520
                                                        <td><input type="checkbox" ng-model="confView.OT"></td>
521
                                                        <td><input type="checkbox" ng-model="confView.E"></td>
522
                                                        <td><input type="checkbox" ng-model="confView.S"></td>
523
                                                        <td><input type="checkbox" ng-model="confView.TC"></td>
524
                                                        <td><input type="checkbox" ng-model="confView.O"></td>
525
                                                        <td><input type="checkbox" ng-model="confView.URL_UNIDADE"></td>
526
                                                        <td><input type="checkbox" ng-model="confView.FICHA_URL"></td>
527
                                                    </tr>
528
                                                    </tbody>
529
                                                </table>
530
                                            </div>
1534 jmachado 531
                                        </div>
1771 jmachado 532
 
533
                                        <div class="panel panel-default">
534
                                            <div class="panel-heading">
535
                                                Informação obtida do Siges (Auxiliar)
1534 jmachado 536
                                            </div>
1771 jmachado 537
                                            <div class="panel-body">
538
                                                <div class="form-group">
539
                                                    <label class="control-label col-sm-2">Ano do Plano no Siges</label>
540
                                                    <div class="col-sm-10">
541
                                                        <input type="text" class="form-control" ng-model="json.anoPlanoSiges"/>
542
                                                    </div>
1534 jmachado 543
                                                </div>
1771 jmachado 544
                                                <div class="form-group">
545
                                                    <label class="control-label col-sm-2">Código do Plano no Siges</label>
546
                                                    <div class="col-sm-10">
547
                                                        <input type="text" class="form-control" ng-model="json.codigoPlanoSiges"/>
548
                                                    </div>
1534 jmachado 549
                                                </div>
1771 jmachado 550
                                                <div class="form-group">
551
                                                    <label class="control-label col-sm-2">Linha Descritiva do Plano no Siges</label>
552
                                                    <div class="col-sm-10">
553
                                                        <input type="text" class="form-control" ng-model="json.descPlanoSiges"/>
554
                                                    </div>
555
                                                </div>
1534 jmachado 556
                                            </div>
557
                                        </div>
558
 
1771 jmachado 559
                                        <div class="panel panel-default">
1516 jmachado 560
                                            <div class="panel-heading">
1771 jmachado 561
                                                Semestres
562
                                                <button style="margin-left: 4px"  type="button" class="btn btn-success pull-right" ng-click="addSemestre()">
563
                                                    <span class="glyphicon glyphicon-plus"> </span> Semestre
564
                                                </button>
565
                                            </div>
566
                                            <div class="panel-body">
567
                                                <div ui-tree="treeOptions" id="page-content-root">
568
                                                    <div ui-tree-nodes ng-model="json.semestre">
569
                                                        <div class="panel panel-primary" ng-repeat="s in json.semestre" ui-tree-node ng-include="'semestre_renderer.html'" ng-init="s.type='semestre'">
570
                                                    </div>
571
                                                </div>
572
                                            </div>
573
                                        </div>
1516 jmachado 574
 
1771 jmachado 575
                                        <script type="text/ng-template" id="semestre_renderer.html">
576
                                            <div class="panel-heading">
1516 jmachado 577
                                                <div class="form-group">
1771 jmachado 578
 
579
                                                    <div class="col-sm-1">
580
                                                        <button type="button" class="btn btn-danger" ng-click="removeSemestre($index)">
1516 jmachado 581
                                                            <span class="glyphicon glyphicon-remove"> </span>
1507 jmachado 582
                                                        </button>
1505 jmachado 583
                                                    </div>
1771 jmachado 584
                                                    <div class="col-sm-4" ui-tree-handle>
585
                                                        <span class="btn btn-info"><i class="glyphicon glyphicon-resize-vertical"></i></span>
1516 jmachado 586
                                                        Duração
587
                                                    </div>
1517 jmachado 588
                                                    <div class="col-sm-3">
1771 jmachado 589
                                                        <select class="form-control chosenOff" ng-model="s.id">
590
                                                            <option value="S1">Semestre 1</option>
591
                                                            <option value="S2">Semestre 2</option>
592
                                                            <option value="S3">Semestre 3</option>
593
                                                            <option value="S4">Semestre 4</option>
594
                                                            <option value="S5">Semestre 5</option>
595
                                                            <option value="S6">Semestre 6</option>
596
                                                            <option value="S7">Semestre 7</option>
597
                                                            <option value="S8">Semestre 8</option>
598
                                                            <option value="A1">Anual 1</option>
599
                                                            <option value="A2">Anual 2</option>
600
                                                            <option value="A3">Anual 3</option>
601
                                                            <option value="A4">Anual 4</option>
602
                                                            <option value="T1">Trimestre 1</option>
603
                                                            <option value="T2">Trimestre 2</option>
604
                                                            <option value="T3">Trimestre 3</option>
605
                                                            <option value="T4">Trimestre 4</option>
606
                                                            <option value="T5">Trimestre 5</option>
607
                                                            <option value="T6">Trimestre 6</option>
608
                                                            <option value="T7">Trimestre 7</option>
609
                                                            <option value="T8">Trimestre 8</option>
610
                                                            <option value="OP">Opcionais</option>
611
                                                        </select>
612
                                                        <div ng-show="s.id == 'OP'">
613
                                                            Descrição (PT) <input type="text" ng-model="s.semestreDesc" class="form-control"/>
614
                                                            Descrição (EN) <input type="text" ng-model="s.semestreDescEn" class="form-control"/>
615
                                                            Descrição (ES) <input type="text" ng-model="s.semestreDescEs" class="form-control"/>
616
                                                            Descrição (FR) <input type="text" ng-model="s.semestreDescFr" class="form-control"/>
1517 jmachado 617
                                                        </div>
1516 jmachado 618
                                                    </div>
1771 jmachado 619
                                                    <div class="col-sm-4">
1507 jmachado 620
 
1771 jmachado 621
                                                        <button style="margin-left: 4px"  type="button" class="btn btn-success pull-right" ng-click="addUnidade(s)">
1516 jmachado 622
                                                            <span class="glyphicon glyphicon-plus"> </span> Unidade
623
                                                        </button>
624
 
1771 jmachado 625
                                                        <button style="margin-left: 4px" type="button" class="btn btn-success pull-right" ng-click="addPerfil(s)">
1516 jmachado 626
                                                            <span class="glyphicon glyphicon-plus"> </span> Perfil
627
                                                        </button>
628
                                                    </div>
629
                                                </div>
630
                                            </div>
631
                                            <div class="panel-body">
1521 jmachado 632
                                                <div class="form-group">
1516 jmachado 633
 
1521 jmachado 634
                                                    <div class="col-sm-2">
635
                                                        Notas do Semestre (Pode ser utilizado para mostrar Optativas)
636
                                                    </div>
637
                                                    <div class="col-sm-10">
1771 jmachado 638
                                                        <textarea ng-model="s.notas" rows="5" class="form-control"></textarea>
1521 jmachado 639
                                                    </div>
640
                                                </div>
641
 
1516 jmachado 642
                                                <button class="btn btn-default" data-toggle="collapse" type="button" data-target=".langs">Ver Campos Multingua</button>
1771 jmachado 643
                                                <div ui-tree-nodes="" ng-model="s.perfil" ng-show="s.perfil.length > 0">
644
                                                    <div class="panel panel-info" ng-repeat="p in s.perfil" ui-tree-node ng-include="'perfil_renderer.html'" ng-init="p.type='perfil';parent=s">
645
                                                    </div>
646
                                                </div>
647
                                                <div ng-show="s.unidade.length > 0" class="table-responsive">
648
                                                    <table class="table clearfix">
649
                                                        <thead>
650
                                                        <tr>
651
                                                            <td></td>
652
                                                            <td></td>
653
                                                            <th ng-show="confView.SIGES">SIGES</th>
654
                                                            <th ng-show="confView.Nome">Nome</th>
655
                                                            <th ng-show="confView.ECTS">ECTS</th>
656
                                                            <th ng-show="confView.Total">Total</th>
657
                                                            <th ng-show="confView.T">T</th>
658
                                                            <th ng-show="confView.TP">TP</th>
659
                                                            <th ng-show="confView.P">P</th>
660
                                                            <th ng-show="confView.PL">PL</th>
661
                                                            <th ng-show="confView.PD">PD</th>
662
                                                            <th ng-show="confView.OT">OT</th>
663
                                                            <th ng-show="confView.E">E</th>
664
                                                            <th ng-show="confView.S">S</th>
665
                                                            <th ng-show="confView.TC">TC</th>
666
                                                            <th ng-show="confView.O">O</th>
667
                                                            <th ng-show="confView.URL_UNIDADE">URL UNIDADE</th>
668
                                                            <th ng-show="confView.FICHA_URL">FICHA URL</th>
669
                                                        </tr>
670
                                                    </thead>
671
                                                    <tbody ui-tree-nodes="" ng-model="s.unidade">
1517 jmachado 672
 
1771 jmachado 673
                                                        <!-- UNIDADE TEMPLATE START-->
674
                                                        <tr ng-repeat="u in s.unidade" ui-tree-node ng-include="'unidade_renderer.html'" ng-init="u.type='unidade';parent=s">
675
                                                        </tr>
676
                                                        <!--UNIDADE TEMPLATE END-->
1507 jmachado 677
 
1771 jmachado 678
                                                    </tbody>
679
                                                </table>
680
                                                </div>
681
                                            </div>
682
                                        </script>
683
                                        <!-- PERFIL TEMPLATE START -->
684
                                        <script type="text/ng-template" id="perfil_renderer.html">
1507 jmachado 685
 
1771 jmachado 686
                                            <div class="panel-heading">
1516 jmachado 687
 
1771 jmachado 688
                                                <div class="form-group">
689
                                                    <div class="col-sm-1">
690
                                                        <button type="button" class="btn btn-danger" ng-click="removePerfil(parent,$index)">
691
                                                            <span class="glyphicon glyphicon-remove"> </span>
692
                                                        </button>
1505 jmachado 693
                                                    </div>
1771 jmachado 694
                                                    <div class="col-sm-3" ui-tree-handle>
695
                                                        <span class="btn btn-info"><i class="glyphicon glyphicon-resize-vertical"></i></span> Perfil
696
                                                    </div>
697
                                                    <div class="col-sm-5">
698
                                                        <input type="text" class="form-control" ng-model="p.nome">
699
                                                    </div>
700
                                                    <div  class="col-sm-3">
701
                                                        <button type="button" class="btn btn-success pull-right" ng-click="addUnidade(p)">
702
                                                            <span class="glyphicon glyphicon-plus"> </span>  Unidade
703
                                                        </button>
704
                                                    </div>
705
                                                </div>
706
                                            </div>
707
                                            <div class="panel-body clearfix table-responsive">
708
                                                <table class="table">
1516 jmachado 709
                                                    <thead>
1771 jmachado 710
                                                    <tr>
711
                                                        <td></td>
712
                                                        <td></td>
713
                                                        <th ng-show="confView.SIGES">SIGES</th>
714
                                                        <th ng-show="confView.Nome">Nome</th>
715
                                                        <th ng-show="confView.ECTS">ECTS</th>
716
                                                        <th ng-show="confView.Total">Total</th>
717
                                                        <th ng-show="confView.T">T</th>
718
                                                        <th ng-show="confView.TP">TP</th>
719
                                                        <th ng-show="confView.P">P</th>
720
                                                        <th ng-show="confView.PL">PL</th>
721
                                                        <th ng-show="confView.PD">PD</th>
722
                                                        <th ng-show="confView.OT">OT</th>
723
                                                        <th ng-show="confView.E">E</th>
724
                                                        <th ng-show="confView.S">S</th>
725
                                                        <th ng-show="confView.TC">TC</th>
726
                                                        <th ng-show="confView.O">O</th>
727
                                                        <th ng-show="confView.URL_UNIDADE">URL UNIDADE</th>
728
                                                        <th ng-show="confView.FICHA_URL">FICHA URL</th>
729
                                                    </tr>
1516 jmachado 730
                                                    </thead>
1771 jmachado 731
                                                    <tbody ui-tree-nodes="" ng-model="p.unidade">
732
                                                        <!-- UNIDADE TEMPLATE START-->
733
                                                        <tr ng-repeat="u in p.unidade" ui-tree-node ng-include="'unidade_renderer.html'" ng-init="u.type='unidade';parent=p">
734
                                                        </tr>
735
                                                        <!--UNIDADE TEMPLATE END-->
1507 jmachado 736
 
1771 jmachado 737
                                                    </tbody>
738
                                                </table>
739
                                            </div>
740
                                        </script>
1507 jmachado 741
 
1771 jmachado 742
                                        <script type="text/ng-template" id="unidade_renderer.html">
743
                                            <td class="text-nowrap">
744
                                                <span class="btn btn-info"><i class="glyphicon glyphicon-resize-vertical" ui-tree-handle></i></span>
745
                                            </td>
746
                                            <td>
747
                                                <button type="button" class="btn btn-danger" ng-click="removeUnidade(parent,$index)">
748
                                                    <span class="glyphicon glyphicon-remove"> </span>
749
                                                </button>
750
                                            </td>
751
                                            <td ng-show="confView.SIGES">
752
                                                <%--
1507 jmachado 753
 
1771 jmachado 754
                                                FOCUS FIND UNIT
755
                                                <script>
756
 
757
                                                    $(document).ready(
758
                                                            function()
759
                                                            {
760
                                                                $("#siges${dummyIndexIdUnidades}").focusout(
761
                                                                        function(){
762
                                                                            var code = $("#siges${dummyIndexIdUnidades}").val();
763
                                                                            $.getJSON("<%=request.getContextPath()%>/user/courses/courseApiJson.jsp",
764
                                                                                    { service:"findCourseUnit",
765
                                                                                        siges: code,
766
                                                                                        courseSigesCode: "${course.code}"
767
                                                                                    },
768
                                                                                    function(data)
769
                                                                                    {
770
                                                                                        if(data.response == "ok")
771
                                                                                        {
772
                                                                                            $("#nome${dummyIndexIdUnidades}").val(data.courseUnitName);
773
                                                                                            $("#sigesResponse${dummyIndexIdUnidades}").html("");
774
                                                                                        }
775
                                                                                        else
776
                                                                                        {
777
                                                                                            $("#sigesResponse${dummyIndexIdUnidades}").html("Não encontrado");
778
                                                                                        }
779
                                                                                    }
780
                                                                            );
1517 jmachado 781
                                                                        }
1771 jmachado 782
                                                                );
783
                                                            }
784
                                                    );
785
                                                </script>--%>
1520 jmachado 786
 
1771 jmachado 787
                                                <input type="text" ng-model="u.siges" style="width: 60px"/>
788
                                                <%--<div id="sigesResponse${dummyIndexIdUnidades}"></div>--%>
789
                                            </td>
790
                                            <td ng-show="confView.Nome">
791
                                                <div>
792
                                                    <div class="col-sm-11"><input type="text"  style="width:200px" ng-model="u.nome"/></div>
1505 jmachado 793
 
1771 jmachado 794
                                                    <div class="langs collapse" >
795
                                                        <div class="col-sm-1">(EN)</div>
796
                                                        <div class="col-sm-11"><input type="text"  style="width:200px" ng-model="u.nomeEn"/></div>
797
                                                        <div class="col-sm-1">(ES)</div>
798
                                                        <div class="col-sm-11"><input type="text"  style="width:200px" ng-model="u.nomeEs"/></div>
799
                                                        <div class="col-sm-1">(FR)</div>
800
                                                        <div class="col-sm-11"><input type="text"  style="width:200px" ng-model="u.nomeFr"/></div>
801
                                                    </div>
802
                                                </div>
1505 jmachado 803
 
1771 jmachado 804
                                            </td>
805
                                            <td ng-show="confView.ECTS"><input type="text" style="width: 40px" ng-model="u.eCTS"/></td>
806
                                            <td ng-show="confView.Total"><input type="text" style="width: 40px" ng-model="u.totalHoras"></td>
1507 jmachado 807
 
1771 jmachado 808
                                            <td ng-show="confView.T"><input type="text" style="width: 40px" ng-model="u.horasContacto.t"/></td>
1772 jmachado 809
                                            <td ng-show="confView.TP"><input type="text" style="width: 40px" ng-model="u.horasContacto.tP"/></td>
1771 jmachado 810
                                            <td ng-show="confView.P"><input type="text" style="width: 40px" ng-model="u.horasContacto.p"/></td>
1772 jmachado 811
                                            <td ng-show="confView.PL"><input type="text" style="width: 40px" ng-model="u.horasContacto.pL"/></td>
812
                                            <td ng-show="confView.PD"><input type="text" style="width: 40px" ng-model="u.horasContacto.pD"/></td>
813
                                            <td ng-show="confView.OT"><input type="text" style="width: 40px" ng-model="u.horasContacto.oT"/></td>
1771 jmachado 814
                                            <td ng-show="confView.E"><input type="text" style="width: 40px" ng-model="u.horasContacto.e"/></td>
815
                                            <td ng-show="confView.S"><input type="text" style="width: 40px" ng-model="u.horasContacto.s"/></td>
1772 jmachado 816
                                            <td ng-show="confView.TC"><input type="text" style="width: 40px" ng-model="u.horasContacto.tC"/></td>
1771 jmachado 817
                                            <td ng-show="confView.O"><input type="text" style="width: 40px" ng-model="u.horasContacto.o"/></td>
818
                                            <td ng-show="confView.URL_UNIDADE"><input type="text" ng-model="u.urlUnidadeCurricular" style="width:600px"/></td>
819
                                            <td ng-show="confView.FICHA_URL" data-unit-semestre="{{s.id}}" data-course-siges-code="${courseSigesCode}" data-unit-siges-code="{{u.siges}}" data-unit-ficha-url-target-id="urlFichaCurricular{{s.id}}_{{u.siges}}" data-unit-site-url-target-id="urlUnidadeCurricular{{s.id}}_{{u.siges}}">
820
                                                <input type="text" id="urlFichaCurricular{{s.id}}_{{u.siges}}"  ng-model="u.urlFichaCurricular" style="width:600px"/>
821
                                            </td>
822
                                        </script>
1505 jmachado 823
 
1772 jmachado 824
                                        <pre class="code">
1771 jmachado 825
                                            {{json | json}}
1772 jmachado 826
                                        </pre>
1771 jmachado 827
                                        <a type="button" class="btn btn-danger" href="<%=request.getContextPath()%>/user/adminStudyPlans.do?courseId=${courseId}">Cancelar</a>
828
                                        <button type="button" class="btn btn-success" ng-click="salvar()">Salvar</button>
829
                                    </div>
1505 jmachado 830
 
831
 
832
 
833
 
834
 
1516 jmachado 835
                    </div>
1505 jmachado 836
                </div>
1516 jmachado 837
            </html:form>
1505 jmachado 838
        </div>
839
    </div>
840
 
841
<%
842
 
843
    AbstractDao.getCurrentSession().getTransaction().commit();
844
%>
845