/impl/conf/language/MessageResourcesEmail.properties |
---|
5,11 → 5,13 |
################################################################################ |
module.Email=Serviço de Email |
pop.no.messages=Não tem mensagens na sua caixa de correio |
pop.title=Últimas mensagens de Email<br>Ir para <a target="_blank" href="http://mail.estgp.pt/exchange/{0}">WEBMAIL</a> |
pop.title=Ir para <a target="_blank" href="http://mail.estgp.pt/exchange/{0}">WEBMAIL</a> |
pop.last.messages=Últimas mensagens de Email |
pop.text=Mensagem |
pop.from=De |
pop.to=Para |
pop.subject=Assunto |
pop.loading=Carregando mensagens de Email... |
pop.date=Recebido |
pop.not.configured=O Seu servidor de Email não está configurado |
pop.not.configured=A caixa POP do seu servidor de Email não está configurado. A sigla POP refere-se ao protocolo de leitura de mensagens em servidores de email externos. Por favor configure o seu servidor de POP nos seus dados de perfil<br>(exemplo na ESTG:<br> pop = mail.estgp.pt) |
pop.danger.messages=Existem mensagens na sua caixa de correio da escola que estão incorrectamente formatadas e que podem prejudicar a vizualização deste sítio. Por favor remova-as da sua caixa para que as restantes possam ser aqui apresentadas. |
/impl/conf/language/MessageResourcesCourse.properties |
---|
9,6 → 9,7 |
course.submit.new=Novo Curso |
course.updated.success=Curso {0} actualizado com sucesso |
course.created.success=Curso {0} criado com sucesso |
course.exists=O Curso já existe com esse código e ano |
course.select=Escolha Curso |
course.select.message=Por favor selecione o curso que deseja editar |
/impl/conf/language/MessageResources.properties |
---|
308,7 → 308,7 |
#Mensagens Status |
authentication.ok=Benvindo Fulano |
logout.ok=Caro {0}, obrigado por usar o nosso serviço. |
logout.ok=Caro/a {0},<br> Obrigado por usar o nosso serviço. |
authentication.first.time=Olá bem-vindo, é a primeira vez que que se esta a ligar |
authenticate.already.authenticated=O seu usuário já está autênticado |
username=Nome de Utilizador |
/impl/conf/app.properties |
---|
306,6 → 306,8 |
# |
siges.degree.1=L |
siges.degree.4=M |
siges.degree.8=C |
national.institution.code=3122 |
siges.institution.code=1 |
/impl/conf/template/email/courseUnitWork_en.txt |
---|
1,4 → 1,4 |
|
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
18,6 → 18,6 |
Best Regards {3} |
--------------------------------------------- |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
http://www.estgp.pt |
/impl/conf/template/email/courseUnitWork_pt.txt |
---|
1,4 → 1,4 |
|
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
18,6 → 18,6 |
Com os melhores cumprimentos {3} |
--------------------------------------------- |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
http://www.estgp.pt |
/impl/conf/template/email/courseUnitWorkChange_en.txt |
---|
New file |
0,0 → 1,26 |
|
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
# 3 : Teacher |
# 4 : Deliver Date |
# Course Unit Assignement |
# |
Dear Student |
WORK MODIFICATION |
The details of an work were changed in: |
{0} |
{1} |
Execution or deliver date: {4} |
{2} |
Best Regards {3} |
--------------------------------------------- |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
http://www.estgp.pt |
/impl/conf/template/email/courseUnitWorkChange_pt.txt |
---|
New file |
0,0 → 1,27 |
|
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
# 3 : Teacher |
# 4 : Deliver Date |
# Course Unit Assignement |
# |
Caro estudante |
ALTERAÇÃO A TRABALHO |
Os detalhes de um trabalho foram alterados na unidade: |
{0} |
{1} |
Data de execução ou entrega: {4} |
{2} |
Com os melhores cumprimentos {3} |
--------------------------------------------- |
Escola Superior de Tecnologia e Gestão |
Instituto Politécnico de Portalegre |
http://www.estgp.pt |
/impl/conf/berserk/sd.xml |
---|
131,6 → 131,7 |
<chain name="Session"/> |
<chain name="AuthenticatedUsers"/> |
<chain name="IsInCourseUnit"/> |
<chain name="CanAddAnnouncementInCourseUnit"/> |
</filterChains> |
</service> |
<service> |
/impl/conf/berserk/fd.xml |
---|
62,6 → 62,16 |
<isTransactional>false</isTransactional> |
</filter> |
<filter> |
<name>CanAddAnnouncementInCourseUnit</name> |
<implementationClass>pt.estgp.estgweb.filters.filters.CanAddAnnouncementInCourseUnit</implementationClass> |
<description> |
Checks if the requester is in course unit and if can create announcement in it of the requested bean |
filter parameter: bean serializable id |
filter parameter: bean class |
</description> |
<isTransactional>false</isTransactional> |
</filter> |
<filter> |
<name>IsStudentInCourseUnitUsersClass</name> |
<implementationClass>pt.estgp.estgweb.filters.filters.IsStudentInCourseUnitUsersClass</implementationClass> |
<description> |
/impl/conf/berserk/fcd.xml |
---|
318,6 → 318,13 |
<invocationTiming>1</invocationTiming> |
<filterClass>pt.estgp.estgweb.filters.chains.LoadControlFilter</filterClass> |
</filterChain> |
<filterChain> |
<name>CanAddAnnouncementInCourseUnit</name> |
<expression>CanAddAnnouncementInCourseUnit("object.courseUnitView.id")</expression> |
<description>Owner of an object Control Chain</description> |
<invocationTiming>1</invocationTiming> |
<filterClass>pt.estgp.estgweb.filters.chains.LoadControlFilter</filterClass> |
</filterChain> |
<!--<filterChain>--> |
<!--<name>InternalCourseUnitBlog</name>--> |
<!--<expression>!(BooleanCheck("serializable","pt.estgp.estgweb.domain.CourseUnitImpl","unitBlog.courseUnitInternal")) || ResourceAccessControlCourseUnit</expression>--> |
/impl/src/java/pt/estgp/estgweb/Globals.java |
---|
251,6 → 251,8 |
public static final String EMAIL_COURSEUNIT_WORK_SUBJECT_EN = ConfigProperties.getProperty("email.courseunit.work.subject.en"); |
public static final String EMAIL_COURSEUNIT_WORK_TEMPLATE_PT = "courseUnitWork_pt.txt"; |
public static final String EMAIL_COURSEUNIT_WORK_TEMPLATE_EN = "courseUnitWork_en.txt"; |
public static final String EMAIL_COURSEUNIT_WORK_CHANGE_TEMPLATE_PT = "courseUnitWorkChange_pt.txt"; |
public static final String EMAIL_COURSEUNIT_WORK_CHANGE_TEMPLATE_EN = "courseUnitWorkChange_en.txt"; |
public static final String EMAIL_COURSEUNIT_BLOGPOST_SUBJECT_PT = ConfigProperties.getProperty("email.courseunit.blogpost.subject.pt"); |
public static final String EMAIL_COURSEUNIT_BLOGPOST_SUBJECT_EN = ConfigProperties.getProperty("email.courseunit.blogpost.subject.en"); |
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesService.java |
---|
14,6 → 14,7 |
import pt.estgp.estgweb.services.data.IRepositoryFile; |
import pt.estgp.estgweb.services.data.RepositoryService; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException; |
import pt.estgp.estgweb.utils.DatesUtils; |
import pt.estgp.estgweb.utils.Dom4jUtil; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
77,17 → 78,24 |
public CourseView loadCourseByCode(String code, boolean initUnits) throws ServiceException |
{ |
Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(code); |
if(c != null) |
{ |
CourseView cV = new CourseView(c,initUnits); |
if(c.getStudiesPlan() != null) |
try{ |
Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(code); |
if(c != null) |
{ |
RepositoryFileImpl repositoryFile = repositoryService.loadView(c.getStudiesPlan()); |
cV.setStudiesPlan(repositoryFile); |
CourseView cV = new CourseView(c,initUnits); |
if(c.getStudiesPlan() != null) |
{ |
RepositoryFileImpl repositoryFile = repositoryService.loadView(c.getStudiesPlan()); |
cV.setStudiesPlan(repositoryFile); |
} |
return cV; |
} |
return cV; |
} |
catch(Throwable e) |
{ |
logger.error(e + " loading code:" + code,e); |
throw new ServiceException("loading code: " + code + " - " + e.toString(),e); |
} |
return null; |
} |
100,9 → 108,14 |
{ |
Course c; |
if(courseView.getId() > 0) |
{ |
c = DaoFactory.getCourseDaoImpl().get(courseView.getId()); |
} |
else |
{ |
c = DaoFactory.getCourseDaoImpl().findCourseByCodeAndYear(courseView.getCode(),courseView.getImportYear()); |
if(c != null) |
throw new AlreadyExistsException(AlreadyExistsException.ALREADY_EXISTS_COURSE); |
c = DomainObjectFactory.createCourseImpl(); |
DaoFactory.getCourseDaoImpl().save(c); |
} |
126,7 → 139,7 |
try |
{ |
Document dom = Dom4jUtil.parse(stream); |
String html = Dom4jUtil.styleDocument(dom, Globals.TEMPLATE_COURSE_XSL_PATH); |
String html = Dom4jUtil.styleDocument(dom, Globals.TEMPLATE_COURSE_XSL_PATH); |
c.setCacheWebDocument(html); |
} |
catch (Exception e) |
/impl/src/java/pt/estgp/estgweb/services/courseunits/CourseUnitWorkService.java |
---|
57,7 → 57,10 |
{ |
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().get(id); |
CourseUnitAssignement assignement; |
boolean newWork = true; |
if(cUV.getId() > 0) |
newWork = false; |
if(cUV.getId() > 0) |
assignement = DaoFactory.getCourseUnitAssignementDaoImpl().get(cUV.getId()); |
else |
{ |
80,11 → 83,11 |
} |
if(assignement.isStatus()) |
trySendWorkEmail(assignement,userSession); |
trySendWorkEmail(assignement,userSession,newWork); |
return loadCourseUnitWorks(id,userSession); |
} |
private void trySendWorkEmail(CourseUnitAssignement assignement, UserSession userSession) |
private void trySendWorkEmail(CourseUnitAssignement assignement, UserSession userSession,boolean newWork) |
{ |
CourseUnit c = assignement.getCourseUnit(); |
List<User> users = new ArrayList<User>(); |
92,14 → 95,14 |
users.addAll(c.getStudents()); |
if(c.getTeachers() != null) |
users.addAll(c.getTeachers()); |
sendWorkEmail(assignement,c.getNormalizedName(), userSession, users); |
sendWorkEmail(assignement,c.getNormalizedName(), userSession, users,newWork); |
} |
SendEmailService sendEmailService = new SendEmailService(); |
private void sendWorkEmail(CourseUnitAssignement a, String desc, UserSession userSession, List<User> users) |
private void sendWorkEmail(CourseUnitAssignement a, String desc, UserSession userSession, List<User> users, boolean newWork) |
{ |
Email e = sendEmailService.getCourseUnitWorkEmail(a, LangEnum.PORTUGUESE,userSession,users); |
Email e = sendEmailService.getCourseUnitWorkEmail(a, LangEnum.PORTUGUESE,userSession,users,newWork); |
EMAILJob emailJob = new EMAILJob(e); |
JobScheduleService.getInstance().scheduleNow(emailJob,"CourseUnit Assignement Email:" + desc,userSession); |
} |
/impl/src/java/pt/estgp/estgweb/services/email/SendEmailService.java |
---|
19,6 → 19,7 |
import java.util.ArrayList; |
import java.util.List; |
import java.util.Properties; |
import java.util.Date; |
import java.text.MessageFormat; |
/** |
201,28 → 202,37 |
return new Email(subject ,recipients, fromEmail, template,arguments,Message.RecipientType.BCC); |
} |
public Email getCourseUnitWorkEmail(CourseUnitAssignement assignement, LangEnum langEnum, UserSession userSession, List<User> users) |
public Email getCourseUnitWorkEmail(CourseUnitAssignement assignement, LangEnum langEnum, UserSession userSession, List<User> users, boolean newWork) |
{ |
List<String> arguments = new ArrayList<String>(); |
arguments.add(assignement.getCourseUnit().getName()); |
arguments.add(assignement.getTitle()); |
arguments.add(assignement.getDescription()); |
if(userSession != null && userSession.getName() != null) |
arguments.add(userSession.getName()); |
else |
arguments.add("unknown"); |
arguments.add( DatesUtils.getStringFromDate(assignement.getDeliverDate())); |
String subjectTxt; |
String template; |
if(langEnum == LangEnum.PORTUGUESE) |
{ |
template = Globals.EMAIL_COURSEUNIT_WORK_TEMPLATE_PT; |
if(newWork) |
template = Globals.EMAIL_COURSEUNIT_WORK_TEMPLATE_PT; |
else |
template = Globals.EMAIL_COURSEUNIT_WORK_CHANGE_TEMPLATE_PT; |
subjectTxt = Globals.EMAIL_COURSEUNIT_WORK_SUBJECT_PT; |
} |
else |
{ |
template = Globals.EMAIL_COURSEUNIT_WORK_TEMPLATE_EN; |
if(newWork) |
template = Globals.EMAIL_COURSEUNIT_WORK_TEMPLATE_EN; |
else |
template = Globals.EMAIL_COURSEUNIT_WORK_CHANGE_TEMPLATE_EN; |
subjectTxt = Globals.EMAIL_COURSEUNIT_WORK_SUBJECT_EN; |
} |
326,10 → 336,11 |
public static void main(String [] args) |
{ |
List<String[]> grades = new ArrayList<String[]>(); |
grades.add(new String[]{"Teste","3"}); |
grades.add(new String[]{"Teste2","4"}); |
new SendEmailService().sendNewGrades(grades,LangEnum.PORTUGUESE,"jmachado@estgp.pt","jorge Machado"); |
System.out.println( DatesUtils.getStringFromDate(new Date())); |
// List<String[]> grades = new ArrayList<String[]>(); |
// grades.add(new String[]{"Teste","3"}); |
// grades.add(new String[]{"Teste2","4"}); |
// new SendEmailService().sendNewGrades(grades,LangEnum.PORTUGUESE,"jmachado@estgp.pt","jorge Machado"); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/email/ReadEmailService.java |
---|
39,15 → 39,15 |
public List<IPopEmail> run(UserSession userSession) |
{ |
if(!((UserImpl)userSession.getUser()).hasPopConfigured()) |
if (!((UserImpl) userSession.getUser()).hasPopConfigured()) |
return null; |
Properties props = new Properties(); |
Date d = (Date) ((UserSessionImpl)userSession).get(POP_MAIL_DATE_KEY); |
ArrayList<IPopEmail> oldMessages = (ArrayList<IPopEmail>) ((UserSessionImpl)userSession).get(POP_MAIL_MESSAGES_KEY); |
if(d != null && oldMessages != null) |
Date d = (Date) ((UserSessionImpl) userSession).get(POP_MAIL_DATE_KEY); |
ArrayList<IPopEmail> oldMessages = (ArrayList<IPopEmail>) ((UserSessionImpl) userSession).get(POP_MAIL_MESSAGES_KEY); |
if (d != null && oldMessages != null) |
{ |
if(System.currentTimeMillis() - d.getTime() < Globals.POP_REFRESH_TIMEOUT_MILISECONDS) |
if (System.currentTimeMillis() - d.getTime() < Globals.POP_REFRESH_TIMEOUT_MILISECONDS) |
{ |
return oldMessages; |
} |
79,67 → 79,80 |
for (int i = count; i > count - Globals.POP_MAX_MESSAGES && i > 0; i--) |
{ |
Message message = inbox.getMessage(i); |
DefaultPopEmail popEmail = new DefaultPopEmail(); |
String date = DatesUtils.getStringFromDate(message.getSentDate()); |
popEmail.setDate(date); |
popEmail.setSubject(message.getSubject()); |
popEmail.setSubjectFragment(StringsUtils.getFragment(message.getSubject(),Globals.POP_FRAGMENT_TEXT_SIZE)); |
List<IAddress> addressLst = new ArrayList<IAddress>(); |
for (Address a : message.getFrom()) |
try |
{ |
InternetAddress internetAddress = (InternetAddress) a; |
DefaultAddress address = new DefaultAddress(); |
address.setEmail(internetAddress.getAddress()); |
address.setName(internetAddress.getPersonal()); |
addressLst.add(address); |
} |
popEmail.setFrom(addressLst); |
Part messagePart = message; |
Object content = messagePart.getContent(); |
if (content instanceof Multipart) |
{ |
messagePart = ((Multipart) content).getBodyPart(0); |
} |
String contentType = messagePart.getContentType(); |
if (contentType.startsWith("text/plain") || contentType.startsWith("text/html")) |
{ |
InputStream is = messagePart.getInputStream(); |
BufferedReader reader = new BufferedReader(new InputStreamReader(is,"ISO-8859-1")); |
StringBuilder text = new StringBuilder(); |
StringBuilder textClean = new StringBuilder(); |
String thisLine = reader.readLine(); |
while (thisLine != null) |
Message message = inbox.getMessage(i); |
DefaultPopEmail popEmail = new DefaultPopEmail(); |
String date = DatesUtils.getStringFromDate(message.getSentDate()); |
popEmail.setDate(date); |
popEmail.setSubject(message.getSubject()); |
popEmail.setSubjectFragment(StringsUtils.getFragment(message.getSubject(), Globals.POP_FRAGMENT_TEXT_SIZE)); |
List<IAddress> addressLst = new ArrayList<IAddress>(); |
for (Address a : message.getFrom()) |
{ |
String thisLineTrim = thisLine.trim(); |
if(thisLineTrim.length() > 0) |
InternetAddress internetAddress = (InternetAddress) a; |
DefaultAddress address = new DefaultAddress(); |
address.setEmail(internetAddress.getAddress()); |
address.setName(internetAddress.getPersonal()); |
addressLst.add(address); |
} |
popEmail.setFrom(addressLst); |
Part messagePart = message; |
Object content = null; |
try |
{ |
content = messagePart.getContent(); |
} |
catch (Throwable e) |
{ |
content = "ESTG SITE AVISO: Conteudo possivelmente perigoso"; |
} |
if (content instanceof Multipart) |
{ |
messagePart = ((Multipart) content).getBodyPart(0); |
} |
String contentType = messagePart.getContentType(); |
if (contentType.startsWith("text/plain") || contentType.startsWith("text/html")) |
{ |
InputStream is = messagePart.getInputStream(); |
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "ISO-8859-1")); |
StringBuilder text = new StringBuilder(); |
StringBuilder textClean = new StringBuilder(); |
String thisLine = reader.readLine(); |
while (thisLine != null) |
{ |
textClean.append(thisLineTrim); |
String thisLineTrim = thisLine.trim(); |
if (thisLineTrim.length() > 0) |
{ |
textClean.append(thisLineTrim); |
} |
text.append("<br>").append(thisLine.trim()); |
thisLine = reader.readLine(); |
} |
text.append("<br>").append(thisLine.trim()); |
thisLine = reader.readLine(); |
popEmail.setText(text.toString()); |
popEmail.setFragment(StringsUtils.getFragment(textClean.toString(), Globals.POP_FRAGMENT_TEXT_SIZE)); |
} |
popEmail.setText(text.toString()); |
popEmail.setFragment(StringsUtils.getFragment(textClean.toString(),Globals.POP_FRAGMENT_TEXT_SIZE)); |
popMessages.add(popEmail); |
} |
popMessages.add(popEmail); |
catch (Throwable e) |
{ |
logger.error(e, e); |
} |
} |
inbox.close(false); |
store.close(); |
((UserSessionImpl)userSession).put(POP_MAIL_DATE_KEY,new Date()); |
((UserSessionImpl)userSession).put(POP_MAIL_MESSAGES_KEY,((ArrayList)popMessages)); |
((UserSessionImpl) userSession).put(POP_MAIL_DATE_KEY, new Date()); |
((UserSessionImpl) userSession).put(POP_MAIL_MESSAGES_KEY, ((ArrayList) popMessages)); |
return popMessages; |
} |
catch (MessagingException e) |
{ |
logger.error(e, e); |
} |
catch (IOException e) |
{ |
logger.error(e, e); |
} |
return null; |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportStudentsService.java |
---|
107,7 → 107,7 |
DaoFactory.getStudentDaoImpl().save(s); |
newUser = true; |
} |
persist(d, s); |
persist(d, s, newUser); |
//Advising CommonsServicesManager before change password |
if (newUser) |
142,19 → 142,22 |
* @param d Aluno |
* @param student Student |
*/ |
private void persist(Aluno d, Student student) |
private void persist(Aluno d, Student student, boolean newUser) |
{ |
student.setName(d.getNome()); |
student.setEmail(d.getEmail()); |
student.setSigesCode(d.getCodigo().intValue()); |
student.setAddress(d.getMorada()); |
student.setPhonenumber(StringsUtils.cleanKeepNumbers(d.getTelemovel())); |
student.setZip("" + d.getCodigoPostal().intValue()); |
student.setBi(d.getNumeroBi()); |
student.setSex(d.getSexo()); |
student.setUserNameNetpa(d.getUsernameNetpa()); |
student.setBirthDate(d.getDataNascimento().toGregorianCalendar().getTime()); |
student.setUsername("a" + d.getCodigo().intValue()); |
if(newUser) |
{ |
student.setName(d.getNome()); |
student.setEmail(d.getEmail()); |
student.setSigesCode(d.getCodigo().intValue()); |
student.setAddress(d.getMorada()); |
student.setPhonenumber(StringsUtils.cleanKeepNumbers(d.getTelemovel())); |
student.setZip("" + d.getCodigoPostal().intValue()); |
student.setBi(d.getNumeroBi()); |
student.setSex(d.getSexo()); |
student.setUserNameNetpa(d.getUsernameNetpa()); |
student.setBirthDate(d.getDataNascimento().toGregorianCalendar().getTime()); |
student.setUsername("a" + d.getCodigo().intValue()); |
} |
/*Desta forma as relacoes antigas sao ignoradas cria-se uma lista nova e atribui-se ao Teacher, o Hibernate faz resto e apaga as chaves estrangeiras antigas */ |
if (d.getDisciplinasInscrito() == null || d.getDisciplinasInscrito().getDisciplina() == null || d.getDisciplinasInscrito().getDisciplina().size() == 0) |
202,7 → 205,6 |
} |
else |
student.setSubscribedUnits(units); |
student.setSubscribedUnits(units); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportTeachersService.java |
---|
75,7 → 75,7 |
logger.info("Importing: (" + t.getUsername() + ") " + t.getName()); |
try |
{ |
persist(d, t); |
persist(d, t, newUser); |
} |
catch (Exception e) |
{ |
112,7 → 112,7 |
* @param t teacher |
* @throws Exception . |
*/ |
private void persist(Docente d, Teacher t) throws Exception |
private void persist(Docente d, Teacher t, boolean newUser) throws Exception |
{ |
try |
{ |
/impl/src/java/pt/estgp/estgweb/services/urlstat/LoadUrlStatService.java |
---|
1,10 → 1,12 |
package pt.estgp.estgweb.services.urlstat; |
import org.apache.log4j.Logger; |
import org.apache.commons.httpclient.util.URIUtil; |
import pt.estgp.estgweb.domain.UrlStat; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import jomm.utils.BytesUtils; |
/** |
* @author Jorge Machado |
24,7 → 26,8 |
*/ |
public UrlStat run(String relativePath) throws ServiceException |
{ |
return DaoFactory.getUrlStatDaoImpl().loadOrNull(relativePath); |
String relativePathDigest = BytesUtils.getMD5(relativePath); |
return DaoFactory.getUrlStatDaoImpl().loadOrNull(relativePathDigest); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/urlstat/UrlStatService.java |
---|
6,11 → 6,14 |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.web.filters.UrlStatFilter; |
import org.apache.log4j.Logger; |
import org.apache.commons.httpclient.util.URIUtil; |
import org.apache.commons.httpclient.URIException; |
import java.util.*; |
import jomm.dao.impl.AbstractDao; |
import jomm.utils.MyCalendar; |
import jomm.utils.BytesUtils; |
/** |
* @author Jorge Machado |
38,15 → 41,25 |
Set<Map.Entry<String, UrlStatFilter.IntegerContainer>> set = map.entrySet(); |
for (Map.Entry<String, UrlStatFilter.IntegerContainer> entry : set) |
{ |
String relativePath = entry.getKey(); |
// String relativePath = entry.getKey(); |
String relativePath = BytesUtils.getMD5(entry.getKey()); |
UrlStatFilter.IntegerContainer ic = entry.getValue(); |
UrlStatImpl urlStat = (UrlStatImpl) DaoFactory.getUrlStatDaoImpl().loadOrNullLockUpgrade(relativePath); |
if (urlStat == null) |
{ |
logger.info("url:" + relativePath + " does not exist... creating"); |
urlStat = DomainObjectFactory.createUrlStatImpl(); |
try |
{ |
urlStat.setName(URIUtil.decode(entry.getKey(),"ISO-8859-1")); |
} |
catch (URIException e) |
{ |
logger.error(e,e); |
} |
urlStat.setRelativePath(relativePath); |
logger.info("url:" + urlStat.getName() + " does not exist... creating"); |
urlStat.setStatus(false); |
DaoFactory.getUrlStatDaoImpl().save(urlStat); |
} |
57,7 → 70,7 |
UrlStatYearImpl urlStatYear = (UrlStatYearImpl) DaoFactory.getUrlStatYearDaoImpl().loadOrNullLockUpgrade(urlStatYearId); |
if (urlStatYear == null) |
{ |
logger.info("url:" + relativePath + " first year call does not exist... creating"); |
logger.info("url:" + urlStat.getName() + " first year call does not exist... creating"); |
urlStatYear = DomainObjectFactory.createUrlStatYearImpl(); |
urlStatYear.setId(urlStatYearId); |
urlStat.addYear(urlStatYear); |
71,7 → 84,7 |
UrlStatMonthImpl urlStatMonth = (UrlStatMonthImpl) DaoFactory.getUrlStatMonthDaoImpl().loadOrNullLockUpgrade(urlStatMonthId); |
if (urlStatMonth == null) |
{ |
logger.info("url:" + relativePath + " first month call does not exist... creating"); |
logger.info("url:" + urlStat.getName() + " first month call does not exist... creating"); |
urlStatMonth = DomainObjectFactory.createUrlStatMonthImpl(); |
urlStatMonth.setId(urlStatMonthId); |
urlStatMonth.setDate(new MyCalendar(year, month, 1).getTime()); |
85,7 → 98,7 |
UrlStatDayImpl urlStatDay = (UrlStatDayImpl) DaoFactory.getUrlStatDayDaoImpl().loadOrNullLockUpgrade(urlStatDayId); |
if (urlStatDay == null) |
{ |
logger.info("url:" + relativePath + " first day call does not exist... creating"); |
logger.info("url:" + urlStat.getName() + " first day call does not exist... creating"); |
urlStatDay = DomainObjectFactory.createUrlStatDayImpl(); |
UrlStatDayId urlStatDayId2 = new UrlStatDayId(); |
urlStatDayId2.setDay(day); |
/impl/src/java/pt/estgp/estgweb/services/urlstat/ResetRelativePathsServiceDigests.java |
---|
New file |
0,0 → 1,61 |
package pt.estgp.estgweb.services.urlstat; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import org.apache.log4j.Logger; |
import org.apache.commons.httpclient.URIException; |
import org.apache.commons.httpclient.util.URIUtil; |
import java.sql.SQLException; |
import java.sql.PreparedStatement; |
import java.sql.ResultSet; |
import jomm.dao.impl.AbstractDao; |
import jomm.utils.BytesUtils; |
/** |
* @author Jorge Machado |
* @date 15/Mar/2008 |
* @time 6:55:38 |
* @see pt.estgp.estgweb.services.urlstat |
*/ |
public class ResetRelativePathsServiceDigests implements IService |
{ |
private static final Logger logger = Logger.getLogger(ResetRelativePathsServiceDigests.class); |
public static void main(String[] args) throws ServiceException, URIException, SQLException |
{ |
AbstractDao.getCurrentSession().beginTransaction(); |
PreparedStatement ps = AbstractDao.getCurrentSession().connection().prepareStatement("select relativePath from urlstat"); |
ResultSet rs = ps.executeQuery(); |
while(rs.next()) |
{ |
PreparedStatement ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstat set relativePath = ? where relativePath=?"); |
String relativePath = rs.getString("relativePath"); |
String encoded= BytesUtils.getMD5(relativePath); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstatday set relativePath = ? where relativePath=?"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstatmonth set relativePath = ? where relativePath=?"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
ps1 = AbstractDao.getCurrentSession().connection().prepareStatement("update urlstatyear set relativePath = ? where relativePath=?"); |
ps1.setString(1,encoded); |
ps1.setString(2,relativePath); |
ps1.executeUpdate(); |
ps1.close(); |
} |
AbstractDao.getCurrentSession().getTransaction().commit(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/urlstat/ChartBuilderService.java |
---|
21,6 → 21,7 |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import pt.estgp.estgweb.Globals; |
import jomm.utils.DatesUtils; |
import jomm.utils.BytesUtils; |
import jomm.dao.impl.AbstractDao; |
import jomm.web.utils.TestHttpServletRequest; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
117,7 → 118,7 |
{ |
try |
{ |
relativePath = URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1"); |
relativePath = BytesUtils.getMD5(URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1")); |
} |
catch (URIException e) |
{ |
/impl/src/java/pt/estgp/estgweb/services/expceptions/AlreadyExistsException.java |
---|
3,6 → 3,7 |
public class AlreadyExistsException extends ServiceException |
{ |
public static final String ALREADY_EXISTS_COURSE = "course"; |
public static final String ALREADY_EXISTS_USERNAME = "username"; |
public static final String ALREADY_EXISTS_EMAIL = "email"; |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseDaoImpl.java |
---|
34,6 → 34,12 |
return (CourseImpl) createCriteria().add(eq("code", code)).uniqueResult(); |
} |
public CourseImpl findCourseByCodeAndYear(String code, String year) |
{ |
return (CourseImpl) createCriteria().add(eq("code", code)).add(eq("importYear", year)).uniqueResult(); |
} |
public int countCoursesActualYear(String query, SearchTypeEnum searchType) |
{ |
Criterion c = DaoUtils.createSearchQuery(query, searchType, "name", "description"); |
/impl/src/java/pt/estgp/estgweb/domain/UrlStatImpl.java |
---|
36,17 → 36,17 |
getYears().add(urlStatYear); |
} |
public String getName() |
{ |
if(super.getName() == null) |
try |
{ |
return URIUtil.decode(getRelativePath()); |
} |
catch (URIException e) |
{ |
logger.error(e,e); |
} |
return super.getName(); |
} |
// public String getName() |
// { |
// if(super.getName() == null) |
// try |
// { |
// return URIUtil.decode(getRelativePath(),"ISO-8859-1"); |
// } |
// catch (URIException e) |
// { |
// logger.error(e,e); |
// } |
// return super.getName(); |
// } |
} |
/impl/src/java/pt/estgp/estgweb/filters/filters/CanAddAnnouncementInCourseUnit.java |
---|
New file |
0,0 → 1,52 |
package pt.estgp.estgweb.filters.filters; |
import pt.estgp.estgweb.filters.chains.LoadControlFilter; |
import pt.estgp.estgweb.filters.exceptions.NeedAuthenticationException; |
import pt.estgp.estgweb.filters.exceptions.AccessDeniedOperationException; |
import pt.estgp.estgweb.filters.filters.utils.LoadObjectFromParameters; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.domain.CourseUnit; |
import pt.estgp.estgweb.domain.UserImpl; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.utils.ReflectionBean; |
import pt.utl.ist.berserk.ServiceRequest; |
import pt.utl.ist.berserk.ServiceResponse; |
import pt.utl.ist.berserk.logic.filterManager.FilterParameters; |
import pt.utl.ist.berserk.logic.filterManager.exceptions.FilterException; |
import org.apache.log4j.Logger; |
import java.io.Serializable; |
public class CanAddAnnouncementInCourseUnit extends LoadControlFilter |
{ |
private static final Logger logger = Logger.getLogger(CanAddAnnouncementInCourseUnit.class); |
public void execute(ServiceRequest request, ServiceResponse response, FilterParameters filterParameters) throws FilterException, Exception |
{ |
UserSession userSession = (UserSession) request.getServiceParameters().getParameter(Globals.USER_SESSION_KEY); |
if(userSession.getUser() == null) |
{ |
logger.info("try access restricted area:" + request.getRequester()); |
throw new NeedAuthenticationException(); |
} |
if(userSession.getUser().isSuperuser()) |
return; |
ReflectionBean serializableBean = new ReflectionBean((String) filterParameters.parametersArray()[0]); |
Object serializableObjectContainer = request.getServiceParameters().getParameter(serializableBean.getName()); |
Serializable serializable = (Serializable) serializableBean.invoke(serializableObjectContainer); |
if(serializable != null && serializable instanceof Long && ((Long)serializable).intValue() > 0) |
{ |
CourseUnit courseUnit = (CourseUnit) LoadObjectFromParameters.loadObjectFromClassName(CourseUnit.class.getName(),filterParameters,request.getServiceParameters()); |
if(!((UserImpl)userSession.getUser()).isTeacherOfCourseUnit(courseUnit.getId(),true)) |
{ |
logger.warn(userSession.getUser().getUsername() + ": try access restricted area"); |
throw new AccessDeniedOperationException("fail.owner"); |
} |
} |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesController.java |
---|
9,6 → 9,7 |
import pt.estgp.estgweb.filters.exceptions.NotFoundException; |
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedCourses; |
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService; |
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException; |
import pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsController; |
import pt.estgp.estgweb.web.exceptions.NoCookiesException; |
import pt.estgp.estgweb.web.form.courses.CourseForm; |
164,6 → 165,20 |
addMessage(request,"course.created.success","" + cV.getCode()); |
return mapping.getInputForward(); |
} |
catch (AlreadyExistsException e) |
{ |
addErrorWithKeys(request,"course.exists",e.getMessage()); |
try |
{ |
load((CourseForm) form,request,response); |
return mapping.findForward("submit"); |
} |
catch (Throwable throwable) |
{ |
logger.error(e, e); |
return mapping.findForward("error500"); |
} |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
/impl/src/java/pt/estgp/estgweb/web/filters/UrlStatFilter.java |
---|
21,6 → 21,7 |
import pt.utl.ist.berserk.logic.serviceManager.exceptions.ServiceManagerException; |
import pt.utl.ist.berserk.logic.filterManager.exceptions.*; |
import jomm.utils.MyCalendar; |
import jomm.utils.BytesUtils; |
/** |
* @author Jorge Machado |
121,14 → 122,18 |
} |
} |
logger.info("accessing " + relativePath); |
relativePath = URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1"); |
logger.info("coded to " + relativePath); |
if (userSession != null) |
{ |
if (userSession.get(relativePath) != null) |
String relativePathDigest = BytesUtils.getMD5(relativePath); |
if (userSession.get(relativePathDigest) != null) |
{ |
chain.doFilter(request, response); |
return; |
} |
userSession.put(relativePath, ""); |
userSession.put(relativePathDigest, ""); |
try |
{ |
userSession.serialize(hrequest, (HttpServletResponse) response); |
140,10 → 145,8 |
return; |
} |
} |
logger.info("accessing " + relativePath); |
relativePath = URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1"); |
logger.info("coded to " + relativePath); |
IntegerContainer count = urlStat.get(relativePath); |
if (count == null) |
/impl/src/doc/Programas0910.doc |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/impl/src/updates/db/update4.sql |
---|
New file |
0,0 → 1,0 |
ALTER TABLE `urlstat` MODIFY COLUMN `name` TEXT DEFAULT NULL; |
/impl/src/hbm/pt/estgp/estgweb/domain/UrlStat.hbm.xml |
---|
13,7 → 13,7 |
<discriminator column="discrimitator"/> |
<timestamp name="updateDate" unsaved-value="null"/> |
<property name="saveDate" type="timestamp"/> |
<property name="name" type="string"/> |
<property name="name" type="text"/> |
<property name="description" type="text"/> |
<property name="totalClicks" type="integer"/> |
<property name="status" type="boolean"/> |
/impl/src/web/auth/logoutok.jsp |
---|
1,13 → 1,9 |
<%-- |
Created by IntelliJ IDEA. |
User: User |
Date: 28/Fev/2008 |
Time: 20:16:38 |
To change this template use File | Settings | File Templates. |
--%> |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<jomm:beanArgMessage patternMessage="logout.ok" argName0="name"/> |
<div class="seccao"> |
<p class="statusOK"> |
<jomm:beanArgMessage patternMessage="logout.ok" argName0="name"/> |
</p> |
</div> |
/impl/src/web/admin/courses/course.jsp |
---|
8,6 → 8,8 |
<%@ 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"/> |
<html:errors/> |
<jomm:messages/> |
<html:form action="/user/courseControllerFromServiceZone" enctype="multipart/form-data"> |
<input type="hidden" name="dispatch" value="submit"/> |
<html:hidden property="courseView.id"/> |
/impl/src/web/user/home/student.jsp |
---|
8,13 → 8,13 |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<div class="portal"> |
<logic:notMatch value="StudentImpl" name="UserSession" property="user.class.name"> |
<ul> |
<li class="WARNING"> |
<logic:notMatch value="StudentImpl" name="UserSession" property="user.class.name"> |
<bean:message key="profile.bad.profile.student.iregular.user.class"/> |
</logic:notMatch> |
</li> |
</ul> |
</logic:notMatch> |
<table class="columnTable" width="100%"> |
<tbody> |
<tr> |
/impl/src/web/user/home/teacher.jsp |
---|
35,7 → 35,7 |
<ul> |
<logic:iterate id="unit" name="UserSession" property="user.teachedUnitsCurrentYearViewS1" type="pt.estgp.estgweb.domain.CourseUnit"> |
<li> |
<html:link action="/user/startLoadCourseUnitFromHome?id=${unit.id}">${unit.name}</html:link> |
<html:link action="/user/startLoadCourseUnitFromHome?id=${unit.id}">${unit.name} (${unit.courseName} (${unit.courseCode}))</html:link> |
</li> |
</logic:iterate> |
</ul> |
/impl/src/web/user/pop/messages.jsp |
---|
16,7 → 16,10 |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<div class="pop"> |
<% |
try |
{ |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{}; |
Object[] args = new Object[]{}; |
25,17 → 28,35 |
if (popMessages == null) |
{ |
%> |
<p> |
<bean:message key="pop.not.configured"/> |
</p> |
<table class="messages"> |
<tr> |
<th> |
<bean:message key="pop.title" arg0="${UserSession.user.pop3username}"/> |
</th> |
</tr> |
<tr> |
<th> |
<bean:message key="pop.not.configured"/> |
</th> |
</tr> |
</table |
<% |
} |
else if (popMessages.size() == 0) |
{ |
%> |
<p> |
<bean:message key="pop.no.messages"/> |
</p> |
<table class="messages"> |
<tr> |
<th> |
<bean:message key="pop.title" arg0="${UserSession.user.pop3username}"/> |
</th> |
</tr> |
<tr> |
<th> |
<bean:message key="pop.no.messages"/> |
</th> |
</tr> |
</table> |
<% |
} |
else |
45,6 → 66,8 |
<tr> |
<th> |
<bean:message key="pop.title" arg0="${UserSession.user.pop3username}"/> |
<br> |
<bean:message key="pop.last.messages"/> |
</th> |
<%--<th>--%> |
<%--<bean:message key="pop.from"/>--%> |
112,5 → 135,12 |
</table> |
<% |
} |
} |
catch(Throwable e) |
{ |
%> |
<p><bean:message key="pop.danger.messages"/></p> |
<% |
} |
%> |
</div> |
/impl/etc/todo/todo.txt |
---|
1,3 → 1,17 |
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
Novas Importacoes 200910 Problemas: |
- Importações Importar Anos Anteriores |
Notas |
Sumarios |
- Interface para aceder a cadeiras antigas |
- Programas em Falta de anos anteriores não mostra os cursos que transitaram de ano de importacao |
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
Questão da identificacao dos Noturnos |
Listagem de Programas |
- Ano > Curso > |
/impl/etc/systemDown/top.jpg |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/impl/etc/systemDown/index.jsp |
---|
New file |
0,0 → 1,95 |
<%-- |
Created by IntelliJ IDEA. |
User: Jorge |
Date: 7/Mai/2009 |
Time: 11:43:05 |
To change this template use File | Settings | File Templates. |
--%> |
<%@ page contentType="text/html;charset=ISO-8859-1" language="java" %> |
<html> |
<head> |
<title>Sistema temporariamente em Manutenção</title> |
<style type="text/css"> |
<!-- |
#footer { |
HEIGHT: 50px; |
PADDING-TOP: 5px; |
} |
#footerStructure TABLE { |
BORDER-RIGHT: 0; |
BORDER-TOP: 0; |
RIGHT: 0; |
LEFT: 0; |
MARGIN: 0; |
BORDER-LEFT: 0; |
WIDTH: 100%; |
PADDING-TOP: 0; |
BORDER-BOTTOM: 0; |
TOP: 0; |
border-spacing: 0 |
} |
#footerStructure TABLE TD { |
VERTICAL-ALIGN: top |
} |
#license UL { |
COLOR: #4D4D4D; |
PADDING-RIGHT: 0; |
PADDING-LEFT: 0; |
FONT-SIZE: 12px; |
TEXT-ALIGN: center; |
MARGIN: 0; |
LIST-STYLE-TYPE: none; |
} |
#footer #organizations { |
} |
#footer #sponsors { |
} |
#footer a |
/*, #footer a:visited */ |
{ |
color: #4d4d4d; |
} |
#footer a:hover { |
color: #8EC73F; |
} |
--> |
</style> |
</head> |
<body> |
<img src="top.jpg" alt="ESTG"> |
<h1>O Sistema www.estgp.pt está temporariamente em Manutenção:</h1> |
<h2>Pedimos desculpa pelo incómodo que esta paragem lhe possa causar.</h2> |
<h2>Tipicamente este tipo de paragem leva apenas alguns minutos. Tentaremos ser breves.</h2> |
<h3>A administração - bacodev [AT] estgp [DOT] pt</h3> |
<div id="footerStructure"> |
<table> |
<tr> |
<td width="33%"> |
<div id="sponsors"> |
</div> |
</td> |
<td align="center" width="33%"> |
<div id="license"> |
<ul class="copyRightLink"> |
<li>Copyright © <a href="http://www.estgp.pt">ESTG</a> 2008</li> |
<!--<li>Contact ESTG Webmaster at (webmaster [AT] estgp [DOT] pt)</li>--> |
</ul> |
</div> |
</td> |
<td width="33%" align="right"> |
<div id="organizations"> |
</div> |
</td> |
</tr> |
</table> |
</div> |
</body> |
</html> |
/impl/etc/systemDown/WEB-INF/web.xml |
---|
New file |
0,0 → 1,8 |
<?xml version="1.0" encoding="UTF-8"?> |
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> |
<web-app> |
<welcome-file-list> |
<welcome-file>index.jsp</welcome-file> |
</welcome-file-list> |
</web-app> |
/impl/etc/systemDown/ROOT.war |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/impl/build.xml |
---|
542,6 → 542,9 |
<target name="util.task.reset.urlsstats"> |
<java classname="pt.estgp.estgweb.services.urlstat.ResetRelativePathsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/> |
</target> |
<target name="util.task.reset.urlsstats.digests"> |
<java classname="pt.estgp.estgweb.services.urlstat.ResetRelativePathsServiceDigests" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/> |
</target> |
</project> |