Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1123 → Rev 1133

/impl/importRoutines.xml
21,15 → 21,15
<target name="courses">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportCourseService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<!--<arg value="201314"/>-->
<!--<arg value="201415"/>-->
<arg value="201516"/>
<arg value="201415"/>
<!--<arg value="201516"/>-->
</java>
</target>
<target name="teachers">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportTeachersService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<!--<arg value="201314"/>-->
<!--<arg value="201415"/>-->
<arg value="201516"/>
<arg value="201415"/>
<!--<arg value="201516"/>-->
</java>
</target>
<target name="students">
67,7 → 67,7
</java>
</target>
<target name="grades">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<!--<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="200809"/>
</java>
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
81,10 → 81,11
</java>
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201213"/>
</java>
</java>-->
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib">
<arg value="201314"/>
</java>
 
</target>
 
<target name="setAreas">
/impl/conf/language/MessageResources.properties
521,7 → 521,8
configuration.task.weekday=Dia da semana
configuration.task.monthday=Dia do Mês
configuration.task.now=Agendar para correr agora
 
configuration.tasks.canceled=Calcelado
configuration.tasks.saved=Tarefa agendada com sucesso
configuration.task.records=Registos de Tarefas Agendadas
configuration.task.log=Ficheiro de Registo
configuration.task.progress=Progresso
548,6 → 549,14
weekday.Sat=Sabados
weekday.Sun=Domingos
 
weekday.2=Segundas
weekday.3=Terças
weekday.4=Quartas
weekday.5=Quintas
weekday.6=Sextas
weekday.7=Sabados
weekday.1=Domingos
 
monthday.day=ao dia
weekday.day=às
day.time=às
/impl/conf/berserk/sd.xml
2225,10 → 2225,24
</filterChains>
</service>
 
<service>
<name>SaveJobServiceTaskScheduler</name>
<implementationClass>pt.estgp.estgweb.services.jobs.JobScheduleService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>save</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
saveJobServiceTaskScheduler
 
 
 
 
 
 
 
</serviceDefinitions>
/impl/src/java/pt/estgp/estgweb/services/sigesimports/CleanCourseUnitsZeroStudents.java
New file
0,0 → 1,72
package pt.estgp.estgweb.services.sigesimports;
 
import jomm.dao.impl.AbstractDao;
import org.hibernate.Query;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.dao.DaoFactory;
 
import java.util.Iterator;
 
/**
* Created by jorgemachado on 01/12/15.
*/
public class CleanCourseUnitsZeroStudents
{
public static void main(String[] args)
{
AbstractDao.getCurrentSession().beginTransaction();
 
 
Query q = AbstractDao.getCurrentSession().createQuery("select c.id from c in class " + CourseUnit.class.getName() +
" where size(c.students) = 0 and (c.importYear = '201415' or c.importYear='201516') order by c.importYear, c.semestre, c.code");
Iterator iter = q.iterate();
System.out.println("ANO;SEMESTRE;CODIGO;NOME;CODIGOCURSO;NOMECURSO");
while(iter.hasNext())
{
 
Long id = (Long) iter.next();
CourseUnit cu = DaoFactory.getCourseUnitDaoImpl().load(id);
System.out.println(cu.getImportYear() + ";" + cu.getSemestre() + ";" + cu.getCode() + ";" + cu.getName() + ";" + cu.getCourseCode() + ";" +cu.getCourseName());
boolean alert = false;
if(cu.getAnnouncements() != null && cu.getAnnouncements().size() > 0)
{
System.out.println("ALERT - Tem Announcements");
}
if(cu.getAssignements() != null && cu.getAssignements().size() > 0)
{
System.out.println("ALERT - Tem Assignements");
}
if(cu.getBlogs() != null && cu.getBlogs().size() > 0)
{
System.out.println("ALERT - Tem BLOGS");
}
if(cu.getCourseUnitEvaluation() != null)
{
System.out.println("ALERT - Tem Evaluation");
alert = true;
}
if(cu.getCourseUnitProgram() != null)
{
System.out.println("ALERT - Tem program");
alert = true;
}
if(cu.getSummaries() != null && cu.getSummaries().size() > 0)
{
System.out.println("ALERT - Tem SUMMARIES");
}
if(alert)
{
System.out.println(">>>>>>>>>>>>>>NAO APAGA");
}
else
{
System.out.println("+++++++++++++++CANDIDATA A APAGAR");
}
 
}
 
 
 
AbstractDao.getCurrentSession().getTransaction().commit();
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportGradesService.java
11,6 → 11,7
import pt.estgp.estgweb.services.email.SendEmailService;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.services.jobs.JobScheduleService;
import pt.estgp.estgweb.services.jobs.ServiceJob;
import pt.estgp.estgweb.services.logresults.ILogMessages;
import pt.estgp.estgweb.services.logresults.LogMessageTypeEnum;
import pt.estgp.estgweb.services.logresults.impl.DefaultLogMessage;
33,7 → 34,7
* @time 12:51:32
* @see pt.estgp.estgweb
*/
public class ImportGradesService implements IService
public class ImportGradesService extends ServiceJob implements IService
{
 
private static final Logger logger = Logger.getLogger(ImportGradesService.class);
46,23 → 47,31
{
DefaultLogMessages logMessages = new DefaultLogMessages();
logMessages.addMessage(new DefaultLogMessage("import.grades", LogMessageTypeEnum.INFO, "instituicao " + DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode() + " ano : " + year));
logger.info("starting grades import " + year);
logger.info(logMessages.getLastMessage());
serviceLogInfo(logMessages.getLastMessage());
Map<Integer,Integer> alunos = new HashMap<Integer,Integer>();
Map<String,String> alunoCadeira = new HashMap<String,String>();
 
int foundTotal = 0;
 
try
{
logger.info("Loading Epocas de avaliacao");
serviceLogInfo("Loading Epocas de avaliacao");
List<ConfigurationGradesEpocaAvaliacao> epocas = DaoFactory.getConfigurationGradesEpocaAvaliacaoDaoImpl().findAll();
if(epocas == null || epocas.size() == 0)
{
logMessages.addMessage(new DefaultLogMessage("import.grades",LogMessageTypeEnum.WARNING,"Sem Epocas de Avaliacao, por favor adicione as epocas ao sistema"));
logger.warn("Sem Epocas de Avaliacao, por favor adicione as epocas ao sistema");
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
return logMessages;
}
List<ConfigurationGradesStatusEpoca> statusEpocas = DaoFactory.getConfigurationGradesStatusEpocaDaoImpl().findAll();
if(statusEpocas == null || statusEpocas.size() == 0)
{
logMessages.addMessage(new DefaultLogMessage("import.grades",LogMessageTypeEnum.WARNING,"Sem Status de epocas de avaliacao, por favor adicione as epocas ao sistema"));
logger.warn("Sem Status de epocas de avaliacao, por favor adicione as epocas ao sistema");
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
return logMessages;
}
HashMap<String,String> mapaEpocasAvaliacao = new HashMap<String, String>();
88,18 → 97,21
{
logMessages.addMessage(new DefaultLogMessage("import.error",e.toString(),"erro na configuracao do WEB Service", LogMessageTypeEnum.INFO));
logger.fatal(e, e);
serviceLogFatal(logMessages.getLastMessage());
return logMessages;
}
ArrayOfNota arrayOfNotas = service.getSiGesWEBSoap().getNotas(new BigDecimal(DaoFactory.getConfigurationDaoImpl().getSigesInstitutionCode()), year);
List<Nota> notas = arrayOfNotas.getNota();
 
int i = 0;
foundTotal++;
for (Nota nota : notas)
{
if (i++ > MAX_COMMIT)
{
i = 0;
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
setProgress((int) (((float)foundTotal)/((float)notas.size())*100.0f));
commitPartially();
}
 
/**
113,7 → 125,9
*/
 
int codAluno = nota.getCodigoAluno().intValue();
alunos.put(codAluno,codAluno);
int codUnidade = nota.getCodigoDisciplina().intValue();
alunoCadeira.put(codAluno + "$" + codUnidade,codAluno + "$" + codUnidade);
int codCurso = nota.getCodigoCurso().intValue();
String cdDuracao = nota.getCdDuracao();
int valor = nota.getNota().intValue();
167,11 → 181,15
else
{
logMessages.addMessage(new DefaultLogMessage("import.warning","","CourseUnit: " + codUnidade + " course: " + codCurso + " student: " + s.getSigesCode() + " semestre: " + cdDuracao + " year: " + year + " does not exist", LogMessageTypeEnum.WARNING));
logger.warn("CourseUnit: " + codUnidade + " course: " + codCurso + " student: " + s.getSigesCode() + " semestre: " + cdDuracao + " year: " + year + " does not exist");
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
}
}catch(Exception e)
{
logger.warn("Error : unit:" + codUnidade + " course:" + codCurso + " student:" + s.getId(),e);
 
logMessages.addMessage(new DefaultLogMessage("import.warning","","Error : unit:" + codUnidade + " course:" + codCurso + " student:" + s.getId(), LogMessageTypeEnum.WARNING));
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
}
 
}
179,12 → 197,14
{
if(descricaoEpoca == null)
{
logger.info(epoca + "-" + momento + " nao esta catalogada para atribuicao de nota");
logMessages.addMessage(new DefaultLogMessage("import.warning","",epoca + "-" + momento + " nao esta catalogada para atribuicao de nota", LogMessageTypeEnum.WARNING));
logger.info(logMessages.getLastMessage());
serviceLogInfo(logMessages.getLastMessage());
}else
{
logMessages.addMessage(new DefaultLogMessage("import.warning","","Student: " + codAluno + " does not exist", LogMessageTypeEnum.WARNING));
logger.warn("Student: " + codAluno + " does not exist");
logger.warn(logMessages.getLastMessage());
serviceLogWarn(logMessages.getLastMessage());
}
 
}
192,19 → 212,39
}
sendSms(null);
sendEmail(null);
 
 
//AbstractDao.getCurrentSession().getTransaction().commit();
}
catch (Throwable e)
{
logger.error(e, e);
 
 
//AbstractDao.getCurrentSession().getTransaction().rollback();
logMessages.addMessage(new DefaultLogMessage("import.error", e.toString(), "see log for details", LogMessageTypeEnum.ERROR));
serviceLogError(logMessages.getLastMessage());
throw new ServiceException(e.toString(), e);
}
setProgress(100);
logger.info("######################################");
serviceLogInfo("######################################");
logger.info("######################################");
serviceLogInfo("######################################");
logger.info("STATS " + year);
serviceLogInfo("STATS " + year);
logger.info("Total Notas: " + foundTotal);
serviceLogInfo("Total Notas: " + foundTotal);
logger.info("Alunos: " + alunos.size());
serviceLogInfo("Alunos: " + alunos.size());
logger.info("Notas de Alunos em cadeiras: " + alunoCadeira.size());
serviceLogInfo("Notas de Alunos em cadeiras: " + alunoCadeira.size());
 
 
 
logMessages.addMessage(new DefaultLogMessage("import.teachers.terminating", LogMessageTypeEnum.INFO));
logger.info("terminating grades import");
logger.info(logMessages.getLastMessage());
serviceLogInfo(logMessages.getLastMessage());
return logMessages;
}
 
271,6 → 311,7
}
}
 
 
/**
* Testar por aqui poi requer Super Role e assim e' autmatico
*
288,4 → 329,9
}
 
 
@Override
protected ILogMessages runJobServiceTask() throws Throwable {
String importYear = getParametersMap().get(JOB_importYear_KEY).getObject();
return run(importYear);
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportStudentsService.java
481,9 → 481,6
student.setBirthDate(alunoSiges.getDataNascimento().toGregorianCalendar().getTime());
student.setUsername("a" + alunoSiges.getCodigo().intValue());
}
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
 
@Override
protected ILogMessages runJobServiceTask() throws Throwable {
 
/impl/src/java/pt/estgp/estgweb/services/sigesimports/SincronizeLastYearCourseUnitProgramsService.java
386,10 → 386,6
}
 
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
public static final String JOB_cloneOnlyNews_KEY = "JOB_cloneOnlyNews_KEY";
public static final String JOB_generateAllPdfs_KEY = "JOB_generateAllPdfs_KEY";
public static final String JOB_validate_KEY = "JOB_validade_KEY";
 
/**
* Parameters for ServiceJob
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportCourseService.java
333,7 → 333,6
}
}
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
 
@Override
protected ILogMessages runJobServiceTask() throws Throwable {
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportSumariesJson.java
166,6 → 166,16
for(Aula aula: arrayOfAulas.getAula())
{
 
if(c.getCdTurma() != null && aula.getAulaCodigoTurma()!=null
&& c.getCdTurma().trim().length() > 0
&& aula.getAulaCodigoTurma().trim().length() > 0
&& !aula.getAulaCodigoTurma().equals(c.getCdTurma()))
{
//Código de Turma diferente
System.out.println("Ignoring summary code: " + aula.getAulaCodigoTurma() + " for unit " + c.getName() + "/" + c.getCode() + " T:" + c.getCdTurma());
continue;
}
 
//CourseUnitSummary s = map.get(aula.getSumNumeroAula() + ":" + aula.getCodigoSumario());
//if(s == null)
//{
366,8 → 376,8
 
String year = DaoFactory.getConfigurationDaoImpl().getImportsDefaultImportYearCreateTransaction();
String semestre = null;
boolean sendIonline = true;
boolean sendEmail = true;
boolean sendIonline = false;
boolean sendEmail = false;
if(args != null && args.length > 0)
year = args[0];
 
393,11 → 403,6
}
 
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
public static final String JOB_semestre_KEY = "JOB_semestre_KEY";
public static final String JOB_sendIonline_KEY = "JOB_sendIonline_KEY";
public static final String JOB_sendEmail_KEY = "JOB_sendEmail_KEY";
 
@Override
protected ILogMessages runJobServiceTask() throws Throwable {
 
/impl/src/java/pt/estgp/estgweb/services/jobs/JobScheduleService.java
143,6 → 143,125
DaoFactory.getJobServiceTaskSchedulerDaoImpl().delete(persistent);
}
 
public void save(JobServiceTaskSchedulerImpl scheduler
,String jobCloneOnlyNewsKey
,String jobJobGenerateAllPdfsKey
,String jobJobImportYearKey
,String jobJobSemestreKey
,String jobSendEmailKey
,String jobSendIonlineKey
,String jobJobValidateKey
,UserSession sess)
{
JobServiceTaskSchedulerImpl persistent;
if(scheduler.getId() <= 0)
{
persistent = DomainObjectFactory.createJobServiceTaskSchedulerImpl();
persistent.setSaveDate(new Date());
persistent.setActive(false);
persistent.setCreatedBy(sess.getUser());
DaoFactory.getJobServiceTaskSchedulerDaoImpl().save(persistent);
 
logger.info("Will create task scheduller " + persistent.getTargetService() + " id:" + scheduler.getId());
}
else
{
persistent = (JobServiceTaskSchedulerImpl) DaoFactory.getJobServiceTaskSchedulerDaoImpl().load(scheduler.getId());
logger.warn("Will update task scheduller " + persistent.getTargetService() + " id:" + scheduler.getId());
}
 
persistent.setTargetService(scheduler.getTargetService());
persistent.setDaily(scheduler.isDaily());
persistent.setMonthly(scheduler.isMonthly());
persistent.setWeekly(scheduler.isWeekly());
 
persistent.setHour(scheduler.getHour());
persistent.setMinute(scheduler.getMinute());
persistent.setSecond(scheduler.getSecond());
persistent.setDescription(scheduler.getDescription());
 
Set<JobServiceTaskSchedulerParameter> params = persistent.getServiceTaskSchedulerParameters();
if(persistent.getTargetService().equals(ImportCourseService.class.getName()) ||
persistent.getTargetService().equals(ImportGradesService.class.getName()) ||
persistent.getTargetService().equals(ImportStudentsService.class.getName()) ||
persistent.getTargetService().equals(ImportTeachersService.class.getName()))
{
if(params == null || params.size() == 0)
{
createParameter(persistent,ServiceJob.JOB_importYear_KEY);
}
JobServiceTaskSchedulerParameter parameter = params.iterator().next();
parameter.setObject(jobJobImportYearKey);
}
else if(persistent.getTargetService().equals(ImportSumariesJson.class.getName()))
{
if(params == null || params.size() == 0)
{
createParameter(persistent,ServiceJob.JOB_importYear_KEY);
createParameter(persistent,ServiceJob.JOB_semestre_KEY);
createParameter(persistent,ServiceJob.JOB_sendIonline_KEY);
createParameter(persistent,ServiceJob.JOB_sendEmail_KEY);
}
for(JobServiceTaskSchedulerParameter param:persistent.getServiceTaskSchedulerParameters())
{
if(param.getName().equals(ServiceJob.JOB_importYear_KEY))
{
param.setObject(jobJobImportYearKey);
}
else if(param.getName().equals(ServiceJob.JOB_semestre_KEY))
{
param.setObject(jobJobSemestreKey);
}
else if(param.getName().equals(ServiceJob.JOB_sendIonline_KEY))
{
param.setObject(jobSendIonlineKey);
}
else if(param.getName().equals(ServiceJob.JOB_sendEmail_KEY))
{
param.setObject(jobSendEmailKey);
}
}
 
}
else if(persistent.getTargetService().equals(SincronizeLastYearCourseUnitProgramsService.class.getName()))
{
if(params == null || params.size() == 0)
{
createParameter(persistent,ServiceJob.JOB_importYear_KEY);
createParameter(persistent,ServiceJob.JOB_cloneOnlyNews_KEY);
createParameter(persistent,ServiceJob.JOB_generateAllPdfs_KEY);
createParameter(persistent,ServiceJob.JOB_validate_KEY);
}
for(JobServiceTaskSchedulerParameter param:persistent.getServiceTaskSchedulerParameters())
{
if(param.getName().equals(ServiceJob.JOB_importYear_KEY))
{
param.setObject(jobJobImportYearKey);
}
else if(param.getName().equals(ServiceJob.JOB_cloneOnlyNews_KEY))
{
param.setObject(jobCloneOnlyNewsKey);
}
else if(param.getName().equals(ServiceJob.JOB_generateAllPdfs_KEY))
{
param.setObject(jobJobGenerateAllPdfsKey);
}
else if(param.getName().equals(ServiceJob.JOB_validate_KEY))
{
param.setObject(jobJobValidateKey);
}
}
}
}
 
private void createParameter(JobServiceTaskSchedulerImpl persistent,String name) {
JobServiceTaskSchedulerParameterImpl param = DomainObjectFactory.createJobServiceTaskSchedulerParameterImpl();
param.setJobServiceTaskScheduler(persistent);
persistent.getServiceTaskSchedulerParameters().add(param);
param.setName(name);
DaoFactory.getJobServiceTaskSchedulerParameterDaoImpl().save(param);
}
 
public static void main(String[] args) throws SQLException
{
AbstractDao.getCurrentSession().beginTransaction();
/impl/src/java/pt/estgp/estgweb/services/jobs/ServiceJob.java
22,7 → 22,15
public abstract class ServiceJob implements JobHandler
{
 
public static final String JOB_importYear_KEY = "JOB_importYear_KEY";
public static final String JOB_semestre_KEY = "JOB_semestre_KEY";
public static final String JOB_sendIonline_KEY = "JOB_sendIonline_KEY";
public static final String JOB_sendEmail_KEY = "JOB_sendEmail_KEY";
public static final String JOB_cloneOnlyNews_KEY = "JOB_cloneOnlyNews_KEY";
public static final String JOB_generateAllPdfs_KEY = "JOB_generateAllPdfs_KEY";
public static final String JOB_validate_KEY = "JOB_validade_KEY";
/*Log for service run*/
 
protected final Logger serviceLog = Logger.getLogger(ServiceJob.class);
 
/*Class regular log*/
/impl/src/java/pt/estgp/estgweb/domain/JobServiceTaskSchedulerImpl.java
53,4 → 53,55
return "unknown";
}
 
private String calendarization;
 
public String getCalendarization() {
 
if(calendarization == null)
{
if(isDaily())
return CalendarizationEnum.DAILY.name();
else if(isMonthly())
return CalendarizationEnum.MONTLY.name();
else if(isWeekly())
return CalendarizationEnum.WEEKLY.name();
else
return CalendarizationEnum.DAILY.name();
}
return calendarization;
 
}
 
public void setCalendarization(String calendarization) {
 
this.calendarization = calendarization;
CalendarizationEnum calendarizationEnum = CalendarizationEnum.parse(calendarization);
setDaily(false);
setMonthly(false);
setWeekly(false);
if(calendarizationEnum == CalendarizationEnum.DAILY)
setDaily(true);
else if(calendarizationEnum == CalendarizationEnum.MONTLY)
setMonthly(true);
else if(calendarizationEnum == CalendarizationEnum.WEEKLY)
setWeekly(true);
 
}
 
 
 
public enum CalendarizationEnum
{
DAILY,WEEKLY,MONTLY;
 
public static CalendarizationEnum parse(String cal)
{
if(cal == null)
return MONTLY;
for(CalendarizationEnum en: CalendarizationEnum.values())
if(en.name().equals(cal))
return en;
return MONTLY;
}
}
}
/impl/src/java/pt/estgp/estgweb/filters/filters/Session.java
36,13 → 36,14
 
public void execute(ServiceRequest request, ServiceResponse response, FilterParameters filterParameters) throws FilterException, Exception {
UserSessionImpl userSession = null;
Configuration config = DaoFactory.getConfigurationDaoImpl().loadSimpleConfigurationForConsult();
 
try
{
userSession = (UserSessionImpl) DaoFactory.getUserSessionDaoImpl().get((Serializable) request.getRequester());
 
if(userSession != null && userSession.getObjects() != null)
{
Configuration config = DaoFactory.getConfigurationDaoImpl().loadSimpleConfigurationForConsult();
userSession.setNowConfiguration(config);
for(SessionObject sessionObject: userSession.getObjects())
{
51,6 → 52,7
}
if(userSession != null && new Date().getTime() - userSession.getSaveDate().getTime() < TIMEOUT_SESSION)
{
userSession.setNowConfiguration(config);
putSessionInArgs(userSession,request);
userSession.setSaveDate(new Date()); //todo NOVO refrescar a sessao
return;
81,6 → 83,8
userSession.setUpdateDate(new Date());
DaoFactory.getUserSessionDaoImpl().saveOrUpdate(userSession);
// System.out.println(Thread.currentThread().getId() +"UPDATE: " + request.getRequester());
userSession.setNowConfiguration(config);
 
putSessionInArgs(userSession,request);
}
}
/impl/src/java/pt/estgp/estgweb/web/form/configuration/SchedulleTasksForm.java
18,13 → 18,82
private Long id;
 
 
private String jobImportYearKey;
private String jobSemestreKey;
private String jobSendIonlineKey;
private String jobSendEmailKey;
private String jobCloneOnlyNewsKey;
private String jobGenerateAllPdfsKey;
private String jobValidateKey;
 
 
 
 
 
public SchedulleTasksForm()
{
if(jobScheduller == null)
{
jobScheduller = DomainObjectFactory.createJobServiceTaskSchedulerImpl();
}
}
 
public String getJobImportYearKey() {
return jobImportYearKey;
}
 
public void setJobImportYearKey(String jobImportYearKey) {
this.jobImportYearKey = jobImportYearKey;
}
 
public String getJobSemestreKey() {
return jobSemestreKey;
}
 
public void setJobSemestreKey(String jobSemestreKey) {
this.jobSemestreKey = jobSemestreKey;
}
 
public String getJobSendIonlineKey() {
return jobSendIonlineKey;
}
 
public void setJobSendIonlineKey(String jobSendIonlineKey) {
this.jobSendIonlineKey = jobSendIonlineKey;
}
 
public String getJobSendEmailKey() {
return jobSendEmailKey;
}
 
public void setJobSendEmailKey(String jobSendEmailKey) {
this.jobSendEmailKey = jobSendEmailKey;
}
 
public String getJobCloneOnlyNewsKey() {
return jobCloneOnlyNewsKey;
}
 
public void setJobCloneOnlyNewsKey(String jobCloneOnlyNewsKey) {
this.jobCloneOnlyNewsKey = jobCloneOnlyNewsKey;
}
 
public String getJobGenerateAllPdfsKey() {
return jobGenerateAllPdfsKey;
}
 
public void setJobGenerateAllPdfsKey(String jobGenerateAllPdfsKey) {
this.jobGenerateAllPdfsKey = jobGenerateAllPdfsKey;
}
 
public String getJobValidateKey() {
return jobValidateKey;
}
 
public void setJobValidateKey(String jobValidateKey) {
this.jobValidateKey = jobValidateKey;
}
 
public JobServiceTaskSchedulerImpl getDirectory()
{
if(jobScheduller == null)
32,6 → 101,10
return jobScheduller;
}
 
public JobServiceTaskSchedulerImpl getJobScheduller() {
return jobScheduller;
}
 
public void setJobScheduller(JobServiceTaskSchedulerImpl jobScheduller) {
this.jobScheduller = jobScheduller;
}
52,4 → 125,6
public void setJobServiceTask(JobServiceTaskImpl jobServiceTask) {
this.jobServiceTask = jobServiceTask;
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/controllers/configuration/SchedulerTasksController.java
4,10 → 4,10
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.domain.JobServiceTaskImpl;
import pt.estgp.estgweb.domain.JobServiceTaskScheduler;
import pt.estgp.estgweb.domain.JobServiceTaskSchedulerImpl;
import pt.estgp.estgweb.services.directories.xsd.*;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.services.directories.xsd.LeafT;
import pt.estgp.estgweb.services.directories.xsd.LeafTImpl;
import pt.estgp.estgweb.services.jobs.ServiceJob;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.web.form.configuration.DirectoriesForm;
20,7 → 20,6
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Iterator;
 
/**
* @author Jorge Machado
33,7 → 32,19
 
private static final Logger logger = Logger.getLogger(SchedulerTasksController.class);
 
public ActionForward newTask(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
 
 
SchedulleTasksForm sf = (SchedulleTasksForm) form;
sf.setJobScheduller(DomainObjectFactory.createJobServiceTaskSchedulerImpl());
return mapping.findForward("task");
}
 
public ActionForward load(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
50,7 → 61,39
try
{
JobServiceTaskSchedulerImpl d = (JobServiceTaskSchedulerImpl) sm.execute(RequestUtils.getRequester(request, response), "LoadJobServiceTaskScheduler", args, names);
for(JobServiceTaskSchedulerParameter p: d.getServiceTaskSchedulerParameters())
{
if(p.getName().equals(ServiceJob.JOB_importYear_KEY))
{
sf.setJobImportYearKey(p.getObject());
}else if(p.getName().equals(ServiceJob.JOB_semestre_KEY))
{
sf.setJobSemestreKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_cloneOnlyNews_KEY))
{
sf.setJobCloneOnlyNewsKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_generateAllPdfs_KEY))
{
sf.setJobGenerateAllPdfsKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_sendEmail_KEY))
{
sf.setJobSendEmailKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_sendIonline_KEY))
{
sf.setJobSendIonlineKey(p.getObject());
}
else if(p.getName().equals(ServiceJob.JOB_validate_KEY))
{
sf.setJobValidateKey(p.getObject());
}
}
 
sf.setJobScheduller(d);
 
}
catch (FilterChainFailedException e)
{
64,6 → 107,44
return mapping.findForward("task");
}
 
public ActionForward save(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable
{
 
 
SchedulleTasksForm sf = (SchedulleTasksForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{sf.getJobScheduller()
,sf.getJobCloneOnlyNewsKey()
,sf.getJobGenerateAllPdfsKey()
,sf.getJobImportYearKey()
,sf.getJobSemestreKey()
,sf.getJobSendEmailKey()
,sf.getJobSendIonlineKey()
,sf.getJobValidateKey()
};
 
try
{
sm.execute(RequestUtils.getRequester(request, response), "SaveJobServiceTaskScheduler", args, names);
addMessage(request, "configuration.tasks.saved");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
return mapping.findForward("tasks");
}
 
public ActionForward loadLog(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
239,234 → 320,21
return mapping.findForward("directory");
}
 
public ActionForward save(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable {
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
 
DirectoriesForm df = (DirectoriesForm) form;
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{df.getDirectory()};
 
try {
sm.execute(RequestUtils.getRequester(request, response), "SaveDirectoryService", args, names);
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
 
addMessage(request, "directories.saved");
 
return mapping.findForward("directories");
}
 
public ActionForward cancel(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
addMessage(request, "directories.canceled");
return mapping.findForward("directories");
addMessage(request, "configuration.tasks.canceled");
return mapping.findForward("tasks");
}
 
 
public ActionForward removeLeaf(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
LeafT leaf = LeafTImpl.removeLeaf(df.getDirectory(), idParent);
if(leaf == null)
{
addError(request,"directories.leaf.not.found",idParent);
return mapping.findForward("directories");
}
addMessage(request, "directories.removed.leaf", idParent);
leaf.getLeaf().add(new LeafTImpl());
return mapping.findForward("directory");
}
 
 
public ActionForward addRight(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
LeafT leaf = LeafTImpl.findLeaf(df.getDirectory(), idParent);
if(leaf == null)
{
addError(request,"directories.leaf.not.found",idParent);
return mapping.findForward("directories");
}
 
leaf.getRights().getRight().add(new RightImpl());
addMessage(request, "directories.add.right", idParent);
return mapping.findForward("directory");
}
 
public ActionForward removeRight(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
LeafT leaf = LeafTImpl.findLeaf(df.getDirectory(), idParent);
if(leaf == null)
{
addError(request,"directories.leaf.not.found",idParent);
return mapping.findForward("directories");
}
 
 
Iterator<RightsT.Right> iter = leaf.getRights().getRight().iterator();
while(iter.hasNext())
{
RightsT.Right r =iter.next();
if(r.getName().equals(df.getRname()) && r.getTarget().equals(df.getRtarget()) && df.getRtype().equals(r.getType()))
{
iter.remove();
}
}
addMessage(request, "directories.remove.right", df.getRname(),df.getRtarget(),df.getRtype());
return mapping.findForward("directory");
}
 
public ActionForward addDirRight(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
df.getDirectory().getRights().getRight().add(new RightImpl());
addMessage(request, "directories.add.right");
return mapping.findForward("directory");
}
 
public ActionForward removeDirRight(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
 
Iterator<RightsT.Right> iter = df.getDirectory().getRights().getRight().iterator();
while(iter.hasNext())
{
RightsT.Right r =iter.next();
if(r.getName().equals(df.getRname()) && r.getTarget().equals(df.getRtarget()) && df.getRtype().equals(r.getType()))
{
iter.remove();
}
}
addMessage(request, "directories.remove.right", df.getRname(),df.getRtarget(),df.getRtype());
return mapping.findForward("directory");
}
 
public ActionForward addDirGroup(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
String idParent = df.getId();
 
df.getDirectory().getGroupsDeclaration().getGroup().add(new GroupImpl());
addMessage(request, "directories.add.group");
return mapping.findForward("directory");
}
 
public ActionForward removeDirGroup(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
 
if(!UserSessionProxy.loadUserSessionFromRequest(request).getUser().isAdmin() && !UserSessionProxy.loadUserSessionFromRequest(request).getUser().hasRole("services"))
{
return mapping.findForward("error401");
}
DirectoriesForm df = (DirectoriesForm) form;
 
Iterator<GroupDeclarationT.Group> iter = df.getDirectory().getGroupsDeclaration().getGroup().iterator();
while(iter.hasNext())
{
GroupDeclarationT.Group g =iter.next();
if(g.getName().equals(df.getRname()))
{
iter.remove();
}
}
addMessage(request, "directories.remove.group");
return mapping.findForward("directory");
}
 
 
 
}
/impl/src/web/auth/index.jsp
5,6 → 5,11
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSessionImpl" scope="request"/>
<html:errors/>
 
<%
 
%>
<div class="container">
<logic:notEmpty name="UserSession" property="nowConfiguration.openInfoIntranet">
<div class="row">
32,4 → 37,4
</div>
 
 
</div>
</div>
/impl/src/web/admin/courses/course.jsp
12,6 → 12,17
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<jsp:useBean id="CourseView" type="pt.estgp.estgweb.domain.views.CourseView" scope="request"/>
<script>
function alertPermissions()
{
alert("Este procedimento afecta as permissões atuais no sistema de ficheiros da intranet. Após salvar estas alterações, por favor gere o BAT de geração de pastas e corra-o novamente na raiz do servidor IONLINE")
}
function alertFolders(place)
{
alert("Caro administrador, lembramos-lhe que alterar o " + place + " de uma unidade curricular implica trocar a pasta de ficheiros da intranet do " + place + " onde esta se encontrava para o " + place + " onde actualmente se encontra. O BACO irá actualizar a nova LOCALIZAÇÃO da pasta de ficheiros na sua base de dados. Mas a pasta terá de ser fisicamente alterada pela administração de sistemas.");
}
 
</script>
<html:errors/>
<jomm:messages/>
<html:form action="/user/courseControllerFromServiceZone" enctype="multipart/form-data">
22,6 → 33,7
<bean:write name="CourseView" property="htmlResult"/>
</pre>
</logic:present>
 
<table class="form">
<tr>
<th>
79,7 → 91,7
<html:option value="O"><bean:message key="course.O"/></html:option>
<html:option value="T"><bean:message key="course.T"/></html:option>
</html:select>
** SIGES: <bean:write name="CourseForm" property="courseView.degree"/> - Confirmar Mestrados e Pos graduacoes e informar equipa de desenvolvimento
** SIGES: <bean:write name="CourseForm" property="courseView.degree"/> - Qualquer erro de atrbuição informar imediatamente a equipa de desenvolvimento
</td>
</tr>
<tr>
108,7 → 120,7
<bean:message key="course.userGroupStudents"/>
</th>
<td>
<html:text property="courseView.userGroupStudents"/>
<html:text onchange="alertPermissions()" property="courseView.userGroupStudents"/>
</td>
</tr>
 
125,7 → 137,7
<bean:message key="course.coordinator"/>
</th>
<td>
<html:select property="courseView.coordinator.id">
<html:select onchange="alertPermissions()" property="courseView.coordinator.id">
<html:option value="0">
<bean:message key="none"/>
</html:option>
144,7 → 156,7
<bean:message key="course.director"/>
</th>
<td>
<html:select property="courseView.director.id">
<html:select onchange="alertPermissions()" property="courseView.director.id">
<html:option value="0">
<bean:message key="none"/>
</html:option>
178,7 → 190,7
request.setAttribute("targetRoles",targetRoles);
%>
<td>
<html:select property="courseView.validationRole">
<html:select onchange="alertPermissions()" property="courseView.validationRole">
<logic:iterate id="role" name="targetRoles">
<html:option value="${role}" key="user.role.${role}"/>
</logic:iterate>
191,10 → 203,9
 
 
<tr>
<td>
 
<th>
<bean:message key="course.externalSite"/>
</td>
</th>
<td>
<html:select property="courseView.externalSiteServer">
<html:option value="estgp">ESTG</html:option>
/impl/src/web/admin/courseunits/courseunit.jsp
12,6 → 12,17
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<script>
function alertPermissions()
{
alert("Este procedimento afecta as permissões atuais no sistema de ficheiros da intranet. Após salvar estas alterações, por favor gere o BAT de geração de pastas e corra-o novamente na raiz do servidor IONLINE")
}
function alertFolders(place)
{
alert("Caro administrador, lembramos-lhe que alterar o " + place + " de uma unidade curricular implica trocar a pasta de ficheiros da intranet do " + place + " onde esta se encontrava para o " + place + " onde actualmente se encontra. O BACO irá actualizar a nova LOCALIZAÇÃO da pasta de ficheiros na sua base de dados. Mas a pasta terá de ser fisicamente alterada pela administração de sistemas.");
}
 
</script>
<%
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
62,7 → 73,7
<bean:message key="courseunit.course"/>
</th>
<td>
<html:select property="courseUnitView.courseId">
<html:select onchange="alertFolders('curso')" property="courseUnitView.courseId">
<logic:iterate id="course" name="Courses" type="pt.estgp.estgweb.domain.views.CourseView">
<html:option value="${course.id}">(${course.code}) ${course.name}</html:option>
</logic:iterate>
82,14 → 93,14
<bean:message key="courseunit.semestre"/>
</th>
<td>
<html:select property="courseUnitView.semestre">
<html:option value="S1">S1</html:option>
<html:option value="S2">S2</html:option>
<html:option value="A">A</html:option>
<html:option value="T1">T1</html:option>
<html:option value="T2">T2</html:option>
<html:option value="T3">T3</html:option>
<html:option value="T4">T4</html:option>
<html:select onchange="alertFolders('semestre')" property="courseUnitView.semestre">
<html:option value="S1"><bean:message key="courseunit.S1"/></html:option>
<html:option value="S2"><bean:message key="courseunit.S2"/></html:option>
<html:option value="A"><bean:message key="courseunit.A"/></html:option>
<html:option value="T1"><bean:message key="courseunit.T1"/></html:option>
<html:option value="T2"><bean:message key="courseunit.T2"/></html:option>
<html:option value="T3"><bean:message key="courseunit.T3"/></html:option>
<html:option value="T4"><bean:message key="courseunit.T4"/></html:option>
</html:select>
</td>
</tr>
98,7 → 109,7
<bean:message key="courseunit.importYear"/>
</th>
<td>
<html:select property="courseUnitView.importYear">
<html:select onchange="alertFolders('ano')" property="courseUnitView.importYear">
<logic:iterate id="item" name="CourseUnitsForm" property="importYears">
<html:option value="${item}">${item}</html:option>
</logic:iterate>
119,7 → 130,7
<bean:message key="courseunit.responsable"/>
</th>
<td>
<html:select property="courseUnitView.responsableId">
<html:select onchange="alertPermissions();" property="courseUnitView.responsableId">
<html:option value="0"></html:option>
<logic:iterate id="teacher" name="CourseUnitsForm" property="teachers" type="pt.estgp.estgweb.domain.views.UserView">
<html:option value="${teacher.id}">(${teacher.code}) ${teacher.name}</html:option>
146,7 → 157,7
</jomm:option>
</logic:iterate>
<input type="button" value="<bean:message key="add"/>"
onclick="set(this.form,'addTeacher');this.form.submit();">
onclick="alertPermissions();set(this.form,'addTeacher');this.form.submit();">
</logic:present>
</html:select>
<logic:greaterThan name="CourseUnitView" property="teachersSize" value="0">
183,7 → 194,7
<logic:greaterThan value="0" name="CourseUnitView" property="id">
<html:text styleClass="text" property="studentCode"/>
<input type="button" value="<bean:message key="add"/>"
onclick="if(this.form.studentCode.value=='0' || this.form.studentCode.value==''){alert('Por favor coloque o numero de aluno antes de adicionar');}else{set(this.form,'addStudent');this.form.submit();}">
onclick="if(this.form.studentCode.value=='0' || this.form.studentCode.value==''){alert('Por favor coloque o numero de aluno antes de adicionar');}else{alertPermissions();set(this.form,'addStudent');this.form.submit();}">
<logic:greaterThan name="CourseUnitView" property="studentsSize" value="0">
<table id="myTable" class="tablesorter dataTable removeButton">
/impl/src/web/admin/configuration/tasks.jsp
88,11 → 88,11
 
 
<a href="<%=request.getContextPath()%>/user/configurationJobTasks.do" style="float:right" class="btn btn-default"><span class="glyphicon glyphicon-list-alt">Consultar Todos os Logs</span></a>
<button type="button" style="float:right" class="btn btn-success" onclick="set(form,'new');form.submit();"><span class="glyphicon glyphicon-plus">Agendar</span></button>
<a href="<%=request.getContextPath()%>/user/configurationTasks.do?dispatch=newTask" style="float:right" class="btn btn-success" onclick="set(form,'new');form.submit();"><span class="glyphicon glyphicon-plus">Agendar</span></a>
<a href="<%=request.getContextPath()%>/user/configurationSchedulleTasks.do" class="btn btn-info"><span class="glyphicon glyphicon-refresh"></span></a>
</div>
<div class="panel-body">
<table id="myTable" class="tablesorter">
<table id="myTable" class="tablesorter tablesorterfiltered">
<thead>
<tr>
<th>Agora</th>
/impl/src/web/admin/configuration/task.jsp
2,6 → 2,8
<%@ page import="pt.estgp.estgweb.domain.JobServiceTaskScheduler" %>
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.utils.DatesUtils" %>
<%@ page import="com.sun.mail.handlers.image_gif" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
11,111 → 13,300
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib prefix="hmlt" uri="http://jakarta.apache.org/struts/tags-html" %>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<jsp:useBean id="SchedulleTasksForm" type="pt.estgp.estgweb.web.form.configuration.SchedulleTasksForm" scope="request"/>
<jomm:messages/>
<html:errors/>
 
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/variables.less"/>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/lavish-bootstrap.css"/>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/js/jquerytables/bootstrap/css/bootstrap.css"/>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/js/jquerytables/bootstrap/css/bootstrap-theme.css"/>
 
<script>
$(document).ready(function()
{
<logic:equal value="true" name="SchedulleTasksForm" property="jobScheduller.weekly">
$("#weekdaySelection").show();
$("#monthdaySelection").hide();
</logic:equal>
<logic:equal value="true" name="SchedulleTasksForm" property="jobScheduller.monthly">
$("#weekdaySelection").hide();
$("#monthdaySelection").show();
</logic:equal>
<logic:equal value="true" name="SchedulleTasksForm" property="jobScheduller.daily">
$("#weekdaySelection").hide();
$("#monthdaySelection").hide();
</logic:equal>
<logic:equal value="false" name="SchedulleTasksForm" property="jobScheduller.daily">
<logic:equal value="false" name="SchedulleTasksForm" property="jobScheduller.monthly">
<logic:equal value="false" name="SchedulleTasksForm" property="jobScheduller.weekly">
$("#weekdaySelection").hide();
$("#monthdaySelection").hide();
</logic:equal>
</logic:equal>
</logic:equal>
 
changeParameters();
 
<script src="<%=request.getContextPath()%>/js/jquerytables/jquery-2.1.4.min.js"></script>
<script src="<%=request.getContextPath()%>/js/jquerytables/bootstrap/js/bootstrap.min.js"></script>
}
);
function changeForms(calendarization)
{
if(calendarization == "DAILY")
{
$("#weekdaySelection").hide();
$("#monthdaySelection").hide();
}
else if(calendarization == "MONTLY")
{
$("#weekdaySelection").hide();
$("#monthdaySelection").show();
}
else if(calendarization == "WEEKLY")
{
$("#weekdaySelection").show();
$("#monthdaySelection").hide();
}
}
 
function changeParameters()
{
$("#jobImportYearKeyPart").hide();
$("#jobSemestreKeyPart").hide();
$("#jobSendIonlineKeyPart").hide();
$("#jobSendEmailKeyPart").hide();
$("#jobCloneOnlyNewsKeyPart").hide();
$("#jobGenerateAllPdfsKeyPart").hide();
$("#jobValidateKeyPart").hide();
 
type = $("#targetService").val();
if(type == "pt.estgp.estgweb.services.sigesimports.ImportCourseService")
{
$("#jobImportYearKeyPart").show();
}
else if(type == "pt.estgp.estgweb.services.sigesimports.ImportGradesService")
{
$("#jobImportYearKeyPart").show();
}
else if(type == "pt.estgp.estgweb.services.sigesimports.ImportTeachersService")
{
$("#jobImportYearKeyPart").show();
}
else if(type == "pt.estgp.estgweb.services.sigesimports.ImportStudentsService")
{
$("#jobImportYearKeyPart").show();
}
else if(type == "pt.estgp.estgweb.services.sigesimports.ImportSumariesJson")
{
$("#jobImportYearKeyPart").show();
$("#jobSemestreKeyPart").show();
$("#jobSendIonlineKeyPart").show();
$("#jobSendEmailKeyPart").show();
}
else if(type == "pt.estgp.estgweb.services.sigesimports.SincronizeLastYearCourseUnitProgramsService")
{
$("#jobImportYearKeyPart").show();
//$("#jobSemestreKeyPart").show();
$("#jobCloneOnlyNewsKeyPart").show();
$("#jobGenerateAllPdfsKeyPart").show();
$("#jobValidateKeyPart").show();
}
else
{
$("#jobImportYearKeyPart").show();
}
 
<%
AbstractDao.getCurrentSession().beginTransaction();
List<JobServiceTaskScheduler> schedulledTasks = DaoFactory.getJobServiceTaskSchedulerDaoImpl().findAll();
request.setAttribute("tasks",schedulledTasks);
%>
 
}
 
 
 
</script>
 
 
<div class="container-fluid">
<div class="panel panel-default">
<div class="panel-heading">
<bean:message key="configuration.tasks"/>
<button type="button" style="float:right" class="btn btn-default" onclick="set(form,'new');form.submit();"><span class="glyphicon glyphicon-list-alt">Consultar Todos os Logs</span></button>
<button type="button" style="float:right" class="btn btn-success" onclick="set(form,'new');form.submit();"><span class="glyphicon glyphicon-plus">Agendar</span></button>
<bean:message key="configuration.task"/>
</div>
<div class="panel-body">
<table class="datatable tablesorter">
<thead>
<tr>
<th><bean:message key="configuration.task"/></th>
<th>Tipo</th>
<th>Calendarização</th>
 
<th>Criador</th>
<th>Parametros</th>
<th>Última</th>
<th>Progresso</th>
<th></th>
</tr>
</thead>
<tbody>
<logic:iterate id="task" name="tasks" type="pt.estgp.estgweb.domain.JobServiceTaskSchedulerImpl">
<tr>
<td><bean:message key="targetService.${task.targetService}"/></td>
<td><bean:message key="configuration.task.${task.typeMsgKey}"/></td>
<td>
<logic:equal value="true" name="task" property="weekly">
<bean:message key="weekday.day"/> <bean:message key="weekday.${task.weekDayMsgKey}"/>
</logic:equal>
<logic:equal value="true" name="task" property="monthly">
<bean:message key="monthday.day"/> ${task.monthday}
</logic:equal>
<bean:message key="day.time"/>
${task.hour}:${task.minute}
</td>
<html:form action="/user/configurationTasks" >
<input type="hidden" name="dispatch" value="save"/>
<html:hidden property="jobScheduller.id"/>
<div class="form-group">
<label for="targetService">Tarefa:</label>
<html:select onchange="changeParameters()" property="jobScheduller.targetService" styleClass="form-control" styleId="targetService">
<html:option value="pt.estgp.estgweb.services.sigesimports.ImportCourseService">Importação de Cursos</html:option>
<html:option value="pt.estgp.estgweb.services.sigesimports.ImportGradesService">Importação de Notas</html:option>
<html:option value="pt.estgp.estgweb.services.sigesimports.ImportTeachersService">Importação de Docentes</html:option>
<html:option value="pt.estgp.estgweb.services.sigesimports.ImportStudentsService">Importação de Estudantes</html:option>
<html:option value="pt.estgp.estgweb.services.sigesimports.ImportSumariesJson">Importação de Sumários</html:option>
<html:option value="pt.estgp.estgweb.services.sigesimports.SincronizeLastYearCourseUnitProgramsService">Clonagem de Fichas Curriculares</html:option>
</html:select>
</div>
<div class="form-group">
<label for="description">Descrição:</label>
<html:textarea styleClass="form-control" styleId="description" property="jobScheduller.description"/>
</div>
<div class="form-group">
<label for="description">Calendarização:</label>
<html:select styleClass="form-control" property="jobScheduller.calendarization" onchange="changeForms(this.value)">
<html:option value="DAILY">Diário</html:option>
<html:option value="WEEKLY">Semanal</html:option>
<html:option value="MONTLY">Mensal</html:option>
</html:select>
</div>
<div class="form-group" id="weekdaySelection">
<label for="weekday">Dia da Semana:</label>
<html:select styleClass="form-control" styleId="weekday" property="jobScheduller.weekday">
<%
for(int i=1;i<=7;i++)
{
request.setAttribute("i",i);
%>
<html:option value="${i}"><bean:message key="weekday.${i}"/></html:option>
<%
}
%>
</html:select>
</div>
<div class="form-group" id="monthdaySelection">
<label for="monthday">Dia do Mês:</label>
<html:select styleClass="form-control" styleId="monthday" property="jobScheduller.monthday">
<%
for(int i=1;i<31;i++)
{
request.setAttribute("i",i);
%>
<html:option value="${i}">${i}</html:option>
<%
}
%>
</html:select>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-4">
<label for="hour">Hora:</label>
<html:select styleClass="form-control" styleId="hour" property="jobScheduller.hour">
<%
for(int i=0;i<24;i++)
{
request.setAttribute("i",i);
%>
<html:option value="${i}">${i}</html:option>
<%
}
%>
</html:select>
</div>
<div class="col-sm-4">
<label for="minute">Minuto:</label>
<html:select styleClass="form-control" styleId="minute" property="jobScheduller.minute">
<%
for(int i=0;i<60;i++)
{
request.setAttribute("i",i);
%>
<html:option value="${i}">${i}</html:option>
<%
}
%>
</html:select>
</div>
<div class="col-sm-4">
<label for="second">Segundo:</label>
<html:select styleClass="form-control" styleId="second" property="jobScheduller.second">
<%
for(int i=0;i<60;i++)
{
request.setAttribute("i",i);
%>
<html:option value="${i}">${i}</html:option>
<%
}
%>
</html:select>
</div>
</div>
</div>
<!--
;
 
<td>${task.createdBy.username}</td>
<td>
<table cellspacing="0" cellspadding="0">
<logic:iterate id="taskParam" name="task" property="serviceTaskSchedulerParameters" type="pt.estgp.estgweb.domain.JobServiceTaskSchedulerParameter">
<tr>
<td>
${taskParam.name}
</td>
<td>
${taskParam.object}
</td>
</tr>
</logic:iterate>
</table>
</td>
<td class="jobStatus${task.lastJobServiceTask.status}">
<logic:notEmpty name="task" property="lastJobServiceTask">
<bean:message key="job.status.${task.lastJobServiceTask.status}"/>
</logic:notEmpty>
</td>
<td style="text-align: right">
<logic:notEmpty name="task" property="lastJobServiceTask">
${task.lastJobServiceTask.progress} %
</logic:notEmpty>
</td>
 
<td>
<button type="button" class="btn btn-default">
<span class="glyphicon glyphicon-list-alt"></span>
</button>
private String jobGenerateAllPdfsKey;
private String jobValidateKey;-->
<div class="form-group" id="jobImportYearKeyPart">
<label for="jobImportYearKey">Ano:</label>
<%
List<String> years = DatesUtils.getImportYears(10);
%>
<html:select styleClass="form-control" styleId="jobImportYearKey" property="jobImportYearKey">
<%
for(String year:years)
{
request.setAttribute("year",year);
%>
<html:option value="${year}">${year}</html:option>
<%
}
%>
</html:select>
</div>
 
<div class="form-group" id="jobSemestreKeyPart">
<label for="jobSemestreKey">Semestre:</label>
<html:select styleClass="form-control" styleId="jobSemestreKey" property="jobSemestreKey">
<html:option value="A">Anual</html:option>
<html:option value="S1">Semestre 1</html:option>
<html:option value="S2">Semestre 2</html:option>
<html:option value="T1">Trimestre 1</html:option>
<html:option value="T2">Trimestre 2</html:option>
<html:option value="T3">Trimestre 3</html:option>
<html:option value="T4">Trimestre 4</html:option>
</html:select>
</div>
 
</td>
<div class="form-group" id="jobSendIonlineKeyPart">
<label for="jobSendIonlineKey">Enviar para a pasta do DTP:</label>
<html:select styleClass="form-control" styleId="jobSendIonlineKey" property="jobSendIonlineKey">
<html:option value="true">Sim</html:option>
<html:option value="false">Não</html:option>
</html:select>
</div>
 
</tr>
</logic:iterate>
</tbody>
<div class="form-group" id="jobSendEmailKeyPart">
<label for="jobSendEmailKey">Enviar email de notificação:</label>
<html:select styleClass="form-control" styleId="jobSendEmailKey" property="jobSendEmailKey">
<html:option value="true">Sim</html:option>
<html:option value="false">Não</html:option>
</html:select>
</div>
 
</table>
<div class="form-group" id="jobCloneOnlyNewsKeyPart">
<label for="jobCloneOnlyNewsKey">Clonar apenas quando não existe ficha (Se escolher não irá clonar também fichas inválidas):</label>
<html:select styleClass="form-control" styleId="jobCloneOnlyNewsKey" property="jobCloneOnlyNewsKey">
<html:option value="true">Sim</html:option>
<html:option value="false">Não</html:option>
</html:select>
</div>
 
<div class="form-group" id="jobGenerateAllPdfsKeyPart">
<label for="jobGenerateAllPdfsKey">Gerar PDF's mesmo que não clone as fichas:</label>
<html:select styleClass="form-control" styleId="jobGenerateAllPdfsKey" property="jobGenerateAllPdfsKey">
<html:option value="true">Sim</html:option>
<html:option value="false">Não</html:option>
</html:select>
</div>
 
<div class="form-group" id="jobValidateKeyPart">
<label for="jobValidateKey">Validar Fichas ao Clonar:</label>
<html:select styleClass="form-control" styleId="jobValidateKey" property="jobValidateKey">
<html:option value="true">Sim</html:option>
<html:option value="false">Não</html:option>
</html:select>
</div>
<button type="submit" class="btn btn-default"><bean:message key="confirm"/></button>
</html:form>
 
 
</div>
</div>
</div>
 
 
<%
AbstractDao.getCurrentSession().getTransaction().commit();
%>
</div>
/impl/src/web/css/intranet.css
9,7 → 9,7
{
background-color: lightsteelblue;
}
td.icons
.icons a img
{
width: 60px !important;
white-space: nowrap !important;
/impl/src/web/ping.jsp
New file
0,0 → 1,4
<%--
Serviço de PING para manter a sessao online
--%>
{"result" : "PING OK"}
/impl/src/web/layout/scripts.jsp
1,6 → 1,7
<%@ page import="pt.estgp.estgweb.web.filters.TopImageFilter" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<meta name="viewport" content="width=device-width, initial-scale=1">
 
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/yui/build/menu/assets/skins/sam/menu.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/yui/build/button/assets/skins/sam/button.css" />
8,13 → 9,20
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/yui/build/container/assets/skins/sam/container.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/yui/build/editor/assets/skins/sam/editor.css" />
 
 
<!--OFF CANVAS É PARA METER O BODY ABAIXO DO MENU DESLIZANTE DE TOPO-->
<!--<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/offcanvas.css"/>-->
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/style.css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/functions.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/ajax.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/compactedPopup.js"></script>
 
<!--
<style>
body
{
background: url('http://www.ist.utl.pt/img/page/cubes.png')
}
</style>-->
<!--
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/js/jquery/style.css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-latest.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.tablesorter.js"></script>
56,7 → 64,78
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/variables.less"/>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/lavish-bootstrap.css"/>
 
 
<script type="text/javascript" language="JavaScript">
var cal = new CalendarPopup();
 
/*
//TABLE SORTER
$(document).ready(function()
{
$("#myTable").tablesorter();
 
}
);
*/
 
function isBreakpoint( alias ) {
return $('.device-' + alias).is(':visible');
}
 
 
 
 
 
$(document).ready(
function(){
$("#network").hide();
$("#network2").hide();
$("#network").mouseleave(
function(){
$("#network").animate({
height: 'hide'
});
}
 
);
$("#network2").mouseleave(
function(){
$("#network2").animate({
height: 'hide'
});
}
 
);
}
);
 
function openNetwork(){
$("#network2").animate({
height: 'hide'
});
$("#network").animate({
height: 'toggle'
});
}
 
function openNetwork2(){
$("#network").animate({
height: 'hide'
});
$("#network2").animate({
height: 'toggle'
});
}
 
</script>
<script language="javascript">
 
function ping()
{
$.getJSON( "<%=request.getContextPath()%>/ping.jsp", function( data ) {
setTimeout("ping()",10000);
});
}
$(document).ready(function()
{
if($("#myTable"))
231,7 → 310,7
widgets: ["zebra","filter"],
ignoreCase: false,
widthFixed : true,
widgetOptions : {filter_reset : 'button.reset',filter_columnFilters : false},
widgetOptions : {filter_reset : 'button.reset',filter_columnFilters : true},
textExtraction: function(node) {
// extract data from markup and return it
if($(node).find(':input').size()>0)
248,6 → 327,7
}
);
}
 
if($(".tablesorterfiltered"))
{
$(".tablesorterfiltered").tablesorter({
277,9 → 357,38
}
);
}
if($(".tablesorterfiltered"))
{
$(".tablesorterfiltered").tablesorter({
theme: 'blue',
 
 
sortMultiSortKey: 'altKey',
//sortList: [[0,0]],
widgets: ["zebra","filter"],
 
ignoreCase: false,
widthFixed : true,
widgetOptions : {filter_reset : 'button.reset',filter_columnFilters : true},
textExtraction: function(node) {
// extract data from markup and return it
if($(node).find(':input').size()>0)
{
var values = $(node).find(":input").map(function() {
return $(this).val()
}).get().join(",");
 
 
return values;
}
return $(node).text();
}
}
);
}
 
 
 
// External search
// buttons set up like this:
// <button type="button" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
300,6 → 409,10
if($('.tablesorterfiltered'))
$.tablesorter.setFilters( $('.tablesorterfiltered'), filters, true ); // new v2.9
 
/*
if($('.tablesorterfiltered'))
$.tablesorter.setFilters( $('.tablesorterfiltered'), filters, true ); // new v2.9
*/
/** old method (prior to tablsorter v2.9 ***
var filters = $('table.tablesorter').find('input.tablesorter-filter');
filters.val(''); // clear all filters
/impl/src/web/layout/navigationLeftMenu.jsp
23,7 → 23,7
</li>
<baco:isAuthenticated>
<li>
<a href=" http://mail.google.com/a/estgp.pt." target="_blank">
<a href=" http://mail.google.com/a/estgp.pt" target="_blank">
Webmail [Nova Plataforma]
</a>
</li>
/impl/src/web/user/courses/directedCoordinatedCoursesCourseView.jsp
187,6 → 187,7
<td>${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.cdTurma}</td>
<td>${courseUnitView.cdTurma}</td>
<td>${courseUnitView.teachersSnipet}</td>
<td class="icons">
<a href="<%=request.getContextPath()%>/user/startLoadCourseUnitFromHome.do?id=${courseUnitView.id}"><img src="<%=request.getContextPath()%>/imgs/home.png"/></a>
/impl/src/web/user/courseunits/courseunitworks.jsp
158,6 → 158,9
</td>
<td>
<a href="javascript:showOrHideOne('assignement${work.id}')">${work.title}</a>
<div style="padding:5px;border:1px solid gray" id="assignement${work.id}" style="<%=Globals.HIDDEN%>">
${work.formatedDescription}
</div>
</td>
<td>
<logic:notEmpty name="work" property="workFile">
289,11 → 292,6
</td>
</logic:notEmpty>
</tr>
<tr id="assignement${work.id}" style="<%=Globals.HIDDEN%>">
<td colspan="${colspanAssignement}">
${work.formatedDescription}
</td>
</tr>
</logic:iterate>
</tbody>
</table>
305,4 → 303,4
</div>
 
</div>
</div>
</div>
/impl/src/web/user/courseunits/courseunitEvaluation.jsp
24,6 → 24,11
<html:errors/>
<jomm:messages/>
 
<script>
//Manter a sessão activa para os docentes não perderem os dados
ping();
</script>
 
<%
IServiceManager sm = ServiceManager.getInstance();
 
/impl/src/web/user/courseunits/courseunitProgram.jsp
20,6 → 20,10
<div id="contentPane">
<html:errors/>
<jomm:messages/>
<script>
//Manter a sessão activa para os docentes não perderem os dados
ping();
</script>
 
<%
IServiceManager sm = ServiceManager.getInstance();
/impl/src/web/user/home/courseComission.jsp
107,14 → 107,14
{
%>
 
<h2><a href="javascript:showOrHide('evaluationValidate<%=mis.course.getId()%>')"><%=mis.course.getName()%> / <%=mis.course.getCode()%></a> (<%=mis.courseUnits.size()%>)</h2>
<h2><a href="javascript:showOrHide('evaluationValidate<%=mis.course.getId()%>')"><%=mis.course.getName()%> / <%=mis.course.getCode()%> </a> (<%=mis.courseUnits.size()%>)</h2>
<div id="evaluationValidate<%=mis.course.getId()%>" style="display: none">
<ul>
<%
for(CourseUnit cu: mis.courseUnits)
{
%>
<li><a href="<%=request.getContextPath()%>/user/startLoadCourseUnitEvaluation.do?courseUnitId=<%=cu.getId()%>"><%=cu.getName()%> / <%=cu.getCode()%></a></li>
<li><a href="<%=request.getContextPath()%>/user/startLoadCourseUnitEvaluation.do?courseUnitId=<%=cu.getId()%>"><%=cu.getName()%> / <%=cu.getCode()%> / <%=cu.getCdTurma()%></a></li>
<%
}
%>
170,7 → 170,7
for(CourseUnit cu: mis.courseUnits)
{
%>
<li><a href="<%=request.getContextPath()%>/user/startLoadCourseUnitEvaluation.do?courseUnitId=<%=cu.getId()%>"><%=cu.getName()%> / <%=cu.getCode()%></a></li>
<li><a href="<%=request.getContextPath()%>/user/startLoadCourseUnitEvaluation.do?courseUnitId=<%=cu.getId()%>"><%=cu.getName()%> / <%=cu.getCode()%> / <%=cu.getCdTurma()%></a></li>
<%
}
%>
/impl/src/web/user/home/teacher.jsp
173,7 → 173,7
for(CourseUnit cu: programs)
{
%>
<li><a href="<%=request.getContextPath()%>/user/startLoadCourseUnitEvaluation.do?courseUnitId=<%=cu.getId()%>"><%=cu.getName()%>/<%=cu.getCode()%> (<%=cu.getCourseName() + "/" +cu.getCourseCode()%>)</a></li>
<li><a href="<%=request.getContextPath()%>/user/startLoadCourseUnitEvaluation.do?courseUnitId=<%=cu.getId()%>"><%=cu.getName()%>/<%=cu.getCode()%> (<%=cu.getCourseName() + "/" +cu.getCourseCode() +"/" + cu.getCdTurma()%>)</a></li>
<%
}
%>
211,7 → 211,7
for(CourseUnit cu: evaluations)
{
%>
<li><a href="<%=request.getContextPath()%>/user/startLoadCourseUnitFromHome.do?id=<%=cu.getId()%>"><%=cu.getName()%>/<%=cu.getCode()%> (<%=cu.getCourseName() + "/" +cu.getCourseCode()%>)</a></li>
<li><a href="<%=request.getContextPath()%>/user/startLoadCourseUnitFromHome.do?id=<%=cu.getId()%>"><%=cu.getName()%>/<%=cu.getCode()%> (<%=cu.getCourseName() + "/" +cu.getCourseCode()+"/" + cu.getCdTurma()%>)</a></li>
<%
}
%>