Subversion Repositories bacoAlunos

Rev

Rev 1772 | Rev 1789 | 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
                                                }
1773 jmachado 480
                                                $scope.findSiges = function(u,s){
481
                                                    var code = u.siges;
482
                                                    $.getJSON("<%=request.getContextPath()%>/user/courses/courseApiJson.jsp",
483
                                                            { service:"findCourseUnit",
484
                                                                siges: code,
485
                                                                courseSigesCode: "${course.code}"
486
                                                            },
487
                                                            function(data)
488
                                                            {
489
                                                                if(data.response == "ok")
490
                                                                {
491
                                                                    u.nome = data.courseUnitName;
492
                                                                    $("#sigesResponse" + s.id + "_" + u.siges).html("");
493
                                                                }
494
                                                                else
495
                                                                {
496
                                                                    $("#sigesResponse" + s.id + "_" + u.siges).html("Não encontrado");
497
                                                                }
498
                                                                $scope.$apply();
499
                                                            }
500
                                                    );
501
                                                }
1771 jmachado 502
                                            });
503
 
504
 
505
                                        </script>
506
                                        <div class="panel panel-info">
507
                                            <div class="panel-heading">Configuração de Visualização</div>
508
                                            <div class="panel-body">
509
                                                <table class="table">
510
                                                    <thead>
511
                                                        <tr>
512
                                                            <th>SIGES</th>
513
                                                            <th>Nome</th>
514
                                                            <th>ECTS</th>
515
                                                            <th>Total</th>
516
                                                            <th>T</th>
517
                                                            <th>TP</th>
518
                                                            <th>P</th>
519
                                                            <th>PL</th>
520
                                                            <th>PD</th>
521
                                                            <th>OT</th>
522
                                                            <th>E</th>
523
                                                            <th>S</th>
524
                                                            <th>TC</th>
525
                                                            <th>O</th>
526
 
527
                                                            <th>URL UNIDADE</th>
528
                                                            <th>FICHA URL</th>
529
                                                        </tr>
530
                                                    </thead>
531
                                                    <tbody>
532
                                                    <tr>
533
                                                        <td><input type="checkbox" ng-model="confView.SIGES"></td>
534
                                                        <td><input type="checkbox" ng-model="confView.Nome"></td>
535
                                                        <td><input type="checkbox" ng-model="confView.ECTS"></td>
536
                                                        <td><input type="checkbox" ng-model="confView.Total"></td>
537
                                                        <td><input type="checkbox" ng-model="confView.T"></td>
538
                                                        <td><input type="checkbox" ng-model="confView.TP"></td>
539
                                                        <td><input type="checkbox" ng-model="confView.P"></td>
540
                                                        <td><input type="checkbox" ng-model="confView.PL"></td>
541
                                                        <td><input type="checkbox" ng-model="confView.PD"></td>
542
                                                        <td><input type="checkbox" ng-model="confView.OT"></td>
543
                                                        <td><input type="checkbox" ng-model="confView.E"></td>
544
                                                        <td><input type="checkbox" ng-model="confView.S"></td>
545
                                                        <td><input type="checkbox" ng-model="confView.TC"></td>
546
                                                        <td><input type="checkbox" ng-model="confView.O"></td>
547
                                                        <td><input type="checkbox" ng-model="confView.URL_UNIDADE"></td>
548
                                                        <td><input type="checkbox" ng-model="confView.FICHA_URL"></td>
549
                                                    </tr>
550
                                                    </tbody>
551
                                                </table>
552
                                            </div>
1534 jmachado 553
                                        </div>
1771 jmachado 554
 
555
                                        <div class="panel panel-default">
556
                                            <div class="panel-heading">
557
                                                Informação obtida do Siges (Auxiliar)
1534 jmachado 558
                                            </div>
1771 jmachado 559
                                            <div class="panel-body">
560
                                                <div class="form-group">
561
                                                    <label class="control-label col-sm-2">Ano do Plano no Siges</label>
562
                                                    <div class="col-sm-10">
563
                                                        <input type="text" class="form-control" ng-model="json.anoPlanoSiges"/>
564
                                                    </div>
1534 jmachado 565
                                                </div>
1771 jmachado 566
                                                <div class="form-group">
567
                                                    <label class="control-label col-sm-2">Código do Plano no Siges</label>
568
                                                    <div class="col-sm-10">
569
                                                        <input type="text" class="form-control" ng-model="json.codigoPlanoSiges"/>
570
                                                    </div>
1534 jmachado 571
                                                </div>
1771 jmachado 572
                                                <div class="form-group">
573
                                                    <label class="control-label col-sm-2">Linha Descritiva do Plano no Siges</label>
574
                                                    <div class="col-sm-10">
575
                                                        <input type="text" class="form-control" ng-model="json.descPlanoSiges"/>
576
                                                    </div>
577
                                                </div>
1534 jmachado 578
                                            </div>
579
                                        </div>
580
 
1771 jmachado 581
                                        <div class="panel panel-default">
1516 jmachado 582
                                            <div class="panel-heading">
1771 jmachado 583
                                                Semestres
584
                                                <button style="margin-left: 4px"  type="button" class="btn btn-success pull-right" ng-click="addSemestre()">
585
                                                    <span class="glyphicon glyphicon-plus"> </span> Semestre
586
                                                </button>
587
                                            </div>
588
                                            <div class="panel-body">
589
                                                <div ui-tree="treeOptions" id="page-content-root">
590
                                                    <div ui-tree-nodes ng-model="json.semestre">
591
                                                        <div class="panel panel-primary" ng-repeat="s in json.semestre" ui-tree-node ng-include="'semestre_renderer.html'" ng-init="s.type='semestre'">
592
                                                    </div>
593
                                                </div>
594
                                            </div>
595
                                        </div>
1516 jmachado 596
 
1771 jmachado 597
                                        <script type="text/ng-template" id="semestre_renderer.html">
598
                                            <div class="panel-heading">
1516 jmachado 599
                                                <div class="form-group">
1771 jmachado 600
 
601
                                                    <div class="col-sm-1">
602
                                                        <button type="button" class="btn btn-danger" ng-click="removeSemestre($index)">
1516 jmachado 603
                                                            <span class="glyphicon glyphicon-remove"> </span>
1507 jmachado 604
                                                        </button>
1505 jmachado 605
                                                    </div>
1771 jmachado 606
                                                    <div class="col-sm-4" ui-tree-handle>
607
                                                        <span class="btn btn-info"><i class="glyphicon glyphicon-resize-vertical"></i></span>
1516 jmachado 608
                                                        Duração
609
                                                    </div>
1517 jmachado 610
                                                    <div class="col-sm-3">
1771 jmachado 611
                                                        <select class="form-control chosenOff" ng-model="s.id">
612
                                                            <option value="S1">Semestre 1</option>
613
                                                            <option value="S2">Semestre 2</option>
614
                                                            <option value="S3">Semestre 3</option>
615
                                                            <option value="S4">Semestre 4</option>
616
                                                            <option value="S5">Semestre 5</option>
617
                                                            <option value="S6">Semestre 6</option>
618
                                                            <option value="S7">Semestre 7</option>
619
                                                            <option value="S8">Semestre 8</option>
620
                                                            <option value="A1">Anual 1</option>
621
                                                            <option value="A2">Anual 2</option>
622
                                                            <option value="A3">Anual 3</option>
623
                                                            <option value="A4">Anual 4</option>
624
                                                            <option value="T1">Trimestre 1</option>
625
                                                            <option value="T2">Trimestre 2</option>
626
                                                            <option value="T3">Trimestre 3</option>
627
                                                            <option value="T4">Trimestre 4</option>
628
                                                            <option value="T5">Trimestre 5</option>
629
                                                            <option value="T6">Trimestre 6</option>
630
                                                            <option value="T7">Trimestre 7</option>
631
                                                            <option value="T8">Trimestre 8</option>
632
                                                            <option value="OP">Opcionais</option>
633
                                                        </select>
634
                                                        <div ng-show="s.id == 'OP'">
635
                                                            Descrição (PT) <input type="text" ng-model="s.semestreDesc" class="form-control"/>
636
                                                            Descrição (EN) <input type="text" ng-model="s.semestreDescEn" class="form-control"/>
637
                                                            Descrição (ES) <input type="text" ng-model="s.semestreDescEs" class="form-control"/>
638
                                                            Descrição (FR) <input type="text" ng-model="s.semestreDescFr" class="form-control"/>
1517 jmachado 639
                                                        </div>
1516 jmachado 640
                                                    </div>
1771 jmachado 641
                                                    <div class="col-sm-4">
1507 jmachado 642
 
1771 jmachado 643
                                                        <button style="margin-left: 4px"  type="button" class="btn btn-success pull-right" ng-click="addUnidade(s)">
1516 jmachado 644
                                                            <span class="glyphicon glyphicon-plus"> </span> Unidade
645
                                                        </button>
646
 
1771 jmachado 647
                                                        <button style="margin-left: 4px" type="button" class="btn btn-success pull-right" ng-click="addPerfil(s)">
1516 jmachado 648
                                                            <span class="glyphicon glyphicon-plus"> </span> Perfil
649
                                                        </button>
650
                                                    </div>
651
                                                </div>
652
                                            </div>
653
                                            <div class="panel-body">
1521 jmachado 654
                                                <div class="form-group">
1516 jmachado 655
 
1521 jmachado 656
                                                    <div class="col-sm-2">
657
                                                        Notas do Semestre (Pode ser utilizado para mostrar Optativas)
658
                                                    </div>
659
                                                    <div class="col-sm-10">
1771 jmachado 660
                                                        <textarea ng-model="s.notas" rows="5" class="form-control"></textarea>
1521 jmachado 661
                                                    </div>
662
                                                </div>
663
 
1516 jmachado 664
                                                <button class="btn btn-default" data-toggle="collapse" type="button" data-target=".langs">Ver Campos Multingua</button>
1771 jmachado 665
                                                <div ui-tree-nodes="" ng-model="s.perfil" ng-show="s.perfil.length > 0">
666
                                                    <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">
667
                                                    </div>
668
                                                </div>
669
                                                <div ng-show="s.unidade.length > 0" class="table-responsive">
670
                                                    <table class="table clearfix">
671
                                                        <thead>
672
                                                        <tr>
673
                                                            <td></td>
674
                                                            <td></td>
675
                                                            <th ng-show="confView.SIGES">SIGES</th>
676
                                                            <th ng-show="confView.Nome">Nome</th>
677
                                                            <th ng-show="confView.ECTS">ECTS</th>
678
                                                            <th ng-show="confView.Total">Total</th>
679
                                                            <th ng-show="confView.T">T</th>
680
                                                            <th ng-show="confView.TP">TP</th>
681
                                                            <th ng-show="confView.P">P</th>
682
                                                            <th ng-show="confView.PL">PL</th>
683
                                                            <th ng-show="confView.PD">PD</th>
684
                                                            <th ng-show="confView.OT">OT</th>
685
                                                            <th ng-show="confView.E">E</th>
686
                                                            <th ng-show="confView.S">S</th>
687
                                                            <th ng-show="confView.TC">TC</th>
688
                                                            <th ng-show="confView.O">O</th>
689
                                                            <th ng-show="confView.URL_UNIDADE">URL UNIDADE</th>
690
                                                            <th ng-show="confView.FICHA_URL">FICHA URL</th>
691
                                                        </tr>
692
                                                    </thead>
693
                                                    <tbody ui-tree-nodes="" ng-model="s.unidade">
1517 jmachado 694
 
1771 jmachado 695
                                                        <!-- UNIDADE TEMPLATE START-->
696
                                                        <tr ng-repeat="u in s.unidade" ui-tree-node ng-include="'unidade_renderer.html'" ng-init="u.type='unidade';parent=s">
697
                                                        </tr>
698
                                                        <!--UNIDADE TEMPLATE END-->
1507 jmachado 699
 
1771 jmachado 700
                                                    </tbody>
701
                                                </table>
702
                                                </div>
703
                                            </div>
704
                                        </script>
705
                                        <!-- PERFIL TEMPLATE START -->
706
                                        <script type="text/ng-template" id="perfil_renderer.html">
1507 jmachado 707
 
1771 jmachado 708
                                            <div class="panel-heading">
1516 jmachado 709
 
1771 jmachado 710
                                                <div class="form-group">
711
                                                    <div class="col-sm-1">
712
                                                        <button type="button" class="btn btn-danger" ng-click="removePerfil(parent,$index)">
713
                                                            <span class="glyphicon glyphicon-remove"> </span>
714
                                                        </button>
1505 jmachado 715
                                                    </div>
1771 jmachado 716
                                                    <div class="col-sm-3" ui-tree-handle>
717
                                                        <span class="btn btn-info"><i class="glyphicon glyphicon-resize-vertical"></i></span> Perfil
718
                                                    </div>
719
                                                    <div class="col-sm-5">
720
                                                        <input type="text" class="form-control" ng-model="p.nome">
721
                                                    </div>
722
                                                    <div  class="col-sm-3">
723
                                                        <button type="button" class="btn btn-success pull-right" ng-click="addUnidade(p)">
724
                                                            <span class="glyphicon glyphicon-plus"> </span>  Unidade
725
                                                        </button>
726
                                                    </div>
727
                                                </div>
728
                                            </div>
729
                                            <div class="panel-body clearfix table-responsive">
730
                                                <table class="table">
1516 jmachado 731
                                                    <thead>
1771 jmachado 732
                                                    <tr>
733
                                                        <td></td>
734
                                                        <td></td>
735
                                                        <th ng-show="confView.SIGES">SIGES</th>
736
                                                        <th ng-show="confView.Nome">Nome</th>
737
                                                        <th ng-show="confView.ECTS">ECTS</th>
738
                                                        <th ng-show="confView.Total">Total</th>
739
                                                        <th ng-show="confView.T">T</th>
740
                                                        <th ng-show="confView.TP">TP</th>
741
                                                        <th ng-show="confView.P">P</th>
742
                                                        <th ng-show="confView.PL">PL</th>
743
                                                        <th ng-show="confView.PD">PD</th>
744
                                                        <th ng-show="confView.OT">OT</th>
745
                                                        <th ng-show="confView.E">E</th>
746
                                                        <th ng-show="confView.S">S</th>
747
                                                        <th ng-show="confView.TC">TC</th>
748
                                                        <th ng-show="confView.O">O</th>
749
                                                        <th ng-show="confView.URL_UNIDADE">URL UNIDADE</th>
750
                                                        <th ng-show="confView.FICHA_URL">FICHA URL</th>
751
                                                    </tr>
1516 jmachado 752
                                                    </thead>
1771 jmachado 753
                                                    <tbody ui-tree-nodes="" ng-model="p.unidade">
754
                                                        <!-- UNIDADE TEMPLATE START-->
755
                                                        <tr ng-repeat="u in p.unidade" ui-tree-node ng-include="'unidade_renderer.html'" ng-init="u.type='unidade';parent=p">
756
                                                        </tr>
757
                                                        <!--UNIDADE TEMPLATE END-->
1507 jmachado 758
 
1771 jmachado 759
                                                    </tbody>
760
                                                </table>
761
                                            </div>
762
                                        </script>
1507 jmachado 763
 
1771 jmachado 764
                                        <script type="text/ng-template" id="unidade_renderer.html">
765
                                            <td class="text-nowrap">
766
                                                <span class="btn btn-info"><i class="glyphicon glyphicon-resize-vertical" ui-tree-handle></i></span>
767
                                            </td>
768
                                            <td>
769
                                                <button type="button" class="btn btn-danger" ng-click="removeUnidade(parent,$index)">
770
                                                    <span class="glyphicon glyphicon-remove"> </span>
771
                                                </button>
772
                                            </td>
773
                                            <td ng-show="confView.SIGES">
1507 jmachado 774
 
1771 jmachado 775
 
1520 jmachado 776
 
1773 jmachado 777
 
778
                                                <input ng-blur="findSiges(u,s)" type="text" ng-model="u.siges" style="width: 60px"/>
779
                                                <div id="sigesResponse{{s.id}}_{{u.siges}}"></div>
1771 jmachado 780
                                            </td>
781
                                            <td ng-show="confView.Nome">
782
                                                <div>
783
                                                    <div class="col-sm-11"><input type="text"  style="width:200px" ng-model="u.nome"/></div>
1505 jmachado 784
 
1771 jmachado 785
                                                    <div class="langs collapse" >
786
                                                        <div class="col-sm-1">(EN)</div>
787
                                                        <div class="col-sm-11"><input type="text"  style="width:200px" ng-model="u.nomeEn"/></div>
788
                                                        <div class="col-sm-1">(ES)</div>
789
                                                        <div class="col-sm-11"><input type="text"  style="width:200px" ng-model="u.nomeEs"/></div>
790
                                                        <div class="col-sm-1">(FR)</div>
791
                                                        <div class="col-sm-11"><input type="text"  style="width:200px" ng-model="u.nomeFr"/></div>
792
                                                    </div>
793
                                                </div>
1505 jmachado 794
 
1771 jmachado 795
                                            </td>
796
                                            <td ng-show="confView.ECTS"><input type="text" style="width: 40px" ng-model="u.eCTS"/></td>
797
                                            <td ng-show="confView.Total"><input type="text" style="width: 40px" ng-model="u.totalHoras"></td>
1507 jmachado 798
 
1771 jmachado 799
                                            <td ng-show="confView.T"><input type="text" style="width: 40px" ng-model="u.horasContacto.t"/></td>
1772 jmachado 800
                                            <td ng-show="confView.TP"><input type="text" style="width: 40px" ng-model="u.horasContacto.tP"/></td>
1771 jmachado 801
                                            <td ng-show="confView.P"><input type="text" style="width: 40px" ng-model="u.horasContacto.p"/></td>
1772 jmachado 802
                                            <td ng-show="confView.PL"><input type="text" style="width: 40px" ng-model="u.horasContacto.pL"/></td>
803
                                            <td ng-show="confView.PD"><input type="text" style="width: 40px" ng-model="u.horasContacto.pD"/></td>
804
                                            <td ng-show="confView.OT"><input type="text" style="width: 40px" ng-model="u.horasContacto.oT"/></td>
1771 jmachado 805
                                            <td ng-show="confView.E"><input type="text" style="width: 40px" ng-model="u.horasContacto.e"/></td>
806
                                            <td ng-show="confView.S"><input type="text" style="width: 40px" ng-model="u.horasContacto.s"/></td>
1772 jmachado 807
                                            <td ng-show="confView.TC"><input type="text" style="width: 40px" ng-model="u.horasContacto.tC"/></td>
1771 jmachado 808
                                            <td ng-show="confView.O"><input type="text" style="width: 40px" ng-model="u.horasContacto.o"/></td>
809
                                            <td ng-show="confView.URL_UNIDADE"><input type="text" ng-model="u.urlUnidadeCurricular" style="width:600px"/></td>
810
                                            <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}}">
811
                                                <input type="text" id="urlFichaCurricular{{s.id}}_{{u.siges}}"  ng-model="u.urlFichaCurricular" style="width:600px"/>
812
                                            </td>
813
                                        </script>
1505 jmachado 814
 
1772 jmachado 815
                                        <pre class="code">
1771 jmachado 816
                                            {{json | json}}
1772 jmachado 817
                                        </pre>
1771 jmachado 818
                                        <a type="button" class="btn btn-danger" href="<%=request.getContextPath()%>/user/adminStudyPlans.do?courseId=${courseId}">Cancelar</a>
819
                                        <button type="button" class="btn btn-success" ng-click="salvar()">Salvar</button>
820
                                    </div>
1505 jmachado 821
 
822
 
823
 
824
 
825
 
1516 jmachado 826
                    </div>
1505 jmachado 827
                </div>
1516 jmachado 828
            </html:form>
1505 jmachado 829
        </div>
830
    </div>
831
 
832
<%
833
 
834
    AbstractDao.getCurrentSession().getTransaction().commit();
835
%>
836