Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 344 → Rev 378

/impl/importRoutines.xml
15,6 → 15,12
<java classname="pt.estgp.estgweb.services.sigesimports.ImportStudentsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
<target name="jobs">
<java classname="pt.estgp.estgweb.services.jobs.JobDeamon" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
<java fork="true" classname="pt.estgp.estgweb.services.jobs.JobDeamon" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
<target name="summaries">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportSumaries" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
<target name="setAreas">
<java fork="true" classname="pt.estgp.estgweb.services.courses.SetUserArea" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
</project>
/impl/conf/language/MessageResourcesIntranet.properties
45,6 → 45,7
 
intranet.utils.actas=Actas
 
intranet.home.curricular=Consulta de Material Curricular
 
 
 
/impl/conf/language/MessageResourcesCourse.properties
13,6 → 13,7
course.select=Escolha Curso
course.select.message=Por favor selecione o curso que deseja editar
 
course.area=Area Científica
course.code=Código
course.degree=Grau académico
course.importYear=Ano de Importação
46,16 → 47,30
course.units.with.program.checked=Unidades com programa válido
course.valid.program=Programa Validado
course.directed.coordinated=Cursos que coordena e/ou dirige (Apenas os coordenadores tem permissão para alterar o estado de um programa)
courseunit.programs=Programas Curriculares
course.directed.courses=Cursos que dirige
course.coordinated.courses=Cursos que coordena
course.unit.directed=Unidades Curriculares
course.unit.coordinated=Unidades Coordenadas
course.program.courses=Programas Curriculares por Curso
course.program.coordinated.directed.courses=Programas Curriculares dos Cursos Coordenados e/ou dirigidos
course.program.courses.choose.year=Escolha o ano que deseja consultar
 
 
courseunit.programfile.valid=programa <u>Aprovado</u> pela coordenação de área
 
 
 
 
 
 
courses.all=Todos os Cursos
 
 
 
 
 
 
 
 
 
/impl/conf/language/MessageResourcesProfile.properties
99,3 → 99,6
profile.RecordEventOrganizationImpl=Participação em Organizações de Eventos
profile.RecordProjectImpl=Participações em Projectos
profile.RecordOtherImpl=Outros
 
profile.record.publisher.all=Instituição / Empresa / Conferência / Workshop / Revista
profile.record.publisher.paper=Conferência / Workshop / Revista
/impl/conf/language/MessageResources.properties
64,8 → 64,11
error.401.item.3=Seguiu um link proveniente de um web site exterior cuja informação pode estar desactualizada
error.401.item.4=Seguiu um link interno errado ou desactualizado.
 
 
organization=Organização
areas=Áreas
areas=Areas
area=Area
areas.all=Todas as Areas
 
area.eg=Área de Engenharia
area.ch=Área de Ciencias Humanas
77,6 → 80,8
top.menu.area.ce=Ciências Empresariais
top.menu.area.ch=Ciências Humanas
 
 
 
#roles
 
user.role.all=Todos
87,6 → 92,11
user.role.teacher.eg=Professor da Área de Engenharia
user.role.teacher.dg=Professor da Área de Design
user.role.teacher.ce=Professor da Área de Ciencias Empresariais
user.role.teacher.ch=Professor da Área de Ciencias Humanas
user.role.student.eg=Aluno da Área de Engenharia
user.role.student.dg=Aluno da Área de Design
user.role.student.ce=Aluno da Área de Ciencias Empresariais
user.role.student.ch=Aluno da Área de Ciencias Humanas
user.role.ci=Centro Informático
user.role.worker=Funcionário
user.role.invited=Convidado
106,6 → 116,8
user.role.courseDirector=Director de Curso
user.role.identifiersManager=Utilizador de Gestão de Identificadores
user.role.identifiersCollectionCreator=Administrador de Colecções de Identificadores
user.role.studentsID=Alunos de Informação e Documentação
user.role.studentsFSIR=Alunos de Fontes de Informação e Serviço de Referência
 
 
#Filter Errors
261,6 → 273,7
portal.estg.edificio=O edifício
 
 
menu.teste=Teste 2
menu.alunos=Alunos
menu.staff=Staff
menu.docentes=Docentes
/impl/conf/language/MessageResourcesCourseUnits.properties
13,7 → 13,9
courseunit.programfilepath=Programa Curricular
courseunit.programfilepath.not.available=O Programa Curricular não está disponivel
courseunit.objectives.not.available=Os objectivos não estão disponiveis
 
courseunit.summaries=Sumários
courseunit.summary.present.students=alunos presentes (valor de amostragem)
courseunit.summaries.zero.placed=Não existem sumários disponiveis
courseunit.program.description=Programa Curricular de {0}
 
courseunit.program.archive=Arquivo
46,6 → 48,13
 
courseunit.assignement=Trabalho: {0}
 
courseunit.teacher.situation=Situação de Professores
courseunit.teacher.situation.withTeachers=Com Professor
courseunit.teacher.situation.withNoTeachers=Sem Professor
courseunit.teacher.situation.all=Todos
courseunit.S1=1º Semestre
courseunit.S2=2ª Semestre
courseunit.ALL=Todos os Semestres
courseunit.assignement.delivered.date=Data de Entrega
courseunit.assignement.deliver.date=Data Limite de Entrega
courseunit.assignement.deliver.type=Tipo de entrega
92,9 → 101,10
 
 
backups=Cópias de Segurança
courseunits.backups=Criar cópia de Segurança de todos os trabalhos entregues em todos os cursos
courseunits.actual.year.backup=Trabalhos entregues este ano
courseunits.all.backup=Todos os trabalhos entregues
courseunits.backups=Criar cópia de Segurança de todos das Unidades Curriculares em todos os cursos
courseunits.backups.actual.year=Criar cópia de Segurança (apenas do ano corrente) de todos das Unidades Curriculares em todos os cursos
courseunits.actual.year.backup=Backup do ano corrente
courseunits.all.backup=Backup de todos os anos (Este serviço pode demorar alguns minutos a executar)
 
 
 
/impl/conf/language/MessageResourcesBlog.properties
38,6 → 38,8
blog.deleted.success=Blog apagado com sucesso.
blog.deleted.fail=O Blog não foi apagado, contacte a administração.
blog.add.post=Adicionar POST
blog.add.post.cant.add.login=Este blog tem restrições de utilização. (Autênticação necessária)
blog.add.post.cant.add=Este blog tem restrições de utilização. Se acha que deveria poder colocar Posts neste blog contacte a administração.
blog.delete.post=Apagar POST
blog.confirm.delete.post=Tem a certeza que deseja apagar o POST Selecionado?
blog.post.deleted.success=POST apagado com sucesso.
/impl/conf/WEB-INF/struts/struts-courses.xml
34,6 → 34,8
<forward name="load" path="page.load.course"/>
</action>
 
<action path="/user/startLoadCoursesProgramsFromServiceZone" forward="/user/courseControllerFromServiceZone.do?dispatch=loadCoursesPrograms&amp;fromDispatch=loadCoursesPrograms&amp;from=ServiceZone"/>
<action path="/user/startLoadDirectedCoordinatedCoursesFromServiceZone" forward="/user/courseControllerFromServiceZone.do?dispatch=loadDirectedCoordininatedCourses&amp;fromDispatch=loadDirectedCoordininatedCourses&amp;from=ServiceZone"/>
<action path="/user/startSelectCourseFromServiceZone" forward="page.select.course.from.service.zone"/>
<action path="/user/startEditCourseFromServiceZone" forward="/user/courseControllerFromServiceZone.do?dispatch=edit&amp;from=ServiceZone"/>
<action path="/user/startNewCourseFromServiceZone" forward="/user/courseControllerFromServiceZone.do?dispatch=startNew&amp;from=ServiceZone"/>
46,10 → 48,13
validate="false"
input="page.separators.serviceZone">
<forward name="submit" path="page.submit.course.from.service.zone"/>
<forward name="load.courses.programs" path="page.courses.programs.from.service.zone"/>
<forward name="load.directed.coordinated.courses" path="page.directed.coordinated.courses.from.service.zone"/>
<forward name="confirm.courses.programs" path="page.separators.serviceZone"/>
</action>
 
<action path="/user/startLoadCoursesProgramsFromHome" forward="/user/courseControllerFromHome.do?dispatch=loadCoursesPrograms&amp;from=Home"/>
<action path="/user/startLoadDirectedCoordinatedCoursesFromHome" forward="/user/courseControllerFromHome.do?dispatch=loadDirectedCoordininatedCourses&amp;from=Home"/>
<action path="/user/startLoadCoursesProgramsFromHome" forward="/user/courseControllerFromHome.do?dispatch=loadCoursesPrograms&amp;fromDispatch=loadCoursesPrograms&amp;from=Home"/>
<action path="/user/startLoadDirectedCoordinatedCoursesFromHome" forward="/user/courseControllerFromHome.do?dispatch=loadDirectedCoordininatedCourses&amp;fromDispatch=loadDirectedCoordininatedCourses&amp;from=Home"/>
<action path="/user/courseControllerFromHome"
type="pt.estgp.estgweb.web.controllers.courses.CoursesController"
name="CourseForm"
59,11 → 64,13
input="page.separators.serviceZone">
<forward name="load.courses.programs" path="page.courses.programs.from.home"/>
<forward name="load.directed.coordinated.courses" path="page.directed.coordinated.courses.from.home"/>
<forward name="home" path="page.separators.home"/>
<forward name="confirm.courses.programs" path="page.separators.home"/>
</action>
 
 
 
 
 
</action-mappings>
 
</struts-config>
/impl/conf/WEB-INF/struts/tiles-courses.xml
32,6 → 32,16
<put name="topnav" value="/user/serviceZone/topnavSubmitCourse.jsp"/>
<put name="body" value="/admin/courses/course.jsp"/>
</definition>
<definition name="page.courses.programs.from.service.zone" extends="page.separators.serviceZone">
<put name="title" value="Ver Programas de Unidades"/>
<put name="topnav" value="/user/serviceZone/topnavCoursesPrograms.jsp"/>
<put name="body" value="/user/courses/directedCoordinatedCourses.jsp"/>
</definition>
<definition name="page.directed.coordinated.courses.from.service.zone" extends="page.separators.serviceZone">
<put name="title" value="Ver Cursos e Unidades"/>
<put name="topnav" value="/user/serviceZone/topnavDirectedCoordinatedCourses.jsp"/>
<put name="body" value="/user/courses/directedCoordinatedCourses.jsp"/>
</definition>
 
 
<definition name="page.directed.coordinated.courses.from.home" extends="page.separators.home">
45,6 → 55,7
<put name="body" value="/user/courses/directedCoordinatedCourses.jsp"/>
</definition>
 
 
 
 
/impl/conf/WEB-INF/struts/struts-default.xml
15,8 → 15,7
</form-beans>
 
<global-exceptions>
 
 
<exception key="error.401" type="pt.estgp.estgweb.web.exceptions.NotAuthorizedException" path="/error401.do"/>
</global-exceptions>
 
<global-forwards>
42,7 → 41,7
<action path="/Welcome" forward="page.welcome"/>
<action path="/StartAuthentication" forward="page.authentication"/>
<action path="/Logout" forward="/authenticate.do?dispatch=logout"/>
 
<!-- Errors -->
<action path="/errorNoCookies" forward="page.no.cookies"/>
<action path="/error401" forward="page.error.401"/>
50,6 → 49,19
<action path="/error500" forward="page.error.500"/>
<action path="/error503" forward="page.error.503"/>
 
<!--Layout Forward-->
<action path="/dirLayout"
type="pt.estgp.estgweb.web.DirLayoutController"
scope="request"
validate="false">
<forward name="layoutEmpty" path="page.layoutEmpty.dir"/>
<forward name="layout0" path="page.layout0.dir"/>
<forward name="layout1" path="page.layout1.dir"/>
<forward name="layout2" path="page.layout2.dir"/>
<forward name="layout3" path="page.layout3.dir"/>
<forward name="layout4" path="page.layout4.dir"/>
<forward name="layoutPortal" path="page.layoutPortal.dir"/>
</action>
<!--Layout Forward-->
<action path="/layout"
type="pt.estgp.estgweb.web.LayoutController"
108,8 → 120,8
<forward name="areaDG" path="page.areaDG.proxy"/>
<forward name="areaCE" path="page.areaCE.proxy"/>
<forward name="areaCH" path="page.areaCH.proxy"/>
 
 
<forward name="layoutCourses" path="page.layoutCourses.proxy"/>
<forward name="layout1.ftp" path="page.layout1.proxy.ftp"/>
<forward name="layout2.ftp" path="page.layout2.proxy.ftp"/>
/impl/conf/WEB-INF/struts/tiles-default.xml
1,8 → 1,8
<?xml version="1.0" encoding="UTF-8" ?>
 
<!--<!DOCTYPE tiles-definitions PUBLIC-->
<!--"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"-->
<!--"http://struts.apache.org/dtds/tiles-config_1_1.dtd">-->
<!--"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"-->
<!--"http://struts.apache.org/dtds/tiles-config_1_1.dtd">-->
 
 
<tiles-definitions>
47,6 → 47,9
</definition>
 
<!--Layouts-->
<definition name="base.layout0" extends="base.definition" path="/layout/layout0.jsp">
</definition>
 
<definition name="base.layout1" extends="base.definition" path="/layout/layout1.jsp">
<put name="navigation" value="/layout/navigationLeft.jsp" />
</definition>
74,6 → 77,27
</definition>
 
 
<definition name="page.layoutEmpty.dir" extends="base.empty">
<put name="body" value="/DirWebProxy"/>
</definition>
<definition name="page.layout0.dir" extends="base.layout0">
<put name="body" value="/DirWebProxy"/>
</definition>
<definition name="page.layout1.dir" extends="base.layout1">
<put name="body" value="/DirWebProxy"/>
</definition>
<definition name="page.layout2.dir" extends="base.layout2">
<put name="body" value="/DirWebProxy"/>
</definition>
<definition name="page.layout3.dir" extends="base.layout3">
<put name="body" value="/DirWebProxy"/>
</definition>
<definition name="page.layout4.dir" extends="base.layout4">
<put name="body" value="/DirWebProxy"/>
</definition>
<definition name="page.layoutPortal.dir" extends="base.layoutPortal">
<put name="body" value="/DirWebProxy"/>
</definition>
 
<!-- Proxies -->
<definition name="page.layout1.proxy" extends="base.layout1">
97,7 → 121,7
<definition name="page.layoutAssessoria.proxy" extends="base.layoutPortal">
<put name="body" value="/WebProxy"/>
</definition>
<definition name="page.layoutNuleoEngenharia.proxy" extends="base.layoutPortal">
<definition name="page.layoutNuleoEngenharia.proxy" extends="base.layoutPortal">
<put name="body" value="/WebProxy"/>
</definition>
 
161,8 → 185,8
<put name="body" value="/public/portals/futurosAlunos/futureStudent.jsp"/>
</definition>
<definition name="page.portal.teacher" extends="base.layoutPortal">
<put name="body" value="/public/portals/Docentes/teacher.jsp"/>
<!--<put name="body" value="/templates/templatePageAssessoria.jsp"/> -->
<put name="body" value="/public/portals/Docentes/teacher.jsp"/>
<!--<put name="body" value="/templates/templatePageAssessoria.jsp"/> -->
</definition>
 
<!--Alunos-->
170,7 → 194,7
<put name="topnav" value="/public/portals/alunos/topnavOrgaos.jsp" />
<put name="navigationLeft" value="/public/portals/alunos/orgaos.jsp" />
</definition>
<definition name="page.alunosContactosPortalMenu.proxy" extends="page.layoutPortal.proxy">
<definition name="page.alunosContactosPortalMenu.proxy" extends="page.layoutPortal.proxy">
<put name="topnav" value="/public/portals/alunos/topnavContactos.jsp" />
<put name="navigationLeft" value="/public/portals/alunos/contactos.jsp" />
</definition>
281,12 → 305,12
<put name="topnav" value="/public/portals/Docentes/topnavInstitutoPolitecnico.jsp" />
<put name="navigationLeft" value="/public/portals/Docentes/institutoPolitecnico.jsp" />
</definition>
<!--Alunos Assessoria-->
<!--Alunos Assessoria-->
<definition name="page.layoutAA.proxy" extends="page.layoutAssessoria.proxy">
<put name="topnav" value="/public/portals/assessoria/topnavAssessoria.jsp" />
<put name="navigationLeft" value="/public/portals/assessoria/assessoria.jsp" />
</definition>
<!--Nucleo de Engenharia-->
<!--Nucleo de Engenharia-->
<definition name="page.layoutNucleoENG.proxy" extends="page.layoutNuleoEngenharia.proxy">
<put name="topnav" value="/public/portals/nucleoEngenharia/topnavNucleoEngenharia.jsp" />
<put name="navigationLeft" value="/public/portals/nucleoEngenharia/nucleoEngenharia.jsp" />
300,7 → 324,7
<put name="body" value="/public/index.jsp" />
</definition>
 
 
<!-- Autenticacao -->
<definition name="page.authentication" extends="base.layout1">
<put name="title" value="Authentication" />
/impl/conf/WEB-INF/tlds/baco.tld
163,6 → 163,20
</attribute>
</tag>
<tag>
<name>canNotAddContent</name>
<tagclass>pt.estgp.estgweb.web.tags.CanNotAddContentTag</tagclass>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>property</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
<tag>
<name>canLoad</name>
<tagclass>pt.estgp.estgweb.web.tags.CanLoadTag</tagclass>
<attribute>
/impl/conf/WEB-INF/web.xml
145,6 → 145,10
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>DirWebProxy</servlet-name>
<servlet-class>pt.estgp.estgweb.web.DirWebProxy</servlet-class>
</servlet>
<servlet>
<servlet-name>WebProxy</servlet-name>
<servlet-class>pt.estgp.estgweb.web.WebProxy</servlet-class>
</servlet>
157,6 → 161,10
<!--<servlet-class>pt.estgp.estgweb.web.FTPProxy</servlet-class>-->
<!--</servlet>-->
<servlet>
<servlet-name>DirProxy</servlet-name>
<servlet-class>pt.estgp.estgweb.web.DirProxy</servlet-class>
</servlet>
<servlet>
<servlet-name>LayoutProxy</servlet-name>
<servlet-class>pt.estgp.estgweb.web.LayoutProxy</servlet-class>
</servlet>
193,6 → 201,10
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DirWebProxy</servlet-name>
<url-pattern>/DirWebProxy</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WebProxy</servlet-name>
<url-pattern>/WebProxy</url-pattern>
</servlet-mapping>
205,6 → 217,10
<!--<url-pattern>/FTPProxy</url-pattern>-->
<!--</servlet-mapping>-->
<servlet-mapping>
<servlet-name>DirProxy</servlet-name>
<url-pattern>/dir/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>LayoutProxy</servlet-name>
<url-pattern>/proxy/*</url-pattern>
</servlet-mapping>
/impl/conf/app.properties
30,9 → 30,19
email.courseunit.announcement.subject.pt={0}: {1} (ESTG)
email.courseunit.announcement.subject.en={0}: {1} (ESTG)
 
email.courseunit.blogpost.subject.pt={0}: {1} (ESTG)
email.courseunit.blogpost.subject.en={0}: {1} (ESTG)
 
email.new.grades=true
email.courseunit.announcements=true
email.courseunit.blogs=true
 
email.summaries=false
 
email.summary.subject.pt=Sumário lançado em {0}
email.summary.subject.en=Sumário lançado em {0}
 
 
##################################################
# Modules usage
#
75,12 → 85,13
ionline.pass=baco
ionline.user=Baco_web
 
server.estgp=http://localhost:8180
#server.estgp=http://localhost:8180
#estgp.encoding=ISO-8859-1
server.estgp.start.path=/static
 
#server.estgp=http://www.estgp.pt/testes/nova_web
server.estgp.start.path=
server.estgp=http://www.estgp.pt/testes/nova_web
estgp.encoding=UTF-8
estgp.proxy.host=
estgp.proxy.port=
 
##server.estgp=http://localhost:8080/estgweb
server.estgweb=http://www.estgp.pt/testes/estgweb
97,6 → 108,16
#server.estgp=http://localhost:8080/estgweb
estgp2.encoding=UTF-8
 
 
server.casaTestes=http://localhost:8080
server.casaTestes.start.path=/static
casaTestes.encoding=ISO-8859-1
casaTestes.proxy.host=
casaTestes.proxy.port=
 
 
proxy.extensions=html htm php asp aspx dhtml jsp py
 
################################################
## Kinds of roles
user.admin=admin
119,22 → 140,29
user.role.08=teacher.eg
user.role.09=teacher.dg
user.role.10=teacher.ce
user.role.11=worker
user.role.12=invited
user.role.13=services
user.role.14=administrativeCouncil
user.role.15=scientificCouncil
user.role.16=pedagogicCouncil
user.role.17=erasmusCouncil
user.role.18=courseCoordinator
user.role.19=studentAssociation
user.role.20=representativeCouncil
user.role.21=computerCenter
user.role.22=courseCoordinator
user.role.23=courseDirector
user.role.24=identifiersManager
user.role.25=identifiersCollectionCreator
user.role.26=servicesPrograms
user.role.11=teacher.ch
user.role.12=worker
user.role.13=invited
user.role.14=services
user.role.15=administrativeCouncil
user.role.16=scientificCouncil
user.role.17=pedagogicCouncil
user.role.18=erasmusCouncil
user.role.19=courseCoordinator
user.role.20=studentAssociation
user.role.21=representativeCouncil
user.role.22=computerCenter
user.role.23=courseCoordinator
user.role.24=courseDirector
user.role.25=identifiersManager
user.role.26=identifiersCollectionCreator
user.role.27=servicesPrograms
user.role.28=studentsID
user.role.29=studentsFSIR
user.role.30=student.eg
user.role.31=student.dg
user.role.32=student.ce
user.role.33=student.ch
 
 
#########################################################################
251,19 → 279,20
 
#GENERIC FILTER IGNORE UserSessionFilter and CookieFilter
 
filter.ignore.extension.1=.js
filter.ignore.extension.2=.css
filter.ignore.extension.3=.jpg
filter.ignore.extension.4=.gif
filter.ignore.extension.5=.png
filter.ignore.extension.6=.tif
filter.ignore.extension.7=.bmp
filter.ignore.extension.8=.swf
#filter.ignore.extension.1=.js
#filter.ignore.extension.2=.css
#filter.ignore.extension.3=.jpg
#filter.ignore.extension.4=.gif
#filter.ignore.extension.5=.png
#filter.ignore.extension.6=.tif
#filter.ignore.extension.7=.bmp
#filter.ignore.extension.8=.swf
filter.ignore.prefix.1=/statUnits.jsp
filter.ignore.prefix.2=/units.jsp
filter.ignore.prefix.3=/js
filter.ignore.prefix.4=/css
filter.ignore.prefix.5=/imageStream
filter.ignore.prefix.6=/imgs
 
 
#See java.text.SimpleDateFormat
348,4 → 377,14
 
 
 
###########################################################################
#
# AREAS CIENTIFICAS
#
 
area.1=eg
area.2=dg
area.3=ce
area.4=ch
 
 
/impl/conf/template/email/courseUnitBlogPost_en.txt
New file
0,0 → 1,22
# 0 : Course Unit Name
# 1 : Title
# 2 : Text
# 3 : Teacher
#
# Course Unit Announcement
#
Dear Student
 
A new post has been inserted in unit blog:
{0}
 
{1}
 
{2}
 
Best Regards {3}
 
---------------------------------------------
Escola Superior de Tecnologia e Gestão
Instituto Politécnico de Portalegre
http://www.estgp.pt
/impl/conf/template/email/courseUnitBlogPost_pt.txt
New file
0,0 → 1,22
# 0 : Course Unit Name
# 1 : Title
# 2 : Text
# 3 : Teacher
#
# Course Unit Announcement
#
Caro estudante
 
Um novo post foi publicado no blog da unidade:
{0}
 
{1}
 
{2}
 
Com os melhores cumprimentos {3}
 
---------------------------------------------
Escola Superior de Tecnologia e Gestão
Instituto Politécnico de Portalegre
http://www.estgp.pt
/impl/conf/template/email/summary_en.txt
New file
0,0 → 1,17
#Email course unit summary
Dear Student
 
Follow the summary of {0} number {1} at day {2}
 
Summary
 
title: {3}
 
{4}
 
Best Regards
 
---------------------------------------------
Escola Superior de Tecnologia e Gestão
Instituto Politécnico de Portalegre
http://www.estgp.pt
/impl/conf/template/email/summary_pt.txt
New file
0,0 → 1,17
#Email course unit summary
Caro Aluno
 
Segue o sumario da disciplina de {0} da aula {1} do dia {2}
 
Sumário
 
titulo: {3}
 
{4}
 
Com os melhores cumprimentos
 
---------------------------------------------
Escola Superior de Tecnologia e Gestão
Instituto Politécnico de Portalegre
http://www.estgp.pt
/impl/conf/directories/foo.xsd
New file
0,0 → 1,15
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2008 rel. 2 sp2 (http://www.altova.com) by Jorge Machado (Escola Superior de tecnologia e Gestao, Portalegre) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="foo" targetNamespace="foo" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="record">
<xs:annotation>
<xs:documentation>This schema olds records</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="title"/>
<xs:element name="text"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
/impl/conf/directories/directory.xsd
New file
0,0 → 1,115
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2008 rel. 2 sp2 (http://www.altova.com) by Jorge Machado (Escola Superior de tecnologia e Gestao, Portalegre) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.estgp.pt/baco/directory/" targetNamespace="http://www.estgp.pt/baco/directory/" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="directory">
<xs:annotation>
<xs:documentation>This schema is to define information structured directories</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="groupsDeclaration" type="groupDeclarationT" minOccurs="0"/>
<xs:element name="node" type="nodeT" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="label" use="required"/>
<xs:attribute name="style" use="required"/>
<xs:attribute name="layout" use="required"/>
<xs:attribute name="layoutRoot" use="required"/>
<xs:attribute name="targetRole" use="required"/>
<xs:attribute name="menuKey" use="required"/>
</xs:complexType>
</xs:element>
<xs:complexType name="nodeT">
<xs:annotation>
<xs:documentation>A node is a directory internal object, it has a label and an identifier and can have children nodes and/or leafs</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="groupsDeclaration" type="groupDeclarationT" minOccurs="0"/>
<xs:choice maxOccurs="unbounded">
<xs:element name="node" type="nodeT"/>
<xs:element name="leaf" type="leafT"/>
</xs:choice>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="label" use="required"/>
<xs:attribute name="group" use="optional">
<xs:annotation>
<xs:documentation>Grouping purposes in styling</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="id" type="xs:ID" use="required"/>
</xs:complexType>
<xs:complexType name="leafT">
<xs:annotation>
<xs:documentation>A leaf is an URL for an external or internal WEB site</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="url" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:ID" use="required"/>
<xs:attribute name="label" use="required"/>
<xs:attribute name="xml" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation>False by default</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="layout" type="xs:boolean">
<xs:annotation>
<xs:documentation>True by default, define if a source is to be included in layout or opened in all window</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="style" type="xs:boolean">
<xs:annotation>
<xs:documentation>True by default, define if a source is to be styled by the XSLT.
When style=false and layout=false external file will be directly writed in TopWindow</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="absolute" type="xs:boolean" use="required">
<xs:annotation>
<xs:documentation>follow parameter will be evaluated only If this parameter is set to false</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="proxy" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>Only consider a proxy if it is here defined</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="group" use="optional">
<xs:annotation>
<xs:documentation>Grouping purposes in styling</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="groupDeclarationT">
<xs:sequence>
<xs:element name="group" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="rightsT">
<xs:annotation>
<xs:documentation>Rights define who is authorized to enter in a node</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="role" type="rightT1"/>
<xs:element name="user" type="rightT1"/>
</xs:choice>
<xs:element name="internal" type="xs:boolean" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="rightT1" mixed="true">
<xs:annotation>
<xs:documentation>A right T1 can be to permit or restrict</xs:documentation>
</xs:annotation>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="permit"/>
<xs:enumeration value="restrict"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:schema>
/impl/conf/directories/student.xml
New file
0,0 → 1,21
<?xml version="1.0" encoding="UTF-8"?>
<directory label="Alunos" layout="layout0" layoutRoot="layoutPortal" targetRole="student" id="student" menuKey="menu.alunos" style="style1.xsl" xmlns="http://www.estgp.pt/baco/directory/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.estgp.pt/baco/directory/ directory.xsd">
<groupsDeclaration>
<group>1</group>
<group>2</group>
</groupsDeclaration>
<node label="Serviços on-line" id="servicosOnLine" group="1">
<leaf absolute="false" url="/public/portal/servicosWebmail.html" proxy="estgp" id="servWebmail" label="Webmail"></leaf>
<leaf absolute="false" url="/public/portal/servicosEduroam.html" proxy="estgp" id="servEduroam" label="Eduroam"></leaf>
<leaf absolute="false" url="/public/portal/servicosSecretaria.html" proxy="estgp" id="servSecretaria" label="Secretaria"></leaf>
<leaf absolute="false" url="/public/portal/servicosBiblioteca.html" proxy="estgp" id="servvBibliotecaOnline" label="Biblioteca online"></leaf>
<leaf absolute="false" url="/public/portal/servicosAcademicosOnline.html" proxy="estgp" id="servAcademicosOnline" label="Académicos online"></leaf>
<leaf absolute="false" url="/public/portal/servicosGabineteComunicacao.html" proxy="estgp" id="servGabinetedeComunicacao" label="Gabinete de Comunicação"></leaf>
<leaf absolute="false" url="/public/portal/servicosRegie.html" proxy="estgp" id="servRegie" label="Régie"></leaf>
<leaf absolute="false" url="/public/portal/servicosCentroInformatico.html" proxy="estgp" id="servCentroInformatico" label="Centro informático"></leaf>
<leaf absolute="false" url="/public/portal/servicosReprografia.html" proxy="estgp" id="servReprografia" label="Reprografia"></leaf>
</node>
<node label="Contactos" id="contactos" group="2">
<leaf absolute="false" url="/public/portal/contactosContactosGeraisEstg.html" proxy="estgp" id="contGerais" label="Contactos gerais estg"></leaf>
</node>
</directory>
/impl/conf/directories/utils.xsl
New file
0,0 → 1,76
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:d="http://www.estgp.pt/baco/directory/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<xsl:param name="dirStartPath"><xsl:value-of select="$contextPath"/>/dir</xsl:param>
<xsl:template match="d:directory" mode="link">
<a>
<xsl:attribute name="href">
<xsl:value-of select="$dirStartPath"/>/<xsl:value-of select="@id"/>?role=<xsl:value-of select="@targetRole"/>&amp;menu=<xsl:value-of select="@menuKey"/>
</xsl:attribute>
<xsl:apply-templates select="." mode="label"/>
</a>
</xsl:template>
<xsl:template match="d:node" mode="link">
<a>
<xsl:attribute name="href">
<xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/>
</xsl:attribute>
<xsl:apply-templates select="." mode="label"/>
</a>
</xsl:template>
<xsl:template match="d:leaf" mode="link">
<a>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="string(@absolute)='true'">
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$dirStartPath"/><xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/><xsl:value-of select="@url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="." mode="label"/>
</a>
</xsl:template>
<xsl:template match="d:directory" mode="linkParent">/<xsl:value-of select="@id"/></xsl:template>
<xsl:template match="d:node" mode="linkParent">
<xsl:apply-templates select=".." mode="linkParent"/>/<xsl:value-of select="@id"/>
</xsl:template>
<xsl:template match="d:leaf" mode="bodyContent">
<xsl:choose>
<xsl:when test="string(@xml) = 'true'">
<xsl:variable name="bodyDoc" select="document($includeXML)"/>
<xsl:apply-templates select="$bodyDoc/*"/>
</xsl:when>
<xsl:otherwise>
@@BODY_CONTENT@@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
 
<xsl:template match="d:directory" mode="label">
<xsl:value-of select="@label"/>
</xsl:template>
<xsl:template match="d:node" mode="label">
<xsl:value-of select="@label"/>
</xsl:template>
<xsl:template match="d:leaf" mode="label">
<xsl:value-of select="@label"/>
</xsl:template>
<!--Static templates-->
<xsl:template name="leafsBlockLabel">
Links
</xsl:template>
<xsl:template name="homeLink">
<a>
<xsl:attribute name="href"><xsl:value-of select="$contextPath"/></xsl:attribute>
home
</a>
</xsl:template>
</xsl:stylesheet>
/impl/conf/directories/style1.xsl
New file
0,0 → 1,611
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cmPort="http://www.cm-portalegre.pt/projectos/" version="1.0" xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon" xmlns:d="http://www.estgp.pt/baco/directory/" xmlns:foo="foo" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<xsl:import href="utils.xsl"/>
<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="yes" />
 
<xsl:param name="contextPath">/baco</xsl:param>
<xsl:param name="username">jmachado</xsl:param>
<xsl:param name="name">Jorge Machado</xsl:param>
<xsl:param name="roles">professor,administrador</xsl:param>
<!--<xsl:param name="ACTUAL">pagina_a1.2.1</xsl:param>-->
<!--<xsl:param name="ACTUAL">ficha_trabalhoIncluido</xsl:param>-->
<xsl:param name="ACTUAL">pagina_teste.html</xsl:param>
<xsl:param name="includeXML">oai_dc.xml</xsl:param>
<xsl:template match="/">
<div>
<xsl:apply-templates select="//*[@id=$ACTUAL]" mode="root"/>
</div>
</xsl:template>
<xsl:template match="cmPort:dadosProjecto">
<table>
<tr>
<th colspan="2">Dados de Projecto</th>
</tr>
<tr>
<th>Nome</th>
<td><xsl:value-of select="./cmPort:nome/text()"/></td>
</tr>
<tr>
<th>Data</th>
<td><xsl:value-of select="./cmPort:data/text()"/></td>
</tr>
<tr>
<th>Local</th>
<td><xsl:value-of select="./cmPort:local/text()"/></td>
</tr>
<tr>
<th>Equipa Técnica</th>
<td><xsl:value-of select="./cmPort:equipaTecnica/text()"/></td>
</tr>
<xsl:if test="./cmPort:parecer/text()">
<tr>
<th>Parecer</th>
<td><xsl:value-of select="./cmPort:parecer/text()"/></td>
</tr>
</xsl:if>
</table>
</xsl:template>
<xsl:template match="/" mode="single">
<html>
<head>
<title>O meu Directório ESTG</title>
<style type="text/css">
body
{
color: black;
border: 0;
padding: 0;
margin-left: auto;
margin-right: auto;
margin-top: 0;
font-family: sans-serif;
font-size: 0.7em;
}
ul
{
margin:0;
}
#header, #header td, #header td a
{
padding-left:10px;
background-color:#396F9D;
color:white;
}
 
#bigTable
{
width:100%;
}
#latNavContainer
{
width:160px;
vertical-align:top;
}
#footer
{
border-top: 1px solid black;
text-align:center;
}
#latNav
{
padding-left:10px;
background-color:lightgreen;
}
#latNav h2
{
font-family: sans-serif;
font-size: 0.7em;
background-color: blue;
color:yellow;
margin-bottom:0;
}
#latNav ul
{
list-style:none;
padding-left: 15px;
margin-left:0;
}
#latNav li
{
font-size: 0.7em;
white-space:nowrap;
}
#latNav li .selected
{
background-color:green;
}
#topnav
{
padding-left:10px;
background-color:yellow;
}
#content
{
padding:4px;
border: 1px solid black;
}
<!--Blocos do conteudo dos directorios-->
.block
{
margin-bottom:10px;
border-left: 1px solid #8EC73F;
}
.block .head
{
font-style:italic;
}
.block
{
font-family: sans-serif;
font-size: 0.7em;
}
.block ul li p
{
background-color:transparent;
font-style:italic;
}
.block ul li ul li
{
padding-left: 0;
}
.block p, .navLeftMenu h2 {
background-color: #8EC73F;
padding-left: 0;
margin: 0;
}
.block ul
{
list-style:none;
padding-left: 5px;
margin-left:0;
}
.block ul li{
padding-top:3px;
padding-left:0;
margin-left:0;
}
.block a {
color: #4d4d4d;
text-decoration: none;
}
.block a:visited {
/*color: #4d4d4d;*/
text-decoration: none;
}
.block a:hover, .linkUnderlineGrayToGreen a:hover {
color: #8EC73F;
text-decoration: underline;
}
.links p
{
background-color:yellow;
}
.links .block
{
border-left: 1px solid yellow;
}
.columnTable
{
width:100%;
}
.columnTable td
{
margin-left: 10px;
}
td.column {
vertical-align: top;
}
 
</style>
</head>
<body>
<xsl:call-template name="header"/>
<xsl:apply-templates select="//*[@id=$ACTUAL]" mode="root"/>
<xsl:call-template name="footer"/>
</body>
</html>
</xsl:template>
<xsl:template name="header">
<div id="header">
<h1>Bem vindos ao meu directorio</h1>
Está autenticado como <xsl:value-of select="$name"/> com os papeis: <xsl:value-of select="$roles"/>
</div>
</xsl:template>
<xsl:template name="footer">
<div id="footer">
Sistema de Directorios da <a href="http://www.estgp.pt">ESTG</a> 2008
</div>
</xsl:template>
<!--
===========================================================
| Página de Apresentação de um Nó no Corpo da Página
===========================================================
-->
<xsl:template match="d:directory" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<xsl:apply-templates select="." mode="childs"/>
</xsl:template>
 
<xsl:template match="d:node" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<td id="leftPage">
<xsl:apply-templates select=".." mode="latNav"/>
</td>
<td class="contentPortal">
<div class="portal">
<xsl:apply-templates select="." mode="childs"/>
</div>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="d:directory" mode="childs">
<table class="columnTable">
<tr>
<td class="column">
<xsl:if test="d:leaf">
<div class="block links">
<p><xsl:call-template name="leafsBlockLabel"/></p>
<ul>
<xsl:for-each select="d:leaf">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</td>
<xsl:if test="d:node">
<xsl:choose>
<xsl:when test="d:groupsDeclaration">
<xsl:for-each select="d:groupsDeclaration/d:group">
<tr>
<xsl:variable name="group" select="."/>
<xsl:for-each select="../../d:node[@group=$group]">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="d:node">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</tr>
</table>
</xsl:template>
<xsl:template match="d:node" mode="childs">
<table class="columnTable">
<tr>
<td class="column">
<xsl:if test="d:leaf">
<div class="block links">
<p><xsl:call-template name="leafsBlockLabel"/></p>
<ul>
<xsl:for-each select="d:leaf">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</td>
<xsl:if test="d:node">
<xsl:choose>
<xsl:when test="d:groupsDeclaration">
<xsl:for-each select="d:groupsDeclaration/d:group">
<tr>
<xsl:variable name="group" select="."/>
<xsl:for-each select="../../d:node[@group=$group]">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="d:node">
<td class="column">
<xsl:apply-templates select="." mode="block"/>
</td>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</tr>
</table>
</xsl:template>
<xsl:template match="d:node" mode="block">
<div class="block">
<p><xsl:apply-templates select="." mode="link"/></p>
<ul>
<xsl:for-each select="d:leaf">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
<xsl:for-each select="d:node">
<li>
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:template>
<!--
===========================================================
| Página de Apresentação de uma Folha no Corpo da Página
===========================================================
-->
<xsl:template match="d:leaf" mode="root">
<xsl:apply-templates select="." mode="topNav"/>
<table id="bigTable">
<tr>
<td id="leftPage">
<xsl:apply-templates select=".." mode="latNav"/>
</td>
<td class="contentPortal">
<xsl:apply-templates select="." mode="bodyContent"/>
</td>
</tr>
</table>
</xsl:template>
<!--<xsl:function name="d:parse" as="document-node()">
<xsl:param name="s" as="xs:string"/>
<xsl:sequence select="doc(concat('data:text/xml','&lt;ola&gt;teste&lt;/ola&gt;'))"/>
 
--><!--<xsl:sequence select="doc(concat('data:text/xml',$s))"/> --><!--
</xsl:function>-->
 
<!--
===========================================================
| Barra de Navegação Superior
===========================================================
-->
<xsl:template match="d:leaf" mode="topNav">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
&gt;
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>
</xsl:template>
 
<xsl:template match="d:node" mode="topNav">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
&gt;
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>
</xsl:template>
 
<xsl:template match="d:directory" mode="topNav">
<!--O Baco faz isto por nós para que a barra superior fique alinhada correctamente-->
<!--<div id="topnav">
<ul>
<li class="navPlace">
<xsl:call-template name="homeLink"/>
</li>
<li class="navPlace">
&gt;
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>-->
</xsl:template>
<xsl:template match="d:directory" mode="navBack">
<li class="navPlace">
<xsl:call-template name="homeLink"/>
</li>
<li class="navPlace">
&gt;
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:template>
<xsl:template match="d:node" mode="navBack">
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
&gt;
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:template>
<!--
===========================================================
| Barra de Navegação Lateral Esquerda
===========================================================
-->
<xsl:template match="d:node" mode="latNav">
<xsl:if test="./d:leaf or ./d:node">
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:node">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
<xsl:apply-templates select="." mode="label"/>
</li>
</xsl:when>
<xsl:otherwise>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf">
<li class="navPlace">...<xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="d:directory" mode="latNav">
<xsl:if test="./d:leaf or ./d:node">
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><xsl:apply-templates select="." mode="label"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul id="portalMenu">
<xsl:for-each select="./d:node">
<xsl:choose>
<xsl:when test="@id = $ACTUAL">
<li class="navPlace selected">
<xsl:apply-templates select="." mode="label"/>
</li>
</xsl:when>
<xsl:otherwise>
<li class="navPlace">
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="./d:leaf">
<li class="navPlace">...<xsl:apply-templates select="." mode="link"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</xsl:if>
</xsl:template>
<!--
===========================================================
| Apresentar Todo o Directorio em árvore - NAO ESTA EM USO DE MOMENTO
===========================================================
-->
<xsl:template name="treeRoot">
<xsl:if test="/d:directory/d:node">
<ul>
<xsl:for-each select="/d:directory/d:node">
<li>
<xsl:apply-templates select="." mode="treeLoop"/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
<xsl:template match="d:node" mode="treeLoop">
<div>
<xsl:if test="$ACTUAL=@id">
<xsl:attribute name="style">background-color:yellow</xsl:attribute>
</xsl:if>
<p><xsl:value-of select="@label"/></p>
<xsl:if test="./d:leaf">
<xsl:for-each select="./d:leaf">
<xsl:apply-templates select="." mode="tree"/>
</xsl:for-each>
</xsl:if>
<xsl:if test="./d:node">
<ul>
<xsl:for-each select="./d:node">
<li>
<xsl:apply-templates select="." mode="treeLoop"/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="d:leaf" mode="tree">
<div>
<xsl:if test="$ACTUAL=@id">
<xsl:attribute name="style">background-color:yellow</xsl:attribute>
</xsl:if>
<p>...<xsl:apply-templates mode="label"/></p>
</div>
</xsl:template>
<!--
===========================================================
| TEMPLATES DE OUTROS ESQUEMAS
===========================================================
-->
<!-- Foo Templates -->
<xsl:template match="foo:record">
<p>titulo:<xsl:value-of select="foo:title"/></p>
<p>texto:<xsl:value-of select="foo:text"/></p>
</xsl:template>
 
 
<!--OAIDC Templates-->
 
<xsl:template match="oai_dc:dc">
<table>
<tr>
<th colspan="2">Registo Bibliografico</th>
</tr>
<xsl:apply-templates select="./dc:*"/>
</table>
</xsl:template>
<xsl:template match="dc:*">
<tr>
<th><xsl:value-of select="local-name(.)"/></th>
<td><xsl:value-of select="./text()"/></td>
</tr>
</xsl:template>
 
</xsl:stylesheet>
/impl/conf/berserk/sd.xml
853,10 → 853,21
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Services"/>
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
<service>
<name>LoadCoursesImportYears</name>
<implementationClass>pt.estgp.estgweb.services.courses.CoursesService</implementationClass>
<description>Load import years</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadImportYears</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
<service>
<name>UpdateDirectedCoordinatedCoursesForUserInSession</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService</implementationClass>
<description>Load coordinated directed courses</description>
997,7 → 1008,7
<implementationClass>pt.estgp.estgweb.services.courseunits.CreateCourseUnitWorksBackupService</implementationClass>
<description>Create a zip file with Intranet folders</description>
<isTransactional>true</isTransactional>
<defaultMethod>createSystemActualYearBackup</defaultMethod>
<defaultMethod>createSystemBackup</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
1005,6 → 1016,18
</filterChains>
</service>
<service>
<name>CreateImportYearCourseUnitWorksBackup</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.CreateCourseUnitWorksBackupService</implementationClass>
<description>Create a zip file with Intranet folders</description>
<isTransactional>true</isTransactional>
<defaultMethod>createSystemImportYearBackup</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
<service>
<name>CreateUserActualYearCourseUnitWorksBackup</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.CreateCourseUnitWorksBackupService</implementationClass>
<description>Create a zip file with deliverables</description>
1016,6 → 1039,17
</filterChains>
</service>
<service>
<name>CreateUserImportYearCourseUnitWorksBackup</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.CreateCourseUnitWorksBackupService</implementationClass>
<description>Create a zip file with deliverables</description>
<isTransactional>true</isTransactional>
<defaultMethod>createImportYearBackup</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
<service>
<name>CreateUserAllCourseUnitWorksBackup</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.CreateCourseUnitWorksBackupService</implementationClass>
<description>Create a zip file with Intranet folders</description>
1075,6 → 1109,16
</filterChains>
</service>
<service>
<name>LoadCoursesImportYearArea</name>
<implementationClass>pt.estgp.estgweb.services.courses.CoursesService</implementationClass>
<description>Load All Courses</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadCoursesImportYearArea</defaultMethod>
<filterChains>
<chain name="Logger"/>
</filterChains>
</service>
<service>
<name>LoadCoursesImportYear</name>
<implementationClass>pt.estgp.estgweb.services.courses.CoursesService</implementationClass>
<description>Load All Courses</description>
/impl/conf/berserk/fcd.xml
42,8 → 42,8
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass>
</filterChain>
<filterChain>
<name>Services</name>
<expression>AuthenticatedUsers &amp;&amp; RoleUsers("servicesPrograms")</expression>
<name>ServicesOrOrganisms</name>
<expression>AuthenticatedUsers &amp;&amp; (RoleUsers("admin") || RoleUsers("servicesPrograms") || RoleUsers("administrativeCouncil") || RoleUsers("scientificCouncil") || RoleUsers("pedagogicCouncil"))</expression>
<description>Validate if a user is coordinator or director</description>
<invocationTiming>1</invocationTiming>
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass>
/impl/src/java/jomm/utils/StringsUtils.java
115,6 → 115,8
return true;
}
 
 
public static String normalizeResourceName(String name)
{
if(name == null || name.trim().length() == 0)
184,6 → 186,7
 
public static void main(String [] args)
{
System.out.println(normalizeResourceName("teste.teste monhe 2.d.zip"));
System.out.println(cleanKeepNumbers("90.0123-212"));
 
}
264,4 → 267,5
}
 
 
 
}
/impl/src/java/jomm/dao/utils/HibernateUtils.java
14,17 → 14,16
 
public class HibernateUtils implements Runnable{
 
// private static Session session;
// private static Session session;
private static final Logger logger = Logger.getLogger(HibernateUtils.class);
private static final SessionFactory sessionFactory;
private static SessionFactory sessionFactory;
 
static
{
try
{
Configuration config = new Configuration();
config.configure(Thread.currentThread().getContextClassLoader().getResource("pt/estgp/estgweb/hibernate.cfg.xml"));
sessionFactory = config.buildSessionFactory();
createFactory();
 
// session = sessionFactory.openSession();
}
catch (Throwable e)
34,8 → 33,17
}
}
 
private static void createFactory()
{
Configuration config = new Configuration();
config.configure(Thread.currentThread().getContextClassLoader().getResource("pt/estgp/estgweb/hibernate.cfg.xml"));
sessionFactory = config.buildSessionFactory();
}
 
public static SessionFactory getSessionFactory()
{
if(sessionFactory.isClosed())
createFactory();
return sessionFactory;
}
 
51,7 → 59,7
// if(!examples.isOpen())
// examples = sessionFactory.openSession();
// return examples;
return sessionFactory.getCurrentSession();
return getSessionFactory().getCurrentSession();
}
 
public static void main(String [] args) throws SQLException
/impl/src/java/jomm/dao/impl/AbstractDao.java
326,7 → 326,7
}
 
/**
*
*
* @param o
* @return
*/
698,7 → 698,7
/**
* Refresh a collection of objects.
*
* @param objs Objects to delete
* @param objs Objects to refreh
*/
public final void refresh(Collection<CLAZZ> objs)
{
715,7 → 715,26
throw new DaoException(e);
}
}
/**
* Refresh a collection of objects.
*
* @param obj Object to refreh
*/
public final void refresh(CLAZZ obj)
{
try
{
Session session = getCurrentSession();
 
session.refresh(obj);
 
}
catch (HibernateException e)
{
throw new DaoException(e);
}
}
 
/**
* Refresh a collection of objects.
*
/impl/src/java/pt/estgp/estgweb/utils/DatesUtils.java
63,6 → 63,31
}
}
 
public static enum SemestreModerate
{
S1,
S2,
S1S2
}
 
public static SemestreModerate getSemestreModerate()
{
MyCalendar mc = new MyCalendar();
int month = mc.getMonth();
if(month > 8 && month <=12)
{
return SemestreModerate.S1;
}
else if(month >= 1 && month <=3)
{
return SemestreModerate.S1S2;
}
else
{
return SemestreModerate.S2;
}
}
 
public static String getImportYearIntranet()
{
MyCalendar mc = new MyCalendar();
86,6 → 111,18
return getFormatedImportYear(firstYearStr,secondYearStr,SIGES_importFinalFormatIntranet);
}
 
public static String getImportYearIntranet(String importYear)
{
String decadeStr = importYear.substring(0,2);
if(importYear.substring(4,6).equals("00"))
{
String decade = importYear.substring(0,2);
int nextdecade= Integer.parseInt(decade)+1;
decadeStr = "" + nextdecade;
}
return getFormatedImportYear(importYear.substring(0,4),decadeStr+importYear.substring(4,6),SIGES_importFinalFormatIntranet);
}
 
public static String getFormatedImportYear(String firstYearStr, String secondYearStr, MessageFormat finalFormat)
{
String[] years = {firstYearStr,secondYearStr};
/impl/src/java/pt/estgp/estgweb/utils/AreasBelongUtils.java
New file
0,0 → 1,126
package pt.estgp.estgweb.utils;
 
import pt.estgp.estgweb.domain.SigesUser;
import pt.estgp.estgweb.Globals;
 
import javax.servlet.http.HttpServletRequest;
import java.util.List;
 
import jomm.utils.MessageResources;
 
/**
* @author Jorge
* @date 16/Jan/2009
* @time 15:45:25
*/
public class AreasBelongUtils
{
private static String AREA_MESSAGE_RESOURCES_PREFIX = "area.";
public static String AREAS_SEPARATOR = ",";
 
private static List<String> areas = null;
 
public static boolean hasArea(SigesUser u, List requiredAreas)
{
if(u == null)
return false;
for(Object area: requiredAreas)
{
if(hasArea(u,(String) area))
return true;
}
return false;
}
 
public static boolean hasArea(SigesUser u, String requiredArea)
{
if(u == null)
return false;
if(u.getAreasBelong() == null || u.getAreasBelong().length() == 0)
return false;
 
String[] areas = u.getAreasBelong().split(AREAS_SEPARATOR);
for(String area: areas)
{
if(area.equals(requiredArea))
return true;
}
return false;
}
 
public static boolean hasArea(List<String> areas, String requiredAreas)
{
if(areas == null || areas.size() == 0)
return false;
 
for(String area: areas)
{
if(area.equals(requiredAreas))
return true;
}
return false;
}
 
 
public static List readAreas()
{
if(areas == null)
{
areas = Globals.AREAS;
}
return areas;
}
 
public static String getAreaDescription(HttpServletRequest request, String area)
{
return MessageResources.getMessage(request, AREA_MESSAGE_RESOURCES_PREFIX + area);
}
 
public static String getSerialAreas(List<String> targetRoles)
{
return StringsUtils.getSerialStrings(targetRoles,AREAS_SEPARATOR);
}
 
public static List<String> getAreasFromSerial(String areasStr)
{
return StringsUtils.getStringsFromSerial(areasStr,AREAS_SEPARATOR);
}
 
public static String addArea(String old, String newArea)
{
if(old == null || old.length() == 0)
return newArea;
else
{
List<String> oldArea = getAreasFromSerial(old);
if(!oldArea.contains(newArea))
oldArea.add(newArea);
else
return old;
return getSerialAreas(oldArea);
}
}
 
public static String removeArea(String old, String toRemoveArea)
{
if(old == null || old.length() == 0)
return "";
else
{
List<String> oldAreas = getAreasFromSerial(old);
while(oldAreas.contains(toRemoveArea))
oldAreas.remove(toRemoveArea);
return getSerialAreas(oldAreas);
}
}
 
 
public static String catArea(String old, String newArea)
{
if(old == null || old.length() == 0)
return newArea;
else
return old + AREAS_SEPARATOR + newArea;
}
 
}
/impl/src/java/pt/estgp/estgweb/utils/StringsUtils.java
New file
0,0 → 1,41
package pt.estgp.estgweb.utils;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge
* @date 16/Jan/2009
* @time 15:40:42
*/
public class StringsUtils
{
public static String getSerialStrings(List<String> strings, String separator)
{
if (strings == null)
return null;
String roles = null;
for (String role : strings)
{
if (roles == null)
roles = role;
else
roles += separator + role;
}
return roles;
}
 
public static List<String> getStringsFromSerial(String stringsSerial, String separator)
{
if (stringsSerial == null)
return null;
String[] roles = stringsSerial.split(separator);
List<String> l = new ArrayList<String>();
for (String role : roles)
{
l.add(role);
}
return l;
}
 
}
/impl/src/java/pt/estgp/estgweb/utils/Dom4jUtil.java
15,9 → 15,10
import java.util.Map;
 
import pt.estgp.estgweb.Globals;
import net.sf.saxon.TransformerFactoryImpl;
import javax.xml.transform.TransformerFactory;
 
 
 
/**
* Class Description
*
40,6 → 41,7
createIgnoreErrorHandler(reader);
return reader.read(new StringReader(xml));
}
 
public static void createIgnoreErrorHandler(SAXReader reader)
{
reader.setValidation(false);
62,6 → 64,18
}
});
}
 
public static Document parseSourceFile(String file) throws DocumentException, IOException
{
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
SAXReader reader = new SAXReader();
reader.setValidation(false);
createIgnoreErrorHandler(reader);
Document dom = reader.read(stream);
stream.close();
return dom;
}
 
public static Document parse(File file) throws DocumentException, MalformedURLException
{
SAXReader reader = new SAXReader();
128,9 → 142,16
writer.write( document );
writer.close();
}
public static void write(Document document,Writer writerStream, OutputFormat outputFormat) throws IOException
{
// lets write to a file
XMLWriter writer = new XMLWriter(writerStream,outputFormat);
writer.write( document );
writer.close();
}
 
 
private static TransformerFactory transFact = new TransformerFactoryImpl();
private static TransformerFactory transFact = TransformerFactory.newInstance();
private static Map<String,Templates> templates =new Hashtable<String,Templates>();
 
 
142,8 → 163,18
* @throws Exception parsing stylesheet
*/
public static String styleDocument(Document document,String stylesheet) throws Exception {
return styleDocument(document,stylesheet, (Map<String,Object>) null);
}
public static String styleDocument(Document document,String stylesheet, Map<String,Object> parameters) throws Exception {
 
Transformer transformer = getTransformerFromSystem(stylesheet);
if(parameters != null)
{
for(Map.Entry<String,Object> entry: parameters.entrySet())
{
transformer.setParameter(entry.getKey(),entry.getValue());
}
}
// now lets style the given document
DocumentSource source = new DocumentSource( document );
DocumentResult result = new DocumentResult();
/impl/src/java/pt/estgp/estgweb/utils/RoleManager.java
82,30 → 82,12
 
public static String getSerialRoles(List<String> targetRoles)
{
if(targetRoles == null)
return null;
String roles = null;
for(String role: targetRoles)
{
if(roles == null)
roles = role;
else
roles += ROLE_SEPARATOR + role;
}
return roles;
return StringsUtils.getSerialStrings(targetRoles,ROLE_SEPARATOR);
}
 
public static List<String> getRolesFromSerial(String rolesStr)
{
if(rolesStr == null)
return null;
String[] roles = rolesStr.split(ROLE_SEPARATOR);
List<String> l = new ArrayList<String>();
for(String role: roles)
{
l.add(role);
}
return l;
return StringsUtils.getStringsFromSerial(rolesStr,ROLE_SEPARATOR);
}
 
public static String addRole(String old, String newRole)
/impl/src/java/pt/estgp/estgweb/Globals.java
1,6 → 1,8
package pt.estgp.estgweb;
 
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.services.directories.DirectoryService;
import pt.estgp.estgweb.domain.DirectoryImpl;
 
import java.util.List;
import java.math.BigDecimal;
24,6 → 26,17
if(CLASSES_ABSOLUTE_PATH.endsWith("/"))
CLASSES_ABSOLUTE_PATH = CLASSES_ABSOLUTE_PATH.substring(0,CLASSES_ABSOLUTE_PATH.length()-1);
}
 
public static List<DirectoryImpl> DIRECTORIES = null;
 
static
{
DirectoryService directoryService = new DirectoryService();
DIRECTORIES = directoryService.loadDirectories(CLASSES_ABSOLUTE_PATH);
}
 
 
public static final String INTRANET_CONTENTS = ConfigProperties.getProperty("intranet.contents.dir");
public static final String INTRANET_GRADES = ConfigProperties.getProperty("intranet.grades.dir");
public static final String INTRANET_PRESENCES = ConfigProperties.getProperty("intranet.presences.dir");
69,6 → 82,9
 
public static final String BLOG_TYPE_COURSE_UNIT = ConfigProperties.getProperty("blog.type.courseunit");
 
 
public static final List<String> AREAS = ConfigProperties.getListValues("area");
 
/*SIGES WEB SERVICES*/
public static final BigDecimal NATIONAL_INSTITUTION_CODE = new BigDecimal(ConfigProperties.getIntProperty("national.institution.code"));
public static final BigDecimal SIGES_INSTITUTION_CODE = new BigDecimal(ConfigProperties.getIntProperty("siges.institution.code"));
144,7 → 160,9
public static final boolean SMS_COURSEUNIT_ANNOUNCEMENT = ConfigProperties.getBooleanProperty("sms.courseunit.announcement");
public static final boolean SMS_NEW_GRADES = ConfigProperties.getBooleanProperty("sms.new.grades");
public static final boolean EMAIL_NEW_GRADES = ConfigProperties.getBooleanProperty("email.new.grades");
public static final boolean EMAIL_SUMMARIES = ConfigProperties.getBooleanProperty("email.summaries");
public static final boolean EMAIL_COURSEUNIT_ANNOUNCEMENTS = ConfigProperties.getBooleanProperty("email.courseunit.announcements");
public static final boolean EMAIL_COURSEUNIT_BLOGS = ConfigProperties.getBooleanProperty("email.courseunit.blogs");
 
public static final boolean SMS_COURSEUNIT_ANNOUNCEMENT_ONLY_PROFS = ConfigProperties.getBooleanProperty("sms.courseunit.announcement.only.profs");
 
184,10 → 202,24
public static final String EMAIL_COURSEUNIT_ANNOUNCEMENT_TEMPLATE_PT = "courseUnitAnnouncement_pt.txt";
public static final String EMAIL_COURSEUNIT_ANNOUNCEMENT_TEMPLATE_EN = "courseUnitAnnouncement_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");
public static final String EMAIL_COURSEUNIT_BLOGPOST_TEMPLATE_PT = "courseUnitBlogPost_pt.txt";
public static final String EMAIL_COURSEUNIT_BLOGPOST_TEMPLATE_EN = "courseUnitBlogPost_en.txt";
 
public static final String EMAIL_NEW_GRADES_SUBJECT_PT = ConfigProperties.getProperty("email.new.grades.subject.pt");
public static final String EMAIL_NEW_GRADES_SUBJECT_EN = ConfigProperties.getProperty("email.new.grades.subject.en");
 
public static final String EMAIL_SUMMARY_SUBJECT_PT = ConfigProperties.getProperty("email.summary.subject.pt");
public static final String EMAIL_SUMMARY_SUBJECT_EN = ConfigProperties.getProperty("email.summary.subject.en");
 
public static final String EMAIL_NEW_GRADES_TEMPLATE_PT = "newGrades_pt.txt";
public static final String EMAIL_NEW_GRADES_TEMPLATE_EN = "newGrades_en.txt";
 
public static final String EMAIL_SUMMARY_TEMPLATE_PT = "summary_pt.txt";
public static final String EMAIL_SUMMARY_TEMPLATE_EN = "summary_en.txt";
 
public static final String EMAIL_GRADE_UNIT_TEMPLATE = "GradeUnit.txt";
 
public static final String[] PROXY_EXTENSIONS = ConfigProperties.getProperty("proxy.extensions").split(" ");
}
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesCommonServices.java
107,7 → 107,7
int missing = DaoFactory.getCourseUnitDaoImpl().countMissingProgramGivenCourse(course.getId());
if(missing > 0)
{
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.objectives.todo",""+missing,"/user/startLoadDirectedCoordinatedCoursesFromHome.do#" + course.getId());
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.objectives.todo",""+missing,"/user/startLoadCoursesProgramsFromHome.do?area=" + course.getArea() +"#" + course.getId());
todos.add(defaultToDo);
}
}
/impl/src/java/pt/estgp/estgweb/services/courses/SetUserArea.java
New file
0,0 → 1,76
package pt.estgp.estgweb.services.courses;
 
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.utils.RoleManager;
import pt.estgp.estgweb.utils.StringsUtils;
import pt.estgp.estgweb.utils.AreasBelongUtils;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.*;
import jomm.dao.impl.AbstractDao;
import static org.hibernate.criterion.Restrictions.*;
 
import java.util.List;
 
import org.hibernate.Query;
import org.hibernate.Criteria;
import org.apache.log4j.Logger;
 
/**
* @author Jorge
* @date 16/Jan/2009
* @time 15:17:12
*/
public class SetUserArea
{
private static final Logger logger = Logger.getLogger(SetUserArea.class);
 
public void run()
{
List<Student> students = DaoFactory.getStudentDaoImpl().findAll();
for (Student student : students)
{
Query q = AbstractDao.getCurrentSession().createQuery("select distinct c.area from c in class " + Course.class.getName() + " inner join c.courseUnits as cu inner join cu.students as s where s.id = " + student.getId());
List<String> areas = q.list();
if (areas != null && areas.size() > 0)
{
for(String area: areas)
{
student.removeRole("teacher." + area);
student.addRole("student." + area);
}
String areasStr = AreasBelongUtils.getSerialAreas(areas);
student.setAreasBelong(areasStr);
logger.info("Setting student: " + student.getId() + " areas:" + areasStr);
}
else
logger.warn("Student ID=" + student.getId() + ": SIGES(" + student.getSigesCode() + ")" + student.getName() + " has no subscribed units");
}
List<Teacher> teachers = DaoFactory.getTeacherDaoImpl().findAll();
for (Teacher teacher : teachers)
{
Query q = AbstractDao.getCurrentSession().createQuery("select distinct c.area from c in class " + Course.class.getName() + " inner join c.courseUnits as cu inner join cu.teachers as s where s.id = " + teacher.getId());
List<String> areas = q.list();
if (areas != null && areas.size() > 0)
{
for(String area: areas)
{
teacher.addRole("teacher." + area);
}
String areasStr = AreasBelongUtils.getSerialAreas(areas);
teacher.setAreasBelong(areasStr);
logger.info("Setting Teacher: " + teacher.getId() + " areas:" + areasStr);
}
else
logger.warn("Student ID=" + teacher.getId() + ": SIGES(" + teacher.getSigesCode() + ")" + teacher.getName() + " has no teached units");
}
 
}
 
public static void main(String[] args) throws ServiceException
{
AbstractDao.getCurrentSession().beginTransaction();
new SetUserArea().run();
AbstractDao.getCurrentSession().getTransaction().commit();
}
}
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesService.java
68,6 → 68,17
return null;
}
 
public List<String> loadImportYears(UserSession userSession) throws ServiceException
{
List<String> importYears = DaoFactory.getCourseDaoImpl().loadImportYears();
List<String> imStrings = new ArrayList<String>();
for(String importYear: importYears)
{
imStrings.add(importYear);
}
return imStrings;
}
 
public CourseView loadCourseByCode(String code, boolean initUnits) throws ServiceException
{
Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(code);
157,6 → 168,18
return courseViews;
}
 
public List<CourseView> loadCoursesImportYearArea(String importYear, String area) throws ServiceException
{
List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(importYear,area);
List<CourseView> courseViews = new ArrayList<CourseView>();
for(Course c: courses)
{
CourseView courseView = new CourseView(c);
courseViews.add(courseView);
}
return courseViews;
}
 
public List<CourseView> loadCoursesImportYear() throws ServiceException
{
String importYearIntranet = DatesUtils.getImportYear();
/impl/src/java/pt/estgp/estgweb/services/courseunits/DirectedCoordinatedCourses.java
17,10 → 17,12
private List<CourseView> merge;
private int updated;
private int missing;
private String area;
private long courseId;
 
public DirectedCoordinatedCourses()
{
System.out.println("");
}
 
public List<CourseView> getDirectedCourses()
78,5 → 80,24
}
 
 
public String getArea()
{
return area;
}
 
public void setArea(String area)
{
this.area = area;
}
 
 
public long getCourseId()
{
return courseId;
}
 
public void setCourseId(long courseId)
{
this.courseId = courseId;
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/DirectedCoordinatedUnitsService.java
1,19 → 1,16
package pt.estgp.estgweb.services.courseunits;
 
import pt.estgp.estgweb.domain.Course;
import pt.estgp.estgweb.domain.Teacher;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.utils.CourseViewComparator;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.utils.AreasBelongUtils;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import java.util.List;
 
/**
23,16 → 20,17
*/
public class DirectedCoordinatedUnitsService implements IService
{
public DirectedCoordinatedCourses loadForUserSession(UserSession userSession)
public DirectedCoordinatedCourses loadForUserSession(String importYear, UserSession userSession)
{
return loadForUser(userSession.getUser().getId(), userSession);
return loadForUser(userSession.getUser().getId(),importYear, userSession);
}
 
public DirectedCoordinatedCourses loadForUser(long teacherId, UserSession userSession)
public DirectedCoordinatedCourses loadForUser(long teacherId, String importYear, UserSession userSession)
{
Teacher t = DaoFactory.getTeacherDaoImpl().load(teacherId);
Set<Course> directorCourses = t.getDirectorCourses();
Set<Course> coordinatorCourses = t.getCoordinatorCourses();
if(importYear == null)
importYear = DatesUtils.getImportYear();
List<Course> directorCourses = DaoFactory.getCourseDaoImpl().loadDirectorCourses(teacherId,importYear);
List<Course> coordinatorCourses = DaoFactory.getCourseDaoImpl().loadCoordinatedCourses(teacherId,importYear);
 
HashMap<Course, Boolean> map = new HashMap<Course, Boolean>();
 
65,19 → 63,76
return directedCoordinatedCourses;
}
 
public DirectedCoordinatedCourses loadForServices(UserSession userSession)
// public DirectedCoordinatedCourses loadForServices(String importYear, UserSession userSession)
// {
// if(importYear == null)
// importYear = DatesUtils.getImportYear();
// List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(importYear);
//
// List<CourseView> courseViews = new ArrayList<CourseView>();
// for(Course c : courses)
// {
// CourseView cV = new CourseView(c, true);
// courseViews.add(cV);
// }
// fill(courseViews);
// DirectedCoordinatedCourses directedCoordinatedCourses = new DirectedCoordinatedCourses();
// directedCoordinatedCourses.setMerge(courseViews);
// return directedCoordinatedCourses;
// }
 
public DirectedCoordinatedCourses loadForServices(String importYear, long courseId, String semestre, String area, TeachersSituationEnum teachersSituationEnum, UserSession userSession)
{
List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(DatesUtils.getImportYear());
if(importYear == null)
importYear = DatesUtils.getImportYear();
 
/**
* Area and Course Initialization
*/
if (area == null && userSession.getUser() != null && userSession.getUser() instanceof Teacher)
{
SigesUser sigesUser = (SigesUser) userSession.getUser();
if (sigesUser.getAreasBelong() != null && sigesUser.getAreasBelong().length() > 0)
{
area = AreasBelongUtils.getAreasFromSerial(sigesUser.getAreasBelong()).get(0);
}
}
/**
* If is a student can see only his course
*/
if (userSession.getUser() != null && userSession.getUser() instanceof Student)
{
StudentImpl sigesUser = (StudentImpl) userSession.getUser();
if (sigesUser.getSubscribedUnits() != null && sigesUser.getSubscribedUnits().size() > 0)
{
Course course = sigesUser.getSubscribedUnits().iterator().next().getCourse();
courseId = course.getId();
}
}
 
List<Course> courses;
 
if(courseId > 0)
{
courses = new ArrayList<Course>();
courses.add(DaoFactory.getCourseDaoImpl().get(courseId));
}
else
{
courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(importYear,area);
}
 
List<CourseView> courseViews = new ArrayList<CourseView>();
for(Course c : courses)
{
CourseView cV = new CourseView(c, true);
CourseView cV = new CourseView(c, false);
courseViews.add(cV);
}
fill(courseViews);
fill(courseViews, semestre, importYear, teachersSituationEnum);
DirectedCoordinatedCourses directedCoordinatedCourses = new DirectedCoordinatedCourses();
directedCoordinatedCourses.setMerge(courseViews);
directedCoordinatedCourses.setArea(area);
directedCoordinatedCourses.setCourseId(courseId);
return directedCoordinatedCourses;
}
 
111,6 → 166,48
}
}
 
private void fill(List<CourseView> courseViews, String semestre, String importYear, TeachersSituationEnum teachersSituationEnum)
{
boolean withTeacher = true;
boolean withNoTeacher = true;
 
if(teachersSituationEnum == TeachersSituationEnum.withNoTeachers)
withTeacher = false;
else if(teachersSituationEnum == TeachersSituationEnum.withTeachers)
withNoTeacher = false;
 
for (CourseView cV : courseViews)
{
cV.setCourseUnitsWithNoProgramS1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithNoProgramS2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedS1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedS2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedS1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedS2(new ArrayList<CourseUnitView>());
 
 
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadCourseUnits(cV.getId(),semestre,importYear,withTeacher,withNoTeacher);
for (CourseUnit cU : courseUnits)
{
CourseUnitView cUV = new CourseUnitView(cU,true,false,false,false);
if (cUV.getProgramStreamId() == null)
if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithNoProgramS1().add(cUV);
else
cV.getCourseUnitsWithNoProgramS2().add(cUV);
else if (cUV.isValidProgram())
if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramCheckedS1().add(cUV);
else
cV.getCourseUnitsWithProgramCheckedS2().add(cUV);
else if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramNotCheckedS1().add(cUV);
else
cV.getCourseUnitsWithProgramNotCheckedS2().add(cUV);
}
}
}
 
public DirectedCoordinatedCourses update(DirectedCoordinatedCourses directedCoordinatedCourses, UserSession userSession)
{
int counter = 0;
152,4 → 249,23
}
return counter;
}
 
public static enum TeachersSituationEnum
{
withTeachers,
withNoTeachers,
all;
 
public static TeachersSituationEnum parse(String situation)
{
if(situation == null)
return all;
else if(situation.equals("withTeachers"))
return withTeachers;
else if(situation.equals("withNoTeachers"))
return withNoTeachers;
else
return all;
}
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/CreateCourseUnitXML.java
New file
0,0 → 1,216
package pt.estgp.estgweb.services.courseunits;
 
import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.dom4j.DocumentFactory;
import org.dom4j.Element;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.estgp.estgweb.web.utils.DatesUtils;
 
import java.io.IOException;
import java.io.File;
 
/**
* @author Jorge Machado
* @date 23/Out/2008
* @see pt.estgp.estgweb.services.data
*/
public class CreateCourseUnitXML
{
private static final Logger logger = Logger.getLogger(CreateCourseUnitXML.class);
 
public void run(String toFile, CourseUnit courseUnit, UserSession userSession)
{
Document dom = run(courseUnit,userSession);
try
{
new File(toFile).getParentFile().mkdirs();
Dom4jUtil.write(dom,toFile);
}
catch (IOException e)
{
logger.error(e,e);
}
}
 
public Document run(CourseUnit courseUnit, UserSession userSession)
{
org.dom4j.Document dom = DocumentFactory.getInstance().createDocument();
Element rootElement = DocumentFactory.getInstance().createElement("courseUnit");
dom.setRootElement(rootElement);
rootElement.addAttribute("id", "" + courseUnit.getId());
rootElement.addAttribute("importYear", "" + courseUnit.getImportYear());
rootElement.addAttribute("institutionCode", "" + courseUnit.getInstitutionCode());
 
Element saveDate = DocumentFactory.getInstance().createElement("saveDate");
saveDate.setText(""+ DatesUtils.getStringFromDateForFilename(courseUnit.getSaveDate()));
 
Element updateDate = DocumentFactory.getInstance().createElement("updateDate");
updateDate.setText(""+ DatesUtils.getStringFromDateForFilename(courseUnit.getUpdateDate()));
 
Element name = DocumentFactory.getInstance().createElement("name");
name.setText("" + courseUnit.getName());
 
Element courseName = DocumentFactory.getInstance().createElement("courseName");
name.setText("" + courseUnit.getCourseName());
rootElement.add(saveDate);
rootElement.add(name);
rootElement.add(courseName);
 
if(courseUnit.getObjectives() != null)
{
Element objectives = DocumentFactory.getInstance().createElement("objectives");
objectives.setText(courseUnit.getObjectives());
rootElement.add(objectives);
}
 
if(courseUnit.getSummaries() != null)
{
Element summaries = DocumentFactory.getInstance().createElement("summaries");
summaries.addAttribute("number",""+courseUnit.getSummaries().size());
rootElement.add(summaries);
for(CourseUnitSummary a: courseUnit.getSummaries())
{
Element summary = DocumentFactory.getInstance().createElement("summary");
summaries.add(summary);
summary.addAttribute("id",""+a.getId());
summary.addAttribute("number",""+a.getNumeroAula());
summary.addAttribute("dateAula",""+a.getDataAula());
summary.addAttribute("studentsPresences",""+a.getAlunosPresentes());
if(a.getDescricao() != null)
{
Element text = DocumentFactory.getInstance().createElement("description");
text.setText(a.getDescricao());
summary.add(text);
}
if(a.getTitulo() != null)
{
Element titulo = DocumentFactory.getInstance().createElement("title");
titulo.setText(a.getTitulo());
summary.add(titulo);
}
}
}
 
if(courseUnit.getTeachers() != null)
{
Element teachers = DocumentFactory.getInstance().createElement("teachers");
teachers.addAttribute("number",""+courseUnit.getTeachers().size());
rootElement.add(teachers);
for(Teacher s: courseUnit.getTeachers())
{
Element teacher = DocumentFactory.getInstance().createElement("teacher");
teacher.addAttribute("code",""+s.getSigesCode());
teacher.addAttribute("name",""+s.getName());
teacher.addAttribute("email",""+s.getEmail());
if( userSession.getUser().isSuperuserOrAdmin() || userSession.getUser() instanceof Teacher)
{
teacher.addAttribute("oemail",""+s.getOutEmail());
teacher.addAttribute("phone",""+s.getPhonenumber());
teacher.addAttribute("gmail",""+s.getGmail());
teacher.addAttribute("msn",""+s.getMsn());
teacher.addAttribute("skype",""+s.getSkype());
}
teachers.add(teacher);
}
}
 
if( userSession.getUser().isSuperuserOrAdmin() || userSession.getUser() instanceof Teacher)
{
if(courseUnit.getStudents() != null)
{
Element students = DocumentFactory.getInstance().createElement("students");
students.addAttribute("number",""+courseUnit.getStudents().size());
rootElement.add(students);
for(Student s: courseUnit.getStudents())
{
Element student = DocumentFactory.getInstance().createElement("student");
student.addAttribute("code",""+s.getSigesCode());
student.addAttribute("name",""+s.getName());
student.addAttribute("email",""+s.getEmail());
student.addAttribute("oemail",""+s.getOutEmail());
student.addAttribute("phone",""+s.getPhonenumber());
student.addAttribute("gmail",""+s.getGmail());
student.addAttribute("msn",""+s.getMsn());
student.addAttribute("skype",""+s.getSkype());
students.add(student);
}
}
}
if( userSession.getUser().isSuperuserOrAdmin() || userSession.getUser() instanceof Teacher)
{
if(courseUnit.getAnnouncements() != null)
{
Element announcements = DocumentFactory.getInstance().createElement("announcements");
announcements.addAttribute("number",""+courseUnit.getAnnouncements().size());
rootElement.add(announcements);
for(Announcement a: courseUnit.getAnnouncements())
{
Element announcement = DocumentFactory.getInstance().createElement("announcement");
announcements.add(announcement);
announcement.addAttribute("id",""+a.getId());
announcement.addAttribute("title",""+a.getTitle());
announcement.addAttribute("date",""+a.getSaveDate());
if(a.getText() != null)
{
Element text = DocumentFactory.getInstance().createElement("text");
text.setText(a.getText());
announcement.add(text);
}
if(a.getUrl() != null)
{
Element url = DocumentFactory.getInstance().createElement("url");
url.setText(a.getUrl());
announcement.add(url);
}
}
}
}
 
if( userSession.getUser().isSuperuserOrAdmin() || userSession.getUser() instanceof Teacher)
{
if(courseUnit.getBlogs() != null)
{
Element blogs = DocumentFactory.getInstance().createElement("blogs");
blogs.addAttribute("number",""+courseUnit.getBlogs().size());
rootElement.add(blogs);
for(Blog b: courseUnit.getBlogs())
{
Element blog = DocumentFactory.getInstance().createElement("blog");
blogs.add(blog);
blog.addAttribute("id",""+b.getId());
blog.addAttribute("title",""+b.getTitle());
if(b.getDescription() != null)
{
Element desc = DocumentFactory.getInstance().createElement("description");
desc.setText(b.getDescription());
blog.add(desc);
}
Element posts = DocumentFactory.getInstance().createElement("posts");
posts.addAttribute("number",""+b.getPosts().size());
blog.add(posts);
if(b.getPosts() != null)
{
for(BlogPost bp: b.getPosts())
{
Element post = DocumentFactory.getInstance().createElement("post");
posts.add(post);
post.addAttribute("id",""+bp.getId());
post.addAttribute("saveDate",""+bp.getId());
blog.addAttribute("title",""+bp.getTitle());
blog.addAttribute("from",""+bp.getOwner().getName());
if(bp.getText() != null)
{
Element descP = DocumentFactory.getInstance().createElement("description");
descP.setText(bp.getText());
post.add(descP);
}
}
}
}
}
}
return dom;
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/CreateCourseUnitWorksBackupService.java
44,9 → 44,13
 
public String createSystemActualYearBackup(String importYear, UserSession userSession) throws ServiceException
{
return createSystemImportYearBackup(DatesUtils.getImportYear(),userSession);
}
 
public String createSystemImportYearBackup(String importYear, UserSession userSession) throws ServiceException
{
if (importYear == null || importYear.trim().length() == 0)
importYear = DatesUtils.getImportYear();
String importYearIntranet = DatesUtils.getImportYearIntranet();
String tmpName = BytesUtils.generateHexKey();
String tmpDir = Globals.TMP_DIR + "/" + tmpName;
new File(tmpDir).mkdirs();
55,55 → 59,86
{
for (Course c : courses)
{
String couseDirPath = tmpDir + "/" + StringsUtils.normalizeResourceName(c.getName()) + '.' + c.getCode();
try
createCourseBackup(tmpDir,c,userSession);
}
FilesUtils.zipFolder(tmpDir, tmpDir + ".zip");
FilesUtils.delete(tmpDir);
return tmpName + ".zip";
}
catch (IOException e)
{
logger.error(e, e);
}
return null;
}
 
public String createSystemBackup(String importYear, UserSession userSession) throws ServiceException
{
String tmpName = BytesUtils.generateHexKey();
String tmpDir = Globals.TMP_DIR + "/" + tmpName;
new File(tmpDir).mkdirs();
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll();
try
{
for (Course c : courses)
{
createCourseBackup(tmpDir,c,userSession);
}
FilesUtils.zipFolder(tmpDir, tmpDir + ".zip");
FilesUtils.delete(tmpDir);
return tmpName + ".zip";
}
catch (IOException e)
{
logger.error(e, e);
}
return null;
}
 
private void createCourseBackup(String tmpDir, Course c, UserSession userSession)
{
String couseDirPath = tmpDir + "/" + StringsUtils.normalizeResourceName(c.getName()) + '.' + c.getCode();
try
{
String importYearIntranet = DatesUtils.getImportYearIntranet(c.getImportYear());
String courseImportYearPath = couseDirPath + "/" + importYearIntranet;
File courseImportYearDir = new File(courseImportYearPath);
courseImportYearDir.mkdirs();
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadByCourse(c.getId(), c.getImportYear());
for (CourseUnit courseUnit : courseUnits)
{
String semestre;
if (courseUnit.getSemestre().equals("S1"))
{
String courseImportYearPath = couseDirPath + "/" + importYearIntranet;
File courseImportYearDir = new File(courseImportYearPath);
courseImportYearDir.mkdirs();
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadByCourse(c.getId(), importYear);
for (CourseUnit courseUnit : courseUnits)
semestre = Globals.INTRANET_SEMESTRE_S1;
}
else
{
semestre = Globals.INTRANET_SEMESTRE_S2;
}
 
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName());
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName;
copyProgram(courseUnit,unitPath,userSession);
new CreateCourseUnitXML().run(unitPath+"/desc.xml",courseUnit,userSession);
for (CourseUnitAssignement assignement : courseUnit.getAssignements())
{
String assignementDir = unitPath + "/assignement" + assignement.getId();
createAssignementCopy(assignement, assignementDir, userSession);
if (!assignement.getDeliverType().equals(Globals.COURSEUNIT_ASSIGNEMENT_TYPE_NO_FILE) && assignement.getDeliverables() != null && assignement.getDeliverables().size() > 0)
{
String semestre;
if (courseUnit.getSemestre().equals("S1"))
for (CourseUnitDeliverable deliverable : assignement.getDeliverables())
{
semestre = Globals.INTRANET_SEMESTRE_S1;
copyDeliverableVersions(deliverable, assignementDir, userSession);
}
else
{
semestre = Globals.INTRANET_SEMESTRE_S2;
}
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName());
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName;
 
for (CourseUnitAssignement assignement : courseUnit.getAssignements())
{
String assignementDir = unitPath + "/assignement" + assignement.getId();
createAssignementCopy(assignement, assignementDir, userSession);
if (!assignement.getDeliverType().equals(Globals.COURSEUNIT_ASSIGNEMENT_TYPE_NO_FILE) && assignement.getDeliverables() != null && assignement.getDeliverables().size() > 0)
{
for (CourseUnitDeliverable deliverable : assignement.getDeliverables())
{
copyDeliverableVersions(deliverable, assignementDir, userSession);
}
}
}
}
}
catch (IOException e)
{
logger.error(e, e);
}
}
FilesUtils.zipFolder(tmpDir, tmpDir + ".zip");
FilesUtils.delete(tmpDir);
return tmpName + ".zip";
}
catch (IOException e)
{
logger.error(e, e);
}
return null;
}
 
/**
113,12 → 148,29
* @return
* @throws ServiceException
*/
public String createImportYearBackup(String importYear, UserSession userSession) throws ServiceException
{
if(importYear == null)
importYear = DatesUtils.getImportYear();
if (userSession.getUser() instanceof Teacher)
return createLoginTeacherActualYearBackup(importYear,userSession);
else if (userSession.getUser() instanceof Student)
return createLoginStudentActualYearBackup(importYear,userSession);
return null;
}
/**
* In case of student create a backup with student deliverables in actual year subscribed units, in case of teacher create a backup of all deliverables in actual year teached units
*
* @param userSession
* @return
* @throws ServiceException
*/
public String createActualYearBackup(UserSession userSession) throws ServiceException
{
if (userSession.getUser() instanceof Teacher)
return createLoginTeacherActualYearBackup(userSession);
return createLoginTeacherActualYearBackup(DatesUtils.getImportYear(),userSession);
else if (userSession.getUser() instanceof Student)
return createLoginStudentActualYearBackup(userSession);
return createLoginStudentActualYearBackup(DatesUtils.getImportYear(), userSession);
return null;
}
 
153,29 → 205,29
}
 
 
public String createLoginStudentActualYearBackup(UserSession userSession) throws ServiceException
public String createLoginStudentActualYearBackup(String importYear,UserSession userSession) throws ServiceException
{
Student s = (Student) userSession.getUser();
return createStudentActualYearBackup(s, userSession);
return createStudentActualYearBackup(s,importYear, userSession);
}
 
 
public String createLoginTeacherActualYearBackup(UserSession userSession) throws ServiceException
public String createLoginTeacherActualYearBackup(String importYear,UserSession userSession) throws ServiceException
{
Teacher t = (Teacher) userSession.getUser();
return createTeacherActualYearBackup(t, userSession);
return createTeacherActualYearBackup(t,importYear, userSession);
}
 
public String createStudentActualYearBackup(long studentId, UserSession userSession) throws ServiceException
public String createStudentActualYearBackup(long studentId,String importYear, UserSession userSession) throws ServiceException
{
Student s = DaoFactory.getStudentDaoImpl().get(studentId);
return createStudentActualYearBackup(s, userSession);
return createStudentActualYearBackup(s,importYear, userSession);
}
 
public String createTeacherActualYearBackup(long teacherId, UserSession userSession) throws ServiceException
public String createTeacherActualYearBackup(long teacherId,String importYear, UserSession userSession) throws ServiceException
{
Teacher t = DaoFactory.getTeacherDaoImpl().get(teacherId);
return createTeacherActualYearBackup(t, userSession);
return createTeacherActualYearBackup(t,importYear, userSession);
}
 
 
192,15 → 244,15
}
 
 
private String createStudentActualYearBackup(Student s, UserSession userSession) throws ServiceException
private String createStudentActualYearBackup(Student s,String importYear, UserSession userSession) throws ServiceException
{
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadSubscribedImportYearUnits(s.getId(), DatesUtils.getImportYear());
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadSubscribedImportYearUnits(s.getId(), importYear);
if (units == null || units.size() == 0)
return null;
return createStudentBackup(units, s, userSession);
}
 
private String createTeacherActualYearBackup(Teacher t, UserSession userSession) throws ServiceException
private String createTeacherActualYearBackup(Teacher t,String importYear, UserSession userSession) throws ServiceException
{
List units = DaoFactory.getCourseUnitDaoImpl().loadTeachedImportYearUnits(t.getId(), DatesUtils.getImportYear());
if (units == null || units.size() == 0)
251,7 → 303,8
}
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName());
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName;
 
copyProgram(courseUnit,unitPath,userSession);
new CreateCourseUnitXML().run(unitPath+"/desc.xml",courseUnit,userSession);
for (CourseUnitAssignement assignement : courseUnit.getAssignements())
{
String assignementDir = unitPath + "/assignement" + assignement.getId();
259,7 → 312,8
if (!assignement.getDeliverType().equals(Globals.COURSEUNIT_ASSIGNEMENT_TYPE_NO_FILE) && assignement.getDeliverables() != null && assignement.getDeliverables().size() > 0)
{
CourseUnitDeliverable deliverable = DaoFactory.getCourseUnitDeliverableDaoImpl().loadDeliverable(s.getId(), assignement.getId());
copyDeliverableVersions(deliverable, assignementDir, userSession);
if(deliverable != null)
copyDeliverableVersions(deliverable, assignementDir, userSession);
}
}
}
304,7 → 358,8
}
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName());
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName;
 
copyProgram(courseUnit,unitPath,userSession);
new CreateCourseUnitXML().run(unitPath+"/desc.xml",courseUnit,userSession);
for (CourseUnitAssignement assignement : courseUnit.getAssignements())
{
String assignementDir = unitPath + "/assignement" + assignement.getId();
335,6 → 390,31
}
 
 
private void copyProgram(CourseUnit courseUnit, String toDir, UserSession userSession)
{
if (courseUnit.getProgramStreamId() != null && courseUnit.getProgramStreamId().length() > 0)
{
String deliverDir = toDir + "/program.zip";
new File(deliverDir).mkdirs();
List<IRepositoryFile> iRepositoryFiles = repositoryService.loadVersions(courseUnit.getProgramStreamId(), userSession);
for (IRepositoryFile iRepositoryFile : iRepositoryFiles)
{
try
{
if(iRepositoryFile.getInput() != null)
FilesUtils.copy(iRepositoryFile.getInput(), toDir + "/program." + FilesUtils.getExtension(iRepositoryFile.getName()));
else
logger.error("Repository File have no candidate file version, coming null inputStream:" + iRepositoryFile.getIdentifier());
 
}
catch (IOException e)
{
logger.error(e, e);
}
}
}
}
 
private void copyDeliverableVersions(CourseUnitDeliverable deliverable, String toDir, UserSession userSession)
{
if (deliverable.getDeliverableRepositoryStream() != null && deliverable.getDeliverableRepositoryStream().length() > 0)
346,7 → 426,10
{
try
{
FilesUtils.copy(iRepositoryFile.getInput(), deliverDir + "/version" + getResourceFileName(iRepositoryFile.getName()));
if(iRepositoryFile.getInput() != null)
FilesUtils.copy(iRepositoryFile.getInput(), deliverDir + "/version" + getResourceFileName(iRepositoryFile.getName()));
else
logger.error("Repository File have no candidate file version, coming null inputStream:" + iRepositoryFile.getIdentifier());
}
catch (IOException e)
{
378,7 → 461,12
if (assignement.getRepositoryStream() != null && assignement.getRepositoryStream().length() > 0)
{
IRepositoryFile iRepositoryFile = repositoryService.load(assignement.getRepositoryStream(), userSession);
FilesUtils.copy(iRepositoryFile.getInput(), assignementDir + "/" + getResourceFileName(iRepositoryFile.getName()));
 
if(iRepositoryFile.getInput() != null)
FilesUtils.copy(iRepositoryFile.getInput(), assignementDir + "/" + getResourceFileName(iRepositoryFile.getName()));
else
logger.error("Repository File have no candidate file version, coming null inputStream:" + iRepositoryFile.getIdentifier());
 
}
}
 
/impl/src/java/pt/estgp/estgweb/services/courseunits/LoadCourseUnitService.java
41,7 → 41,7
{
CourseUnit c = DaoFactory.getCourseUnitDaoImpl().get(id);
 
 
if(c == null)
return null;
CourseUnitView cV = new CourseUnitView(c,initTeachers,initStudents,initBlog);
60,6 → 60,16
{
List<AnnouncementView> announcementViews = loadCourseUnitAnnouncements.run(id,userSession);
cV.setAnnouncements(announcementViews);
 
List<CourseUnitSummaryView> summaryViews = new ArrayList<CourseUnitSummaryView>();
if(c.getSummaries() != null)
{
for(CourseUnitSummary summary: c.getSummaries())
{
summaryViews.add(new CourseUnitSummaryView(summary));
}
}
cV.setSummaries(summaryViews);
}
return cV;
}
/impl/src/java/pt/estgp/estgweb/services/email/SendEmailService.java
3,10 → 3,10
import jomm.utils.TemplateUtils;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.web.utils.DatesUtils;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.domain.enums.LangEnum;
import pt.estgp.estgweb.domain.CourseUnitAnnouncement;
import pt.estgp.estgweb.domain.User;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.utils.Email;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
158,7 → 158,40
return new Email(subject ,recipients, Globals.SYSTEM_EMAIL_BOX,template,arguments);
}
 
public Email getCourseUnitBlogPostEmail(BlogPost post, LangEnum langEnum, String from, List<User> users)
{
List<String> arguments = new ArrayList<String>();
arguments.add(((CourseUnitBlog)post.getBlog()).getCourseUnit().getName());
arguments.add(post.getTitle());
arguments.add(post.getText());
arguments.add(from);
 
String subjectTxt;
String template;
 
if(langEnum == LangEnum.PORTUGUESE)
{
template = Globals.EMAIL_COURSEUNIT_BLOGPOST_TEMPLATE_PT;
subjectTxt = Globals.EMAIL_COURSEUNIT_BLOGPOST_SUBJECT_PT;
}
else
{
template = Globals.EMAIL_COURSEUNIT_BLOGPOST_TEMPLATE_EN;
subjectTxt = Globals.EMAIL_COURSEUNIT_BLOGPOST_SUBJECT_EN;
}
 
List<String> recipients = new ArrayList<String>();
for(User u: users)
{
if(Email.validEmail(u.getEmail()))
recipients.add(u.getEmail());
}
 
String subject = java.text.MessageFormat.format(subjectTxt,new String[]{((CourseUnitBlog)post.getBlog()).getCourseUnit().getNormalizedName(),post.getTitle()});
return new Email(subject ,recipients, Globals.SYSTEM_EMAIL_BOX,template,arguments);
}
 
 
public Email getNewGradesEmail(List<String[]> grades, LangEnum langEnum, String studentEmail, String studentName)
{
List<String> arguments = new ArrayList<String>();
192,6 → 225,38
return new Email(subject ,recipients, Globals.SYSTEM_EMAIL_BOX,template,arguments);
}
 
public Email getSummaryEmail(List<String> emails, CourseUnitSummary cUS, CourseUnit c, LangEnum langEnum)
{
List<String> arguments = new ArrayList<String>();
 
String data = DatesUtils.getStringFromDate(cUS.getDataAula());
String subject;
String template;
 
if(langEnum == LangEnum.PORTUGUESE)
{
template = Globals.EMAIL_SUMMARY_TEMPLATE_PT;
subject = Globals.EMAIL_SUMMARY_SUBJECT_PT;
}
else
{
template = Globals.EMAIL_SUMMARY_TEMPLATE_EN;
subject = Globals.EMAIL_SUMMARY_SUBJECT_EN;
}
subject = TemplateUtils.formatMessageTemplate(subject,new String[]{c.getName()});
 
arguments.add(c.getName());
arguments.add(""+cUS.getNumeroAula());
arguments.add(data);
arguments.add(cUS.getTitulo());
arguments.add(cUS.getDescricao());
 
List<String> recipients = new ArrayList<String>();
for(String email:emails)
recipients.add(email);
return new Email(subject ,recipients, Globals.SYSTEM_EMAIL_BOX,template,arguments);
}
 
public boolean sendNewGrades(List<String[]> grades, LangEnum langEnum, String studentEmail, String studentName)
{
try
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportGradesService.java
135,11 → 135,13
}
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));
logger.error(e, e);
throw new ServiceException(e.toString(), e);
}
 
logMessages.addMessage(new DefaultLogMessage("import.teachers.terminating", LogMessageTypeEnum.INFO));
logger.info("terminating grades import");
return logMessages;
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportSumaries.java
New file
0,0 → 1,185
package pt.estgp.estgweb.services.sigesimports;
 
import jomm.dao.impl.AbstractDao;
import org.apache.log4j.Logger;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.CourseUnitSummary;
import pt.estgp.estgweb.domain.DomainObjectFactory;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.enums.LangEnum;
import pt.estgp.estgweb.services.email.EMAILJob;
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.logresults.ILogMessages;
import pt.estgp.estgweb.services.logresults.LogMessageTypeEnum;
import pt.estgp.estgweb.services.logresults.impl.DefaultLogMessage;
import pt.estgp.estgweb.services.logresults.impl.DefaultLogMessages;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.ipportalegre.siges.web.services.ArrayOfAula;
import pt.ipportalegre.siges.web.services.Aula;
import pt.ipportalegre.siges.web.services.SiGesWEB;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import javax.xml.namespace.QName;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
 
/**
* @author Jorge Machado
* @date 11/May/2008
* @time 12:51:32
* @see pt.estgp.estgweb
*/
public class ImportSumaries implements IService
{
 
private static final Logger logger = Logger.getLogger(ImportSumaries.class);
 
private static final int MAX_COMMIT = 100;
 
private List<Long> newSummaries = new ArrayList<Long>();
 
public ILogMessages run(String year) throws ServiceException
{
DefaultLogMessages logMessages = new DefaultLogMessages();
logMessages.addMessage(new DefaultLogMessage("import.summaries", LogMessageTypeEnum.INFO, "instituicao " + Globals.SIGES_INSTITUTION_CODE));
logger.info("starting summaries import");
try
{
AbstractDao.getCurrentSession().beginTransaction();
SiGesWEB service;
try
{
service = new SiGesWEB(new URL(Globals.SIGES_WEBSERVICE_WSDL), new QName(Globals.SIGES_WEBSERVICE_TARGET_NAMESPACE, "SiGesWEB"));
}
catch (MalformedURLException e)
{
logMessages.addMessage(new DefaultLogMessage("import.error",e.toString(),"erro na configuracao do WEB Service", LogMessageTypeEnum.INFO));
logger.fatal(e, e);
return logMessages;
}
 
int i = 0;
List<Long> cUs = DaoFactory.getCourseUnitDaoImpl().loadIds(year,DatesUtils.getSemestre());
for(Long cId: cUs)
{
if (i++ > MAX_COMMIT)
{
i = 0;
AbstractDao.getCurrentSession().getTransaction().commit();
AbstractDao.getCurrentSession().beginTransaction();
}
CourseUnit c = DaoFactory.getCourseUnitDaoImpl().load(cId);
logMessages.addMessage(new DefaultLogMessage("import.info","","Importing Summaries to CourseUnit: " + c.getCode() + ": course: " + c.getCourse(), LogMessageTypeEnum.INFO));
logger.info("Importing Summaries to CourseUnit: " + c.getCode() + ": course: " + c.getCourse());
 
int tries = 3;
ArrayOfAula arrayOfAulas = null;
while(tries > 0)
{
try
{
arrayOfAulas = service.getSiGesWEBSoap().getAulas(Globals.SIGES_INSTITUTION_CODE, year,c.getCode(),DatesUtils.getSemestre());
break;
}
catch(Throwable t)
{
if(tries-- == 0)
{
logger.error("Giving up of courseUnit:" + cId + " ( " + c.getName() + " ) ",t);
break;
}
 
logger.error("WebService Fail, trying " + tries + " times sleeping a while");
Thread.sleep(5000);
}
}
if(arrayOfAulas != null && arrayOfAulas.getAula() != null)
{
HashMap<String, CourseUnitSummary> map = new HashMap<String, CourseUnitSummary>();
if(c.getSummaries() != null && c.getSummaries().size() > 0)
for(CourseUnitSummary s: c.getSummaries())
map.put(s.getCodigoAula() + ":" + s.getCodigoSumario(),s);
else
c.setSummaries(new HashSet<CourseUnitSummary>());
for(Aula aula: arrayOfAulas.getAula())
{
CourseUnitSummary s = map.get(aula.getSumNumeroAula() + ":" + aula.getCodigoSumario());
if(s == null)
{
s = DomainObjectFactory.createCourseUnitSummaryImpl();
s.setCourseUnit(c);
c.getSummaries().add(s);
DaoFactory.getCourseUnitSummaryDaoImpl().save(s);
newSummaries.add(s.getId());
}
s.setCodigoSumario(""+aula.getCodigoSumario().intValue());
s.setCodigoAula(""+aula.getSumNumeroAula().intValue());
s.setNumeroAula(aula.getSumNumeroAula().intValue());
s.setDataAula(aula.getData().toGregorianCalendar().getTime());
s.setTipoAula(aula.getSumTipoAula());
s.setCodigoSalaAula("" + aula.getAulaCodigoSalaAula().intValue());
s.setAlunosPresentes(aula.getSumNumeroAlunos().intValue());
s.setTitulo(aula.getSumTitulo());
s.setDescricao(aula.getSumDescricao());
s.setcEstado(""+aula.getSumCdEstado().intValue());
}
}
else
logger.error("Summaries come null in unit:" + c.getCode());
}
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));
throw new ServiceException(e.toString(), e);
}
 
logMessages.addMessage(new DefaultLogMessage("import.summaries.terminating", LogMessageTypeEnum.INFO));
logger.info("terminating summaries import");
return logMessages;
}
 
 
public static SendEmailService sendEmailService = new SendEmailService();
 
private void sendEmail(UserSession userSession)
{
if(Globals.EMAIL_SUMMARIES && newSummaries.size() > 0)
{
for(long id: newSummaries)
{
CourseUnitSummary summary = DaoFactory.getCourseUnitSummaryDaoImpl().load(id);
List<String> emails = DaoFactory.getCourseUnitSummaryDaoImpl().getStudentsEmails(summary.getId());
if(emails == null)
logger.warn("No students emails in unit: code:" + summary.getCourseUnit().getCode() + " " + summary.getCourseUnit().getName());
EMAILJob emailJob = new EMAILJob(sendEmailService.getSummaryEmail(emails,summary,summary.getCourseUnit(), LangEnum.PORTUGUESE));
JobScheduleService.getInstance().scheduleNow(emailJob,"New Summary EMAIL from: " + summary.getCourseUnit().getName() + " aula: " +summary.getNumeroAula() ,userSession);
}
}
}
 
/**
* Testar por aqui poi requer Super Role e assim e' autmatico
*
* @param args of main
* @throws pt.estgp.estgweb.services.expceptions.ServiceException on error
*/
public static void main(String[] args) throws ServiceException
{
new ImportSumaries().run(DatesUtils.getImportYear());
}
 
 
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportStudentsService.java
100,9 → 100,10
}
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));
logger.error(e,e);
 
}
return logMessages;
}
187,7 → 188,6
 
public static void main(String[] args) throws ServiceException
{
 
new ImportStudentsService().run(DatesUtils.getImportYear());
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportCourseService.java
48,7 → 48,7
HashMap<String, Disciplina> disciplinasMap = new HashMap<String, Disciplina>();
HashMap<String, Disciplina> disciplinasMapS1 = new HashMap<String, Disciplina>();
HashMap<String, Disciplina> disciplinasMapS2 = new HashMap<String, Disciplina>();
HashMap<Integer, Disciplina> cursosMap = new HashMap<Integer, Disciplina>();
HashMap<String, Disciplina> cursosMap = new HashMap<String, Disciplina>();
 
/**
* Build Course Units Maps
73,8 → 73,8
*/
logMessages.addMessage(new DefaultLogMessage("import.semestre.updating.courses", LogMessageTypeEnum.INFO));
logger.info("updating courses");
Set<Map.Entry<Integer, Disciplina>> set2 = cursosMap.entrySet();
for (Map.Entry<Integer, Disciplina> entry : set2)
Set<Map.Entry<String, Disciplina>> set2 = cursosMap.entrySet();
for (Map.Entry<String, Disciplina> entry : set2)
{
Disciplina d = entry.getValue();
CourseView c = coursesService.loadCourseByCode("" + d.getCodigoCurso().intValue(),false);
101,11 → 101,11
}
catch (Throwable e)
{
logMessages.addMessage(new DefaultLogMessage("import.error",e.toString(), "see log for details", LogMessageTypeEnum.ERROR));
logger.error(e,e);
logger.error(e,e);
logMessages.addMessage(new DefaultLogMessage("import.error",e.toString(), "see log for details", LogMessageTypeEnum.ERROR));
}
logMessages.addMessage(new DefaultLogMessage("import.course.terminating", LogMessageTypeEnum.INFO));
logger.info("terminating course import");
logMessages.addMessage(new DefaultLogMessage("import.course.terminating", LogMessageTypeEnum.INFO));
return logMessages;
}
 
114,7 → 114,7
String year,
HashMap<String, Disciplina> disciplinasMap,
HashMap<String, Disciplina> disciplinasMapSemestre,
HashMap<Integer, Disciplina> cursosMap,
HashMap<String, Disciplina> cursosMap,
DefaultLogMessages logMessages)
{
logMessages.addMessage(new DefaultLogMessage("import.semestre.course.units." + semestre, LogMessageTypeEnum.INFO));
130,8 → 130,7
}
disciplinasMap.put(d.getCodigo().intValue() + ":" + d.getCodigoCurso() + ":" + semestre, d);
disciplinasMapSemestre.put(d.getCodigo().intValue() + ":" + d.getCodigoCurso() + ":" + semestre, d);
cursosMap.put(d.getCodigoCurso().intValue(), d);
 
cursosMap.put(d.getCodigoCurso().intValue()+":"+year, d);
}
}
 
/impl/src/java/pt/estgp/estgweb/services/common/CommonServicesManager.java
157,7 → 157,7
}
catch (Throwable e)
{
logger.error(e, e);
logger.error(moduleKey.getMessageKey() + " - query:" + query + ": " + e, e);
throw e;
}
}
/impl/src/java/pt/estgp/estgweb/services/urlstat/ResetRelativePathsService.java
New file
0,0 → 1,84
package pt.estgp.estgweb.services.urlstat;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import org.apache.log4j.Logger;
import org.apache.commons.httpclient.util.URIUtil;
import org.apache.commons.httpclient.URIException;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.Day;
import org.jfree.data.time.Month;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.plot.XYPlot;
 
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Date;
import java.util.ArrayList;
import java.io.File;
import java.io.IOException;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.ResultSet;
 
import jomm.utils.MyCalendar;
import jomm.utils.DatesUtils;
import jomm.utils.MessageResources;
import jomm.dao.impl.AbstractDao;
import jomm.dao.utils.HibernateUtils;
 
/**
* @author Jorge Machado
* @date 15/Mar/2008
* @time 6:55:38
* @see pt.estgp.estgweb.services.urlstat
*/
public class ResetRelativePathsService implements IService
{
private static final Logger logger = Logger.getLogger(ResetRelativePathsService.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=URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1");
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
115,6 → 115,15
TimeSeriesCollection dataset = new TimeSeriesCollection();
for(String relativePath: relativePaths)
{
try
{
relativePath = URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1");
}
catch (URIException e)
{
logger.error(e,e);
return null;
}
UrlStat urlStat = DaoFactory.getUrlStatDaoImpl().loadOrNull(relativePath);
if(urlStat != null)
{
194,7 → 203,7
String dates = sp.format(startDate) + "_UNTIL_" + sp.format(endDate) + "_" + seriesScaleEnum.getType();
String path;
if(encode)
path = URIUtil.encodePath(relativePathName.replaceAll("/","_"),"ISO-8859-1");
path = URIUtil.encodeWithinQuery(relativePathName.replaceAll("/","_"),"ISO-8859-1");
else
path = relativePathName.replaceAll("/","_");
return LINK_CHART_TMP_DIR + "/" + path + "_" + dates + ".png";
213,23 → 222,24
* @throws ServiceException
*/
 
public static void main(String[] args) throws ServiceException
public static void main(String[] args) throws ServiceException, URIException
{
// UrlStatService.main(null);
AbstractDao.getCurrentSession().beginTransaction();
List<String> relativePaths = new ArrayList<String>();
relativePaths.add("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295");
// AbstractDao.getCurrentSession().beginTransaction();
// List<String> relativePaths = new ArrayList<String>();
// relativePaths.add("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295");
System.out.println(URIUtil.decode(URIUtil.encodeWithinQuery("/public/announcements/getFlashNews.jsp?sid=0.9998549583612295&jorge=j","ISO-8859-1")));
// relativePaths.add("/teste2");
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.weekDays));
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.monthDays));
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreDays));
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreDays));
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearDays));
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreMonths));
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreMonths));
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearMonths));
System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.twoYearsMonths));
AbstractDao.getCurrentSession().getTransaction().commit();
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.weekDays));
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.monthDays));
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreDays));
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreDays));
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearDays));
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.trimestreMonths));
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.semestreMonths));
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.yearMonths));
// System.out.println(new ChartBuilderService().run(new TestHttpServletRequest(),relativePaths, ChartTypeEnum.twoYearsMonths));
// AbstractDao.getCurrentSession().getTransaction().commit();
}
 
}
/impl/src/java/pt/estgp/estgweb/services/utils/TransformXmlService.java
32,7 → 32,6
String xmlFile = args[0];
String xslTemplate = args[1];
String fileDest = args[2];
System.out.println("");
try
{
new TransformXmlService().transform(xmlFile,xslTemplate,fileDest);
/impl/src/java/pt/estgp/estgweb/services/profile/CurriculumService.java
66,12 → 66,15
{
r = RecordEnum.parse(recordView.getType()).createInstance();
r.setOwner(userSession.getUser());
r.setCreators(new HashSet<User>());
r.getCreators().add(userSession.getUser());
// r.setCreators(new HashSet<User>());
// r.getCreators().add(userSession.getUser());
userSession.getUser().getCreatorRecords().add(r);
if(userSession.getUser().getCreatorRecords() == null)
userSession.getUser().setCreatorRecords(new HashSet<Record>());
userSession.getUser().getCreatorRecords().add(r);
 
DaoFactory.getRecordDaoImpl().save(r);
DaoFactory.getRecordDaoImpl().refresh(r);
System.out.println(r.getCreators().size());
}
else
r = DaoFactory.getRecordDaoImpl().get(recordView.getId());
/impl/src/java/pt/estgp/estgweb/services/blogs/CreateBlogPostService.java
4,13 → 4,21
import pt.estgp.estgweb.domain.views.BlogView;
import pt.estgp.estgweb.domain.views.BlogPostView;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.enums.LangEnum;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.services.data.ImageManager;
import pt.estgp.estgweb.services.sms.SMSJob;
import pt.estgp.estgweb.services.jobs.JobScheduleService;
import pt.estgp.estgweb.services.email.SendEmailService;
import pt.estgp.estgweb.services.email.EMAILJob;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.utils.Email;
import org.apache.log4j.Logger;
 
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
 
import jomm.utils.MyCalendar;
 
63,12 → 71,36
{
bPV.setStatus(true);
}
 
bPV.persistViewInObject(bP);
bP.setOwner(userSession.getUser());
bP.setBlog(b);
bP.setSaveDate(new Date());
DaoFactory.getBlogPostDaoImpl().save(bP);
trySendPostEmail(bP,userSession);
return new BlogPostView(bP);
}
 
 
private void trySendPostEmail(BlogPost post, UserSession userSession)
{
if(post.getBlog() instanceof CourseUnitBlog && Globals.EMAIL_COURSEUNIT_BLOGS)
{
CourseUnit c = ((CourseUnitBlog)post.getBlog()).getCourseUnit();
List<User> users = new ArrayList<User>();
if(c.getStudents() != null)
users.addAll(c.getStudents());
if(c.getTeachers() != null)
users.addAll(c.getTeachers());
sendPostEmail(post,post.getTitle(), userSession, users);
}
}
 
private void sendPostEmail(BlogPost p, String desc, UserSession userSession, List<User> users)
{
SendEmailService sendEmailService = new SendEmailService();
Email e = sendEmailService.getCourseUnitBlogPostEmail(p, LangEnum.PORTUGUESE,userSession.getName(),users);
EMAILJob emailJob = new EMAILJob(e);
JobScheduleService.getInstance().scheduleNow(emailJob,"CourseUnit BlogPost Email:" + desc,userSession);
}
}
/impl/src/java/pt/estgp/estgweb/services/directories/DirectoryService.java
New file
0,0 → 1,67
package pt.estgp.estgweb.services.directories;
 
import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import pt.estgp.estgweb.domain.DirectoryImpl;
import pt.estgp.estgweb.utils.Dom4jUtil;
 
import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
 
/**
* @author Jorge Machado
*/
public class DirectoryService
{
 
private static final Logger logger = Logger.getLogger(DirectoryService.class);
 
 
public List<DirectoryImpl> loadDirectories(String classesPath)
{
List<DirectoryImpl> directories = new ArrayList<DirectoryImpl>();
String directoryResources = classesPath + "/pt/estgp/estgweb/directories";
 
if(directoryResources.startsWith("file:"))
{
directoryResources = directoryResources.substring("file:".length());
}
System.out.println("Using directory resources from:" + directoryResources);
File f = new File(directoryResources);
for(File dir: f.listFiles())
{
if(dir.getName().endsWith("xml"))
{
logger.info("Possible directory: " + dir.getName());
try
{
Document directoryDocument = Dom4jUtil.parse(dir);
String targetRole = directoryDocument.getRootElement().attribute("targetRole").getValue();
String id = directoryDocument.getRootElement().attribute("id").getValue();
String menuKey = directoryDocument.getRootElement().attribute("menuKey").getValue();
DirectoryImpl directory = new DirectoryImpl();
directory.setId(id);
directory.setKey(menuKey);
directory.setRole(targetRole);
directories.add(directory);
}
catch (DocumentException e)
{
logger.error("Error parsing directory " + dir.getAbsolutePath(),e);
}
catch (MalformedURLException e)
{
logger.error("Error parsing directory " + dir.getAbsolutePath(),e);
}
catch (Exception e)
{
logger.error("Error parsing directory " + dir.getAbsolutePath(),e);
}
}
}
return directories;
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseDaoImpl.java
1,8 → 1,10
package pt.estgp.estgweb.domain.dao.impl;
 
import static org.hibernate.criterion.Restrictions.*;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Criterion;
import org.hibernate.Criteria;
import org.hibernate.Query;
import pt.estgp.estgweb.domain.Course;
import pt.estgp.estgweb.domain.CourseImpl;
import pt.estgp.estgweb.domain.CourseUnit;
29,12 → 31,12
 
public CourseImpl findCourseByCode(String code)
{
return (CourseImpl) createCriteria().add(eq("code",code)).uniqueResult();
return (CourseImpl) createCriteria().add(eq("code", code)).uniqueResult();
}
 
public int countCoursesActualYear(String query, SearchTypeEnum searchType)
{
Criterion c = DaoUtils.createSearchQuery(query,searchType,"name","description");
Criterion c = DaoUtils.createSearchQuery(query, searchType, "name", "description");
return createCriteria()
.add(c)
.add(eq("importYear", DatesUtils.getImportYear()))
61,17 → 63,75
.list();
}
 
public List<Course> findAllImportYearOrderByName(String importYear, String area)
{
Criteria c = createCriteria();
if (importYear != null && importYear.length() > 0)
{
c.add(eq("importYear", importYear));
}
if (area != null && area.length() > 0)
{
c.add(eq("area", area));
}
return c.addOrder(Order.asc("name"))
.list();
}
 
public List<Course> findAllOrderByName(String importYear)
{
return createCriteria()
.add(eq("importYear",importYear))
.add(eq("importYear", importYear))
.addOrder(Order.asc("name"))
.list();
}
 
public List<Course> findAllOrderByName(String importYear, String area)
{
Criteria c = createCriteria();
if (importYear != null && importYear.length() > 0)
c.add(eq("importYear", importYear));
if (area != null && area.length() > 0)
c.add(eq("area", area));
return c.addOrder(Order.asc("name"))
.list();
}
 
public List<String> loadImportYears()
{
Query q = createQuery("select distinct c.importYear from c in class " + Course.class.getName() + " order by c.importYear desc");
return q.list();
}
 
public List<Course> loadAllCourses(long teacherId, String importYear)
{
return
createCriteria()
.add(eq("importYear", importYear))
.list();
}
 
public List<Course> loadCoordinatedCourses(long teacherId, String importYear)
{
return
createCriteria()
.add(eq("coordinator.id", teacherId))
.add(eq("importYear", importYear))
.list();
}
 
public List<Course> loadDirectorCourses(long teacherId, String importYear)
{
return
createCriteria()
.add(eq("director.id", teacherId))
.add(eq("importYear", importYear))
.list();
}
 
public List<Course> findAll(String importYear)
{
return createCriteria().add(eq("importYear",importYear))
return createCriteria().add(eq("importYear", importYear))
.list();
}
 
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/UserDaoImpl.java
150,8 → 150,8
}
else
criteria = createCriteria();
Criterion textSearch = DaoUtils.createSearchQuery(textToSearch, SearchTypeEnum.parse(typeToSearch), "name", "username");
Criterion text2Search = DaoUtils.createSearchQuery(textToSearch, SearchTypeEnum.parse(typeToSearch), "email");
Criterion textSearch = DaoUtils.createSearchQuery(textToSearch, SearchTypeEnum.AllWords, "name", "username");
Criterion text2Search = DaoUtils.createSearchQuery(textToSearch, SearchTypeEnum.AllWords, "email");
Criterion fields = or(textSearch, text2Search);
return criteria.add(fields)
.addOrder(Order.desc("name"))
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/RepositoryFileDaoImpl.java
24,7 → 24,7
 
public RepositoryFile loadByIdentifier(String identifier)
{
return (RepositoryFile) createCriteria().add(eq("identifier",identifier)).uniqueResult();
return (RepositoryFile) createCriteria().add(eq("id",identifier)).uniqueResult();
}
 
// public boolean hasTeacherFile(String identifier)
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AnnouncementDaoImpl.java
205,6 → 205,10
Criterion c = createSearchQuery(query, searchTypeEnum);
Criteria criteria = createRolesTypeCriteria(roles, null, null, internal);
criteria.add(c);
for(String notSearchable : Globals.ANNOUNCEMENT_NOT_STANDARD)
{
criteria.add(not(eq("type",notSearchable)));
}
return criteria.list().size();
}
 
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseUnitDaoImpl.java
12,6 → 12,8
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.sql.JoinFragment;
import org.apache.log4j.Logger;
 
import java.util.List;
46,27 → 48,40
 
public List<CourseUnit> loadByCourse(long course, String importYear)
{
return createCriteria().add(eq("importYear",importYear)).add(eq("course.id", course)).list();
return createCriteria().add(eq("importYear", importYear)).add(eq("course.id", course)).list();
}
 
public List<CourseUnit> load(String importYear, String semestre)
{
return createCriteria().add(eq("importYear", importYear)).add(eq("semestre", semestre)).list();
}
 
public List<Long> loadIds(String importYear, String semestre)
{
Query q = createQuery("select c.id from c in class " + CourseUnit.class.getName() + " where c.importYear = ? and c.semestre = ?");
q.setString(0, importYear);
q.setString(1, semestre);
return q.list();
}
 
public List<CourseUnit> loadSubscribedImportYearUnits(long studentId, String importYear)
{
return createCriteria().add(eq("importYear",importYear))
.createAlias("students","st")
return createCriteria().add(eq("importYear", importYear))
.createAlias("students", "st")
.add(eq("st.id", studentId)).addOrder(Order.asc("name")).list();
}
 
public List<CourseUnit> loadSubscribedOtherImportYearUnits(long studentId, String importYear)
{
return createCriteria().add(not(eq("importYear",importYear)))
.createAlias("students","st")
return createCriteria().add(not(eq("importYear", importYear)))
.createAlias("students", "st")
.add(eq("st.id", studentId)).addOrder(Order.asc("name")).list();
}
 
public List<CourseUnitImpl> loadTeachedImportYearUnits(long teacherId, String importYear)
{
return createCriteria().add(eq("importYear",importYear))
.createAlias("teachers","st")
return createCriteria().add(eq("importYear", importYear))
.createAlias("teachers", "st")
.add(eq("st.id", teacherId)).addOrder(Order.asc("importYear")).addOrder(Order.asc("name")).list();
}
 
82,27 → 97,27
 
public CourseUnit loadBySigesCodeUniqueSubscribed(String sigesCode, String year, String courseCode, long studentId, String semestre)
{
List<CourseUnit> cus = createCriteria()
List<CourseUnit> cus = createCriteria()
.add(eq("code", sigesCode))
.add(eq("importYear", year))
.add(eq("courseCode", courseCode))
.add(eq("semestre", semestre))
.createAlias("students","st")
.add(eq("st.id",studentId))
.createAlias("students", "st")
.add(eq("st.id", studentId))
.list();
if(cus.size() > 1)
if (cus.size() > 1)
{
CourseUnit cu1 = cus.get(0);
CourseUnit cu2 = cus.get(1);
if(cus.size() > 2)
if (cus.size() > 2)
{
logger.error("CourseUnit in more than two places in a course:" + cu1.getCode());
}
else
{
if(cu1.getSemestre().equals("S1"))
if (cu1.getSemestre().equals("S1"))
{
if(cu2.getSemestre().equals("S1"))
if (cu2.getSemestre().equals("S1"))
logger.error("CourseUnit in more than two places in a semestre:" + cu1.getCode());
else
{
111,7 → 126,7
}
else
{
if(cu2.getSemestre().equals("S2"))
if (cu2.getSemestre().equals("S2"))
logger.error("CourseUnit in more than two places in a semestre:" + cu1.getCode());
else
{
120,7 → 135,7
}
}
}
else if(cus.size() == 1)
else if (cus.size() == 1)
return cus.get(0);
 
return null;
137,10 → 152,32
.uniqueResult();
}
 
public List<CourseUnit> loadCourseUnits(long courseId, String semestre, String year, boolean withTeacher, boolean withNoTeacher)
{
Criteria c = createCriteria();
if(courseId > 0)
c.add(eq("course.id", courseId));
if(semestre != null && semestre.length() > 0)
c.add(eq("semestre", semestre));
if(year != null && year.length() > 0)
c.add(eq("importYear", year));
if(withTeacher && !withNoTeacher)
{
c.createAlias("teachers", "th");
c.add(isNotNull("th.id"));
}
else if(!withTeacher && withNoTeacher)
{
c.createAlias("teachers", "th", JoinFragment.LEFT_OUTER_JOIN);
c.add(isNull("th.id"));
}
return c.list();
}
 
 
public int countCourseUnits(String query, SearchTypeEnum searchType)
{
Criterion c = DaoUtils.createSearchQuery(query,searchType,"objectives","name");
Criterion c = DaoUtils.createSearchQuery(query, searchType, "objectives", "name");
return createCriteria().add(c).list().size();
}
 
157,7 → 194,7
 
public int countCourseUnitsActualYear(String query, SearchTypeEnum searchType)
{
Criterion c = DaoUtils.createSearchQuery(query,searchType,"objectives","name");
Criterion c = DaoUtils.createSearchQuery(query, searchType, "objectives", "name");
return createCriteria()
.add(c)
.add(eq("importYear", DatesUtils.getImportYear()))
181,10 → 218,10
//todo falta a projeccao do teacher id
return createCriteria()
.add(eq("importYear", DatesUtils.getImportYear()))
.add((or(isNull("objectives"),eq("objectives",""))))
.add((or(isNull("objectives"), eq("objectives", ""))))
.createAlias("teachers", "th")
.add(eq("semestre",DatesUtils.getSemestre()))
.add(eq("th.id",teacherId))
.add(eq("semestre", DatesUtils.getSemestre()))
.add(eq("th.id", teacherId))
.list();
}
 
193,22 → 230,30
//todo falta a projeccao do teacher id
return createCriteria()
.add(eq("importYear", DatesUtils.getImportYear()))
.add((or(isNull("programStreamId"),eq("programStreamId",""))))
.add((or(isNull("programStreamId"), eq("programStreamId", ""))))
.createAlias("teachers", "th")
.add(eq("semestre",DatesUtils.getSemestre()))
.add(eq("th.id",teacherId))
.add(eq("semestre", DatesUtils.getSemestre()))
.add(eq("th.id", teacherId))
.list();
}
 
public List<CourseUnit> loadMissingObjectivesOrPrograms(long teacherId)
{
//todo falta a projeccao do teacher id
return createCriteria()
Criteria c = createCriteria()
.add(eq("importYear", DatesUtils.getImportYear()))
.add(or(or(isNull("objectives"),eq("objectives","")),or(isNull("programStreamId"),eq("programStreamId",""))))
.add(eq("semestre",DatesUtils.getSemestre()))
.createAlias("teachers", "th")
.add(eq("th.id",teacherId))
.add(or(or(isNull("objectives"), eq("objectives", "")), or(isNull("programStreamId"), eq("programStreamId", ""))));
 
DatesUtils.SemestreModerate semestreModerate = DatesUtils.getSemestreModerate();
if (semestreModerate == DatesUtils.SemestreModerate.S1)
c.add(eq("semestre", "S1"));
else if (semestreModerate == DatesUtils.SemestreModerate.S2)
c.add(eq("semestre", "S2"));
else
c.add(or(eq("semestre", "S1"), eq("semestre", "S2")));
 
return c.createAlias("teachers", "th")
.add(eq("th.id", teacherId))
.list();
}
 
217,10 → 262,10
{
return createCriteria()
.createAlias("course", "c")
.add(eq("c.id",courseId))
.add(eq("c.id", courseId))
.add(eq("importYear", DatesUtils.getImportYear()))
.add(eq("semestre",DatesUtils.getSemestre()))
.add((or(isNull("objectives"),eq("objectives",""))))
.add(eq("semestre", DatesUtils.getSemestre()))
.add((or(isNull("objectives"), eq("objectives", ""))))
.list();
}
 
228,10 → 273,10
{
return createCriteria()
.createAlias("course", "c")
.add(eq("c.id",courseId))
.add(eq("c.id", courseId))
.add(eq("importYear", DatesUtils.getImportYear()))
.add(eq("semestre",DatesUtils.getSemestre()))
.add((or(isNull("programStreamId"),eq("programStreamId",""))))
.add(eq("semestre", DatesUtils.getSemestre()))
.add((or(isNull("programStreamId"), eq("programStreamId", ""))))
.list();
}
 
239,10 → 284,10
{
return createCriteria()
.createAlias("course", "c")
.add(eq("c.id",courseId))
.add(eq("c.id", courseId))
.add(eq("importYear", DatesUtils.getImportYear()))
.add(eq("semestre",DatesUtils.getSemestre()))
.add((or(or(isNull("objectives"),eq("objectives","")),or(isNull("programStreamId"),eq("programStreamId","")))))
.add(eq("semestre", DatesUtils.getSemestre()))
.add((or(or(isNull("objectives"), eq("objectives", "")), or(isNull("programStreamId"), eq("programStreamId", "")))))
.list();
}
 
252,11 → 297,4
}
 
 
 
 
 
 
 
 
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseUnitSummaryDaoImpl.java
New file
0,0 → 1,53
package pt.estgp.estgweb.domain.dao.impl;
 
import java.util.List;
 
import pt.estgp.estgweb.domain.Student;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.CourseUnitSummary;
import org.hibernate.Query;
import jomm.dao.impl.AbstractDao;
 
/**
* @author Jorge Machado
* @date 28/Fev/2008
* @time 2:51:06
* @see pt.estgp.estgweb.domain.dao.impl
*/
public class CourseUnitSummaryDaoImpl extends CourseUnitSummaryDao
{
 
 
 
private CourseUnitSummaryDaoImpl()
{
}
 
public static CourseUnitSummaryDaoImpl getInstance()
{
if (myInstance == null)
myInstance = new CourseUnitSummaryDaoImpl();
return (CourseUnitSummaryDaoImpl) myInstance;
}
 
 
public List<String> getStudentsEmails(long summaryId)
{
Query q = createQuery("select e.email from "
+ Student.class.getName() + " e join e.subscribedUnits as unit join unit.summaries as s "
+ " where "
+ " s.id = ? "
 
);
q.setLong(0,summaryId);
return q.list();
}
 
public static void main(String[] args)
{
AbstractDao.getCurrentSession().beginTransaction();
List l = new CourseUnitSummaryDaoImpl().getStudentsEmails(2);
 
AbstractDao.getCurrentSession().getTransaction().commit();
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/DaoUtils.java
21,7 → 21,7
c = or(like(field1, "%" + query + "%"), like(field2, "%" + query + "%"));
else if (searchTypeEnum == SearchTypeEnum.AllWords)
{
String[] fields = query.split(" ");
String[] fields = query.trim().split(" ");
for (String field : fields)
{
if (c == null)
32,7 → 32,7
}
else
{
String[] fields = query.split(" ");
String[] fields = query.trim().split(" ");
for (String field : fields)
{
if (c == null)
51,7 → 51,7
c = like(field1, "%" + query + "%");
else if (searchTypeEnum == SearchTypeEnum.AllWords)
{
String[] fields = query.split(" ");
String[] fields = query.trim().split(" ");
for (String field : fields)
{
if (c == null)
62,7 → 62,7
}
else
{
String[] fields = query.split(" ");
String[] fields = query.trim().split(" ");
for (String field : fields)
{
if (c == null)
/impl/src/java/pt/estgp/estgweb/domain/dao/DaoFactory.java
16,7 → 16,12
return JobDaoImpl.getInstance();
}
 
public static CourseUnitSummaryDaoImpl getCourseUnitSummaryDaoImpl()
{
return CourseUnitSummaryDaoImpl.getInstance();
}
 
 
public static CourseUnitGradeDaoImpl getCourseUnitGradeDaoImpl()
{
return CourseUnitGradeDaoImpl.getInstance();
/impl/src/java/pt/estgp/estgweb/domain/DirectoryImpl.java
New file
0,0 → 1,46
package pt.estgp.estgweb.domain;
 
/**
* Created by IntelliJ IDEA.
* User: Jorge
* Date: 2/Dez/2008
* Time: 19:25:19
* To change this template use File | Settings | File Templates.
*/
public class DirectoryImpl
{
private String id;
private String key;
private String role;
 
 
public String getId()
{
return id;
}
 
public void setId(String id)
{
this.id = id;
}
 
public String getKey()
{
return key;
}
 
public void setKey(String key)
{
this.key = key;
}
 
public String getRole()
{
return role;
}
 
public void setRole(String role)
{
this.role = role;
}
}
/impl/src/java/pt/estgp/estgweb/domain/SigesUserImpl.java
New file
0,0 → 1,10
package pt.estgp.estgweb.domain;
 
/**
* @author Jorge
* @date 16/Jan/2009
* @time 15:34:38
*/
public abstract class SigesUserImpl extends SigesUser
{
}
/impl/src/java/pt/estgp/estgweb/domain/CourseUnitSummaryImpl.java
New file
0,0 → 1,28
package pt.estgp.estgweb.domain;
 
import org.apache.log4j.Logger;
 
import java.util.List;
import java.util.Date;
import java.io.Serializable;
 
import pt.estgp.estgweb.domain.enums.AnnouncementStyleEnum;
import pt.estgp.estgweb.utils.RoleManager;
 
/**
* @author Jorge Machado
* @date 2/Mar/2008
* @time 10:27:25
* @see pt.estgp.estgweb.domain
*/
public class CourseUnitSummaryImpl extends CourseUnitSummary
{
 
private static final Logger logger = Logger.getLogger(CourseUnitSummaryImpl.class);
 
 
public Serializable getSerializable()
{
return getId();
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitSummaryView.java
New file
0,0 → 1,90
package pt.estgp.estgweb.domain.views;
 
import pt.estgp.estgweb.domain.CourseUnitSummary;
import pt.estgp.estgweb.web.utils.DatesUtils;
 
import java.io.Serializable;
 
/**
* @author Jorge Machado
* @date 2/Mar/2008
* @time 19:34:49
* @see pt.estgp.estgweb.domain.views
*/
public class CourseUnitSummaryView extends DomainObjectView
{
 
 
private CourseUnitSummary summary;
private long id;
private String title;
private String description;
private int number;
private String date;
private int students;
 
 
 
 
public CourseUnitSummaryView(CourseUnitSummary summary)
{
super(summary);
init(summary);
}
public void init(CourseUnitSummary summary)
{
this.summary = summary;
this.id = summary.getId();
this.title = summary.getTitulo();
this.description = summary.getDescricao();
this.date = DatesUtils.getStringFromDate(summary.getDataAula());
this.number = summary.getNumeroAula();
this.students = summary.getAlunosPresentes();
}
 
// public void persistViewInObject(Announcement announcement)
// {
// }
 
 
public Class getReferenceClass()
{
return CourseUnitSummary.class;
}
 
public Serializable getSerializable()
{
return id;
}
 
 
public long getId()
{
return id;
}
 
public String getTitle()
{
return title;
}
 
public String getDescription()
{
return description;
}
 
public int getNumber()
{
return number;
}
 
public String getDate()
{
return date;
}
 
public int getStudents()
{
return students;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/RecordView.java
36,6 → 36,7
private String copyright;
private String identifier;
private String repositoryStream;
private String creatorsStr;
private List<UserView> creators = new ArrayList<UserView>();
private List<UserView> contributors = new ArrayList<UserView>();
private RepositoryFileImpl repositoryFile;
91,6 → 92,8
this.copyright = record.getCopyright();
this.identifier = record.getIdentifier();
this.repositoryStream = record.getRepositoryStream();
 
this.creators = UserView.getViews(new ArrayList<User>(record.getCreators()));
this.contributors = UserView.getViews(new ArrayList<User>(record.getContributors()));
if(repositoryStream != null)
120,7 → 123,8
r.setDescripion(description);
r.setPublisher(publisher);
r.setIdentifier(identifier);
r.setCreators(UserView.loadUsers(creators));
if(creators != null && creators.size() > 0)
r.setCreators(UserView.loadUsers(creators));
r.setContributors(UserView.loadUsers(contributors));
}
 
/impl/src/java/pt/estgp/estgweb/domain/views/UserView.java
233,6 → 233,7
public void persistViewInObjectUser(User user)
{
user.setName(name);
user.setEmail(email);
user.setOutEmail(outEmail);
user.setPop3server(pop3server);
user.setPop3username(pop3username);
/impl/src/java/pt/estgp/estgweb/domain/views/AnnouncementView.java
371,9 → 371,9
return StringsUtils.getFormatedText(text);
}
 
public Boolean getHaveAllText()
public Boolean getTextBiggerThenPermited()
{
if(getInternalUrlPath() != null)
if(getInternalUrlPath() != null && getInternalUrlPath().trim().length()>0)
return false;
if(getType().equals("top.flash.news"))
{
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitView.java
37,6 → 37,7
private String pathIntranet;
private String normalizedName;
private List<AnnouncementView> announcements;
private List<CourseUnitSummaryView> summaries;
 
private CourseUnit courseUnit;
private Set<UserView> teachers;
455,21 → 456,36
this.validatorUser = validatorUser;
}
 
 
public void setSummaries(List<CourseUnitSummaryView> summaries)
{
this.summaries = summaries;
}
 
public List<CourseUnitSummaryView> getSummaries()
{
return summaries;
}
 
public String getTeachersSnipet()
{
String sep = "";
StringBuilder strBuilder = new StringBuilder();
if(teachers != null && teachers.size() > 0)
{
for(UserView userView: teachers)
{
strBuilder
.append(sep)
.append(" ")
.append(" <a href=\"mailto:")
.append(userView.getEmail())
.append("\">")
.append(userView.getName())
.append("</a>")
.append(" ");
 
;
sep = ",";
}
}
return strBuilder.toString();
/impl/src/java/pt/estgp/estgweb/domain/views/CourseView.java
24,7 → 24,9
 
 
private long id;
 
private String code;
private String area;
private String name;
private String degree;
private String importYear;
84,6 → 86,7
this.course = course;
this.id = course.getId();
this.code = course.getCode();
this.area = course.getArea();
this.name = course.getName();
this.degree = course.getDegree();
this.description = course.getDescription();
116,6 → 119,7
public void persistViewInObject(Course c)
{
c.setCode(code);
c.setArea(area);
c.setDegree(degree);
c.setDescription(description);
c.setImportYear(importYear);
182,6 → 186,16
this.code = code;
}
 
public String getArea()
{
return area;
}
 
public void setArea(String area)
{
this.area = area;
}
 
public String getName()
{
return name;
/impl/src/java/pt/estgp/estgweb/domain/UrlStatImpl.java
1,5 → 1,9
package pt.estgp.estgweb.domain;
 
import org.apache.commons.httpclient.util.URIUtil;
import org.apache.commons.httpclient.URIException;
import org.apache.log4j.Logger;
 
import java.io.Serializable;
import java.util.HashSet;
import java.util.Date;
12,6 → 16,7
*/
public class UrlStatImpl extends UrlStat
{
private static final Logger logger = Logger.getLogger(UrlStatImpl.class);
 
public UrlStatImpl()
{
34,7 → 39,14
public String getName()
{
if(super.getName() == null)
return getRelativePath();
try
{
return URIUtil.decode(getRelativePath());
}
catch (URIException e)
{
logger.error(e,e);
}
return super.getName();
}
}
/impl/src/java/pt/estgp/estgweb/domain/DomainObjectFactory.java
66,6 → 66,11
return new CourseUnitAnnouncementImpl();
}
 
public static CourseUnitSummaryImpl createCourseUnitSummaryImpl()
{
return new CourseUnitSummaryImpl();
}
 
public static CourseImpl createCourseImpl()
{
return new CourseImpl();
/impl/src/java/pt/estgp/estgweb/web/tags/CanNotAddContentTag.java
New file
0,0 → 1,80
package pt.estgp.estgweb.web.tags;
 
import org.apache.log4j.Logger;
import org.apache.struts.util.RequestUtils;
 
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
 
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.domain.IAddContents;
 
public class CanNotAddContentTag extends BodyTagSupport
{
 
private static final Logger logger = Logger.getLogger(CanNotAddContentTag.class);
 
private String name;
 
private String property;
 
public String getName()
{
return name;
}
 
public void setName(String name)
{
this.name = name;
}
 
public String getProperty()
{
return property;
}
 
public void setProperty(String property)
{
this.property = property;
}
 
public int doStartTag() throws JspException
{
if (!go())
{
return EVAL_BODY_TAG;
}
else
return SKIP_BODY;
}
 
public boolean go() throws JspException
{
UserSessionImpl userSession = (UserSessionImpl) pageContext.getRequest().getAttribute(pt.estgp.estgweb.Globals.USER_SESSION_KEY);
IAddContents iAddContents = (IAddContents) RequestUtils.lookup(pageContext, name, property, null);
return iAddContents != null && userSession.getUser() != null && (iAddContents.canAddContent(userSession.getUser()));
}
 
public int doEndTag() throws JspException
{
if (go())
{
String toPage = bodyContent.getString().trim();
JspWriter writer = pageContext.getOut();
try
{
writer.write(toPage);
}
catch (Exception e)
{
logger.error(e, e);
throw new JspException(e);
}
}
// Continue processing this page
return EVAL_PAGE;
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/tags/PageUrlStatTag.java
51,7 → 51,7
if(attributes == null)
attributes = "";
 
String url = "<a " + attributes + " href=\"" + hrequest.getContextPath() + "/urlstat/startUrlStat.do?relativePaths[0].value=" + URIUtil.encodePath(relativePath,"ISO-8859-1") + "\">";
String url = "<a " + attributes + " href=\"" + hrequest.getContextPath() + "/urlstat/startUrlStat.do?relativePaths[0].value=" + URIUtil.encodeWithinQuery(relativePath,"ISO-8859-1") + "\">";
String endUrl = "</a>";
String toPage = bodyContent.getString().trim();
JspWriter writer = pageContext.getOut();
77,5 → 77,10
return EVAL_PAGE;
}
 
public static void main(String[] args)
{
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/DirWebProxy.java
New file
0,0 → 1,404
package pt.estgp.estgweb.web;
 
import org.apache.log4j.Logger;
import org.apache.commons.httpclient.util.URIUtil;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.OutputFormat;
 
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import javax.servlet.jsp.JspWriter;
import java.io.*;
import java.net.*;
import java.util.Date;
import java.util.Map;
import java.util.HashMap;
import java.util.zip.ZipInputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.InflaterInputStream;
 
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.estgp.estgweb.domain.UserSession;
import freemarker.template.utility.HtmlEscape;
import com.lowagie.text.html.HtmlEncoder;
 
/**
* @author Jorge Machado
* @date 26/Fev/2008
* @time 12:46:16
* @see pt.estgp.estgweb.web
*/
public class DirWebProxy extends HttpServlet
{
 
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
*
* @param request servlet request
* @param response servlet response
*/
 
private static final Logger logger = Logger.getLogger(DirWebProxy.class);
 
 
protected static void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
 
String element = (String) request.getAttribute("element");
if(element.equals("node"))
{
processNode(request,response);
}
else
{
processLeaf(request,response);
}
}
 
 
/**
*
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
 
protected static void processNode(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
styleDirectory(request,response);
}
 
protected static void processLeaf(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String path = (String) request.getAttribute("path");
String server = (String) request.getAttribute("server");
String useOutputStream = (String) request.getAttribute("useOutputStream");
String encoding = (String) request.getAttribute("encoding");
String proxyHost = (String) request.getAttribute("proxy.host");
String proxyPort = (String) request.getAttribute("proxy.port");
boolean style = Boolean.parseBoolean((String) request.getAttribute("style"));
String xml = (String) request.getAttribute("xml");
String label = (String) request.getAttribute("label");
 
logger.info("server:" + server);
logger.info("path:" + path);
logger.info("proxyHost:" + proxyHost);
logger.info("proxyPort:" + proxyPort);
logger.info("xml:" + xml);
logger.info("style:" + style);
logger.info("label:" + label);
 
if (path != null)
{
try
{
Proxy proxy = null;
if (proxyHost != null && proxyHost.length() > 0)
{
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, Integer.parseInt(proxyPort)));
}
 
 
String finalURL = server + URIUtil.encodePath(path, "ISO-8859-1");
URL url = new URL(finalURL);
 
 
if (useOutputStream != null && useOutputStream.equals("true"))
{
InputStream stream = openStream(finalURL,proxy);
URLConnection con = url.openConnection();
response.setContentType(con.getContentType());
if(xml == null || xml.equals("false"))
response.setCharacterEncoding(encoding);
response.setContentLength(con.getContentLength());
writeDirectStream(response,stream);
}
else if(xml == null || xml.equals("false"))
{
InputStream stream = openStream(finalURL,proxy);
String content = readContent2String(stream,encoding);
generateOutputLeaf(response,request,content,style);
}
else
{
URLConnection con = new URL(finalURL).openConnection();
con.connect();
if(con.getContentLength()>0)
{
// Document dom = Dom4jUtil.parse(stream);
generateOutputLeafXml(response,request,finalURL,proxy,style);
}
}
}
catch (FileNotFoundException e)
{
logger.warn("url not found for server:" + server + " and path:" + path);
response.sendError(404);
}
catch (Exception e)
{
throw new IOException(e.toString());
}
}
else
{
logger.warn("url not found for server:" + server + " and path:" + path);
response.sendError(404);
}
 
}
 
 
private static void generateOutputLeafXml(HttpServletResponse response,HttpServletRequest request, String finalURL,Proxy proxy, boolean style) throws IOException, DocumentException
{
if(style)
{
Map<String,Object> parameters = new HashMap<String,Object>();
// OutputFormat outputFormat = new OutputFormat();
// outputFormat.setSuppressDeclaration(true);
// outputFormat.setEncoding("UTF-8");
// StringWriter writer = new StringWriter();
// Dom4jUtil.write(dom,writer, outputFormat);
// org.w3c.dom.Document d = new org.dom4j.io.DOMWriter().write(dom);
// parameters.put("body",dom.selectSingleNode("/"));
parameters.put("includeXML",finalURL);
styleDirectory(request,response,parameters,null);
}
else
{
InputStream stream = openStream(finalURL,proxy);
Document dom = Dom4jUtil.parse(stream);
Dom4jUtil.write(dom,response.getWriter());
}
}
 
private static void generateOutputLeaf(HttpServletResponse response,HttpServletRequest request, String content, boolean style) throws IOException
{
if(style)
{
// Map<String,Object> parameters = new HashMap<String,Object>();
// parameters.put("body",content);
styleDirectory(request,response,new HashMap<String,Object>(),content);
}
else
{
response.getWriter().write(content);
}
}
 
private static void styleDirectory(HttpServletRequest request, HttpServletResponse response) throws IOException
{
styleDirectory(request,response,new HashMap<String,Object>(),null);
}
 
private static void styleDirectory(HttpServletRequest request, HttpServletResponse response, Map<String,Object> parameters, String bodyContent) throws IOException
{
String stylesheet = (String) request.getAttribute("stylesheet");
Document directoryDocument = (Document) request.getAttribute("directoryDocument");
String actualNodeId = (String) request.getAttribute("actualNodeId");
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
 
parameters.put("contextPath",request.getContextPath());
if(userSession.getUsername() != null)
parameters.put("username",userSession.getUsername());
if(userSession.getName() != null)
parameters.put("name",userSession.getName());
if(userSession.getUser() != null)
parameters.put("roles",userSession.getUser().getRoles());
parameters.put("ACTUAL",actualNodeId);
 
try
{
String html = Dom4jUtil.styleDocument(directoryDocument,stylesheet,parameters);
if(bodyContent != null)
html = html.replace("@@BODY_CONTENT@@",bodyContent);
response.getWriter().write(html);
}
catch (Exception e)
{
logger.error(e,e);
response.sendError(500);
}
}
 
private static String readContent2String(InputStream stream, String encoding) throws IOException
{
byte[] buf = new byte[1024];
int readedBytes;
StringWriter writer = new StringWriter();
while ((readedBytes = stream.read(buf)) > 0)
{
String s = new String(buf, 0, readedBytes, encoding);
writer.write(s);
}
return writer.toString();
}
 
private static void writeDirectStream(HttpServletResponse response, InputStream stream) throws IOException
{
byte[] buf = new byte[1024];
int readedBytes;
OutputStream os = response.getOutputStream();
while ((readedBytes = stream.read(buf)) > 0)
{
os.write(buf, 0, readedBytes);
}
os.close();
}
 
private static InputStream openStream(String requestURL, Proxy proxy) throws IOException
{
InputStream in = null;
URL url = new URL(requestURL);
 
HttpURLConnection con = null;
int responseCode = 0;
do
{
if (proxy != null)
con = (HttpURLConnection) url.openConnection(proxy);
else
con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("User-Agent", "ESTG-Baco/1.0");
con.setRequestProperty("Accept-Encoding", "compress, gzip, identify");
try
{
responseCode = con.getResponseCode();
logger.debug("responseCode=" + responseCode);
}
catch (FileNotFoundException e)
{
// assume it's a 503 response
logger.info(requestURL, e);
responseCode = HttpURLConnection.HTTP_UNAVAILABLE;
}
 
if (responseCode == HttpURLConnection.HTTP_UNAVAILABLE)
{
long retrySeconds = con.getHeaderFieldInt("Retry-After", -1);
if (retrySeconds == -1)
{
long now = (new Date()).getTime();
long retryDate = con.getHeaderFieldDate("Retry-After", now);
retrySeconds = retryDate - now;
}
if (retrySeconds == 0)
{ // Apparently, it's a bad URL
throw new FileNotFoundException("Bad URL?");
}
logger.error("Server response: Retry-After=" + retrySeconds);
if (retrySeconds > 0)
{
try
{
Thread.sleep(retrySeconds * 1000);
}
catch (InterruptedException ex)
{
ex.printStackTrace();
}
}
}
}
while (responseCode == HttpURLConnection.HTTP_UNAVAILABLE);
String contentEncoding = con.getHeaderField("Content-Encoding");
logger.debug("contentEncoding=" + contentEncoding);
if ("compress".equals(contentEncoding))
{
ZipInputStream zis = new ZipInputStream(con.getInputStream());
zis.getNextEntry();
in = zis;
}
else if ("gzip".equals(contentEncoding))
{
in = new GZIPInputStream(con.getInputStream());
}
else if ("deflate".equals(contentEncoding))
{
in = new InflaterInputStream(con.getInputStream());
}
else
{
in = con.getInputStream();
}
return in;
}
 
public static void processHttpRequestService(JspWriter out, String server, String path) throws IOException, ServletException
{
String serverUrl = ConfigProperties.getProperty("server." + server);
String serverEncoding = ConfigProperties.getProperty(server + ".encoding");
String confStartPath = ConfigProperties.getProperty("server." + server + ".start.path");
if (confStartPath != null)
path = confStartPath + path;
 
 
try
{
URL url = new URL(serverUrl + URIUtil.encodePath(path, "ISO-8859-1"));
URLConnection con = url.openConnection();
InputStream stream = con.getInputStream();
 
byte[] buf = new byte[1024];
int readedBytes;
 
while ((readedBytes = stream.read(buf)) > 0)
{
String str = new String(buf, 0, readedBytes, serverEncoding);
out.print(str);
}
}
catch (FileNotFoundException e)
{
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
}
catch (Exception e)
{
throw new IOException(e.toString());
}
 
}
 
 
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
processRequest(request, response);
}
 
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
processRequest(request, response);
}
 
/**
* Returns a short description of the servlet.
*/
public String getServletInfo()
{
return "Proxy Servlet to forward to HTTP or FTP Proxy";
}
// </editor-fold>
}
/impl/src/java/pt/estgp/estgweb/web/WebProxy.java
13,8 → 13,11
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.*;
import java.util.Date;
import java.util.zip.ZipInputStream;
import java.util.zip.InflaterInputStream;
import java.util.zip.GZIPInputStream;
 
/**
* @author Jorge Machado
22,9 → 25,12
* @time 12:46:16
* @see pt.estgp.estgweb.web
*/
public class WebProxy extends HttpServlet {
public class WebProxy extends HttpServlet
{
 
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
*
* @param request servlet request
* @param response servlet response
*/
32,7 → 38,6
private static final Logger logger = Logger.getLogger(WebProxy.class);
 
 
 
protected static void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
40,46 → 45,60
String server = (String) request.getAttribute("server");
String useOutputStream = (String) request.getAttribute("useOutputStream");
String encoding = (String) request.getAttribute("encoding");
String proxyHost = (String) request.getAttribute("proxy.host");
String proxyPort = (String) request.getAttribute("proxy.port");
logger.info("server:" + server);
logger.info("path:" + path);
if(path != null)
logger.info("proxyHost:" + proxyHost);
logger.info("proxyPort:" + proxyPort);
if (path != null)
{
try
{
URL url = new URL(server + URIUtil.encodePath(path,"ISO-8859-1"));
Proxy proxy = null;
if (proxyHost != null && proxyHost.length() > 0)
{
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, Integer.parseInt(proxyPort)));
}
 
 
String finalURL = server + URIUtil.encodePath(path, "ISO-8859-1");
URL url = new URL(finalURL);
 
URLConnection con = url.openConnection();
response.setContentType(con.getContentType());
response.setContentLength(con.getContentLength());
InputStream stream = con.getInputStream();
 
 
InputStream stream = openStream(finalURL,proxy);
 
byte[] buf = new byte[1024];
int readedBytes;
if(useOutputStream!=null && useOutputStream.equals("true"))
if (useOutputStream != null && useOutputStream.equals("true"))
{
 
OutputStream os = response.getOutputStream();
while((readedBytes = stream.read(buf)) > 0)
while ((readedBytes = stream.read(buf)) > 0)
{
os.write(buf,0,readedBytes);
os.write(buf, 0, readedBytes);
}
os.close();
}
else
{
while((readedBytes = stream.read(buf)) > 0)
while ((readedBytes = stream.read(buf)) > 0)
{
String s = new String(buf,0,readedBytes,encoding);
String s = new String(buf, 0, readedBytes, encoding);
response.getWriter().write(s);
}
}
}
catch(FileNotFoundException e)
catch (FileNotFoundException e)
{
logger.warn("url not found for server:" + server + " and path:" + path);
response.sendError(404);
}
catch(Exception e)
catch (Exception e)
{
throw new IOException(e.toString());
}
92,35 → 111,113
 
}
 
private static InputStream openStream(String requestURL, Proxy proxy) throws IOException
{
InputStream in = null;
URL url = new URL(requestURL);
 
HttpURLConnection con = null;
int responseCode = 0;
do
{
if (proxy != null)
con = (HttpURLConnection) url.openConnection(proxy);
else
con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("User-Agent", "ESTG-Baco/1.0");
con.setRequestProperty("Accept-Encoding", "compress, gzip, identify");
try
{
responseCode = con.getResponseCode();
logger.debug("responseCode=" + responseCode);
}
catch (FileNotFoundException e)
{
// assume it's a 503 response
logger.info(requestURL, e);
responseCode = HttpURLConnection.HTTP_UNAVAILABLE;
}
 
if (responseCode == HttpURLConnection.HTTP_UNAVAILABLE)
{
long retrySeconds = con.getHeaderFieldInt("Retry-After", -1);
if (retrySeconds == -1)
{
long now = (new Date()).getTime();
long retryDate = con.getHeaderFieldDate("Retry-After", now);
retrySeconds = retryDate - now;
}
if (retrySeconds == 0)
{ // Apparently, it's a bad URL
throw new FileNotFoundException("Bad URL?");
}
logger.error("Server response: Retry-After=" + retrySeconds);
if (retrySeconds > 0)
{
try
{
Thread.sleep(retrySeconds * 1000);
}
catch (InterruptedException ex)
{
ex.printStackTrace();
}
}
}
}
while (responseCode == HttpURLConnection.HTTP_UNAVAILABLE);
String contentEncoding = con.getHeaderField("Content-Encoding");
logger.debug("contentEncoding=" + contentEncoding);
if ("compress".equals(contentEncoding))
{
ZipInputStream zis = new ZipInputStream(con.getInputStream());
zis.getNextEntry();
in = zis;
}
else if ("gzip".equals(contentEncoding))
{
in = new GZIPInputStream(con.getInputStream());
}
else if ("deflate".equals(contentEncoding))
{
in = new InflaterInputStream(con.getInputStream());
}
else
{
in = con.getInputStream();
}
return in;
}
 
public static void processHttpRequestService(JspWriter out, String server, String path) throws IOException, ServletException
{
String serverUrl = ConfigProperties.getProperty("server." + server);
String serverEncoding = ConfigProperties.getProperty(server + ".encoding");
String confStartPath = ConfigProperties.getProperty("server." + server + ".start.path");
if(confStartPath != null)
if (confStartPath != null)
path = confStartPath + path;
 
 
try
{
URL url = new URL(serverUrl + URIUtil.encodePath(path,"ISO-8859-1"));
URL url = new URL(serverUrl + URIUtil.encodePath(path, "ISO-8859-1"));
URLConnection con = url.openConnection();
InputStream stream = con.getInputStream();
 
byte[] buf = new byte[1024];
int readedBytes;
 
while((readedBytes = stream.read(buf)) > 0)
while ((readedBytes = stream.read(buf)) > 0)
{
String str = new String(buf,0,readedBytes,serverEncoding);
String str = new String(buf, 0, readedBytes, serverEncoding);
out.print(str);
}
}
catch(FileNotFoundException e)
catch (FileNotFoundException e)
{
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
}
catch(Exception e)
catch (Exception e)
{
throw new IOException(e.toString());
}
129,27 → 226,35
 
 
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
throws ServletException, IOException
{
processRequest(request, response);
}
 
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
throws ServletException, IOException
{
processRequest(request, response);
}
 
/** Returns a short description of the servlet.
/**
* Returns a short description of the servlet.
*/
public String getServletInfo() {
public String getServletInfo()
{
return "Proxy Servlet to forward to HTTP or FTP Proxy";
}
// </editor-fold>
/impl/src/java/pt/estgp/estgweb/web/DirLayoutController.java
New file
0,0 → 1,667
package pt.estgp.estgweb.web;
 
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.log4j.Logger;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.httpclient.util.URIUtil;
import org.dom4j.*;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.net.URL;
import java.net.MalformedURLException;
 
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.web.exceptions.NotAuthorizedException;
import jomm.web.ftp.IFile;
import jomm.web.ftp.impl.FtpFile;
import jomm.web.utils.NavPlace;
 
/**
* @author Jorge Machado
* @date 26/Fev/2008
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class DirLayoutController extends Action
{
 
private static final Logger logger = Logger.getLogger(DirLayoutController.class);
 
 
private static enum DirectoryNodeType
{
node,
leaf,
directory,
external
}
 
private static class Rights
{
List<RightsT> rightsT;
boolean internal = false; //by default
}
 
private static class RightsT
{
String text;
RightsTClass rightsTClass;
RightsTType type;
 
private static enum RightsTType
{
permit,
restrict
}
 
private static enum RightsTClass
{
role,
user
}
}
 
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
 
/**
* 1 - Obtain Directory XML
* 2 - Build a Xpath query based on path
* 3 - Set Actual Node
* 4 - Check Actual Node Rights
* 5 - If is a leaf check absolute just to confirm the request is valid, if absolute redirect just in case
* 6 - If is a leaf check layout to define the use of a layout and get directory@layout to choose layout to forward in struts
* 7 - If is a leaf check style to define the use of a style and allays put the object in "body" parameter or directly put content in layout
* 8 - If is a leaf check proxy to know if it is an proxied source if it is get content by URL concat or just forward to an internal localhost/context/path
* 8.1 in this case check if is to be layout, usuallly will not be laouted but just in case check it.
*
*
* No WebProxy colocar o contextPath, o user, os Roles, o actual node, username, name, body se for o caso de puxar
*/
 
 
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
 
 
String directory = request.getParameter("directory");
String path = request.getParameter("path");
 
 
try
{
Document directoryDocument = Dom4jUtil.parseSourceFile("/pt/estgp/estgweb/directories/" + directory + ".xml");
 
if (path.startsWith("/"))
path = path.substring(1);
String[] ids = path.split("/");
Map<String, String> namespaces = new HashMap<String, String>();
DirectoryNodeType directoryNodeType = null;
String actualNodeId = null;
Element actualNode = null;
int stopName = 0;
List<Rights> rights = new ArrayList<Rights>();
for (String id : ids)
{
XPath idXpath = directoryDocument.createXPath("//*[@id='" + id + "']");
namespaces.put("d", "http://www.estgp.pt/baco/directory/");
idXpath.setNamespaceURIs(namespaces);
Element idElem = (Element) idXpath.selectSingleNode(directoryDocument);
if (idElem == null)
{
directoryNodeType = DirectoryNodeType.external;
break;
}
Rights r = buildRights(idElem, namespaces);
if (r != null)
rights.add(r);
String name = idElem.getQName().getName();
if (name.equals("leaf"))
{
directoryNodeType = DirectoryNodeType.leaf;
actualNodeId = id;
actualNode = idElem;
}
else if (name.equals("node"))
{
directoryNodeType = DirectoryNodeType.node;
actualNodeId = id;
actualNode = idElem;
}
else if (name.equals("directory"))
{
directoryNodeType = DirectoryNodeType.directory;
actualNodeId = id;
actualNode = idElem;
}
else
{
logger.error("Unexpected node " + name + " with id " + id);
return mapping.findForward("500");
}
stopName++;
}
if (directoryNodeType == null)
{
logger.error("Unexpected, no nodes found for given id path " + path + " in directory " + directory);
return mapping.findForward("500");
}
else
{
if (!checkRights(rights, userSession))
throw new NotAuthorizedException("user: " + userSession.getUsername() + " trying access node " + actualNodeId + " in directory " + directory);
if (!pruneDocument(directoryDocument.getRootElement(), namespaces, userSession))
{
throw new NotAuthorizedException("user: " + userSession.getUsername() + " trying access directory: " + directory);
}
String externalFile = buildExternalFile(stopName, ids);
 
putInRequestCommonAttributes(request, actualNodeId, directoryDocument);
 
Attribute layoutStrAtt = directoryDocument.getRootElement().attribute("layout");
Attribute layoutRootStrAtt = directoryDocument.getRootElement().attribute("layoutRoot");
String layoutChoosed = (layoutStrAtt != null ? layoutStrAtt.getValue() : "layoutEmpty");
String rootLayoutChoosed = (layoutRootStrAtt != null ? layoutRootStrAtt.getValue() : "layout1");
 
if (directoryNodeType == DirectoryNodeType.node)
{
request.setAttribute("element", "node");
return mapping.findForward(layoutChoosed);
}
else if (directoryNodeType == DirectoryNodeType.directory)
{
request.setAttribute("element", "node");
return mapping.findForward(rootLayoutChoosed);
}
else if (directoryNodeType == DirectoryNodeType.leaf || directoryNodeType == DirectoryNodeType.external)
{
request.setAttribute("element", "leaf");
 
String url = getAttributeValue(actualNode, "url");
String label = getAttributeValue(actualNode, "label");
String xml = getAttributeValue(actualNode, "xml");
String layout = getAttributeValue(actualNode, "layout");
String style = getAttributeValue(actualNode, "style");
String absolute = getAttributeValue(actualNode, "absolute");
String proxy = getAttributeValue(actualNode, "proxy");
 
if(style == null)
style = "true";
 
//Confirm just in case
if (url != null && absolute != null && absolute.equals("true"))
return redirect(response, url);
else
{
boolean layoutDo = true;
if (layout != null && layout.length() > 0) layoutDo = Boolean.parseBoolean(layout);
if (!layoutDo) layoutChoosed = "layoutEmpty";
putProxyAttributes(request, proxy, externalFile,xml);
request.setAttribute("label", label);
request.setAttribute("style", style);
request.setAttribute("xml", xml);
if(style.equals("false") && !layoutDo)
request.setAttribute("useOutputStream", "true");
if(request.getAttribute("useOutputStream") != null && request.getAttribute("useOutputStream").equals("true"))
{
ActionForward forward = new ActionForward();
forward.setPath("/DirWebProxy");
return forward;
}
else
{
return mapping.findForward(layoutChoosed);
}
}
}
}
}
catch (DocumentException e)
{
logger.error(e, e);
throw new IOException(e.toString());
}
ActionForward forward = new ActionForward();
request.setAttribute("useOutputStream", "true");
forward.setPath("/WebProxy");
return forward;
}
 
private String getAttributeValue(Element actualNode, String name)
{
return (actualNode.attribute(name) != null ? actualNode.attribute(name).getValue() : null);
}
 
private void putProxyAttributes(HttpServletRequest request, String proxy, String externalFile, String xml)
{
String server = ConfigProperties.getProperty("server." + proxy);
String proxyHost = ConfigProperties.getProperty(proxy + ".proxy.host");
String proxyPort = ConfigProperties.getProperty(proxy + ".proxy.port");
String confStartPath = ConfigProperties.getProperty("server." + proxy + ".start.path");
 
request.setAttribute("server", server);
request.setAttribute("proxy.host", proxyHost);
request.setAttribute("proxy.port", proxyPort);
if (confStartPath != null)
externalFile = confStartPath + externalFile;
request.setAttribute("path", externalFile);
 
if(xml != null && xml.equals("true"))
{
String encoding = ConfigProperties.getProperty(proxy + ".encoding");
request.setAttribute("encoding", encoding);
request.setAttribute("useOutputStream", "false");
return;
}
for(String extension: pt.estgp.estgweb.Globals.PROXY_EXTENSIONS)
{
if(externalFile.endsWith("." + extension))
{
String encoding = ConfigProperties.getProperty(proxy + ".encoding");
request.setAttribute("encoding", encoding);
request.setAttribute("useOutputStream", "false");
return;
}
}
request.setAttribute("useOutputStream", "true");
}
 
private void putInRequestCommonAttributes(HttpServletRequest request, String actualNameId, Document directoryDocument)
{
/**
* Attributes used in Nodes and Leafs
*/
 
Attribute targetRoleStrAtt = directoryDocument.getRootElement().attribute("targetRole");
Attribute styleStrAtt = directoryDocument.getRootElement().attribute("style");
 
String targetRoleChoosed = (targetRoleStrAtt != null ? targetRoleStrAtt.getValue() : pt.estgp.estgweb.Globals.ALL_ROLE);
String styleChoosed = (styleStrAtt != null ? styleStrAtt.getValue() : "style1.xsl");
 
/**
* Prepare request to forward to Layout Tile
*/
request.setAttribute("stylesheet", "/pt/estgp/estgweb/directories/" + styleChoosed);
request.setAttribute("directoryDocument", directoryDocument);
request.setAttribute("actualNodeId", actualNameId);
request.setAttribute("targetRole", targetRoleChoosed);
}
 
private ActionForward redirect(HttpServletResponse response, String url) throws IOException
{
response.sendRedirect(url);
ActionForward forward = new ActionForward();
forward.setRedirect(true);
forward.setPath(url);
return forward;
}
 
private String buildExternalFile(int stopName, String[] ids)
{
 
if (stopName <= ids.length)
{
StringBuilder externalFileBuilder = new StringBuilder();
for (int i = stopName; i < ids.length; i++)
{
int questionMark = ids[i].indexOf("?");
if (questionMark >= 0)
{
externalFileBuilder.append("/").append(ids[i].substring(0, questionMark));
break;
}
else
externalFileBuilder.append("/").append(ids[i]);
}
return externalFileBuilder.toString();
}
return null;
}
 
Namespace dirNamespace = new Namespace("d", "http://www.estgp.pt/baco/directory/");
QName nodeDir = new QName("node", dirNamespace);
QName leafDir = new QName("leaf", dirNamespace);
 
private boolean pruneDocument(Element startElem, Map namespaces, UserSession userSession)
{
Rights rights = buildRights(startElem, namespaces);
if (rights != null && !checkRights(rights, userSession))
{
Element parentNode = startElem.getParent();
if (parentNode != null)
parentNode.remove(startElem);
return false;
}
List<Element> nodes = startElem.elements(nodeDir);
List<Element> leafs = startElem.elements(leafDir);
for (Element childNode : nodes)
{
pruneDocument(childNode, namespaces, userSession);
}
for (Element childLeaf : leafs)
{
pruneDocument(childLeaf, namespaces, userSession);
}
return true;
}
 
private Rights buildRights(Element nodeOrLeaf, Map namespaces)
{
XPath rightsXpath = nodeOrLeaf.createXPath("./d:rights");
rightsXpath.setNamespaceURIs(namespaces);
Element rightsElem = (Element) rightsXpath.selectSingleNode(nodeOrLeaf);
if (rightsElem == null)
return null;
else
{
Rights rights = new Rights();
 
XPath userXpath = rightsElem.createXPath("./d:user");
userXpath.setNamespaceURIs(namespaces);
List<Element> userElems = userXpath.selectNodes(rightsElem);
 
XPath roleXpath = rightsElem.createXPath("./d:role");
roleXpath.setNamespaceURIs(namespaces);
List<Element> rolesElems = roleXpath.selectNodes(rightsElem);
 
XPath internalXpath = rightsElem.createXPath("./d:internal");
internalXpath.setNamespaceURIs(namespaces);
Element internalElem = (Element) internalXpath.selectSingleNode(rightsElem);
 
 
rights.rightsT = new ArrayList<RightsT>();
 
if (userElems != null && userElems.size() > 0)
{
for (Element userElem : userElems)
{
RightsT rightsT = new RightsT();
rightsT.rightsTClass = RightsT.RightsTClass.user;
rightsT.text = userElem.getText();
String type = userElem.attribute("type").getText();
if (type.equals("permit"))
rightsT.type = RightsT.RightsTType.permit;
else
rightsT.type = RightsT.RightsTType.restrict;
rights.rightsT.add(rightsT);
}
}
 
if (rolesElems != null && rolesElems.size() > 0)
{
for (Element roleElem : rolesElems)
{
RightsT rightsT = new RightsT();
rightsT.rightsTClass = RightsT.RightsTClass.role;
rightsT.text = roleElem.getText();
String type = roleElem.attribute("type").getText();
if (type.equals("permit"))
rightsT.type = RightsT.RightsTType.permit;
else
rightsT.type = RightsT.RightsTType.restrict;
rights.rightsT.add(rightsT);
}
}
 
if (internalElem != null)
{
if (internalElem.getText() != null && internalElem.getText().trim().equals("true"))
rights.internal = true;
}
return rights;
}
}
 
private boolean checkRights(List<Rights> rights, UserSession userSession)
{
if (rights != null && rights.size() > 0)
{
for (Rights r : rights)
{
if (!checkRights(r, userSession))
return false;
}
return true;
}
return true;
}
 
/**
* Check if a user can access through a Rights Element
*
* @param r
* @param userSession
* @return
*/
private boolean checkRights(Rights r, UserSession userSession)
{
if (r.internal && userSession.getUser() == null)
return false;
else
{
if (r.rightsT != null && r.rightsT.size() > 0)
{
boolean ok = true;
boolean permitActivated = false;
for (RightsT rightsT : r.rightsT)
{
if (permitActivated && rightsT.type == RightsT.RightsTType.restrict)
{
//do nothing
}
else
{
if (rightsT.type == RightsT.RightsTType.restrict) //implicitly permitActivated = false
{
if (rightsT.rightsTClass == RightsT.RightsTClass.user && userSession.getUsername() != null && userSession.getUsername().equals(rightsT.text))
return false;
else
if (rightsT.rightsTClass == RightsT.RightsTClass.role && userSession.getUsername() != null && userSession.getUser().hasRole(rightsT.text))
return false;
}
else
{
//One permit mean that just if specific permission was given it will let him pass
permitActivated = true;
ok = false;
if (rightsT.rightsTClass == RightsT.RightsTClass.user && userSession.getUsername() != null && userSession.getUsername().equals(rightsT.text))
{
ok = true;
break;
}
else
if (rightsT.rightsTClass == RightsT.RightsTClass.role && userSession.getUsername() != null && userSession.getUser().hasRole(rightsT.text))
{
ok = true;
break;
}
}
}
}
if (!ok)
return false;
}
}
return true;
}
 
 
protected void processRequestFtp(HttpServletRequest request, String path, String serverStr, String server, String startPath)
throws ServletException, IOException
{
try
{
String user = ConfigProperties.getProperty(serverStr + ".user");
String pass = ConfigProperties.getProperty(serverStr + ".pass");
 
if (path != null)
{
 
DirLayoutController.FtpServer ftpServer = getServer(server, user, pass);
FTPClient client = ftpServer.getClient();
client.changeWorkingDirectory(path);
FTPFile[] files = client.listFiles();
List<IFile> iFiles = new ArrayList<IFile>();
for (FTPFile ftpFile : files)
{
IFile iFile;
if (path.endsWith("/"))
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + ftpFile.getName(), "ISO-8859-1"), path);
else
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + "/" + ftpFile.getName(), "ISO-8859-1"), path);
iFiles.add(iFile);
}
List<NavPlace> navPlaces = FtpFile.getNavPlaces(path, startPath);
request.setAttribute("NavPlaces", navPlaces);
request.setAttribute("files", iFiles);
client.quit();
client.disconnect();
}
else
{
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
}
}
catch (Throwable e)
{
logger.error(e, e);
}
}
 
private static HashMap<String, FtpServer> servers = new HashMap<String, DirLayoutController.FtpServer>();
 
/**
* Add a ftpServer to Cache
*
* @param urlStr to parse
* @param user username
* @param pass password
* @return ftpServer
*/
private static synchronized DirLayoutController.FtpServer addServer(String urlStr, String user, String pass)
{
try
{
URL url = new URL(urlStr);
String host = url.getHost();
int port = url.getPort();
if (port <= 0)
port = 21;
logger.info("Connecting to " + host + "in port:" + port);
DirLayoutController.FtpServer ftpServer = new DirLayoutController.FtpServer(host, port, user, pass);
servers.put(urlStr, ftpServer);
return ftpServer;
}
catch (MalformedURLException e)
{
logger.error(e, e);
}
catch (IOException e)
{
logger.error(e, e);
}
return null;
}
 
private static DirLayoutController.FtpServer getServer(String urlStr, String user, String pass)
{
DirLayoutController.FtpServer ftpServer = servers.get(urlStr);
if (ftpServer == null)
ftpServer = addServer(urlStr, user, pass);
return ftpServer;
}
 
public static class FtpServer
{
String host = null;
int port = 21;
String username = null;
String password = null;
 
 
public FtpServer(String host, int port)
{
this.host = host;
if (port > 0)
this.port = port;
}
 
public FtpServer(String host, int port, String username, String password)
{
this.host = host;
this.port = port;
this.username = username;
this.password = password;
}
 
public FTPClient getClient() throws IOException
{
FTPClient ftp = new FTPClient();
ftp.connect(host, port);
if (username != null)
ftp.user(username);
if (password != null)
ftp.pass(password);
return ftp;
}
 
public String getHost()
{
return host;
}
 
public void setHost(String host)
{
this.host = host;
}
 
public int getPort()
{
return port;
}
 
public void setPort(int port)
{
this.port = port;
}
 
public String getUsername()
{
return username;
}
 
public void setUsername(String username)
{
this.username = username;
}
 
public String getPassword()
{
return password;
}
 
public void setPassword(String password)
{
this.password = password;
}
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/DirProxy.java
New file
0,0 → 1,111
package pt.estgp.estgweb.web;
 
import org.apache.log4j.Logger;
 
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
 
import jomm.web.utils.NavPlace;
 
import java.io.IOException;
import java.io.FileNotFoundException;
 
/**
* @author Jorge Machado
* @date 26/Fev/2008
* @time 12:46:16
* @see pt.estgp.estgweb.web
*/
public class DirProxy extends HttpServlet
{
 
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
 
 
 
private static final Logger logger = Logger.getLogger(DirProxy.class);
 
protected void setQueryString(String queryString, HttpServletRequest request)
{
NavPlace.setAuxiliaryQueryString(queryString,request);
}
 
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
 
String path = request.getPathInfo();
int dirEnd = path.indexOf("/",1);
if(dirEnd < 0)
dirEnd = path.length();
String directory = path.substring(1,dirEnd);
logger.info("diectory:" + directory);
// path = path.substring(dirEnd);
logger.info("path:" + path);
 
/**
* 1 - Obtain Directory XML
* 2 - Build a Xpath query based on path
* 3 - Set Actual Node
* 4 - Check Actual Node Rights
* 5 - If is a leaf check absolute just to confirm the request is valid, if absolute redirect just in case
* 6 - If is a leaf check layout to define the use of a layout and get directory@layout to choose layout to forward in struts
* 7 - If is a leaf check style to define the use of a style and allays put the object in "body" parameter or directly put content in layout
* 8 - If is a leaf check proxy to know if it is an proxied source if it is get content by URL concat or just forward to an internal localhost/context/path
* 8.1 in this case check if is to be layout, usuallly will not be laouted but just in case check it.
*/
 
if(path != null)
{
try
{
getServletContext().getRequestDispatcher("/dirLayout.do?directory=" + directory + "&path=" + path + "&" + request.getQueryString()).forward(request,response);
}
catch(FileNotFoundException e)
{
throw new FileNotFoundException(path);
}
catch(Exception e)
{
throw new IOException(e.toString());
}
}
else
{
throw new FileNotFoundException("url not found for directory:" + directory + " and path:" + path);
}
}
 
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
processRequest(request, response);
}
 
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
 
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Proxy Servlet to get pages form static web page servers";
}
// </editor-fold>
}
/impl/src/java/pt/estgp/estgweb/web/LayoutController.java
65,6 → 65,11
request.setAttribute("path", path);
request.setAttribute("server", server);
 
String proxyHost = ConfigProperties.getProperty(serverParameter + ".proxy.host");
String proxyPort = ConfigProperties.getProperty(serverParameter + ".proxy.port");
request.setAttribute("proxy.host",proxyHost);
request.setAttribute("proxy.port",proxyPort);
 
try
{
// URL url = new URL(server + path);
/impl/src/java/pt/estgp/estgweb/web/form/profile/ProfileForm.java
1,20 → 1,14
package pt.estgp.estgweb.web.form.profile;
 
import pt.estgp.estgweb.domain.User;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.domain.views.UserView;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.upload.FormFile;
import pt.estgp.estgweb.domain.views.RecordView;
import pt.estgp.estgweb.web.form.ApplicationForm;
import pt.estgp.estgweb.domain.views.UserView;
import pt.estgp.estgweb.web.form.AddRolesForm;
import pt.estgp.estgweb.web.utils.DatesUtils;
import pt.estgp.estgweb.web.UserSessionProxy;
 
import java.util.List;
import java.util.ArrayList;
 
import org.apache.struts.action.ActionErrors;
import org.apache.struts.upload.FormFile;
 
/**
* @author Fabio
* @date 30/Abr/2008
31,7 → 25,7
private UserView userView;
 
private String textToSearch;
private static List<UserView> usersFind;
private List<UserView> usersFind;
private long userIDToChange;
private String birthDayDate;
private String typeClass;
116,7 → 110,7
 
public void setUsersFind(List<UserView> usersFind)
{
ProfileForm.usersFind = usersFind;
this.usersFind = usersFind;
}
 
public long getUserIDToChange()
/impl/src/java/pt/estgp/estgweb/web/form/courses/CourseForm.java
4,6 → 4,8
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedCourses;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService;
import pt.estgp.estgweb.Globals;
 
import java.util.List;
 
20,7 → 22,14
private FormFile studiesPlan;
private DirectedCoordinatedCourses directedCoordinatedCourses = new DirectedCoordinatedCourses();
 
private String importYear = DatesUtils.getImportYear();
 
private String area;
 
 
private List<String> areas = Globals.AREAS;
 
 
public CourseForm()
{
courseView = new CourseView();
41,6 → 50,16
this.directedCoordinatedCourses = directedCoordinatedCourses;
}
 
public String getImportYear()
{
return importYear;
}
 
public void setImportYear(String importYear)
{
this.importYear = importYear;
}
 
public void setCourseView(CourseView courseView)
{
this.courseView = courseView;
61,4 → 80,73
{
this.studiesPlan = studiesPlan;
}
 
 
public List<String> getAreas()
{
return areas;
}
 
 
public String getArea()
{
return area;
}
 
public void setArea(String area)
{
this.area = area;
}
 
 
/************************************
*
* For Programas Selection
*
*/
private String semestre;
 
private long courseId = -1;
 
/**
* possibleValues withTeachers, withNoTeachers, all
* @see pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService.TeachersSituationEnum
*/
private String teachersSituation;
 
public String getSemestre()
{
return semestre;
}
 
public void setSemestre(String semestre)
{
this.semestre = semestre;
}
 
public long getCourseId()
{
return courseId;
}
 
public void setCourseId(long courseId)
{
this.courseId = courseId;
}
 
public String getTeachersSituation()
{
return teachersSituation;
}
 
public DirectedCoordinatedUnitsService.TeachersSituationEnum getTeacherSituationEnum()
{
return DirectedCoordinatedUnitsService.TeachersSituationEnum.parse(teachersSituation);
}
 
public void setTeachersSituation(String teachersSituation)
{
this.teachersSituation = teachersSituation;
}
}
/impl/src/java/pt/estgp/estgweb/web/form/blogs/BlogForm.java
72,7 → 72,7
{
if (httpServletRequest.getParameter("dispatch").equals("save"))
{
UserSessionImpl userSession = null;
UserSessionImpl userSession;
try
{
userSession = (UserSessionImpl) UserSessionProxy.loadUserSessionFromRequest(httpServletRequest);
/impl/src/java/pt/estgp/estgweb/web/Globals.java
1,5 → 1,7
package pt.estgp.estgweb.web;
 
import pt.estgp.estgweb.utils.ConfigProperties;
 
import javax.servlet.http.HttpServletRequest;
 
/**
10,6 → 12,9
*/
public class Globals
{
 
public static final String SITE_URL = ConfigProperties.getProperty("site.url");
 
public static final String BACO_SESSION_COOKIE = "BACOSESSIONID";
private static final String PORTAL_MENU_START_LINK_START = "/proxy/";
private static final String PORTAL_MENU_START_LINK_END = "/estgp/public/portal";
/impl/src/java/pt/estgp/estgweb/web/controllers/profile/ProfileController.java
356,13 → 356,13
try
{
ProfileForm fromRequest = (ProfileForm) form;
ProfileForm profileForm = new ProfileForm();
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{fromRequest.getTextToSearch(), fromRequest.getTypeToSearch()};
List<UserView> uVs = (List<UserView>) sm.execute(RequestUtils.getRequester(request, response), "SearchUser", args, names);
profileForm.setUsersFind(uVs);
request.setAttribute("ProfileForm", profileForm);
fromRequest.setUsersFind(uVs);
request.setAttribute("ProfileForm", fromRequest);
if (uVs.size() != 0)
addMessage(request, "profile.search.user.find", "" + uVs.size());
else
433,13 → 433,19
else
args = new Object[]{profileForm.getRecordView(), null, null, null, 0};
 
boolean newRecord = false;
if(profileForm.getRecordView().getId() <= 0)
newRecord = true;
UserView userView;
if (profileForm.getRecordView().getId() > 0)
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "EditUserProfileRecord", args, names);
else
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "CreateUserProfileRecord", args, names);
 
addMessage(request, "profile.record.add.sucess", profileForm.getRecordView().getTitle());
if(newRecord)
addMessage(request, "profile.record.add.sucess", profileForm.getRecordView().getTitle());
else
addMessage(request, "profile.record.updated.sucess", profileForm.getRecordView().getTitle());
profileForm.setUserView(userView);
return mapping.findForward("home");
}
500,7 → 506,7
 
RecordView recordView = (RecordView) sm.execute(RequestUtils.getRequester(request, response), "LoadEditUserProfileRecord", args, names);
UserView uV = recordView.getOwnerUserView();
addMessage(request, "profile.record.deleted.sucess");
// addMessage(request, "profile.record.deleted.sucess");
profileForm.setUserView(uV);
profileForm.setRecordView(recordView);
return mapping.findForward("curriculum");
/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesController.java
1,30 → 1,32
package pt.estgp.estgweb.web.controllers.courses;
 
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.domain.*;
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.web.controllers.courseunits.CourseUnitsController;
import pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsAdminController;
import pt.estgp.estgweb.web.form.courseunits.CourseUnitsForm;
import pt.estgp.estgweb.web.exceptions.NoCookiesException;
import pt.estgp.estgweb.web.form.courses.CourseForm;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.estgp.estgweb.web.exceptions.NoCookiesException;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.filters.exceptions.NotFoundException;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.services.common.ISearchResults;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedCourses;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.utils.AreasBelongUtils;
import pt.utl.ist.berserk.logic.filterManager.exceptions.FilterRetrieveException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.IncompatibleFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.InvalidFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.InvalidFilterExpressionException;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.ServiceManagerException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.*;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
 
/**
* @author Jorge Machado
57,7 → 59,7
{
String code = cF.getCourseView().getCode();
long id = cF.getCourseView().getId();
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args;
152,7 → 154,7
request.setAttribute("CourseView",cV);
if(cV.getHtmlResult() != null)
{
return mapping.findForward("submit");
return mapping.findForward("submit");
}
 
cF.setCourseView(cV);
179,19 → 181,28
 
 
public ActionForward loadCoursesPrograms(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
try
{
CourseForm cF = (CourseForm) form;
String importYear = cF.getImportYear();
long courseId = cF.getCourseId();
String semestre = cF.getSemestre();
String area = cF.getArea();
DirectedCoordinatedUnitsService.TeachersSituationEnum teachersSituationEnum = cF.getTeacherSituationEnum();
 
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new String[]{};
String[] names = new String[]{"importYear","courseId","semestre","area","teachersSituationEnum"};
Object[] args = new Object[]{importYear,courseId,semestre,area,teachersSituationEnum};
DirectedCoordinatedCourses directedCoordinatedCourses = (DirectedCoordinatedCourses) sm.execute(RequestUtils.getRequester(request, response), "LoadCoursesProgramsForServices", args, names);
cF.setDirectedCoordinatedCourses(directedCoordinatedCourses);
cF.setArea(directedCoordinatedCourses.getArea());
cF.setCourseId(directedCoordinatedCourses.getCourseId());
return mapping.findForward("load.courses.programs");
}
catch (FilterChainFailedException e)
210,17 → 221,19
}
 
public ActionForward loadDirectedCoordininatedCourses(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
try
{
 
CourseForm cF = (CourseForm) form;
String importYear = cF.getImportYear();
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new String[]{};
String[] names = new String[]{"importYear"};
Object[] args = new String[]{importYear};
DirectedCoordinatedCourses directedCoordinatedCourses = (DirectedCoordinatedCourses) sm.execute(RequestUtils.getRequester(request, response), "LoadDirectedCoordinatedCoursesForUserInSession", args, names);
cF.setDirectedCoordinatedCourses(directedCoordinatedCourses);
return mapping.findForward("load.directed.coordinated.courses");
241,9 → 254,9
}
 
public ActionForward updateDirectedCoordininatedCourses(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
try
255,7 → 268,7
DirectedCoordinatedCourses directedCoordinatedCourses = (DirectedCoordinatedCourses) sm.execute(RequestUtils.getRequester(request, response), "UpdateDirectedCoordinatedCoursesForUserInSession", args, names);
cF.setDirectedCoordinatedCourses(directedCoordinatedCourses);
addMessage(request,"course.directed.coordinated.courses.updated.success",""+directedCoordinatedCourses.getUpdated());
return mapping.findForward("home");
return mapping.findForward("confirm.courses.programs");
}
catch (FilterChainFailedException e)
{
/impl/src/java/pt/estgp/estgweb/web/controllers/courseunits/CourseUnitsAdminController.java
61,7 → 61,7
}
}
 
public ActionForward createCourseUnitWorksBackup(ActionMapping mapping,
public ActionForward createAllCourseUnitWorksBackup(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
92,6 → 92,37
}
}
 
public ActionForward createImportYearCourseUnitWorksBackup(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
try
{
String importYear = request.getParameter("importYear");
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{importYear};
String tmpFile = (String) sm.execute(RequestUtils.getRequester(request, response), "CreateImportYearCourseUnitWorksBackup", args, names);
request.getRequestDispatcher("/tmpStream/" + tmpFile).forward(request,response);
return null;
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (NotFoundException e)
{
return mapping.findForward("error404");
}
catch (Throwable e)
{
logger.error(e, e);
return mapping.findForward("error500");
}
}
 
 
public ActionForward createOrUpdateAdmin(ActionMapping mapping,
/impl/src/java/pt/estgp/estgweb/web/controllers/courseunits/CourseUnitsController.java
50,6 → 50,7
private static final Logger logger = Logger.getLogger(CourseUnitsController.class);
 
private ActionForward createBackup(String service,
Object[] args,
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
60,7 → 61,6
{
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{};
String tmpFile = (String) sm.execute(RequestUtils.getRequester(request, response), service, args, names);
request.getRequestDispatcher("/tmpStream/" + tmpFile).forward(request,response);
return null;
85,7 → 85,8
HttpServletResponse response)
throws ServletException
{
return createBackup("CreateUserAllCourseUnitWorksBackup",mapping,form,request,response);
String[] args = new String[]{};
return createBackup("CreateUserAllCourseUnitWorksBackup",args,mapping,form,request,response);
}
public ActionForward createUserCourseUnitActualYearWorksBackup(ActionMapping mapping,
94,7 → 95,9
HttpServletResponse response)
throws ServletException
{
return createBackup("CreateUserActualYearCourseUnitWorksBackup",mapping,form,request,response);
String importYear = request.getParameter("importYear");
String[] args = new String[]{importYear};
return createBackup("CreateUserImportYearCourseUnitWorksBackup",args,mapping,form,request,response);
}
 
private ActionForward loadCourseUnitAndForward(CourseUnitsForm cUF, long id, boolean initTeachers, boolean initStudents, ActionMapping mapping, HttpServletRequest request, HttpServletResponse response)
/impl/src/java/pt/estgp/estgweb/web/controllers/blogs/BlogsController.java
174,7 → 174,11
if (!errors.isEmpty())
{
saveErrors(request, errors);
BlogView bV = loadBlogView(blogForm.getBlogView().getId(), mapping, request, response);
BlogView bV;
if(blogForm.getBlogView().getId() > 0)
bV = loadBlogView(blogForm.getBlogView().getId(), mapping, request, response);
else
bV = blogForm.getBlogView();
request.setAttribute("BlogView", bV);
return mapping.findForward("submit");
}
/impl/src/java/pt/estgp/estgweb/web/filters/UrlStatFilter.java
1,6 → 1,7
package pt.estgp.estgweb.web.filters;
 
import org.apache.log4j.Logger;
import org.apache.commons.httpclient.util.URIUtil;
 
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
140,6 → 141,9
}
}
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/java/pt/estgp/estgweb/web/RepositoryStream.java
12,6 → 12,7
 
import jomm.dao.impl.AbstractDao;
import jomm.utils.StreamsUtils;
import jomm.utils.StringsUtils;
import pt.estgp.estgweb.domain.Image;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.dao.impl.ImageDaoImpl;
69,7 → 70,7
}
response.setContentLength(iRepositoryFile.getSize());
response.setContentType(iRepositoryFile.getContentType());
response.setHeader("Content-disposition","filename=" + iRepositoryFile.getName());
response.setHeader("Content-disposition","inline; filename=" + iRepositoryFile.getName());
StreamsUtils.inputStream2OutputStream(iRepositoryFile.getInput(),response.getOutputStream());
}
catch(FilterChainFailedException fail)
/impl/src/doc/deploy.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/doc/estgweb.eap
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/impl/src/doc/Concurso.ppt
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/update2.sql
New file
0,0 → 1,23
 
DROP TABLE IF EXISTS `courseunitsummary`;
CREATE TABLE `courseunitsummary` (
`id` bigint(20) NOT NULL auto_increment,
`discrimitator` varchar(255) NOT NULL,
`updateDate` datetime NOT NULL,
`saveDate` datetime default NULL,
`dataAula` datetime default NULL,
`tipoAula` varchar(255) default NULL,
`codigoAula` varchar(255) default NULL,
`codigoSumario` varchar(255) default NULL,
`codigoSalaAula` varchar(255) default NULL,
`alunosPresentes` int(11) default NULL,
`numeroAula` int(11) default NULL,
`titulo` varchar(255) default NULL,
`descricao` text,
`cEstado` varchar(255) default NULL,
`courseUnit` bigint(20) default NULL,
PRIMARY KEY (`id`),
KEY `tituloIndex` (`titulo`),
KEY `FK4B6262A7DF034EA4` (`courseUnit`),
CONSTRAINT `FK4B6262A7DF034EA4` FOREIGN KEY (`courseUnit`) REFERENCES `courseunit` (`id`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
/impl/src/hbm/pt/estgp/estgweb/domain/GenericUser.hbm.xml
72,46 → 72,51
</set>
<subclass name="pt.estgp.estgweb.domain.UserImpl" discriminator-value="UserImpl">
<subclass name="pt.estgp.estgweb.domain.UserManagedRoleImpl">
<subclass name="pt.estgp.estgweb.domain.Student">
<subclass name="pt.estgp.estgweb.domain.SigesUser">
<meta attribute="extends">pt.estgp.estgweb.domain.UserManagedRoleImpl</meta>
<meta attribute="scope-class">public abstract</meta>
<property name="sigesCode" type="int"/>
<property name="areasBelong" type="string" index="areasBelongIndex"/>
<property name="userNameNetpa" type="string"/>
<property name="localRemovedSubscribedUnits" type="string"/>
<set name="subscribedUnits" lazy="true" order-by="courseUnitId" table="subscribedunits">
<key column="studentId"/>
<many-to-many class="pt.estgp.estgweb.domain.CourseUnit" column="courseUnitId"/>
</set>
<set name="courseUnitGrades" order-by="courseUnit asc" lazy="true">
<key column="student"/>
<one-to-many class="pt.estgp.estgweb.domain.CourseUnitGrade"/>
</set>
<subclass name="pt.estgp.estgweb.domain.StudentImpl" discriminator-value="StudentImpl"/>
<subclass name="pt.estgp.estgweb.domain.SigesUserImpl">
<subclass name="pt.estgp.estgweb.domain.Student">
<meta attribute="extends">pt.estgp.estgweb.domain.SigesUserImpl</meta>
<meta attribute="scope-class">public abstract</meta>
<property name="localRemovedSubscribedUnits" type="string"/>
<set name="subscribedUnits" lazy="true" order-by="courseUnitId" table="subscribedunits">
<key column="studentId"/>
<many-to-many class="pt.estgp.estgweb.domain.CourseUnit" column="courseUnitId"/>
</set>
<set name="courseUnitGrades" order-by="courseUnit asc" lazy="true">
<key column="student"/>
<one-to-many class="pt.estgp.estgweb.domain.CourseUnitGrade"/>
</set>
<subclass name="pt.estgp.estgweb.domain.StudentImpl" discriminator-value="StudentImpl"/>
</subclass>
<subclass name="pt.estgp.estgweb.domain.Teacher">
<meta attribute="extends">pt.estgp.estgweb.domain.SigesUserImpl</meta>
<meta attribute="scope-class">public abstract</meta>
<property name="academicName" type="string"/>
<property name="employerName" type="string"/>
<property name="unitCheck" type="boolean"/>
<property name="academicDegree" type="string"/>
<property name="localRemovedTeachedUnits" type="string"/>
<set name="teachedUnits" lazy="true" order-by="courseUnitId" table="teachedunits">
<key column="teacherId"/>
<many-to-many class="pt.estgp.estgweb.domain.CourseUnit" column="courseUnitId"/>
</set>
<set name="coordinatorCourses" order-by="name asc" lazy="true">
<key column="coordinator"/>
<one-to-many class="pt.estgp.estgweb.domain.Course"/>
</set>
<set name="directorCourses" order-by="name asc" lazy="true">
<key column="director"/>
<one-to-many class="pt.estgp.estgweb.domain.Course"/>
</set>
<subclass name="pt.estgp.estgweb.domain.TeacherImpl" discriminator-value="TeacherImpl"/>
</subclass>
</subclass>
</subclass>
<subclass name="pt.estgp.estgweb.domain.Teacher">
<meta attribute="extends">pt.estgp.estgweb.domain.UserManagedRoleImpl</meta>
<meta attribute="scope-class">public abstract</meta>
<property name="sigesCode" type="int"/>
<property name="userNameNetpa" type="string"/>
<property name="academicName" type="string"/>
<property name="employerName" type="string"/>
<property name="unitCheck" type="boolean"/>
<property name="academicDegree" type="string"/>
<property name="localRemovedTeachedUnits" type="string"/>
<set name="teachedUnits" lazy="true" order-by="courseUnitId" table="teachedunits">
<key column="teacherId"/>
<many-to-many class="pt.estgp.estgweb.domain.CourseUnit" column="courseUnitId"/>
</set>
<set name="coordinatorCourses" order-by="name asc" lazy="true">
<key column="coordinator"/>
<one-to-many class="pt.estgp.estgweb.domain.Course"/>
</set>
<set name="directorCourses" order-by="name asc" lazy="true">
<key column="director"/>
<one-to-many class="pt.estgp.estgweb.domain.Course"/>
</set>
<subclass name="pt.estgp.estgweb.domain.TeacherImpl" discriminator-value="TeacherImpl"/>
</subclass>
</subclass>
</subclass>
</subclass>
/impl/src/hbm/pt/estgp/estgweb/domain/Course.hbm.xml
25,6 → 25,7
<column name="cacheWebDocument" sql-type="TEXT"/>
</property>
<property name="studiesPlan" type="string" index="studiesPlanIndex"/>
<property name="area" type="string" index="areaIndex"/>
<many-to-one name="director" class="pt.estgp.estgweb.domain.Teacher" outer-join="false" lazy="proxy"/>
<many-to-one name="coordinator" class="pt.estgp.estgweb.domain.Teacher" outer-join="false" lazy="proxy"/>
<set name="users" order-by="user.name asc" lazy="true">
/impl/src/hbm/pt/estgp/estgweb/domain/CourseUnit.hbm.xml
53,6 → 53,10
<key column="courseUnit"/>
<one-to-many class="pt.estgp.estgweb.domain.CourseUnitAssignement"/>
</set>
<set name="summaries" cascade="delete" lazy="true" order-by="dataAula desc">
<key column="courseUnit"/>
<one-to-many class="pt.estgp.estgweb.domain.CourseUnitSummary"/>
</set>
<subclass name="pt.estgp.estgweb.domain.CourseUnitImpl" discriminator-value="CourseUnitImpl"/>
</class>
 
134,6 → 138,29
<subclass name="pt.estgp.estgweb.domain.CourseUnitGradeImpl" discriminator-value="CourseUnitGradeImpl"/>
</class>
 
<class name="pt.estgp.estgweb.domain.CourseUnitSummary" table="courseunitsummary" abstract="true">
<meta attribute="extends">pt.estgp.estgweb.domain.DomainSerializableObject</meta>
<meta attribute="scope-class">public abstract</meta>
<id name="id" type="long">
<generator class="native"/>
</id>
<discriminator column="discrimitator"/>
<timestamp name="updateDate" unsaved-value="null"/>
<property name="saveDate" type="timestamp"/>
<property name="dataAula" type="timestamp"/>
<property name="tipoAula" type="string"/>
<property name="codigoAula" type="string"/>
<property name="codigoSumario" type="string"/>
<property name="codigoSalaAula" type="string"/>
<property name="alunosPresentes" type="int"/>
<property name="numeroAula" type="int"/>
<property name="titulo" type="string" index="tituloIndex"/>
<property name="descricao" type="text"/>
<property name="cEstado" type="string"/>
<many-to-one name="courseUnit" class="pt.estgp.estgweb.domain.CourseUnit" lazy="false" outer-join="true"/>
<subclass name="pt.estgp.estgweb.domain.CourseUnitSummaryImpl" discriminator-value="CourseUnitSummaryImpl"/>
</class>
 
<!--<class name="pt.estgp.estgweb.domain.CourseUnit" table="courseunitassignement" abstract="true">-->
<!--<meta attribute="extends">pt.estgp.estgweb.domain.DomainSerializableObject</meta>-->
<!--<meta attribute="scope-class">public abstract</meta>-->
/impl/src/web/admin/profile/profileCurriculum.jsp
33,15 → 33,20
<bean:message key="profile.record.type"/>
</th>
<td>
<html:select property="recordView.type">
<html:option value="RecordThesisImpl" key="profile.RecordThesisImpl"/>
<html:option value="RecordPaperImpl" key="profile.RecordPaperImpl"/>
<%--todo Falta Artigo de Opinião e falta meter artigo cientifico, revista, conferencia, workshop--%>
<html:option value="RecordJobImpl" key="profile.RecordJobImpl"/>
<html:option value="RecordEventOrganizationImpl" key="profile.RecordEventOrganizationImpl"/>
<html:option value="RecordProjectImpl" key="profile.RecordProjectImpl"/>
<html:option value="RecordOtherImpl" key="profile.RecordOtherImpl"/>
</html:select>
<logic:greaterThan value="0" name="ProfileForm" property="recordView.id">
<bean:message key="profile.${ProfileForm.recordView.type}"/>
</logic:greaterThan>
<logic:lessEqual value="0" name="ProfileForm" property="recordView.id">
<html:select property="recordView.type">
<html:option value="RecordThesisImpl" key="profile.RecordThesisImpl"/>
<html:option value="RecordPaperImpl" key="profile.RecordPaperImpl"/>
<%--todo Falta Artigo de Opinião e falta meter artigo cientifico, revista, conferencia, workshop--%>
<html:option value="RecordJobImpl" key="profile.RecordJobImpl"/>
<html:option value="RecordEventOrganizationImpl" key="profile.RecordEventOrganizationImpl"/>
<html:option value="RecordProjectImpl" key="profile.RecordProjectImpl"/>
<html:option value="RecordOtherImpl" key="profile.RecordOtherImpl"/>
</html:select>
</logic:lessEqual>
</td>
</tr>
<tr>
98,7 → 103,12
</tr>
<tr>
<th>
<bean:message key="profile.record.publisher"/>
<logic:equal value="RecordPaperImpl" name="ProfileForm" property="recordView.type">
<bean:message key="profile.record.publisher.paper"/>
</logic:equal>
<logic:notEqual value="RecordPaperImpl" name="ProfileForm" property="recordView.type">
<bean:message key="profile.record.publisher.all"/>
</logic:notEqual>
</th>
<td>
<html:text styleClass="text" property="recordView.publisher"/>
/impl/src/web/admin/profile/profilePersonalData.jsp
287,27 → 287,27
</td>
</tr>
 
<baco:isNotAdmin>
<%--<baco:isNotAdmin>--%>
<!--<tr>-->
<!--<th>-->
<%--<bean:message key="email.institucion"/>--%>
<!--*-->
<!--</th>-->
<!--<td>-->
<%--<html:text property="userView.email" maxlength="250" readonly="true" styleClass="readOnly text"/>--%>
<!--</td>-->
<!--</tr>-->
<%--</baco:isNotAdmin>--%>
<%--<baco:isAdmin>--%>
<tr>
<th>
<bean:message key="email.institucion"/>
*
</th>
<td>
<html:text property="userView.email" maxlength="250" readonly="true" styleClass="readOnly text"/>
</td>
</tr>
</baco:isNotAdmin>
<baco:isAdmin>
<tr>
<th>
<bean:message key="email.institucion2"/>
</th>
<td>
<html:text styleClass="text" property="userView.email" maxlength="250"/>
</td>
</tr>
</baco:isAdmin>
<%--</baco:isAdmin>--%>
<tr>
<th>
<bean:message key="email.secundary"/>
/impl/src/web/admin/courses/course.jsp
27,6 → 27,19
</tr>
<tr>
<th>
<bean:message key="course.area"/>
</th>
 
<td>
<html:select property="courseView.area">
<logic:iterate id="area" name="CourseForm" property="areas">
<html:option value="${area}" key="area.${area}"/>
</logic:iterate>
</html:select>
</td>
</tr>
<tr>
<th>
<bean:message key="name"/>
</th>
<td>
/impl/src/web/css/style.css
1,4 → 1,4
/*********** Site Struture *************/
/*********** Site Struture *************/
BODY *, .contentPortal, .contentPortal p, .contentPortal li, div {
FONT-FAMILY: "bitstream vera sans", Verdana, Arial, Helvetica, sans-serif;
FONT-SIZE: 11px;
241,7 → 241,16
border: #8EC73F solid 1px;
padding:10px;
}
.contentPane
{
border: #8EC73F solid 1px;
}
ul li.contentPane
{
list-style-type:none;
}
 
 
.contentPortal {
border: #8EC73F solid 1px;
padding:5px;
566,7 → 575,7
 
.portalAnnouncementTitle
{
white-space:nowrap;
/*white-space:nowrap;*/
}
.portalAnnouncementTitle a {
color: #000000;
580,6 → 589,11
color: #4d4d4d;
}
 
.portalAnnouncementText, .portalAnnouncementTitle {
/*table-layout: fixed;*/
width: 180px;
}
 
/* todo FABIO
todo Left Manus???? ao pe de portalMenus isto esta uma confusao*/
.navleftMenu {
/impl/src/web/layout/layout0.jsp
New file
0,0 → 1,40
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<html:html locale="true">
<head>
<title><bean:message key="site.title"/> - <tiles:getAsString name="title"/></title>
<jsp:include page="/layout/scripts.jsp"/>
</head>
<body class="small" marginwidth="0" marginheight="0" bgcolor="#ffffff" topmargin="0" leftmargin="0" onload="horizontal();">
<table width="100%">
<tr>
<td align="center">
<div id="body">
<div id="header">
<tiles:insert attribute="header"/>
</div>
<table id="pageStructure">
<tr>
<td><tiles:insert attribute="navigationTop"/></td>
</tr>
<tr>
<td>
<tiles:insert attribute="body" />
</td>
</tr>
</table>
<div id="footer">
<tiles:insert attribute="footer"/>
</div>
</div>
</td>
</tr>
</table>
</body>
</html:html>
 
/impl/src/web/layout/navigationLeftMenu.jsp
1,4 → 1,6
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="pt.estgp.estgweb.domain.DirectoryImpl" %>
<%@ 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-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
23,4 → 25,28
</li>
</ul>
</div>
</div>
</div>
 
 
<br/>
<br/>
<p>Directorios</p>
 
<div class="linkLeftMenu">
<div class="listClean">
<ul>
<%
for (DirectoryImpl directory: Globals.DIRECTORIES)
{
request.setAttribute("dir",directory);
%>
<li>
<a href="<%=request.getContextPath()%>/dir/${dir.id}?role=${dir.role}&menu=${dir.key}"><bean:message key="${dir.key}"/></a>
</li>
<%
}
%>
</ul>
</div>
</div>
 
/impl/src/web/public/profile/recordViews.jsp
52,7 → 52,14
</logic:present>
<logic:present name="recordView" property="publisher">
<tr>
<th><bean:message key="profile.record.publisher"/></th>
<th>
<logic:equal value="RecordPaperImpl" name="recordView" property="type">
<bean:message key="profile.record.publisher.paper"/>
</logic:equal>
<logic:notEqual value="RecordPaperImpl" name="ProfileForm" property="recordView.type">
<bean:message key="profile.record.publisher"/>
</logic:notEqual>
</th>
<td>${recordView.publisher}</td>
</tr>
</logic:present>
/impl/src/web/public/index.jsp
76,7 → 76,7
</p>
</logic:empty>
<logic:notEmpty name="item" property="url">
<logic:equal value="false" name="item" property="haveAllText">
<logic:equal value="false" name="item" property="textBiggerThenPermited">
<h2>
<html:link href="${item.url}">${item.title}</html:link>
</h2>
84,7 → 84,7
<html:link href="${item.url}">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
<logic:equal value="true" name="item" property="haveAllText">
<logic:equal value="true" name="item" property="textBiggerThenPermited">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
136,7 → 136,7
</p>
</logic:empty>
<logic:notEmpty name="item" property="url">
<logic:equal value="false" name="item" property="haveAllText">
<logic:equal value="false" name="item" property="textBiggerThenPermited">
<h2>
<html:link href="${item.url}">${item.title}</html:link>
</h2>
144,7 → 144,7
<html:link href="${item.url}">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
<logic:equal value="true" name="item" property="haveAllText">
<logic:equal value="true" name="item" property="textBiggerThenPermited">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
/impl/src/web/public/search/searchResults.jsp
1,5 → 1,6
<%@ page import="pt.estgp.estgweb.services.common.*" %>
<%@ page import="pt.estgp.estgweb.web.Globals" %>
<%@ page import="jomm.utils.ConfigProperties" %>
<%@ 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-nested.tld" prefix="nested" %>
51,7 → 52,7
{
// Initialize the web searcher
gWebSearch = new GwebSearch();
gWebSearch.setSiteRestriction("www.estgp.pt");
gWebSearch.setSiteRestriction("<%=Globals.SITE_URL%>");
gWebSearch.setResultSetSize(GSearch.LARGE_RESULTSET);
gWebSearch.setSearchCompleteCallback(null, OnWebSearch);
gWebSearch.execute(query);
/impl/src/web/public/blogs/blog.jsp
75,8 → 75,17
<baco:canAddContent name="BlogView">
<a href="<%=request.getContextPath()%>${user}/startAddPost${fromAction}.do?id=<%=BlogView.getId()%>"><bean:message key="blog.add.post"/></a>
</baco:canAddContent>
<%--<baco:canNotAddContent name="BlogView">--%>
<%--<baco:isAuthenticated>--%>
<%--<bean:message key="blog.add.post.cant.add"/>--%>
<%--</baco:isAuthenticated>--%>
<%--<baco:isNotAuthenticated>--%>
<%--<bean:message key="blog.add.post.cant.add.login"/>--%>
<%--</baco:isNotAuthenticated>--%>
<%--</baco:canNotAddContent>--%>
</div>
</div>
 
<baco:canAddContent name="BlogView">
<logic:present name="BlogPostView">
<html:form action="${user}/blogsController${fromAction}${from}" enctype="multipart/form-data">
/impl/src/web/public/announcements/announcementsPortalLeft.jsp
80,7 → 80,7
</logic:empty>
<logic:notEmpty name="item" property="url">
<%
if (!item.getHaveAllText())
if (!item.getTextBiggerThenPermited())
{
%>
<div class="portalAnnouncementTitle">
/impl/src/web/public/announcements/getFlashNews.jsp
31,7 → 31,7
<h2><a href="<%=request.getContextPath()%>/loadAnnouncement.do?id=<%=announcementView.getId()%>&dispatch=load"><%=announcementView.getTitle()%></a></h2>
<p><a href="<%=request.getContextPath()%>/loadAnnouncement.do?id=<%=announcementView.getId()%>&dispatch=load"><%=announcementView.getTextSummary()%></a></p>
<%}
else if(!announcementView.getHaveAllText())
else if (!announcementView.getTextBiggerThenPermited())
{%>
<h2><a href="<%=announcementView.getUrl()%>"><%=announcementView.getTitle()%></a></h2>
<p><a href="<%=announcementView.getUrl()%>"><%=announcementView.getText()%></a></p>
/impl/src/web/public/announcements/announcements.jsp
29,7 → 29,7
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</logic:empty>
<logic:notEmpty name="item" property="url">
<%if(!item.getHaveAllText())
<%if (!item.getTextBiggerThenPermited())
{%>
<html:link href="${item.url}">${item.title}</html:link>
<%}
/impl/src/web/public/announcements/announcementsPortalRight.jsp
77,7 → 77,7
</logic:empty>
<logic:notEmpty name="item" property="url">
<%
if (!item.getHaveAllText())
if (!item.getTextBiggerThenPermited())
{
%>
<div class="portalAnnouncementTitle">
/impl/src/web/templates/xml/oai_dc.xml
New file
0,0 → 1,39
<?xml version="1.0" encoding="UTF-8"?>
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Digital Library of Thesis and Dissertations</dc:title>
<dc:title>Dissertações e Teses Digitais-DiTeD</dc:title>
<dc:creator>Machado, Jorge Miguel Calha R., 1980-</dc:creator>
<dc:creator>Cebolas, Sergio Miguel Chicarro</dc:creator>
<dc:description>Pretende-se com este projecto o desenvolvimento de
um sistema de depósito pela Internet de obras científicas em
formato digital, nomeadamente de teses e dissertações. É esta a
motivação para a designação DiTeD - Depósito Digital de Teses e
Dissertações. Pretende-se que o desenvolvimento inclua não só o
sistema de depósito e consulta (FrontOffice) como também um
sistema de gestão que permita a administradores controlar todas
as entidades existentes e suas relações (BackOffice). Como tal,
foi considerada alguma segurança em toda a gestão e/ou acesso à
informação existente. Para o desenho do sistema deverão ser
ainda levados em linha de conta os requisitos de o mesmo dever
poder vir a ser utilizado modularmente com outros sistemas já
existentes ou a desenvolver pela Biblioteca Nacional, pelo que
usou-se uma tecnologia que visasse uma separação MVC
(Model/View/Controller), a fim de se separar o modelo
relacional, os processos de negócio e as interfaces de
utilização. A tecnologia escolhida para esta separação foi o
Struts (http://jakarta.apache.org/struts) , sendo esta também
uma tecnologia aberta. </dc:description>
<dc:publisher>Instituições portuguesas -- UTL-Universidade Técnica
de Lisboa -- IST-Instituto Superior Técnico -- -Departamento de
Engenharia Informática</dc:publisher>
<dc:contributor>Borbinha, José Luís, 1963-</dc:contributor>
<dc:contributor>Oliveira, Arlindo Manuel Limede de</dc:contributor>
<dc:contributor>Silva, Alberto da</dc:contributor>
<dc:date>2003</dc:date>
<dc:type>gradthesis</dc:type>
<dc:identifier>http://dited.bn.pt:80/1</dc:identifier>
<dc:source>Lisboa</dc:source>
<dc:language>por</dc:language>
</oai_dc:dc>
/impl/src/web/user/courses/directedCoordinatedCourses.jsp
1,3 → 1,10
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.estgp.estgweb.domain.views.CourseView" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="pt.estgp.estgweb.utils.AreasBelongUtils" %>
<%@ page import="pt.estgp.estgweb.domain.*" %>
<%@ 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,145 → 18,312
<jomm:messages/>
<html:errors/>
<%
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{};
List<String> importYears = (List<String>) sm.execute(RequestUtils.getRequester(request, response), "LoadCoursesImportYears", args, names);
request.setAttribute("importYears", importYears);
args = new Object[]{CourseForm.getImportYear(), CourseForm.getArea()};
List<CourseView> courses = (List<CourseView>) sm.execute(RequestUtils.getRequester(request, response), "LoadCoursesImportYearArea", args, names);
request.setAttribute("courses", courses);
 
request.setAttribute("fromDispatch", request.getParameter("fromDispatch"));
 
String fromAction = "";
String from = "";
String from = "?fromDispatch=" + request.getParameter("fromDispatch");
String user = "";
if (request.getParameter("from") != null)
{
user = "/user";
fromAction = "From" + request.getParameter("from");
from = "?from=" + request.getParameter("from");
from = "?from=" + request.getParameter("from") + "&fromDispatch=" + request.getParameter("fromDispatch");
}
request.setAttribute("from", from);
request.setAttribute("user", user);
request.setAttribute("fromAction", fromAction);
 
 
boolean canChange = false;
%>
 
<html:form action="${user}/courseController${fromAction}${from}" enctype="multipart/form-data">
<input type="hidden" name="dispatch" value="updateDirectedCoordininatedCourses">
<input type="hidden" name="fromDispatch" value="${fromDispatch}"/>
<div class="seccao">
<h2><bean:message key="course.directed.coordinated"/></h2>
<div class="seccao">
<ul>
<nested:iterate id="courseView" property="directedCoordinatedCourses.merge" type="pt.estgp.estgweb.domain.views.CourseView">
<li>
<a name="${courseView.id}"></a>
<nested:hidden property="id"/>
<h3>(${courseView.code}) ${courseView.name}</h3>
<ul>
<li><h3><bean:message key="courseunit.semestre"/> 1</h3>
<ul>
<logic:notEmpty name="courseView" property="courseUnitsWithNoProgramS1">
<li><h3 class="statusERROR"><bean:message key="course.units.no.program"/></h3>
<ul>
<nested:iterate id="courseUnitView" property="courseUnitsWithNoProgramS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<li>
(${courseUnitView.code}) ${courseUnitView.name} - ${courseUnitView.teachersSnipet}
</li>
</nested:iterate>
</ul>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramNotCheckedS1">
<%--<html:hidden property="courseUnitsWithProgramNotCheckedS1size"/>--%>
<li><h3 class="statusWARNING"><bean:message key="course.units.with.program.not.checked"/></h3>
<ul>
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramNotCheckedS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<li>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/>
</logic:equal>
(${courseUnitView.code}) <a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a> - ${courseUnitView.teachersSnipet}
</li>
</nested:iterate>
</ul>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramCheckedS1">
<%--<html:hidden property="courseUnitsWithProgramCheckedS1size"/>--%>
<li><h3 class="statusOK"><bean:message key="course.units.with.program.checked"/></h3>
<ul>
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramCheckedS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<li>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/>
</logic:equal>
(${courseUnitView.code}) <a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a> - ${courseUnitView.teachersSnipet}
</li>
</nested:iterate>
</ul>
</li>
</logic:notEmpty>
</ul>
</li>
 
<h1><bean:message key="courseunit.programs"/></h1>
 
<li><h3><bean:message key="courseunit.semestre"/> 2</h3>
 
 
<div class="form blockForm">
<table>
<tr>
<th><bean:message key="course.program.courses.choose.year"/></th>
<td>
<html:select property="importYear" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<logic:iterate id="importYear" name="importYears">
<html:option value="${importYear}"/>
</logic:iterate>
</html:select>
</td>
</tr>
<tr>
<th><bean:message key="courseunit.semestre"/></th>
<td>
<html:select property="semestre" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<option value=""><bean:message key="courseunit.ALL"/></option>
<html:option value="S1" key="courseunit.S1"/>
<html:option value="S2" key="courseunit.S2"/>
</html:select>
</td>
</tr>
<baco:hasRole role="admin,all,services,teacher,servicesPrograms,administrativeCouncil,courseCoordinator,courseDirector,scientificCouncil,pedagogicCouncil">
<tr>
<th><bean:message key="area"/></th>
<td>
<html:select property="area" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<option value=""><bean:message key="areas.all"/></option>
<logic:iterate id="area" name="CourseForm" property="areas">
<html:option value="${area}" key="area.${area}"/>
</logic:iterate>
</html:select>
</td>
</tr>
<tr>
<th><bean:message key="courseunit.course"/></th>
<td>
<html:select property="courseId" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<html:option value="" key="courses.all"/>
<logic:iterate id="courseView" name="courses" type="pt.estgp.estgweb.domain.views.CourseView">
<html:option value="${courseView.id}">(${courseView.code}) ${courseView.name}</html:option>
</logic:iterate>
</html:select>
</td>
</tr>
<tr>
<th><bean:message key="courseunit.teacher.situation"/></th>
<td>
<html:select property="teachersSituation" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<html:option value="all" key="courseunit.teacher.situation.all"/>
<html:option value="withTeachers" key="courseunit.teacher.situation.withTeachers"/>
<html:option value="withNoTeachers" key="courseunit.teacher.situation.withNoTeachers"/>
</html:select>
</td>
</tr>
</baco:hasRole>
</table>
</div>
 
 
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td id="leftPage" valign="top">
<%
if(CourseForm.getDirectedCoordinatedCourses().getMerge().size()>1)
{
%>
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><bean:message key="courses"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul>
<logic:notEmpty name="courseView" property="courseUnitsWithNoProgramS2">
<li><h3 class="statusERROR"><bean:message key="course.units.no.program"/></h3>
<ul>
<nested:iterate id="courseUnitView" property="courseUnitsWithNoProgramS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<li>
(${courseUnitView.code}) ${courseUnitView.name} - ${courseUnitView.teachersSnipet}
</li>
</nested:iterate>
</ul>
<nested:iterate id="courseView" property="directedCoordinatedCourses.merge" type="pt.estgp.estgweb.domain.views.CourseView">
<li>
<a href="#${courseView.id}">(${courseView.code}) ${courseView.name}</a>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramNotCheckedS2">
<%--<html:hidden property="courseUnitsWithProgramNotCheckedS2size"/>--%>
<li><h3 class="statusWARNING"><bean:message key="course.units.with.program.not.checked"/></h3>
<ul>
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramNotCheckedS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<li>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/>
</logic:equal>
(${courseUnitView.code}) ${courseUnitView.name} - ${courseUnitView.teachersSnipet}
</li>
</nested:iterate>
</ul>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramCheckedS2">
<%--<html:hidden property="courseUnitsWithProgramCheckedS2size"/>--%>
<li><h3 class="statusOK"><bean:message key="course.units.with.program.checked"/></h3>
<ul>
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramCheckedS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<li>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/>
</logic:equal>
(${courseUnitView.code}) ${courseUnitView.name} - ${courseUnitView.teachersSnipet}
</li>
</nested:iterate>
</ul>
</li>
</logic:notEmpty>
</nested:iterate>
</ul>
</li>
</div>
</div>
</div>
<%
}
%>
</td>
<td id="rightPage" valign="top">
<div class="contentPane">
<div >
<ul>
<nested:iterate id="courseView" property="directedCoordinatedCourses.merge" type="pt.estgp.estgweb.domain.views.CourseView">
<li class="contentPane">
<a name="${courseView.id}"></a>
<nested:hidden property="id"/>
<h1>(${courseView.code}) ${courseView.name}</h1>
<ul>
<logic:notEqual value="S2" name="CourseForm" property="semestre">
<li><h3><bean:message key="courseunit.semestre"/> 1</h3>
<ul>
<logic:notEmpty name="courseView" property="courseUnitsWithNoProgramS1">
<li><h3 class="statusERROR"><bean:message key="course.units.no.program"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithNoProgramS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<td>${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramNotCheckedS1">
<%--<html:hidden property="courseUnitsWithProgramNotCheckedS1size"/>--%>
<li><h3 class="statusWARNING"><bean:message key="course.units.with.program.not.checked"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramNotCheckedS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
 
</ul>
</li>
</nested:iterate>
</ul>
</div>
</div>
<table>
<tr class="buttons">
<td colspan="2">
<input type="submit" value="<bean:message key="confirm"/>"/>
</td>
</tr>
</table>
<logic:notEqual value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td></td>
</logic:notEqual>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<%
canChange=true;
%>
<td><nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td>
<baco:hasRole role="teacher">
<a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a>
</baco:hasRole>
 
<baco:hasNotRole role="teacher">
<logic:equal value="true" name="courseUnitView" property="validProgram">
<a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a>
</logic:equal>
<logic:equal value="false" name="courseUnitView" property="validProgram">
${courseUnitView.name}
</logic:equal>
</baco:hasNotRole>
</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramCheckedS1">
<%--<html:hidden property="courseUnitsWithProgramCheckedS1size"/>--%>
<li><h3 class="statusOK"><bean:message key="course.units.with.program.checked"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramCheckedS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<logic:notEqual value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td></td>
</logic:notEqual>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<%
canChange=true;
%>
<td><nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td><a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a></td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
</ul>
</li>
</logic:notEqual>
 
<logic:notEqual value="S1" name="CourseForm" property="semestre">
<li><h3><bean:message key="courseunit.semestre"/> 2</h3>
<ul>
<logic:notEmpty name="courseView" property="courseUnitsWithNoProgramS2">
 
<li><h3 class="statusERROR"><bean:message key="course.units.no.program"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithNoProgramS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<td>${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramNotCheckedS2">
<%--<html:hidden property="courseUnitsWithProgramNotCheckedS2size"/>--%>
<li><h3 class="statusWARNING"><bean:message key="course.units.with.program.not.checked"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramNotCheckedS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<logic:notEqual value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td></td>
</logic:notEqual>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td><nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramCheckedS2">
<%--<html:hidden property="courseUnitsWithProgramCheckedS2size"/>--%>
<li><h3 class="statusOK"><bean:message key="course.units.with.program.checked"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramCheckedS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<logic:notEqual value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td></td>
</logic:notEqual>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td><nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
</ul>
</li>
</logic:notEqual>
</ul>
</li>
</nested:iterate>
</ul>
</div>
<%
if(canChange)
{
%>
<table>
<tr class="buttons">
<td colspan="2">
<input type="submit" value="<bean:message key="confirm"/>">
</td>
</tr>
</table>
<%
}
%>
 
</div>
</td>
</tr>
 
</table>
 
 
</html:form>
/impl/src/web/user/courseunits/courseunit.jsp
51,14 → 51,29
</p>
<p>
<baco:canManage name="CourseUnitView">
<html:file property="programFile"/>
<logic:equal value="false" name="CourseUnitView" property="validProgram">
<html:file property="programFile"/>
</logic:equal>
<logic:present name="CourseUnitView" property="programStreamId">
<a href="<%=request.getContextPath()%>/repositoryStream/${CourseUnitView.programStreamId}"><bean:message key="courseunit.programfilepath"/></a> (${CourseUnitView.programSize} Kb)
<logic:equal value="true" name="CourseUnitView" property="validProgram">
(<bean:message key="courseunit.programfile.valid"/>)
</logic:equal>
</logic:present>
</baco:canManage>
<logic:present name="CourseUnitView" property="programStreamId">
<a href="<%=request.getContextPath()%>/repositoryStream/${CourseUnitView.programStreamId}"><bean:message key="courseunit.programfilepath"/></a> (${CourseUnitView.programSize} Kb)
</logic:present>
 
<baco:cantManage name="CourseUnitView">
<logic:present name="CourseUnitView" property="programStreamId">
<logic:equal value="true" name="CourseUnitView" property="validProgram">
<a href="<%=request.getContextPath()%>/repositoryStream/${CourseUnitView.programStreamId}"><bean:message key="courseunit.programfilepath"/></a> (${CourseUnitView.programSize} Kb) (<bean:message key="courseunit.programfile.valid"/>)
</logic:equal>
</logic:present>
</baco:cantManage>
 
<logic:notPresent name="CourseUnitView" property="programStreamId">
<bean:message key="courseunit.programfilepath.not.available"/>
</logic:notPresent>
 
</p>
 
<baco:canManage name="CourseUnitView">
94,7 → 109,7
</tr>
<baco:isAuthenticated>
<tr>
<td colspan="2" class="seccao">
<td class="seccao" valign="top">
<h2><bean:message key="module.Announcements"/></h2>
<logic:notEmpty name="CourseUnitView" property="announcements">
<div class="listCircleWhite">
113,6 → 128,25
<p><bean:message key="announcement.zero.placed"/></p>
</logic:empty>
</td>
<td class="seccao" valign="top">
<h2><bean:message key="courseunit.summaries"/></h2>
<logic:notEmpty name="CourseUnitView" property="summaries">
<div class="listCircleWhite">
<ul>
<logic:iterate id="summary" name="CourseUnitView" property="summaries" type="pt.estgp.estgweb.domain.views.CourseUnitSummaryView">
<li>
<h3>(${summary.date}) - ${summary.title}</h3>
<p>${summary.description}</p>
<p class="pFooterSeccao">${summary.students} <bean:message key="courseunit.summary.present.students"/> </p>
</li>
</logic:iterate>
</ul>
</div>
</logic:notEmpty>
<logic:empty name="CourseUnitView" property="summaries">
<p><bean:message key="courseunit.summaries.zero.placed"/></p>
</logic:empty>
</td>
</tr>
</baco:isAuthenticated>
</table>
/impl/src/web/user/home/student.jsp
65,6 → 65,14
</ul>
<!--Can put year all other units in the future calling service user.subscribedUnitsOldYearsView-->
</div>
<div class="block">
<p><bean:message key="intranet.home.curricular"/></p>
<ul>
<li>
<html:link action="/user/startLoadCoursesProgramsFromHome"><bean:message key="courseunit.programs"/></html:link>
</li>
</ul>
</div>
</td>
</baco:isModuleOn>
<td class="column">
/impl/src/web/user/home/teacher.jsp
63,6 → 63,14
</li>
</ul>
</div>
<div class="block">
<p><bean:message key="intranet.home.curricular"/></p>
<ul>
<li>
<html:link action="/user/startLoadCoursesProgramsFromHome"><bean:message key="courseunit.programs"/></html:link>
</li>
</ul>
</div>
</td>
</baco:isModuleOn>
<td class="column">
/impl/src/web/user/home/user.jsp
16,28 → 16,6
<jsp:include page="/user/home/todos.jsp"/>
</baco:isModuleOn>
</td>
<td class="column">
<div class="block">
<p>Ficheiros Úteis</p>
<ul>
<li>
<a href="#">Modelo de comunicação interna</a>
</li>
<li>
<a href="#">Justificação de Presença</a>
</li>
<li>
<a href="#">Justificação de Faltas</a>
</li>
<li>
<a href="#">Modelo de Bolsa</a>
</li>
<li>
<a href="#">Modelo de Bolsa</a>
</li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
/impl/src/web/user/serviceZone/topnavCoursesPrograms.jsp
New file
0,0 → 1,12
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@ page import="jomm.web.utils.NavPlace" %>
<%@ page import="jomm.web.utils.NavPlaceServer" %>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "course.program.courses");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavDirectedCoordinatedCourses.jsp
New file
0,0 → 1,12
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@ page import="jomm.web.utils.NavPlace" %>
<%@ page import="jomm.web.utils.NavPlaceServer" %>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startHome.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "course.directed.coordinated.courses");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/serviceZone.jsp
7,6 → 7,7
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="pt.estgp.estgweb.domain.CourseUnitAnnouncement" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
76,7 → 77,7
</li>
</baco:isModuleOn>
<baco:isModuleOn module="todos">
<baco:hasRole role="admin,super,services,administrativeCouncil,courseCoordinator,courseDirector,scientificCouncil,pedagogicCouncil">
<baco:hasRole role="admin,all,services,administrativeCouncil,courseCoordinator,courseDirector,scientificCouncil,pedagogicCouncil">
<li>
<html:link action="/user/startSubmitTodoAnnouncementFromServiceZone">
<bean:message key="submit.todo.announcement"/>
117,10 → 118,12
</baco:isAdmin>
 
<baco:isModuleOn module="courseunits">
<baco:isAdmin>
 
<baco:hasRole role="admin,all,services,administrativeCouncil,courseCoordinator,courseDirector,scientificCouncil,pedagogicCouncil">
<li>
<bean:message key="courses"/>
<ul>
<baco:isAdmin>
<li>
<html:link action="/user/startNewCourseFromServiceZone">
<bean:message key="course.new"/>
141,33 → 144,52
<bean:message key="courseunit.search"/>
</html:link>
</li>
 
</baco:isAdmin>
<%--<li>--%>
<%--<html:link action="/user/startFindCourseUnitAdminFromServiceZone">--%>
<%--<bean:message key="courseunit.program.archive"/>--%>
<%--</html:link>--%>
<%--</li>--%>
<li>
<baco:hasRole role="admin,all,servicesPrograms,administrativeCouncil,scientificCouncil,pedagogicCouncil">
<html:link action="/user/startLoadCoursesProgramsFromServiceZone">
<bean:message key="course.program.courses"/>
</html:link>
</baco:hasRole>
</li>
<li>
<baco:hasRole role="courseCoordinator,courseDirector">
<html:link action="/user/startLoadDirectedCoordinatedCoursesFromServiceZone">
<bean:message key="course.program.coordinated.directed.courses"/>
</html:link>
</baco:hasRole>
</li>
</ul>
</li>
</baco:isAdmin>
</baco:hasRole>
<li>
<bean:message key="backups"/>
<ul>
<baco:isAdmin>
<li>
<html:link target="_blank" action="/user/courseUnitControllerAdminFromServiceZone?dispatch=createCourseUnitWorksBackup">
<html:link action="/user/courseUnitControllerAdminFromServiceZone?dispatch=createAllCourseUnitWorksBackup">
<bean:message key="courseunits.backups"/>
</html:link>
</li>
<li>
<html:link action="/user/courseUnitControllerAdminFromServiceZone?dispatch=createImportYearCourseUnitWorksBackup">
<bean:message key="courseunits.backups.actual.year"/>
</html:link>
</li>
</baco:isAdmin>
<baco:hasRole role="student,teacher">
<li>
<html:link target="_blank" action="/user/courseUnitControllerAdminFromServiceZone?dispatch=createUserAllCourseUnitWorksBackup">
<html:link action="/user/courseUnitControllerAdminFromServiceZone?dispatch=createUserAllCourseUnitWorksBackup">
<bean:message key="courseunits.all.backup"/>
</html:link>
</li>
<li>
<html:link target="_blank" action="/user/courseUnitControllerAdminFromServiceZone?dispatch=createUserCourseUnitActualYearWorksBackup">
<html:link action="/user/courseUnitControllerAdminFromServiceZone?dispatch=createUserCourseUnitActualYearWorksBackup">
<bean:message key="courseunits.actual.year.backup"/>
</html:link>
</li>
234,8 → 256,18
%>
<tr>
<td>
<a href="<%=request.getContextPath()%>/user/startLoadAnnouncementFromServiceZone.do?id=<%=a.getId()%>"><%=a.getTitle()%>
</a></td>
<a href="<%=request.getContextPath()%>/user/startLoadAnnouncementFromServiceZone.do?id=<%=a.getId()%>"><%=a.getTitle()%></a>
 
<%
if (a.getCourseUnitView() != null)
{
%>
(<%=a.getCourseUnitView().getName()%>)
<%
}
%>
 
</td>
<td>
<%
String message;
/impl/etc/todo/todo.txt
9,12 → 9,6
No dia da Instalação:
Pasta de Deliberações CC copy paste.
 
 
Configuracoes de Teste
Server ESTGP esta definido para o localhost
Start Path do IOnline esta para a raiz mas para testar unidades tem de apontar para /Erasmus/baco
(PEDRO) Todos os documentos da Secção escola devem ser transferidos para a mesma pasta na nova web
 
Reestruturação das pastas da intranet:
 
As pastas enumeradas adiante tem de possuir permissões de intranet
29,18 → 23,11
Pasta Bolonha ZIP Pack deploy
Pasta Horarios Criar hierarquia. > Intranet/horarios
 
 
 
Jorge Meu
Tirar o getSerializable de noovo do domainObject e ver de onde devem herdar
 
###
 
Listagem de Docentes a fazer por jorge
Listagem de Alunos a fazer por jorge
Avisos Disciplina a fazer Susana
Disciplinas com Duvidas a fazer por jorge
Disciplinas com Blog a fazer por jorge
RSS disciplina incluido os três pontos anteriores Susana
RSS aluno incluindo o RSS anterior e os avisos gerais e os avisos para alunos Susana
RSS geral para anuncios dado o Tipo de anuncio (Destaques, SubDestaques e Noticias) Susana
48,8 → 35,40
TAB da disciplina definido por Jorge implementadar pela Susana (Objectivos, Programa, listagem da Intranet, Lista de Docentes, Lista de Alunos)
Pagina da disciplina a listar conteudos da intranet Jorge
 
#Material da Regie
 
####
FABIO
Imagens de Origem das noticias, parece-me que estão mal na pasta imgs
criar por defeito no DBInit um user com o role de cada uma das imagens (Secretaria, CI, CD, CC, CP, etc)
Serviços
 
1 - Actualizar material -> Procurar XML
2 - Registar Emprestimo -> Procurar utilizador -> Inserir Material da Combo (Filtra por entregar) -> Data De, Data Até -> confirmar
3 - Entregar Emprestimo -> Listar Emprestimos Pendentes -> Combo Devolvido
4 - Consultar Historico de Emprestimos -> (Entre Datas)
 
Extras
 
1 - Afazeres do Aluno Equipamentos por entregar
2 - Material da Regie na página oficial navegavel pelos Directorios
 
#Programas
Curto Prazo
- Listar apenas unidades com professor
- Filtrar por semestre
 
- adicionar campos consultar o Batista
- Descrição da Unidade
- bibliografia
 
Serviços Extra
 
1 - Consultar bibliografia por Curso / Semestre / Ano
2 - Pesquisar
 
 
#Questionários
 
- Semi-Projectado no EA
 
#Eventos
 
- Projecto por formalizar
/impl/build.xml
152,7 → 152,7
<antcall target="createConfigurationFiles"/>
</target>
<target name="compile" depends="initDirs" description="Compile All">
<javac encoding="UTF-8" source="1.5" target="1.5" destdir="${build.dir.classes}" debug="true" optimize="true" fork="true" deprecation="true" verbose="true" failonerror="true">
<javac encoding="UTF-8" source="1.5" target="1.5" destdir="${build.dir.classes}" debug="true" optimize="true" fork="true" failonerror="true" nowarn="true">
<src path="${src.dir}"/>
<src path="${gen.dir.java}"/>
<classpath refid="pathToToolsLib"/>
338,15 → 338,19
<mkdir dir="${build.dir.intranet.setup.folders.file}"/>
<copy overwrite="true" todir="${build.dir.intranet.setup.folders.file}" file="${intranet.setup.folders.file.src}"/>
 
<java classname="${scripts.buider.class}" classpath="${build.dir.classes}">
<arg value="${basedir}${file.separator}..${file.separator}common"/>
<arg value="${basedir}${file.separator}build${file.separator}ant${file.separator}classes"/>
<arg value="${build.dir.scripts}"/>
<arg value="${scripts.target.libs.file}"/>
</java>
<copy overwrite="true" todir="${build.dir.scripts}">
<fileset dir="${src.scripts}" includes="*.*"/>
<mkdir dir="${build.dir.classes}/pt/estgp/estgweb/directories"/>
<copy overwrite="true" todir="${build.dir.classes}/pt/estgp/estgweb/directories">
<fileset dir="${conf.dir}/directories" includes="*.*"/>
</copy>
<!--<java classname="${scripts.buider.class}" classpath="${build.dir.classes}">-->
<!--<arg value="${basedir}${file.separator}..${file.separator}common"/>-->
<!--<arg value="${basedir}${file.separator}build${file.separator}ant${file.separator}classes"/>-->
<!--<arg value="${build.dir.scripts}"/>-->
<!--<arg value="${scripts.target.libs.file}"/>-->
<!--</java>-->
<!--<copy overwrite="true" todir="${build.dir.scripts}">-->
<!--<fileset dir="${src.scripts}" includes="*.*"/>-->
<!--</copy>-->
 
</target>
 
384,9 → 388,9
<replacefilter token="@log.file@" value="${log.file}"/>
<replacefilter token="@log.level@" value="${log.level}"/>
</replace>
<replace file="${build.dir.scripts}/${scripts.setenv.file}">
<!--<replace file="${build.dir.scripts}/${scripts.setenv.file}">
<replacefilter token="@tomcat.home@" value="${tomcat.home}"/>
</replace>
</replace>-->
<replace file="${jdbc.properties.build}/${jdbc.properties.filename}">
<replacefilter token="@database.username@" value="${database.username}"/>
<replacefilter token="@database.password@" value="${database.password}"/>
506,6 → 510,9
<target name="util.task.createRepositoryXML">
<java classname="pt.estgp.estgweb.services.data.CreateDescriptionsXML" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
<target name="util.task.reset.urlsstats">
<java classname="pt.estgp.estgweb.services.urlstat.ResetRelativePathsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
 
 
</project>