Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1902 → Rev 1916

/branches/grupo1/impl/conf/berserk/sd.xml
997,17 → 997,17
</service>
 
<!--<service>
<name>DeleteCourseUnit</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.UpdateCourseUnitService</implementationClass>
<description>Update course unit objectives and program file</description>
<isTransactional>true</isTransactional>
<defaultMethod>delete</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Supers"/>
</filterChains>
</service>-->
<name>DeleteCourseUnit</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.UpdateCourseUnitService</implementationClass>
<description>Update course unit objectives and program file</description>
<isTransactional>true</isTransactional>
<defaultMethod>delete</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Supers"/>
</filterChains>
</service>-->
<service>
<name>LoadCourseUnit</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadCourseUnitService</implementationClass>
1079,9 → 1079,9
<service>
<name>SaveCourseUnitProgram</name>
<!--Args
ourseUnitProgramView programView,
long unitId used in filters
-->
ourseUnitProgramView programView,
long unitId used in filters
-->
<implementationClass>pt.estgp.estgweb.services.courseunits.SaveCourseUnitProgram</implementationClass>
<description>Save course unit program</description>
<isTransactional>true</isTransactional>
1123,9 → 1123,9
<service>
<name>SaveCourseUnitEvaluation</name>
<!--Args
CourseUnitEvaluationView evaluationView,
long unitId used in filters
-->
CourseUnitEvaluationView evaluationView,
long unitId used in filters
-->
<implementationClass>pt.estgp.estgweb.services.courseunits.SaveCourseUnitEvaluation</implementationClass>
<description>Save course unit evaluation</description>
<isTransactional>true</isTransactional>
1157,8 → 1157,8
<service>
<name>InitCourseUnitEvaluationClearances</name>
<!--Parameters
CourseUnitView cuv, Long courseUnitId
-->
CourseUnitView cuv, Long courseUnitId
-->
<implementationClass>pt.estgp.estgweb.services.courseunits.SaveCourseUnitEvaluation</implementationClass>
<description>Open course unit evaluation for edition</description>
<isTransactional>true</isTransactional>
2920,18 → 2920,18
</service>
 
<!--
<service>
<name>AddUpdateDirtyRolesTranslation</name>
<implementationClass>pt.estgp.estgweb.services.users.UserRoleConfigService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>addUpdateDirtRolesTranslation</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="RoleAddRemoveManager"/>
</filterChains>
</service>-->
<service>
<name>AddUpdateDirtyRolesTranslation</name>
<implementationClass>pt.estgp.estgweb.services.users.UserRoleConfigService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>addUpdateDirtRolesTranslation</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="RoleAddRemoveManager"/>
</filterChains>
</service>-->
 
<service>
<name>AddUpdateRoleTranslation</name>
3901,8 → 3901,8
 
 
<!--/****************************************************************************/
/* COURSE REPORTS
/****************************************************************************/-->
/* COURSE REPORTS
/****************************************************************************/-->
 
 
 
3944,16 → 3944,16
</service>
 
<!--
PRECISO DE UM IMPORTAR NOVAMENTE TABELA DE RESULTADOS DE APRENDIZAGEM
Ha de ser um subservico do de cima que tem usar
o servico LoadCourseEvaluationSections novamente
PRECISO DE UM IMPORTAR NOVAMENTE TABELA DE RESULTADOS DE APRENDIZAGEM
Ha de ser um subservico do de cima que tem usar
o servico LoadCourseEvaluationSections novamente
 
PRECISO DE UM SERVICO PARA GERAR OS GRAFICOS DE APRENDIZAGEM
-->
PRECISO DE UM SERVICO PARA GERAR OS GRAFICOS DE APRENDIZAGEM
-->
 
<!--/****************************************************************************/
/* SERVICOS WS-API TODO Seguranca em falta
/****************************************************************************/-->
/* SERVICOS WS-API TODO Seguranca em falta
/****************************************************************************/-->
 
<service>
<name>LoadCourseEvaluationSections</name>
4062,4 → 4062,35
</filterChains>
</service>
 
<service>
<name>SaveCourseReportDocument</name>
<implementationClass>pt.estgp.estgweb.services.courses.CourseReportServices</implementationClass>
<description>
@reportCourseDocument documento course report em json
Guarda o relatorio na base de dados
</description>
<isTransactional>true</isTransactional>
<defaultMethod>saveCourseReportDocument</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
 
<service>
<name>LoadCourseReportDocument</name>
<implementationClass>pt.estgp.estgweb.services.courses.CourseReportServices</implementationClass>
<description>
@courseCode codigo do curso
@year ano do relatorio
Carrega o relatorio da base de dados
</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadCourseReportDocument</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
 
</serviceDefinitions>
/branches/grupo1/impl/src/java/pt/estgp/estgweb/services/courses/CourseReportServices.java
453,7 → 453,7
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson);
LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class);
GlobalLearningResultsChartImg chartImg = (GlobalLearningResultsChartImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartImg.class);
GlobalLearningResultsChartYearImg chartImg = (GlobalLearningResultsChartYearImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartYearImg.class);
 
UnitsLearningResultsTable table = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class);
 
481,8 → 481,48
return view.toJson();
}
 
public String saveCourseReportDocument(String reportDocumentJson,UserSession session) {
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson);
 
Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(reportDocument.getCourseCode());
CourseYear cy = DaoFactory.getCourseYearDaoImpl().findCourseYearU(reportDocument.getCourseCode(), reportDocument.getYear());
 
if (cy == null) {
cy = DomainObjectFactory.createCourseYearImpl();
cy.setCourse(c);
c.getCourseYears().add(cy);
cy.setImportYear(reportDocument.getYear());
DaoFactory.getCourseYearDaoImpl().save(cy);
}
cy.setCourseReportDocument(reportDocumentJson);
 
return reportDocument.toJson();
}
 
public String loadCourseReportDocument(String courseCode,String year,UserSession session) {
CourseYear cy = DaoFactory.getCourseYearDaoImpl().findCourseYearU(courseCode, year);
 
String courseReportJson = null;
if (cy != null) {
courseReportJson = cy.getCourseReportDocument();
}
 
if (courseReportJson == null) {
CourseReportDocument courseReport = null;
 
try {
courseReport = new CourseReportServices().createNewCourseReportDocument(courseCode, year);
courseReportJson = courseReport.toJson();
} catch (Throwable e) {
System.out.println(e);
e.printStackTrace();
}
}
 
return courseReportJson;
}
 
 
/****************************************************************************/
/*
 
/branches/grupo1/impl/src/java/pt/estgp/estgweb/services/courses/coursereport/documentmodel/learningresults/components/GlobalLearningResultsChartYearImg.java
1,10 → 1,192
package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components;
 
import pt.estgp.estgweb.utils.documentBuilder.AutoImageWraperComponent;
import jomm.dao.impl.AbstractDao;
import jomm.utils.BytesUtils;
import jomm.utils.MimeTypeGuesser;
import jomm.utils.StreamsUtils;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.block.BlockBorder;
import org.jfree.chart.labels.ItemLabelAnchor;
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.RingPlot;
import org.jfree.chart.renderer.category.StackedBarRenderer;
import org.jfree.chart.renderer.category.StandardBarPainter;
import org.jfree.chart.title.LegendTitle;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.ui.RectangleInsets;
import org.jfree.ui.TextAnchor;
import org.json.JSONException;
import org.json.JSONObject;
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.CourseReportDocument;
import pt.estgp.estgweb.services.questionarios.QuestionariosReportsService;
import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.utils.DataTable;
import pt.estgp.estgweb.utils.Globals;
import pt.estgp.estgweb.utils.documentBuilder.ImageComponent;
import pt.estgp.estgweb.web.controllers.utils.FileUploaded;
 
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.List;
 
/**
* Created by jorgemachado on 31/10/17.
* Created by joaocarvalho on 30/11/17.
*/
public class GlobalLearningResultsChartYearImg extends AutoImageWraperComponent
public class GlobalLearningResultsChartYearImg extends ImageComponent
{
}
public FileUploaded generateChart2tmp(UnitsLearningResultsTable results, CourseReportDocument courseReportDocument) throws IOException {
List<UnitsLearningResultYear> years = results.getYears();
 
String tempName = BytesUtils.generateHexKey() + ".png";
 
DefaultCategoryDataset data = new DefaultCategoryDataset();
for (UnitsLearningResultYear year : years) {
data.addValue(new Double(year.getAprovados1013Percent()), "Aprovados 10-13", year.getAno() + "º Ano");
data.addValue(new Double(year.getAprovados1416Percent()), "Aprovados 14-16", year.getAno() + "º Ano");
data.addValue(new Double(year.getAprovados1720Percent()), "Aprovados 17-20", year.getAno() + "º Ano");
}
data.addValue(new Double(results.getAprovados1013Percent()), "Aprovados 10-13", "Total");
data.addValue(new Double(results.getAprovados1416Percent()), "Aprovados 14-16", "Total");
data.addValue(new Double(results.getAprovados1720Percent()), "Aprovados 17-20", "Total");
 
JFreeChart chart = ChartFactory.createStackedBarChart(
null,
null,
null,
data,
PlotOrientation.VERTICAL,
true,
false,
false);
 
chart.setBackgroundPaint(Color.WHITE);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setRangeGridlinePaint(Color.GRAY);
plot.setRangeGridlinesVisible(true);
//plot.setRangeGridlineStroke(new BasicStroke(1.0f));
 
RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0);
chart.setPadding(chartRectangle);
 
plot.getDomainAxis().setTickLabelFont(new Font("Helvetica", Font.PLAIN, 25));
plot.getRangeAxis().setTickLabelFont(new Font("Helvetica", Font.PLAIN, 25));
 
StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
// Remover gradiente das barras
renderer.setBarPainter(new StandardBarPainter());
renderer.setSeriesPaint(0, new Color(237,127,32));
renderer.setSeriesPaint(1, new Color(255,198,0));
renderer.setSeriesPaint(2, new Color(122,173,38));
renderer.setMaximumBarWidth(0.2);
 
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", new DecimalFormat("#.##'%'")));
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelFont(new Font("Helvetica",Font.PLAIN,25));
 
LegendTitle legend = chart.getLegend();
legend.setItemFont(new Font("Helvetica", Font.PLAIN,25));
legend.setFrame(BlockBorder.NONE);
 
 
BufferedImage image = chart.createBufferedImage( 300*4, 200*4);
String pathGraficoTiposAlunos = Globals.TMP_DIR + java.io.File.separator + tempName;
java.io.File output = new java.io.File(pathGraficoTiposAlunos);
ImageIO.write(image, "png", new FileOutputStream(output));
 
FileUploaded fileUploaded = new FileUploaded();
fileUploaded.setTmpName(tempName);
fileUploaded.setTitle("Taxa global de aproveitamento");
fileUploaded.setDescription("Curso: " + courseReportDocument.getCourseName() + " (" + courseReportDocument.getCourseCode()+ ") ano " + courseReportDocument.getYear());
fileUploaded.setContentType(MimeTypeGuesser.getInstance().guessMimeType(output));
fileUploaded.setFileSize(output.length());
fileUploaded.setExtension("png");
 
return fileUploaded;
}
 
public static void main(String[] args) throws IOException {
String tempName = "test.png";
 
DefaultCategoryDataset data = new DefaultCategoryDataset();
data.addValue(new Double(29.5), "Aprovados 10-13", "1º Ano");
data.addValue(new Double(50.5), "Aprovados 14-16", "1º Ano");
data.addValue(new Double(20), "Aprovados 17-20", "1º Ano");
 
data.addValue(new Double(10), "Aprovados 10-13", "2º Ano");
data.addValue(new Double(40), "Aprovados 14-16", "2º Ano");
data.addValue(new Double(50), "Aprovados 17-20", "2º Ano");
 
data.addValue(new Double(50), "Aprovados 10-13", "3º Ano");
data.addValue(new Double(10), "Aprovados 14-16", "3º Ano");
data.addValue(new Double(40), "Aprovados 17-20", "3º Ano");
 
data.addValue(new Double(33.33), "Aprovados 10-13", "Total");
data.addValue(new Double(33.33), "Aprovados 14-16", "Total");
data.addValue(new Double(33.33), "Aprovados 17-20", "Total");
 
 
 
JFreeChart chart = ChartFactory.createStackedBarChart(
null,
null,
null,
data,
PlotOrientation.VERTICAL,
true,
false,
false);
 
chart.setBackgroundPaint(Color.WHITE);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setRangeGridlinePaint(Color.GRAY);
plot.setRangeGridlinesVisible(true);
//plot.setRangeGridlineStroke(new BasicStroke(1.0f));
 
RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0);
chart.setPadding(chartRectangle);
 
plot.getDomainAxis().setTickLabelFont(new Font("Helvetica", Font.PLAIN, 25));
plot.getRangeAxis().setTickLabelFont(new Font("Helvetica", Font.PLAIN, 25));
 
StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
// Remover gradiente das barras
renderer.setBarPainter(new StandardBarPainter());
renderer.setSeriesPaint(0, new Color(237,127,32));
renderer.setSeriesPaint(1, new Color(255,198,0));
renderer.setSeriesPaint(2, new Color(122,173,38));
renderer.setMaximumBarWidth(0.2);
 
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", new DecimalFormat("#.##'%'")));
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelFont(new Font("Helvetica",Font.PLAIN,25));
 
LegendTitle legend = chart.getLegend();
legend.setItemFont(new Font("Helvetica", Font.PLAIN,25));
legend.setFrame(BlockBorder.NONE);
 
 
 
BufferedImage image = chart.createBufferedImage( 300*4, 200*4);
String pathGraficoTiposAlunos = Globals.TMP_DIR + java.io.File.separator + tempName;
java.io.File output = new java.io.File(pathGraficoTiposAlunos);
ImageIO.write(image, "png", new FileOutputStream(output));
}
}
/branches/grupo1/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseYearDaoImpl.java
26,4 → 26,16
.add(eq("c.code",code)).list();
return cYs;
}
public CourseYear findCourseYearU(String code, String importYear)
{
List<CourseYear> cYs = createCriteria()
.createAlias("course","c")
.add(eq("importYear", importYear))
.add(eq("c.code",code)).list();
 
if (cYs.isEmpty())
return null;
 
return cYs.get(0);
}
}
/branches/grupo1/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesServicesController.java
52,4 → 52,14
new Object[]{courseReportDocument});
return new JSONObject(json);
}
 
public JSONObject saveCourseReportDocument(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
String courseReportDocument = request.getParameter("courseReportDocument");
 
IServiceManager sm = ServiceManager.getInstance();
String json = (String) sm.execute(RequestUtils.getRequester(request, response),
"SaveCourseReportDocument",
new Object[]{courseReportDocument});
return new JSONObject(json);
}
}
/branches/grupo1/impl/src/java/pt/estgp/estgweb/web/controllers/configuration/ConfigurationsController.java
170,6 → 170,7
 
configuration.setOpenInfoIntranet(f.getConfiguration().getOpenInfoIntranet());
configuration.setInterfaceImportYear(f.getConfiguration().getInterfaceImportYear());
configuration.setCourseReportImportYear(f.getConfiguration().getCourseReportImportYear());
configuration.setCursosFicticios(f.getConfiguration().getCursosFicticios());
 
configuration.setCourseUnitEvaluationActiveYear(f.getConfiguration().getCourseUnitEvaluationActiveYear());
/branches/grupo1/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="text">
<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/grupo1/impl/src/hbm/pt/estgp/estgweb/domain/Configuration.hbm.xml
15,6 → 15,9
<property name="saveDate" type="timestamp"/>
<property name="interfaceImportYear" type="string"/>
 
<property name="courseReportImportYear" type="string">
<column name="courseReportImportYear" default="201718"/>
</property>
<!-- IMPORTS CONFIGS -->
<property name="importsDefaultImportYear" type="string"/>
<property name="sigesWebServicesWsdl" type="string">
/branches/grupo1/impl/src/web/admin/configuration/configs.jsp
69,7 → 69,24
</div>
</div>
 
<div class="form-group">
<label class="control-label col-sm-2">Relatórios de Curso em Produção</label>
<div class="col-sm-10">
 
<html:select styleClass="form-control" property="configuration.courseReportImportYear">
<%
for(String year:years)
{
request.setAttribute("year",year);
%>
<html:option value="${year}">${year}</html:option>
<%
}
%>
</html:select>
</div>
</div>
 
<div class="panel panel-default">
<div class="panel-heading">Relatórios de Avaliação das Unidades Curriculares</div>
<div class="panel-body">
/branches/grupo1/impl/src/web/user/courses/courseReportEdit.jsp
2,19 → 2,19
<%@ 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" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ 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" %>
 
<%-- 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">
66,7 → 66,7
 
var body = '';
body += '--' + boundary + '\r\n' +
'Content-Disposition: form-data; name="filesInputId-UPLOAD[]"; filename="20170530_210340.pdf"' + '\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;
93,255 → 93,276
</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;
 
String courseReportJson = null;
try {
courseReport = new CourseReportServices().createNewCourseReportDocument(courseCode, year);
} catch (Throwable e) {
System.out.println(e);
e.printStackTrace();
IServiceManager sm = ServiceManager.getInstance();
courseReportJson = (String) sm.execute(RequestUtils.getRequester(request, response),
"LoadCourseReportDocument",
new Object[]{courseCode, year});
} catch (Throwable throwable) {
throwable.printStackTrace();
}
String courseReportJson = courseReport.toJson();
request.setAttribute("courseDocumentJson",courseReportJson);
request.setAttribute("courseDocument",courseReport);
 
 
AbstractDao.getCurrentSession().beginTransaction();
CourseImpl courseImpl = DaoFactory.getCourseDaoImpl().findCourseByCode(courseCode);
request.setAttribute("course",courseImpl);
 
//request.setAttribute("courseDocument",courseReport);
%>
<%--<a href="javascript:demoFromHTML()" class="button">Run Code</a>--%>
 
<div class="container-fluid">
 
<style>
.separatorSection
{
border: 1px solid #ddd;
}
</style>
<style>
.separatorSection
{
border: 1px solid #ddd;
}
</style>
 
 
<!-- Apresentacao da Unidade -->
<!-- Apresentacao da Unidade -->
 
<div class="panel panel-default">
<div class="panel-heading">
Relatório Anual do curso: ${course.name}
</div>
<div class="panel-body">
<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>
<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>
<script>
 
//Especifico da aplicacao
var courseReportApp = angular.module('courseReportApp', ['ui.tree']);
GLOBAL_BacoAngularAppDependencies.push('courseReportApp');
//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.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)
{
courseReportApp.controller('courseReportAppController', function($scope)
{
 
$scope.docAppSelector = "#courseReportApp";
$scope.report = <%=courseReportJson%>
$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;
}
$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;
}
/**
* @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;
}
$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)
/**
* 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)
{
return superClassId;
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(".","_");
}
}
}
return obj["@class"].replaceAll(".","_");
}
 
$scope.addText = function(parentCustomPane)
{
$scope.addSimpleDocComponent(parentCustomPane,"pt.estgp.estgweb.utils.documentBuilder.TextComponent")
}
$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.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(
$scope.addSimpleDocComponent = function(parentCustomPane,classComponent)
{
"@class" : classComponent
if(!parentCustomPane.components)
{
parentCustomPane.components = [];
}
parentCustomPane.components.push(
{
"@class" : classComponent
}
);
}
);
}
$scope.removeComponent = function(index,array)
{
array.splice(index,1);
}
$scope.removeComponent = function(index,array)
{
array.splice(index,1);
}
 
$scope.callbackUploadedFiles = function(filesUploadResult,token,targetElement)
{
var modelObject = BacoAngularUtils.getAngularElementModel(targetElement);
$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",
if(modelObject.image && modelObject.image.identifier)
{
"identifier" : modelObject.image.identifier,
"fileUploaded" : BacoJS.stringifyOrdered(filesUploadResult.uploadedFiles[0])
},
"#courseReportApp",
function(repositoryFile4JsonView)
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
{
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(){}
);
}
}
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>
});
</script>
 
<!--TEMPLATES FOR DOCUMENT BUILDER-->
<jsp:include page="../utils/documentsBuilder.jsp"/>
<jsp:include page="coursereport/templates.jsp"/>
<!--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 class="form-vertical">
<div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController">
<div class="web-messages"></div>
 
<div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'">
<button class="btn btn-success" ng-click="saveCourseReportDocument()">Gravar</button>
 
</div>
<div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'">
 
<!-- <pre class="code">{{ report | json }}</pre>-->
</div>
 
<!--<pre class="code">{{ report | json }}</pre>-->
 
 
</div><!--App-->
</div> <!--form-->
 
</div><!--Panel Body-->
</div><!--App-->
</div> <!--form-->
 
</div><!--Panel-->
</div><!--Panel Body-->
 
</div><!--Panel-->
 
</div><!--container-fluid-->
 
<%
/branches/grupo1/impl/src/web/user/home/teacher.jsp
166,6 → 166,13
<div class="panel-body">
 
<div class="list-group">
 
<logic:iterate id="cordCourse" name="tLoggedIn" property="coordinatorCourses" type="pt.estgp.estgweb.domain.Course">
<div class="list-group-item">
<html:link action="/user/editCourseReport.do?courseCode=${cordCourse.code}&year=${UserSession.nowConfiguration.courseReportImportYear}">Editar o relatório de Curso do ano (${UserSession.nowConfiguration.courseReportImportYear})</html:link>
</div>
</logic:iterate>
 
<div class="list-group-item">
<html:link action="/user/startSubmitMessageCourseComission">
Enviar email aos alunos
/branches/grupo1/impl/src/web/user/utils/documentsBuilder.jsp
56,6 → 56,8
 
</div>
</div></div>
</div>
</div>
</script>
 
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_ImageComponent">
/branches/grupo1/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/grupo1/impl/gen/java/pt/estgp/estgweb/domain/CourseYear.java
16,6 → 16,7
private String importYear;
private boolean separatedTurmas;
private Course course;
private String courseReportDocument;
 
public CourseYear() {
}
56,6 → 57,10
public void setSeparatedTurmas(boolean separatedTurmas) {
this.separatedTurmas = separatedTurmas;
}
public String getCourseReportDocument() { return this.courseReportDocument; }
 
public void setCourseReportDocument(String courseReportDocument) { this.courseReportDocument = courseReportDocument; }
 
public Course getCourse() {
return this.course;
}
/branches/grupo1/impl/gen/java/pt/estgp/estgweb/domain/Configuration.java
10,20 → 10,21
public abstract class Configuration extends pt.estgp.estgweb.domain.DomainSerializableObject implements java.io.Serializable {
 
 
private long id;
private Date updateDate;
private Date saveDate;
private String interfaceImportYear;
private String importsDefaultImportYear;
private String sigesWebServicesWsdl;
private Integer sigesInstitutionCode;
private Integer nationalInstitutionCode;
private String courseUnitEvaluationActiveYear;
private String courseUnitEvaluationActiveDegrees;
private String courseUnitEvaluationActiveCourseIds;
private String cursosFicticios;
private String openInfoIntranet;
private ConfigurationGrades configurationGrades;
private long id;
private Date updateDate;
private Date saveDate;
private String interfaceImportYear;
private String courseReportImportYear;
private String importsDefaultImportYear;
private String sigesWebServicesWsdl;
private Integer sigesInstitutionCode;
private Integer nationalInstitutionCode;
private String courseUnitEvaluationActiveYear;
private String courseUnitEvaluationActiveDegrees;
private String courseUnitEvaluationActiveCourseIds;
private String cursosFicticios;
private String openInfoIntranet;
private ConfigurationGrades configurationGrades;
 
public Configuration() {
}
57,6 → 58,13
public void setInterfaceImportYear(String interfaceImportYear) {
this.interfaceImportYear = interfaceImportYear;
}
public String getCourseReportImportYear() {
return this.courseReportImportYear;
}
 
public void setCourseReportImportYear(String courseReportImportYear) {
this.courseReportImportYear = courseReportImportYear;
}
public String getImportsDefaultImportYear() {
return this.importsDefaultImportYear;
}