/branches/grupo10/impl/src/web/user/courses/coursereport/templates.jsp |
---|
691,4 → 691,76 |
</div> |
</div> |
</div> |
</script> |
<!-- Johny --> |
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_GlobalLearningResultsChartYearImg"> |
<globallearningresultschartyearimg> |
</globallearningresultschartyearimg> |
</script> |
<script> |
angular.module("courseReportApp").directive('globallearningresultschartyearimg', function() { |
return { |
restrict: 'E', |
link: function($scope, element, attrs) |
{ |
$scope.generateChart = function(comp) |
{ |
widgetCallWithActionParameters( |
"<%=request.getContextPath()%>/user/courseReport.do", |
"generateGlobalLearningResultsChartYearImg", |
{ |
"courseReportDocument" : BacoJS.stringifyOrdered(angular.element($("#courseReportApp")).scope().report) |
}, |
"#courseReportApp", |
function(repositoryFile4JsonView) |
{ |
comp.image = repositoryFile4JsonView; |
comp.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + comp.image.identifier + "?" + new Date().getTime(); |
angular.element($("#courseReportApp")).scope().$apply(); |
}, |
function(){} |
); |
} |
}, |
templateUrl: function(elem,attrs) { |
return "globallearningresultschartyearimg"; |
} |
} |
}); |
</script> |
<script type="text/ng-template" id="globallearningresultschartyearimg"> |
<div class="imageComponent component"> |
<div class="componentBody"> |
<div class="form-group clearfix"> |
<label class="col-md-2 control-label">Legenda</label> |
<div class="col-md-10"> |
<input type="text" class="form-control" rows="10" ng-model="comp.title"> |
</div> |
</div> |
<div class="form-group clearfix"> |
<div class="col-md-2 control-label"> |
<button class="btn btn-default" ng-click="generateChart(comp)">Refrescar/Gerar Gráfico</button> |
</div> |
<div class="col-md-10"> |
<label ng-if="comp.image.identifier"> Limites do PDF </label> |
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px"> |
<center> |
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)"> |
<img ng-if="comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}"> |
<img ng-if="!comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{'<%=request.getContextPath()%>/repositoryStream/' + comp.image.identifier}}"> |
</div> |
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito) |
</center> |
</div> |
</div> |
</div> |
</div> |
</div> |
</script> |
/branches/grupo10/impl/src/web/user/courses/courseReportEdit.jsp |
---|
1,349 → 1,13 |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<%@ page import="jomm.dao.impl.AbstractDao" %> |
<%@ page import="pt.estgp.estgweb.domain.CourseImpl" %> |
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %> |
<%@ page import="pt.estgp.estgweb.utils.documentBuilder.TextComponent" %> |
<%@ page import="pt.estgp.estgweb.utils.documentBuilder.ImageComponent" %> |
<%@ page import="pt.estgp.estgweb.services.courses.CourseReportServices" %> |
<%@ page import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.CourseReportDocument" %> |
<%@ page import="org.json.JSONException" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
<%@taglib prefix="t" tagdir="/WEB-INF/tags" %> |
<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %> |
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/jquery-ui-1.12.1/jquery-ui.css"> |
<script src="<%=request.getContextPath()%>/js/jquery-ui-1.12.1/jquery-ui.min.js"></script> |
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/flora-commons/flora.resizable.css"> |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js"></script> |
<script> |
function demoFromHTML() { |
var pdf = new jsPDF('p', 'pt', 'letter'); |
// source can be HTML-formatted string, or a reference |
// to an actual DOM element from which the text will be scraped. |
source = $('#courseReportApp')[0]; |
<!--*************************************--> |
// we support special element handlers. Register them with jQuery-style |
// ID selector for either ID or node name. ("#iAmID", "div", "span" etc.) |
// There is no support for any other type of selectors |
// (class, of compound) at this time. |
specialElementHandlers = { |
// element with id of "bypass" - jQuery style selector |
'#bypassme': function (element, renderer) { |
// true = "handled elsewhere, bypass text extraction" |
return true |
} |
}; |
margins = { |
top: 80, |
bottom: 60, |
left: 40, |
width: 522 |
}; |
// all coords and widths are in jsPDF instance's declared units |
// 'inches' in this case |
pdf.fromHTML( |
source, // HTML string or DOM elem ref. |
margins.left, // x coord |
margins.top, { // y coord |
'width': margins.width, // max width of content on PDF |
'elementHandlers': specialElementHandlers |
}, |
function (dispose) { |
// dispose: object with X, Y of the last line add to the PDF |
// this allow the insertion of new lines after html |
//var pdfDocument = pdf.save('Test.pdf'); |
var pdfDocument = pdf.output(); |
var boundary = '---------------------------'; |
boundary += Math.floor(Math.random()*32768); |
boundary += Math.floor(Math.random()*32768); |
boundary += Math.floor(Math.random()*32768); |
var body = ''; |
body += '--' + boundary + '\r\n' + |
'Content-Disposition: form-data; name="filesInputId-UPLOAD[]"; filename="20170530_210340.pdf"' + '\r\n'; |
body += 'Content-Type: application/pdf'; |
body += '\r\n\r\n'; |
body += pdfDocument; |
body += '\r\n' |
body += '--' + boundary + '--'; |
$.ajax({ |
type: "POST", |
cache: false, |
url: "<%=request.getContextPath()%>/filesUpload", |
data: body , |
processData: false, |
contentType : 'multipart/form-data; boundary=' + boundary, |
success: function (data) { |
alert('success'); |
return false; |
} |
}); |
}, margins |
); |
} |
</script> |
<% |
String courseCode = request.getParameter("courseCode"); |
String year = request.getParameter("year"); |
AbstractDao.getCurrentSession().beginTransaction(); |
CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseCode); |
request.setAttribute("course",courseImpl); |
CourseReportDocument courseReport = null; |
try { |
courseReport = new CourseReportServices().createNewCourseReportDocument(courseCode, year); |
} catch (Throwable e) { |
System.out.println(e); |
e.printStackTrace(); |
} |
String courseReportJson = courseReport.toJson(); |
request.setAttribute("courseDocumentJson",courseReportJson); |
request.setAttribute("courseDocument",courseReport); |
%> |
<%--<a href="javascript:demoFromHTML()" class="button">Run Code</a>--%> |
<div class="container-fluid"> |
<style> |
.separatorSection |
{ |
border: 1px solid #ddd; |
} |
</style> |
<!-- Apresentacao da Unidade --> |
<div class="panel panel-default"> |
<div class="panel-heading"> |
Relatório Anual do curso: ${course.name} |
</div> |
<div class="panel-body"> |
<p><b class="label-info">Tipo de Curso:</b> <bean:message key="course.${course.degree}"/></p> |
<p><b class="label-info">Ano Lectivo:</b> ${course.importYear}</p> |
<p><b class="label-info">Departamento:</b> ${course.department.name}</p> |
<p><b class="label-info">Escola:</b> ${course.department.courseSchool.name}</p> |
<script> |
//Especifico da aplicacao |
var courseReportApp = angular.module('courseReportApp', ['ui.tree']); |
GLOBAL_BacoAngularAppDependencies.push('courseReportApp'); |
courseReportApp.directive('resizable', function () { |
return { |
restrict: 'A', |
scope: { |
callback: '&onResize' |
}, |
link: function postLink(scope, elem, attrs) { |
elem.resizable(); |
elem.on('resize', function (evt, ui, comp) { |
scope.$apply(function() { |
if (scope.callback) { |
scope.callback({$evt: evt, $ui: ui, $comp: comp }); |
} |
}) |
}); |
} |
}; |
}); |
courseReportApp.controller('courseReportAppController', function($scope) |
{ |
$scope.docAppSelector = "#courseReportApp"; |
$scope.report = <%=courseReportJson%> |
$scope.resize = function(evt,ui,comp) { |
//console.log (evt,ui); |
comp.width = ui.size.width; |
comp.height = ui.size.height; |
} |
/** |
* @classe class to match |
* @superClasses array of strings |
* */ |
$scope.contains = function(obj,classe) |
{ |
if(obj['@class'] && obj['@class'] == classe) |
return true; |
if(obj.allSuperClasses) |
{ |
for(var i in obj.allSuperClasses) |
{ |
if(classe == obj.allSuperClasses[i]) |
return true; |
} |
} |
return false; |
} |
$scope.showSep = function(section,subSection) |
{ |
var s; |
for(s in section.sections) |
{ |
section.sections[s].active = false; |
} |
/*$(".separatorSectionNav").each(function() |
{ |
angular.element($(this)).scope().section.active = false; |
});*/ |
subSection.active = true; |
} |
/** |
* Este metodo devolve o template mais profundo na hierarquia de classes |
* permitindo emular o override, quanto mais especifica for a classe |
* e caso exista template é esse o template devolvido |
* procura um script com o id da classe e se nao existir |
* vai subindo nas super classes |
* @param obj |
* @returns {*} |
*/ |
$scope.class2id = function(obj) |
{ |
var objClassId = obj["@class"].replaceAll(".","_"); |
if($("script#" + objClassId).length > 0) |
{ |
return objClassId; |
} |
if(obj.allSuperClasses) |
{ |
var s; |
for(s in obj.allSuperClasses) |
{ |
var superClass = obj.allSuperClasses[s]; |
var superClassId = superClass.replaceAll(".","_"); |
if($("script#" + superClassId).length > 0) |
{ |
return superClassId; |
} |
} |
} |
return obj["@class"].replaceAll(".","_"); |
} |
$scope.addText = function(parentCustomPane) |
{ |
$scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.TextComponent") |
} |
$scope.addImage = function(parentCustomPane) |
{ |
$scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.ImageComponent") |
} |
$scope.addSimpleDocComponent = function(parentCustomPane,classComponent) |
{ |
if(!parentCustomPane.components) |
{ |
parentCustomPane.components = []; |
} |
parentCustomPane.components.push( |
{ |
"@class" : classComponent |
} |
); |
} |
$scope.removeComponent = function(index,array) |
{ |
array.splice(index,1); |
} |
$scope.callbackUploadedFiles = function(filesUploadResult,token,targetElement) |
{ |
var modelObject = BacoAngularUtils.getAngularElementModel(targetElement); |
if(modelObject.image && modelObject.image.identifier) |
{ |
widgetCallWithActionParameters( |
"<%=request.getContextPath()%>/user/json/repository.do", |
"replaceRepositoryFileFromTempPrivateDomain", |
{ |
"identifier" : modelObject.image.identifier, |
"fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
}, |
"#courseReportApp", |
function(repositoryFile4JsonView) |
{ |
modelObject.image = repositoryFile4JsonView; |
//image URL is generated on reimport just to avoid caching |
modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
angular.element($("#courseReportApp")).scope().$apply(); |
}, |
function(){} |
); |
} |
else |
{ |
widgetCallWithActionParameters( |
"<%=request.getContextPath()%>/user/json/repository.do", |
"saveRepositoryFileFromTempPrivateDomain", |
{ |
"fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
}, |
"#courseReportApp", |
function(repositoryFile4JsonView) |
{ |
modelObject.image = repositoryFile4JsonView; |
modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
angular.element($("#courseReportApp")).scope().$apply(); |
}, |
function(){} |
); |
} |
} |
}); |
</script> |
<!--TEMPLATES FOR DOCUMENT BUILDER--> |
<jsp:include page="../utils/documentsBuilder.jsp"/> |
<jsp:include page="coursereport/templates.jsp"/> |
<div class="form-vertical"> |
<div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController"> |
<div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'"> |
</div> |
<!-- <pre class="code">{{ report | json }}</pre>--> |
</div><!--App--> |
</div> <!--form--> |
</div><!--Panel Body--> |
</div><!--Panel--> |
</div><!--container-fluid--> |
<% |
AbstractDao.getCurrentSession().getTransaction().commit(); |
%> |
<jsp:include page="../utils/reportEdit.jsp"/> |
<jsp:include page="coursereport/templates.jsp"/> |
/branches/grupo10/impl/src/web/user/home/teacher.jsp |
---|
21,188 → 21,204 |
<%--<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/offcanvas.css"/>--%> |
<logic:notMatch value="TeacherImpl" name="UserSession" property="user.class.name"> |
<div class="alert alert-warning"> |
<bean:message key="profile.bad.profile.teacher.iregular.user.class"/> |
</div> |
</logic:notMatch> |
<logic:notMatch value="TeacherImpl" name="UserSession" property="user.class.name"> |
<div class="alert alert-warning"> |
<bean:message key="profile.bad.profile.teacher.iregular.user.class"/> |
</div> |
</logic:notMatch> |
<jsp:include page="todosAfazer.jsp"/> |
<jsp:include page="todosAfazer.jsp"/> |
<div class="row"> |
<div class="col-md-6 col-sm-12 col-xs-12" style="padding-right: 6px"> |
<div class="row"> |
<div class="col-md-6 col-sm-12 col-xs-12" style="padding-right: 6px"> |
<baco:isModuleOn module="courseunits"> |
<div class="panel panel-primary"> |
<div class="panel-heading"><bean:message key="intranet.home.curricular"/></div> |
<div class="panel-body"> |
<!--<p><bean:message key="intranet.home.curricular"/></p>--> |
<!--<ul> |
<li>--> |
<div class="list-group"> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCoursesProgramsFromHome"><bean:message key="courseunit.indexes"/></html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/courseComissions"><bean:message key="course.comissions"/></html:link> |
</div> |
<div class="list-group-item"> |
<a href="<%=request.getContextPath()%>/dir/utilsIntranet/comAvalDesemp">Avaliação de Desempenho Docente</a> |
</div> |
<baco:isModuleOn module="courseunits"> |
<div class="panel panel-primary"> |
<div class="panel-heading"><bean:message key="intranet.home.curricular"/></div> |
<div class="panel-body"> |
<!--<p><bean:message key="intranet.home.curricular"/></p>--> |
<!--<ul> |
<li>--> |
<div class="list-group"> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCoursesProgramsFromHome"><bean:message key="courseunit.indexes"/></html:link> |
</div> |
<!--</li> |
</ul>--> |
<div class="list-group-item"> |
<html:link action="/user/courseComissions"><bean:message key="course.comissions"/></html:link> |
</div> |
<div class="list-group-item"> |
<a href="<%=request.getContextPath()%>/dir/utilsIntranet/comAvalDesemp">Avaliação de Desempenho Docente</a> |
</div> |
</div> |
<!--</li> |
</ul>--> |
</div> |
</div> |
<% |
java.util.List<String> years = new java.util.ArrayList<String>(); |
String nowImportYear = DaoFactory.getConfigurationDaoImpl().getInterfaceImportYearCreateTransaction(); |
years.add(DaoFactory.getConfigurationDaoImpl().getInterfaceImportYearCreateTransaction()); |
years.add(DatesUtils.getPreviousImportYear(nowImportYear)); |
<% |
java.util.List<String> years = new java.util.ArrayList<String>(); |
String nowImportYear = DaoFactory.getConfigurationDaoImpl().getInterfaceImportYearCreateTransaction(); |
years.add(DaoFactory.getConfigurationDaoImpl().getInterfaceImportYearCreateTransaction()); |
years.add(DatesUtils.getPreviousImportYear(nowImportYear)); |
java.util.Collections.sort(years, new java.util.Comparator<String>() |
{ |
public int compare(String o1, String o2) { |
return o2.compareTo(o1); |
} |
}); |
java.util.Collections.sort(years, new java.util.Comparator<String>() |
{ |
public int compare(String o1, String o2) { |
return o2.compareTo(o1); |
} |
}); |
for(String year: years) |
{ |
for(String year: years) |
{ |
String yearFormatted = pt.estgp.estgweb.utils.DatesUtils.getImportYearFormatted(year); |
String yearFormatted = pt.estgp.estgweb.utils.DatesUtils.getImportYearFormatted(year); |
%> |
%> |
<div class="panel panel-primary"> |
<div class="panel-heading"><bean:message key="intranet.course.units"/> - <%=yearFormatted%></div> |
<div class="panel-body"> |
<div class="panel panel-primary"> |
<div class="panel-heading"><bean:message key="intranet.course.units"/> - <%=yearFormatted%></div> |
<div class="panel-body"> |
<% |
String[] semestres = new String[]{"A","S1","S2","T1","T2","T3","T4"}; |
String[] semestreLabel = new String[]{ |
MessageResources.getMessage(request,"courseunit.anuais"), |
MessageResources.getMessage(request,"courseunit.semestre") + "1", |
MessageResources.getMessage(request,"courseunit.semestre") + "2", |
MessageResources.getMessage(request,"courseunit.trimestre") + "1", |
MessageResources.getMessage(request,"courseunit.trimestre") + "2", |
MessageResources.getMessage(request,"courseunit.trimestre") + "3", |
MessageResources.getMessage(request,"courseunit.trimestre") + "4"}; |
<% |
String[] semestres = new String[]{"A","S1","S2","T1","T2","T3","T4"}; |
String[] semestreLabel = new String[]{ |
MessageResources.getMessage(request,"courseunit.anuais"), |
MessageResources.getMessage(request,"courseunit.semestre") + "1", |
MessageResources.getMessage(request,"courseunit.semestre") + "2", |
MessageResources.getMessage(request,"courseunit.trimestre") + "1", |
MessageResources.getMessage(request,"courseunit.trimestre") + "2", |
MessageResources.getMessage(request,"courseunit.trimestre") + "3", |
MessageResources.getMessage(request,"courseunit.trimestre") + "4"}; |
for(int i =0;i< semestres.length;i++) |
{ |
request.setAttribute("LABEL",semestreLabel[i]); |
%> |
for(int i =0;i< semestres.length;i++) |
{ |
request.setAttribute("LABEL",semestreLabel[i]); |
%> |
<jsp:useBean id="LABEL" scope="request" type="java.lang.String"/> |
<% |
TeacherImpl u = ((pt.estgp.estgweb.domain.TeacherImpl)UserSession.getUser()); |
List<pt.estgp.estgweb.domain.CourseUnit> cus= |
(List<CourseUnit>) |
u.getClass().getMethod("getTeachedUnitsView" + semestres[i],String.class) |
.invoke(u,year); |
request.setAttribute("units",cus); |
if(cus == null || cus.size() == 0) |
{} |
else if(cus.size() > 0) |
{ |
%> |
<jsp:useBean id="units" scope="request" type="java.util.Collection"/> |
<div class="list-group"> |
<div class="list-group-item list-group-item-heading"><bean:write name="LABEL"/></div> |
<jsp:useBean id="LABEL" scope="request" type="java.lang.String"/> |
<% |
TeacherImpl u = ((pt.estgp.estgweb.domain.TeacherImpl)UserSession.getUser()); |
List<pt.estgp.estgweb.domain.CourseUnit> cus= |
(List<CourseUnit>) |
u.getClass().getMethod("getTeachedUnitsView" + semestres[i],String.class) |
.invoke(u,year); |
request.setAttribute("units",cus); |
if(cus == null || cus.size() == 0) |
{} |
else if(cus.size() > 0) |
{ |
%> |
<jsp:useBean id="units" scope="request" type="java.util.Collection"/> |
<div class="list-group"> |
<div class="list-group-item list-group-item-heading"><bean:write name="LABEL"/></div> |
<logic:iterate id="unit" name="units" type="pt.estgp.estgweb.domain.CourseUnit"> |
<div class="list-group-item"> |
<div class="row"> |
<div class="col-sm-10"><html:link action="/user/startLoadCourseUnitFromHome?id=${unit.id}">${unit.name} (${unit.courseName} (${unit.courseCode}) ${unit.cdTurma}</html:link></div> |
<div class="col-sm-2"><html:link action="/user/startLoadCourseUnitRootFromHome?courseUnitView.id=${unit.id}"> <span style="padding:5px" class="glyphicon glyphicon-folder-open"></span> </html:link></div> |
</div> |
</div> |
</logic:iterate> |
<logic:iterate id="unit" name="units" type="pt.estgp.estgweb.domain.CourseUnit"> |
<div class="list-group-item"> |
<div class="row"> |
<div class="col-sm-10"><html:link action="/user/startLoadCourseUnitFromHome?id=${unit.id}">${unit.name} (${unit.courseName} (${unit.courseCode}) ${unit.cdTurma}</html:link></div> |
<div class="col-sm-2"><html:link action="/user/startLoadCourseUnitRootFromHome?courseUnitView.id=${unit.id}"> <span style="padding:5px" class="glyphicon glyphicon-folder-open"></span> </html:link></div> |
</div> |
</div> |
<% |
} |
} |
</logic:iterate> |
</div> |
<% |
} |
} |
%> |
%> |
</div> |
</div> |
<% |
} |
%> |
</div> |
<% |
} |
%> |
</baco:isModuleOn> |
<%-- |
<baco:isModuleOn module="todos"> |
<jsp:include page="/user/home/todos.jsp"/> |
</baco:isModuleOn>--%> |
<baco:isModuleOn module="courseunits"> |
<jsp:include page="/user/home/courseUnitsAnnouncements.jsp"/> |
</baco:isModuleOn> |
</baco:isModuleOn> |
<%-- |
<baco:isModuleOn module="todos"> |
<jsp:include page="/user/home/todos.jsp"/> |
</baco:isModuleOn>--%> |
<baco:isModuleOn module="courseunits"> |
<jsp:include page="/user/home/courseUnitsAnnouncements.jsp"/> |
</baco:isModuleOn> |
</div> |
<div class="col-md-6 col-sm-12 col-xs-12" style="padding-left: 6px"> |
</div> |
<div class="col-md-6 col-sm-12 col-xs-12" style="padding-left: 6px"> |
<% |
AbstractDao.getCurrentSession().beginTransaction(); |
TeacherImpl tLoggedIn = (TeacherImpl) DaoFactory.getTeacherDaoImpl().get(UserSession.getUser().getId()); |
boolean hasCommisionsOrCoordinations = tLoggedIn.hasCoordinationsOrBelongToCourseCommissions(); |
AbstractDao.getCurrentSession().getTransaction().commit(); |
if( hasCommisionsOrCoordinations ) |
{ |
%> |
<div class="panel panel-primary"> |
<div class="panel-heading">As minhas Comissões de Curso</div> |
<div class="panel-body"> |
<% |
AbstractDao.getCurrentSession().beginTransaction(); |
TeacherImpl tLoggedIn = (TeacherImpl) DaoFactory.getTeacherDaoImpl().get(UserSession.getUser().getId()); |
boolean hasCommisionsOrCoordinations = tLoggedIn.hasCoordinationsOrBelongToCourseCommissions(); |
request.setAttribute("tLoggedIn", tLoggedIn); |
AbstractDao.getCurrentSession().getTransaction().commit(); |
<div class="list-group"> |
<div class="list-group-item"> |
if( hasCommisionsOrCoordinations ) |
{ |
%> |
<div class="panel panel-primary"> |
<div class="panel-heading">As minhas Comissões de Curso</div> |
<div class="panel-body"> |
<div class="list-group"> |
<!-- Req 6 --> |
<logic:iterate id="course" name="tLoggedIn" property="coordinatorCourses" type="pt.estgp.estgweb.domain.Course"> |
<div class="list-group-item"> |
<html:link action="/user/editCourseReport.do?courseCode=${course.code}&year=${UserSession.nowConfiguration.interfaceImportYear}">Editar o relatório de Curso do ano </html:link> |
</div> |
</logic:iterate> |
<!--*****************--> |
<div class="list-group-item"> |
<html:link action="/user/startSubmitMessageCourseComission"> |
Enviar email aos alunos |
</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCourseCourseUnitsStatistics?importYear=${UserSession.nowConfiguration.interfaceImportYear}">Consultar estatisticas das Unidades Curriculares (${UserSession.nowConfiguration.interfaceImportYear})</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCourseCourseUnitsStatistics?importYear=${UserSession.nowConfiguration.previousInterfaceImportYear}">Consultar estatisticas das Unidades Curriculares (${UserSession.nowConfiguration.previousInterfaceImportYear})</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/listStudentsCourseComission"> |
Consultar Alunos |
</html:link> |
</div> |
<!--<div class="list-group-item"> |
<html:link action="/user/startSubmitMessageCourseComission"> |
Enviar email aos alunos |
</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCourseCourseUnitsStatistics?importYear=${UserSession.nowConfiguration.interfaceImportYear}">Consultar estatisticas das Unidades Curriculares (${UserSession.nowConfiguration.interfaceImportYear})</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCourseCourseUnitsStatistics?importYear=${UserSession.nowConfiguration.previousInterfaceImportYear}">Consultar estatisticas das Unidades Curriculares (${UserSession.nowConfiguration.previousInterfaceImportYear})</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/listStudentsCourseComission"> |
Consultar Alunos |
</html:link> |
</div> |
<!--<div class="list-group-item"> |
<html:link action="/user/startSubmitMessageCourseComission"> |
Consultar Docentes |
</html:link> |
</div>--> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCoursesProgramsFromHome?importYear=${UserSession.nowConfiguration.interfaceImportYear}&forUser=courseCommission">Atalho para as validações (${UserSession.nowConfiguration.interfaceImportYear})</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCoursesProgramsFromHome?importYear=${UserSession.nowConfiguration.previousInterfaceImportYear}&forUser=courseCommission">Atalho para as validações (${UserSession.nowConfiguration.previousInterfaceImportYear})</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCoursesProgramsFromHome?importYear=${UserSession.nowConfiguration.interfaceImportYear}&forUser=courseCommission">Atalho para as validações (${UserSession.nowConfiguration.interfaceImportYear})</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/startLoadCoursesProgramsFromHome?importYear=${UserSession.nowConfiguration.previousInterfaceImportYear}&forUser=courseCommission">Atalho para as validações (${UserSession.nowConfiguration.previousInterfaceImportYear})</html:link> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/courseReportTools?importYear=${UserSession.nowConfiguration.previousInterfaceImportYear}">Utilitários do Relatório de Curso (${UserSession.nowConfiguration.previousInterfaceImportYear})</html:link> |
</div> |
</div> |
<!--</li> |
</ul>--> |
</div> |
<div class="list-group-item"> |
<html:link action="/user/courseReportTools?importYear=${UserSession.nowConfiguration.previousInterfaceImportYear}">Utilitários do Relatório de Curso (${UserSession.nowConfiguration.previousInterfaceImportYear})</html:link> |
</div> |
<jsp:include page="courseComission.jsp"/> |
<div class="list-group-item"> |
<!--http://localhost:8080/baco/user/editCourseReport.do?courseCode=44&year=201617 --> |
</div> |
<!--</li> |
</ul>--> |
</div> |
</div> |
<jsp:include page="courseComission.jsp"/> |
<% |
} |
257,27 → 273,27 |
%> |
<div class="list-group"> |
<div class="list-group-item list-group-item-warning"><span class="icon icon-clipboard"></span> <label class="label label-warning" style="font-size:1em"><%=activeYear%></label> Relatórios de avaliação por preencher/entregar de <%=activeYear%> |
<%--<% |
if(activeDegrees != null) |
{ |
%> |
(graus em processo de validação: |
<% |
String sep = ""; |
for(String activeDegree: activeDegrees) |
{ |
%> |
<%=sep + MessageResources.getInstance(request).getMessage("course."+activeDegree)%> |
<% |
sep = ", "; |
} |
%> |
) |
<% |
} |
%> |
--%> |
</div> |
<%--<% |
if(activeDegrees != null) |
{ |
%> |
(graus em processo de validação: |
<% |
String sep = ""; |
for(String activeDegree: activeDegrees) |
{ |
%> |
<%=sep + MessageResources.getInstance(request).getMessage("course."+activeDegree)%> |
<% |
sep = ", "; |
} |
%> |
) |
<% |
} |
%> |
--%> |
</div> |
<% |
for(CourseUnit cu: evaluations) |
307,6 → 323,7 |
</div> |
</div> |
</div> |
/branches/grupo10/impl/src/web/user/utils/reportEdit.jsp |
---|
New file |
0,0 → 1,349 |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %> |
<%-- http://localhost:8080/baco/user/editCourseReport.do?courseCode=44&year=201617 --%> |
<link rel="stylesheet" href="<%=request.getContextPath()%>/js/jquery-ui-1.12.1/jquery-ui.css"> |
<script src="<%=request.getContextPath()%>/js/jquery-ui-1.12.1/jquery-ui.min.js"></script> |
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/flora-commons/flora.resizable.css"> |
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.min.js"></script>--> |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.debug.js"></script> |
<script> |
function demoFromHTML() { |
var pdf = new jsPDF('p', 'pt', 'letter'); |
// source can be HTML-formatted string, or a reference |
// to an actual DOM element from which the text will be scraped. |
source = $('#courseReportApp')[0]; |
// we support special element handlers. Register them with jQuery-style |
// ID selector for either ID or node name. ("#iAmID", "div", "span" etc.) |
// There is no support for any other type of selectors |
// (class, of compound) at this time. |
specialElementHandlers = { |
// element with id of "bypass" - jQuery style selector |
'#bypassme': function (element, renderer) { |
// true = "handled elsewhere, bypass text extraction" |
return true |
} |
}; |
margins = { |
top: 80, |
bottom: 60, |
left: 40, |
width: 522 |
}; |
// all coords and widths are in jsPDF instance's declared units |
// 'inches' in this case |
pdf.fromHTML( |
source, // HTML string or DOM elem ref. |
margins.left, // x coord |
margins.top, { // y coord |
'width': margins.width, // max width of content on PDF |
'elementHandlers': specialElementHandlers |
}, |
function (dispose) { |
// dispose: object with X, Y of the last line add to the PDF |
// this allow the insertion of new lines after html |
var pdfDocument = pdf.save('Test.pdf'); |
/*var pdfDocument = pdf.output(); |
var boundary = '---------------------------'; |
boundary += Math.floor(Math.random()*32768); |
boundary += Math.floor(Math.random()*32768); |
boundary += Math.floor(Math.random()*32768); |
var body = ''; |
body += '--' + boundary + '\r\n' + |
'Content-Disposition: form-data; name="filesInputId-UPLOAD[]"; filename="20170530_210340.pdf"' + '\r\n'; |
body += 'Content-Type: application/pdf'; |
body += '\r\n\r\n'; |
body += pdfDocument; |
body += '\r\n' |
body += '--' + boundary + '--'; |
$.ajax({ |
type: "POST", |
cache: false, |
url: "<%=request.getContextPath()%>/filesUpload", |
data: body , |
processData: false, |
contentType : 'multipart/form-data; boundary=' + boundary, |
success: function (data) { |
alert('success'); |
return false; |
} |
});*/ |
}, margins |
); |
} |
</script> |
<script>ping()</script> |
<jsp:useBean id="courseReportJson" type="java.lang.String" scope="request"/> |
<% |
//AbstractDao.getCurrentSession().beginTransaction(); |
%> |
<%--<a href="javascript:demoFromHTML()" class="button">Run Code</a>--%> |
<div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController" class="container-fluid"> |
<style> |
.separatorSection |
{ |
border: 1px solid #ddd; |
} |
</style> |
<!-- Apresentacao da Unidade --> |
<div class="panel panel-default"> |
<div class="panel-heading"> |
Relatório Anual do curso: {{report.name}} |
</div> |
<div class="panel-body"> |
<p><b class="label-info">Tipo de Curso:</b> {{report.degree}}</p> |
<p><b class="label-info">Ano Lectivo:</b> {{report.years}}</p> |
<p><b class="label-info">Escola:</b> {{report.nomeEscola}}</p> |
<div ng-include="class2id(report)"> |
<script> |
//Especifico da aplicacao |
var courseReportApp = angular.module('courseReportApp', ['ui.tree']); |
GLOBAL_BacoAngularAppDependencies.push('courseReportApp'); |
courseReportApp.directive('resizable', function () { |
return { |
restrict: 'A', |
scope: { |
callback: '&onResize' |
}, |
link: function postLink(scope, elem, attrs) { |
elem.resizable(); |
elem.on('resize', function (evt, ui, comp) { |
scope.$apply(function() { |
if (scope.callback) { |
scope.callback({$evt: evt, $ui: ui, $comp: comp }); |
} |
}) |
}); |
} |
}; |
}); |
courseReportApp.controller('courseReportAppController', function($scope) |
{ |
$scope.docAppSelector = "#courseReportApp"; |
$scope.report = ${courseReportJson} |
$scope.resize = function(evt,ui,comp) { |
//console.log (evt,ui); |
comp.width = ui.size.width; |
comp.height = ui.size.height; |
} |
/** |
* @classe class to match |
* @superClasses array of strings |
* */ |
$scope.contains = function(obj,classe) |
{ |
if(obj['@class'] && obj['@class'] == classe) |
return true; |
if(obj.allSuperClasses) |
{ |
for(var i in obj.allSuperClasses) |
{ |
if(classe == obj.allSuperClasses[i]) |
return true; |
} |
} |
return false; |
} |
$scope.showSep = function(section,subSection) |
{ |
var s; |
for(s in section.sections) |
{ |
section.sections[s].active = false; |
} |
/*$(".separatorSectionNav").each(function() |
{ |
angular.element($(this)).scope().section.active = false; |
});*/ |
subSection.active = true; |
} |
/** |
* Este metodo devolve o template mais profundo na hierarquia de classes |
* permitindo emular o override, quanto mais especifica for a classe |
* e caso exista template é esse o template devolvido |
* procura um script com o id da classe e se nao existir |
* vai subindo nas super classes |
* @param obj |
* @returns {*} |
*/ |
$scope.class2id = function(obj) |
{ |
var objClassId = obj["@class"].replaceAll(".","_"); |
if($("script#" + objClassId).length > 0) |
{ |
return objClassId; |
} |
if(obj.allSuperClasses) |
{ |
var s; |
for(s in obj.allSuperClasses) |
{ |
var superClass = obj.allSuperClasses[s]; |
var superClassId = superClass.replaceAll(".","_"); |
if($("script#" + superClassId).length > 0) |
{ |
return superClassId; |
} |
} |
} |
return obj["@class"].replaceAll(".","_"); |
} |
$scope.addText = function(parentCustomPane) |
{ |
$scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.TextComponent") |
} |
$scope.addImage = function(parentCustomPane) |
{ |
$scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.ImageComponent") |
} |
$scope.addSimpleDocComponent = function(parentCustomPane,classComponent) |
{ |
if(!parentCustomPane.components) |
{ |
parentCustomPane.components = []; |
} |
parentCustomPane.components.push( |
{ |
"@class" : classComponent |
} |
); |
} |
$scope.removeComponent = function(index,array) |
{ |
array.splice(index,1); |
} |
$scope.callbackUploadedFiles = function(filesUploadResult,token,targetElement) |
{ |
var modelObject = BacoAngularUtils.getAngularElementModel(targetElement); |
if(modelObject.image && modelObject.image.identifier) |
{ |
widgetCallWithActionParameters( |
"<%=request.getContextPath()%>/user/json/repository.do", |
"replaceRepositoryFileFromTempPrivateDomain", |
{ |
"identifier" : modelObject.image.identifier, |
"fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
}, |
"#courseReportApp", |
function(repositoryFile4JsonView) |
{ |
modelObject.image = repositoryFile4JsonView; |
//image URL is generated on reimport just to avoid caching |
modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
angular.element($("#courseReportApp")).scope().$apply(); |
}, |
function(){} |
); |
} |
else |
{ |
widgetCallWithActionParameters( |
"<%=request.getContextPath()%>/user/json/repository.do", |
"saveRepositoryFileFromTempPrivateDomain", |
{ |
"fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0]) |
}, |
"#courseReportApp", |
function(repositoryFile4JsonView) |
{ |
modelObject.image = repositoryFile4JsonView; |
modelObject.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + modelObject.image.identifier + "?" + new Date().getTime(); |
angular.element($("#courseReportApp")).scope().$apply(); |
}, |
function(){} |
); |
} |
} |
$scope.saveCourseReportDocument = function () { |
widgetCallWithActionParameters( |
"<%=request.getContextPath()%>/user/courseReport.do", |
"saveCourseReportDocument", |
{ |
"courseReportDocument" : BacoJS.stringifyOrdered($scope.report) |
}, |
"#courseReportApp", |
function(data) |
{ |
alert(BacoJS.stringifyOrdered(data)); |
}, |
function(){} |
); |
} |
}); |
</script> |
<!--TEMPLATES FOR DOCUMENT BUILDER--> |
<jsp:include page="documentsBuilder.jsp"/> |
<div class="form-vertical"> |
<div> |
<div class="web-messages"></div> |
<button class="btn btn-success" ng-click="saveCourseReportDocument()">Gravar</button> |
<button class="btn btn-success" onclick="demoFromHTML()">PDF</button> |
<div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'"> |
</div> |
<!--<pre class="code">{{ report | json }}</pre>--> |
</div><!--App--> |
</div> <!--form--> |
</div><!--Panel Body--> |
</div><!--Panel--> |
</div><!--container-fluid--> |
<% |
//AbstractDao.getCurrentSession().getTransaction().commit(); |
%> |