Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 373 → Rev 379

/impl/importRoutines.xml
15,9 → 15,12
<java classname="pt.estgp.estgweb.services.sigesimports.ImportStudentsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
<target name="jobs">
<java classname="pt.estgp.estgweb.services.jobs.JobDeamon" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
<java fork="true" classname="pt.estgp.estgweb.services.jobs.JobDeamon" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
<target name="summaries">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportSumaries" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
<target name="setAreas">
<java fork="true" classname="pt.estgp.estgweb.services.courses.SetUserArea" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
</project>
/impl/conf/language/MessageResourcesIntranet.properties
45,6 → 45,7
 
intranet.utils.actas=Actas
 
intranet.home.curricular=Consulta de Material Curricular
 
 
 
/impl/conf/language/MessageResourcesCourse.properties
13,6 → 13,7
course.select=Escolha Curso
course.select.message=Por favor selecione o curso que deseja editar
 
course.area=Area Científica
course.code=Código
course.degree=Grau académico
course.importYear=Ano de Importação
46,6 → 47,7
course.units.with.program.checked=Unidades com programa válido
course.valid.program=Programa Validado
course.directed.coordinated=Cursos que coordena e/ou dirige (Apenas os coordenadores tem permissão para alterar o estado de um programa)
courseunit.programs=Programas Curriculares
course.directed.courses=Cursos que dirige
course.coordinated.courses=Cursos que coordena
course.unit.directed=Unidades Curriculares
62,3 → 64,13
 
 
 
courses.all=Todos os Cursos
 
 
 
 
 
 
 
 
 
/impl/conf/language/MessageResources.properties
64,8 → 64,11
error.401.item.3=Seguiu um link proveniente de um web site exterior cuja informação pode estar desactualizada
error.401.item.4=Seguiu um link interno errado ou desactualizado.
 
 
organization=Organização
areas=Áreas
areas=Areas
area=Area
areas.all=Todas as Areas
 
area.eg=Área de Engenharia
area.ch=Área de Ciencias Humanas
77,6 → 80,8
top.menu.area.ce=Ciências Empresariais
top.menu.area.ch=Ciências Humanas
 
 
 
#roles
 
user.role.all=Todos
87,6 → 92,11
user.role.teacher.eg=Professor da Área de Engenharia
user.role.teacher.dg=Professor da Área de Design
user.role.teacher.ce=Professor da Área de Ciencias Empresariais
user.role.teacher.ch=Professor da Área de Ciencias Humanas
user.role.student.eg=Aluno da Área de Engenharia
user.role.student.dg=Aluno da Área de Design
user.role.student.ce=Aluno da Área de Ciencias Empresariais
user.role.student.ch=Aluno da Área de Ciencias Humanas
user.role.ci=Centro Informático
user.role.worker=Funcionário
user.role.invited=Convidado
/impl/conf/language/MessageResourcesCourseUnits.properties
48,6 → 48,13
 
courseunit.assignement=Trabalho: {0}
 
courseunit.teacher.situation=Situação de Professores
courseunit.teacher.situation.withTeachers=Com Professor
courseunit.teacher.situation.withNoTeachers=Sem Professor
courseunit.teacher.situation.all=Todos
courseunit.S1=1º Semestre
courseunit.S2=2ª Semestre
courseunit.ALL=Todos os Semestres
courseunit.assignement.delivered.date=Data de Entrega
courseunit.assignement.deliver.date=Data Limite de Entrega
courseunit.assignement.deliver.type=Tipo de entrega
/impl/conf/WEB-INF/struts/struts-courses.xml
34,7 → 34,7
<forward name="load" path="page.load.course"/>
</action>
 
<action path="/user/startLoadCoursesProgramsFromServiceZone" forward="/user/courseControllerFromHome.do?dispatch=loadCoursesPrograms&amp;fromDispatch=loadCoursesPrograms&amp;from=ServiceZone"/>
<action path="/user/startLoadCoursesProgramsFromServiceZone" forward="/user/courseControllerFromServiceZone.do?dispatch=loadCoursesPrograms&amp;fromDispatch=loadCoursesPrograms&amp;from=ServiceZone"/>
<action path="/user/startLoadDirectedCoordinatedCoursesFromServiceZone" forward="/user/courseControllerFromServiceZone.do?dispatch=loadDirectedCoordininatedCourses&amp;fromDispatch=loadDirectedCoordininatedCourses&amp;from=ServiceZone"/>
<action path="/user/startSelectCourseFromServiceZone" forward="page.select.course.from.service.zone"/>
<action path="/user/startEditCourseFromServiceZone" forward="/user/courseControllerFromServiceZone.do?dispatch=edit&amp;from=ServiceZone"/>
/impl/conf/app.properties
140,24 → 140,29
user.role.08=teacher.eg
user.role.09=teacher.dg
user.role.10=teacher.ce
user.role.11=worker
user.role.12=invited
user.role.13=services
user.role.14=administrativeCouncil
user.role.15=scientificCouncil
user.role.16=pedagogicCouncil
user.role.17=erasmusCouncil
user.role.18=courseCoordinator
user.role.19=studentAssociation
user.role.20=representativeCouncil
user.role.21=computerCenter
user.role.22=courseCoordinator
user.role.23=courseDirector
user.role.24=identifiersManager
user.role.25=identifiersCollectionCreator
user.role.26=servicesPrograms
user.role.27=studentsID
user.role.28=studentsFSIR
user.role.11=teacher.ch
user.role.12=worker
user.role.13=invited
user.role.14=services
user.role.15=administrativeCouncil
user.role.16=scientificCouncil
user.role.17=pedagogicCouncil
user.role.18=erasmusCouncil
user.role.19=courseCoordinator
user.role.20=studentAssociation
user.role.21=representativeCouncil
user.role.22=computerCenter
user.role.23=courseCoordinator
user.role.24=courseDirector
user.role.25=identifiersManager
user.role.26=identifiersCollectionCreator
user.role.27=servicesPrograms
user.role.28=studentsID
user.role.29=studentsFSIR
user.role.30=student.eg
user.role.31=student.dg
user.role.32=student.ce
user.role.33=student.ch
 
 
#########################################################################
372,6 → 377,14
 
 
 
###########################################################################
#
# AREAS CIENTIFICAS
#
 
area.1=eg
area.2=dg
area.3=ce
area.4=ch
 
 
/impl/conf/directories/directory.xsd
38,6 → 38,22
<xs:documentation>Grouping purposes in styling</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="showNav" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation>Show link to this node in navigation menus, true by default</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="type" use="optional">
<xs:annotation>
<xs:documentation>Type of node, by default HTTP link</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="ftp"/>
<xs:enumeration value="http"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="id" type="xs:ID" use="required"/>
</xs:complexType>
<xs:complexType name="leafT">
45,6 → 61,13
<xs:documentation>A leaf is an URL for an external or internal WEB site</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>A leaf can be a root of some diferent system like FTP server Directory</xs:documentation>
</xs:annotation>
<xs:element name="node" type="nodeT"/>
<xs:element name="leaf" type="leafT"/>
</xs:choice>
<xs:element name="rights" type="rightsT" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="url" type="xs:string" use="required"/>
81,6 → 104,33
<xs:documentation>Grouping purposes in styling</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ftpDirectory" type="xs:boolean"/>
<xs:attribute name="size" use="optional">
<xs:annotation>
<xs:documentation>Size of content in Kb</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="mimeType" use="optional">
<xs:annotation>
<xs:documentation>Mime Type of content in Kb</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lastModification" use="optional">
<xs:annotation>
<xs:documentation>Last Modification of content in Kb</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="visualization" use="optional">
<xs:annotation>
<xs:documentation>Type of node, by default HTTP link</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="filesystem"/>
<xs:enumeration value="normal"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="groupDeclarationT">
<xs:sequence>
/impl/conf/directories/style1.xsl
10,7 → 10,8
<xsl:param name="roles">professor,administrador</xsl:param>
<!--<xsl:param name="ACTUAL">pagina_a1.2.1</xsl:param>-->
<!--<xsl:param name="ACTUAL">ficha_trabalhoIncluido</xsl:param>-->
<xsl:param name="ACTUAL">pagina_teste.html</xsl:param>
<xsl:param name="ACTUAL">ionline</xsl:param>
<xsl:param name="ACTUAL_REMOTE_CHILD"></xsl:param>
<xsl:param name="includeXML">oai_dc.xml</xsl:param>
<xsl:template match="/">
380,12 → 381,77
<xsl:apply-templates select=".." mode="latNav"/>
</td>
<td class="contentPortal">
<xsl:apply-templates select="." mode="bodyContent"/>
<xsl:choose>
<xsl:when test="not(./d:leaf)">
<xsl:apply-templates select="." mode="bodyContent"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="//*[@id=$ACTUAL_REMOTE_CHILD]">
<xsl:apply-templates select="//*[@id=$ACTUAL_REMOTE_CHILD]" mode="remoteChildsContent"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="remoteChildsContent"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="d:node" mode="remoteChildsContent">
<xsl:apply-templates select="." mode="topNavRemote"/>
 
</xsl:template>
<xsl:template match="d:leaf" mode="remoteChildsContent">
<xsl:apply-templates select="." mode="topNavRemote"/>
<div class="files">
<table cellpadding="0" cellspacing="0">
<tr>
<th>
Nome do ficheiro/pasta
</th>
<th>
Data de Modificação
</th>
<th>
Tamanho
</th>
</tr>
<xsl:apply-templates select="./d:leaf[@d:ftpDirectory='true']" mode="ftpLine"/>
<xsl:apply-templates select="./d:leaf[@d:ftpDirectory='false']" mode="ftpLine"/>
</table>
</div>
</xsl:template>
<xsl:template match="d:leaf" mode="ftpLine">
<xsl:choose>
<xsl:when test="./@d:ftpDirectory='true'">
<tr>
<td colspan="3">
<img>
<xsl:attribute name="src"><xsl:value-of select="$contextPath"/>/imgs/folder.gif</xsl:attribute>
</img>
<xsl:value-of select="@d:label"/>
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr>
<td>
<xsl:value-of select="./@d:label"/>
</td>
<td>
<xsl:value-of select="./@d:lastModification"/>
</td>
<td>
<xsl:value-of select="./@d:size"/>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--<xsl:function name="d:parse" as="document-node()">
<xsl:param name="s" as="xs:string"/>
<xsl:sequence select="doc(concat('data:text/xml','&lt;ola&gt;teste&lt;/ola&gt;'))"/>
439,7 → 505,29
</div>-->
</xsl:template>
<xsl:template match="d:leaf" mode="topNavRemote">
<div id="topnav">
<ul>
<li class="navPlace">
raiz
</li>
</ul>
</div>
</xsl:template>
<xsl:template match="d:node" mode="topNavRemote">
<div id="topnav">
<ul>
<xsl:apply-templates select=".." mode="navBackRemote"/>
<li class="navPlace">
&gt;
<xsl:apply-templates select="." mode="label"/>
</li>
</ul>
</div>
</xsl:template>
<xsl:template match="d:directory" mode="navBack">
<li class="navPlace">
<xsl:call-template name="homeLink"/>
459,6 → 547,21
</li>
</xsl:template>
<xsl:template match="d:leaf" mode="navBackRemote">
<li class="navPlace">
&gt;
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:template>
<xsl:template match="d:node" mode="navBackRemote">
<xsl:apply-templates select=".." mode="navBack"/>
<li class="navPlace">
&gt;
<xsl:apply-templates select="." mode="link"/>
</li>
</xsl:template>
<!--
===========================================================
| Barra de Navegação Lateral Esquerda
/impl/conf/berserk/sd.xml
853,7 → 853,7
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="ServicesOrOrganisms"/>
<chain name="AuthenticatedUsers"/>
</filterChains>
</service>
<service>
1109,6 → 1109,16
</filterChains>
</service>
<service>
<name>LoadCoursesImportYearArea</name>
<implementationClass>pt.estgp.estgweb.services.courses.CoursesService</implementationClass>
<description>Load All Courses</description>
<isTransactional>true</isTransactional>
<defaultMethod>loadCoursesImportYearArea</defaultMethod>
<filterChains>
<chain name="Logger"/>
</filterChains>
</service>
<service>
<name>LoadCoursesImportYear</name>
<implementationClass>pt.estgp.estgweb.services.courses.CoursesService</implementationClass>
<description>Load All Courses</description>
/impl/src/java/jomm/web/ftp/impl/FtpFile.java
141,4 → 141,18
}
return navPlaces;
}
 
public static List<IFile> init(FTPFile[] files, String server, String path) throws URIException
{
List<IFile> iFiles = new ArrayList<IFile>();
for (FTPFile ftpFile : files)
{
IFile iFile;
if (path.endsWith("/"))
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path +ftpFile.getName(),"ISO-8859-1"), path);
else iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + "/" + ftpFile.getName(),"ISO-8859-1"), path);
iFiles.add(iFile);
}
return iFiles;
}
}
/impl/src/java/pt/estgp/estgweb/utils/AreasBelongUtils.java
New file
0,0 → 1,126
package pt.estgp.estgweb.utils;
 
import pt.estgp.estgweb.domain.SigesUser;
import pt.estgp.estgweb.Globals;
 
import javax.servlet.http.HttpServletRequest;
import java.util.List;
 
import jomm.utils.MessageResources;
 
/**
* @author Jorge
* @date 16/Jan/2009
* @time 15:45:25
*/
public class AreasBelongUtils
{
private static String AREA_MESSAGE_RESOURCES_PREFIX = "area.";
public static String AREAS_SEPARATOR = ",";
 
private static List<String> areas = null;
 
public static boolean hasArea(SigesUser u, List requiredAreas)
{
if(u == null)
return false;
for(Object area: requiredAreas)
{
if(hasArea(u,(String) area))
return true;
}
return false;
}
 
public static boolean hasArea(SigesUser u, String requiredArea)
{
if(u == null)
return false;
if(u.getAreasBelong() == null || u.getAreasBelong().length() == 0)
return false;
 
String[] areas = u.getAreasBelong().split(AREAS_SEPARATOR);
for(String area: areas)
{
if(area.equals(requiredArea))
return true;
}
return false;
}
 
public static boolean hasArea(List<String> areas, String requiredAreas)
{
if(areas == null || areas.size() == 0)
return false;
 
for(String area: areas)
{
if(area.equals(requiredAreas))
return true;
}
return false;
}
 
 
public static List readAreas()
{
if(areas == null)
{
areas = Globals.AREAS;
}
return areas;
}
 
public static String getAreaDescription(HttpServletRequest request, String area)
{
return MessageResources.getMessage(request, AREA_MESSAGE_RESOURCES_PREFIX + area);
}
 
public static String getSerialAreas(List<String> targetRoles)
{
return StringsUtils.getSerialStrings(targetRoles,AREAS_SEPARATOR);
}
 
public static List<String> getAreasFromSerial(String areasStr)
{
return StringsUtils.getStringsFromSerial(areasStr,AREAS_SEPARATOR);
}
 
public static String addArea(String old, String newArea)
{
if(old == null || old.length() == 0)
return newArea;
else
{
List<String> oldArea = getAreasFromSerial(old);
if(!oldArea.contains(newArea))
oldArea.add(newArea);
else
return old;
return getSerialAreas(oldArea);
}
}
 
public static String removeArea(String old, String toRemoveArea)
{
if(old == null || old.length() == 0)
return "";
else
{
List<String> oldAreas = getAreasFromSerial(old);
while(oldAreas.contains(toRemoveArea))
oldAreas.remove(toRemoveArea);
return getSerialAreas(oldAreas);
}
}
 
 
public static String catArea(String old, String newArea)
{
if(old == null || old.length() == 0)
return newArea;
else
return old + AREAS_SEPARATOR + newArea;
}
 
}
/impl/src/java/pt/estgp/estgweb/utils/StringsUtils.java
New file
0,0 → 1,41
package pt.estgp.estgweb.utils;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge
* @date 16/Jan/2009
* @time 15:40:42
*/
public class StringsUtils
{
public static String getSerialStrings(List<String> strings, String separator)
{
if (strings == null)
return null;
String roles = null;
for (String role : strings)
{
if (roles == null)
roles = role;
else
roles += separator + role;
}
return roles;
}
 
public static List<String> getStringsFromSerial(String stringsSerial, String separator)
{
if (stringsSerial == null)
return null;
String[] roles = stringsSerial.split(separator);
List<String> l = new ArrayList<String>();
for (String role : roles)
{
l.add(role);
}
return l;
}
 
}
/impl/src/java/pt/estgp/estgweb/utils/Dom4jUtil.java
13,6 → 13,7
import java.net.URL;
import java.util.Hashtable;
import java.util.Map;
import java.util.HashMap;
 
import pt.estgp.estgweb.Globals;
import javax.xml.transform.TransformerFactory;
65,9 → 66,51
});
}
 
private static Map<String,byte[]> sourceXmls = new HashMap<String,byte[]>();
 
/**
* Search for Source Document in cache
*
* @param file in src tree
* @return bytes
* @throws java.io.IOException on read error
*/
public static byte[] getSourceFile(String file) throws IOException
{
byte[] bytes;
if((bytes = sourceXmls.get(file)) != null)
{
return bytes;
}
 
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
ByteArrayOutputStream output = new ByteArrayOutputStream();
int read;
byte[] buffer = new byte[1024];
while((read = stream.read(buffer)) > 0)
{
output.write(buffer,0,read);
}
output.close();
stream.close();
bytes = output.toByteArray();
sourceXmls.put(file, bytes);
return bytes;
}
 
public static Document parseSourceFileFromCache(String file) throws DocumentException, IOException
{
byte[] bytes = getSourceFile(file);
SAXReader reader = new SAXReader();
reader.setValidation(false);
createIgnoreErrorHandler(reader);
return reader.read(new ByteArrayInputStream(bytes));
}
 
public static Document parseSourceFile(String file) throws DocumentException, IOException
{
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
SAXReader reader = new SAXReader();
reader.setValidation(false);
createIgnoreErrorHandler(reader);
/impl/src/java/pt/estgp/estgweb/utils/RoleManager.java
82,30 → 82,12
 
public static String getSerialRoles(List<String> targetRoles)
{
if(targetRoles == null)
return null;
String roles = null;
for(String role: targetRoles)
{
if(roles == null)
roles = role;
else
roles += ROLE_SEPARATOR + role;
}
return roles;
return StringsUtils.getSerialStrings(targetRoles,ROLE_SEPARATOR);
}
 
public static List<String> getRolesFromSerial(String rolesStr)
{
if(rolesStr == null)
return null;
String[] roles = rolesStr.split(ROLE_SEPARATOR);
List<String> l = new ArrayList<String>();
for(String role: roles)
{
l.add(role);
}
return l;
return StringsUtils.getStringsFromSerial(rolesStr,ROLE_SEPARATOR);
}
 
public static String addRole(String old, String newRole)
/impl/src/java/pt/estgp/estgweb/Globals.java
82,6 → 82,9
 
public static final String BLOG_TYPE_COURSE_UNIT = ConfigProperties.getProperty("blog.type.courseunit");
 
 
public static final List<String> AREAS = ConfigProperties.getListValues("area");
 
/*SIGES WEB SERVICES*/
public static final BigDecimal NATIONAL_INSTITUTION_CODE = new BigDecimal(ConfigProperties.getIntProperty("national.institution.code"));
public static final BigDecimal SIGES_INSTITUTION_CODE = new BigDecimal(ConfigProperties.getIntProperty("siges.institution.code"));
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesCommonServices.java
107,7 → 107,7
int missing = DaoFactory.getCourseUnitDaoImpl().countMissingProgramGivenCourse(course.getId());
if(missing > 0)
{
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.objectives.todo",""+missing,"/user/startLoadDirectedCoordinatedCoursesFromHome.do#" + course.getId());
DefaultToDo defaultToDo = new DefaultToDo(course.getName(),null,null, "course.courseunit.program.objectives.todo",""+missing,"/user/startLoadCoursesProgramsFromHome.do?area=" + course.getArea() +"#" + course.getId());
todos.add(defaultToDo);
}
}
/impl/src/java/pt/estgp/estgweb/services/courses/SetUserArea.java
New file
0,0 → 1,76
package pt.estgp.estgweb.services.courses;
 
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.utils.RoleManager;
import pt.estgp.estgweb.utils.StringsUtils;
import pt.estgp.estgweb.utils.AreasBelongUtils;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.*;
import jomm.dao.impl.AbstractDao;
import static org.hibernate.criterion.Restrictions.*;
 
import java.util.List;
 
import org.hibernate.Query;
import org.hibernate.Criteria;
import org.apache.log4j.Logger;
 
/**
* @author Jorge
* @date 16/Jan/2009
* @time 15:17:12
*/
public class SetUserArea
{
private static final Logger logger = Logger.getLogger(SetUserArea.class);
 
public void run()
{
List<Student> students = DaoFactory.getStudentDaoImpl().findAll();
for (Student student : students)
{
Query q = AbstractDao.getCurrentSession().createQuery("select distinct c.area from c in class " + Course.class.getName() + " inner join c.courseUnits as cu inner join cu.students as s where s.id = " + student.getId());
List<String> areas = q.list();
if (areas != null && areas.size() > 0)
{
for(String area: areas)
{
student.removeRole("teacher." + area);
student.addRole("student." + area);
}
String areasStr = AreasBelongUtils.getSerialAreas(areas);
student.setAreasBelong(areasStr);
logger.info("Setting student: " + student.getId() + " areas:" + areasStr);
}
else
logger.warn("Student ID=" + student.getId() + ": SIGES(" + student.getSigesCode() + ")" + student.getName() + " has no subscribed units");
}
List<Teacher> teachers = DaoFactory.getTeacherDaoImpl().findAll();
for (Teacher teacher : teachers)
{
Query q = AbstractDao.getCurrentSession().createQuery("select distinct c.area from c in class " + Course.class.getName() + " inner join c.courseUnits as cu inner join cu.teachers as s where s.id = " + teacher.getId());
List<String> areas = q.list();
if (areas != null && areas.size() > 0)
{
for(String area: areas)
{
teacher.addRole("teacher." + area);
}
String areasStr = AreasBelongUtils.getSerialAreas(areas);
teacher.setAreasBelong(areasStr);
logger.info("Setting Teacher: " + teacher.getId() + " areas:" + areasStr);
}
else
logger.warn("Student ID=" + teacher.getId() + ": SIGES(" + teacher.getSigesCode() + ")" + teacher.getName() + " has no teached units");
}
 
}
 
public static void main(String[] args) throws ServiceException
{
AbstractDao.getCurrentSession().beginTransaction();
new SetUserArea().run();
AbstractDao.getCurrentSession().getTransaction().commit();
}
}
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesService.java
168,6 → 168,18
return courseViews;
}
 
public List<CourseView> loadCoursesImportYearArea(String importYear, String area) throws ServiceException
{
List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(importYear,area);
List<CourseView> courseViews = new ArrayList<CourseView>();
for(Course c: courses)
{
CourseView courseView = new CourseView(c);
courseViews.add(courseView);
}
return courseViews;
}
 
public List<CourseView> loadCoursesImportYear() throws ServiceException
{
String importYearIntranet = DatesUtils.getImportYear();
/impl/src/java/pt/estgp/estgweb/services/courseunits/DirectedCoordinatedCourses.java
17,10 → 17,12
private List<CourseView> merge;
private int updated;
private int missing;
private String area;
private long courseId;
 
public DirectedCoordinatedCourses()
{
System.out.println("");
}
 
public List<CourseView> getDirectedCourses()
78,5 → 80,24
}
 
 
public String getArea()
{
return area;
}
 
public void setArea(String area)
{
this.area = area;
}
 
 
public long getCourseId()
{
return courseId;
}
 
public void setCourseId(long courseId)
{
this.courseId = courseId;
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/DirectedCoordinatedUnitsService.java
1,13 → 1,12
package pt.estgp.estgweb.services.courseunits;
 
import pt.estgp.estgweb.domain.Course;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.utils.CourseViewComparator;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.utils.AreasBelongUtils;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.ArrayList;
64,21 → 63,76
return directedCoordinatedCourses;
}
 
public DirectedCoordinatedCourses loadForServices(String importYear, UserSession userSession)
// public DirectedCoordinatedCourses loadForServices(String importYear, UserSession userSession)
// {
// if(importYear == null)
// importYear = DatesUtils.getImportYear();
// List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(importYear);
//
// List<CourseView> courseViews = new ArrayList<CourseView>();
// for(Course c : courses)
// {
// CourseView cV = new CourseView(c, true);
// courseViews.add(cV);
// }
// fill(courseViews);
// DirectedCoordinatedCourses directedCoordinatedCourses = new DirectedCoordinatedCourses();
// directedCoordinatedCourses.setMerge(courseViews);
// return directedCoordinatedCourses;
// }
 
public DirectedCoordinatedCourses loadForServices(String importYear, long courseId, String semestre, String area, TeachersSituationEnum teachersSituationEnum, UserSession userSession)
{
if(importYear == null)
importYear = DatesUtils.getImportYear();
List<Course> courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(importYear);
 
/**
* Area and Course Initialization
*/
if (area == null && userSession.getUser() != null && userSession.getUser() instanceof Teacher)
{
SigesUser sigesUser = (SigesUser) userSession.getUser();
if (sigesUser.getAreasBelong() != null && sigesUser.getAreasBelong().length() > 0)
{
area = AreasBelongUtils.getAreasFromSerial(sigesUser.getAreasBelong()).get(0);
}
}
/**
* If is a student can see only his course
*/
if (userSession.getUser() != null && userSession.getUser() instanceof Student)
{
StudentImpl sigesUser = (StudentImpl) userSession.getUser();
if (sigesUser.getSubscribedUnits() != null && sigesUser.getSubscribedUnits().size() > 0)
{
Course course = sigesUser.getSubscribedUnits().iterator().next().getCourse();
courseId = course.getId();
}
}
 
List<Course> courses;
 
if(courseId > 0)
{
courses = new ArrayList<Course>();
courses.add(DaoFactory.getCourseDaoImpl().get(courseId));
}
else
{
courses = DaoFactory.getCourseDaoImpl().findAllOrderByName(importYear,area);
}
 
List<CourseView> courseViews = new ArrayList<CourseView>();
for(Course c : courses)
{
CourseView cV = new CourseView(c, true);
CourseView cV = new CourseView(c, false);
courseViews.add(cV);
}
fill(courseViews);
fill(courseViews, semestre, importYear, teachersSituationEnum);
DirectedCoordinatedCourses directedCoordinatedCourses = new DirectedCoordinatedCourses();
directedCoordinatedCourses.setMerge(courseViews);
directedCoordinatedCourses.setArea(area);
directedCoordinatedCourses.setCourseId(courseId);
return directedCoordinatedCourses;
}
 
112,6 → 166,48
}
}
 
private void fill(List<CourseView> courseViews, String semestre, String importYear, TeachersSituationEnum teachersSituationEnum)
{
boolean withTeacher = true;
boolean withNoTeacher = true;
 
if(teachersSituationEnum == TeachersSituationEnum.withNoTeachers)
withTeacher = false;
else if(teachersSituationEnum == TeachersSituationEnum.withTeachers)
withNoTeacher = false;
 
for (CourseView cV : courseViews)
{
cV.setCourseUnitsWithNoProgramS1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithNoProgramS2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedS1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramCheckedS2(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedS1(new ArrayList<CourseUnitView>());
cV.setCourseUnitsWithProgramNotCheckedS2(new ArrayList<CourseUnitView>());
 
 
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadCourseUnits(cV.getId(),semestre,importYear,withTeacher,withNoTeacher);
for (CourseUnit cU : courseUnits)
{
CourseUnitView cUV = new CourseUnitView(cU,true,false,false,false);
if (cUV.getProgramStreamId() == null)
if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithNoProgramS1().add(cUV);
else
cV.getCourseUnitsWithNoProgramS2().add(cUV);
else if (cUV.isValidProgram())
if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramCheckedS1().add(cUV);
else
cV.getCourseUnitsWithProgramCheckedS2().add(cUV);
else if (cUV.getSemestre().equals("S1"))
cV.getCourseUnitsWithProgramNotCheckedS1().add(cUV);
else
cV.getCourseUnitsWithProgramNotCheckedS2().add(cUV);
}
}
}
 
public DirectedCoordinatedCourses update(DirectedCoordinatedCourses directedCoordinatedCourses, UserSession userSession)
{
int counter = 0;
153,4 → 249,23
}
return counter;
}
 
public static enum TeachersSituationEnum
{
withTeachers,
withNoTeachers,
all;
 
public static TeachersSituationEnum parse(String situation)
{
if(situation == null)
return all;
else if(situation.equals("withTeachers"))
return withTeachers;
else if(situation.equals("withNoTeachers"))
return withNoTeachers;
else
return all;
}
}
}
/impl/src/java/pt/estgp/estgweb/services/common/impl/DefaultResult.java
11,6 → 11,7
public class DefaultResult implements IResult
{
 
 
private String title;
private String subTitle;
21,8 → 22,10
private boolean subTitleKey = false;
private boolean textKey = false;
 
private LabelGroup subTitlesGroup = null;
 
 
 
public DefaultResult() {
}
 
90,4 → 93,15
public void setSubTitleKey(boolean subTitleKey) {
this.subTitleKey = subTitleKey;
}
 
 
public LabelGroup getSubTitlesGroup()
{
return subTitlesGroup;
}
 
public void setSubTitlesGroup(LabelGroup subTitlesGroup)
{
this.subTitlesGroup = subTitlesGroup;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/IResult.java
1,5 → 1,8
package pt.estgp.estgweb.services.common;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
* @date 24/Abr/2008
16,4 → 19,85
public String getText();
public boolean isTextKey();
public String getUrl();
public LabelGroup getSubTitlesGroup();
 
/**
* Class to support groups of labels
* usefull to add groups of message keys
*/
public static class LabelGroup
{
private String title;
private boolean key;
 
private List<Label> labels;
 
public LabelGroup()
{
labels = new ArrayList<Label>();
}
 
public List<Label> getLabels()
{
return labels;
}
 
public void setLabels(List<Label> labels)
{
this.labels = labels;
}
 
 
public String getTitle()
{
return title;
}
 
public void setTitle(String title)
{
this.title = title;
}
 
public boolean isKey()
{
return key;
}
 
public void setKey(boolean key)
{
this.key = key;
}
}
public static class Label
{
private String label;
private boolean key;
 
 
public Label(String label, boolean key)
{
this.label = label;
this.key = key;
}
 
public String getLabel()
{
return label;
}
 
public void setLabel(String label)
{
this.label = label;
}
 
public boolean isKey()
{
return key;
}
 
public void setKey(boolean key)
{
this.key = key;
}
}
}
/impl/src/java/pt/estgp/estgweb/services/utils/TransformXmlService.java
32,7 → 32,6
String xmlFile = args[0];
String xslTemplate = args[1];
String fileDest = args[2];
System.out.println("");
try
{
new TransformXmlService().transform(xmlFile,xslTemplate,fileDest);
/impl/src/java/pt/estgp/estgweb/services/profile/ProfileCommonServices.java
8,6 → 8,7
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 org.apache.log4j.Logger;
 
import java.util.List;
57,6 → 58,25
{
DefaultResult defaultResult = new DefaultResult();
defaultResult.setTitle(u.getName());
defaultResult.setSubTitleKey(true);
 
if(u.hasRole(Globals.TEACHER_ROLE))
{
defaultResult.setSubTitle("user.role." + Globals.TEACHER_ROLE);
}
else if(u.hasRole(Globals.STUDENT_ROLE))
{
defaultResult.setSubTitle("user.role." + Globals.STUDENT_ROLE);
}else if(u.isSuperuser())
{
defaultResult.setSubTitle("superuser");
}
else if(u.isAdmin())
{
defaultResult.setSubTitle("user.role." + Globals.ADMIN_ROLE);
}
 
if (from == null)
defaultResult.setUrl("/startProfile.do?userView.id=" + u.getId());
else
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseDaoImpl.java
63,6 → 63,21
.list();
}
 
public List<Course> findAllImportYearOrderByName(String importYear, String area)
{
Criteria c = createCriteria();
if (importYear != null && importYear.length() > 0)
{
c.add(eq("importYear", importYear));
}
if (area != null && area.length() > 0)
{
c.add(eq("area", area));
}
return c.addOrder(Order.asc("name"))
.list();
}
 
public List<Course> findAllOrderByName(String importYear)
{
return createCriteria()
71,6 → 86,17
.list();
}
 
public List<Course> findAllOrderByName(String importYear, String area)
{
Criteria c = createCriteria();
if (importYear != null && importYear.length() > 0)
c.add(eq("importYear", importYear));
if (area != null && area.length() > 0)
c.add(eq("area", area));
return c.addOrder(Order.asc("name"))
.list();
}
 
public List<String> loadImportYears()
{
Query q = createQuery("select distinct c.importYear from c in class " + Course.class.getName() + " order by c.importYear desc");
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseUnitDaoImpl.java
13,6 → 13,7
import org.hibernate.criterion.Order;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.sql.JoinFragment;
import org.apache.log4j.Logger;
 
import java.util.List;
151,7 → 152,29
.uniqueResult();
}
 
public List<CourseUnit> loadCourseUnits(long courseId, String semestre, String year, boolean withTeacher, boolean withNoTeacher)
{
Criteria c = createCriteria();
if(courseId > 0)
c.add(eq("course.id", courseId));
if(semestre != null && semestre.length() > 0)
c.add(eq("semestre", semestre));
if(year != null && year.length() > 0)
c.add(eq("importYear", year));
if(withTeacher && !withNoTeacher)
{
c.createAlias("teachers", "th");
c.add(isNotNull("th.id"));
}
else if(!withTeacher && withNoTeacher)
{
c.createAlias("teachers", "th", JoinFragment.LEFT_OUTER_JOIN);
c.add(isNull("th.id"));
}
return c.list();
}
 
 
public int countCourseUnits(String query, SearchTypeEnum searchType)
{
Criterion c = DaoUtils.createSearchQuery(query, searchType, "objectives", "name");
/impl/src/java/pt/estgp/estgweb/domain/SigesUserImpl.java
New file
0,0 → 1,10
package pt.estgp.estgweb.domain;
 
/**
* @author Jorge
* @date 16/Jan/2009
* @time 15:34:38
*/
public abstract class SigesUserImpl extends SigesUser
{
}
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitView.java
469,19 → 469,23
 
public String getTeachersSnipet()
{
String sep = "";
StringBuilder strBuilder = new StringBuilder();
if(teachers != null && teachers.size() > 0)
{
for(UserView userView: teachers)
{
strBuilder
.append(sep)
.append(" ")
.append(" <a href=\"mailto:")
.append(userView.getEmail())
.append("\">")
.append(userView.getName())
.append("</a>")
.append(" ");
 
;
sep = ",";
}
}
return strBuilder.toString();
/impl/src/java/pt/estgp/estgweb/domain/views/CourseView.java
24,7 → 24,9
 
 
private long id;
 
private String code;
private String area;
private String name;
private String degree;
private String importYear;
84,6 → 86,7
this.course = course;
this.id = course.getId();
this.code = course.getCode();
this.area = course.getArea();
this.name = course.getName();
this.degree = course.getDegree();
this.description = course.getDescription();
116,6 → 119,7
public void persistViewInObject(Course c)
{
c.setCode(code);
c.setArea(area);
c.setDegree(degree);
c.setDescription(description);
c.setImportYear(importYear);
182,6 → 186,16
this.code = code;
}
 
public String getArea()
{
return area;
}
 
public void setArea(String area)
{
this.area = area;
}
 
public String getName()
{
return name;
/impl/src/java/pt/estgp/estgweb/domain/GenericUserImpl.java
9,6 → 9,10
 
import org.apache.log4j.Logger;
 
import javax.servlet.http.HttpServletRequest;
 
import jomm.utils.MessageResources;
 
/**
* @author Jorge Machado
* @date 2/Mar/2008
97,4 → 101,19
{
return isSuperuser() || isAdmin();
}
 
public String getRolesDescription(HttpServletRequest request,String separator)
{
String sep = "";
StringBuilder strBuilder = new StringBuilder();
for (String role : getRolesList())
{
if (!role.equals(Globals.SUPER_USER_ROLE))
{
strBuilder.append(sep + MessageResources.getMessage(request, "user.role." + role));
sep = separator;
}
}
return strBuilder.toString();
}
}
/impl/src/java/pt/estgp/estgweb/web/DirWebProxy.java
2,8 → 2,9
 
import org.apache.log4j.Logger;
import org.apache.commons.httpclient.util.URIUtil;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.dom4j.*;
import org.dom4j.io.OutputFormat;
 
import javax.servlet.http.HttpServlet;
13,9 → 14,7
import javax.servlet.jsp.JspWriter;
import java.io.*;
import java.net.*;
import java.util.Date;
import java.util.Map;
import java.util.HashMap;
import java.util.*;
import java.util.zip.ZipInputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.InflaterInputStream;
25,6 → 24,10
import pt.estgp.estgweb.domain.UserSession;
import freemarker.template.utility.HtmlEscape;
import com.lowagie.text.html.HtmlEncoder;
import jomm.web.ftp.IFile;
import jomm.web.ftp.FileType;
import jomm.web.ftp.impl.FtpFile;
import jomm.web.utils.NavPlace;
 
/**
* @author Jorge Machado
50,19 → 53,18
{
 
String element = (String) request.getAttribute("element");
if(element.equals("node"))
if (element.equals("node"))
{
processNode(request,response);
processNode(request, response);
}
else
{
processLeaf(request,response);
processLeaf(request, response);
}
}
 
 
/**
*
* @param request
* @param response
* @throws ServletException
72,16 → 74,19
protected static void processNode(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
styleDirectory(request,response);
styleDirectory(request, response);
}
 
protected static void processLeaf(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String path = (String) request.getAttribute("path");
String startPath = (String) request.getAttribute("startPath");
String leafUrl = (String) request.getAttribute("leaf.url");
String server = (String) request.getAttribute("server");
String useOutputStream = (String) request.getAttribute("useOutputStream");
String encoding = (String) request.getAttribute("encoding");
String proxyKey = (String) request.getAttribute("proxyKey");
String proxyHost = (String) request.getAttribute("proxy.host");
String proxyPort = (String) request.getAttribute("proxy.port");
boolean style = Boolean.parseBoolean((String) request.getAttribute("style"));
90,6 → 95,7
 
logger.info("server:" + server);
logger.info("path:" + path);
logger.info("proxyKey:" + proxyKey);
logger.info("proxyHost:" + proxyHost);
logger.info("proxyPort:" + proxyPort);
logger.info("xml:" + xml);
108,35 → 114,44
 
 
String finalURL = server + URIUtil.encodePath(path, "ISO-8859-1");
URL url = new URL(finalURL);
 
if (!finalURL.startsWith("ftp://"))
{
URL url = new URL(finalURL);
 
if (useOutputStream != null && useOutputStream.equals("true"))
{
InputStream stream = openStream(finalURL,proxy);
URLConnection con = url.openConnection();
response.setContentType(con.getContentType());
if(xml == null || xml.equals("false"))
response.setCharacterEncoding(encoding);
response.setContentLength(con.getContentLength());
writeDirectStream(response,stream);
}
else if(xml == null || xml.equals("false"))
{
InputStream stream = openStream(finalURL,proxy);
String content = readContent2String(stream,encoding);
generateOutputLeaf(response,request,content,style);
}
else
{
URLConnection con = new URL(finalURL).openConnection();
con.connect();
if(con.getContentLength()>0)
if (useOutputStream != null && useOutputStream.equals("true"))
{
InputStream stream = openStream(finalURL, proxy);
URLConnection con = url.openConnection();
response.setContentType(con.getContentType());
if (xml == null || xml.equals("false"))
response.setCharacterEncoding(encoding);
response.setContentLength(con.getContentLength());
writeDirectStream(response, stream);
}
else if (xml == null || xml.equals("false"))
{
InputStream stream = openStream(finalURL, proxy);
String content = readContent2String(stream, encoding);
generateOutputLeaf(response, request, content, style);
}
else
{
URLConnection con = new URL(finalURL).openConnection();
con.connect();
if (con.getContentLength() > 0)
{
// Document dom = Dom4jUtil.parse(stream);
generateOutputLeafXml(response,request,finalURL,proxy,style);
generateOutputLeafXml(response, request, finalURL, proxy, style);
}
}
}
else
{
Document directoryDocument = (Document) request.getAttribute("directoryDocument");
extendDiretoryDocument(request, path, proxyKey, server, startPath + leafUrl, directoryDocument);
styleDirectory(request, response);
}
}
catch (FileNotFoundException e)
{
153,15 → 168,199
logger.warn("url not found for server:" + server + " and path:" + path);
response.sendError(404);
}
}
 
 
public static String FTP_FILE_PREFIX = "FTP_";
 
public static void addAttribute(Element element, String name, String value)
{
element.addAttribute(new QName(name, DirLayoutController.dirNamespace), value);
}
 
 
private static void generateOutputLeafXml(HttpServletResponse response,HttpServletRequest request, String finalURL,Proxy proxy, boolean style) throws IOException, DocumentException
protected static void extendDiretoryDocument(HttpServletRequest request, String path, String serverStr, String server, String startPath, Document directoryDocument)
throws ServletException, IOException
{
if(style)
try
{
Map<String,Object> parameters = new HashMap<String,Object>();
String user = ConfigProperties.getProperty(serverStr + ".user");
String pass = ConfigProperties.getProperty(serverStr + ".pass");
 
if (path != null)
{
 
FtpServer ftpServer = FtpServer.getServer(server, user, pass);
FTPClient client = ftpServer.getClient();
 
Element actualNode = (Element) request.getAttribute("actualNode");
 
if(startPath.equals("/"))
startPath = "";
if (path.equals(startPath))
{
client.changeWorkingDirectory(path);
FTPFile[] files = client.listFiles();
List<IFile> iFiles = FtpFile.init(files, server, path);
//root
for (IFile iFile : iFiles)
{
Element iFileElem = actualNode.addElement(DirLayoutController.leafDir);
addAttribute(iFileElem, "id", FTP_FILE_PREFIX + "0_" + iFile.getName());
addAttribute(iFileElem, "label", iFile.getName());
addAttribute(iFileElem, "visualization", "filesystem");
addAttribute(iFileElem, "size", "" + iFile.getSize());
addAttribute(iFileElem, "lastModification", "" + iFile.getLastUpdate().toString());
if (iFile.getType() == FileType.DIRECTORY)
{
addAttribute(iFileElem, "ftpDirectory", "true");
}
else
{
addAttribute(iFileElem, "ftpDirectory", "false");
addAttribute(iFileElem, "absolute", "true");
addAttribute(iFileElem, "url", iFile.getCompleteUrl());
}
}
}
else
{
 
String pathAux = path.substring(startPath.length());
String[] pathFragments = pathAux.split("/");
 
client.changeWorkingDirectory(startPath);
FTPFile[] files = client.listFiles();
List<IFile> iFiles = FtpFile.init(files, server, path);
Element goDeepElement = null;
for (IFile iFile : iFiles)
{
Element iFileElem = actualNode.addElement(DirLayoutController.nodeDir);
 
addAttribute(iFileElem, "id", FTP_FILE_PREFIX + "0_" + iFile.getName());
addAttribute(iFileElem, "label", iFile.getName());
addAttribute(iFileElem, "visualization", "filesystem");
addAttribute(iFileElem, "size", "" + iFile.getSize());
addAttribute(iFileElem, "lastModification", "" + iFile.getLastUpdate().toString());
if (iFile.getType() == FileType.DIRECTORY)
{
addAttribute(iFileElem, "ftpDirectory", "true");
}
else
{
addAttribute(iFileElem, "ftpDirectory", "false");
addAttribute(iFileElem, "absolute", "true");
addAttribute(iFileElem, "url", iFile.getCompleteUrl());
}
 
if (iFile.getName().equals(pathFragments[0]))
goDeepElement = iFileElem;
}
 
 
 
for (int i = 0; i < pathFragments.length; i++)
{
Element nextGoDeepElement = null;
String d = pathFragments[i];
String startPathAux = startPath + "/" + d;
client.changeWorkingDirectory(startPathAux);
files = client.listFiles();
iFiles = FtpFile.init(files, server, path);
for (IFile iFile : iFiles)
{
Element iFileElem;
 
if(i == pathFragments.length - 1)
iFileElem = goDeepElement.addElement(DirLayoutController.leafDir);
else
iFileElem = goDeepElement.addElement(DirLayoutController.nodeDir);
 
addAttribute(iFileElem, "id", FTP_FILE_PREFIX + (i+1) + "_" + iFile.getName());
addAttribute(iFileElem, "label", iFile.getName());
addAttribute(iFileElem, "visualization", "filesystem");
addAttribute(iFileElem, "size", "" + iFile.getSize());
addAttribute(iFileElem, "lastModification", "" + iFile.getLastUpdate().toString());
if (iFile.getType() == FileType.DIRECTORY)
{
addAttribute(iFileElem, "ftpDirectory", "true");
}
else
{
addAttribute(iFileElem, "ftpDirectory", "false");
addAttribute(iFileElem, "absolute", "true");
addAttribute(iFileElem, "url", iFile.getCompleteUrl());
}
 
if (i < pathFragments.length - 1 && iFile.getName().equals(pathFragments[i + 1]))
nextGoDeepElement = iFileElem;
}
goDeepElement = nextGoDeepElement;
}
request.setAttribute("ACTUAL_REMOTE_CHILD",pathFragments[pathFragments.length - 1]);
}
client.quit();
client.disconnect();
}
else
{
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
}
}
catch (Throwable e)
{
logger.error(e, e);
}
}
 
protected void processRequestFtp(HttpServletRequest request, String path, String serverStr, String server, String startPath)
throws ServletException, IOException
{
try
{
String user = ConfigProperties.getProperty(serverStr + ".user");
String pass = ConfigProperties.getProperty(serverStr + ".pass");
 
if (path != null)
{
 
FtpServer ftpServer = FtpServer.getServer(server, user, pass);
FTPClient client = ftpServer.getClient();
client.changeWorkingDirectory(path);
FTPFile[] files = client.listFiles();
List<IFile> iFiles = new ArrayList<IFile>();
for (FTPFile ftpFile : files)
{
IFile iFile;
if (path.endsWith("/"))
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + ftpFile.getName(), "ISO-8859-1"), path);
else
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + "/" + ftpFile.getName(), "ISO-8859-1"), path);
iFiles.add(iFile);
}
List<NavPlace> navPlaces = FtpFile.getNavPlaces(path, startPath);
request.setAttribute("NavPlaces", navPlaces);
request.setAttribute("files", iFiles);
client.quit();
client.disconnect();
}
else
{
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
}
}
catch (Throwable e)
{
logger.error(e, e);
}
}
 
 
private static void generateOutputLeafXml(HttpServletResponse response, HttpServletRequest request, String finalURL, Proxy proxy, boolean style) throws IOException, DocumentException
{
if (style)
{
Map<String, Object> parameters = new HashMap<String, Object>();
// OutputFormat outputFormat = new OutputFormat();
// outputFormat.setSuppressDeclaration(true);
// outputFormat.setEncoding("UTF-8");
169,24 → 368,24
// Dom4jUtil.write(dom,writer, outputFormat);
// org.w3c.dom.Document d = new org.dom4j.io.DOMWriter().write(dom);
// parameters.put("body",dom.selectSingleNode("/"));
parameters.put("includeXML",finalURL);
styleDirectory(request,response,parameters,null);
parameters.put("includeXML", finalURL);
styleDirectory(request, response, parameters, null);
}
else
{
InputStream stream = openStream(finalURL,proxy);
InputStream stream = openStream(finalURL, proxy);
Document dom = Dom4jUtil.parse(stream);
Dom4jUtil.write(dom,response.getWriter());
Dom4jUtil.write(dom, response.getWriter());
}
}
 
private static void generateOutputLeaf(HttpServletResponse response,HttpServletRequest request, String content, boolean style) throws IOException
private static void generateOutputLeaf(HttpServletResponse response, HttpServletRequest request, String content, boolean style) throws IOException
{
if(style)
if (style)
{
// Map<String,Object> parameters = new HashMap<String,Object>();
// parameters.put("body",content);
styleDirectory(request,response,new HashMap<String,Object>(),content);
styleDirectory(request, response, new HashMap<String, Object>(), content);
}
else
{
196,35 → 395,37
 
private static void styleDirectory(HttpServletRequest request, HttpServletResponse response) throws IOException
{
styleDirectory(request,response,new HashMap<String,Object>(),null);
styleDirectory(request, response, new HashMap<String, Object>(), null);
}
 
private static void styleDirectory(HttpServletRequest request, HttpServletResponse response, Map<String,Object> parameters, String bodyContent) throws IOException
private static void styleDirectory(HttpServletRequest request, HttpServletResponse response, Map<String, Object> parameters, String bodyContent) throws IOException
{
String stylesheet = (String) request.getAttribute("stylesheet");
Document directoryDocument = (Document) request.getAttribute("directoryDocument");
String actualNodeId = (String) request.getAttribute("actualNodeId");
String actualRemoteNodeId = (String) request.getAttribute("ACTUAL_REMOTE_CHILD");
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
 
parameters.put("contextPath",request.getContextPath());
if(userSession.getUsername() != null)
parameters.put("username",userSession.getUsername());
if(userSession.getName() != null)
parameters.put("name",userSession.getName());
if(userSession.getUser() != null)
parameters.put("roles",userSession.getUser().getRoles());
parameters.put("ACTUAL",actualNodeId);
parameters.put("contextPath", request.getContextPath());
if (userSession.getUsername() != null)
parameters.put("username", userSession.getUsername());
if (userSession.getName() != null)
parameters.put("name", userSession.getName());
if (userSession.getUser() != null)
parameters.put("roles", userSession.getUser().getRoles());
parameters.put("ACTUAL", actualNodeId);
parameters.put("ACTUAL_REMOTE_CHILD", actualRemoteNodeId);
 
try
{
String html = Dom4jUtil.styleDocument(directoryDocument,stylesheet,parameters);
if(bodyContent != null)
html = html.replace("@@BODY_CONTENT@@",bodyContent);
String html = Dom4jUtil.styleDocument(directoryDocument, stylesheet, parameters);
if (bodyContent != null)
html = html.replace("@@BODY_CONTENT@@", bodyContent);
response.getWriter().write(html);
}
catch (Exception e)
{
logger.error(e,e);
logger.error(e, e);
response.sendError(500);
}
}
/impl/src/java/pt/estgp/estgweb/web/DirLayoutController.java
13,8 → 13,7
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.io.*;
import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
41,7 → 40,13
 
private static final Logger logger = Logger.getLogger(DirLayoutController.class);
 
public static Map<String, String> namespaces = new HashMap<String, String>();
 
static
{
namespaces.put("d", "http://www.estgp.pt/baco/directory/");
}
 
private static enum DirectoryNodeType
{
node,
104,15 → 109,14
String directory = request.getParameter("directory");
String path = request.getParameter("path");
 
 
try
{
Document directoryDocument = Dom4jUtil.parseSourceFile("/pt/estgp/estgweb/directories/" + directory + ".xml");
Document directoryDocument = Dom4jUtil.parseSourceFileFromCache("/pt/estgp/estgweb/directories/" + directory + ".xml");
 
if (path.startsWith("/"))
path = path.substring(1);
String[] ids = path.split("/");
Map<String, String> namespaces = new HashMap<String, String>();
 
DirectoryNodeType directoryNodeType = null;
String actualNodeId = null;
Element actualNode = null;
121,7 → 125,7
for (String id : ids)
{
XPath idXpath = directoryDocument.createXPath("//*[@id='" + id + "']");
namespaces.put("d", "http://www.estgp.pt/baco/directory/");
 
idXpath.setNamespaceURIs(namespaces);
Element idElem = (Element) idXpath.selectSingleNode(directoryDocument);
if (idElem == null)
173,7 → 177,7
}
String externalFile = buildExternalFile(stopName, ids);
 
putInRequestCommonAttributes(request, actualNodeId, directoryDocument);
putInRequestCommonAttributes(request,actualNode, actualNodeId, directoryDocument);
 
Attribute layoutStrAtt = directoryDocument.getRootElement().attribute("layout");
Attribute layoutRootStrAtt = directoryDocument.getRootElement().attribute("layoutRoot");
213,7 → 217,7
boolean layoutDo = true;
if (layout != null && layout.length() > 0) layoutDo = Boolean.parseBoolean(layout);
if (!layoutDo) layoutChoosed = "layoutEmpty";
putProxyAttributes(request, proxy, externalFile,xml);
putProxyAttributes(request, proxy, externalFile,xml,url);
request.setAttribute("label", label);
request.setAttribute("style", style);
request.setAttribute("xml", xml);
249,19 → 253,23
return (actualNode.attribute(name) != null ? actualNode.attribute(name).getValue() : null);
}
 
private void putProxyAttributes(HttpServletRequest request, String proxy, String externalFile, String xml)
private void putProxyAttributes(HttpServletRequest request, String proxy, String externalFile, String xml, String url)
{
String server = ConfigProperties.getProperty("server." + proxy);
String proxyHost = ConfigProperties.getProperty(proxy + ".proxy.host");
String proxyPort = ConfigProperties.getProperty(proxy + ".proxy.port");
String confStartPath = ConfigProperties.getProperty("server." + proxy + ".start.path");
 
 
request.setAttribute("leaf.url", url);
request.setAttribute("server", server);
request.setAttribute("proxyKey", proxy);
request.setAttribute("proxy.host", proxyHost);
request.setAttribute("proxy.port", proxyPort);
if (confStartPath != null)
externalFile = confStartPath + externalFile;
request.setAttribute("path", externalFile);
request.setAttribute("startPath", confStartPath);
 
if(xml != null && xml.equals("true"))
{
280,10 → 288,11
return;
}
}
request.setAttribute("useOutputStream", "true");
if(!server.startsWith("ftp://"))
request.setAttribute("useOutputStream", "true");
}
 
private void putInRequestCommonAttributes(HttpServletRequest request, String actualNameId, Document directoryDocument)
private void putInRequestCommonAttributes(HttpServletRequest request,Element actualNode, String actualNameId, Document directoryDocument)
{
/**
* Attributes used in Nodes and Leafs
301,6 → 310,7
request.setAttribute("stylesheet", "/pt/estgp/estgweb/directories/" + styleChoosed);
request.setAttribute("directoryDocument", directoryDocument);
request.setAttribute("actualNodeId", actualNameId);
request.setAttribute("actualNode", actualNode);
request.setAttribute("targetRole", targetRoleChoosed);
}
 
335,9 → 345,9
return null;
}
 
Namespace dirNamespace = new Namespace("d", "http://www.estgp.pt/baco/directory/");
QName nodeDir = new QName("node", dirNamespace);
QName leafDir = new QName("leaf", dirNamespace);
public static Namespace dirNamespace = new Namespace("d", "http://www.estgp.pt/baco/directory/");
public static QName nodeDir = new QName("node", dirNamespace);
public static QName leafDir = new QName("leaf", dirNamespace);
 
private boolean pruneDocument(Element startElem, Map namespaces, UserSession userSession)
{
503,165 → 513,6
}
 
 
protected void processRequestFtp(HttpServletRequest request, String path, String serverStr, String server, String startPath)
throws ServletException, IOException
{
try
{
String user = ConfigProperties.getProperty(serverStr + ".user");
String pass = ConfigProperties.getProperty(serverStr + ".pass");
 
if (path != null)
{
 
DirLayoutController.FtpServer ftpServer = getServer(server, user, pass);
FTPClient client = ftpServer.getClient();
client.changeWorkingDirectory(path);
FTPFile[] files = client.listFiles();
List<IFile> iFiles = new ArrayList<IFile>();
for (FTPFile ftpFile : files)
{
IFile iFile;
if (path.endsWith("/"))
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + ftpFile.getName(), "ISO-8859-1"), path);
else
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + "/" + ftpFile.getName(), "ISO-8859-1"), path);
iFiles.add(iFile);
}
List<NavPlace> navPlaces = FtpFile.getNavPlaces(path, startPath);
request.setAttribute("NavPlaces", navPlaces);
request.setAttribute("files", iFiles);
client.quit();
client.disconnect();
}
else
{
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
}
}
catch (Throwable e)
{
logger.error(e, e);
}
}
 
private static HashMap<String, FtpServer> servers = new HashMap<String, DirLayoutController.FtpServer>();
 
/**
* Add a ftpServer to Cache
*
* @param urlStr to parse
* @param user username
* @param pass password
* @return ftpServer
*/
private static synchronized DirLayoutController.FtpServer addServer(String urlStr, String user, String pass)
{
try
{
URL url = new URL(urlStr);
String host = url.getHost();
int port = url.getPort();
if (port <= 0)
port = 21;
logger.info("Connecting to " + host + "in port:" + port);
DirLayoutController.FtpServer ftpServer = new DirLayoutController.FtpServer(host, port, user, pass);
servers.put(urlStr, ftpServer);
return ftpServer;
}
catch (MalformedURLException e)
{
logger.error(e, e);
}
catch (IOException e)
{
logger.error(e, e);
}
return null;
}
 
private static DirLayoutController.FtpServer getServer(String urlStr, String user, String pass)
{
DirLayoutController.FtpServer ftpServer = servers.get(urlStr);
if (ftpServer == null)
ftpServer = addServer(urlStr, user, pass);
return ftpServer;
}
 
public static class FtpServer
{
String host = null;
int port = 21;
String username = null;
String password = null;
 
 
public FtpServer(String host, int port)
{
this.host = host;
if (port > 0)
this.port = port;
}
 
public FtpServer(String host, int port, String username, String password)
{
this.host = host;
this.port = port;
this.username = username;
this.password = password;
}
 
public FTPClient getClient() throws IOException
{
FTPClient ftp = new FTPClient();
ftp.connect(host, port);
if (username != null)
ftp.user(username);
if (password != null)
ftp.pass(password);
return ftp;
}
 
public String getHost()
{
return host;
}
 
public void setHost(String host)
{
this.host = host;
}
 
public int getPort()
{
return port;
}
 
public void setPort(int port)
{
this.port = port;
}
 
public String getUsername()
{
return username;
}
 
public void setUsername(String username)
{
this.username = username;
}
 
public String getPassword()
{
return password;
}
 
public void setPassword(String password)
{
this.password = password;
}
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/FtpServer.java
New file
0,0 → 1,138
package pt.estgp.estgweb.web;
 
import org.apache.commons.net.ftp.FTPClient;
import org.apache.log4j.Logger;
 
import java.util.HashMap;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.IOException;
 
/**
* @author Jorge
* @date 18/Jan/2009
* @time 18:35:11
*/
public class FtpServer
{
private static final Logger logger = Logger.getLogger(FtpServer.class);
 
 
private static HashMap<String, FtpServer> servers = new HashMap<String, FtpServer>();
 
 
 
 
String host = null;
int port = 21;
String username = null;
String password = null;
 
 
public FtpServer(String host, int port)
{
this.host = host;
if (port > 0)
this.port = port;
}
 
public FtpServer(String host, int port, String username, String password)
{
this.host = host;
this.port = port;
this.username = username;
this.password = password;
}
 
public FTPClient getClient() throws IOException
{
FTPClient ftp = new FTPClient();
ftp.connect(host, port);
if (username != null)
ftp.user(username);
if (password != null)
ftp.pass(password);
return ftp;
}
 
public String getHost()
{
return host;
}
 
public void setHost(String host)
{
this.host = host;
}
 
public int getPort()
{
return port;
}
 
public void setPort(int port)
{
this.port = port;
}
 
public String getUsername()
{
return username;
}
 
public void setUsername(String username)
{
this.username = username;
}
 
public String getPassword()
{
return password;
}
 
public void setPassword(String password)
{
this.password = password;
}
 
public static FtpServer getServer(String urlStr, String user, String pass)
{
FtpServer ftpServer = servers.get(urlStr);
if (ftpServer == null)
ftpServer = addServer(urlStr, user, pass);
return ftpServer;
}
 
/**
* Add a ftpServer to Cache
*
* @param urlStr to parse
* @param user username
* @param pass password
* @return ftpServer
*/
private static synchronized FtpServer addServer(String urlStr, String user, String pass)
{
try
{
URL url = new URL(urlStr);
String host = url.getHost();
int port = url.getPort();
if (port <= 0)
port = 21;
logger.info("Connecting to " + host + "in port:" + port);
FtpServer ftpServer = new FtpServer(host, port, user, pass);
servers.put(urlStr, ftpServer);
return ftpServer;
}
catch (MalformedURLException e)
{
logger.error(e, e);
}
catch (IOException e)
{
logger.error(e, e);
}
return null;
}
}
/impl/src/java/pt/estgp/estgweb/web/LayoutController.java
122,7 → 122,7
if (path != null)
{
 
FtpServer ftpServer = getServer(server, user, pass);
FtpServer ftpServer = FtpServer.getServer(server, user, pass);
FTPClient client = ftpServer.getClient();
client.changeWorkingDirectory(path);
FTPFile[] files = client.listFiles();
151,124 → 151,4
logger.error(e, e);
}
}
 
private static HashMap<String, FtpServer> servers = new HashMap<String, FtpServer>();
 
/**
* Add a ftpServer to Cache
*
* @param urlStr to parse
* @param user username
* @param pass password
* @return ftpServer
*/
private static synchronized FtpServer addServer(String urlStr, String user, String pass)
{
try
{
URL url = new URL(urlStr);
String host = url.getHost();
int port = url.getPort();
if (port <= 0)
port = 21;
logger.info("Connecting to " + host + "in port:" + port);
FtpServer ftpServer = new FtpServer(host, port, user, pass);
servers.put(urlStr, ftpServer);
return ftpServer;
}
catch (MalformedURLException e)
{
logger.error(e, e);
}
catch (IOException e)
{
logger.error(e, e);
}
return null;
}
 
private static FtpServer getServer(String urlStr, String user, String pass)
{
FtpServer ftpServer = servers.get(urlStr);
if (ftpServer == null)
ftpServer = addServer(urlStr, user, pass);
return ftpServer;
}
 
public static class FtpServer
{
String host = null;
int port = 21;
String username = null;
String password = null;
 
 
public FtpServer(String host, int port)
{
this.host = host;
if (port > 0)
this.port = port;
}
 
public FtpServer(String host, int port, String username, String password)
{
this.host = host;
this.port = port;
this.username = username;
this.password = password;
}
 
public FTPClient getClient() throws IOException
{
FTPClient ftp = new FTPClient();
ftp.connect(host, port);
if (username != null)
ftp.user(username);
if (password != null)
ftp.pass(password);
return ftp;
}
 
public String getHost()
{
return host;
}
 
public void setHost(String host)
{
this.host = host;
}
 
public int getPort()
{
return port;
}
 
public void setPort(int port)
{
this.port = port;
}
 
public String getUsername()
{
return username;
}
 
public void setUsername(String username)
{
this.username = username;
}
 
public String getPassword()
{
return password;
}
 
public void setPassword(String password)
{
this.password = password;
}
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/form/courses/CourseForm.java
4,6 → 4,8
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedCourses;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService;
import pt.estgp.estgweb.Globals;
 
import java.util.List;
 
19,9 → 21,15
private CourseView courseView;
private FormFile studiesPlan;
private DirectedCoordinatedCourses directedCoordinatedCourses = new DirectedCoordinatedCourses();
private String importYear;
 
private String importYear = DatesUtils.getImportYear();
 
private String area;
 
 
private List<String> areas = Globals.AREAS;
 
 
public CourseForm()
{
courseView = new CourseView();
72,4 → 80,73
{
this.studiesPlan = studiesPlan;
}
 
 
public List<String> getAreas()
{
return areas;
}
 
 
public String getArea()
{
return area;
}
 
public void setArea(String area)
{
this.area = area;
}
 
 
/************************************
*
* For Programas Selection
*
*/
private String semestre;
 
private long courseId = -1;
 
/**
* possibleValues withTeachers, withNoTeachers, all
* @see pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService.TeachersSituationEnum
*/
private String teachersSituation;
 
public String getSemestre()
{
return semestre;
}
 
public void setSemestre(String semestre)
{
this.semestre = semestre;
}
 
public long getCourseId()
{
return courseId;
}
 
public void setCourseId(long courseId)
{
this.courseId = courseId;
}
 
public String getTeachersSituation()
{
return teachersSituation;
}
 
public DirectedCoordinatedUnitsService.TeachersSituationEnum getTeacherSituationEnum()
{
return DirectedCoordinatedUnitsService.TeachersSituationEnum.parse(teachersSituation);
}
 
public void setTeachersSituation(String teachersSituation)
{
this.teachersSituation = teachersSituation;
}
}
/impl/src/java/pt/estgp/estgweb/web/UserSessionProxy.java
56,6 → 56,7
IServiceManager sm = ServiceManager.getInstance();
Object[] args = new Object[]{RequestUtils.getRequester(request, response)};
UserSession userSession = (UserSession) sm.execute(RequestUtils.getRequester(request, response),"LoadUserSession",args);
userSession.setRequest(request);
request.setAttribute(Globals.USER_SESSION_KEY,userSession);
return userSession;
}
/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesController.java
1,30 → 1,32
package pt.estgp.estgweb.web.controllers.courses;
 
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.filters.exceptions.NotFoundException;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedCourses;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedUnitsService;
import pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsController;
import pt.estgp.estgweb.web.controllers.courseunits.CourseUnitsAdminController;
import pt.estgp.estgweb.web.form.courseunits.CourseUnitsForm;
import pt.estgp.estgweb.web.exceptions.NoCookiesException;
import pt.estgp.estgweb.web.form.courses.CourseForm;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.estgp.estgweb.web.exceptions.NoCookiesException;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.filters.exceptions.NotFoundException;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.services.common.ISearchResults;
import pt.estgp.estgweb.services.courseunits.DirectedCoordinatedCourses;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.utils.AreasBelongUtils;
import pt.utl.ist.berserk.logic.filterManager.exceptions.FilterRetrieveException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.IncompatibleFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.InvalidFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.InvalidFilterExpressionException;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.FilterChainFailedException;
import pt.utl.ist.berserk.logic.serviceManager.exceptions.ServiceManagerException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.*;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
 
/**
* @author Jorge Machado
57,7 → 59,7
{
String code = cF.getCourseView().getCode();
long id = cF.getCourseView().getId();
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args;
152,7 → 154,7
request.setAttribute("CourseView",cV);
if(cV.getHtmlResult() != null)
{
return mapping.findForward("submit");
return mapping.findForward("submit");
}
 
cF.setCourseView(cV);
179,20 → 181,28
 
 
public ActionForward loadCoursesPrograms(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
try
{
CourseForm cF = (CourseForm) form;
String importYear = cF.getImportYear();
long courseId = cF.getCourseId();
String semestre = cF.getSemestre();
String area = cF.getArea();
DirectedCoordinatedUnitsService.TeachersSituationEnum teachersSituationEnum = cF.getTeacherSituationEnum();
 
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"importYear"};
Object[] args = new String[]{importYear};
String[] names = new String[]{"importYear","courseId","semestre","area","teachersSituationEnum"};
Object[] args = new Object[]{importYear,courseId,semestre,area,teachersSituationEnum};
DirectedCoordinatedCourses directedCoordinatedCourses = (DirectedCoordinatedCourses) sm.execute(RequestUtils.getRequester(request, response), "LoadCoursesProgramsForServices", args, names);
cF.setDirectedCoordinatedCourses(directedCoordinatedCourses);
cF.setArea(directedCoordinatedCourses.getArea());
cF.setCourseId(directedCoordinatedCourses.getCourseId());
return mapping.findForward("load.courses.programs");
}
catch (FilterChainFailedException e)
211,9 → 221,9
}
 
public ActionForward loadDirectedCoordininatedCourses(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
try
244,9 → 254,9
}
 
public ActionForward updateDirectedCoordininatedCourses(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
try
/impl/src/java/pt/estgp/estgweb/web/filters/UserSessionFilter.java
76,8 → 76,6
}
}
 
 
String path =((HttpServletRequest)request).getServletPath();
if(((HttpServletRequest)request).getServletPath().indexOf("errorNoCookies.do")>=0 || !hrequest.isRequestedSessionIdFromCookie())
chain.doFilter(request,response);
try
/impl/src/doc/Programas0809.doc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/src/hbm/pt/estgp/estgweb/domain/GenericUser.hbm.xml
72,46 → 72,51
</set>
<subclass name="pt.estgp.estgweb.domain.UserImpl" discriminator-value="UserImpl">
<subclass name="pt.estgp.estgweb.domain.UserManagedRoleImpl">
<subclass name="pt.estgp.estgweb.domain.Student">
<subclass name="pt.estgp.estgweb.domain.SigesUser">
<meta attribute="extends">pt.estgp.estgweb.domain.UserManagedRoleImpl</meta>
<meta attribute="scope-class">public abstract</meta>
<property name="sigesCode" type="int"/>
<property name="areasBelong" type="string" index="areasBelongIndex"/>
<property name="userNameNetpa" type="string"/>
<property name="localRemovedSubscribedUnits" type="string"/>
<set name="subscribedUnits" lazy="true" order-by="courseUnitId" table="subscribedunits">
<key column="studentId"/>
<many-to-many class="pt.estgp.estgweb.domain.CourseUnit" column="courseUnitId"/>
</set>
<set name="courseUnitGrades" order-by="courseUnit asc" lazy="true">
<key column="student"/>
<one-to-many class="pt.estgp.estgweb.domain.CourseUnitGrade"/>
</set>
<subclass name="pt.estgp.estgweb.domain.StudentImpl" discriminator-value="StudentImpl"/>
<subclass name="pt.estgp.estgweb.domain.SigesUserImpl">
<subclass name="pt.estgp.estgweb.domain.Student">
<meta attribute="extends">pt.estgp.estgweb.domain.SigesUserImpl</meta>
<meta attribute="scope-class">public abstract</meta>
<property name="localRemovedSubscribedUnits" type="string"/>
<set name="subscribedUnits" lazy="true" order-by="courseUnitId" table="subscribedunits">
<key column="studentId"/>
<many-to-many class="pt.estgp.estgweb.domain.CourseUnit" column="courseUnitId"/>
</set>
<set name="courseUnitGrades" order-by="courseUnit asc" lazy="true">
<key column="student"/>
<one-to-many class="pt.estgp.estgweb.domain.CourseUnitGrade"/>
</set>
<subclass name="pt.estgp.estgweb.domain.StudentImpl" discriminator-value="StudentImpl"/>
</subclass>
<subclass name="pt.estgp.estgweb.domain.Teacher">
<meta attribute="extends">pt.estgp.estgweb.domain.SigesUserImpl</meta>
<meta attribute="scope-class">public abstract</meta>
<property name="academicName" type="string"/>
<property name="employerName" type="string"/>
<property name="unitCheck" type="boolean"/>
<property name="academicDegree" type="string"/>
<property name="localRemovedTeachedUnits" type="string"/>
<set name="teachedUnits" lazy="true" order-by="courseUnitId" table="teachedunits">
<key column="teacherId"/>
<many-to-many class="pt.estgp.estgweb.domain.CourseUnit" column="courseUnitId"/>
</set>
<set name="coordinatorCourses" order-by="name asc" lazy="true">
<key column="coordinator"/>
<one-to-many class="pt.estgp.estgweb.domain.Course"/>
</set>
<set name="directorCourses" order-by="name asc" lazy="true">
<key column="director"/>
<one-to-many class="pt.estgp.estgweb.domain.Course"/>
</set>
<subclass name="pt.estgp.estgweb.domain.TeacherImpl" discriminator-value="TeacherImpl"/>
</subclass>
</subclass>
</subclass>
<subclass name="pt.estgp.estgweb.domain.Teacher">
<meta attribute="extends">pt.estgp.estgweb.domain.UserManagedRoleImpl</meta>
<meta attribute="scope-class">public abstract</meta>
<property name="sigesCode" type="int"/>
<property name="userNameNetpa" type="string"/>
<property name="academicName" type="string"/>
<property name="employerName" type="string"/>
<property name="unitCheck" type="boolean"/>
<property name="academicDegree" type="string"/>
<property name="localRemovedTeachedUnits" type="string"/>
<set name="teachedUnits" lazy="true" order-by="courseUnitId" table="teachedunits">
<key column="teacherId"/>
<many-to-many class="pt.estgp.estgweb.domain.CourseUnit" column="courseUnitId"/>
</set>
<set name="coordinatorCourses" order-by="name asc" lazy="true">
<key column="coordinator"/>
<one-to-many class="pt.estgp.estgweb.domain.Course"/>
</set>
<set name="directorCourses" order-by="name asc" lazy="true">
<key column="director"/>
<one-to-many class="pt.estgp.estgweb.domain.Course"/>
</set>
<subclass name="pt.estgp.estgweb.domain.TeacherImpl" discriminator-value="TeacherImpl"/>
</subclass>
</subclass>
</subclass>
</subclass>
/impl/src/hbm/pt/estgp/estgweb/domain/Course.hbm.xml
25,6 → 25,7
<column name="cacheWebDocument" sql-type="TEXT"/>
</property>
<property name="studiesPlan" type="string" index="studiesPlanIndex"/>
<property name="area" type="string" index="areaIndex"/>
<many-to-one name="director" class="pt.estgp.estgweb.domain.Teacher" outer-join="false" lazy="proxy"/>
<many-to-one name="coordinator" class="pt.estgp.estgweb.domain.Teacher" outer-join="false" lazy="proxy"/>
<set name="users" order-by="user.name asc" lazy="true">
/impl/src/web/admin/courses/course.jsp
27,6 → 27,19
</tr>
<tr>
<th>
<bean:message key="course.area"/>
</th>
 
<td>
<html:select property="courseView.area">
<logic:iterate id="area" name="CourseForm" property="areas">
<html:option value="${area}" key="area.${area}"/>
</logic:iterate>
</html:select>
</td>
</tr>
<tr>
<th>
<bean:message key="name"/>
</th>
<td>
/impl/src/web/css/style.css
241,7 → 241,16
border: #8EC73F solid 1px;
padding:10px;
}
.contentPane
{
border: #8EC73F solid 1px;
}
ul li.contentPane
{
list-style-type:none;
}
 
 
.contentPortal {
border: #8EC73F solid 1px;
padding:5px;
/impl/src/web/layout/navigationTop.jsp
21,15 → 21,16
<li class="submenu"><a href="#">Apresentação</a>
<div class="shadow ">
<ul class="menu">
<li><a href="#">Mensagem do Presidente</a></li>
<li><a href="<%=request.getContextPath()%>/proxy/layout4/estgp/public/portal/estgMensagemPresidente.html">Mensagem do Presidente</a></li>
<li><a href="#">A ESTG e a sua missão</a></li>
<li><a href="#">História</a></li>
<li><a href="#">Localização</a></li>
<li><a href="#">Factos e números</a></li>
<li><a href="<%=request.getContextPath()%>/proxy/layout4/estgp/public/portal/estgComoChegarEstg.html">Localização</a></li>
<li><a href="<%=request.getContextPath()%>/proxy/estgFuturosAlunosPortalMenu/estgp/public/portal/estgNumeros.html">Factos e números</a></li>
<li><a href="#">A ESTG em Fotografias</a></li>
</ul>
</div>
</li>
<li class="submenu"><a href="<%=request.getContextPath()%>/proxy/layout4/estgp/public/portal/contactosContactosGeraisEstg.html">Contactos</a></li>
<li class="submenu"><a href="#"><bean:message key="organization"/> </a>
 
<div class="shadow">
/impl/src/web/public/search/searchResults.jsp
1,6 → 1,4
<%@ page import="pt.estgp.estgweb.services.common.*" %>
<%@ page import="pt.estgp.estgweb.web.Globals" %>
<%@ page import="jomm.utils.ConfigProperties" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
181,6 → 179,26
</logic:notEqual>
)
</logic:notEmpty>
<logic:notEmpty name="result" property="subTitlesGroup">
(
<%
String subTitleSeparator = "";
%>
<logic:iterate id="subTitleLabel" name="result" property="subTitlesGroup.labels">
<%=subTitleSeparator%>
<logic:equal value="true" name="subTitleLabel" property="key">
<bean:message key="${subTitleLabel.label}"/>
</logic:equal>
<logic:notEqual value="true" name="subTitleLabel" property="key">
${subTitleLabel.label}
</logic:notEqual>
 
<%
subTitleSeparator = ", ";
%>
</logic:iterate>
)
</logic:notEmpty>
</h2>
 
<p>${result.bestFragments} ...</p>
/impl/src/web/user/courses/directedCoordinatedCourses.jsp
3,6 → 3,8
<%@ page import="pt.estgp.estgweb.domain.views.CourseView" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="pt.estgp.estgweb.utils.AreasBelongUtils" %>
<%@ page import="pt.estgp.estgweb.domain.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
16,178 → 18,312
<jomm:messages/>
<html:errors/>
<%
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{};
List<String> importYears = (List<String>) sm.execute(RequestUtils.getRequester(request, response), "LoadCoursesImportYears", args, names);
request.setAttribute("importYears", importYears);
args = new Object[]{CourseForm.getImportYear(), CourseForm.getArea()};
List<CourseView> courses = (List<CourseView>) sm.execute(RequestUtils.getRequester(request, response), "LoadCoursesImportYearArea", args, names);
request.setAttribute("courses", courses);
 
request.setAttribute("fromDispatch",request.getParameter("fromDispatch"));
request.setAttribute("fromDispatch", request.getParameter("fromDispatch"));
 
String fromAction = "";
String from = "?fromDispatch="+request.getParameter("fromDispatch");;
String from = "?fromDispatch=" + request.getParameter("fromDispatch");
String user = "";
if (request.getParameter("from") != null)
{
user = "/user";
fromAction = "From" + request.getParameter("from");
from = "?from=" + request.getParameter("from") + "&fromDispatch="+request.getParameter("fromDispatch");
from = "?from=" + request.getParameter("from") + "&fromDispatch=" + request.getParameter("fromDispatch");
}
request.setAttribute("from", from);
request.setAttribute("user", user);
request.setAttribute("fromAction", fromAction);
 
boolean canChange=false;
 
boolean canChange = false;
%>
 
<html:form action="${user}/courseController${fromAction}${from}" enctype="multipart/form-data">
<input type="hidden" name="dispatch" value="updateDirectedCoordininatedCourses">
<input type="hidden" name="fromDispatch" value="${fromDispatch}"/>
<div class="seccao">
<h2><bean:message key="course.directed.coordinated"/> </h2>
<p>
<bean:message key="course.program.courses.choose.year"/>
<html:select property="importYear" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<logic:iterate id="importYear" name="importYears">
<html:option value="${importYear}"/>
</logic:iterate>
</html:select>
</p>
<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>
 
<h1><bean:message key="courseunit.programs"/></h1>
 
 
 
<div class="form blockForm">
<table>
<tr>
<th><bean:message key="course.program.courses.choose.year"/></th>
<td>
<html:select property="importYear" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<logic:iterate id="importYear" name="importYears">
<html:option value="${importYear}"/>
</logic:iterate>
</html:select>
</td>
</tr>
<tr>
<th><bean:message key="courseunit.semestre"/></th>
<td>
<html:select property="semestre" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<option value=""><bean:message key="courseunit.ALL"/></option>
<html:option value="S1" key="courseunit.S1"/>
<html:option value="S2" key="courseunit.S2"/>
</html:select>
</td>
</tr>
<baco:hasRole role="admin,all,services,teacher,servicesPrograms,administrativeCouncil,courseCoordinator,courseDirector,scientificCouncil,pedagogicCouncil">
<tr>
<th><bean:message key="area"/></th>
<td>
<html:select property="area" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<option value=""><bean:message key="areas.all"/></option>
<logic:iterate id="area" name="CourseForm" property="areas">
<html:option value="${area}" key="area.${area}"/>
</logic:iterate>
</html:select>
</td>
</tr>
<tr>
<th><bean:message key="courseunit.course"/></th>
<td>
<html:select property="courseId" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<html:option value="" key="courses.all"/>
<logic:iterate id="courseView" name="courses" type="pt.estgp.estgweb.domain.views.CourseView">
<html:option value="${courseView.id}">(${courseView.code}) ${courseView.name}</html:option>
</logic:iterate>
</html:select>
</td>
</tr>
<tr>
<th><bean:message key="courseunit.teacher.situation"/></th>
<td>
<html:select property="teachersSituation" onchange="set(this.form,'${fromDispatch}');this.form.submit()">
<html:option value="all" key="courseunit.teacher.situation.all"/>
<html:option value="withTeachers" key="courseunit.teacher.situation.withTeachers"/>
<html:option value="withNoTeachers" key="courseunit.teacher.situation.withNoTeachers"/>
</html:select>
</td>
</tr>
</baco:hasRole>
</table>
</div>
 
 
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td id="leftPage" valign="top">
<%
if(CourseForm.getDirectedCoordinatedCourses().getMerge().size()>1)
{
%>
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle"><bean:message key="courses"/></div>
<div class="linkLeftMenu">
<div class="listClean">
<ul>
<logic:notEmpty name="courseView" property="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>
<nested:iterate id="courseView" property="directedCoordinatedCourses.merge" type="pt.estgp.estgweb.domain.views.CourseView">
<li>
<a href="#${courseView.id}">(${courseView.code}) ${courseView.name}</a>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="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">
<%
canChange=true;
%>
<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">
<%
canChange=true;
%>
<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>
</nested:iterate>
</ul>
</li>
</div>
</div>
</div>
<%
}
%>
</td>
<td id="rightPage" valign="top">
<div class="contentPane">
<div >
<ul>
<nested:iterate id="courseView" property="directedCoordinatedCourses.merge" type="pt.estgp.estgweb.domain.views.CourseView">
<li class="contentPane">
<a name="${courseView.id}"></a>
<nested:hidden property="id"/>
<h1>(${courseView.code}) ${courseView.name}</h1>
<ul>
<logic:notEqual value="S2" name="CourseForm" property="semestre">
<li><h3><bean:message key="courseunit.semestre"/> 1</h3>
<ul>
<logic:notEmpty name="courseView" property="courseUnitsWithNoProgramS1">
<li><h3 class="statusERROR"><bean:message key="course.units.no.program"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithNoProgramS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<td>${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramNotCheckedS1">
<%--<html:hidden property="courseUnitsWithProgramNotCheckedS1size"/>--%>
<li><h3 class="statusWARNING"><bean:message key="course.units.with.program.not.checked"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramNotCheckedS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
 
<logic:notEqual value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td></td>
</logic:notEqual>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<%
canChange=true;
%>
<td><nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td>
<baco:hasRole role="teacher">
<a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a>
</baco:hasRole>
 
<li><h3><bean:message key="courseunit.semestre"/> 2</h3>
<ul>
<logic:notEmpty name="courseView" property="courseUnitsWithNoProgramS2">
<baco:hasNotRole role="teacher">
<logic:equal value="true" name="courseUnitView" property="validProgram">
<a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a>
</logic:equal>
<logic:equal value="false" name="courseUnitView" property="validProgram">
${courseUnitView.name}
</logic:equal>
</baco:hasNotRole>
</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramCheckedS1">
<%--<html:hidden property="courseUnitsWithProgramCheckedS1size"/>--%>
<li><h3 class="statusOK"><bean:message key="course.units.with.program.checked"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramCheckedS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<logic:notEqual value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td></td>
</logic:notEqual>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<%
canChange=true;
%>
<td><nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td><a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a></td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
</ul>
</li>
</logic:notEqual>
 
<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>
<logic:notEqual value="S1" name="CourseForm" property="semestre">
<li><h3><bean:message key="courseunit.semestre"/> 2</h3>
<ul>
<logic:notEmpty name="courseView" property="courseUnitsWithNoProgramS2">
 
</ul>
</li>
</nested:iterate>
</ul>
</div>
</div>
<%
if(canChange)
{
%>
<table>
<tr class="buttons">
<td colspan="2">
<input type="submit" value="<bean:message key="confirm"/>"/>
</td>
</tr>
</table>
<%
}
%>
<li><h3 class="statusERROR"><bean:message key="course.units.no.program"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithNoProgramS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<td>${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramNotCheckedS2">
<%--<html:hidden property="courseUnitsWithProgramNotCheckedS2size"/>--%>
<li><h3 class="statusWARNING"><bean:message key="course.units.with.program.not.checked"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramNotCheckedS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<logic:notEqual value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td></td>
</logic:notEqual>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td><nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
<logic:notEmpty name="courseView" property="courseUnitsWithProgramCheckedS2">
<%--<html:hidden property="courseUnitsWithProgramCheckedS2size"/>--%>
<li><h3 class="statusOK"><bean:message key="course.units.with.program.checked"/></h3>
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithProgramCheckedS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<logic:notEqual value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td></td>
</logic:notEqual>
<logic:equal value="${courseView.coordinator.id}" name="UserSession" property="user.id">
<td><nested:hidden property="programStreamId"/>
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
</nested:iterate>
</table>
</li>
</logic:notEmpty>
</ul>
</li>
</logic:notEqual>
</ul>
</li>
</nested:iterate>
</ul>
</div>
<%
if(canChange)
{
%>
<table>
<tr class="buttons">
<td colspan="2">
<input type="submit" value="<bean:message key="confirm"/>">
</td>
</tr>
</table>
<%
}
%>
 
</div>
</td>
</tr>
 
</table>
 
 
</html:form>
/impl/src/web/user/courseunits/courseunit.jsp
54,16 → 54,26
<logic:equal value="false" name="CourseUnitView" property="validProgram">
<html:file property="programFile"/>
</logic:equal>
<logic:present name="CourseUnitView" property="programStreamId">
<a href="<%=request.getContextPath()%>/repositoryStream/${CourseUnitView.programStreamId}"><bean:message key="courseunit.programfilepath"/></a> (${CourseUnitView.programSize} Kb)
<logic:equal value="true" name="CourseUnitView" property="validProgram">
(<bean:message key="courseunit.programfile.valid"/>)
</logic:equal>
</logic:present>
</baco:canManage>
<logic:present name="CourseUnitView" property="programStreamId">
<a href="<%=request.getContextPath()%>/repositoryStream/${CourseUnitView.programStreamId}"><bean:message key="courseunit.programfilepath"/></a> (${CourseUnitView.programSize} Kb)
</logic:present>
(<logic:equal value="true" name="CourseUnitView" property="validProgram">
<bean:message key="courseunit.programfile.valid"/>
</logic:equal>)
 
<baco:cantManage name="CourseUnitView">
<logic:present name="CourseUnitView" property="programStreamId">
<logic:equal value="true" name="CourseUnitView" property="validProgram">
<a href="<%=request.getContextPath()%>/repositoryStream/${CourseUnitView.programStreamId}"><bean:message key="courseunit.programfilepath"/></a> (${CourseUnitView.programSize} Kb) (<bean:message key="courseunit.programfile.valid"/>)
</logic:equal>
</logic:present>
</baco:cantManage>
 
<logic:notPresent name="CourseUnitView" property="programStreamId">
<bean:message key="courseunit.programfilepath.not.available"/>
</logic:notPresent>
 
</p>
 
<baco:canManage name="CourseUnitView">
/impl/src/web/user/home/student.jsp
65,6 → 65,14
</ul>
<!--Can put year all other units in the future calling service user.subscribedUnitsOldYearsView-->
</div>
<div class="block">
<p><bean:message key="intranet.home.curricular"/></p>
<ul>
<li>
<html:link action="/user/startLoadCoursesProgramsFromHome"><bean:message key="courseunit.programs"/></html:link>
</li>
</ul>
</div>
</td>
</baco:isModuleOn>
<td class="column">
/impl/src/web/user/home/teacher.jsp
63,6 → 63,14
</li>
</ul>
</div>
<div class="block">
<p><bean:message key="intranet.home.curricular"/></p>
<ul>
<li>
<html:link action="/user/startLoadCoursesProgramsFromHome"><bean:message key="courseunit.programs"/></html:link>
</li>
</ul>
</div>
</td>
</baco:isModuleOn>
<td class="column">
/impl/etc/todo/todo.txt
9,12 → 9,6
No dia da Instalação:
Pasta de Deliberações CC copy paste.
 
 
Configuracoes de Teste
Server ESTGP esta definido para o localhost
Start Path do IOnline esta para a raiz mas para testar unidades tem de apontar para /Erasmus/baco
(PEDRO) Todos os documentos da Secção escola devem ser transferidos para a mesma pasta na nova web
 
Reestruturação das pastas da intranet:
 
As pastas enumeradas adiante tem de possuir permissões de intranet
29,18 → 23,11
Pasta Bolonha ZIP Pack deploy
Pasta Horarios Criar hierarquia. > Intranet/horarios
 
 
 
Jorge Meu
Tirar o getSerializable de noovo do domainObject e ver de onde devem herdar
 
###
 
Listagem de Docentes a fazer por jorge
Listagem de Alunos a fazer por jorge
Avisos Disciplina a fazer Susana
Disciplinas com Duvidas a fazer por jorge
Disciplinas com Blog a fazer por jorge
RSS disciplina incluido os três pontos anteriores Susana
RSS aluno incluindo o RSS anterior e os avisos gerais e os avisos para alunos Susana
RSS geral para anuncios dado o Tipo de anuncio (Destaques, SubDestaques e Noticias) Susana
48,8 → 35,40
TAB da disciplina definido por Jorge implementadar pela Susana (Objectivos, Programa, listagem da Intranet, Lista de Docentes, Lista de Alunos)
Pagina da disciplina a listar conteudos da intranet Jorge
 
#Material da Regie
 
####
FABIO
Imagens de Origem das noticias, parece-me que estão mal na pasta imgs
criar por defeito no DBInit um user com o role de cada uma das imagens (Secretaria, CI, CD, CC, CP, etc)
Serviços
 
1 - Actualizar material -> Procurar XML
2 - Registar Emprestimo -> Procurar utilizador -> Inserir Material da Combo (Filtra por entregar) -> Data De, Data Até -> confirmar
3 - Entregar Emprestimo -> Listar Emprestimos Pendentes -> Combo Devolvido
4 - Consultar Historico de Emprestimos -> (Entre Datas)
 
Extras
 
1 - Afazeres do Aluno Equipamentos por entregar
2 - Material da Regie na página oficial navegavel pelos Directorios
 
#Programas
Curto Prazo
- Listar apenas unidades com professor
- Filtrar por semestre
 
- adicionar campos consultar o Batista
- Descrição da Unidade
- bibliografia
 
Serviços Extra
 
1 - Consultar bibliografia por Curso / Semestre / Ano
2 - Pesquisar
 
 
#Questionários
 
- Semi-Projectado no EA
 
#Eventos
 
- Projecto por formalizar