Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 904 → Rev 919

/impl/importRoutines.xml
55,4 → 55,8
<arg value="false"/>
</java>
</target>
 
<target name="storeAllProgramsFtp">
<java classname="pt.estgp.estgweb.services.courseunits.SaveCourseUnitProgram" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
</project>
/impl/conf/language/MessageResourcesCourseUnits.properties
170,6 → 170,7
 
 
courseunit.evaluation=Ficha de Avalia\u00e7\u00e3o da Unidade Curricular
courseunit.evaluation.warning=Por favor v\u00e1 guardando a sua ficha no bot\u00e3o de Salvar para evitar que caso a sess\u00e3o expire perca o seu trabalho.
courseunit.evaluation.mapa1=Mapa 1
courseunit.evaluation.mapa1.desc=Dados relativos ao processo de avalia\u00e7\u00e3o
courseunit.menu.evaluation=Relat\u00f3rio de Avalia\u00e7\u00e3o
/impl/conf/app.properties
469,8 → 469,8
intranet.dtp.avaliacao=4.Avaliacao
intranet.dtp.avaliacao.enunciados=4.1.Enunciados
intranet.dtp.avaliacao.pautas=4.2.Pautas
intranet.dtp.ficha_avaliacao=5.Ficha.de.Avaliacao.da.Unidade.Curricular
intranet.dtp.inquerito_pedagogico=6.Inquerito.Pedagogico.Unidade.Curricular
intranet.dtp.ficha_avaliacao=5.Relatorio.de.Avaliacao
intranet.dtp.inquerito_pedagogico=6.Inquerito.Pedagogico
intranet.dtp.course.coordinator.write=true
intranet.dtp.course.director.write=true
intranet.dtp.course.unit.responsible.write=true
/impl/src/java/pt/estgp/estgweb/utils/StringsUtils.java
44,6 → 44,7
try{
if(nome != null)
{
nome = nome.replace("/","_");
String[] partes = nome.split(" ");
StringBuilder sb = new StringBuilder();
for(String n : partes)
/impl/src/java/pt/estgp/estgweb/Globals.java
360,4 → 360,10
public static final String EMAIL_GRADE_UNIT_TEMPLATE = "GradeUnit.txt";
 
public static final String[] PROXY_EXTENSIONS = ConfigProperties.getProperty("proxy.extensions").split(" ");
 
 
public static final String FTP_IONLINE_URL = ConfigProperties.getProperty("server.ionline") + ConfigProperties.getProperty("server.ionline.start.path");
public static final String FTP_IONLINE_USER = ConfigProperties.getProperty("ionline.user");
public static final String FTP_IONLINE_PASS = ConfigProperties.getProperty("ionline.pass");
public static final String FTP_IONLINE_START_PATH = ConfigProperties.getProperty("server.ionline.start.path");
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/SaveCourseUnitProgram.java
1,12 → 1,17
package pt.estgp.estgweb.services.courseunits;
 
import jomm.dao.impl.AbstractDao;
import jomm.utils.PdfUtils;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.fop.apps.FOPException;
import org.apache.log4j.Logger;
import org.dom4j.*;
import org.hibernate.Query;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.dao.impl.CourseUnitDaoImpl;
import pt.estgp.estgweb.domain.views.CourseUnitProgramView;
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum;
import pt.estgp.estgweb.services.data.RepositoryService;
14,6 → 19,7
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.estgp.estgweb.utils.StringsUtils;
import pt.estgp.estgweb.web.FtpServer;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import javax.xml.transform.TransformerException;
23,10 → 29,7
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
 
/*
* @author Goncalo Luiz gedl [AT] rnl [DOT] ist [DOT] utl [DOT] pt
110,9 → 113,86
public void createPdf(CourseUnit cu, List<String> errors) throws IOException, TransformerException, FOPException {
createPdf(cu,errors,null);
}
 
public void createPdf(CourseUnit cu, List<String> errors,UserSession u) throws IOException, TransformerException, FOPException {
 
 
String path = generatePdfFile(cu, errors, u);
 
 
 
RepositoryService repositoryService = new RepositoryService();
User owner;
if(cu.getTeachers() != null && cu.getTeachers().size() > 0)
owner = cu.getTeachers().iterator().next();
else
owner = DaoFactory.getUserDaoImpl().load(new Long(1));
if(owner.getUsername() == null)
{
errors.add("Docente: " + owner.getName() + " ( " + owner.getId() + " ) don't have username check that situation");
// owner.setUsername("UKNOWN");
}
if(cu.getProgramStreamId() == null)
{
String identifier = repositoryService.storeRepositoryFile(new FileInputStream(path), "application/pdf", "pdf",((int) new File(path).length()), cu.getCode() + ".pdf", "courseunit.program.description" + cu.getName(), ResourceAccessControlEnum.publicDomain,owner);
cu.setProgramStreamId(identifier);
}
else
{
repositoryService.updateRepositoryFile(cu.getProgramStreamId(), new FileInputStream(path), "application/pdf", "pdf", ((int)new File(path).length()),cu.getCode() + ".pdf", "courseunit.program.description " + cu.getName(), ResourceAccessControlEnum.publicDomain);
}
cu.setObjectives(cu.getCourseUnitProgram().getCourseUnitProgramPart2().getObjectivos());
//Obrigar a ser falso
 
//NOVO
RepositoryFileImpl repoFile = repositoryService.loadView(cu.getProgramStreamId());
sendPdfFtpIonline(cu,errors,u,path,repoFile.getLastVersion().getSaveDate(),null);
}
 
 
public boolean sendPdfFtpIonline(CourseUnit cu, List<String> errors, UserSession u, FTPClient client) throws IOException, TransformerException, FOPException
{
RepositoryService repositoryService = new RepositoryService();
if(cu.getProgramStreamId() != null && cu.getProgramStreamId().length()> 0)
{
RepositoryFileImpl repoFile = repositoryService.loadView(cu.getProgramStreamId());
String path = generatePdfFile(cu, errors, u);
sendPdfFtpIonline(cu,errors,u,path,repoFile.getLastVersion().getSaveDate(),client);
return true;
}
return false;
}
 
SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd.HH_mm_ss");
private void sendPdfFtpIonline(CourseUnit cu, List<String> errors, UserSession u,String pdfPath,Date versionDate,FTPClient client) throws IOException, TransformerException, FOPException {
 
FtpServer server = null;
if(client == null)
{
server = FtpServer.getNewServer(Globals.FTP_IONLINE_URL,Globals.FTP_IONLINE_USER,Globals.FTP_IONLINE_PASS);
client = server.getClient();
}
client.setFileType(FTP.BINARY_FILE_TYPE);
 
String pastaFichaCurricular = Globals.FTP_IONLINE_START_PATH + cu.getPathIntranet() + "/" + Globals.INTRANET_DTP + "/" + Globals.INTRANET_DTP_FichaCurricular;
if(!client.changeWorkingDirectory(pastaFichaCurricular))
{
logger.error("FTP CANT CHANGE TO PATH: " + pastaFichaCurricular);
}
else
{
client.storeFile(cu.getCode() + "_" + cu.getNormalizedName() + "_v" + sdf.format(versionDate) + ".pdf",new FileInputStream(pdfPath));
 
if(server != null)
{
client.quit();
client.disconnect();
}
}
//
}
 
private String generatePdfFile(CourseUnit cu, List<String> errors, UserSession u) throws TransformerException, IOException, FOPException {
((CourseUnitProgramImpl)cu.getCourseUnitProgram()).consistNullValues();
Document responseDoc = DocumentHelper.createDocument();
Namespace namespace = new Namespace("uc", "http://baco.estgp.pt/schemas/courseunits/program/");
174,7 → 254,6
}
 
 
 
Element apresentacaoObjectivos = curriculum.addElement(new QName("objetivosDaAprendizagem",namespace));
apresentacaoObjectivos.setText(cu.getCourseUnitProgram().getCourseUnitProgramPart2().getObjectivos());
 
290,18 → 369,11
cargaHorariaTotal.setText(cu.getCourseUnitProgram().getCargaHorariaTotal());
 
 
 
 
 
 
 
 
 
// Dom4jUtil.writeSout(responseDoc);
 
 
String path = Globals.TMP_DIR + File.separator + cu.getCode() + "-" + cu.getName() + ".pdf";
FileOutputStream teste = new FileOutputStream(path);
String path = Globals.TMP_DIR + File.separator + cu.getCode() + "-" + cu.getNormalizedName() + ".pdf";
FileOutputStream out = new FileOutputStream(path);
Map<String,Object> params = new HashMap<String,Object>();
params.put("site", Globals.SITE_URL);
if(cu.isValidProgram())
314,34 → 386,55
 
org.w3c.dom.Document dd = Dom4jUtil.toW3c(responseDoc);
 
PdfUtils.createPdfFromXml(new DOMSource(dd), "pt/estgp/estgweb/services/courseunits/courseunitprogram.fo.xsl", teste,params);
teste.flush();
teste.close();
PdfUtils.createPdfFromXml(new DOMSource(dd), "pt/estgp/estgweb/services/courseunits/courseunitprogram.fo.xsl", out, params);
out.flush();
out.close();
return path;
}
 
 
RepositoryService repositoryService = new RepositoryService();
User owner;
if(cu.getTeachers() != null && cu.getTeachers().size() > 0)
owner = cu.getTeachers().iterator().next();
else
owner = DaoFactory.getUserDaoImpl().load(new Long(1));
if(owner.getUsername() == null)
{
errors.add("Docente: " + owner.getName() + " ( " + owner.getId() + " ) don't have username check that situation");
// owner.setUsername("UKNOWN");
public void storeAllPrograms() throws IOException {
CourseUnitDaoImpl dao = DaoFactory.getCourseUnitDaoImpl();
Query q = AbstractDao.getCurrentSession().createQuery("select c from c in class " + CourseUnit.class.getName() + " where c.importYear = ?");
q.setString(0,DatesUtils.getImportYear());
Iterator<CourseUnit> cuIter = q.iterate();
FtpServer server = FtpServer.getNewServer(Globals.FTP_IONLINE_URL,Globals.FTP_IONLINE_USER,Globals.FTP_IONLINE_PASS);
FTPClient client = server.getClient();
while (cuIter.hasNext()) {
CourseUnit next = cuIter.next();
 
try {
List<String> errors = new ArrayList<String>();
System.out.print("Sending " + next.getCourse().getName() + " - " + next.getSemestre() + " - " + next.getNormalizedName());
if(sendPdfFtpIonline(next,errors,null,client))
System.out.print(" ... OK");
else
System.out.print(" ... FAIL probably no StreamID");
System.out.print("\n");
if(errors.size()>0)
for(String error:errors)
logger.warn(error);
} catch (IOException e) {
logger.error(e,e);
} catch (TransformerException e) {
logger.error(e, e);
} catch (FOPException e) {
e.printStackTrace();
}
 
AbstractDao.getCurrentSession().evict(next);
}
if(cu.getProgramStreamId() == null)
{
String identifier = repositoryService.storeRepositoryFile(new FileInputStream(path), "application/pdf", "pdf",((int) new File(path).length()), cu.getCode() + ".pdf", "courseunit.program.description" + cu.getName(), ResourceAccessControlEnum.publicDomain,owner);
cu.setProgramStreamId(identifier);
client.quit();
client.disconnect();
 
}
 
 
public static void main(String[] args) throws IOException {
AbstractDao.getCurrentSession().beginTransaction();
new SaveCourseUnitProgram().storeAllPrograms();
AbstractDao.getCurrentSession().flush();
AbstractDao.getCurrentSession().getTransaction().commit();
}
else
{
repositoryService.updateRepositoryFile(cu.getProgramStreamId(), new FileInputStream(path), "application/pdf", "pdf", ((int)new File(path).length()),cu.getCode() + ".pdf", "courseunit.program.description " + cu.getName(), ResourceAccessControlEnum.publicDomain);
}
cu.setObjectives(cu.getCourseUnitProgram().getCourseUnitProgramPart2().getObjectivos());
//Obrigar a ser falso
 
 
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/SaveCourseUnitEvaluation.java
1,20 → 1,20
package pt.estgp.estgweb.services.courseunits;
 
import jomm.utils.PdfUtils;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.fop.apps.FOPException;
import org.apache.log4j.Logger;
import org.dom4j.*;
import org.dom4j.Document;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.CourseUnitEvaluationView;
import pt.estgp.estgweb.domain.views.CourseUnitProgramView;
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum;
import pt.estgp.estgweb.services.data.RepositoryService;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.estgp.estgweb.utils.StringsUtils;
import pt.estgp.estgweb.web.FtpServer;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import javax.xml.transform.TransformerException;
24,10 → 24,7
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
 
/*
* @author Goncalo Luiz gedl [AT] rnl [DOT] ist [DOT] utl [DOT] pt
41,8 → 38,8
* @author Jorge Machado
*
*
* So pode editar o programa da unidade o coordenador do curso ou o responsavel da unidade
* ou o docente da unidade ou tem o role de validacao do curso a comissao de curso
* So pode editar a avaliação da unidade o docente da unidade
* É gerado um PDF a cada gravação do Ficheiro
*
* Created at 17/Out/2003 , 23:45:24
*
54,6 → 51,8
 
private static final Logger logger = Logger.getLogger(SaveCourseUnitEvaluation.class);
 
RepositoryService repositoryService = new RepositoryService();
 
public CourseUnitEvaluationView run(CourseUnitEvaluationView cupv, Long coursUnitId, UserSession usession) throws ServiceException, TransformerException, IOException, FOPException {
 
CourseUnit c = DaoFactory.getCourseUnitDaoImpl().get(coursUnitId);
84,7 → 83,16
cupv.persistViewInObjectTeacher(evaluation);
}
List<String> errors = new ArrayList<String>();
if(cupv.isFechar())
{
evaluation.setClosed(true);
}
else
{
evaluation.setClosed(false);
}
 
createPdf(evaluation,c,usession,errors);
if(usession.getUser() instanceof Teacher)
DirectedCoordinatedUnitsService.sendNotificationsEditedInterestedPeople(c,usession);
else
95,5 → 103,106
return cupv;
}
 
public void createPdf(CourseUnitEvaluation cuv, CourseUnit cu, UserSession userSession,List<String> errors) throws IOException, TransformerException, FOPException {
 
 
String path = generatePdf(cuv, cu);
 
 
 
RepositoryService repositoryService = new RepositoryService();
User owner = userSession.getUser();
 
if(cu.getEvaluationStreamId() == null)
{
String identifier = repositoryService.storeRepositoryFile(new FileInputStream(path), "application/pdf", "pdf",((int) new File(path).length()), cu.getCode() + "-evaluation.pdf", "courseunit.evaluation.description" + cu.getName(), ResourceAccessControlEnum.privateDomain,owner);
cu.setEvaluationStreamId(identifier);
}
else
{
repositoryService.updateRepositoryFile(cu.getEvaluationStreamId(), new FileInputStream(path), "application/pdf", "pdf", ((int)new File(path).length()),cu.getCode() + "-evaluation.pdf", "evaluation.evaluation.description " + cu.getName(), ResourceAccessControlEnum.privateDomain);
}
 
//Obrigar a ser falso
 
//NOVO
 
if(cuv.isClosed())
{
RepositoryFileImpl repoFile = repositoryService.loadView(cu.getEvaluationStreamId());
sendPdfFtpIonline(cu,errors,userSession,path,repoFile.getLastVersion().getSaveDate(),null);
}
}
 
public String generatePdf(CourseUnitEvaluation cuv, CourseUnit c) throws IOException, TransformerException, FOPException {
 
Document responseDoc = ((CourseUnitEvaluationImpl)cuv).getDom();
responseDoc.setXMLEncoding("ISO-8859-1");
 
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
 
responseDoc.getRootElement().addAttribute("data", sdf.format(new java.util.Date()));
 
 
 
 
String path = Globals.TMP_DIR + File.separator + c.getCode() + "-" + c.getNormalizedName() + "-eval.pdf";
 
FileOutputStream out = new FileOutputStream(path);
Map<String,Object> params = new HashMap<String,Object>();
params.put("site", Globals.SITE_URL);
 
 
org.w3c.dom.Document dd = Dom4jUtil.toW3c(responseDoc);
 
PdfUtils.createPdfFromXml(new DOMSource(dd), "pt/estgp/estgweb/services/courseunits/courseunitevaluation.fo.xsl", out, params);
out.flush();
out.close();
return path;
}
 
 
 
/* public boolean sendPdfFtpIonline(CourseUnit cu, List<String> errors, UserSession u, FTPClient client) throws IOException, TransformerException, FOPException
{
RepositoryService repositoryService = new RepositoryService();
if(cu.getProgramStreamId() != null && cu.getProgramStreamId().length()> 0)
{
RepositoryFileImpl repoFile = repositoryService.loadView(cu.getProgramStreamId());
String path = generatePdfFile(cu, errors, u);
sendPdfFtpIonline(cu,errors,u,path,repoFile.getLastVersion().getSaveDate(),client);
return true;
}
return false;
}*/
 
SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd.HH_mm_ss");
private void sendPdfFtpIonline(CourseUnit cu, List<String> errors, UserSession u,String pdfPath,Date versionDate,FTPClient client) throws IOException, TransformerException, FOPException {
 
FtpServer server = null;
if(client == null)
{
server = FtpServer.getNewServer(Globals.FTP_IONLINE_URL,Globals.FTP_IONLINE_USER,Globals.FTP_IONLINE_PASS);
client = server.getClient();
}
client.setFileType(FTP.BINARY_FILE_TYPE);
 
String pastaFichaCurricular = Globals.FTP_IONLINE_START_PATH + cu.getPathIntranet() + "/" + Globals.INTRANET_DTP + "/" + Globals.INTRANET_DTP_FichaAvaliacao;
if(!client.changeWorkingDirectory(pastaFichaCurricular))
{
logger.error("FTP CANT CHANGE TO PATH: " + pastaFichaCurricular);
}
else
{
client.storeFile(cu.getCode() + "_" + cu.getNormalizedName() + "_v" + sdf.format(versionDate) + ".pdf",new FileInputStream(pdfPath));
 
if(server != null)
{
client.quit();
client.disconnect();
}
}
//
}
 
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/courseunitprogram.fo.xsl
253,11 → 253,12
<xsl:with-param name="value"><xsl:value-of select="//uc:conteudosProgramaticos"/></xsl:with-param>
</xsl:call-template>
 
<!--<xsl:call-template name="tableGrayLine">-->
<!--<xsl:with-param name="label">Demonstração da coerência dos conteúdos programáticos com os objectivos da unidade curricular</xsl:with-param>-->
<!--<xsl:with-param name="label2"></xsl:with-param>-->
<!--<xsl:with-param name="value"><xsl:value-of select="//uc:demonstracaoCoerenciaConteudosObjectivos"/></xsl:with-param>-->
<!--</xsl:call-template>-->
<!-- Campo Novo Aprovado Luis Batista Mail de 3 de Setembro de 2015 assunto RE: Verificação conteudos - UC - CESH_TD-->
<xsl:call-template name="tableGrayLine">
<xsl:with-param name="label">Demonstração da coerência dos conteúdos programáticos com os objectivos da unidade curricular</xsl:with-param>
<xsl:with-param name="label2"></xsl:with-param>
<xsl:with-param name="value"><xsl:value-of select="//uc:demonstracaoCoerenciaConteudosObjectivos"/></xsl:with-param>
</xsl:call-template>
 
<xsl:call-template name="tableWhiteLine">
<xsl:with-param name="label">Metodologias de ensino e Aprendizagem</xsl:with-param>
265,12 → 266,14
<xsl:with-param name="value"><xsl:value-of select="//uc:metodologiasEnsino"/></xsl:with-param>
</xsl:call-template>
 
<!--<xsl:call-template name="tableGrayLine">-->
<!--<xsl:with-param name="label">Demonstração da coerência das metodologias de ensino com os objectivos da aprendizagem da unidade curricular</xsl:with-param>-->
<!--<xsl:with-param name="label2"></xsl:with-param>-->
<!--<xsl:with-param name="value"><xsl:value-of select="//uc:demonstracaoDaCoerenciaMetodologiasObjectivos"/></xsl:with-param>-->
<!--</xsl:call-template>-->
<!-- Campo Novo Aprovado Luis Batista Mail de 3 de Setembro de 2015 assunto RE: Verificação conteudos - UC - CESH_TD-->
 
<xsl:call-template name="tableGrayLine">
<xsl:with-param name="label">Demonstração da coerência das metodologias de ensino com os objectivos da aprendizagem da unidade curricular</xsl:with-param>
<xsl:with-param name="label2"></xsl:with-param>
<xsl:with-param name="value"><xsl:value-of select="//uc:demonstracaoDaCoerenciaMetodologiasObjectivos"/></xsl:with-param>
</xsl:call-template>
 
<xsl:call-template name="tableWhiteLine">
<xsl:with-param name="label">Língua de ensino</xsl:with-param>
<xsl:with-param name="label2"></xsl:with-param>
/impl/src/java/pt/estgp/estgweb/services/courseunits/CreateCourseUnitDirPackageServiceBat.java
11,6 → 11,7
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
152,6 → 153,7
String dtpUnitFolder = semestreUnitName + Globals.INTRANET_DTP + "\\";
String conteudosUnitFolder = semestreUnitName + Globals.INTRANET_CONTENTS + "\\";
 
batRunner.write("md " + semestreUnitName + "\n");
batRunner.write("md " + conteudosUnitFolder + "\n");
batRunner.write("md " + dtpUnitFolder + "\n");
 
164,15 → 166,19
batRunner.write("md " + dtpUnitFolder + Globals.INTRANET_DTP_FichaAvaliacao + "\\\n");
batRunner.write("md " + dtpUnitFolder + Globals.INTRANET_DTP_InqueritoPedagogico + "\\\n");
batRunner.write("cd " + semestreUnitName + "\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /p \"Domain Users\":n\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /p \"Authenticated Users\":n\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /p \"Intranet\":n\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /p \"Alunos\":n\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /r \"Domain Users\"\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /r \"Authenticated Users\"\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /r \"Intranet\"\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /r \"Alunos\"\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"Docentes\":r\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + c.getUserGroupStudents() + "\":r\n");
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + ConfigProperties.getProperty("ionline.user") + "\":f\n");
 
 
/*
echo CACLS Seminario.Ii /T /E /R [NOME DO GRUPO DE TODOS OS ALUNOS DA ESTG tira os parentisis rectos]
echo CACLS Seminario.Ii /T /E /G [NOME DO GRUPO DE TODOS OS DOCENTES]:R
193,6 → 199,11
if(t.getUsername() != null)
{
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + t.getUsername() + "\":c\n");
//batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /r \"" + t.getUsername() + "\":c\n");
batRunner.write("cd " + Globals.INTRANET_DTP + "\n");
batRunner.write("cacls " + Globals.INTRANET_DTP_FichaCurricular + " /t /e /r \"" + t.getUsername() + "\"\n");
//batRunner.write("cacls " + Globals.INTRANET_DTP_FichaAvaliacao + " /t /e /r \"" + t.getUsername() + "\"\n");
batRunner.write("cd ..\\\n");
batRunner.write("cacls " + Globals.INTRANET_CONTENTS + " /t /e /g \"" + t.getUsername() + "\":c\n");
//users += " " + t.getUsername();
//counter++;
204,14 → 215,28
if(Globals.INTRANET_DTP_CourseUnitResponsibleWrite && courseUnit.getResponsableTeacher() != null )
{
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + courseUnit.getResponsableTeacher().getUsername() + "\":c\n");
batRunner.write("cd " + Globals.INTRANET_DTP + "\n");
batRunner.write("cacls " + Globals.INTRANET_DTP_FichaCurricular + " /t /e /r \"" + courseUnit.getResponsableTeacher().getUsername() + "\"\n");
batRunner.write("cacls " + Globals.INTRANET_DTP_FichaAvaliacao + " /t /e /r \"" + courseUnit.getResponsableTeacher().getUsername() + "\"\n");
batRunner.write("cd ..\\\n");
 
}
if(Globals.INTRANET_DTP_CourseCoordinatorWrite && c.getCoordinator() != null)
{
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + c.getCoordinator().getUsername() + "\":c\n");
batRunner.write("cd " + Globals.INTRANET_DTP + "\n");
batRunner.write("cacls " + Globals.INTRANET_DTP_FichaCurricular + " /t /e /r \"" + c.getCoordinator().getUsername() + "\"\n");
batRunner.write("cacls " + Globals.INTRANET_DTP_FichaAvaliacao + " /t /e /r \"" + c.getCoordinator().getUsername() + "\"\n");
batRunner.write("cd ..\\\n");
 
}
if(Globals.INTRANET_DTP_CourseDirectorWrite && c.getCoordinator() != null)
{
batRunner.write("cacls " + Globals.INTRANET_DTP + " /t /e /g \"" + c.getDirector().getUsername() + "\":c\n");
batRunner.write("cd " + Globals.INTRANET_DTP + "\n");
batRunner.write("cacls " + Globals.INTRANET_DTP_FichaCurricular + " /t /e /r \"" + c.getDirector().getUsername() + "\"\n");
batRunner.write("cacls " + Globals.INTRANET_DTP_FichaAvaliacao + " /t /e /r \"" + c.getDirector().getUsername() + "\"\n");
batRunner.write("cd ..\\\n");
}
batRunner.write("cd ..\\..\\\n");
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/courseunitevaluation.fo.xsl
New file
0,0 → 1,275
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:uc="http://baco.estgp.pt/schemas/courseunits/program/">
<xsl:param name="site">http://localhost/bacoTESTE</xsl:param>
<xsl:param name="revisor">automático</xsl:param>
<xsl:param name="validadoCC">false</xsl:param>
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4Vertical" page-width="210mm" page-height="297mm"
margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm"
reference-orientation="0">
<fo:region-body region-name="body" margin-top="20mm" margin-bottom="10mm" margin-right="0"
margin-left="0"/>
 
<fo:region-before region-name="header" extent="15mm"/>
<fo:region-after region-name="footer" extent="1cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="A4HorizontalRot" page-width="210mm" page-height="297mm"
margin-top="0.5cm" margin-bottom="0.5cm" margin-left="0.5cm" margin-right="0.5cm"
reference-orientation="90">
<fo:region-body region-name="body" margin-top="20mm" margin-bottom="10mm" margin-right="0"
margin-left="0"/>
<fo:region-before region-name="header" extent="15mm"/>
<fo:region-after region-name="footer" extent="1cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="A4Horizontal" page-width="297mm" page-height="210mm"
margin-top="0.5cm" margin-bottom="0.5cm" margin-left="0.5cm"
margin-right="0.5cm">
<fo:region-body region-name="body" margin-top="20mm" margin-bottom="15mm" margin-right="0"
margin-left="0"/>
<fo:region-before region-name="header" extent="15mm"/>
<fo:region-after region-name="footer" extent="1cm"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="pages">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="pages" page-position="any"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
 
<!--LAYOUT DE PAGINA ESCOLHIDO-->
<fo:page-sequence master-reference="A4Vertical" initial-page-number="auto">
<xsl:call-template name="page"/>
</fo:page-sequence>
 
 
</fo:root>
</xsl:template>
 
 
<xsl:template name="page">
<fo:static-content flow-name="header">
 
<fo:block text-align="left" >
<fo:table width="100%" table-layout="fixed" border-bottom="1px solid black">
<fo:table-column column-width="100%"/>
 
 
<fo:table-body>
<fo:table-row>
<fo:table-cell >
<fo:block>
<fo:external-graphic height="auto" width="auto"
content-height="30">
<!--<xsl:attribute name="src">url('http://www.ipportalegre.pt/imagens/Logos/ESTG/Logotipo%20ESTG.jpg')</xsl:attribute>-->
<xsl:attribute name="src">url('<xsl:value-of select="$site"/>/imgs/logoestg.gif')</xsl:attribute>
</fo:external-graphic>
</fo:block>
<xsl:if test="//closed = 'false'">
<fo:block font-size="20pt">
(Este documento não está fechado)
</fo:block>
</xsl:if>
<xsl:if test="//closed = 'true'">
<fo:block font-size="20pt">
 
</fo:block>
</xsl:if>
</fo:table-cell>
 
</fo:table-row>
 
</fo:table-body>
</fo:table>
 
</fo:block>
 
 
</fo:static-content>
<fo:static-content flow-name="footer">
 
<fo:table width="100%" table-layout="fixed" border-top="1px solid black" font-size="6.5pt" >
<fo:table-column column-width="20%"/>
<fo:table-column column-width="80%" />
 
 
<fo:table-body>
<fo:table-row>
<fo:table-cell padding-top="3pt">
<fo:block >
Revisto a <xsl:value-of select="//updateDate"/> por <xsl:value-of select="$revisor"/> / Página <fo:page-number/>
</fo:block>
<fo:block font-size="5pt">
ESTG.SA.xxxx.1
</fo:block>
 
</fo:table-cell>
<fo:table-cell padding-top="3pt" >
<fo:block font-size="6pt" text-align="right">
http://www.estgp.pt | gerado pela plataforma baco® 2015
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
 
<fo:flow flow-name="body">
<fo:block>
<xsl:apply-templates select="/CourseUnitEvaluation"/>
</fo:block>
</fo:flow>
</xsl:template>
 
<xsl:template match="/CourseUnitEvaluation">
 
<fo:table table-layout="fixed" border="0px solid black" margin="0.5em" font-size="8.5pt">
<xsl:call-template name="gen_cols"/>
<fo:table-body text-align="left">
 
<xsl:call-template name="gen_header"/>
 
<xsl:call-template name="gen_line"/>
 
</fo:table-body>
</fo:table>
</xsl:template>
 
<xsl:template name="gen_cols">
<fo:table-column column-width="15em" />
<fo:table-column/>
</xsl:template>
 
 
 
 
<xsl:template name="gen_header">
 
</xsl:template>
 
 
 
 
 
 
 
 
<xsl:attribute-set name="myBorder">
<xsl:attribute name="border">solid 0.2mm black</xsl:attribute>
</xsl:attribute-set>
 
<xsl:template name="gen_line">
 
<fo:table-row background-color="#FFF" color="#000" padding="0">
 
<fo:table-cell border-right="1px solid gray" border-bottom="1px solid gray" display-align="center" >
<fo:block text-align="right" padding="3pt" font-weight="bold">
Dados relativos ao processo de avaliação
</fo:block>
</fo:table-cell>
 
<fo:table-cell border-bottom="1px solid gray" padding="0" padding-top="5px" padding-bottom="5px" padding-left="0mm" display-align="center">
 
 
<fo:table margin="0" margin-left="0mm" border="0px solid black" font-size="5.5pt" >
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" number-rows-spanned="2" padding-top="3pt"><fo:block > Nº Alunos Inscritos </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" number-rows-spanned="2" padding-top="3pt"><fo:block > Nº de alunos sem elementos de avaliação </fo:block> </fo:table-cell>
 
<fo:table-cell xsl:use-attribute-sets="myBorder" number-rows-spanned="1" number-columns-spanned="5" padding-top="3pt" display-align="center"><fo:block display-align="center"> Nº de alunos aprovados em </fo:block> </fo:table-cell>
 
<fo:table-cell xsl:use-attribute-sets="myBorder" number-rows-spanned="2" padding-top="3pt"><fo:block > Aprovados com a classificação entre 10 e 13 valores (%) </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" number-rows-spanned="2" padding-top="3pt"><fo:block > Aprovados com a classificação entre 14 e 16 valores (%) </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" number-rows-spanned="2" padding-top="3pt"><fo:block > Aprovados com a classificação entre 17 e 20 valores (%) </fo:block> </fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > Avaliação de frequência </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > Exame Época Normal </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > Exame Época Recurso </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > Exame Época Especial </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > Total </fo:block> </fo:table-cell>
 
</fo:table-row>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosInscritos"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosSemElementosAvaliacao"/> </fo:block> </fo:table-cell>
 
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosAprovFrequencia"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosAprovNormal"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosAprovRecurso"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosAprovEspecial"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosAprovTotal"/> </fo:block> </fo:table-cell>
 
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosAprov1013"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosAprov1416"/> </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding-top="3pt"><fo:block > <xsl:value-of select="//numAlunosAprov1720"/> </fo:block> </fo:table-cell>
 
</fo:table-row>
</fo:table-body>
</fo:table>
 
 
</fo:table-cell>
 
 
 
</fo:table-row>
 
<fo:table-row background-color="#FFF" color="#000">
<fo:table-cell border-bottom="1px solid gray" border-right="1px solid gray" padding-right="0.1em" display-align="center">
<fo:block text-align="center" font-weight="bold">Auto-avaliação</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom="1px solid gray" display-align="center" padding="5px">
 
 
<fo:table margin="0" margin-left="0mm" border="0px solid black" font-size="5.5pt" >
<fo:table-column column-width="20%"/>
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" display-align="center" padding="3pt"><fo:block font-weight="bold"> Apreciação dos resultados quantitativos obtidos pelos estudantes </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block > <xsl:value-of select="//qualApreciacaoQuantitivos"/> </fo:block> </fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" display-align="center" padding="3pt"><fo:block font-weight="bold"> Apreciação do funcionamento da UC (Condições de funcionamento da UC; problemas detetados; identificação de práticas pedagógicas de mérito ou deficientes; etc.) </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block > <xsl:value-of select="//qualApreciacaoUC"/> </fo:block> </fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" display-align="center" padding="3pt"><fo:block font-weight="bold"> Apreciação do cumprimento do programa da UC (Adequação das metodologias de ensino/aprendizagem utilizadas; competências efetivamente adquiridas e cumprimento dos conteúdos planificados) </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block > <xsl:value-of select="//qualApreciacaoCumprimentoPrograma"/> </fo:block> </fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="myBorder" display-align="center" padding="3pt"><fo:block font-weight="bold"> Conclusões (Pontos fortes e fracos; sugestões de melhoria e respetivo plano de ação para a sua concretização) </fo:block> </fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="myBorder" padding="3pt"><fo:block > <xsl:value-of select="//qualConclusoes"/> </fo:block> </fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
 
 
</fo:table-cell>
</fo:table-row>
 
 
</xsl:template>
 
 
 
 
 
 
 
</xsl:stylesheet>
Property changes:
Added: svn:executable
+ *
/impl/src/java/pt/estgp/estgweb/services/ftpservices/FtpService.java
27,7 → 27,7
 
private static final Logger logger = Logger.getLogger(FtpService.class);
 
private static final String FTP_PASSWORD = "pt.estgp.estgweb.services.ftpservices.FtpService.FTP_PASSWORD";
public static final String FTP_PASSWORD = "pt.estgp.estgweb.services.ftpservices.FtpService.FTP_PASSWORD";
 
 
public String run(FtpRequestForm ftpRequestForm, UserSession userSession) throws IOException
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitEvaluationView.java
2,8 → 2,6
 
import pt.estgp.estgweb.domain.CourseUnitEvaluation;
import pt.estgp.estgweb.domain.CourseUnitEvaluationImpl;
import pt.estgp.estgweb.domain.CourseUnitProgram;
import pt.estgp.estgweb.domain.CourseUnitProgramImpl;
 
import java.io.Serializable;
 
19,6 → 17,7
 
 
private CourseUnitEvaluation courseUnitEvaluation;
private boolean fechar = false;
 
public Class getReferenceClass()
{
67,4 → 66,12
c.setQualApreciacaoUC(courseUnitEvaluation.getQualApreciacaoUC());
c.setQualConclusoes(courseUnitEvaluation.getQualConclusoes());
}
 
public boolean isFechar() {
return fechar;
}
 
public void setFechar(boolean fechar) {
this.fechar = fechar;
}
}
/impl/src/java/pt/estgp/estgweb/domain/CourseUnitEvaluationImpl.java
1,13 → 1,172
package pt.estgp.estgweb.domain;
 
import org.apache.fop.apps.FOPException;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.dom.DOMDocumentFactory;
import pt.estgp.estgweb.services.courseunits.SaveCourseUnitEvaluation;
 
import javax.xml.transform.TransformerException;
import java.beans.ExceptionListener;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
 
/**
* Created by jorgemachado on 03/06/14.
*/
 
/**
 
 
 
 
 
 
 
 
 
 
 
 
private String qualConclusoes;
*/
public class CourseUnitEvaluationImpl extends CourseUnitEvaluation {
@Override
public Serializable getSerializable() {
return getId();
}
public CourseUnitEvaluationImpl() {
}
 
 
public Document getDom(){
Document dom = DOMDocumentFactory.getInstance().createDocument();
Element elemCourseUnitEvaluationImpl = dom.addElement("CourseUnitEvaluation");
 
Element id = elemCourseUnitEvaluationImpl.addElement("id");
id.setText(getId()+"");
 
Element updateDate = elemCourseUnitEvaluationImpl.addElement("updateDate");
updateDate.setText(getUpdateDate()+"");
 
Element saveDate = elemCourseUnitEvaluationImpl.addElement("saveDate");
saveDate.setText(getSaveDate()+"");
 
Element closed = elemCourseUnitEvaluationImpl.addElement("closed");
closed.setText(isClosed()+"");
 
Element numAlunosInscritos = elemCourseUnitEvaluationImpl.addElement("numAlunosInscritos");
numAlunosInscritos.setText(getNumAlunosInscritos()+"");
 
Element numAlunosSemElementosAvaliacao = elemCourseUnitEvaluationImpl.addElement("numAlunosSemElementosAvaliacao");
numAlunosSemElementosAvaliacao.setText(getNumAlunosSemElementosAvaliacao()+"");
 
Element numAlunosAprovFrequencia = elemCourseUnitEvaluationImpl.addElement("numAlunosAprovFrequencia");
numAlunosAprovFrequencia.setText(getNumAlunosAprovFrequencia()+"");
 
Element numAlunosAprovNormal = elemCourseUnitEvaluationImpl.addElement("numAlunosAprovNormal");
numAlunosAprovNormal.setText(getNumAlunosAprovNormal()+"");
 
Element numAlunosAprovRecurso = elemCourseUnitEvaluationImpl.addElement("numAlunosAprovRecurso");
numAlunosAprovRecurso.setText(getNumAlunosAprovRecurso()+"");
 
Element numAlunosAprovEspecial = elemCourseUnitEvaluationImpl.addElement("numAlunosAprovEspecial");
numAlunosAprovEspecial.setText(getNumAlunosAprovEspecial()+"");
 
Element numAlunosAprovTotal = elemCourseUnitEvaluationImpl.addElement("numAlunosAprovTotal");
numAlunosAprovTotal.setText(getNumAlunosAprovTotal()+"");
 
Element numAlunosAprov1013 = elemCourseUnitEvaluationImpl.addElement("numAlunosAprov1013");
numAlunosAprov1013.setText(getNumAlunosAprov1013()+"");
 
Element numAlunosAprov1416 = elemCourseUnitEvaluationImpl.addElement("numAlunosAprov1416");
numAlunosAprov1416.setText(getNumAlunosAprov1416()+"");
 
Element numAlunosAprov1720 = elemCourseUnitEvaluationImpl.addElement("numAlunosAprov1720");
numAlunosAprov1720.setText(getNumAlunosAprov1720()+"");
 
Element numAlunosAprovados = elemCourseUnitEvaluationImpl.addElement("numAlunosAprovados");
numAlunosAprovados.setText(getNumAlunosAprovados()+"");
 
Element numAlunosReprovados = elemCourseUnitEvaluationImpl.addElement("numAlunosReprovados");
numAlunosReprovados.setText(getNumAlunosReprovados()+"");
 
Element qualApreciacaoQuantitivos = elemCourseUnitEvaluationImpl.addElement("qualApreciacaoQuantitivos");
qualApreciacaoQuantitivos.setText(getQualApreciacaoQuantitivos()+"");
 
Element qualApreciacaoUC = elemCourseUnitEvaluationImpl.addElement("qualApreciacaoUC");
qualApreciacaoUC.setText(getQualApreciacaoUC()+"");
 
Element qualApreciacaoCumprimentoPrograma = elemCourseUnitEvaluationImpl.addElement("qualApreciacaoCumprimentoPrograma");
qualApreciacaoCumprimentoPrograma.setText(getQualApreciacaoCumprimentoPrograma()+"");
 
Element qualConclusoes = elemCourseUnitEvaluationImpl.addElement("qualConclusoes");
qualConclusoes.setText(getQualConclusoes()+"");
 
return dom;
}
 
public String writeXml() throws FileNotFoundException {
StringOutputStream sout = new StringOutputStream();
java.beans.XMLEncoder xe1 = new java.beans.XMLEncoder(sout);
xe1.setExceptionListener(new ExceptionListener() {
@Override
public void exceptionThrown(Exception e) {
System.out.println("Exception:" + e.toString());
}
});
//ObjectOutputStream oos = new ObjectOutputStream( baos );
xe1.writeObject(this);
xe1.flush();
xe1.close();
 
return sout.getString();
}
 
public static class StringOutputStream extends OutputStream {
 
StringBuilder mBuf = new StringBuilder();
 
public void write(int c) throws IOException {
mBuf.append((char) c);
}
 
public String getString() {
return mBuf.toString();
}
}
 
public static class Teste
{
public Teste(){}
private String nome;
 
public String getNome() {
return nome;
}
 
public void setNome(String nome) {
this.nome = nome;
}
}
public static void main(String [] args) throws IOException, TransformerException, FOPException {
CourseUnitEvaluationImpl cuv = new CourseUnitEvaluationImpl() {
@Override
public Serializable getSerializable() {
return 1;
}
};
cuv.setClosed(true);
cuv.setNumAlunosAprov1013(12);
cuv.setNumAlunosInscritos("" + 20);
cuv.setQualConclusoes("conclusoes");
SaveCourseUnitEvaluation s = new SaveCourseUnitEvaluation();
CourseUnit cu = new CourseUnitImpl();
cu.setNormalizedName("teste");
cu.setCode("TESTE");
s.generatePdf(cuv,cu);
}
 
}
/impl/src/java/pt/estgp/estgweb/web/tags/CanManageTag.java
70,8 → 70,8
 
 
IInternal iInternal = (IInternal) owned;
System.out.println("userSession: " + userSession);
System.out.println("iInternal: " + iInternal);
//System.out.println("userSession: " + userSession);
//System.out.println("iInternal: " + iInternal);
if((userSession==null || userSession.getUser() == null) && iInternal.isInternal())
{
return false;
/impl/src/java/pt/estgp/estgweb/web/FtpServer.java
46,6 → 46,7
{
FTPClient ftp = new FTPClient();
ftp.connect(host, port);
 
if (username != null)
ftp.user(username);
if (password != null)
/impl/src/java/pt/estgp/estgweb/web/LayoutController.java
131,24 → 131,31
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
String username = userSession != null ? userSession.getUsername() : "UNKNOWN";
 
String user = ConfigProperties.getProperty(serverStr + ".user");
String pass = ConfigProperties.getProperty(serverStr + ".pass");
 
 
if (path != null)
{
 
FtpServer ftpServer = FtpServer.getServer(server, user, pass);
boolean isStaticAccess = ConfigProperties.getBooleanProperty(serverStr+".use.default.credentials.to.updates.and.deletes");
String user;
String pass;
 
if(isStaticAccess)
{
user = ConfigProperties.getProperty(serverStr + ".user");
pass = ConfigProperties.getProperty(serverStr + ".pass");
}
else
{
logger.warn("Will access using user and pass authnenticated to connect FTP " + serverStr);
user= username;
pass= ((UserImpl)userSession.getUser()).getPop3PassDecrypted();
}
FtpServer ftpServer = FtpServer.getNewServer(server, user, pass);
FTPClient client = ftpServer.getClient();
if(!client.changeWorkingDirectory(path))
{
logger.warn("Trying user and pass to connect");
ftpServer = FtpServer.getNewServer(server,userSession.getUser().getPop3username(),((UserImpl)userSession.getUser()).getPop3PassDecrypted());
client = ftpServer.getClient();
if(!client.changeWorkingDirectory(path))
{
logger.warn(username + ": " + request.getRemoteAddr() + "cant access this area server:" + server + " and path:" + path);
throw new NotAuthorizedException("nao pode aceder a esta area");
}
throw new NotAuthorizedException("nao pode aceder a esta area");
}
FTPFile[] files = client.listFiles();
List<IFile> iFiles = new ArrayList<IFile>();
/impl/src/java/pt/estgp/estgweb/web/controllers/courseunits/CourseUnitsEvaluationController.java
5,15 → 5,10
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.domain.CourseUnitEvaluationImpl;
import pt.estgp.estgweb.domain.CourseUnitProgram;
import pt.estgp.estgweb.domain.CourseUnitProgramImpl;
import pt.estgp.estgweb.domain.CourseUnitProgramPart2Impl;
import pt.estgp.estgweb.domain.views.CourseUnitEvaluationView;
import pt.estgp.estgweb.domain.views.CourseUnitProgramView;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.filters.exceptions.NotFoundException;
import pt.estgp.estgweb.web.form.courseunits.CourseUnitEvaluationForm;
import pt.estgp.estgweb.web.form.courseunits.CourseUnitProgramForm;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
121,7 → 116,44
}
}
 
public ActionForward publishEvaluation(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
try
{
CourseUnitEvaluationForm cUF = (CourseUnitEvaluationForm) form;
 
long id = cUF.getCourseUnitView().getId();
CourseUnitEvaluationView cuV = cUF.getCourseUnitEvaluationView();
cuV.setFechar(true);
IServiceManager sm = ServiceManager.getInstance();
Object[] args = new Object[]{cuV, id};
sm.execute(RequestUtils.getRequester(request, response), "SaveCourseUnitEvaluation", args);
CourseUnitView cV = loadCourseUnitView(id,true,false, mapping, request, response);
cUF.setCourseUnitView(cV);
request.setAttribute("CourseUnitView", cV);
addMessage(request,"courseunit.evaluation.success");
return mapping.findForward("load");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (NotFoundException e)
{
return mapping.findForward("error404");
}
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
}
}
 
 
 
 
}
/impl/src/hbm/pt/estgp/estgweb/domain/CourseUnit.hbm.xml
28,6 → 28,7
<property name="validProgram" type="boolean" index="validProgramIndex"/>
<property name="status" type="boolean" index="statusIndex" />
<property name="contentsGrants" type="string"/>
<property name="evaluationStreamId" type="string" index="evaluationStreamIdIndex" />
<many-to-one name="validatorUser" class="pt.estgp.estgweb.domain.Teacher" lazy="false" outer-join="true"/>
<many-to-one name="course" class="pt.estgp.estgweb.domain.Course" lazy="false" outer-join="true"/>
<many-to-one name="courseUnitProgram" class="pt.estgp.estgweb.domain.CourseUnitProgram" lazy="false" outer-join="true"/>
/impl/src/web/user/courseunits/courseunitEvaluation.jsp
53,8 → 53,13
<div class="seccao">
<h2>
<bean:message key="courseunit.evaluation"/>
 
</h2>
<p class="WARNING"><bean:message key="courseunit.evaluation.warning"/></p>
<%
 
%>
 
<%
boolean editCoordinatorPart = false;
boolean editTeacherPart = false;
127,6 → 132,9
<html:hidden property="courseUnitView.id"/>
 
<%--DOCENTE--%>
<logic:equal value="true" name="CourseUnitEvaluationForm" property="courseUnitEvaluationView.fechar">
<p class="alert-success">Esta avaliação está publicada no DTP em formato PDF</p>
</logic:equal>
 
<table class="dataTable tableDisabled" width="100%">
<tr>
248,6 → 256,7
%>
 
<input type="button" value="<bean:message key="save"/>" onclick="set(form,'saveEvaluation');form.submit()"/>
<input type="button" value="FECHAR E PUBLICAR" onclick="set(form,'publishEvaluation');form.submit()"/>
<%
}
%>