1,7 → 1,9 |
<%@ page import="jomm.dao.impl.AbstractDao" %> |
<%@ page import="pt.estgp.estgweb.domain.Configuration" %> |
<%@ page import="pt.estgp.estgweb.domain.Course" %> |
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
<%@ page import="pt.estgp.estgweb.web.form.configuration.ConfigurationsForm" %> |
<%@ page import="pt.estgp.estgweb.utils.DatesUtils" %> |
<%@ page import="java.util.List" %> |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
9,7 → 11,7 |
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
|
<baco:isAdmin> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<jomm:messages/> |
<html:errors/> |
22,19 → 24,318 |
|
%> |
|
<html:form action="/admin/setConfigurations"> |
<jsp:useBean id="ConfigurationsForm" type="pt.estgp.estgweb.web.form.configuration.ConfigurationsForm" scope="request"/> |
<% |
ConfigurationsForm.setConfiguration(configuration); |
%> |
Ano de Interface : <html:text property="configuration.interfaceImportYear"/> |
Cursos Ficticios : <html:text property="configuration.cursosFicticios"/> |
Ano em Avaliação : <html:text property="configuration.courseUnitEvaluationActiveYear"/> |
Tipos de Cursos em Avaliação : <html:text property="configuration.courseUnitEvaluationActiveDegrees"/> |
Cursos Ativos para Avaliação : <html:text property="configuration.courseUnitEvaluationActiveCourseIds"/> |
Informação de Abertura da Intranet : <html:textarea property="configuration.openInfoIntranet"/> |
</html:form> |
<div class="panel panel-default"> |
<div class="panel-heading">Configurações Gerais do Sistema</div> |
<div class="panel-body"> |
<html:form styleClass="form-horizontal" action="/admin/setConfigurations"> |
<input type="hidden" name="dispatch" value="saveConfigsGerais"/> |
<jsp:useBean id="ConfigurationsForm" type="pt.estgp.estgweb.web.form.configuration.ConfigurationsForm" scope="request"/> |
<% |
ConfigurationsForm.setConfiguration(configuration); |
%> |
|
<div class="form-group"> |
<label class="control-label col-sm-2">Ano de Interface</label> |
<div class="col-sm-10"> |
<% |
List<String> years = DatesUtils.getImportYears(10); |
%> |
<html:select styleClass="form-control" property="configuration.interfaceImportYear"> |
<% |
for(String year:years) |
{ |
request.setAttribute("year",year); |
%> |
<html:option value="${year}">${year}</html:option> |
<% |
} |
%> |
</html:select> |
</div> |
</div> |
|
<div class="form-group"> |
<label class="control-label col-sm-2">Cursos Ficticios (separados por virgulas)</label> |
<div class="col-sm-10"> |
<html:text styleClass="form-control" property="configuration.cursosFicticios"/> |
</div> |
</div> |
|
|
<div class="form-group"> |
<label class="control-label col-sm-2">Informação de Abertura da Intranet</label> |
<div class="col-sm-10"> |
<html:textarea styleClass="form-control" rows="5" property="configuration.openInfoIntranet"/> |
</div> |
</div> |
|
|
<div class="panel panel-default"> |
<div class="panel-heading">Relatórios de Avaliação das Unidades Curriculares</div> |
<div class="panel-body"> |
<div class="form-group"> |
<label class="control-label col-sm-2">Ano aberto para relatórios de avaliação</label> |
<div class="col-sm-10"> |
<html:select styleClass="form-control" property="configuration.courseUnitEvaluationActiveYear"> |
<% |
for(String year:years) |
{ |
request.setAttribute("year",year); |
%> |
<html:option value="${year}">${year}</html:option> |
<% |
} |
%> |
</html:select> |
</div> |
</div> |
<div class="form-group"> |
<label class="control-label col-sm-2">Tipos de Cursos em Avaliação</label> |
<div class="col-sm-4"> |
<html:hidden styleId="degree" property="configuration.courseUnitEvaluationActiveDegrees" /> |
<div class="list-group" id="degreesListGroup"> |
|
</div> |
<script> |
var degrees = '${ConfigurationsForm.configuration.courseUnitEvaluationActiveDegrees}'; |
jsonObjDegrees = []; |
if(degrees.length > 0) |
{ |
var degreesArray = degrees.split(","); |
for(i=0;i< degreesArray.length;i++) |
{ |
item = {} |
item ["degree"] = degreesArray[i]; |
jsonObjDegrees.push(item); |
} |
} |
function persistDegrees(){ |
var finalDegrees = ""; |
$("#degreesListGroup").html(""); |
jsonObjDegrees.forEach( |
function(obj) { |
if(finalDegrees == "") |
finalDegrees+= obj.degree; |
else |
finalDegrees+= "," + obj.degree; |
|
|
var elementNew = $("<div class=\"list-group-item\">" + |
$('#degreeCombo option[value="' + obj.degree + '"]').html() + |
"</div>"); |
$("#degreesListGroup").append(elementNew); |
var removeBtn = $('<button class="btn btn-xs btn-danger pull-right" type="button"><span class="glyphicon glyphicon-remove"/></button>'); |
elementNew.append(removeBtn); |
removeBtn.click( |
function(){ |
var found = false; |
for(var degree in jsonObjDegrees) |
{ |
if(jsonObjDegrees[degree].degree == obj.degree) |
{ |
jsonObjDegrees.splice(degree, 1); |
break; |
} |
} |
persistDegrees(); |
} |
); |
} |
); |
$("#degree").val(finalDegrees); |
|
} |
$(document).ready( |
function(){ |
persistDegrees(); |
$("#addDegreeBtn").click( |
function() |
{ |
var found = false; |
for(var degree in jsonObjDegrees) |
{ |
if(jsonObjDegrees[degree].degree == $("#degreeCombo").val()) |
{ |
found = true; |
} |
} |
if(!found) |
{ |
item = {} |
item ["degree"] = $("#degreeCombo").val(); |
jsonObjDegrees.push(item); |
persistDegrees(); |
} |
} |
); |
$("#removeDegreeBtn").click( |
function() |
{ |
var found = false; |
for(var degree in jsonObjDegrees) |
{ |
if(jsonObjDegrees[degree].degree == $("#degreeCombo").val()) |
{ |
jsonObjDegrees.splice(degree, 1); |
break; |
} |
} |
persistDegrees(); |
} |
); |
|
} |
); |
</script> |
</div> |
<div class="col-sm-3"> |
<select class="form-control" id="degreeCombo"> |
<option value="B"><bean:message key="course.B"/> (B)</option> |
<option value="L"><bean:message key="course.L"/> (L)</option> |
<option value="M"><bean:message key="course.M"/> (M)</option> |
<option value="P"><bean:message key="course.P"/> (P)</option> |
<option value="E"><bean:message key="course.E"/> (E)</option> |
<option value="A"><bean:message key="course.A"/> (A)</option> |
<option value="C"><bean:message key="course.C"/> (C)</option> |
<option value="O"><bean:message key="course.O"/> (O)</option> |
<option value="T"><bean:message key="course.T"/> (T)</option> |
</select> |
</div> |
<div class="col-sm-3"> |
<button class="btn btn-small btn-success" type="button" id="addDegreeBtn"><span class="glyphicon glyphicon-plus"/></button> |
<button class="btn btn-small btn-danger" type="button" id="removeDegreeBtn"><span class="glyphicon glyphicon-remove"/></button> |
</div> |
</div> |
|
|
<div class="form-group"> |
<label class="control-label col-sm-2">Cursos Ativos para Avaliação</label> |
<div class="col-sm-4"> |
<html:hidden styleId="course" property="configuration.courseUnitEvaluationActiveCourseIds" /> |
<div class="list-group" id="coursesListGroup"> |
|
</div> |
<script> |
var courses = '${ConfigurationsForm.configuration.courseUnitEvaluationActiveCourseIds}'; |
|
jsonObjCourses = []; |
if(courses.length > 0) |
{ |
var coursesArray = courses.split(";"); |
for(i=0;i< coursesArray.length;i++) |
{ |
item = {} |
item ["courseId"] = coursesArray[i]; |
jsonObjCourses.push(item); |
} |
} |
|
function persistCourses(){ |
var finalCourses = ""; |
$("#coursesListGroup").html(""); |
jsonObjCourses.forEach( |
function(obj) { |
if(finalCourses == "") |
finalCourses+= obj.courseId; |
else |
finalCourses+= ";" + obj.courseId; |
var elementNew = $( "<div class=\"list-group-item\">" + |
$('#coursesCombo option[value="' + obj.courseId + '"]').html() + |
"</div>"); |
$("#coursesListGroup").append(elementNew); |
var removeBtn = $('<button class="btn btn-xs btn-danger pull-right" type="button"><span class="glyphicon glyphicon-remove"/></button>'); |
elementNew.append(removeBtn); |
removeBtn.click( |
function(){ |
var found = false; |
for(var course in jsonObjCourses) |
{ |
if(jsonObjCourses[course].courseId == obj.courseId) |
{ |
jsonObjCourses.splice(course, 1); |
break; |
} |
} |
persistCourses(); |
} |
); |
|
} |
); |
$("#course").val(finalCourses); |
|
} |
$(document).ready( |
function(){ |
persistCourses(); |
$("#addCourseBtn").click( |
function() |
{ |
var found = false; |
for(var course in jsonObjCourses) |
{ |
if(jsonObjCourses[course].courseId == $("#coursesCombo").val()) |
{ |
found = true; |
} |
} |
if(!found) |
{ |
item = {} |
item ["courseId"] = $("#coursesCombo").val(); |
jsonObjCourses.push(item); |
persistCourses(); |
} |
} |
); |
$("#removeCourseBtn").click( |
function() |
{ |
var found = false; |
for(var course in jsonObjCourses) |
{ |
if(jsonObjCourses[course].courseId == $("#coursesCombo").val()) |
{ |
jsonObjCourses.splice(course, 1); |
break; |
} |
} |
persistCourses(); |
} |
); |
|
} |
); |
</script> |
</div> |
<div class="col-sm-3"> |
<select class="form-control" id="coursesCombo"> |
<% |
List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(); |
request.setAttribute("Courses",courses); |
%> |
<logic:iterate id="course" name="Courses" type="pt.estgp.estgweb.domain.Course"> |
<option value="${course.id}">${course.name} (${course.code})</option> |
</logic:iterate> |
</select> |
</div> |
<div class="col-sm-3"> |
<button class="btn btn-small btn-success" type="button" id="addCourseBtn"><span class="glyphicon glyphicon-plus"/></button> |
<button class="btn btn-small btn-danger" type="button" id="removeCourseBtn"><span class="glyphicon glyphicon-remove"/></button> |
</div> |
</div> |
</div> |
</div> |
|
|
|
<button type="button" class="btn btn-success" onclick="set(form,'saveConfigsGerais');form.submit()"><bean:message key="confirm"/></button> |
</html:form> |
</div> |
</div> |
|
|
<% |
AbstractDao.getCurrentSession().getTransaction().commit(); |
%> |
%> |
</baco:isAdmin> |