/branches/grupo11/impl/conf/WEB-INF/struts/struts-courses.xml |
---|
164,7 → 164,8 |
<action path="/user/courseReportTools" forward="page.course.report.tools"/> |
<action path="/user/loadCourseReportTools" forward="page.course.report.tools.load"/> |
<action path="/user/editCourseReport" forward="page.course.report.edit"/> |
<!--Chama o servico de edição --> |
<action path="/user/editCourseReport" forward="/user/courseReport.do?dispatch=loadReportDocument"/> |
<action path="/user/courseReport" |
type="pt.estgp.estgweb.web.controllers.courses.CoursesServicesController" |
173,9 → 174,15 |
parameter="dispatch" |
validate="true" |
input="page.widget.json.fail.validations"> |
<!--Dispacho para a mesma pagina de edição --> |
<forward name="editReport" path="page.course.report.edit"/> |
</action> |
</action-mappings> |
</struts-config> |
/branches/grupo11/impl/conf/berserk/sd.xml |
---|
4022,11 → 4022,14 |
<defaultMethod>loadPlanYearForCourseUnitCode</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
<chain name="CoordinatorCourse"/> |
</filterChains> |
</service> |
<!-- SERVICOS DE GERACAO DE RELATORIO DE CURSO --> |
4045,9 → 4048,50 |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
</filterChains> |
</service> |
<!-- ServicosExameES --> |
<service> |
<name>CourseReportDocumentSave</name> |
<implementationClass>pt.estgp.estgweb.services.courses.CourseReportServices</implementationClass> |
<description> |
@reportCourseDocument documento course report em JSON |
Servico para guardar um courseReport na base de dados |
Guarda o documento do curso |
</description> |
<filterChains> |
<chain name="Logger"/> <!--Log dos acessos --> |
<!-- chain name "Session" /> --> |
<!-- chain name="CoordinatorCourse"/>/ --> |
</filterChains> |
<isTransactional>true</isTransactional> |
<defaultMethod>saveReportDocument</defaultMethod> |
</service> |
<service> |
<name>CourseReportDocumentLoad</name> |
<implementationClass>pt.estgp.estgweb.services.courses.CourseReportServices</implementationClass> |
<description> |
@courseCode código do curso |
@year import year ( ano do report) |
Servico para fazer load a um courseReport da base de dados |
Carrega o documento do curso |
</description> |
<filterChains> |
<chain name = "Logger"/> |
<chain name = "Session"/> |
<chain name = "CoordinatorCourse"/> |
</filterChains> |
<isTransactional>true</isTransactional> |
<defaultMethod>loadReportDocument</defaultMethod> |
</service> |
</serviceDefinitions> |
/branches/grupo11/impl/conf/berserk/fd.xml |
---|
100,6 → 100,7 |
</description> |
<isTransactional>false</isTransactional> |
</filter> |
<filter> |
<name>IsTeacherInCourseUnitUsersClass</name> |
<implementationClass>pt.estgp.estgweb.filters.filters.IsTeacherInCourseUnitUsersClass</implementationClass> |
182,7 → 183,7 |
<name>LogAccess</name> |
<implementationClass>pt.estgp.estgweb.filters.filters.AccessLogger</implementationClass> |
<description>Writes accesses to a file</description> |
<isTransactional>false</isTransactional> |
<isTransactional>false</isTransactional>f |
</filter> |
<filter> |
<name>SessionLoad</name> |
/branches/grupo11/impl/conf/berserk/fcd.xml |
---|
56,7 → 56,15 |
<invocationTiming>1</invocationTiming> |
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass> |
</filterChain> |
<!-- My Filter Chain --> |
<filterChain> |
<name>CoordinatorCourse</name> |
<expression>AuthenticatedUsers && RoleUsers("teacher,courseCoordinator") || RoleUsers("super")</expression> |
<description>Validate if user is authenticated and is a teacher or a super</description> |
<invocationTiming>1</invocationTiming> |
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass> |
</filterChain> |
<filterChain> |
<name>DirectorsCoordinators</name> |
<expression>AuthenticatedUsers</expression> |
<description>Validate if a user is coordinator or director</description> |
/branches/grupo11/impl/src/java/pt/estgp/estgweb/services/courses/CourseReportServices.java |
---|
9,6 → 9,10 |
import org.json.JSONObject; |
import pt.estgp.estgweb.domain.*; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.domain.dao.DaoUtils; |
import pt.estgp.estgweb.domain.dao.impl.CourseDao; |
import pt.estgp.estgweb.domain.dao.impl.CourseDaoImpl; |
import pt.estgp.estgweb.domain.dao.impl.CourseYearDaoImpl; |
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum; |
import pt.estgp.estgweb.services.courses.coursereport.CourseReportUtils; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.*; |
29,8 → 33,10 |
import pt.estgp.estgweb.web.controllers.utils.FileUploaded; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import javax.swing.text.View; |
import java.io.IOException; |
import java.io.InputStream; |
import java.io.Serializable; |
import java.net.URL; |
import java.net.URLConnection; |
import java.util.*; |
337,6 → 343,8 |
for(CourseUnit cu :units) |
{ |
CourseUnitDtpStat statFound = CourseReportUtils.findCourseUnitDtpStat(statsLoaded, (CourseUnitImpl) cu); |
if(statFound == null) |
{ |
statFound = CourseReportUtils.createCourseUnitDtpStat(cu); |
450,9 → 458,78 |
/* Save Method */ |
public String saveReportDocument (String reportDocumentJson,UserSession session){ |
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson); |
List<CourseYear> cyList = DaoFactory.getCourseYearDaoImpl().findCourseYear(reportDocument.getCourseCode(),reportDocument.getYear()); |
if(cyList!= null){ |
for (CourseYear courseYear : cyList) { |
courseYear.setCourseReportDocument(reportDocument.toJson()); |
} |
DaoFactory.getCourseYearDaoImpl().save(cyList); |
} |
else |
{ |
CourseYear cy = DomainObjectFactory.createCourseYearImpl(); |
cy.setCourseReportDocument(reportDocument.toJson()); |
Course course = DaoFactory.getCourseDaoImpl().findCourseByCodeAndYear(reportDocument.getCourseCode(),reportDocument.getYear()); |
cy.setImportYear(reportDocument.getYear()); |
cy.setSaveDate(session.getSaveDate()); |
course.getCourseYears().add(cy); |
cy.setCourse(course); |
DaoFactory.getCourseYearDaoImpl().save(cy); |
} |
return reportDocumentJson; |
} |
/* LOAD METHOD */ |
public String loadReportDocument(String courseCode, String year, UserSession session){ |
CourseYear cy = DaoFactory.getCourseYearDaoImpl().findCourseYear(courseCode,year).get(0); |
CourseReportDocument reportDocument = null; |
String reportDocumentJson = null; |
if(cy!= null){ |
reportDocumentJson = cy.getCourseReportDocument(); |
} |
else{ |
try { |
reportDocument = createNewCourseReportDocument(courseCode,year); |
saveReportDocument(reportDocumentJson,session); |
reportDocumentJson = reportDocument.toJson(); |
} catch (IOException e) { |
e.printStackTrace(); |
} catch (JSONException e) { |
e.printStackTrace(); |
} |
} |
return reportDocumentJson; |
} |
/****************************************************************************/ |
/* |
641,11 → 718,6 |
public static void main(String[] args) throws IOException, JSONException { |
AbstractDao.getCurrentSession().beginTransaction(); |
/branches/grupo11/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesServicesController.java |
---|
1,7 → 1,13 |
package pt.estgp.estgweb.web.controllers.courses; |
import jomm.dao.impl.AbstractDao; |
import org.apache.struts.action.ActionForm; |
import org.apache.struts.action.ActionForward; |
import org.apache.struts.action.ActionMapping; |
import org.json.JSONObject; |
import pt.estgp.estgweb.domain.CourseImpl; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.CourseReportDocument; |
import pt.estgp.estgweb.web.controllers.utils.AbstractWidgetAjaxController; |
import pt.estgp.estgweb.web.utils.RequestUtils; |
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager; |
43,4 → 49,30 |
} |
public ActionForward loadReportDocument(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Throwable{ |
String courseCode = request.getParameter("courseCode"); |
String year = request.getParameter("year"); |
AbstractDao.getCurrentSession().beginTransaction(); |
CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseCode); |
request.setAttribute("course",courseImpl); |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{courseCode,year}; |
Object[] args = new Object[] {courseCode,year}; |
String documentJson = (String) sm.execute(RequestUtils.getRequester(request,response),"loadReportDocument", args,names); |
request.setAttribute("courseDocumentJson",documentJson); |
AbstractDao.getCurrentSession().getTransaction().commit(); |
return mapping.findForward("editReport"); |
} |
} |
/branches/grupo11/impl/src/hbm/pt/estgp/estgweb/domain/Course.hbm.xml |
---|
79,6 → 79,9 |
<property name="separatedTurmas" type="boolean"> |
<column name="separatedTurmas" default="false"/> |
</property> |
<property name="courseReportDocument" type="string"> |
<column name="courseReportDocument" sql-type="LONGTEXT"/> |
</property> |
<many-to-one name="course" class="pt.estgp.estgweb.domain.Course" outer-join="true" lazy="false" column="course_id"/> |
<subclass name="pt.estgp.estgweb.domain.CourseYearImpl" discriminator-value="CourseYearImpl"/> |
</class> |
/branches/grupo11/impl/src/web/user/courses/courseReportEdit.jsp |
---|
1,12 → 1,5 |
<%@ 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" %> |
15,335 → 8,5 |
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
<%@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="../utils/reportEdit.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(); |
%> |
/branches/grupo11/impl/src/web/user/utils/reportEdit.jsp |
---|
New file |
0,0 → 1,320 |
<%-- |
Created by IntelliJ IDEA. |
User: Pedro |
Date: 01/02/2018 |
Time: 18:05 |
To change this template use File | Settings | File Templates. |
--%> |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<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> |
<%--<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 = ${courseDocumentJson}; |
$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"/> |
<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--> |
/branches/grupo11/impl/build.xml |
---|
66,6 → 66,7 |
<target name="initDirs"> |
<mkdir dir="${log.dir}"/> |
<mkdir dir="${data.dir}"/> |
<mkdir dir="${tmp.dir}"/> |
<mkdir dir="${build.dir}"/> |
<mkdir dir="${build.dir.classes}"/> |
<mkdir dir="${build.dir.war}"/> |
/branches/grupo11/impl/gen/java/pt/estgp/estgweb/domain/CourseYear.java |
---|
2,12 → 2,13 |
// Generated 4/nov/2017 19:35:42 by Hibernate Tools 3.2.0.b9 |
import java.io.Serializable; |
import java.util.Date; |
/** |
* CourseYear generated by hbm2java |
*/ |
public abstract class CourseYear extends pt.estgp.estgweb.domain.DomainSerializableObject implements java.io.Serializable { |
public abstract class CourseYear extends DomainSerializableObject implements Serializable { |
private long id; |
16,7 → 17,16 |
private String importYear; |
private boolean separatedTurmas; |
private Course course; |
private String courseReportDocument; |
public String getCourseReportDocument() { |
return courseReportDocument; |
} |
public void setCourseReportDocument(String courseReportDocument) { |
this.courseReportDocument = courseReportDocument; |
} |
public CourseYear() { |
} |