/impl/importRoutines.xml |
---|
14,6 → 14,7 |
<target name="students"> |
<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"/> |
</target> |
</project> |
/impl/conf/language/MessageResourcesCommon.properties |
---|
9,6 → 9,7 |
search.next=Próxima Página |
search.previous=Página Anterior |
search.see.more=ver mais |
search.see.more.content=Clique aqui para ver mais acerca deste conteudo |
search.type.phrase=Frase Exacta |
search.type.any=Algumas Palavras |
search.type.all=Todas as Palavras |
/impl/conf/language/MessageResourcesCourse.properties |
---|
22,11 → 22,12 |
course.director=Director de Curso |
course.studies.plan=Plano de Estudos (XML válido no planoEstudos.xsd) |
course.studies.plan.not.available=Não disponivel |
course.courseunit.program.objectives.todo=Unidade em Falta (programa ou objectivos) |
course.courseunit.program.objectives.todo={0} Unidades em Falta (programa) |
course.externalSite=Site Externo |
course.studies.plan=Plano de Estudos |
course.directed.coordinated.courses=Gestão de Unidades Curriculares |
course.directed.coordinated.courses.updated.success={0} unidades curriculares actualizadas com sucesso |
course.B=Bacharlato |
course.L=Lincenciatura |
course.M=Mestrado |
38,9 → 39,17 |
course.Ms=Mestrados |
course.Ps=Pós Graduaçãos |
course.Es=CET's |
course.units.no.program=Unidades sem programa entregue |
course.units.with.program.not.checked=Unidades com programa por validar |
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) |
course.directed.courses=Cursos que dirige |
course.coordinated.courses=Cursos que coordena |
course.unit.directed=Unidades Curriculares |
course.unit.coordinated=Unidades Coordenadas |
48,3 → 57,5 |
/impl/conf/language/MessageResourcesProfile.properties |
---|
7,6 → 7,11 |
profile=Perfil Pessoal |
profile.bad.profile.teacher.iregular.user.class=Existe um problema com o seu perfil. Aparentemente o papel de professor que lhe foi atribuido não foi reconhecido pelo sistema central. Por favor dirija-se ao centro informatico e reporte o problema para que a situação seja corrigida. Pedimos desculpa pelo incómodo. |
profile.bad.profile.student.iregular.user.class=Existe um problema com o seu perfil. Aparentemente o papel de estudante que lhe foi atribuido não foi reconhecido pelo sistema central. Por favor dirija-se ao centro informatico e reporte o problema para que a situação seja corrigida. Pedimos desculpa pelo incómodo. |
user.exists=Já existe um utilizador com o {0} escolhido |
#Degrees |
profile.scholar.degree.notset=Não disponivel |
profile.scholar.degree=Escolaridade |
/impl/conf/language/MessageResources.properties |
---|
47,6 → 47,7 |
error.no.cookies=Por favor ligue os cookies do seu browser para poder continuar a usar este sistema. Obrigado |
error.500=Ocorreu um erro interno |
error.503=O serviço de monmento encontra-se indisponivel, por favor volte a tentar mais tarde. |
error.404=A página solicitada não está disponível |
error.404.explain=Caro utilizador, a página que pretende visualizar não se encontra disponível neste endereço.<br>O erro pode ter ocorrido por uma das seguintes razões: |
error.404.item.1=Escreveu mal o endereço (URL) do documento a que pretende aceder |
90,6 → 91,7 |
user.role.worker=Funcionário |
user.role.invited=Convidado |
user.role.services=Serviços |
user.role.servicesPrograms=Gestão de Programas Curriculares |
user.role.administrativeCouncil=Conselho Directivo |
user.role.representativeCouncil=Assembleia de Representantes |
user.role.scientificCouncil=Conselho Científico |
/impl/conf/language/MessageResourcesCourseUnits.properties |
---|
24,6 → 24,7 |
courseunit.zero.units=Nenhuma Unidade Curricular |
courseunit.objectives.todo=Peenchimento dos objectivos da unidade |
courseunit.program.todo=Upload do programa da unidade |
courseunit.program.objectives.todo=Programa e/ou Objectivos |
courseunit.question.todo=Dúvida |
courseunit.assignement.todo=Trabalho por entregar |
course.unit.works=Trabalhos |
/impl/conf/WEB-INF/struts/struts-courses.xml |
---|
48,6 → 48,20 |
<forward name="submit" path="page.submit.course.from.service.zone"/> |
</action> |
<action path="/user/startLoadCoursesProgramsFromHome" forward="/user/courseControllerFromHome.do?dispatch=loadCoursesPrograms&from=Home"/> |
<action path="/user/startLoadDirectedCoordinatedCoursesFromHome" forward="/user/courseControllerFromHome.do?dispatch=loadDirectedCoordininatedCourses&from=Home"/> |
<action path="/user/courseControllerFromHome" |
type="pt.estgp.estgweb.web.controllers.courses.CoursesController" |
name="CourseForm" |
scope="request" |
parameter="dispatch" |
validate="false" |
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"/> |
</action> |
</action-mappings> |
/impl/conf/WEB-INF/struts/tiles-courses.xml |
---|
33,6 → 33,18 |
<put name="body" value="/admin/courses/course.jsp"/> |
</definition> |
<definition name="page.directed.coordinated.courses.from.home" extends="page.separators.home"> |
<put name="title" value="Ver Cursos e Unidades"/> |
<put name="topnav" value="/user/courses/topnavDirectedCoordinatedCourses.jsp"/> |
<put name="body" value="/user/courses/directedCoordinatedCourses.jsp"/> |
</definition> |
<definition name="page.courses.programs.from.home" extends="page.separators.home"> |
<put name="title" value="Ver Cursos e Unidades"/> |
<put name="topnav" value="/user/courses/topnavDirectedCoordinatedCourses.jsp"/> |
<put name="body" value="/user/courses/directedCoordinatedCourses.jsp"/> |
</definition> |
/impl/conf/WEB-INF/struts/struts-default.xml |
---|
21,6 → 21,7 |
<global-forwards> |
<forward name="welcome" path="/Welcome.do"/> |
<forward name="error503" path="/error503.do"/> |
<forward name="error500" path="/error500.do"/> |
<forward name="error404" path="/error404.do"/> |
<forward name="error401" path="/error401.do"/> |
47,6 → 48,7 |
<action path="/error401" forward="page.error.401"/> |
<action path="/error404" forward="page.error.404"/> |
<action path="/error500" forward="page.error.500"/> |
<action path="/error503" forward="page.error.503"/> |
<!--Layout Forward--> |
<action path="/layout" |
/impl/conf/WEB-INF/struts/tiles-default.xml |
---|
324,6 → 324,10 |
<put name="title" value="internal error" /> |
<put name="body" value="/errors/500.jsp" /> |
</definition> |
<definition name="page.error.503" extends="base.error.definition"> |
<put name="title" value="indisponivel" /> |
<put name="body" value="/errors/503.jsp" /> |
</definition> |
<definition name="page.error.401" extends="base.error.definition"> |
<put name="title" value="not authorized" /> |
<put name="body" value="/errors/401.jsp" /> |
/impl/conf/WEB-INF/tlds/baco.tld |
---|
121,6 → 121,20 |
</attribute> |
</tag> |
<tag> |
<name>isRealOwner</name> |
<tagclass>pt.estgp.estgweb.web.tags.RealOwnerTag</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>isValid</name> |
<tagclass>pt.estgp.estgweb.web.tags.IsValidTag</tagclass> |
<attribute> |
/impl/conf/WEB-INF/web.xml |
---|
294,6 → 294,10 |
<error-code>500</error-code> |
<location>/error500.do</location> |
</error-page> |
<error-page> |
<error-code>503</error-code> |
<location>/error503.do</location> |
</error-page> |
<!--TLDS--> |
<jsp-config> |
/impl/conf/app.properties |
---|
8,7 → 8,7 |
email.local.suffix=estgp.pt |
email.server=mail.estgp.pt |
email.server=localhost |
email.user= |
email.password= |
email.from=bacodev@estgp.pt |
49,7 → 49,7 |
module.reminders=true |
module.intranet=true |
module.profile=true |
module.sms=true |
module.sms=false |
################################################## |
# SMS |
75,12 → 75,12 |
ionline.pass=baco |
ionline.user=Baco_web |
server.estgp=http://www.estgp.pt |
estgp.encoding=ISO-8859-1 |
server.estgp.start.path=/testes/nova_web |
server.estgp=http://localhost:8180 |
#estgp.encoding=ISO-8859-1 |
server.estgp.start.path=/static |
#server.estgp=http://www.estgp.pt/testes/nova_web |
#estgp.encoding=UTF-8 |
estgp.encoding=UTF-8 |
##server.estgp=http://localhost:8080/estgweb |
server.estgweb=http://www.estgp.pt/testes/estgweb |
106,6 → 106,7 |
user.courseCoordinator=courseCoordinator |
user.courseDirector=courseDirector |
user.identifiersManagers=identifiersManager |
user.servicesPrograms=servicesPrograms |
user.role.00=all |
user.role.01=admin |
133,9 → 134,9 |
user.role.23=courseDirector |
user.role.24=identifiersManager |
user.role.25=identifiersCollectionCreator |
user.role.26=servicesPrograms |
######################################################################### |
# |
# Modules |
145,7 → 146,7 |
######################################################################### |
# Announcements |
# |
announcements.text.summary.size=250 |
announcements.text.summary.size=500 |
announcements.text.summary.size.small=100 |
announcements.max.visible=10 |
announcements.top.flash.news.timeout.miliseconds=7000 |
171,7 → 172,7 |
announcements.automatic.validation.role.5=services |
studentAssociation.auto.validation.targets=student,oldStudent,futureStudent,erasmusStudent |
studentAssociation.auto.validation.types=news,top.flash.news |
studentAssociation.auto.validation.types=news |
services.auto.validation.targets=student,oldStudent,futureStudent,erasmusStudent,teacher,teacher.eg,teacher.dg,teacher.ce |
services.auto.validation.types=news,top.flash.news,bottom.flash.news,todo |
194,7 → 195,8 |
#role images for announcements |
announcement.default.img=/imgs/rolesIcons/nd.gif |
announcement.default.img=/imgs/rolesIcons/estg.gif |
role.student.img=/imgs/rolesIcons/student.gif |
role.admin.img=/imgs/rolesIcons/estg.gif |
role.sudentAssociation.img=/imgs/rolesIcons/ae.gif |
role.administrativeCouncil.img=/imgs/rolesIcons/c_directivo.gif |
/impl/conf/template/email/courseUnitAnnouncement_pt.txt |
---|
1,4 → 1,4 |
# 0 : Course Unit Name |
# 0 : Course Unit Name |
# 1 : Title |
# 2 : Text |
# 3 : Teacher |
7,7 → 7,7 |
# |
Caro estudante |
Um novo anuncio foi publicado na unidade: |
Um novo anúncio foi publicado na unidade: |
{0} |
{1} |
/impl/conf/template/assignement/Assignement.txt |
---|
1,7 → 1,10 |
Unidade Curricular:{0} |
Unidade Curricular:{0} |
Titulo:{1} |
Data de Entrega: {2} |
Descrição: |
{3} |
/impl/conf/berserk/sd.xml |
---|
833,6 → 833,42 |
</filterChains> |
</service> |
<service> |
<name>LoadDirectedCoordinatedCoursesForUserInSession</name> |
<implementationClass>pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService</implementationClass> |
<description>Load coordinated directed courses</description> |
<isTransactional>true</isTransactional> |
<defaultMethod>loadForUserSession</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
<chain name="DirectorsCoordinators"/> |
</filterChains> |
</service> |
<service> |
<name>LoadCoursesProgramsForServices</name> |
<implementationClass>pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService</implementationClass> |
<description>Load coordinated directed courses</description> |
<isTransactional>true</isTransactional> |
<defaultMethod>loadForServices</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
<chain name="Services"/> |
</filterChains> |
</service> |
<service> |
<name>UpdateDirectedCoordinatedCoursesForUserInSession</name> |
<implementationClass>pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService</implementationClass> |
<description>Load coordinated directed courses</description> |
<isTransactional>true</isTransactional> |
<defaultMethod>update</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
<chain name="Session"/> |
<chain name="DirectorsCoordinators"/> |
</filterChains> |
</service> |
<service> |
<name>LoadTeachedUnits</name> |
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadTeachedUnitsService</implementationClass> |
<description>Load teacher units</description> |
/impl/conf/berserk/fcd.xml |
---|
35,6 → 35,20 |
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass> |
</filterChain> |
<filterChain> |
<name>DirectorsCoordinators</name> |
<expression>AuthenticatedUsers && (RoleUsers("courseDirector") || RoleUsers("courseCoordinator"))</expression> |
<description>Validate if a user is coordinator or director</description> |
<invocationTiming>1</invocationTiming> |
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass> |
</filterChain> |
<filterChain> |
<name>Services</name> |
<expression>AuthenticatedUsers && RoleUsers("servicesPrograms")</expression> |
<description>Validate if a user is coordinator or director</description> |
<invocationTiming>1</invocationTiming> |
<filterClass>pt.estgp.estgweb.filters.chains.AdminControlFilter</filterClass> |
</filterChain> |
<filterChain> |
<name>IdentifiersManager</name> |
<expression>AuthenticatedUsers && RoleUsers("identifiersManager")</expression> |
<description>Admins Control Chain</description> |
/impl/src/java/jomm/utils/StreamsUtils.java |
---|
53,6 → 53,4 |
stream.close(); |
out.close(); |
} |
} |
/impl/src/java/jomm/utils/AutoFillArrayList.java |
---|
New file |
0,0 → 1,63 |
package jomm.utils; |
import org.apache.log4j.Logger; |
import java.util.ArrayList; |
/** |
* @author Jorge Machado |
* @date 24/Out/2008 |
* @see jomm.utils |
*/ |
public class AutoFillArrayList<CLAZZ> extends ArrayList<CLAZZ> |
{ |
private static final Logger logger = Logger.getLogger(AutoFillArrayList.class); |
Class c; |
public AutoFillArrayList(Class c) |
{ |
super(); |
// this.c = c; |
for(int i=0;i<600;i++) |
{ |
try |
{ |
super.add((CLAZZ) c.newInstance()); |
} |
catch (InstantiationException e) |
{ |
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. |
} |
catch (IllegalAccessException e) |
{ |
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. |
} |
} |
} |
// public CLAZZ get(int n) |
// { |
// while(super.size()-1 < n) |
// { |
// super.add(null); |
// } |
// if(super.get(n)==null) |
// try |
// { |
// super.add(n, (CLAZZ) c.newInstance()); |
// } |
// catch (InstantiationException e) |
// { |
// logger.error(e,e); |
// } |
// catch (IllegalAccessException e) |
// { |
// logger.error(e,e); |
// } |
// return super.get(n); |
// } |
} |
/impl/src/java/jomm/utils/StringsUtils.java |
---|
50,6 → 50,14 |
{ |
finalFormatedText.append(" "); |
} |
else if (text.charAt(i) == '<') |
{ |
finalFormatedText.append("<"); |
} |
else if (text.charAt(i) == '>') |
{ |
finalFormatedText.append(">"); |
} |
else |
{ |
finalFormatedText.append(text.charAt(i)); |
59,6 → 67,31 |
return finalFormatedText.toString(); |
} |
public static String getEscapeHtmlText(String text) |
{ |
if (text == null || text.trim().length() == 0) |
return ""; |
StringBuilder finalFormatedText = new StringBuilder(); |
boolean newLine = true; |
for (int i = 0; i < text.length(); i++) |
{ |
if (text.charAt(i) == '<') |
{ |
finalFormatedText.append("<"); |
} |
else if (text.charAt(i) == '>') |
{ |
finalFormatedText.append(">"); |
} |
else |
{ |
finalFormatedText.append(text.charAt(i)); |
} |
} |
return finalFormatedText.toString(); |
} |
public static boolean checkLetters09AZazHiffenUnderScore(String candidate) |
{ |
if (candidate == null) |
/impl/src/java/jomm/dao/impl/AbstractDao.java |
---|
5,12 → 5,14 |
import jomm.dao.IDomainObjectDao; |
import jomm.dao.utils.HibernateUtils; |
import org.hibernate.*; |
import org.hibernate.proxy.HibernateProxy; |
import org.hibernate.criterion.CriteriaSpecification; |
import org.hibernate.criterion.Order; |
import org.hibernate.criterion.Projections; |
import static org.hibernate.criterion.Restrictions.eq; |
import pt.estgp.estgweb.domain.DomainObject; |
import pt.estgp.estgweb.domain.DomainSerializableObject; |
import pt.estgp.estgweb.domain.Teacher; |
import java.io.Serializable; |
import java.sql.SQLException; |
324,6 → 326,20 |
} |
/** |
* |
* @param o |
* @return |
*/ |
public CLAZZ narrow(CLAZZ o) |
{ |
if (o instanceof HibernateProxy) |
{ |
return (CLAZZ) ((HibernateProxy)o).getHibernateLazyInitializer().getImplementation(); |
} |
return o; |
} |
/** |
* Used by the base DAO classes but here for your modification Load object |
* matching the given key and return it. |
* |
492,8 → 508,8 |
} |
} |
/** |
* Remove this instance from the system cache. |
* <p/> |
/impl/src/java/pt/estgp/estgweb/utils/DatesUtils.java |
---|
49,6 → 49,20 |
return getFormatedImportYear(firstYearStr,secondYearStr,SIGES_importFinalFormat); |
} |
public static String getSemestre() |
{ |
MyCalendar mc = new MyCalendar(); |
int month = mc.getMonth(); |
if((month > 8 && month <=12) || (month >= 1 && month <=2)) |
{ |
return "S1"; |
} |
else |
{ |
return "S2"; |
} |
} |
public static String getImportYearIntranet() |
{ |
MyCalendar mc = new MyCalendar(); |
/impl/src/java/pt/estgp/estgweb/utils/CourseViewComparator.java |
---|
New file |
0,0 → 1,39 |
package pt.estgp.estgweb.utils; |
import jomm.utils.StringComparator; |
import pt.estgp.estgweb.domain.views.CourseView; |
/** |
* |
* @author User |
*/ |
public class CourseViewComparator implements java.util.Comparator<CourseView> |
{ |
private static CourseViewComparator instance = null; |
public static CourseViewComparator getInstance() |
{ |
if(instance == null) |
{ |
instance = new CourseViewComparator(); |
} |
return instance; |
} |
/** Creates a new instance of LongComparator */ |
private CourseViewComparator() { |
} |
public int compare(CourseView s1, CourseView s2) |
{ |
int compareResult = s2.getName().compareTo(s1.getName()); |
if(compareResult > 0) |
return -1; |
else if(compareResult < 0) |
return 1; |
return 0; |
} |
} |
/impl/src/java/pt/estgp/estgweb/Globals.java |
---|
33,6 → 33,8 |
public static final int SEARCH_BEST_FRAGMENTS_MAX_FRAGMENTS = ConfigProperties.getIntProperty("search.best.fragments.max.fragments"); |
public static final String ALL_ROLE = ConfigProperties.getProperty("user.super"); |
public static final String SERVICES_PROGRAMS_ROLE = ConfigProperties.getProperty("user.servicesPrograms"); |
public static final String ACTUAL_RELATIVE_PATH = "ACTUAL_RELATIVE_PATH"; |
public static final String ADMIN_ROLE = ConfigProperties.getProperty("user.admin"); |
public static final String SUPER_USER_ROLE = ConfigProperties.getProperty("user.super"); |
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesCommonServices.java |
---|
8,6 → 8,8 |
import pt.estgp.estgweb.services.courseunits.CourseUnitsCommonServices; |
import pt.estgp.estgweb.domain.*; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.utils.DatesUtils; |
import org.apache.log4j.Logger; |
import java.util.*; |
96,21 → 98,36 |
coordinatorCourses = new HashSet<Course>(); |
if(directorCourses == null) |
directorCourses = new HashSet<Course>(); |
coordinatorCourses = new HashSet<Course>(coordinatorCourses); |
directorCourses = new HashSet<Course>(directorCourses); |
coordinatorCourses.removeAll(directorCourses); |
directorCourses.addAll(coordinatorCourses); |
for(Course course: directorCourses) |
{ |
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadMissingObjectivesOrProgramGivenCourse(course.getId()); |
for(CourseUnit c: courseUnits) |
int missing = DaoFactory.getCourseUnitDaoImpl().countMissingProgramGivenCourse(course.getId()); |
if(missing > 0) |
{ |
DefaultToDo defaultToDo = new DefaultToDo(c.getName(),null,c.getCourseName(), "course.courseunit.program.objectives.todo","/user/startLoadCourseUnitFromHome.do?id=" + c.getId()); |
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.objectives.todo",""+missing,"/user/startLoadDirectedCoordinatedCoursesFromHome.do#" + course.getId()); |
todos.add(defaultToDo); |
} |
} |
} |
} |
if(userSession.getUser().hasRole(Globals.SERVICES_PROGRAMS_ROLE)) |
{ |
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll(DatesUtils.getImportYear()); |
for(Course course: courses) |
{ |
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/startLoadCoursesProgramsFromHome.do#" + course.getId()); |
todos.add(defaultToDo); |
} |
} |
}/*This method is invoked from object creation*/ |
return todos; |
}/*This method is invoked from object creation*/ |
} |
public void adviseNew(DomainObject object) |
{ |
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesService.java |
---|
107,7 → 107,7 |
String extension = FilesUtils.getExtension(name); |
if(c.getStudiesPlan() == null) |
{ |
String identifier = repositoryService.storeRepositoryFile(stream, contentType, extension, size, name, "course.studies.plan" + c.getName(), ResourceAccessControlEnum.publicDomain,userSession); |
String identifier = repositoryService.storeRepositoryFile(stream, contentType, extension, size, name, "course.studies.plan " + c.getName(), ResourceAccessControlEnum.publicDomain,userSession); |
c.setStudiesPlan(identifier); |
} |
else |
/impl/src/java/pt/estgp/estgweb/services/courseunits/CourseUnitsCommonServices.java |
---|
88,30 → 88,30 |
if(userSession.getUser() != null && userSession.getUser() instanceof Teacher) |
{ |
HashMap<Long,Long> doneProgramCodes = new HashMap<Long,Long>(); |
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadMissingObjectives(userSession.getUser().getId()); |
// HashMap<Long,Long> doneProgramCodes = new HashMap<Long,Long>(); |
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadMissingObjectivesOrPrograms(userSession.getUser().getId()); |
for(CourseUnit c: courseUnits) |
{ |
DefaultToDo defaultToDo = new DefaultToDo(c.getName(),null,c.getCourseName(), "courseunit.objectives.todo","/user/startLoadCourseUnitFromHome.do?id=" + c.getId()); |
DefaultToDo defaultToDo = new DefaultToDo(c.getName(),null,c.getCourseName(), "courseunit.program.objectives.todo","/user/startLoadCourseUnitFromHome.do?id=" + c.getId()); |
todos.add(defaultToDo); |
if(c.getProgramStreamId() == null || c.getProgramStreamId().length() == 0) |
{ |
doneProgramCodes.put(c.getId(),c.getId()); |
defaultToDo = new DefaultToDo(c.getName(),null,c.getCourseName(), "courseunit.program.todo","/user/startLoadCourseUnitFromHome.do?id=" + c.getId()); |
todos.add(defaultToDo); |
} |
// if(c.getProgramStreamId() == null || c.getProgramStreamId().length() == 0) |
// { |
//// doneProgramCodes.put(c.getId(),c.getId()); |
// defaultToDo = new DefaultToDo(c.getName(),null,c.getCourseName(), "courseunit.program.todo","/user/startLoadCourseUnitFromHome.do?id=" + c.getId()); |
// todos.add(defaultToDo); |
// } |
} |
courseUnits = DaoFactory.getCourseUnitDaoImpl().loadMissingPrograms(userSession.getUser().getId()); |
for(CourseUnit c: courseUnits) |
{ |
if(doneProgramCodes.get(c.getId()) == null) //is not in missing objectives units |
{ |
doneProgramCodes.put(c.getId(),c.getId()); |
DefaultToDo defaultToDo = new DefaultToDo(c.getName(),null,c.getCourseName(), "courseunit.program.todo","/user/startLoadCourseUnitFromHome.do?id=" + c.getId()); |
todos.add(defaultToDo); |
} |
} |
// courseUnits = DaoFactory.getCourseUnitDaoImpl().loadMissingPrograms(userSession.getUser().getId()); |
// for(CourseUnit c: courseUnits) |
// { |
// if(doneProgramCodes.get(c.getId()) == null) //is not in missing objectives units |
// { |
// doneProgramCodes.put(c.getId(),c.getId()); |
// DefaultToDo defaultToDo = new DefaultToDo(c.getName(),null,c.getCourseName(), "courseunit.program.todo","/user/startLoadCourseUnitFromHome.do?id=" + c.getId()); |
// todos.add(defaultToDo); |
// } |
// } |
List<CourseUnitQuestion> courseUnitQuestions = DaoFactory.getCourseUnitQuestionDaoImpl().loadMissingQuestions(userSession.getUser().getId()); |
for(CourseUnitQuestion c: courseUnitQuestions) |
/impl/src/java/pt/estgp/estgweb/services/courseunits/DirectedCoordinatedCourses.java |
---|
New file |
0,0 → 1,82 |
package pt.estgp.estgweb.services.courseunits; |
import jomm.utils.AutoFillArrayList; |
import pt.estgp.estgweb.domain.views.CourseView; |
import java.util.List; |
/** |
* @author Jorge Machado |
* @date 24/Out/2008 |
* @see pt.estgp.estgweb.services.courseunits |
*/ |
public class DirectedCoordinatedCourses |
{ |
private List<CourseView> directedCourses; |
private List<CourseView> coordinatedCourses; |
private List<CourseView> merge; |
private int updated; |
private int missing; |
public DirectedCoordinatedCourses() |
{ |
System.out.println(""); |
} |
public List<CourseView> getDirectedCourses() |
{ |
return directedCourses; |
} |
public void setDirectedCourses(List<CourseView> directedCourses) |
{ |
this.directedCourses = directedCourses; |
} |
public List<CourseView> getCoordinatedCourses() |
{ |
return coordinatedCourses; |
} |
public void setCoordinatedCourses(List<CourseView> coordinatedCourses) |
{ |
this.coordinatedCourses = coordinatedCourses; |
} |
public int getUpdated() |
{ |
return updated; |
} |
public void setUpdated(int updated) |
{ |
this.updated = updated; |
} |
public int getMissing() |
{ |
return missing; |
} |
public void setMissing(int missing) |
{ |
this.missing = missing; |
} |
public void setMerge(List<CourseView> merge) |
{ |
this.merge = merge; |
} |
public List<CourseView> getMerge() |
{ |
if(merge == null) |
merge = new AutoFillArrayList<CourseView>(CourseView.class); |
return merge; |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/courseunits/DirectedCoordinatedUnitsService.java |
---|
New file |
0,0 → 1,155 |
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.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.utl.ist.berserk.logic.serviceManager.IService; |
import java.util.ArrayList; |
import java.util.HashMap; |
import java.util.Set; |
import java.util.List; |
/** |
* @author Jorge Machado |
* @date 2/Jun/2008 |
* @see pt.estgp.estgweb.services.courseunits |
*/ |
public class DirectedCoordinatedUnitsService implements IService |
{ |
public DirectedCoordinatedCourses loadForUserSession(UserSession userSession) |
{ |
return loadForUser(userSession.getUser().getId(), userSession); |
} |
public DirectedCoordinatedCourses loadForUser(long teacherId, UserSession userSession) |
{ |
Teacher t = DaoFactory.getTeacherDaoImpl().load(teacherId); |
Set<Course> directorCourses = t.getDirectorCourses(); |
Set<Course> coordinatorCourses = t.getCoordinatorCourses(); |
HashMap<Course, Boolean> map = new HashMap<Course, Boolean>(); |
DirectedCoordinatedCourses directedCoordinatedCourses = new DirectedCoordinatedCourses(); |
directedCoordinatedCourses.setCoordinatedCourses(new ArrayList<CourseView>()); |
directedCoordinatedCourses.setDirectedCourses(new ArrayList<CourseView>()); |
directedCoordinatedCourses.setMerge(new ArrayList<CourseView>()); |
for (Course c : directorCourses) |
{ |
CourseView cV = new CourseView(c, true); |
directedCoordinatedCourses.getDirectedCourses().add(cV); |
if (map.get(c) == null) |
{ |
directedCoordinatedCourses.getMerge().add(cV); |
map.put(c, true); |
} |
} |
for (Course c : coordinatorCourses) |
{ |
CourseView cV = new CourseView(c, true); |
directedCoordinatedCourses.getCoordinatedCourses().add(cV); |
if (map.get(c) == null) |
{ |
directedCoordinatedCourses.getMerge().add(cV); |
map.put(c, true); |
} |
} |
java.util.Collections.sort(directedCoordinatedCourses.getMerge(), CourseViewComparator.getInstance()); |
fill(directedCoordinatedCourses.getMerge()); |
return directedCoordinatedCourses; |
} |
public DirectedCoordinatedCourses loadForServices(UserSession userSession) |
{ |
List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(DatesUtils.getImportYear()); |
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; |
} |
private void fill(List<CourseView> courseViews) |
{ |
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>()); |
for (CourseUnitView cUV : cV.getCourseUnits()) |
{ |
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; |
for(CourseView courseView: directedCoordinatedCourses.getMerge()) |
{ |
if(courseView.getId()>0) |
{ |
Course c = DaoFactory.getCourseDaoImpl().load(courseView.getId()); |
if(userSession.getUser().getId() == c.getCoordinator().getId()) |
{ |
counter+=updateList(courseView.getCourseUnitsWithProgramCheckedS1()); |
counter+=updateList(courseView.getCourseUnitsWithProgramCheckedS2()); |
counter+=updateList(courseView.getCourseUnitsWithProgramNotCheckedS1()); |
counter+=updateList(courseView.getCourseUnitsWithProgramNotCheckedS2()); |
} |
} |
} |
directedCoordinatedCourses.setUpdated(counter); |
return directedCoordinatedCourses; |
} |
private int updateList(List<CourseUnitView> views) |
{ |
int counter = 0; |
for(CourseUnitView courseUnitView: views) |
{ |
if(courseUnitView != null && courseUnitView.getId()>0) |
{ |
if(courseUnitView.getProgramStreamId() != null && courseUnitView.getProgramStreamId().length() > 0) |
{ |
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().load(courseUnitView.getId()); |
if(courseUnit.isValidProgram() != courseUnitView.isValidProgram()) |
{ |
courseUnit.setValidProgram(courseUnitView.isValidProgram()); |
counter++; |
} |
} |
} |
} |
return counter; |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/courseunits/CreateCourseUnitWorksBackupService.java |
---|
31,10 → 31,9 |
*/ |
/** |
* @author Jorge Machado |
* |
* |
* Created at 17/Out/2003 , 23:45:24 |
* |
* <p/> |
* <p/> |
* Created at 17/Out/2003 , 23:45:24 |
*/ |
public class CreateCourseUnitWorksBackupService implements IService |
{ |
45,16 → 44,16 |
public String createSystemActualYearBackup(String importYear, UserSession userSession) throws ServiceException |
{ |
if(importYear == null || importYear.trim().length() == 0) |
if (importYear == null || importYear.trim().length() == 0) |
importYear = DatesUtils.getImportYear(); |
String importYearIntranet = DatesUtils.getImportYearIntranet(); |
String tmpName = BytesUtils.generateHexKey(); |
String tmpName = BytesUtils.generateHexKey(); |
String tmpDir = Globals.TMP_DIR + "/" + tmpName; |
new File(tmpDir).mkdirs(); |
List<Course> courses = DaoFactory.getCourseDaoImpl().findAll(importYear); |
try |
{ |
for(Course c: courses) |
for (Course c : courses) |
{ |
String couseDirPath = tmpDir + "/" + StringsUtils.normalizeResourceName(c.getName()) + '.' + c.getCode(); |
try |
62,11 → 61,11 |
String courseImportYearPath = couseDirPath + "/" + importYearIntranet; |
File courseImportYearDir = new File(courseImportYearPath); |
courseImportYearDir.mkdirs(); |
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadByCourse(c.getId(),importYear); |
for(CourseUnit courseUnit: courseUnits) |
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadByCourse(c.getId(), importYear); |
for (CourseUnit courseUnit : courseUnits) |
{ |
String semestre; |
if(courseUnit.getSemestre().equals("S1")) |
if (courseUnit.getSemestre().equals("S1")) |
{ |
semestre = Globals.INTRANET_SEMESTRE_S1; |
} |
77,15 → 76,15 |
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName()); |
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName; |
for(CourseUnitAssignement assignement : courseUnit.getAssignements()) |
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) |
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()) |
for (CourseUnitDeliverable deliverable : assignement.getDeliverables()) |
{ |
copyDeliverableVersions(deliverable,assignementDir,userSession); |
copyDeliverableVersions(deliverable, assignementDir, userSession); |
} |
} |
} |
93,48 → 92,49 |
} |
catch (IOException e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
} |
} |
FilesUtils.zipFolder(tmpDir,tmpDir + ".zip"); |
FilesUtils.zipFolder(tmpDir, tmpDir + ".zip"); |
FilesUtils.delete(tmpDir); |
return tmpName + ".zip"; |
} |
catch (IOException e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
} |
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 |
* 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) |
if (userSession.getUser() instanceof Teacher) |
return createLoginTeacherActualYearBackup(userSession); |
else if(userSession.getUser() instanceof Student) |
else if (userSession.getUser() instanceof Student) |
return createLoginStudentActualYearBackup(userSession); |
return null; |
} |
/** |
* In case of student create a backup with student deliverables subscribed units, in case of teacher create a backup of all deliverables of teached units |
* |
* In case of student create a backup with student deliverables subscribed units, in case of teacher create a backup of all deliverables of teached units |
* @param userSession |
* @return |
* @throws ServiceException |
*/ |
public String createBackup(UserSession userSession) throws ServiceException |
{ |
if(userSession.getUser() instanceof Teacher) |
if (userSession.getUser() instanceof Teacher) |
return createLoginTeacherBackup(userSession); |
else if(userSession.getUser() instanceof Student) |
else if (userSession.getUser() instanceof Student) |
return createLoginStudentBackup(userSession); |
return null; |
} |
142,97 → 142,93 |
public String createLoginStudentBackup(UserSession userSession) throws ServiceException |
{ |
Student s = (Student) userSession.getUser(); |
return createStudentBackup(s,userSession); |
return createStudentBackup(s, userSession); |
} |
public String createLoginTeacherBackup(UserSession userSession) throws ServiceException |
{ |
Teacher t = (Teacher) userSession.getUser(); |
return createTeacherBackup(t,userSession); |
return createTeacherBackup(t, userSession); |
} |
public String createLoginStudentActualYearBackup(UserSession userSession) throws ServiceException |
{ |
Student s = (Student) userSession.getUser(); |
return createStudentActualYearBackup(s,userSession); |
return createStudentActualYearBackup(s, userSession); |
} |
public String createLoginTeacherActualYearBackup(UserSession userSession) throws ServiceException |
{ |
Teacher t = (Teacher) userSession.getUser(); |
return createTeacherActualYearBackup(t,userSession); |
return createTeacherActualYearBackup(t, userSession); |
} |
public String createStudentActualYearBackup(long studentId, UserSession userSession) throws ServiceException |
{ |
Student s = DaoFactory.getStudentDaoImpl().get(studentId); |
return createStudentActualYearBackup(s,userSession); |
return createStudentActualYearBackup(s, userSession); |
} |
public String createTeacherActualYearBackup(long teacherId, UserSession userSession) throws ServiceException |
{ |
Teacher t = DaoFactory.getTeacherDaoImpl().get(teacherId); |
return createTeacherActualYearBackup(t,userSession); |
return createTeacherActualYearBackup(t, userSession); |
} |
public String createStudentBackup(long studentId, UserSession userSession) throws ServiceException |
{ |
Student s = DaoFactory.getStudentDaoImpl().get(studentId); |
return createStudentBackup(s,userSession); |
return createStudentBackup(s, userSession); |
} |
public String createTeacherBackup(long teacherId, UserSession userSession) throws ServiceException |
{ |
Teacher t = DaoFactory.getTeacherDaoImpl().get(teacherId); |
return createTeacherBackup(t,userSession); |
return createTeacherBackup(t, userSession); |
} |
private String createStudentActualYearBackup(Student s, UserSession userSession) throws ServiceException |
{ |
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadSubscribedImportYearUnits(s.getId(),DatesUtils.getImportYear()); |
if(units == null || units.size() == 0) |
List<CourseUnit> units = DaoFactory.getCourseUnitDaoImpl().loadSubscribedImportYearUnits(s.getId(), DatesUtils.getImportYear()); |
if (units == null || units.size() == 0) |
return null; |
return createStudentBackup(units,s,userSession); |
return createStudentBackup(units, s, userSession); |
} |
private String createTeacherActualYearBackup(Teacher t, UserSession userSession) throws ServiceException |
{ |
List units = DaoFactory.getCourseUnitDaoImpl().loadTeachedImportYearUnits(t.getId(),DatesUtils.getImportYear()); |
if(units == null || units.size() == 0) |
List units = DaoFactory.getCourseUnitDaoImpl().loadTeachedImportYearUnits(t.getId(), DatesUtils.getImportYear()); |
if (units == null || units.size() == 0) |
return null; |
return createTeacherBackup(units,t,userSession); |
return createTeacherBackup(units, t, userSession); |
} |
private String createStudentBackup(Student s, UserSession userSession) throws ServiceException |
{ |
List<CourseUnit> units = new ArrayList<CourseUnit>(s.getSubscribedUnits()); |
if(units == null || units.size() == 0) |
if (units == null || units.size() == 0) |
return null; |
return createStudentBackup(units,s,userSession); |
return createStudentBackup(units, s, userSession); |
} |
private String createTeacherBackup(Teacher t, UserSession userSession) throws ServiceException |
{ |
List<CourseUnit> units = new ArrayList<CourseUnit>(t.getTeachedUnits()); |
if(units == null || units.size() == 0) |
if (units == null || units.size() == 0) |
return null; |
return createTeacherBackup(units,t,userSession); |
return createTeacherBackup(units, t, userSession); |
} |
private String createStudentBackup(List<CourseUnit> courseUnits, Student s, UserSession userSession) throws ServiceException |
{ |
String tmpName = BytesUtils.generateHexKey(); |
String tmpName = BytesUtils.generateHexKey(); |
String tmpDir = Globals.TMP_DIR + "/" + tmpName; |
new File(tmpDir).mkdirs(); |
240,12 → 236,12 |
{ |
try |
{ |
for(CourseUnit courseUnit: courseUnits) |
for (CourseUnit courseUnit : courseUnits) |
{ |
String courseDirPath = tmpDir + "/" + StringsUtils.normalizeResourceName(courseUnit.getCourse().getName()) + '.' + courseUnit.getCourse().getCode(); |
String courseImportYearPath = courseDirPath + "/" + courseUnit.getImportYear(); |
String semestre; |
if(courseUnit.getSemestre().equals("S1")) |
if (courseUnit.getSemestre().equals("S1")) |
{ |
semestre = Globals.INTRANET_SEMESTRE_S1; |
} |
256,36 → 252,36 |
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName()); |
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName; |
for(CourseUnitAssignement assignement : courseUnit.getAssignements()) |
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) |
createAssignementCopy(assignement, assignementDir, userSession); |
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); |
CourseUnitDeliverable deliverable = DaoFactory.getCourseUnitDeliverableDaoImpl().loadDeliverable(s.getId(), assignement.getId()); |
copyDeliverableVersions(deliverable, assignementDir, userSession); |
} |
} |
} |
} |
catch (IOException e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
} |
FilesUtils.zipFolder(tmpDir,tmpDir + ".zip"); |
FilesUtils.zipFolder(tmpDir, tmpDir + ".zip"); |
FilesUtils.delete(tmpDir); |
return tmpName + ".zip"; |
} |
catch (IOException e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
} |
return null; |
} |
private String createTeacherBackup(List<CourseUnit> courseUnits, Teacher t, UserSession userSession) throws ServiceException |
{ |
String tmpName = BytesUtils.generateHexKey(); |
String tmpName = BytesUtils.generateHexKey(); |
String tmpDir = Globals.TMP_DIR + "/" + tmpName; |
new File(tmpDir).mkdirs(); |
293,12 → 289,12 |
{ |
try |
{ |
for(CourseUnit courseUnit: courseUnits) |
for (CourseUnit courseUnit : courseUnits) |
{ |
String courseDirPath = tmpDir + "/" + StringsUtils.normalizeResourceName(courseUnit.getCourse().getName()) + '.' + courseUnit.getCourse().getCode(); |
String courseImportYearPath = courseDirPath + "/" + courseUnit.getImportYear(); |
String semestre; |
if(courseUnit.getSemestre().equals("S1")) |
if (courseUnit.getSemestre().equals("S1")) |
{ |
semestre = Globals.INTRANET_SEMESTRE_S1; |
} |
309,15 → 305,15 |
String normalizedName = StringsUtils.normalizeResourceName(courseUnit.getName()); |
String unitPath = courseImportYearPath + "/" + semestre + "/" + normalizedName; |
for(CourseUnitAssignement assignement : courseUnit.getAssignements()) |
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) |
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()) |
for (CourseUnitDeliverable deliverable : assignement.getDeliverables()) |
{ |
copyDeliverableVersions(deliverable,assignementDir,userSession); |
copyDeliverableVersions(deliverable, assignementDir, userSession); |
} |
} |
} |
325,15 → 321,15 |
} |
catch (IOException e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
} |
FilesUtils.zipFolder(tmpDir,tmpDir + ".zip"); |
FilesUtils.zipFolder(tmpDir, tmpDir + ".zip"); |
FilesUtils.delete(tmpDir); |
return tmpName + ".zip"; |
} |
catch (IOException e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
} |
return null; |
} |
341,25 → 337,37 |
private void copyDeliverableVersions(CourseUnitDeliverable deliverable, String toDir, UserSession userSession) |
{ |
if(deliverable.getDeliverableRepositoryStream() != null && deliverable.getDeliverableRepositoryStream().length() > 0) |
if (deliverable.getDeliverableRepositoryStream() != null && deliverable.getDeliverableRepositoryStream().length() > 0) |
{ |
String deliverDir = toDir + "/deliverable" + deliverable.getId() + "-" + deliverable.getStudent().getId() + "numero" + deliverable.getStudent().getSigesCode(); |
new File(deliverDir).mkdirs(); |
List<IRepositoryFile> iRepositoryFiles = repositoryService.loadVersions(deliverable.getDeliverableRepositoryStream(),userSession); |
for(IRepositoryFile iRepositoryFile: iRepositoryFiles) |
List<IRepositoryFile> iRepositoryFiles = repositoryService.loadVersions(deliverable.getDeliverableRepositoryStream(), userSession); |
for (IRepositoryFile iRepositoryFile : iRepositoryFiles) |
{ |
try |
{ |
FilesUtils.copy(iRepositoryFile.getInput(),deliverDir + "/version" + StringsUtils.normalizeResourceName(iRepositoryFile.getName())); |
FilesUtils.copy(iRepositoryFile.getInput(), deliverDir + "/version" + getResourceFileName(iRepositoryFile.getName())); |
} |
catch (IOException e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
} |
} |
} |
} |
public String getResourceFileName(String resourceName) |
{ |
String extension = FilesUtils.getExtension(resourceName); |
if (extension != null) |
{ |
resourceName = resourceName.substring(0, resourceName.length() - extension.length()); |
} |
if (extension == null) |
extension = ".unknown"; |
return resourceName + extension; |
} |
private void createAssignementCopy(CourseUnitAssignement assignement, String assignementDir, UserSession userSession) throws IOException |
{ |
String fileContent = buildAssignementTemplate(assignement); |
367,17 → 375,15 |
FileWriter assignementDesc = new FileWriter(assignementDir + "/description.txt"); |
assignementDesc.write(fileContent); |
assignementDesc.close(); |
if(assignement.getRepositoryStream() != null && assignement.getRepositoryStream().length() > 0) |
if (assignement.getRepositoryStream() != null && assignement.getRepositoryStream().length() > 0) |
{ |
IRepositoryFile iRepositoryFile = repositoryService.load(assignement.getRepositoryStream(),userSession); |
FilesUtils.copy(iRepositoryFile.getInput(),assignementDir + "/" + StringsUtils.normalizeResourceName(iRepositoryFile.getName())); |
IRepositoryFile iRepositoryFile = repositoryService.load(assignement.getRepositoryStream(), userSession); |
FilesUtils.copy(iRepositoryFile.getInput(), assignementDir + "/" + getResourceFileName(iRepositoryFile.getName())); |
} |
} |
public String buildAssignementTemplate(CourseUnitAssignement assignement) |
{ |
String assignementDir = StringsUtils.normalizeResourceName(assignement.getTitle()) + assignement.getId(); |
new File(assignementDir).mkdirs(); |
String[] args = new String[] |
{ |
assignement.getCourseUnit().getName(), |
386,16 → 392,15 |
assignement.getDescription() |
}; |
String content = TemplateUtils.getOrLoadTemplate(Globals.TEMPLATE_ASSIGNEMENT_PATH + "/Assignement.txt"); |
// Format the mail message |
// Format the mail message |
return MessageFormat.format(content, args); |
} |
public static void main(String[] args) throws ServiceException |
{ |
AbstractDao.getCurrentSession().beginTransaction(); |
new CreateCourseUnitWorksBackupService().createSystemActualYearBackup(null,null); |
new CreateCourseUnitWorksBackupService().createSystemActualYearBackup(null, null); |
AbstractDao.getCurrentSession().getTransaction().commit(); |
} |
/impl/src/java/pt/estgp/estgweb/services/common/impl/DefaultToDo.java |
---|
19,6 → 19,7 |
private String catKey = null; |
private String from; |
private String to; |
private String catArg0; |
public DefaultToDo(String description, String url) |
43,6 → 44,15 |
this.catKey = catKey; |
this.url = url; |
} |
public DefaultToDo(String description, String to, String from, String catKey,String catArg0, String url) |
{ |
this.description = description; |
this.to = to; |
this.from = from; |
this.catKey = catKey; |
this.url = url; |
this.catArg0 = catArg0; |
} |
public String getDescription() |
{ |
95,7 → 105,10 |
{ |
if(getFrom() == null || getFrom().length() == 0) |
{ |
return "(" + getCatKey() + ")"+ "\t" + getDescription(); |
if(catArg0 == null) |
return "(" + getCatKey() + ")"+ "\t" + getDescription(); |
else |
return "(" + getCatKey() + ")"+ "\t" + getDescription(); |
} |
else |
{ |
119,4 → 132,14 |
{ |
this.to = to; |
} |
public String getCatArg0() |
{ |
return catArg0; |
} |
public void setCatArg0(String catArg0) |
{ |
this.catArg0 = catArg0; |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/common/IToDo.java |
---|
13,6 → 13,7 |
public String getUrl(); |
public String getDescription(); |
public String getCatKey(); |
public String getCatArg0(); |
public String getFrom(); |
public String getTo(); |
public String getLabel(HttpServletRequest request); |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportStudentsService.java |
---|
149,7 → 149,9 |
while (iter.hasNext()) |
{ |
CourseUnit courseUnit = iter.next(); |
if(((StudentImpl)student).isLocalRemovedUnit(courseUnit)) |
//In case of a comming proxy |
StudentImpl sImpl = (StudentImpl) DaoFactory.getStudentDaoImpl().narrow(student); |
if(sImpl.isLocalRemovedUnit(courseUnit)) |
iter.remove(); |
} |
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportTeachersService.java |
---|
1,28 → 1,35 |
package pt.estgp.estgweb.services.sigesimports; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
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.DomainObjectFactory; |
import pt.estgp.estgweb.domain.Teacher; |
import pt.estgp.estgweb.domain.TeacherImpl; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.services.common.CommonServicesManager; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
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.services.logresults.impl.DefaultLogMessage; |
import pt.estgp.estgweb.services.logresults.LogMessageTypeEnum; |
import pt.estgp.estgweb.services.logresults.ILogMessages; |
import pt.estgp.estgweb.services.common.CommonServicesManager; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.utils.DatesUtils; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.domain.*; |
import pt.ipportalegre.siges.web.services.*; |
import org.apache.log4j.Logger; |
import pt.ipportalegre.siges.web.services.ArrayOfDecimal; |
import pt.ipportalegre.siges.web.services.Disciplina; |
import pt.ipportalegre.siges.web.services.Docente; |
import pt.ipportalegre.siges.web.services.SiGesWEB; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import java.util.*; |
import javax.xml.namespace.QName; |
import java.math.BigDecimal; |
import java.net.MalformedURLException; |
import java.net.URL; |
import java.net.MalformedURLException; |
import java.util.HashSet; |
import java.util.Iterator; |
import java.util.List; |
import java.util.Set; |
import jomm.dao.impl.AbstractDao; |
import javax.xml.namespace.QName; |
/** |
* @author Jorge Machado |
* @date 11/May/2008 |
48,7 → 55,7 |
} |
catch (MalformedURLException e) |
{ |
logMessages.addMessage(new DefaultLogMessage("import.error",e.toString(),"erro na configuracao do WEB Service", LogMessageTypeEnum.INFO)); |
logMessages.addMessage(new DefaultLogMessage("import.error", e.toString(), "erro na configuracao do WEB Service", LogMessageTypeEnum.INFO)); |
logger.fatal(e, e); |
return logMessages; |
} |
65,7 → 72,16 |
DaoFactory.getTeacherDaoImpl().save(t); |
newUser = true; |
} |
persist(d, t); |
logger.info("Importing: (" + t.getUsername() + ") " + t.getName()); |
try |
{ |
persist(d, t); |
} |
catch (Exception e) |
{ |
logger.error(e, e); |
throw e; |
} |
if (newUser) |
CommonServicesManager.getInstance().adviseNew(t); |
else |
94,68 → 110,87 |
* |
* @param d docente |
* @param t teacher |
* @throws Exception . |
*/ |
private void persist(Docente d, Teacher t) |
private void persist(Docente d, Teacher t) throws Exception |
{ |
t.setName(d.getNomeFuncionarioInt()); |
t.setEmail(d.getEmail()); |
if(d.getEmail() != null && d.getEmail().endsWith(Globals.EMAIL_LOCAL_SUFFIX)) |
try |
{ |
int atIndex = d.getEmail().indexOf("@"); |
if(atIndex > 0) |
t.setUsername(d.getEmail().substring(0,atIndex)); |
} |
t.setSigesCode(d.getCodigoFuncionario().intValue()); |
t.setAddress(d.getMorada()); |
t.setZip("" + d.getCodigoPostal().intValue()); |
t.setBi(d.getNumeroBi()); |
t.setEmployerName(d.getNomeFuncionario()); |
t.setAcademicName(d.getNomeAcademico()); |
t.setBirthDate(d.getDataNascimento().toGregorianCalendar().getTime()); |
//Desta forma as relacoes antigas sao ignoradas cria-se uma lista nova e atribui-se ao Teacher, o Hibernate faz resto e apaga as chaves estrangeiras antigas |
if (d.getDisciplinas() == null || d.getDisciplinas().getDisciplina() == null || d.getDisciplinas().getDisciplina().size() == 0) |
logger.warn("ATENTION TEACHER WITH ZERO UNITS: codigoFuncionario " + d.getCodigoFuncionario()); |
else |
{ |
Set<CourseUnit> units = new HashSet<CourseUnit>(); |
for (Disciplina disciplina : d.getDisciplinas().getDisciplina()) |
if(t.getName() == null || t.getName().length() == 0) |
t.setName(d.getNomeFuncionarioInt()); |
//Email instituicao |
t.setEmail(d.getEmail()); |
if (d.getEmail() != null && d.getEmail().endsWith(Globals.EMAIL_LOCAL_SUFFIX)) |
{ |
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + disciplina.getCodigo(),"" + disciplina.getCodigoCurso(),"" + disciplina.getCdDuracao(),"" + disciplina.getCdLectivo()); |
int atIndex = d.getEmail().indexOf("@"); |
if (atIndex > 0) |
t.setUsername(d.getEmail().substring(0, atIndex)); |
if(courseUnit == null) |
{ |
logger.warn("Unit not found: semestre:" + disciplina.getCdDuracao() + " codigo:" + disciplina.getCodigo() + " course:" + disciplina.getCodigoCurso() + " year:" + disciplina.getCdLectivo()); |
} |
else |
units.add(courseUnit); |
} |
Iterator<CourseUnit> iter = units.iterator(); |
while (iter.hasNext()) |
t.setSigesCode(d.getCodigoFuncionario().intValue()); |
if(t.getAddress() == null || t.getAddress().length() == 0) |
t.setAddress(d.getMorada()); |
if(t.getZip() == null || t.getZip().length() == 0) |
t.setZip("" + d.getCodigoPostal().intValue()); |
if(t.getBi() == null || t.getBi().length() == 0) |
t.setBi(d.getNumeroBi()); |
t.setEmployerName(d.getNomeFuncionario()); |
t.setAcademicName(d.getNomeAcademico()); |
if(t.getBirthDate() == null || t.getBirthDate().getTime() == 0) |
t.setBirthDate(d.getDataNascimento().toGregorianCalendar().getTime()); |
//Desta forma as relacoes antigas sao ignoradas cria-se uma lista nova e atribui-se ao Teacher, o Hibernate faz resto e apaga as chaves estrangeiras antigas |
if (d.getDisciplinas() == null || d.getDisciplinas().getDisciplina() == null || d.getDisciplinas().getDisciplina().size() == 0) |
logger.warn("ATENTION TEACHER WITH ZERO UNITS: codigoFuncionario " + d.getCodigoFuncionario()); |
else |
{ |
CourseUnit courseUnit = iter.next(); |
if(((TeacherImpl)t).isLocalRemovedUnit(courseUnit)) |
iter.remove(); |
} |
if(t.getTeachedUnits() != null) |
{ |
for(CourseUnit c: units) |
Set<CourseUnit> units = new HashSet<CourseUnit>(); |
for (Disciplina disciplina : d.getDisciplinas().getDisciplina()) |
{ |
boolean isIn = false; |
for(CourseUnit tc : t.getTeachedUnits()) |
CourseUnit courseUnit = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodeUnique("" + disciplina.getCodigo(), "" + disciplina.getCodigoCurso(), "" + disciplina.getCdDuracao(), "" + disciplina.getCdLectivo()); |
if (courseUnit == null) |
{ |
if(tc.equals(c)) |
logger.warn("Unit not found: semestre:" + disciplina.getCdDuracao() + " codigo:" + disciplina.getCodigo() + " course:" + disciplina.getCodigoCurso() + " year:" + disciplina.getCdLectivo()); |
} |
else |
units.add(courseUnit); |
} |
Iterator<CourseUnit> iter = units.iterator(); |
while (iter.hasNext()) |
{ |
CourseUnit courseUnit = iter.next(); |
//In case of a comming proxy |
TeacherImpl tImpl = (TeacherImpl) DaoFactory.getTeacherDaoImpl().narrow(t); |
if (tImpl.isLocalRemovedUnit(courseUnit)) |
iter.remove(); |
} |
if (t.getTeachedUnits() != null) |
{ |
for (CourseUnit c : units) |
{ |
boolean isIn = false; |
for (CourseUnit tc : t.getTeachedUnits()) |
{ |
isIn = true; |
break; |
if (tc.equals(c)) |
{ |
isIn = true; |
break; |
} |
} |
if (!isIn) |
t.getTeachedUnits().add(c); |
} |
if(!isIn) |
t.getTeachedUnits().add(c); |
} |
else |
t.setTeachedUnits(units); |
} |
else |
t.setTeachedUnits(units); |
} |
catch (Exception e) |
{ |
logger.error(e, e); |
throw e; |
} |
} |
/** |
/impl/src/java/pt/estgp/estgweb/services/profile/EditUserService.java |
---|
8,6 → 8,8 |
import pt.estgp.estgweb.domain.DomainObjectFactory; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import pt.estgp.estgweb.services.expceptions.FieldException; |
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException; |
import org.apache.log4j.Logger; |
public class EditUserService implements IService |
18,6 → 20,21 |
public UserView run(UserView userView, String userToCreate, UserSession userSession) throws ServiceException |
{ |
// if (userView.getUsername() == null || user.getPassword() == null || user.getUsername().length() < 4 || user.getPassword().length() < 4) |
// throw new FieldException("bad.fields"); |
User u = DaoFactory.getUserDaoImpl().loadByUsername(userView.getUsername()); |
if (u != null && u.getId() != userView.getId()) |
{ |
throw new AlreadyExistsException(AlreadyExistsException.ALREADY_EXISTS_USERNAME); |
} |
u = DaoFactory.getUserDaoImpl().loadByUsername(userView.getEmail()); |
if (u != null && u.getId() != userView.getId()) |
{ |
throw new AlreadyExistsException(AlreadyExistsException.ALREADY_EXISTS_EMAIL); |
} |
User user; |
if (userView.getId() > 0) |
user = DaoFactory.getUserDaoImpl().get(userView.getSerializable()); |
/impl/src/java/pt/estgp/estgweb/services/profile/SearchUserService.java |
---|
4,8 → 4,11 |
import pt.estgp.estgweb.domain.User; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.domain.dao.DaoUtils; |
import pt.estgp.estgweb.domain.views.UserView; |
import pt.estgp.estgweb.services.common.SearchTypeEnum; |
import org.apache.log4j.Logger; |
import org.hibernate.criterion.Criterion; |
import java.util.List; |
import java.util.ArrayList; |
16,7 → 19,8 |
public List<UserView> run(String textToSearch,String typeToSearch) |
{ |
List<User> users =DaoFactory.getUserDaoImpl().findUsers(textToSearch,typeToSearch); |
List<User> users = DaoFactory.getUserDaoImpl().findUsers(textToSearch,typeToSearch); |
if(users == null) |
return null; |
List<UserView> userViews = new ArrayList<UserView>(); |
/impl/src/java/pt/estgp/estgweb/services/data/RepositoryService.java |
---|
1,10 → 1,7 |
package pt.estgp.estgweb.services.data; |
import pt.utl.ist.berserk.logic.serviceManager.IService; |
import pt.estgp.estgweb.domain.DomainObjectFactory; |
import pt.estgp.estgweb.domain.RepositoryFileImpl; |
import pt.estgp.estgweb.domain.RepositoryFileVersionImpl; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.domain.*; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum; |
import pt.estgp.estgweb.services.data.impl.DefaultRepositoryFile; |
16,6 → 13,10 |
import java.util.List; |
import java.util.ArrayList; |
import org.dom4j.DocumentFactory; |
import org.dom4j.Element; |
import org.dom4j.Document; |
/** |
* @author Jorge Machado |
* @date 4/Jun/2008 |
25,15 → 26,17 |
{ |
/** |
* |
* @param stream |
* @param contentType |
* @param size |
* @param name |
* @param description |
* @param stream . |
* @param contentType . |
* @param size . |
* @param name . |
* @param description . |
* @param extension . |
* @param accessControl . |
* @param userSession . |
* @return the identifier to retrieve the document |
*/ |
public String storeRepositoryFile(InputStream stream, String contentType, String extension,int size, String name, String description, ResourceAccessControlEnum accessControl, UserSession userSession) |
public String storeRepositoryFile(InputStream stream, String contentType, String extension, int size, String name, String description, ResourceAccessControlEnum accessControl, UserSession userSession) |
{ |
RepositoryFileImpl repositoryFile = DomainObjectFactory.createRepositoryFileImpl(); |
repositoryFile.setSaveDate(new Date()); |
49,53 → 52,49 |
repositoryFileVersion.setContentType(contentType); |
repositoryFileVersion.setExtension(extension); |
RepositoryManager.store(stream,repositoryFileVersion.getId()); |
Document dom = createXMLdescription(repositoryFileVersion); |
RepositoryManager.storeDescription(dom, repositoryFileVersion.getId()); |
RepositoryManager.store(stream, repositoryFileVersion.getId()); |
return new StringBuilder().append(repositoryFile.getId()).toString(); |
} |
/** |
* |
* @param stream |
* @param contentType |
* @param size |
* @param name |
* @param description |
* @return the identifier to retrieve the document |
* @param stream . |
* @param contentType . |
* @param size . |
* @param name . |
* @param description . |
* @param identifier . |
* @param extension . |
* @param accessControl . |
*/ |
public void updateRepositoryFile(String identifier, InputStream stream, String contentType, String extension, int size, String name, String description, ResourceAccessControlEnum accessControl) |
{ |
RepositoryFileImpl repositoryFile = (RepositoryFileImpl) DaoFactory.getRepositoryFileDaoImpl().get(Long.parseLong(identifier)); |
repositoryFile.setSaveDate(new Date()); |
repositoryFile.setAccessControl(accessControl.getKey()); |
RepositoryFileVersionImpl repositoryFileVersion = createVersion(repositoryFile); |
repositoryFileVersion.setName(name); |
repositoryFileVersion.setSize(size); |
repositoryFileVersion.setDescription(description); |
repositoryFileVersion.setContentType(contentType); |
repositoryFileVersion.setExtension(extension); |
RepositoryManager.store(stream,repositoryFileVersion.getId()); |
Document dom = createXMLdescription(repositoryFileVersion); |
RepositoryManager.storeDescription(dom, repositoryFileVersion.getId()); |
RepositoryManager.store(stream, repositoryFileVersion.getId()); |
} |
/** |
* |
* @param identifier |
* @param identifier . |
* @return a view of a document |
*/ |
public RepositoryFileImpl loadView(String identifier) |
{ |
RepositoryFileImpl repositoryFile = (RepositoryFileImpl) DaoFactory.getRepositoryFileDaoImpl().get(Long.parseLong(identifier)); |
for(RepositoryFileVersionImpl version: repositoryFile.getRepositoryFileVersions()) |
for (RepositoryFileVersionImpl version : repositoryFile.getRepositoryFileVersions()) |
{ |
version.getSaveDate(); |
} |
103,11 → 102,11 |
} |
/** |
* |
* @param identifier |
* @param identifier . |
* @param userSession . |
* @return a view with an inputStream for document |
*/ |
public IRepositoryFile load(String identifier,UserSession userSession) |
public IRepositoryFile load(String identifier, UserSession userSession) |
{ |
DefaultRepositoryFile iRepositoryFile = new DefaultRepositoryFile(); |
RepositoryFileImpl repositoryFile = (RepositoryFileImpl) DaoFactory.getRepositoryFileDaoImpl().load(Long.parseLong(identifier)); |
119,15 → 118,15 |
} |
/** |
* |
* @param identifier |
* @param identifier . |
* @param userSession . |
* @return a view with an inputStream for document |
*/ |
public List<IRepositoryFile> loadVersions(String identifier,UserSession userSession) |
public List<IRepositoryFile> loadVersions(String identifier, UserSession userSession) |
{ |
RepositoryFileImpl repositoryFile = (RepositoryFileImpl) DaoFactory.getRepositoryFileDaoImpl().load(Long.parseLong(identifier)); |
List<IRepositoryFile> versions = new ArrayList<IRepositoryFile>(); |
for(RepositoryFileVersionImpl version : repositoryFile.getRepositoryFileVersions()) |
for (RepositoryFileVersionImpl version : repositoryFile.getRepositoryFileVersions()) |
{ |
DefaultRepositoryFile iRepositoryFile = new DefaultRepositoryFile(); |
iRepositoryFile.setContentType(version.getContentType()); |
141,18 → 140,141 |
/** |
* Create a new File Version |
* @param repositoryFile |
* @return |
* |
* @param repositoryFile . |
* @return . |
*/ |
private RepositoryFileVersionImpl createVersion(RepositoryFileImpl repositoryFile) |
{ |
RepositoryFileVersionImpl repositoryFileVersion = DomainObjectFactory.createRepositoryFileVersionImpl(); |
repositoryFileVersion.setRepositoryFile(repositoryFile); |
if(repositoryFile.getRepositoryFileVersions() == null) |
if (repositoryFile.getRepositoryFileVersions() == null) |
repositoryFile.setRepositoryFileVersions(new HashSet<RepositoryFileVersionImpl>()); |
repositoryFile.getRepositoryFileVersions().add(repositoryFileVersion); |
repositoryFile.setLastVersion(repositoryFileVersion); |
DaoFactory.getRepositoryFileVersionDaoImpl().save(repositoryFileVersion); |
return repositoryFileVersion; |
} |
public static Document createXMLdescription(RepositoryFileVersionImpl repositoryFile) |
{ |
org.dom4j.Document dom = DocumentFactory.getInstance().createDocument(); |
Element rootElement = DocumentFactory.getInstance().createElement("repositoryFileVersion"); |
dom.setRootElement(rootElement); |
rootElement.addAttribute("id", "" + repositoryFile.getId()); |
Element saveDate = DocumentFactory.getInstance().createElement("saveDate"); |
saveDate.setText(""+DatesUtils.getStringFromDateForFilename(repositoryFile.getSaveDate())); |
Element name = DocumentFactory.getInstance().createElement("name"); |
name.setText("" + repositoryFile.getName()); |
Element contentType = DocumentFactory.getInstance().createElement("contentType"); |
contentType.setText(""+repositoryFile.getContentType()); |
Element extension = DocumentFactory.getInstance().createElement("extension"); |
extension.setText("" + repositoryFile.getExtension()); |
Element size = DocumentFactory.getInstance().createElement("sizeKb"); |
size.setText("" + repositoryFile.getSizeKb()); |
Element description = DocumentFactory.getInstance().createElement("description"); |
description.setText(repositoryFile.getDescription()); |
rootElement.add(saveDate); |
rootElement.add(name); |
rootElement.add(contentType); |
rootElement.add(extension); |
rootElement.add(size); |
rootElement.add(description); |
//Repository File Generics |
Element repositoryFileElem = DocumentFactory.getInstance().createElement("repositoryFile"); |
rootElement.add(repositoryFileElem); |
repositoryFileElem.addAttribute("id", "" + repositoryFile.getRepositoryFile().getId()); |
Element rSaveDate = DocumentFactory.getInstance().createElement("saveDate"); |
rSaveDate.setText(""+DatesUtils.getStringFromDateForFilename(repositoryFile.getRepositoryFile().getSaveDate())); |
Element rUpdateDate = DocumentFactory.getInstance().createElement("updateDate"); |
rUpdateDate.setText(""+DatesUtils.getStringFromDateForFilename(repositoryFile.getRepositoryFile().getUpdateDate())); |
Element accessControl = DocumentFactory.getInstance().createElement("accessControl"); |
accessControl.setText(repositoryFile.getRepositoryFile().getAccessControl()); |
Element deleted = DocumentFactory.getInstance().createElement("deleted"); |
deleted.setText("" + repositoryFile.getRepositoryFile().isDeleted()); |
repositoryFileElem.add(rSaveDate); |
repositoryFileElem.add(rUpdateDate); |
repositoryFileElem.add(accessControl); |
repositoryFileElem.add(deleted); |
Element owner = DocumentFactory.getInstance().createElement("owner"); |
repositoryFileElem.add(owner); |
owner.addAttribute("id", "" + repositoryFile.getRepositoryFile().getOwner().getId()); |
if (repositoryFile.getRepositoryFile().getOwner().getName() != null) |
{ |
Element oName = DocumentFactory.getInstance().createElement("name"); |
oName.setText(repositoryFile.getRepositoryFile().getOwner().getName()); |
owner.add(oName); |
} |
if (DocumentFactory.getInstance().createElement("roles") != null) |
{ |
Element oRoles = DocumentFactory.getInstance().createElement("roles"); |
oRoles.setText(repositoryFile.getRepositoryFile().getOwner().getRoles()); |
owner.add(oRoles); |
} |
Element oClass = DocumentFactory.getInstance().createElement("class"); |
oClass.setText(repositoryFile.getRepositoryFile().getOwner().getClass().getSimpleName()); |
owner.add(oClass); |
if (repositoryFile.getRepositoryFile().getOwner() instanceof User) |
{ |
Element oUsername = DocumentFactory.getInstance().createElement("username"); |
oUsername.setText(((User) repositoryFile.getRepositoryFile().getOwner()).getUsername()); |
owner.add(oUsername); |
if (((User) repositoryFile.getRepositoryFile().getOwner()).getEmail() != null) |
{ |
Element oEmail = DocumentFactory.getInstance().createElement("email"); |
oEmail.setText(((User) repositoryFile.getRepositoryFile().getOwner()).getEmail()); |
owner.add(oEmail); |
} |
if (((User) repositoryFile.getRepositoryFile().getOwner()).getOutEmail() != null) |
{ |
Element outEmail = DocumentFactory.getInstance().createElement("outEmail"); |
outEmail.setText(((User) repositoryFile.getRepositoryFile().getOwner()).getOutEmail()); |
owner.add(outEmail); |
} |
if (((User) repositoryFile.getRepositoryFile().getOwner()).getBi() != null) |
{ |
Element biEmail = DocumentFactory.getInstance().createElement("bi"); |
biEmail.setText(((User) repositoryFile.getRepositoryFile().getOwner()).getBi()); |
owner.add(biEmail); |
} |
if (repositoryFile.getRepositoryFile().getOwner() instanceof Teacher) |
{ |
Element code = DocumentFactory.getInstance().createElement("teacherCode"); |
code.setText("" + ((Teacher) repositoryFile.getRepositoryFile().getOwner()).getSigesCode()); |
owner.add(code); |
} |
if (repositoryFile.getRepositoryFile().getOwner() instanceof Student) |
{ |
Element code = DocumentFactory.getInstance().createElement("studentCode"); |
code.setText("" + ((Student) repositoryFile.getRepositoryFile().getOwner()).getSigesCode()); |
owner.add(code); |
} |
} |
return dom; |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/data/ResourceManager.java |
---|
1,12 → 1,12 |
package pt.estgp.estgweb.services.data; |
import jomm.utils.StreamsUtils; |
import org.dom4j.Document; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.utils.Dom4jUtil; |
import java.io.*; |
import jomm.utils.StreamsUtils; |
import org.apache.log4j.Logger; |
/** |
* @author Jorge Machado |
* @date 28/Mai/2008 |
15,14 → 15,25 |
public class ResourceManager |
{ |
public static final int DOCS_IN_PATH = 1000; |
public static final int DOCS_FIRST_DIR_LEN = 20; |
public static final int DOCS_IN_PATH_LEVEL1 = DOCS_IN_PATH * DOCS_IN_PATH; |
public static final int DOCS_IN_PATH_LEVEL2 = DOCS_IN_PATH * DOCS_IN_PATH * DOCS_IN_PATH; |
public static final int DOCS_FIRST_DIR_LEN = 10; |
public static void saveResource(InputStream stream, String resourcePath, long id) throws IOException |
{ |
StreamsUtils.inputStream2File(stream, new File(Globals.DATA_DIR + resourcePath + getDocumentPathById(id))); |
} |
public static void saveResource(Document dom, String resourcePath, long id) throws IOException |
{ |
new File(Globals.DATA_DIR + resourcePath + getDocumentPathById(id)+".xml").getParentFile().mkdirs(); |
Dom4jUtil.write(dom,Globals.DATA_DIR + resourcePath + getDocumentPathById(id)+".xml"); |
} |
public static InputStream getResource(String resourcePath, long id) throws FileNotFoundException |
{ |
return new FileInputStream(Globals.DATA_DIR + resourcePath + getDocumentPathById(id)); |
49,14 → 60,33 |
public static String getDocumentPathById(long id) |
{ |
char[] dir = new char[DOCS_FIRST_DIR_LEN]; |
setAllChars('0', dir); |
long dirNumber = id / DOCS_IN_PATH; |
dirNumber = dirNumber * DOCS_IN_PATH; |
String dirNumberStr = "" + dirNumber; |
copyCharsToArray(dir, dirNumberStr); |
dirNumberStr = new String(dir); |
return "/" + dirNumberStr + "/" + id; |
char[] dir0 = new char[DOCS_FIRST_DIR_LEN]; |
setAllChars('0', dir0); |
char[] dir1 = new char[DOCS_FIRST_DIR_LEN]; |
setAllChars('0', dir1); |
char[] dir2 = new char[DOCS_FIRST_DIR_LEN]; |
setAllChars('0', dir2); |
long dirNumber0 = id / DOCS_IN_PATH_LEVEL2; |
long dirNumber1 = id / DOCS_IN_PATH_LEVEL1; |
long dirNumber2 = id / DOCS_IN_PATH; |
dirNumber0 = dirNumber0 * DOCS_IN_PATH_LEVEL2; |
dirNumber1 = dirNumber1 * DOCS_IN_PATH_LEVEL1; |
dirNumber2 = dirNumber2 * DOCS_IN_PATH; |
String dirNumberStr0 = "" + dirNumber0; |
String dirNumberStr1 = "" + dirNumber1; |
String dirNumberStr2 = "" + dirNumber2; |
copyCharsToArray(dir0, dirNumberStr0); |
copyCharsToArray(dir1, dirNumberStr1); |
copyCharsToArray(dir2, dirNumberStr2); |
dirNumberStr0 = new String(dir0); |
dirNumberStr1 = new String(dir1); |
dirNumberStr2 = new String(dir2); |
return "/" + dirNumberStr0 + "/" + dirNumberStr1 + "/" + dirNumberStr2 + "/" + id; |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/data/RepositoryManager.java |
---|
1,6 → 1,7 |
package pt.estgp.estgweb.services.data; |
import org.apache.log4j.Logger; |
import org.dom4j.Document; |
import pt.estgp.estgweb.domain.Image; |
import java.io.ByteArrayInputStream; |
32,6 → 33,20 |
return false; |
} |
public static boolean storeDescription(Document dom, long identifier) |
{ |
try |
{ |
ResourceManager.saveResource(dom, RESOURCE_PATH, identifier); |
return true; |
} |
catch (IOException e) |
{ |
logger.error(e,e); |
} |
return false; |
} |
public static InputStream load(long identifier) |
{ |
try |
/impl/src/java/pt/estgp/estgweb/services/data/CreateDescriptionsXML.java |
---|
New file |
0,0 → 1,34 |
package pt.estgp.estgweb.services.data; |
import jomm.dao.impl.AbstractDao; |
import pt.estgp.estgweb.domain.dao.impl.RepositoryFileDao; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.domain.RepositoryFileVersion; |
import pt.estgp.estgweb.domain.RepositoryFileVersionImpl; |
import java.util.List; |
import org.dom4j.Document; |
import org.apache.log4j.Logger; |
/** |
* @author Jorge Machado |
* @date 23/Out/2008 |
* @see pt.estgp.estgweb.services.data |
*/ |
public class CreateDescriptionsXML |
{ |
private static final Logger logger = Logger.getLogger(CreateDescriptionsXML.class); |
public static void main(String[]args) |
{ |
AbstractDao.getCurrentSession().beginTransaction(); |
List<RepositoryFileVersion> repoList = AbstractDao.getCurrentSession().createCriteria(RepositoryFileVersion.class).list(); |
for(RepositoryFileVersion repositoryFileVersion: repoList) |
{ |
logger.info("Creating description for file:" + repositoryFileVersion.getId() + ":" + repositoryFileVersion.getName()); |
Document dom = RepositoryService.createXMLdescription((RepositoryFileVersionImpl) repositoryFileVersion); |
RepositoryManager.storeDescription(dom, repositoryFileVersion.getId()); |
} |
AbstractDao.getCurrentSession().getTransaction().commit(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/services/announcements/CreateAnnouncementService.java |
---|
131,6 → 131,8 |
logger.info("ImageSmall form announcement:" + announcementView.getId() + "do not exist!"); |
} |
} |
if(a.getOwner().getId() != userSession.getUser().getId()) |
announcementView.setChoosedOwnerRole(a.getChoosedOwnerRole()); |
announcementView.persistViewInObject(a); |
if(announcementView.getTargetRoles() == null || announcementView.getTargetRoles().size() == 0) |
a.setTargetRoles(ALL_ROLE); |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/TeacherDaoImpl.java |
---|
3,7 → 3,9 |
import pt.estgp.estgweb.domain.Teacher; |
import pt.estgp.estgweb.domain.CourseUnit; |
import pt.estgp.estgweb.domain.CourseUnitImpl; |
import pt.estgp.estgweb.domain.TeacherImpl; |
import static org.hibernate.criterion.Restrictions.*; |
import org.hibernate.exception.GenericJDBCException; |
import java.util.List; |
17,6 → 19,10 |
{ |
private TeacherDaoImpl(){} |
// protected Class getReferenceClass() { |
// return TeacherImpl.class; |
// } |
public static TeacherDaoImpl getInstance() |
{ |
if (myInstance == null) |
26,7 → 32,14 |
public Teacher loadBySigesCode(int sigesCode) |
{ |
return (Teacher) createCriteria().add(eq("sigesCode",sigesCode)).uniqueResult(); |
try |
{ |
return (Teacher) createCriteria().add(eq("sigesCode",sigesCode)).uniqueResult(); |
} |
catch(GenericJDBCException e) |
{ |
throw e; |
} |
} |
public Teacher loadByBi(String bi) |
34,7 → 47,7 |
return (Teacher) createCriteria().add(eq("bi",bi)).uniqueResult(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/UserDaoImpl.java |
---|
1,27 → 1,20 |
package pt.estgp.estgweb.domain.dao.impl; |
import jomm.dao.DaoException; |
import org.hibernate.HibernateException; |
import org.hibernate.Query; |
import org.hibernate.Hibernate; |
import org.apache.log4j.Logger; |
import org.hibernate.Criteria; |
import static org.hibernate.criterion.Restrictions.*; |
import org.hibernate.HibernateException; |
import org.hibernate.criterion.Criterion; |
import org.hibernate.criterion.SimpleExpression; |
import org.hibernate.criterion.Order; |
import org.apache.log4j.Logger; |
import java.util.List; |
import java.util.Date; |
import java.io.Serializable; |
import static org.hibernate.criterion.Restrictions.*; |
import pt.estgp.estgweb.domain.User; |
import pt.estgp.estgweb.domain.Announcement; |
import pt.estgp.estgweb.domain.CourseUnit; |
import pt.estgp.estgweb.domain.dao.DaoUtils; |
import pt.estgp.estgweb.services.common.SearchTypeEnum; |
import java.io.Serializable; |
import java.util.Date; |
import java.util.List; |
/** |
* @author Jorge Machado |
* @date 28/Fev/2008 |
53,11 → 46,11 |
{ |
List list = |
createCriteria() |
.add(eq("username",username)) |
.add(eq("username", username)) |
.setMaxResults(1) |
.list(); |
if(list.size() == 0) |
if (list.size() == 0) |
return null; |
return (User) list.get(0); |
} |
66,6 → 59,7 |
throw new DaoException(e); |
} |
} |
/** |
* Used by the base DAO classes but here for your modification Load object |
* matching the given key and return it. |
78,7 → 72,7 |
try |
{ |
return (User) createCriteria() |
.add(eq("email",email)) |
.add(eq("email", email)) |
.uniqueResult(); |
} |
catch (HibernateException e) |
99,7 → 93,7 |
try |
{ |
return (User) createCriteria() |
.add(eq("id",ID)) |
.add(eq("id", ID)) |
.uniqueResult(); |
} |
catch (HibernateException e) |
121,7 → 115,7 |
try |
{ |
return (User) createCriteria() |
.add(eq("username",username)) |
.add(eq("username", username)) |
.add(eq("password", jomm.utils.BytesUtils.getDigestMD5Hex(password))) |
.uniqueResult(); |
} |
131,52 → 125,49 |
} |
} |
public List<User> loadRoleUsers (String role) |
public List<User> loadRoleUsers(String role) |
{ |
return createCriteria().add(like("roles","%" + role + "%")).addOrder(Order.asc("name")).list(); |
return createCriteria().add(like("roles", "%" + role + "%")).addOrder(Order.asc("name")).list(); |
} |
public List<User> findUsers (String textToSearch) |
public List<User> findUsers(String textToSearch) |
{ |
return findUsers(textToSearch,null); |
return findUsers(textToSearch, null); |
} |
public List<User> findUsers (String textToSearch,String typeToSearch) |
public List<User> findUsers(String textToSearch, String typeToSearch) |
{ |
Criteria criteria=null; |
if(typeToSearch!=null && typeToSearch.trim().length()!=0) |
{ |
Criteria criteria; |
if (typeToSearch != null && typeToSearch.trim().length() != 0) |
try |
{ |
criteria = createCriteria(Class.forName(typeToSearch)); |
} |
catch (ClassNotFoundException e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
return null; |
} |
} |
else |
{ |
criteria=createCriteria(); |
} |
Criterion name= or(like("name","%"+textToSearch+"%"),like("name","%"+textToSearch+"%")); |
Criterion username = or(like("username", "%" + textToSearch + "%"), like("username", "%" + textToSearch + "%")); |
Criterion email = or(like("email", "%" + textToSearch + "%"), like("email", "%" + textToSearch + "%")); |
criteria.add(or(or(name,username),email)) |
.addOrder(Order.desc("name")); |
return criteria.list(); |
criteria = createCriteria(); |
Criterion textSearch = DaoUtils.createSearchQuery(textToSearch, SearchTypeEnum.parse(typeToSearch), "name", "username"); |
Criterion text2Search = DaoUtils.createSearchQuery(textToSearch, SearchTypeEnum.parse(typeToSearch), "email"); |
Criterion fields = or(textSearch, text2Search); |
return criteria.add(fields) |
.addOrder(Order.desc("name")) |
.list(); |
} |
public Serializable save(User obj) |
{ |
try { |
try |
{ |
obj.setSaveDate(new Date()); |
return super.save(obj); |
} |
catch (HibernateException e) { |
catch (HibernateException e) |
{ |
throw new DaoException(e); |
} |
184,7 → 175,7 |
public int countUsers(String query, SearchTypeEnum searchType) |
{ |
Criterion c = DaoUtils.createSearchQuery(query,searchType,"name","username"); |
Criterion c = DaoUtils.createSearchQuery(query, searchType, "name", "username"); |
return createCriteria() |
.add(c) |
.list().size(); |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/AnnouncementDaoImpl.java |
---|
131,8 → 131,25 |
{ |
coSubTargets = eq("subTargets", subTarget); |
} |
if (type != null) |
criteria.add(eq("type", type)); |
{ |
String[] types = type.split(","); |
if(types.length == 1) |
criteria.add(eq("type", type)); |
else if(types.length > 1) |
{ |
Criterion orCriteron = null; |
for(String typeAux: types) |
{ |
if(orCriteron == null) |
orCriteron = eq("type", typeAux); |
else |
orCriteron = or(orCriteron,eq("type",typeAux)); |
} |
criteria.add(orCriteron); |
} |
} |
if (!internal) |
criteria.add(eq("internal", false)); |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseUnitDaoImpl.java |
---|
62,7 → 62,7 |
.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)) |
183,6 → 183,7 |
.add(eq("importYear", DatesUtils.getImportYear())) |
.add((or(isNull("objectives"),eq("objectives","")))) |
.createAlias("teachers", "th") |
.add(eq("semestre",DatesUtils.getSemestre())) |
.add(eq("th.id",teacherId)) |
.list(); |
} |
194,17 → 195,31 |
.add(eq("importYear", DatesUtils.getImportYear())) |
.add((or(isNull("programStreamId"),eq("programStreamId","")))) |
.createAlias("teachers", "th") |
.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() |
.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)) |
.list(); |
} |
public List<CourseUnit> loadMissingObjectivesGivenCourse(long courseId) |
{ |
return createCriteria() |
.createAlias("course", "c") |
.add(eq("c.id",courseId)) |
.add(eq("importYear", DatesUtils.getImportYear())) |
.add(eq("semestre",DatesUtils.getSemestre())) |
.add((or(isNull("objectives"),eq("objectives","")))) |
.list(); |
} |
215,6 → 230,7 |
.createAlias("course", "c") |
.add(eq("c.id",courseId)) |
.add(eq("importYear", DatesUtils.getImportYear())) |
.add(eq("semestre",DatesUtils.getSemestre())) |
.add((or(isNull("programStreamId"),eq("programStreamId","")))) |
.list(); |
} |
225,12 → 241,22 |
.createAlias("course", "c") |
.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",""))))) |
.list(); |
} |
public int countMissingProgramGivenCourse(long courseId) |
{ |
return loadMissingProgramGivenCourse(courseId).size(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/dao/DaoUtils.java |
---|
43,4 → 43,34 |
} |
return c; |
} |
public static Criterion createSearchQuery(String query, SearchTypeEnum searchTypeEnum, String field1) |
{ |
Criterion c = null; |
if (searchTypeEnum == SearchTypeEnum.ExactPhrase) |
c = like(field1, "%" + query + "%"); |
else if (searchTypeEnum == SearchTypeEnum.AllWords) |
{ |
String[] fields = query.split(" "); |
for (String field : fields) |
{ |
if (c == null) |
c = like(field1, "%" + field + "%"); |
else |
c = and(c, like(field1, "%" + field + "%")); |
} |
} |
else |
{ |
String[] fields = query.split(" "); |
for (String field : fields) |
{ |
if (c == null) |
c = like(field1, "%" + field + "%"); |
else |
c = or(c,like(field1, "%" + field + "%")); |
} |
} |
return c; |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/TeacherImpl.java |
---|
34,8 → 34,15 |
setScholarDegree(Globals.PROFILE_SCHOLAR_DEGREE_SUPERIOR); |
} |
public String getManagedRole() { |
return TEACHER_ROLE; |
public String getManagedRole() |
{ |
List<String> roles = new ArrayList<String>(); |
if(getDirectorCourses() != null && getDirectorCourses().size() > 0) |
roles.add(Globals.COURSE_DIRECTOR_ROLE); |
if(getCoordinatorCourses() != null && getCoordinatorCourses().size() > 0) |
roles.add(Globals.COURSE_COORDINATOR_ROLE); |
roles.add(TEACHER_ROLE); |
return RoleManager.getSerialRoles(roles); |
} |
public List<Course> getTeachedCoursesView() |
/impl/src/java/pt/estgp/estgweb/domain/UserManagedRoleImpl.java |
---|
4,11 → 4,13 |
import java.util.*; |
import pt.estgp.estgweb.utils.RoleManager; |
public abstract class UserManagedRoleImpl extends UserImpl |
{ |
public static List<CourseUnit> getUnitsSemestre(String semestre, List<CourseUnit> s1) |
public static List<CourseUnit> getUnitsSemestre(String semestre, List<CourseUnit> s1) |
{ |
if(s1 != null) |
{ |
24,12 → 26,12 |
} |
return s1; |
} |
public UserManagedRoleImpl() |
{ |
} |
/** |
* |
* @return the managed role of implementation object |
42,14 → 44,23 |
*/ |
public String getRoles() |
{ |
if(super.getRoles() == null) |
super.setRoles(getManagedRole()); |
else if(super.getRoles().indexOf(getManagedRole()) < 0) |
String managedRole = getManagedRole(); |
if(managedRole != null) |
{ |
addRole(getManagedRole()); |
if(super.getRoles() == null) |
super.setRoles(getManagedRole()); |
else |
{ |
List<String> roles = RoleManager.getRolesFromSerial(managedRole); |
for(String role:roles) |
{ |
if(super.getRoles().indexOf(role) < 0) |
{ |
addRole(getManagedRole()); |
} |
} |
} |
} |
return super.getRoles(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/views/BlogPostView.java |
---|
1,6 → 1,7 |
package pt.estgp.estgweb.domain.views; |
import pt.estgp.estgweb.domain.*; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.utils.ConfigProperties; |
import pt.estgp.estgweb.utils.RoleManager; |
import org.apache.log4j.Logger; |
8,6 → 9,8 |
import java.util.List; |
import java.io.Serializable; |
import jomm.utils.StringsUtils; |
/** |
* @author Jorge Machado |
* @date 2/Mar/2008 |
26,6 → 29,9 |
private String text; |
private Image image; |
private GenericUser owner; |
private String ownerUsername; |
private String ownerName; |
private String ownerEmail; |
private boolean status; |
private BlogPost blogPost; |
private long blogId; |
45,6 → 51,9 |
this.status = blogPost.isStatus(); |
this.id = blogPost.getId(); |
this.owner = blogPost.getOwner(); |
ownerUsername = owner.getUsername(); |
ownerName = owner.getName(); |
ownerEmail = owner.getEmail(); |
this.blogId = blogPost.getBlog().getId(); |
this.internal = blogPost.getBlog().isInternal(); |
} |
114,6 → 123,11 |
return title; |
} |
public String getFormatedTitle() |
{ |
return StringsUtils.getEscapeHtmlText(title); |
} |
public void setTitle(String title) |
{ |
this.title = title; |
124,6 → 138,11 |
return text; |
} |
public String getFormatedText() |
{ |
return StringsUtils.getFormatedText(text); |
} |
public void setText(String text) |
{ |
this.text = text; |
176,20 → 195,19 |
public String getOwnerEmail() |
{ |
if (owner instanceof User) |
return ((User) owner).getEmail(); |
else |
return null; |
return ownerEmail; |
} |
public String getOwnerUsername() |
{ |
if (owner instanceof User) |
return ((User) owner).getUsername(); |
else |
return null; |
return ownerUsername; |
} |
public String getOwnerName() |
{ |
return ownerName; |
} |
public boolean isInternal() |
{ |
return internal; |
/impl/src/java/pt/estgp/estgweb/domain/views/AnnouncementView.java |
---|
14,6 → 14,8 |
import org.apache.log4j.Logger; |
import jomm.utils.StringsUtils; |
import javax.servlet.http.HttpServletRequest; |
/** |
* @author Jorge Machado |
* @date 2/Mar/2008 |
46,6 → 48,9 |
private boolean status = true; |
private boolean internal; |
private GenericUser owner; |
private String ownerUsername; |
private String ownerName; |
private String ownerEmail; |
private String style; |
private String internalUrlServer; |
private String internalUrlPath; |
70,8 → 75,6 |
} |
public void init(Announcement announcement) |
{ |
this.announcement = announcement; |
this.title = announcement.getTitle(); |
this.text = announcement.getText(); |
81,8 → 84,8 |
this.bigImageId = announcement.getBigImage().getId(); |
if(announcement.getSmallImage() != null) |
this.smallImageId = announcement.getSmallImage().getId(); |
this.url =announcement.getUrl(); |
this.type =announcement.getType(); |
this.url = announcement.getUrl(); |
this.type = announcement.getType(); |
this.targetRoles = RoleManager.getRolesFromSerial(announcement.getTargetRoles()); |
this.status=announcement.isStatus(); |
this.id = announcement.getId(); |
91,6 → 94,9 |
this.expireDate = announcement.getExpireDate(); |
this.choosedOwnerRole = announcement.getChoosedOwnerRole(); |
this.owner = announcement.getOwner(); |
this.ownerUsername = owner.getUsername(); |
this.ownerName = owner.getName(); |
this.ownerEmail = owner.getEmail(); |
this.internalUrlServer = announcement.getInternalUrlServer(); |
this.internalUrlPath = announcement.getInternalUrlPath(); |
this.style = announcement.getStyle(); |
130,7 → 136,7 |
((CourseUnitAnnouncement)announcement).setCourseUnitInternal(courseUnitInternal); |
} |
} |
public boolean isCourseUnitInternal() |
{ |
return courseUnitInternal; |
308,6 → 314,14 |
return url; |
} |
public String getUrl(HttpServletRequest request) { |
if(url != null && url.startsWith("/")) |
return request.getContextPath() + url; |
else |
return url; |
} |
public void setUrl(String url) { |
this.url = url; |
} |
359,6 → 373,8 |
public Boolean getHaveAllText() |
{ |
if(getInternalUrlPath() != null) |
return false; |
if(getType().equals("top.flash.news")) |
{ |
return getText().length() > TEXT_SUMMARY_SIZE; |
414,4 → 430,19 |
return ((AnnouncementImpl)announcement).canLoadInOpenTransaction(u); |
} |
public String getOwnerUsername() |
{ |
return ownerUsername; |
} |
public String getOwnerName() |
{ |
return ownerName; |
} |
public String getOwnerEmail() |
{ |
return ownerEmail; |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitAssignementView.java |
---|
10,6 → 10,8 |
import java.util.List; |
import java.util.Date; |
import jomm.utils.StringsUtils; |
/** |
* @author Jorge Machado |
* @date 2/Mar/2008 |
165,6 → 167,11 |
return description; |
} |
public String getFormatedDescription() |
{ |
return StringsUtils.getFormatedText(description); |
} |
public void setDescription(String description) |
{ |
this.description = description; |
222,9 → 229,11 |
this.courseUnitDeliverableView = courseUnitDeliverableView; |
} |
private static final long milisecondsof24Hours=24*60*60*1000; |
public boolean isActive() |
{ |
return courseUnitAssignement.getDeliverDate() != null && courseUnitAssignement.getDeliverDate().getTime() >= System.currentTimeMillis(); |
return courseUnitAssignement.getDeliverDate() != null && courseUnitAssignement.getDeliverDate().getTime() + milisecondsof24Hours >= System.currentTimeMillis(); |
} |
256,7 → 265,7 |
userSession.getUser() != null && |
((UserImpl) userSession.getUser()).isInCourseUnit(courseUnitId) && |
!deliverType.equals(Globals.COURSEUNIT_ASSIGNEMENT_TYPE_NO_FILE) && |
(lateDelivers || courseUnitAssignement.getDeliverDate().getTime() >= System.currentTimeMillis()); |
(lateDelivers || courseUnitAssignement.getDeliverDate().getTime() + milisecondsof24Hours >= System.currentTimeMillis()); |
} |
public boolean isLateDeliver() |
/impl/src/java/pt/estgp/estgweb/domain/views/UserView.java |
---|
360,9 → 360,10 |
public String getSafeEmail() |
{ |
String email = username + "@" + Globals.EMAIL_LOCAL_SUFFIX; |
if(email != null) |
{ |
String safe =email.replace("@", " [ AT ] ").replace("."," [ DOT ] "); |
String safe = email.replace("@", " [ AT ] ").replace("."," [ DOT ] "); |
StringBuilder result = new StringBuilder(); |
result.append("<script type=\"text/javascript\" language=\"JavaScript\">\n"); |
for(int i = 0;i< safe.length();i++) |
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitDeliverableView.java |
---|
148,8 → 148,10 |
this.deliverDateStr = deliverDateStr; |
} |
private static final long milisecondsof24Hours=24*60*60*1000; |
public boolean isLateDeliver() |
{ |
return getDeliverDate().getTime() > courseUnitAssignementView.getDeliverDateDate().getTime(); |
return getDeliverDate().getTime() > milisecondsof24Hours + courseUnitAssignementView.getDeliverDateDate().getTime(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitView.java |
---|
44,6 → 44,8 |
private String objectives; |
private String programStreamId; |
private boolean validProgram; |
private UserView validatorUser; |
private int programSize; |
private String extension; |
private List<CourseUnitAssignementView> courseUnitAssignements; |
68,29 → 70,35 |
public CourseUnitView(CourseUnit courseUnit, boolean initTeachers, boolean initStudents ) |
{ |
super(courseUnit); |
init(courseUnit, initTeachers, initStudents,false); |
init(courseUnit, initTeachers, initStudents,false,false); |
} |
public CourseUnitView(CourseUnit courseUnit, boolean initTeachers, boolean initStudents, boolean initBlog ) |
{ |
super(courseUnit); |
init(courseUnit, initTeachers, initStudents, initBlog); |
init(courseUnit, initTeachers, initStudents, initBlog,false); |
} |
public CourseUnitView(CourseUnit courseUnit, boolean initTeachers, boolean initStudents, boolean initBlog, boolean validatorPerson ) |
{ |
super(courseUnit); |
init(courseUnit, initTeachers, initStudents, initBlog, validatorPerson); |
} |
public CourseUnitView(CourseUnit courseUnit) |
{ |
super(courseUnit); |
init(courseUnit, false,false,false); |
init(courseUnit, false,false,false,false); |
} |
public CourseUnitView(CourseUnit courseUnit, BlogView b) |
{ |
super(courseUnit); |
this.blog = b; |
init(courseUnit, false,false,false); |
init(courseUnit, false,false,false,false); |
} |
private void init(CourseUnit courseUnit, boolean initTeachers, boolean initStudents, boolean initBlog) |
private void init(CourseUnit courseUnit, boolean initTeachers, boolean initStudents, boolean initBlog, boolean validatorUser) |
{ |
this.pathIntranet = courseUnit.getPathIntranet(); |
this.normalizedName = courseUnit.getNormalizedName(); |
103,7 → 111,16 |
this.courseCode = courseUnit.getCourseCode(); |
this.objectives = courseUnit.getObjectives(); |
if(courseUnit.getProgramStreamId() != null) |
{ |
programStreamId = courseUnit.getProgramStreamId(); |
validProgram = courseUnit.isValidProgram(); |
if(validatorUser) |
{ |
if(courseUnit.getValidatorUser() != null) |
this.validatorUser = new UserView(courseUnit.getValidatorUser()); |
} |
} |
// if(courseUnit.getBlog() != null) |
// this.blog = new BlogView(courseUnit.getBlog()); |
this.id = courseUnit.getId(); |
133,6 → 150,7 |
{ |
courseId = courseUnit.getCourse().getId(); |
} |
} |
public long getCourseId() |
293,6 → 311,11 |
public String getSemestre() |
{ |
if(semestre == null) |
{ |
logger.error("Unit" + getId() + " " + getName() + "" + " - " + getCourseName() + " " + getImportYear() + " with no SEMESTRE SET, returning S1"); |
return "S1"; |
} |
return semestre; |
} |
412,5 → 435,43 |
} |
public boolean isValidProgram() |
{ |
return validProgram; |
} |
public void setValidProgram(boolean validProgram) |
{ |
this.validProgram = validProgram; |
} |
public UserView getValidatorUser() |
{ |
return validatorUser; |
} |
public void setValidatorUser(UserView validatorUser) |
{ |
this.validatorUser = validatorUser; |
} |
public String getTeachersSnipet() |
{ |
StringBuilder strBuilder = new StringBuilder(); |
if(teachers != null && teachers.size() > 0) |
{ |
for(UserView userView: teachers) |
{ |
strBuilder |
.append(" <a href=\"mailto:") |
.append(userView.getEmail()) |
.append("\">") |
.append(userView.getName()) |
.append("</a>") |
.append(" "); |
} |
} |
return strBuilder.toString(); |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/views/CourseView.java |
---|
10,6 → 10,8 |
import java.util.ArrayList; |
import java.io.Serializable; |
import jomm.utils.AutoFillArrayList; |
/** |
* @author Jorge Machado |
* @date 2/Mar/2008 |
31,6 → 33,12 |
private UserView coordinator; |
private UserView director; |
private List<CourseUnitView> courseUnits; |
private List<CourseUnitView> courseUnitsWithNoProgramS1; |
private List<CourseUnitView> courseUnitsWithProgramCheckedS1; |
private List<CourseUnitView> courseUnitsWithProgramNotCheckedS1; |
private List<CourseUnitView> courseUnitsWithNoProgramS2; |
private List<CourseUnitView> courseUnitsWithProgramCheckedS2; |
private List<CourseUnitView> courseUnitsWithProgramNotCheckedS2; |
private String studiesPlanStreamId; |
private RepositoryFileImpl studiesPlan; |
private String htmlResult; |
98,7 → 106,7 |
courseUnits = new ArrayList<CourseUnitView>(); |
for(CourseUnit c: course.getCourseUnits()) |
{ |
CourseUnitView cUV = new CourseUnitView(c); |
CourseUnitView cUV = new CourseUnitView(c,true,false,false,false); |
courseUnits.add(cUV); |
} |
} |
334,4 → 342,75 |
{ |
this.externalSitePath = externalSitePath; |
} |
public List<CourseUnitView> getCourseUnitsWithNoProgramS1() |
{ |
return courseUnitsWithNoProgramS1; |
} |
public void setCourseUnitsWithNoProgramS1(List<CourseUnitView> courseUnitsWithNoProgramS1) |
{ |
this.courseUnitsWithNoProgramS1 = courseUnitsWithNoProgramS1; |
} |
public List<CourseUnitView> getCourseUnitsWithProgramCheckedS1() |
{ |
if(courseUnitsWithProgramCheckedS1==null) |
courseUnitsWithProgramCheckedS1 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class); |
return courseUnitsWithProgramCheckedS1; |
} |
public void setCourseUnitsWithProgramCheckedS1(List<CourseUnitView> courseUnitsWithProgramCheckedS1) |
{ |
this.courseUnitsWithProgramCheckedS1 = courseUnitsWithProgramCheckedS1; |
} |
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedS1() |
{ |
if(courseUnitsWithProgramNotCheckedS1==null) |
courseUnitsWithProgramNotCheckedS1 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class); |
return courseUnitsWithProgramNotCheckedS1; |
} |
public void setCourseUnitsWithProgramNotCheckedS1(List<CourseUnitView> courseUnitsWithProgramNotCheckedS1) |
{ |
this.courseUnitsWithProgramNotCheckedS1 = courseUnitsWithProgramNotCheckedS1; |
} |
public List<CourseUnitView> getCourseUnitsWithNoProgramS2() |
{ |
return courseUnitsWithNoProgramS2; |
} |
public void setCourseUnitsWithNoProgramS2(List<CourseUnitView> courseUnitsWithNoProgramS2) |
{ |
this.courseUnitsWithNoProgramS2 = courseUnitsWithNoProgramS2; |
} |
public List<CourseUnitView> getCourseUnitsWithProgramCheckedS2() |
{ |
if(courseUnitsWithProgramCheckedS2==null) |
courseUnitsWithProgramCheckedS2 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class); |
return courseUnitsWithProgramCheckedS2; |
} |
public void setCourseUnitsWithProgramCheckedS2(List<CourseUnitView> courseUnitsWithProgramCheckedS2) |
{ |
this.courseUnitsWithProgramCheckedS2 = courseUnitsWithProgramCheckedS2; |
} |
public List<CourseUnitView> getCourseUnitsWithProgramNotCheckedS2() |
{ |
if(courseUnitsWithProgramNotCheckedS2==null) |
courseUnitsWithProgramNotCheckedS2 = new AutoFillArrayList<CourseUnitView>(CourseUnitView.class); |
return courseUnitsWithProgramNotCheckedS2; |
} |
public void setCourseUnitsWithProgramNotCheckedS2(List<CourseUnitView> courseUnitsWithProgramNotCheckedS2) |
{ |
this.courseUnitsWithProgramNotCheckedS2 = courseUnitsWithProgramNotCheckedS2; |
} |
} |
/impl/src/java/pt/estgp/estgweb/domain/views/BlogView.java |
---|
10,6 → 10,7 |
import java.util.List; |
import jomm.dao.impl.AbstractDao; |
import jomm.utils.StringsUtils; |
/** |
* @author Jorge Machado |
243,6 → 244,10 |
{ |
return title; |
} |
public String getFormatedaaTitle() |
{ |
return StringsUtils.getEscapeHtmlText(title); |
} |
public void setTitle(String title) |
{ |
254,6 → 259,11 |
return description; |
} |
public String getFormatedDescription() |
{ |
return StringsUtils.getFormatedText(description); |
} |
public void setDescription(String description) |
{ |
this.description = description; |
/impl/src/java/pt/estgp/estgweb/domain/GenericUserImpl.java |
---|
97,6 → 97,4 |
{ |
return isSuperuser() || isAdmin(); |
} |
public abstract String getUsername(); |
} |
/impl/src/java/pt/estgp/estgweb/web/tags/RealOwnerTag.java |
---|
New file |
0,0 → 1,99 |
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.IOwned; |
import pt.estgp.estgweb.Globals; |
public class RealOwnerTag extends BodyTagSupport |
{ |
private static final Logger logger = Logger.getLogger(RealOwnerTag.class); |
private String name; |
private String property; |
private String valid; |
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 String getValid() |
{ |
return valid; |
} |
public void setValid(String valid) |
{ |
this.valid = valid; |
} |
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(Globals.USER_SESSION_KEY); |
IOwned owned = (IOwned) RequestUtils.lookup(pageContext, name, property, null); |
return owned.getOwner() == null || userSession.getUser() != null && (owned.getOwner().getId() == userSession.getUser().getId()); |
} |
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/WebProxy.java |
---|
76,7 → 76,8 |
} |
catch(FileNotFoundException e) |
{ |
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path); |
logger.warn("url not found for server:" + server + " and path:" + path); |
response.sendError(404); |
} |
catch(Exception e) |
{ |
85,7 → 86,8 |
} |
else |
{ |
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path); |
logger.warn("url not found for server:" + server + " and path:" + path); |
response.sendError(404); |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/form/profile/ProfileForm.java |
---|
153,6 → 153,14 |
public ActionErrors validate(org.apache.struts.action.ActionMapping actionMapping, javax.servlet.http.HttpServletRequest httpServletRequest) |
{ |
ActionErrors errors = new ActionErrors(); |
if(userView.getUsername() == null || userView.getUsername().length() == 0) |
{ |
addMessageWithKeys(errors, httpServletRequest, "errors.required","username"); |
} |
if(userView.getEmail() == null || userView.getEmail().length() == 0) |
{ |
addMessageWithKeys(errors, httpServletRequest, "errors.required","email"); |
} |
if (userView.getPop3password().length() > 0 && !userView.getPop3password().equals(userView.getPop3passwordAgain())) |
addMessage(errors, httpServletRequest, "errors.diferent.passwords.pop"); |
else |
/impl/src/java/pt/estgp/estgweb/web/form/courses/CourseForm.java |
---|
1,9 → 1,9 |
package pt.estgp.estgweb.web.form.courses; |
import pt.estgp.estgweb.web.form.ApplicationForm; |
import pt.estgp.estgweb.web.form.commons.TeachersForm; |
import pt.estgp.estgweb.domain.views.CourseView; |
import pt.estgp.estgweb.utils.DatesUtils; |
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedCourses; |
import java.util.List; |
18,6 → 18,7 |
{ |
private CourseView courseView; |
private FormFile studiesPlan; |
private DirectedCoordinatedCourses directedCoordinatedCourses = new DirectedCoordinatedCourses(); |
public CourseForm() |
30,6 → 31,16 |
return courseView; |
} |
public DirectedCoordinatedCourses getDirectedCoordinatedCourses() |
{ |
return directedCoordinatedCourses; |
} |
public void setDirectedCoordinatedCourses(DirectedCoordinatedCourses directedCoordinatedCourses) |
{ |
this.directedCoordinatedCourses = directedCoordinatedCourses; |
} |
public void setCourseView(CourseView courseView) |
{ |
this.courseView = courseView; |
/impl/src/java/pt/estgp/estgweb/web/controllers/profile/ProfileController.java |
---|
11,6 → 11,7 |
import pt.estgp.estgweb.domain.views.UserView; |
import pt.estgp.estgweb.domain.views.RecordView; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException; |
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; |
50,8 → 51,14 |
ActionErrors errors = profileForm.validate(mapping, request); |
if (!errors.isEmpty()) |
{ |
UserView uV = loadUser(profileForm.getUserView().getId(), request, response); |
profileForm.getUserView().setPasswordLocal(uV.isPasswordLocal()); |
if(profileForm.getUserView().getId() > 0) |
{ |
UserView uV = loadUser(profileForm.getUserView().getId(), request, response); |
profileForm.getUserView().setPasswordLocal(uV.isPasswordLocal()); |
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
uV.setUserRoles((List<String>) userSession.get(TARGET_ROLES_KEY)); |
profileForm.setSelectedRoles(uV.getUserRoles()); |
} |
saveMessages(request, errors); |
return mapping.getInputForward(); |
} |
63,7 → 70,20 |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"object"}; |
Object[] args = new Object[]{userView, profileForm.getTypeClass()}; |
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "SubmitUser", args, names); |
try |
{ |
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "SubmitUser", args, names); |
} |
catch (AlreadyExistsException e) |
{ |
if(profileForm.getUserView().getId() > 0) |
{ |
UserView uV = loadUser(profileForm.getUserView().getId(), request, response); |
profileForm.getUserView().setPasswordLocal(uV.isPasswordLocal()); |
} |
addErrorWithKeys(request,"user.exists",e.getMessage()); |
return mapping.getInputForward(); |
} |
profileForm.setUserView(userView); |
if (userSession.getUser().getId() == userView.getId()) |
{ |
177,6 → 197,7 |
throw e; |
} |
} |
public ActionForward home(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
188,7 → 209,7 |
ProfileForm pF = (ProfileForm) form; |
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
long userToLoad; |
if(pF.getUserView().getId() > 0) |
if (pF.getUserView().getId() > 0) |
userToLoad = pF.getUserView().getId(); |
else |
userToLoad = userSession.getUser().getId(); |
206,10 → 227,11 |
throw e; |
} |
} |
public ActionForward grades(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
217,7 → 239,7 |
ProfileForm pF = (ProfileForm) form; |
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response); |
long userToLoad; |
if(pF.getUserView().getId() > 0) |
if (pF.getUserView().getId() > 0) |
userToLoad = pF.getUserView().getId(); |
else |
userToLoad = userSession.getUser().getId(); |
238,9 → 260,9 |
public ActionForward homeCode(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
306,6 → 328,7 |
UserView uV = (UserView) sm.execute(RequestUtils.getRequester(request, response), "LoadUserWithRecordsById", args, names); |
return uV; |
} |
private UserView loadUserWithGrades(long id, HttpServletRequest request, HttpServletResponse response) throws Throwable, InvalidFilterException, ServiceManagerException, InvalidFilterExpressionException, IncompatibleFilterException, FilterRetrieveException, NoCookiesException |
{ |
IServiceManager sm = ServiceManager.getInstance(); |
314,6 → 337,7 |
UserView uV = (UserView) sm.execute(RequestUtils.getRequester(request, response), "LoadUserWithGradesById", args, names); |
return uV; |
} |
public UserView loadUserWithRecordsCode(int code, HttpServletRequest request, HttpServletResponse response) throws Throwable, InvalidFilterException, ServiceManagerException, InvalidFilterExpressionException, IncompatibleFilterException, FilterRetrieveException, NoCookiesException |
{ |
IServiceManager sm = ServiceManager.getInstance(); |
335,7 → 359,7 |
ProfileForm profileForm = new ProfileForm(); |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"serializable"}; |
Object[] args = new Object[]{fromRequest.getTextToSearch(),fromRequest.getTypeToSearch()}; |
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); |
357,7 → 381,7 |
} |
public ActionForward delete(ActionMapping mapping, |
ActionForm form , |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
368,33 → 392,33 |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"serializable"}; |
Object[] args = new Object[]{new Long(request.getParameter("id"))}; |
Boolean status= (Boolean) sm.execute(RequestUtils.getRequester(request, response),"DeleteUser",args,names); |
if(status) |
Boolean status = (Boolean) sm.execute(RequestUtils.getRequester(request, response), "DeleteUser", args, names); |
if (status) |
{ |
addMessage(request,"user.deleted.sucess"); |
addMessage(request, "user.deleted.sucess"); |
return mapping.findForward("success"); |
} |
else |
{ |
addMessage(request,"user.deleted.fail"); |
addMessage(request, "user.deleted.fail"); |
return mapping.findForward("success"); |
} |
} |
catch(FilterChainFailedException e) |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
throw e; |
} |
} |
public ActionForward createRecord(ActionMapping mapping, |
ActionForm form , |
HttpServletRequest request, |
HttpServletResponse response) |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
404,36 → 428,36 |
String[] names = new String[]{"object"}; |
Object[] args; |
if(profileForm.getUploadFile() != null) |
args = new Object[]{profileForm.getRecordView(),profileForm.getUploadFile().getInputStream(),profileForm.getUploadFile().getFileName(),profileForm.getUploadFile().getContentType(),profileForm.getUploadFile().getFileSize()}; |
if (profileForm.getUploadFile() != null) |
args = new Object[]{profileForm.getRecordView(), profileForm.getUploadFile().getInputStream(), profileForm.getUploadFile().getFileName(), profileForm.getUploadFile().getContentType(), profileForm.getUploadFile().getFileSize()}; |
else |
args = new Object[]{profileForm.getRecordView(),null,null,null,0}; |
args = new Object[]{profileForm.getRecordView(), null, null, null, 0}; |
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); |
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()); |
addMessage(request, "profile.record.add.sucess", profileForm.getRecordView().getTitle()); |
profileForm.setUserView(userView); |
return mapping.findForward("home"); |
} |
catch(FilterChainFailedException e) |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
throw e; |
} |
} |
public ActionForward deleteRecord(ActionMapping mapping, |
ActionForm form , |
HttpServletRequest request, |
HttpServletResponse response) |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
442,28 → 466,28 |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"serializable"}; |
Object[] args; |
args = new Object[]{profileForm.getRecordView().getId()}; |
args = new Object[]{profileForm.getRecordView().getId()}; |
UserView userView = (UserView) sm.execute(RequestUtils.getRequester(request, response),"DeleteUserProfileRecord",args,names); |
addMessage(request,"profile.record.deleted.sucess"); |
UserView userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "DeleteUserProfileRecord", args, names); |
addMessage(request, "profile.record.deleted.sucess"); |
profileForm.setUserView(userView); |
return mapping.findForward("home"); |
} |
catch(FilterChainFailedException e) |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
throw e; |
} |
} |
public ActionForward loadEditRecord(ActionMapping mapping, |
ActionForm form , |
HttpServletRequest request, |
HttpServletResponse response) |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws Throwable, ServletException |
{ |
try |
472,22 → 496,22 |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"serializable"}; |
Object[] args; |
args = new Object[]{profileForm.getRecordView().getId()}; |
args = new Object[]{profileForm.getRecordView().getId()}; |
RecordView recordView = (RecordView) sm.execute(RequestUtils.getRequester(request, response),"LoadEditUserProfileRecord",args,names); |
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"); |
} |
catch(FilterChainFailedException e) |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (Throwable e) |
{ |
logger.error(e,e); |
logger.error(e, e); |
throw e; |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesController.java |
---|
11,6 → 11,7 |
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.utl.ist.berserk.logic.serviceManager.IServiceManager; |
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager; |
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException; |
175,4 → 176,99 |
return mapping.findForward("error500"); |
} |
} |
public ActionForward loadCoursesPrograms(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws ServletException |
{ |
try |
{ |
CourseForm cF = (CourseForm) form; |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{}; |
Object[] args = new String[]{}; |
DirectedCoordinatedCourses directedCoordinatedCourses = (DirectedCoordinatedCourses) sm.execute(RequestUtils.getRequester(request, response), "LoadCoursesProgramsForServices", args, names); |
cF.setDirectedCoordinatedCourses(directedCoordinatedCourses); |
return mapping.findForward("load.courses.programs"); |
} |
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 loadDirectedCoordininatedCourses(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws ServletException |
{ |
try |
{ |
CourseForm cF = (CourseForm) form; |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{}; |
Object[] args = new String[]{}; |
DirectedCoordinatedCourses directedCoordinatedCourses = (DirectedCoordinatedCourses) sm.execute(RequestUtils.getRequester(request, response), "LoadDirectedCoordinatedCoursesForUserInSession", args, names); |
cF.setDirectedCoordinatedCourses(directedCoordinatedCourses); |
return mapping.findForward("load.directed.coordinated.courses"); |
} |
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 updateDirectedCoordininatedCourses(ActionMapping mapping, |
ActionForm form, |
HttpServletRequest request, |
HttpServletResponse response) |
throws ServletException |
{ |
try |
{ |
CourseForm cF = (CourseForm) form; |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"directedCoordinatedCourses"}; |
Object[] args = new Object[]{cF.getDirectedCoordinatedCourses()}; |
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"); |
} |
catch (FilterChainFailedException e) |
{ |
return mapping.findForward("error401"); |
} |
catch (NotFoundException e) |
{ |
return mapping.findForward("error404"); |
} |
catch (Throwable e) |
{ |
logger.error(e, e); |
return mapping.findForward("error500"); |
} |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/controllers/announcements/AnnouncementsController.java |
---|
54,7 → 54,7 |
AnnouncementsForm announcementForm = (AnnouncementsForm) form; |
AnnouncementView view = announcementForm.getAnnouncementView(); |
String finalUrl = ""; |
if (announcementForm.getUrl() != null && !announcementForm.getUrl().equals("")) |
if (announcementForm.getUrl() != null && announcementForm.getUrl().length() > 0) |
{ |
finalUrl = announcementForm.getUrlProtocol() + announcementForm.getUrl(); |
view.setUrl(finalUrl); |
139,6 → 139,20 |
announcementsForm.setStartDate(DatesUtils.getStringFromDate(aV.getStartDate())); |
announcementsForm.setExpireDate(DatesUtils.getStringFromDate(aV.getExpireDate())); |
announcementsForm.setSelectedRoles(aV.getTargetRoles()); |
if(aV.getUrl() != null) |
{ |
int indexProtocol = aV.getUrl().indexOf("://"); |
if(indexProtocol > 0) |
{ |
announcementsForm.setUrl(aV.getUrl().substring(indexProtocol+3)); |
announcementsForm.setUrlProtocol(aV.getUrl().substring(0,indexProtocol+3)); |
} |
else |
{ |
announcementsForm.setUrlProtocol(""); |
announcementsForm.setUrl(aV.getUrl()); |
} |
} |
sess.put(TARGET_ROLES_KEY, (Serializable) aV.getTargetRoles()); |
sess.serialize(request,response); |
return mapping.getInputForward(); |
233,6 → 247,8 |
{ |
try |
{ |
AnnouncementsForm announcementForm = (AnnouncementsForm) form; |
String id = request.getParameter("id"); |
AnnouncementView announcementView = load(request,response,Long.parseLong(id)); |
request.setAttribute("Announcement", announcementView); |
/impl/src/doc/estgweb.eap |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/impl/src/updates/db/update1.sql |
---|
New file |
0,0 → 1,9 |
ALTER TABLE courseunit ENGINE = myisam; |
ALTER TABLE `courseunit` ADD COLUMN `validatorUser` BIGINT(20) UNSIGNED AFTER `course`, ADD COLUMN `validProgram` BIT(1) DEFAULT 0 AFTER `validatorUser`, ADD INDEX `validatorUserIndex`(`validatorUser`); |
ALTER TABLE `courseunit` ADD CONSTRAINT `FK_validatorUser` FOREIGN KEY `FK_validatorUser` (`validatorUser`) |
REFERENCES `user` (`id`) |
ON DELETE SET NULL |
ON UPDATE SET NULL; |
update courseunit set validProgram = 0; |
ALTER TABLE courseunit ENGINE = ndb; |
/impl/src/hbm/pt/estgp/estgweb/domain/GenericUser.hbm.xml |
---|
14,7 → 14,9 |
<timestamp name="updateDate" unsaved-value="null"/> |
<property name="saveDate" type="timestamp"/> |
<property name="superuser" type="boolean"/> |
<property name="username" type="string" unique="true" length="50" index="usernameIndex"/> |
<property name="name" type="string" index="nameIndex"/> |
<property name="email" type="string" index="emailIndex"/> |
<property name="roles" type="string" index="rolesIndex"/> |
<many-to-one name="image" column="image" class="pt.estgp.estgweb.domain.Image" lazy="no-proxy" outer-join="false" cascade="all"/> |
<subclass name="pt.estgp.estgweb.domain.GenericUserImpl"> |
28,12 → 30,10 |
</subclass> |
<subclass name="pt.estgp.estgweb.domain.User"> |
<meta attribute="scope-class">public abstract</meta> |
<property name="username" type="string" unique="true" length="50" index="usernameIndex"/> |
<property name="password" type="string"/> |
<property name="address" type="text"/> |
<property name="zip" type="string"/> |
<property name="country" type="string"/> |
<property name="email" type="string" index="emailIndex"/> |
<property name="outEmail" type="string"/> |
<property name="phonenumber" type="string"/> |
<property name="sex" type="string"/> |
/impl/src/hbm/pt/estgp/estgweb/domain/Course.hbm.xml |
---|
31,7 → 31,7 |
<key column="course_id"/> |
<one-to-many class="pt.estgp.estgweb.domain.CourseUserAssociation"/> |
</set> |
<set name="courseUnits" order-by="courseYear asc" lazy="true"> |
<set name="courseUnits" order-by="name asc" lazy="true"> |
<key column="course"/> |
<one-to-many class="pt.estgp.estgweb.domain.CourseUnit"/> |
</set> |
/impl/src/hbm/pt/estgp/estgweb/domain/CourseUnit.hbm.xml |
---|
25,7 → 25,9 |
<property name="normalizedName" type="string" /> |
<property name="objectives" type="text"/> |
<property name="programStreamId" type="string" index="programStreamIdIndex" /> |
<property name="validProgram" type="boolean" index="validProgramIndex"/> |
<property name="status" type="boolean" index="statusIndex" /> |
<many-to-one name="validatorUser" class="pt.estgp.estgweb.domain.Teacher" lazy="false" outer-join="true"/> |
<many-to-one name="course" class="pt.estgp.estgweb.domain.Course" lazy="false" outer-join="true"/> |
<set name="blogs" cascade="delete" lazy="true" order-by="saveDate asc"> |
<key column="courseUnit"/> |
/impl/src/web/imgs/rolesIcons/student.gif |
---|
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/web/imgs/topFundoTijolo.jpg |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+ application/octet-stream |
/impl/src/web/admin/profile/profilePersonalData.jsp |
---|
10,6 → 10,7 |
<div id="contentPane"> |
<jomm:messages/> |
<html:errors/> |
<%--<jsp:useBean id="ProfileForm" class="pt.estgp.estgweb.web.form.profile.ProfileForm"/>--%> |
136,7 → 137,7 |
<bean:message key="profile.scholar.degree"/> |
</th> |
<td> |
<html:select property="userView.academicDegree"> |
<html:select property="userView.scholarDegree"> |
<html:option value="less"><bean:message key="profile.scholar.degree.less"/></html:option> |
<html:option value="9"><bean:message key="profile.scholar.degree.9"/></html:option> |
<html:option value="12"><bean:message key="profile.scholar.degree.12"/></html:option> |
/impl/src/web/admin/announcements/submitAnnouncement.jsp |
---|
91,25 → 91,29 |
</html:select> |
</td> |
</tr> |
<logic:present name="UserSession" property="user"> |
<logic:notEmpty name="UserSession" property="user.ownerRoles"> |
<tr> |
<th> |
<bean:message key="announcement.sendAnnouncementLike"/> |
</th> |
<td> |
<html:select property="announcementView.choosedOwnerRole"> |
<logic:iterate id="item" name="UserSession" property="user.ownerRoles"> |
<jomm:option itemName="item" comparableObjectName="AnnouncementsForm" |
comparableObjectProperty="announcementView.choosedOwnerRole"> |
<bean:message key="user.role.${item}"/> |
</jomm:option> |
</logic:iterate> |
</html:select> |
</td> |
</tr> |
</logic:notEmpty> |
<baco:isRealOwner name="AnnouncementsForm" property="announcementView"> |
<logic:notEmpty name="UserSession" property="user.ownerRoles"> |
<tr> |
<th> |
<bean:message key="announcement.sendAnnouncementLike"/> |
</th> |
<td> |
<html:select property="announcementView.choosedOwnerRole"> |
<logic:iterate id="item" name="UserSession" property="user.ownerRoles"> |
<jomm:option itemName="item" comparableObjectName="AnnouncementsForm" |
comparableObjectProperty="announcementView.choosedOwnerRole"> |
<bean:message key="user.role.${item}"/> |
</jomm:option> |
</logic:iterate> |
</html:select> |
</td> |
</tr> |
</logic:notEmpty> |
</baco:isRealOwner> |
</logic:present> |
<tr> |
<th> |
<bean:message key="announcement.target.roles"/> |
307,6 → 311,7 |
<html:option value="http://">Http://</html:option> |
<html:option value="ftp://">ftp://</html:option> |
<html:option value="https://">Https://</html:option> |
<html:option value="">Relativo ao Baco (exemplo: /blog/bugs</html:option> |
</html:select> |
<html:text property="url" maxlength="250"/> |
</td> |
318,7 → 323,7 |
<bean:message key="announcement.internalLinkAnnouncement"/> |
</th> |
<td> |
<html:select property="announcementView.internalUrlServer"> |
<html:select property="announcementView.internalUrlInclude"> |
<html:option value="true"> |
<bean:message key="announcement.internal.url.include.yes"/> |
</html:option> |
/impl/src/web/errors/503.jsp |
---|
New file |
0,0 → 1,10 |
<%@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" %> |
<% |
response.sendError(500); |
%> |
<h3 class="statusWARNING"><bean:message key="error.503"/></h3> |
/impl/src/web/layout/header.jsp |
---|
6,7 → 6,7 |
<%@ 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" %> |
<table width="100%"> |
<table width="100%" style="background-image:url(<%=request.getContextPath()%>/imgs/topFundoTijolo.jpg)"> |
<tr> |
<td> |
/impl/src/web/layout/headerIntranet.jsp |
---|
7,7 → 7,9 |
<table width="100%" id="headerIntranet"> |
<tr> |
<td class="title"> |
INTRANET - ESTG (<bean:write name="UserSession" property="user.name"/> online) |
<logic:present name="UserSession"> |
INTRANET - ESTG (<bean:write name="UserSession" property="user.name"/> online) |
</logic:present> |
</td> |
<td class="links"> |
<ul> |
/impl/src/web/public/blogs/blog.jsp |
---|
30,7 → 30,7 |
<div class="seccao"> |
<div class="postHeader"> |
<h1> |
<bean:write name="BlogView" property="title"/> |
${BlogView.formatedaaTitle} |
</h1> |
<baco:canManage name="BlogView"> |
64,7 → 64,7 |
%> |
</td> |
<td valign="top"> |
${BlogView.description} |
${BlogView.formatedDescription} |
</td> |
</tr> |
</table> |
137,7 → 137,8 |
<baco:canLoad name="post"> |
<tr> |
<td colspan="2" class="title"> |
<a name="post${post.id}"></a>${post.title} |
<a name="post${post.id}"></a> |
<h3>${post.formatedTitle}</h3> |
<baco:canManage name="post"> |
<a onclick="return confirm('${confirmDeletePost}')" href="<%=request.getContextPath()%>${user}/startDeletePost${fromAction}.do?id=${post.id}&blogId=${BlogView.id}"><bean:message key="blog.delete.post"/></a> |
<baco:canManage name="BlogView"> |
161,7 → 162,7 |
</tr> |
<tr> |
<td valign="top"> |
${post.text} |
${post.formatedText} |
</td> |
<td valign="top"> |
<% |
179,7 → 180,7 |
</tr> |
<tr> |
<td colspan="2" class="pFooter"> |
Posted by: ${post.ownerUsername} AT ${post.formatedSaveDate} |
Posted by: (${post.ownerUsername}) ${post.ownerName} [AT] ${post.formatedSaveDate} |
</td> |
</tr> |
</baco:canLoad> |
/impl/src/web/public/announcements/announcementsPortalLeft.jsp |
---|
21,7 → 21,7 |
IServiceManager sm = ServiceManager.getInstance(); |
String subTarget = null; |
String[] names = new String[]{}; |
Object[] args = new Object[]{request.getParameter("role"), Globals.ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS, subTarget}; |
Object[] args = new Object[]{request.getParameter("role"), Globals.ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS + "," +Globals.ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS, subTarget}; |
List<AnnouncementView> announcementViews = (List<AnnouncementView>) sm.execute(RequestUtils.getRequester(request, response), "LoadRoleTypeMaxAnnouncements", args, names); |
request.setAttribute("Announcements", announcementViews); |
/impl/src/web/public/announcements/loadAnnouncement.jsp |
---|
3,6 → 3,7 |
<%@ page import="pt.estgp.estgweb.domain.enums.AnnouncementStyleEnum" %> |
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %> |
<%@ page import="jomm.utils.MessageResources" %> |
<%@ page import="pt.estgp.estgweb.web.WebProxy" %> |
<%@ 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" %> |
12,8 → 13,23 |
<jsp:useBean id="Announcement" type="pt.estgp.estgweb.domain.views.AnnouncementView" scope="request"/> |
<% UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);%> |
<table class="seccao"> |
<tr><td> |
<h2>${Announcement.title} |
<tr> |
<td> |
<h2> |
<% |
if(Announcement.getUrl() != null && Announcement.getUrl().length()>0) |
{ |
%> |
<a href="<%=Announcement.getUrl(request)%>">${Announcement.title}</a> |
<% |
} |
else |
{ |
%> |
${Announcement.title} |
<% |
} |
%> |
<baco:canManage name="Announcement"> |
<!--valid="false">--> |
<% |
66,28 → 82,50 |
<% |
if (Announcement.getBigImage() != null) |
{ |
if(Announcement.getUrl() != null && Announcement.getUrl().length()>0) |
{ |
%> |
<img align="<%=align%>" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>"> |
<a href="<%=Announcement.getUrl(request)%>"> |
<img border="0" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
</a> |
<% |
} |
else |
{ |
%> |
<img border="0" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
<% |
} |
} |
else if (Announcement.getSmallImage() != null) |
{ |
if(Announcement.getUrl() != null && Announcement.getUrl().length()>0) |
{ |
%> |
<img align="<%=align%>" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
<a href="<%=Announcement.getUrl(request)%>"> |
<img border="0" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
</a> |
<% |
} |
else |
{ |
%> |
<img border="0" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
<% |
} |
} |
%> |
</div> |
${Announcement.formatedText} |
<% |
if (Announcement.getUrl() != null) |
{ |
%> |
<html:link href="${Announcement.url}">Ver +</html:link> |
<% |
}%> |
<logic:notEmpty name="Announcement" property="url"> |
>> <html:link href="${Announcement.url}">${Announcement.url}</html:link> |
</logic:notEmpty> |
<div class="pFooter"> |
Posted by: (${Announcement.ownerUsername}) ${Announcement.ownerName} [AT] ${Announcement.formatedSaveDate} |
</div> |
</p> |
<% |
} |
101,25 → 139,57 |
<% |
if (Announcement.getBigImage() != null) |
{ |
if(Announcement.getUrl() != null && Announcement.getUrl().length()>0) |
{ |
%> |
<img alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>"> |
<a href="<%=Announcement.getUrl(request)%>"> |
<img border="0" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>"> |
</a> |
<% |
} |
else |
{ |
%> |
<img border="0" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>"> |
<% |
} |
} |
else if (Announcement.getSmallImage() != null) |
{ |
if(Announcement.getUrl() != null && Announcement.getUrl().length()>0) |
{ |
%> |
<img alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
<a href="<%=Announcement.getUrl(request)%>"> |
<img border="0" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
</a> |
<% |
} |
else |
{ |
%> |
<img border="0" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
<% |
} |
} |
%> |
</div> |
</td> |
</tr> |
<tr> |
<td>${Announcement.formatedText}</td> |
<td valign="<%=valign%>" >${Announcement.formatedText}</td> |
</tr> |
<logic:notEmpty name="Announcement" property="url"> |
<tr> |
<td> >> <html:link href="${Announcement.url}">${Announcement.url}</html:link></td> |
</tr> |
</logic:notEmpty> |
<tr> |
<td class="pFooter"> |
Posted by: (${Announcement.ownerUsername}) ${Announcement.ownerName} [AT] ${Announcement.formatedSaveDate} |
</td> |
</tr> |
</table> |
<% |
} |
133,23 → 203,56 |
<% |
if (Announcement.getBigImage() != null) |
{ |
if(Announcement.getUrl() != null && Announcement.getUrl().length()>0) |
{ |
%> |
<img alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>"> |
<a href="<%=Announcement.getUrl(request)%>"> |
<img border="0" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>"> |
</a> |
<% |
} |
else |
{ |
%> |
<img border="0" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>"> |
<% |
} |
} |
else if (Announcement.getSmallImage() != null) |
{ |
if(Announcement.getUrl() != null && Announcement.getUrl().length()>0) |
{ |
%> |
<img alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
<a href="<%=Announcement.getUrl(request)%>"> |
<img border="0" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
</a> |
<% |
} |
else |
{ |
%> |
<img border="0" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
<% |
} |
} |
%> |
</div> |
</td> |
<td>${Announcement.formatedText}</td> |
<td valign="<%=valign%>">${Announcement.formatedText}</td> |
</tr> |
<logic:notEmpty name="Announcement" property="url"> |
<tr> |
<td colspan="2"> >> <html:link href="${Announcement.url}">${Announcement.url}</html:link></td> |
</tr> |
</logic:notEmpty> |
<tr> |
<td colspan="2" class="pFooter"> |
Posted by: (${Announcement.ownerUsername}) ${Announcement.ownerName} [AT] ${Announcement.formatedSaveDate} |
</td> |
</tr> |
</table> |
<% |
} |
158,30 → 261,98 |
%> |
<table> |
<tr> |
<td>${Announcement.formatedText}</td> |
<td valign="<%=valign%>">${Announcement.formatedText}</td> |
<td valign="<%=valign%>"> |
<div class="imageAnnouncement"> |
<% |
if (Announcement.getBigImage() != null) |
{ |
if(Announcement.getUrl() != null && Announcement.getUrl().length()>0) |
{ |
%> |
<img alt="<%=Announcement.getTitle()%>" |
<a href="${Announcement.url}"> |
<img border="0" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>"> |
</a> |
<% |
} |
else |
{ |
%> |
<img border="0" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>"> |
<% |
} |
} |
else if (Announcement.getSmallImage() != null) |
{ |
if(Announcement.getUrl() != null && Announcement.getUrl().length()>0) |
{ |
%> |
<img alt="<%=Announcement.getTitle()%>" |
<a href="<%=Announcement.getUrl(request)%>"> |
<img border="0" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
</a> |
<% |
} |
else |
{ |
%> |
<img border="0" alt="<%=Announcement.getTitle()%>" |
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>"> |
<% |
} |
} |
%> |
</div> |
</td> |
</tr> |
<logic:notEmpty name="Announcement" property="url"> |
<tr> |
<td colspan="2"> >> <html:link href="${Announcement.url}">${Announcement.url}</html:link></td> |
</tr> |
</logic:notEmpty> |
<tr> |
<td colspan="2" class="pFooter"> |
Posted by: (${Announcement.ownerUsername}) ${Announcement.ownerName} [AT] ${Announcement.formatedSaveDate} |
</td> |
</tr> |
</table> |
<% |
} |
%> |
</td></tr></table> |
</td> |
</tr> |
<tr> |
<td> |
<logic:notEmpty name="Announcement" property="internalUrlPath"> |
<logic:notEmpty name="Announcement" property="internalUrlServer"> |
<logic:equal name="Announcement" property="internalUrlInclude" value="true"> |
<% |
WebProxy.processHttpRequestService(out, Announcement.getInternalUrlServer(), Announcement.getInternalUrlPath()); |
%> |
</logic:equal> |
<logic:notEqual name="Announcement" property="internalUrlInclude" value="true"> |
<% |
if(Announcement.getInternalUrlPath().startsWith("/")) |
{ |
%> |
<a href="<%=request.getContextPath()%>/proxy/layout1/${Announcement.internalUrlServer}${Announcement.internalUrlPath}"><bean:message key="search.see.more.content"/></a> |
<% |
} |
else |
{ |
%> |
<a href="<%=request.getContextPath()%>/proxy/layout1/${Announcement.internalUrlServer}/${Announcement.internalUrlPath}"><bean:message key="search.see.more.content"/></a> |
<% |
} |
%> |
</logic:notEqual> |
</logic:notEmpty> |
</logic:notEmpty> |
</td> |
</tr> |
</table> |
/impl/src/web/public/announcements/loadTodoAnnouncement.jsp |
---|
42,5 → 42,10 |
</td> |
<td valign="top">${Announcement.formatedText}</td> |
</tr> |
<logic:notEmpty name="Announcement" property="url"> |
<tr> |
<td colspan="2"> >> <html:link href="${Announcement.url}">${Announcement.url}</html:link></td> |
</tr> |
</logic:notEmpty> |
</table> |
</div> |
/impl/src/web/user/courses/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.home.back"); |
topNav.addNavPlace(null, "course.directed.coordinated.courses"); |
%> |
<jsp:include page="/layout/topnav.jsp"/> |
/impl/src/web/user/courses/directedCoordinatedCourses.jsp |
---|
New file |
0,0 → 1,155 |
<%@ 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" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %> |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
<jsp:useBean id="CourseForm" type="pt.estgp.estgweb.web.form.courses.CourseForm" scope="request"/> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<jomm:messages/> |
<html:errors/> |
<% |
String fromAction = ""; |
String from = ""; |
String user = ""; |
if (request.getParameter("from") != null) |
{ |
user = "/user"; |
fromAction = "From" + request.getParameter("from"); |
from = "?from=" + request.getParameter("from"); |
} |
request.setAttribute("from", from); |
request.setAttribute("user", user); |
request.setAttribute("fromAction", fromAction); |
%> |
<html:form action="${user}/courseController${fromAction}${from}" enctype="multipart/form-data"> |
<input type="hidden" name="dispatch" value="updateDirectedCoordininatedCourses"> |
<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> |
<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> |
<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> |
</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> |
</ul> |
</li> |
</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> |
</html:form> |
/impl/src/web/user/courseunits/courseunitworks.jsp |
---|
215,9 → 215,14 |
request.setAttribute("confirmDelete", confirmDelete); |
%> |
<td> |
<html:link onclick="return confirm('${confirmDelete}')" action="/user/startDeleteCourseUnitWorksFromHome?courseUnitAssignementView.id=${work.id}"> |
<bean:message key="delete"/> |
</html:link> |
<logic:equal value="0" name="work" property="delivers"> |
<html:link onclick="return confirm('${confirmDelete}')" action="/user/startDeleteCourseUnitWorksFromHome?courseUnitAssignementView.id=${work.id}"> |
<bean:message key="delete"/> |
</html:link> |
</logic:equal> |
<logic:notEqual value="0" name="work" property="delivers"> |
<%--<bean:message key="delete"/>--%> |
</logic:notEqual> |
</td> |
</baco:canManage> |
<baco:isStudentOfCourseUnit courseUnitId="${CourseUnitView.id}"> |
276,7 → 281,7 |
</tr> |
<tr id="assignement${work.id}" style="<%=Globals.HIDDEN%>"> |
<td colspan="${colspanAssignement}"> |
${work.description} |
${work.formatedDescription} |
</td> |
</tr> |
</logic:iterate> |
/impl/src/web/user/courseunits/courseunitassignement.jsp |
---|
67,7 → 67,7 |
<bean:message key="courseunit.description"/> |
</th> |
<td> |
<bean:write name="CourseUnitAssignementView" property="description"/> |
${CourseUnitAssignementView.formatedDescription} |
</td> |
</tr> |
<tr> |
124,7 → 124,7 |
<bean:message key="courseunit.assignement.deliver.time.ok"/> |
</td> |
</logic:notEqual> |
<td>${deliverable.student.code}</td> |
<td align="right">${deliverable.student.code}</td> |
<td>${deliverable.student.name}</td> |
<td><a target="_blank" href="<%=request.getContextPath()%>/repositoryStream/${deliverable.fileStreamId}"><bean:message key="courseunit.assignement.deliver.version"/> (${deliverable.deliverDateStr})</a></td> |
<td> |
/impl/src/web/user/courseunits/courseunit.jsp |
---|
102,7 → 102,7 |
<logic:iterate id="announcement" name="CourseUnitView" property="announcements" type="pt.estgp.estgweb.domain.views.AnnouncementView"> |
<li> |
<h3><html:link action="/user/startLoadAnnouncementFromCourseUnit?id=${announcement.id}">${announcement.title}</html:link></h3> |
<p>${announcement.text}</p> |
<p>${announcement.formatedText}</p> |
<p class="pFooterSeccao"><bean:message key="from"/>: ${announcement.owner.name} (${announcement.owner.username}) <bean:message key="at"/> ${announcement.formatedSaveDate} </p> |
</li> |
</logic:iterate> |
/impl/src/web/user/courseunits/submitAnnouncement.jsp |
---|
43,7 → 43,7 |
<html:hidden property="announcementView.courseUnitView.name"/> |
<input type="hidden" name="expireDate" value="<%=calendar.getWebDateString()%>"/> |
<html:hidden property="announcementView.courseUnitView.courseName"/> |
<html:hidden property="targetRolesStr" value="student"/> |
<html:hidden property="targetRolesStr" value="all"/> |
<baco:hasRole role="student"> |
<html:hidden property="announcementView.choosedOwnerRole" value="student"/> |
</baco:hasRole> |
/impl/src/web/user/home.jsp |
---|
4,6 → 4,7 |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<jomm:messages/> |
<html:errors/> |
11,7 → 12,8 |
<table width="100%" cellpadding="0" cellspacing="0"> |
<tr> |
<td id="leftPage"> |
<jsp:include page="/public/announcements/announcementsPortalLeft.jsp?role=student&from=Home"/> |
<jsp:include page="/public/announcements/announcementsPortalLeft.jsp?role=${UserSession.user.roles}&from=Home"/> |
</td> |
<td class="contentPortal"> |
<jsp:include page="/user/home/student.jsp"/> |
22,7 → 24,7 |
<%--</table>--%> |
</td> |
<td id="rightPagePortal"> |
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=student&from=Home"/> |
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=${UserSession.user.roles}&from=Home"/> |
</td> |
</tr> |
</table> |
31,7 → 33,7 |
<table> |
<tr> |
<td id="leftPage"> |
<jsp:include page="/public/announcements/announcementsPortalLeft.jsp?role=teacher&from=Home"/> |
<jsp:include page="/public/announcements/announcementsPortalLeft.jsp?role=${UserSession.user.roles}&from=Home"/> |
</td> |
<td class="contentPortal"> |
<jsp:include page="/user/home/teacher.jsp"/> |
42,7 → 44,7 |
<%--</table>--%> |
</td> |
<td id="rightPagePortal"> |
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=teacher&from=Home"/> |
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=${UserSession.user.roles}&from=Home"/> |
</td> |
</tr> |
</table> |
/impl/src/web/user/home/student.jsp |
---|
8,20 → 8,30 |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<div class="portal"> |
<ul> |
<li class="WARNING"> |
<logic:notMatch value="StudentImpl" name="UserSession" property="user.class.name"> |
<bean:message key="profile.bad.profile.student.iregular.user.class"/> |
</logic:notMatch> |
</li> |
</ul> |
<table class="columnTable" width="100%"> |
<tbody> |
<tr> |
<baco:isModuleOn module="courseunits"> |
<td class="column"> |
<div class="block"> |
<p><bean:message key="intranet.course.units"/></p> |
<ul> |
<li> |
<p><bean:message key="courseunit.semestre"/> 1</p> |
<logic:empty name="UserSession" property="user.subscribedUnitsCurrentYearViewS1"> |
<bean:message key="courseunit.zero.units"/> |
</logic:empty> |
<logic:present name="UserSession" property="user.subscribedUnitsCurrentYearViewS1"> |
<logic:empty name="UserSession" property="user.subscribedUnitsCurrentYearViewS1"> |
<bean:message key="courseunit.zero.units"/> |
</logic:empty> |
</logic:present> |
<logic:present name="UserSession" property="user.subscribedUnitsCurrentYearViewS1"> |
<logic:notEmpty name="UserSession" property="user.subscribedUnitsCurrentYearViewS1"> |
<ul> |
<logic:iterate id="unit" name="UserSession" property="user.subscribedUnitsCurrentYearViewS1" type="pt.estgp.estgweb.domain.CourseUnit"> |
35,10 → 45,12 |
</li> |
<li> |
<p><bean:message key="courseunit.semestre"/> 2</p> |
<logic:empty name="UserSession" property="user.subscribedUnitsCurrentYearViewS2"> |
<bean:message key="courseunit.zero.units"/> |
</logic:empty> |
<logic:present name="UserSession" property="user.subscribedUnitsCurrentYearViewS2"> |
<logic:empty name="UserSession" property="user.subscribedUnitsCurrentYearViewS2"> |
<bean:message key="courseunit.zero.units"/> |
</logic:empty> |
</logic:present> |
<logic:present name="UserSession" property="user.subscribedUnitsCurrentYearViewS2"> |
<logic:notEmpty name="UserSession" property="user.subscribedUnitsCurrentYearViewS2"> |
<ul> |
<logic:iterate id="unit" name="UserSession" property="user.subscribedUnitsCurrentYearViewS2" type="pt.estgp.estgweb.domain.CourseUnit"> |
63,28 → 75,7 |
<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/home/todos.jsp |
---|
103,10 → 103,15 |
<a href="<%=request.getContextPath() + todo.getUrl()%>"> |
<font class="<%=styleClass%>"> |
<% |
if(todo.getCatKey() != null) |
if(todo.getCatArg0() == null && todo.getCatKey() != null) |
{ |
out.print(MessageResources.getMessage(request,todo.getCatKey()) + ":"); |
} |
else if(todo.getCatArg0() != null && todo.getCatKey() != null) |
{ |
out.print(MessageResources.getMessage(request,todo.getCatKey(),todo.getCatArg0()) + ":"); |
} |
%> |
<%=todo.getLabelInsideCat(request)%> |
</font> |
/impl/src/web/user/home/teacher.jsp |
---|
8,6 → 8,13 |
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %> |
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/> |
<div class="portal"> |
<ul> |
<li class="WARNING"> |
<logic:notMatch value="TeacherImpl" name="UserSession" property="user.class.name"> |
<bean:message key="profile.bad.profile.teacher.iregular.user.class"/> |
</logic:notMatch> |
</li> |
</ul> |
<table class="columnTable" width="100%"> |
<tbody> |
<tr> |
18,10 → 25,12 |
<ul> |
<li> |
<p><bean:message key="courseunit.semestre"/> 1</p> |
<logic:empty name="UserSession" property="user.teachedUnitsCurrentYearViewS1"> |
<bean:message key="courseunit.zero.units"/> |
</logic:empty> |
<logic:present name="UserSession" property="user.teachedUnitsCurrentYearViewS1"> |
<logic:empty name="UserSession" property="user.teachedUnitsCurrentYearViewS1"> |
<bean:message key="courseunit.zero.units"/> |
</logic:empty> |
</logic:present> |
<logic:present name="UserSession" property="user.teachedUnitsCurrentYearViewS1"> |
<logic:notEmpty name="UserSession" property="user.teachedUnitsCurrentYearViewS1"> |
<ul> |
<logic:iterate id="unit" name="UserSession" property="user.teachedUnitsCurrentYearViewS1" type="pt.estgp.estgweb.domain.CourseUnit"> |
35,10 → 44,12 |
</li> |
<li> |
<p><bean:message key="courseunit.semestre"/> 2</p> |
<logic:empty name="UserSession" property="user.teachedUnitsCurrentYearViewS2"> |
<bean:message key="courseunit.zero.units"/> |
</logic:empty> |
<logic:present name="UserSession" property="user.teachedUnitsCurrentYearViewS2"> |
<logic:empty name="UserSession" property="user.teachedUnitsCurrentYearViewS2"> |
<bean:message key="courseunit.zero.units"/> |
</logic:empty> |
</logic:present> |
<logic:present name="UserSession" property="user.teachedUnitsCurrentYearViewS2"> |
<logic:notEmpty name="UserSession" property="user.teachedUnitsCurrentYearViewS2"> |
<ul> |
<logic:iterate id="unit" name="UserSession" property="user.teachedUnitsCurrentYearViewS2" type="pt.estgp.estgweb.domain.CourseUnit"> |
62,28 → 73,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/serviceZone.jsp |
---|
85,8 → 85,9 |
</baco:hasRole> |
</baco:isModuleOn> |
<li> |
<baco:isAdmin> |
<baco:isAdmin> |
<li> |
<bean:message key="users"/> |
<ul> |
<li> |
112,14 → 113,14 |
</li> |
</baco:isModuleOn> |
</ul> |
</baco:isAdmin> |
</li> |
</li> |
</baco:isAdmin> |
<baco:isModuleOn module="courseunits"> |
<li> |
<baco:isAdmin> |
<li> |
<bean:message key="courses"/> |
<ul> |
<baco:isAdmin> |
<li> |
<html:link action="/user/startNewCourseFromServiceZone"> |
<bean:message key="course.new"/> |
140,13 → 141,16 |
<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>--%> |
<%--<html:link action="/user/startFindCourseUnitAdminFromServiceZone">--%> |
<%--<bean:message key="courseunit.program.archive"/>--%> |
<%--</html:link>--%> |
<%--</li>--%> |
</ul> |
</li> |
</baco:isAdmin> |
<li> |
<bean:message key="backups"/> |
<ul> |
<baco:isAdmin> |
168,7 → 172,6 |
</html:link> |
</li> |
</baco:hasRole> |
</ul> |
</li> |
</baco:isModuleOn> |
/impl/build.xml |
---|
97,6 → 97,12 |
config="file://${basedir}/${dist.dir}/estgweb.xml" |
username="${tomcat.username}" password="${tomcat.password}" /> |
</target> |
<target name="tomcat.deployContextOnly" depends=""> |
<echo message="${tomcat.manager}"/> |
<tomcat.install url="${tomcat.manager}" path="${tomcat.context.path.install}" |
config="file://${basedir}/${dist.dir}/estgweb.xml" |
username="${tomcat.username}" password="${tomcat.password}" /> |
</target> |
<target name="tomcat.redeployContext" depends="tomcat.undeploy,build.war" > |
<echo message="${tomcat.manager}"/> |
<tomcat.install url="${tomcat.manager}" path="${tomcat.context.path.install}" |
497,5 → 503,9 |
<!--<java classname="mitra.oaiharvest.harvest.HarvestEngine" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>--> |
<!--<java classname="mitra.oaiharvest.index.IndexEngine" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>--> |
<!--</target>--> |
<target name="util.task.createRepositoryXML"> |
<java classname="pt.estgp.estgweb.services.data.CreateDescriptionsXML" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/> |
</target> |
</project> |