Rev 1771 | Rev 1773 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@ page import="jomm.dao.impl.AbstractDao" %>
<%@ page import="pt.estgp.estgweb.domain.Course" %>
<%@ page import="pt.estgp.estgweb.domain.CourseStudiesPlan" %>
<%@ page import="pt.estgp.estgweb.domain.CourseStudiesPlanImpl" %>
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
<%@ page import="pt.estgp.estgweb.services.courses.CoursesService" %>
<%@ page import="pt.estgp.estgweb.services.courses.xsd.Curso" %>
<%@ page import="pt.estgp.estgweb.services.courses.xsd.CursoImpl" %>
<%@ page import="pt.estgp.estgweb.web.form.courses.CourseStudiesPlansAdminForm" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm"%>
<%
//TODO NOVO JSON
//O SALVAR TEM DE SER UMA FuncTION E DEIXAR DE SER UM SUBMIT PARA PODERMOS TRASNFERIR O JSON
//PARA UMA VAR DE TEXTO
//todo temos de ter aqui o id do curso para o carregar aqui mesmo
//se queremos barras de navegação então temos de ter ser acedidos de um
//controlador que carregue o necerrário à barra ou então assumimos que
//o curso id esta sempre disponivel nas barras possiveis de chamar
AbstractDao.getCurrentSession().beginTransaction();
CourseStudiesPlanImpl planoEdicao;
boolean ultimaVersao = true;
Long courseId;
Long studyPlanId;
String versaoPlano = "Não Encontrada";
Course course;
if(request.getAttribute("CourseStudiesPlansAdminForm") != null)
{
CourseStudiesPlansAdminForm frm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm");
courseId = frm.getCourseId();
studyPlanId = frm.getCourseStudiesPlan().getId();
ultimaVersao = frm.isVersaoVigor();
course = DaoFactory.getCourseDaoImpl().load(courseId);
planoEdicao = frm.getCourseStudiesPlan();
}
else
{
courseId = Long.parseLong(request.getParameter("courseId"));
studyPlanId = Long.parseLong(request.getParameter("studyPlanId"));
request.setAttribute("courseId",courseId);
request.setAttribute("studyPlanId",studyPlanId);
course = DaoFactory.getCourseDaoImpl().load(courseId);
planoEdicao = null;
for(CourseStudiesPlan plan:course.getStudiesPlans())
{
if(plan.getId() == studyPlanId)
{
versaoPlano = plan.getVersion() + "";
planoEdicao = (CourseStudiesPlanImpl) DaoFactory.getCourseStudiesPlanDaoImpl().narrow(plan);
break;
}
ultimaVersao = false;
}
//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
}
request.setAttribute("courseId",courseId);
request.setAttribute("studyPlanId",studyPlanId);
request.setAttribute("course",course);
request.setAttribute("courseSigesCode",course.getCode());
/*
if(planoEdicao != null)
{
}
*/
%>
<div class="panel panel-default" id="planoApp" ng-app="planoApp" ng-controller="planoController">
<div class="panel-heading">
Edição do plano de estudos. Versão <%=versaoPlano%> <%=ultimaVersao? "(<u>é a versão em vigor</u>)":""%> do curso de <%=course.getName()%> (<%=course.getCode()%>)
</div>
<div class="panel-body">
<html:errors/>
<jomm:messages/>
<div class="panel panel-default">
<div class="panel-heading">Dados do Curso</div>
<div class="panel-body">
<div class="col-sm-12">Código do Curso <label class="text-info">${course.code}</label></div>
<div class="col-sm-12">
<table class="tablesorter-blue">
<thead>
<tr>
<th>Língua</th>
<th>Nome do Curso</th>
<th>Departamento</th>
</tr>
</thead>
<tbody>
<tr>
<td>PT</td>
<td>${course.name}</td>
<td>
<%if(course.getDepartment() != null){%>${course.department.name}<%}%>
</td>
</tr>
<tr>
<td>EN</td>
<td>${course.nameEn}</td>
<td>
<%if(course.getDepartment() != null){%>${course.department.nameEn}<%}%>
</td>
</tr>
<tr>
<td>ES</td>
<td>${course.nameEs}</td>
<td>
<%if(course.getDepartment() != null){%>${course.department.nameEs}<%}%>
</td>
</tr>
<tr>
<td>FR</td>
<td>${course.nameFr}</td>
<td>
<%if(course.getDepartment() != null){%>${course.department.nameFr}<%}%>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<html:form action="/user/courseControllerStudiesPlan" styleId="CourseStudiesPlansAdminForm" styleClass="form-horizontal" enctype="multipart/form-data">
<div class="panel panel-warning">
<div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> Clonagem a partir de outro plano de Estudos</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label col-sm-2">Versão Fonte para Clonagem</label>
<div class="col-sm-10">
<html:select styleClass="form-control" property="sourcePlanId">
<html:option value="">Nenhuma</html:option>
<%
for(CourseStudiesPlan plan:course.getStudiesPlans())
{
if(plan.getId() != studyPlanId)
{
request.setAttribute("nowPlanId",plan.getId());
%>
<html:option value="${nowPlanId}">Versão <%=plan.getVersion()%></html:option>
<%
}
}
%>
</html:select>
</div>
</div>
<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();">
Clonar para a fonte escolhida
</button>
</div>
</div>
<script>
function createFichasUrls()
{
$("[data-unit-ficha-url-target-id]").each(
function()
{
var targetId = $(this).attr("data-unit-ficha-url-target-id");
var sigesUnit = $(this).attr("data-unit-siges-code");
var sigesCourse = $(this).attr("data-course-siges-code");
var unitSemestre = $(this).attr("data-unit-semestre");
var sigesUrlInput = $("#" + targetId);
var urlPattern = $("#urlPadraoFicha").val();
var targetsType = $("#urlPadraoFichaAlvo option:selected").val();
if(targetsType == "all" || sigesUrlInput.val() == "")
{
urlPattern = urlPattern.replace("{SIGES_CURSO}",'${courseSigesCode}');
urlPattern = urlPattern.replace("{SIGES_UNIT}",sigesUnit);
urlPattern = urlPattern.replace("{UNIT_SEMESTRE}",unitSemestre);
$("#" + targetId).val(urlPattern);
}
}
);
alert("URLS gerados com Sucesso, Necessita de SALVAR o Plano.");
}
</script>
<div class="panel panel-warning">
<div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> Ferramenta Auxiliar de Auto-Preenchimento de URL's de Fichas</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label col-sm-2">URL Padrão</label>
<div class="col-sm-10">
<p>exemplo para a ESTG: http://www.estgp.pt/startLoadCourseUnitProgramSiges.do?unitCode={SIGES_UNIT}&courseCode={SIGES_CURSO}&semestre={UNIT_SEMESTRE}</p>
<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>
<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>
<input type="text" class="form-control" id="urlPadraoFicha" placeholder="http://exemplo.com/exemplo/{SIGES_CURSO}/{UNIT_SEMESTRE}/{SIGES_UNIT}.pdf">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Alvos</label>
<div class="col-sm-10">
<select id="urlPadraoFichaAlvo">
<option value="all">Todos</option>
<option value="onlyEmpty">Apenas Vazios</option>
</select>
</div>
</div>
<button class="btn btn-warning" type="button" data-toggle="modal" onclick="createFichasUrls()">
Gerar URL's de Fichas
</button>
</div>
</div>
<%
CourseStudiesPlansAdminForm courseStudiesPlansAdminForm = (CourseStudiesPlansAdminForm) request.getAttribute("CourseStudiesPlansAdminForm");
//Isto corre sempre que se entra no Editor a primeira vez e não apenas quando é um plano novo
//Form ainda não iniciado vai iniciar é a primeira vez
if(courseStudiesPlansAdminForm.getCourseStudiesPlan().getId() <= 0)
{
courseStudiesPlansAdminForm.setCourseStudiesPlan(planoEdicao);
courseStudiesPlansAdminForm.setCourseId(courseId);
courseStudiesPlansAdminForm.setVersaoVigor(ultimaVersao);
Curso cPlanoDoXml2Json = new CoursesService().loadCursoPlanoFromXml(planoEdicao.getXml());
if(cPlanoDoXml2Json == null)
courseStudiesPlansAdminForm.setPlanoEstudos(new CursoImpl());
else
courseStudiesPlansAdminForm.setPlanoEstudos(new CoursesService().loadCursoPlanoFromXml(planoEdicao.getXml()));
}
//LINHA NOVA PARA JSON DE INTERFACE
courseStudiesPlansAdminForm.setPlanoEstudosJsonInterface(CursoImpl.toJson(courseStudiesPlansAdminForm.getPlanoEstudos()));
%>
<logic:notEmpty name="CourseStudiesPlansAdminForm" property="courseStudiesPlan.importLog">
<div class="panel panel-warning">
<div class="panel-heading"><span class="glyphicon glyphicon-wrench"></span> LOG DA ULTIMA IMPORTAÇÃO</div>
<div class="panel-body">
<pre>
<html:hidden name="CourseStudiesPlansAdminForm" property="courseStudiesPlan.importLog"/>
<bean:write name="CourseStudiesPlansAdminForm" property="courseStudiesPlan.importLog"/>
</pre>
</div>
</div>
</logic:notEmpty>
<div class="panel panel-warning">
<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>
<div class="panel-body">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
<div class="form-group">
<label class="control-label col-sm-2">Escolher Ficheiro Exportado do Siges</label>
<div class="col-sm-10">
<html:file styleClass="form-control" property="formFileImport"/>
</div>
</div>
<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();">
Importar o ficheiro sobrepondo esta versão do plano
</button>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-body">
<div class="form-group">
<label class="control-label col-sm-2">Escolher Ficheiro Exportado do Siges Com Ramos</label>
<div class="col-sm-10">
<html:file styleClass="form-control" property="formFileImport2"/>
</div>
</div>
<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();">
FUNDIR o ficheiro com esta versão do plano
</button>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Plano de Estudos</div>
<div class="panel-body">
<input type="hidden" name="dispatch" value="savePlano"/>
<html:hidden property="courseId"/>
<html:hidden property="versaoVigor"/>
<html:hidden property="courseStudiesPlan.id"/>
<html:hidden styleId="semestreId" property="semestreId"/>
<html:hidden styleId="perfilId" property="perfilId"/>
<html:hidden styleId="planoEstudosJsonInterface" property="planoEstudosJsonInterface"/>
<div class="form-group">
<label class="control-label col-sm-2">Versão</label>
<div class="col-sm-10">
<html:text styleClass="form-control" property="courseStudiesPlan.version" size="3"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Descrição</label>
<div class="col-sm-10">
<html:text styleClass="form-control" property="courseStudiesPlan.versionDescription"/>
</div>
</div>
<div>
<script>
var planoApp = angular.module('planoApp', ['ui.tree']);
GLOBAL_BacoAngularAppDependencies.push('planoApp');
planoApp.controller('planoController', function ($scope) {
$scope.treeOptions = {
accept: function(sourceNodeScope, destNodesScope, destIndex) {
//if(destNodesScope)
//console.log(destNodesScope);
//console.log(sourceNodeScope);
//console.log(destIndex);
//console.log(destNodesScope.$parent.$modelValue.title);
//console.log(destNodesScope.$modelValue[0].type);
if(sourceNodeScope.$modelValue.type == destNodesScope.$modelValue[0].type)
return true;
return false;
},
dropped: function(e) {
//console.log (e.source.nodeScope.$modelValue);
//alert ("Largado o nó com nome: " + e.source.nodeScope.$modelValue.name + " sobre " + e.dest.nodesScope.$parent.$modelValue.name);
}
};
$scope.json = <%=courseStudiesPlansAdminForm.getPlanoEstudosJsonInterface()%>
$scope.confView =
{
"SIGES" : true ,
"Nome" : true ,
"ECTS" : true,
"Total" : true ,
"T" : true ,
"TP" : true ,
"P" : true ,
"PL" : true ,
"PD" : true ,
"OT" : true ,
"E" : true ,
"S" : true ,
"TC" : true ,
"O" : true ,
"URL_UNIDADE" : true ,
"FICHA_URL" : true
}
$scope.submeterForm = function()
{
$("#planoEstudosJsonInterface").val(
JSON.stringify($scope.json)
);
$("#CourseStudiesPlansAdminForm").submit();
}
$scope.fundirPlano = function()
{
set($("#CourseStudiesPlansAdminForm").get(0),"mergePlano");
$scope.submeterForm();
}
$scope.importarPlano = function()
{
set($("#CourseStudiesPlansAdminForm").get(0),"importarPlano");
$scope.submeterForm();
}
$scope.salvar = function()
{
set($("#CourseStudiesPlansAdminForm").get(0),"savePlano");
$scope.submeterForm();
}
$scope.removeSemestre = function($index)
{
if(confirm("Tem a certeza que deseja remover o Semestre " + $scope.json.semestre[$index].id + "?"))
$scope.json.semestre.splice($index,1);
}
$scope.removePerfil = function(semestre,$index)
{
if(confirm("Tem a certeza que deseja remover o Perfil " + semestre.perfil[$index].nome + "?"))
semestre.perfil.splice($index,1);
}
$scope.removeUnidade = function(semestreOuperfil,$index)
{
if(confirm("Tem a certeza que deseja remover a Unidade " + semestreOuperfil.unidade[$index].nome + "?"))
semestreOuperfil.unidade.splice($index,1);
}
$scope.addSemestre = function()
{
$scope.json.semestre.push(
{
"id": "S1",
"notas": null,
"perfil": [],
"semestreDesc": "Semestre 1",
"semestreDescEn": "Semester 1",
"semestreDescEs": "Semestre 1",
"semestreDescFr": "Semestre 1",
"semestreId": null,
"unidade": [],
"type" : "semestre"
}
);
}
$scope.addPerfil = function(semestre)
{
semestre.perfil.push(
{
"nome": "",
"perfilId": null,
"unidade" : [],
"type" : "perfil"
}
);
}
$scope.addUnidade = function(semestreOuPerfil)
{
semestreOuPerfil.unidade.push(
{
"dep": "",
"ects": "",
"nome": "",
"nomeEn": null,
"nomeEs": null,
"nomeFr": null,
"obs": "",
"removed": null,
"siges": null,
"totalHoras": 0,
"urlFichaCurricular": "",
"urlUnidadeCurricular": "",
"type": "unidade"
}
);
}
});
</script>
<div class="panel panel-info">
<div class="panel-heading">Configuração de Visualização</div>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th>SIGES</th>
<th>Nome</th>
<th>ECTS</th>
<th>Total</th>
<th>T</th>
<th>TP</th>
<th>P</th>
<th>PL</th>
<th>PD</th>
<th>OT</th>
<th>E</th>
<th>S</th>
<th>TC</th>
<th>O</th>
<th>URL UNIDADE</th>
<th>FICHA URL</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox" ng-model="confView.SIGES"></td>
<td><input type="checkbox" ng-model="confView.Nome"></td>
<td><input type="checkbox" ng-model="confView.ECTS"></td>
<td><input type="checkbox" ng-model="confView.Total"></td>
<td><input type="checkbox" ng-model="confView.T"></td>
<td><input type="checkbox" ng-model="confView.TP"></td>
<td><input type="checkbox" ng-model="confView.P"></td>
<td><input type="checkbox" ng-model="confView.PL"></td>
<td><input type="checkbox" ng-model="confView.PD"></td>
<td><input type="checkbox" ng-model="confView.OT"></td>
<td><input type="checkbox" ng-model="confView.E"></td>
<td><input type="checkbox" ng-model="confView.S"></td>
<td><input type="checkbox" ng-model="confView.TC"></td>
<td><input type="checkbox" ng-model="confView.O"></td>
<td><input type="checkbox" ng-model="confView.URL_UNIDADE"></td>
<td><input type="checkbox" ng-model="confView.FICHA_URL"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
Informação obtida do Siges (Auxiliar)
</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label col-sm-2">Ano do Plano no Siges</label>
<div class="col-sm-10">
<input type="text" class="form-control" ng-model="json.anoPlanoSiges"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Código do Plano no Siges</label>
<div class="col-sm-10">
<input type="text" class="form-control" ng-model="json.codigoPlanoSiges"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">Linha Descritiva do Plano no Siges</label>
<div class="col-sm-10">
<input type="text" class="form-control" ng-model="json.descPlanoSiges"/>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
Semestres
<button style="margin-left: 4px" type="button" class="btn btn-success pull-right" ng-click="addSemestre()">
<span class="glyphicon glyphicon-plus"> </span> Semestre
</button>
</div>
<div class="panel-body">
<div ui-tree="treeOptions" id="page-content-root">
<div ui-tree-nodes ng-model="json.semestre">
<div class="panel panel-primary" ng-repeat="s in json.semestre" ui-tree-node ng-include="'semestre_renderer.html'" ng-init="s.type='semestre'">
</div>
</div>
</div>
</div>
<script type="text/ng-template" id="semestre_renderer.html">
<div class="panel-heading">
<div class="form-group">
<div class="col-sm-1">
<button type="button" class="btn btn-danger" ng-click="removeSemestre($index)">
<span class="glyphicon glyphicon-remove"> </span>
</button>
</div>
<div class="col-sm-4" ui-tree-handle>
<span class="btn btn-info"><i class="glyphicon glyphicon-resize-vertical"></i></span>
Duração
</div>
<div class="col-sm-3">
<select class="form-control chosenOff" ng-model="s.id">
<option value="S1">Semestre 1</option>
<option value="S2">Semestre 2</option>
<option value="S3">Semestre 3</option>
<option value="S4">Semestre 4</option>
<option value="S5">Semestre 5</option>
<option value="S6">Semestre 6</option>
<option value="S7">Semestre 7</option>
<option value="S8">Semestre 8</option>
<option value="A1">Anual 1</option>
<option value="A2">Anual 2</option>
<option value="A3">Anual 3</option>
<option value="A4">Anual 4</option>
<option value="T1">Trimestre 1</option>
<option value="T2">Trimestre 2</option>
<option value="T3">Trimestre 3</option>
<option value="T4">Trimestre 4</option>
<option value="T5">Trimestre 5</option>
<option value="T6">Trimestre 6</option>
<option value="T7">Trimestre 7</option>
<option value="T8">Trimestre 8</option>
<option value="OP">Opcionais</option>
</select>
<div ng-show="s.id == 'OP'">
Descrição (PT) <input type="text" ng-model="s.semestreDesc" class="form-control"/>
Descrição (EN) <input type="text" ng-model="s.semestreDescEn" class="form-control"/>
Descrição (ES) <input type="text" ng-model="s.semestreDescEs" class="form-control"/>
Descrição (FR) <input type="text" ng-model="s.semestreDescFr" class="form-control"/>
</div>
</div>
<div class="col-sm-4">
<button style="margin-left: 4px" type="button" class="btn btn-success pull-right" ng-click="addUnidade(s)">
<span class="glyphicon glyphicon-plus"> </span> Unidade
</button>
<button style="margin-left: 4px" type="button" class="btn btn-success pull-right" ng-click="addPerfil(s)">
<span class="glyphicon glyphicon-plus"> </span> Perfil
</button>
</div>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<div class="col-sm-2">
Notas do Semestre (Pode ser utilizado para mostrar Optativas)
</div>
<div class="col-sm-10">
<textarea ng-model="s.notas" rows="5" class="form-control"></textarea>
</div>
</div>
<button class="btn btn-default" data-toggle="collapse" type="button" data-target=".langs">Ver Campos Multingua</button>
<div ui-tree-nodes="" ng-model="s.perfil" ng-show="s.perfil.length > 0">
<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">
</div>
</div>
<div ng-show="s.unidade.length > 0" class="table-responsive">
<table class="table clearfix">
<thead>
<tr>
<td></td>
<td></td>
<th ng-show="confView.SIGES">SIGES</th>
<th ng-show="confView.Nome">Nome</th>
<th ng-show="confView.ECTS">ECTS</th>
<th ng-show="confView.Total">Total</th>
<th ng-show="confView.T">T</th>
<th ng-show="confView.TP">TP</th>
<th ng-show="confView.P">P</th>
<th ng-show="confView.PL">PL</th>
<th ng-show="confView.PD">PD</th>
<th ng-show="confView.OT">OT</th>
<th ng-show="confView.E">E</th>
<th ng-show="confView.S">S</th>
<th ng-show="confView.TC">TC</th>
<th ng-show="confView.O">O</th>
<th ng-show="confView.URL_UNIDADE">URL UNIDADE</th>
<th ng-show="confView.FICHA_URL">FICHA URL</th>
</tr>
</thead>
<tbody ui-tree-nodes="" ng-model="s.unidade">
<!-- UNIDADE TEMPLATE START-->
<tr ng-repeat="u in s.unidade" ui-tree-node ng-include="'unidade_renderer.html'" ng-init="u.type='unidade';parent=s">
</tr>
<!--UNIDADE TEMPLATE END-->
</tbody>
</table>
</div>
</div>
</script>
<!-- PERFIL TEMPLATE START -->
<script type="text/ng-template" id="perfil_renderer.html">
<div class="panel-heading">
<div class="form-group">
<div class="col-sm-1">
<button type="button" class="btn btn-danger" ng-click="removePerfil(parent,$index)">
<span class="glyphicon glyphicon-remove"> </span>
</button>
</div>
<div class="col-sm-3" ui-tree-handle>
<span class="btn btn-info"><i class="glyphicon glyphicon-resize-vertical"></i></span> Perfil
</div>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="p.nome">
</div>
<div class="col-sm-3">
<button type="button" class="btn btn-success pull-right" ng-click="addUnidade(p)">
<span class="glyphicon glyphicon-plus"> </span> Unidade
</button>
</div>
</div>
</div>
<div class="panel-body clearfix table-responsive">
<table class="table">
<thead>
<tr>
<td></td>
<td></td>
<th ng-show="confView.SIGES">SIGES</th>
<th ng-show="confView.Nome">Nome</th>
<th ng-show="confView.ECTS">ECTS</th>
<th ng-show="confView.Total">Total</th>
<th ng-show="confView.T">T</th>
<th ng-show="confView.TP">TP</th>
<th ng-show="confView.P">P</th>
<th ng-show="confView.PL">PL</th>
<th ng-show="confView.PD">PD</th>
<th ng-show="confView.OT">OT</th>
<th ng-show="confView.E">E</th>
<th ng-show="confView.S">S</th>
<th ng-show="confView.TC">TC</th>
<th ng-show="confView.O">O</th>
<th ng-show="confView.URL_UNIDADE">URL UNIDADE</th>
<th ng-show="confView.FICHA_URL">FICHA URL</th>
</tr>
</thead>
<tbody ui-tree-nodes="" ng-model="p.unidade">
<!-- UNIDADE TEMPLATE START-->
<tr ng-repeat="u in p.unidade" ui-tree-node ng-include="'unidade_renderer.html'" ng-init="u.type='unidade';parent=p">
</tr>
<!--UNIDADE TEMPLATE END-->
</tbody>
</table>
</div>
</script>
<script type="text/ng-template" id="unidade_renderer.html">
<td class="text-nowrap">
<span class="btn btn-info"><i class="glyphicon glyphicon-resize-vertical" ui-tree-handle></i></span>
</td>
<td>
<button type="button" class="btn btn-danger" ng-click="removeUnidade(parent,$index)">
<span class="glyphicon glyphicon-remove"> </span>
</button>
</td>
<td ng-show="confView.SIGES">
<%--
FOCUS FIND UNIT
<script>
$(document).ready(
function()
{
$("#siges${dummyIndexIdUnidades}").focusout(
function(){
var code = $("#siges${dummyIndexIdUnidades}").val();
$.getJSON("<%=request.getContextPath()%>/user/courses/courseApiJson.jsp",
{ service:"findCourseUnit",
siges: code,
courseSigesCode: "${course.code}"
},
function(data)
{
if(data.response == "ok")
{
$("#nome${dummyIndexIdUnidades}").val(data.courseUnitName);
$("#sigesResponse${dummyIndexIdUnidades}").html("");
}
else
{
$("#sigesResponse${dummyIndexIdUnidades}").html("Não encontrado");
}
}
);
}
);
}
);
</script>--%>
<input type="text" ng-model="u.siges" style="width: 60px"/>
<%--<div id="sigesResponse${dummyIndexIdUnidades}"></div>--%>
</td>
<td ng-show="confView.Nome">
<div>
<div class="col-sm-11"><input type="text" style="width:200px" ng-model="u.nome"/></div>
<div class="langs collapse" >
<div class="col-sm-1">(EN)</div>
<div class="col-sm-11"><input type="text" style="width:200px" ng-model="u.nomeEn"/></div>
<div class="col-sm-1">(ES)</div>
<div class="col-sm-11"><input type="text" style="width:200px" ng-model="u.nomeEs"/></div>
<div class="col-sm-1">(FR)</div>
<div class="col-sm-11"><input type="text" style="width:200px" ng-model="u.nomeFr"/></div>
</div>
</div>
</td>
<td ng-show="confView.ECTS"><input type="text" style="width: 40px" ng-model="u.eCTS"/></td>
<td ng-show="confView.Total"><input type="text" style="width: 40px" ng-model="u.totalHoras"></td>
<td ng-show="confView.T"><input type="text" style="width: 40px" ng-model="u.horasContacto.t"/></td>
<td ng-show="confView.TP"><input type="text" style="width: 40px" ng-model="u.horasContacto.tP"/></td>
<td ng-show="confView.P"><input type="text" style="width: 40px" ng-model="u.horasContacto.p"/></td>
<td ng-show="confView.PL"><input type="text" style="width: 40px" ng-model="u.horasContacto.pL"/></td>
<td ng-show="confView.PD"><input type="text" style="width: 40px" ng-model="u.horasContacto.pD"/></td>
<td ng-show="confView.OT"><input type="text" style="width: 40px" ng-model="u.horasContacto.oT"/></td>
<td ng-show="confView.E"><input type="text" style="width: 40px" ng-model="u.horasContacto.e"/></td>
<td ng-show="confView.S"><input type="text" style="width: 40px" ng-model="u.horasContacto.s"/></td>
<td ng-show="confView.TC"><input type="text" style="width: 40px" ng-model="u.horasContacto.tC"/></td>
<td ng-show="confView.O"><input type="text" style="width: 40px" ng-model="u.horasContacto.o"/></td>
<td ng-show="confView.URL_UNIDADE"><input type="text" ng-model="u.urlUnidadeCurricular" style="width:600px"/></td>
<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}}">
<input type="text" id="urlFichaCurricular{{s.id}}_{{u.siges}}" ng-model="u.urlFichaCurricular" style="width:600px"/>
</td>
</script>
<pre class="code">
{{json | json}}
</pre>
<a type="button" class="btn btn-danger" href="<%=request.getContextPath()%>/user/adminStudyPlans.do?courseId=${courseId}">Cancelar</a>
<button type="button" class="btn btn-success" ng-click="salvar()">Salvar</button>
</div>
</div>
</div>
</html:form>
</div>
</div>
<%
AbstractDao.getCurrentSession().getTransaction().commit();
%>