/impl/conf/WEB-INF/web.xml |
---|
17,6 → 17,10 |
<filter-class>pt.estgp.estgweb.web.filters.TopImageFilter</filter-class> |
</filter> |
<filter> |
<filter-name>TopImageDirectoryFilter</filter-name> |
<filter-class>pt.estgp.estgweb.web.filters.TopImageDirectoryFilter</filter-class> |
</filter> |
<filter> |
<filter-name>UserFilter</filter-name> |
<filter-class>pt.estgp.estgweb.web.filters.UserFilter</filter-class> |
</filter> |
/impl/conf/app.properties |
---|
78,44 → 78,16 |
##Proxy Servers |
#If is an HTTP Server needs encoding config if FTP needs user pass config |
server.ionline=ftp://www.global.estgp.pt |
#server.ionline.start.path= |
#TODO USAR a de baixo quando testar as unidades curriculares |
server.ionline.start.path= |
#server.ionline.start.path=/Eramus/Baco |
ionline.pass=baco |
ionline.user=Baco_web |
#server.estgp=http://localhost:8180 |
#estgp.encoding=ISO-8859-1 |
server.estgp.start.path= |
server.estgp=http://172.20.100.14:8180/static |
server.estgp=http://deptal.estgp.pt:9090/static |
estgp.encoding=UTF-8 |
estgp.proxy.host= |
estgp.proxy.port= |
##server.estgp=http://localhost:8080/estgweb |
server.estgweb=http://www.estgp.pt/testes/estgweb |
estgweb.encoding=UTF-8 |
server.localhost=http://localhost:8080 |
localhost.encoding=ISO-8859-1 |
server.localhost.start.path=/templates |
server.estgp2=http://www.estgp.pt/testes/nova_web |
#server.estgp=http://localhost:8080/estgweb |
estgp2.encoding=UTF-8 |
server.casaTestes=http://localhost:8080 |
server.casaTestes.start.path=/templates |
casaTestes.encoding=ISO-8859-1 |
casaTestes.proxy.host= |
casaTestes.proxy.port= |
proxy.extensions=html htm php asp aspx dhtml jsp py |
################################################ |
287,6 → 259,16 |
#filter.ignore.extension.6=.tif |
#filter.ignore.extension.7=.bmp |
#filter.ignore.extension.8=.swf |
filter.top.image.ignore.extension.1=.js |
filter.top.image.ignore.extension.2=.css |
filter.top.image.ignore.extension.3=.jpg |
filter.top.image.ignore.extension.4=.gif |
filter.top.image.ignore.extension.5=.png |
filter.top.image.ignore.extension.6=.tif |
filter.top.image.ignore.extension.7=.bmp |
filter.top.image.ignore.extension.8=.swf |
filter.ignore.prefix.1=/statUnits.jsp |
filter.ignore.prefix.2=/units.jsp |
filter.ignore.prefix.3=/js |
367,16 → 349,40 |
#TopImage Filter Links |
# |
top.image.1.start.with=/ |
top.image.1=/imgs/top.jpg |
top.image.url.1=/proxy/contactosAlunosPortalMenu/estgp/public/portal/imagens/top.jpg |
top.image.start.with.2=/student.do?role=student&menu=menu.alunos |
top.image.url.2=/imgs/topStudents.jpg |
top.image.url.2=/proxy/contactosAlunosPortalMenu/estgp/public/portal/imagens/topStudent.jpg |
top.image.start.with.3=/futureStudent.do?role=futureStudent&menu=menu.futurosAlunos |
top.image.url.3=/proxy/contactosAlunosPortalMenu/estgp/public/portal/imagens/topFutureStudent.jpg |
top.image.start.with.4=/oldStudent.do?role=oldStudent&menu=menu.antigosAlunos |
top.image.url.4=/proxy/contactosAlunosPortalMenu/estgp/public/portal/imagens/topOldStudent.jpg |
top.image.start.with.5=/teacher.do?role=teacher&menu=menu.docentes |
top.image.url.5=/proxy/contactosAlunosPortalMenu/estgp/public/portal/imagens/topTeacher.jpg |
top.image.start.with.6=/dir/student |
top.image.url.6=/proxy/contactosAlunosPortalMenu/estgp/public/portal/imagens/topStudent.jpg |
top.image.start.with.7=/dir/futureStudent |
top.image.url.7=/proxy/contactosAlunosPortalMenu/estgp/public/portal/imagens/topFutureStudent.jpg |
top.image.start.with.8=/dir/oldStudent |
top.image.url.8=/proxy/contactosAlunosPortalMenu/estgp/public/portal/imagens/topOldStudent.jpg |
top.image.start.with.9=/dir/teacher.do |
top.image.url.9=/proxy/contactosAlunosPortalMenu/estgp/public/portal/imagens/topTeacher.jpg |
########################################################################### |
# |
# AREAS CIENTIFICAS |
/impl/conf/directories/utilsIntranet.xml |
---|
11,4 → 11,10 |
<leaf label="Projectos-AA,CA,GE,MKT" id="Projectos.Finais" absolute="false" remoteExtensionRoot="true" style="true" proxy="ionline" layout="true" url="/Intranet/Escola/Secretaria/Projectos.Finais"/> |
<leaf label="Actas" id="Actas" absolute="false" remoteExtensionRoot="true" style="true" proxy="ionline" layout="true" url="/Actas/Arquivo"/> |
</leaf> |
<leaf absolute="false" label="Horários" layout="true" proxy="estgp" id="horarios" url="/intranet/escola/horarios.html"> |
<leaf absolute="false" label="Horários de Licenciaturas" layout="true" proxy="estgp" id="horariosLicenciaturas" url="/intranet/escola/horarios_licenciaturas.html"/> |
<leaf absolute="false" label="Horários de Docentes" layout="true" proxy="estgp" id="horariosDocentes" url="/intranet/escola/horarios_Docentes.html"/> |
<leaf absolute="false" label="Horários de Salas" layout="true" proxy="estgp" id="horariosSalas" url="/intranet/escola/horarios_salas.html"/> |
</leaf> |
<leaf absolute="false" label="Calendário de Exames" layout="true" proxy="estgp" id="exames" url="/intranet/escola/Exames.html"/> |
</directory> |
/impl/conf/directories/style1.xsl |
---|
457,18 → 457,18 |
<xsl:attribute name="src"> |
<xsl:choose> |
<xsl:when test="contains(@extension, 'rtf')"><xsl:value-of select="$contextPath"/>/imgs/mime/doc.gif</xsl:when> |
<xsl:when test="contains(@extension, 'doc')"><xsl:value-of select="$contextPath"/>/imgs/mime/doc.gif</xsl:when> |
<xsl:when test="contains(@extension, 'docx')"><xsl:value-of select="$contextPath"/>/imgs/mime/doc.gif</xsl:when> |
<xsl:when test="contains(@extension, 'doc')"><xsl:value-of select="$contextPath"/>/imgs/mime/doc.gif</xsl:when> |
<xsl:when test="contains(@extension, 'docx')"><xsl:value-of select="$contextPath"/>/imgs/mime/doc.gif</xsl:when> |
<xsl:when test="contains(@extension, 'pdf')"><xsl:value-of select="$contextPath"/>/imgs/mime/pdf.gif</xsl:when> |
<xsl:when test="contains(@extension, 'ppt')"><xsl:value-of select="$contextPath"/>/imgs/mime/ppt.gif</xsl:when> |
<xsl:when test="contains(@extension, 'zip')"><xsl:value-of select="$contextPath"/>/imgs/mime/zip.gif</xsl:when> |
<xsl:when test="contains(@extension, 'gz')"><xsl:value-of select="$contextPath"/>/imgs/mime/zip.gif</xsl:when> |
<xsl:when test="contains(@extension, 'tgz')"><xsl:value-of select="$contextPath"/>/imgs/mime/zip.gif</xsl:when> |
<xsl:when test="contains(@extension, 'rar')"><xsl:value-of select="$contextPath"/>/imgs/mime/rar.gif</xsl:when> |
<xsl:when test="contains(@extension, 'html')"><xsl:value-of select="$contextPath"/>/imgs/mime/html.gif</xsl:when> |
<xsl:when test="contains(@extension, 'html')"><xsl:value-of select="$contextPath"/>/imgs/mime/html.gif</xsl:when> |
<xsl:when test="contains(@extension, 'xls')"><xsl:value-of select="$contextPath"/>/imgs/mime/xls.gif</xsl:when> |
<xsl:when test="contains(@extension, 'xlsx')"><xsl:value-of select="$contextPath"/>/imgs/mime/xls.gif</xsl:when> |
<xsl:when test="contains(@extension, 'zip')"><xsl:value-of select="$contextPath"/>/imgs/mime/zip.gif</xsl:when> |
<xsl:when test="contains(@extension, 'gz')"><xsl:value-of select="$contextPath"/>/imgs/mime/zip.gif</xsl:when> |
<xsl:when test="contains(@extension, 'tgz')"><xsl:value-of select="$contextPath"/>/imgs/mime/zip.gif</xsl:when> |
<xsl:when test="contains(@extension, 'rar')"><xsl:value-of select="$contextPath"/>/imgs/mime/rar.gif</xsl:when> |
<xsl:when test="contains(@extension, 'html')"><xsl:value-of select="$contextPath"/>/imgs/mime/html.gif</xsl:when> |
<xsl:when test="contains(@extension, 'html')"><xsl:value-of select="$contextPath"/>/imgs/mime/html.gif</xsl:when> |
<xsl:when test="contains(@extension, 'xls')"><xsl:value-of select="$contextPath"/>/imgs/mime/xls.gif</xsl:when> |
<xsl:when test="contains(@extension, 'xlsx')"><xsl:value-of select="$contextPath"/>/imgs/mime/xls.gif</xsl:when> |
<xsl:when test="contains(@extension, 'txt')"><xsl:value-of select="$contextPath"/>/imgs/mime/txt.gif</xsl:when> |
<xsl:otherwise><xsl:value-of select="$contextPath"/>/imgs/mime/unknown.gif</xsl:otherwise> |
</xsl:choose> |
/impl/conf/berserk/sd.xml |
---|
78,6 → 78,16 |
<chain name="Logger"/> |
</filterChains> |
</service> |
<service> |
<name>LoadTeachersWithUnits</name> |
<implementationClass>pt.estgp.estgweb.services.users.LoadUsersService</implementationClass> |
<description>Load user of some class</description> |
<isTransactional>true</isTransactional> |
<defaultMethod>loadTeachersWithUnits</defaultMethod> |
<filterChains> |
<chain name="Logger"/> |
</filterChains> |
</service> |
<!--URL Statistics--> |
/impl/src/java/pt/estgp/estgweb/Globals.java |
---|
115,6 → 115,7 |
public static final List<String> URL_STAT_IGNORE_EXTENSIONS = ConfigProperties.getListValues("url.stat.ignore.extension"); |
public static final List<String> URL_STAT_IGNORE_PREFIXS = ConfigProperties.getListValues("url.stat.ignore.prefix"); |
public static final List<String> FILTER_TOP_IMAGE_IGNORE_EXTENSIONS = ConfigProperties.getListValues("filter.top.image.ignore.extension"); |
public static final List<String> FILTER_IGNORE_EXTENSIONS = ConfigProperties.getListValues("filter.ignore.extension"); |
public static final List<String> FILTER_IGNORE_PREFIXES = ConfigProperties.getListValues("filter.ignore.prefix"); |
/impl/src/java/pt/estgp/estgweb/services/users/LoadUsersService.java |
---|
4,12 → 4,14 |
import pt.estgp.estgweb.domain.User; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.domain.UserImpl; |
import pt.estgp.estgweb.domain.Teacher; |
import pt.estgp.estgweb.domain.views.UserView; |
import pt.estgp.estgweb.domain.dao.DaoFactory; |
import pt.estgp.estgweb.services.expceptions.ServiceException; |
import pt.estgp.estgweb.services.expceptions.FieldException; |
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException; |
import pt.estgp.estgweb.services.common.CommonServicesManager; |
import pt.estgp.estgweb.utils.DatesUtils; |
import org.apache.log4j.Logger; |
import org.hibernate.criterion.Order; |
65,6 → 67,14 |
return UserView.getViews(users); |
} |
public List<UserView> loadTeachersWithUnits(String area) throws ServiceException |
{ |
List<User> users = DaoFactory.getTeacherDaoImpl().loadByAreaWithUnitsInYear(area, DatesUtils.getImportYear()); |
if(users == null) |
return null; |
return UserView.getViews(users); |
} |
public List<UserView> load(String role) throws ServiceException |
{ |
List<User> users = DaoFactory.getUserDaoImpl().loadRoleUsers(role); |
/impl/src/java/pt/estgp/estgweb/services/directories/DirectoryNodeType.java |
---|
New file |
0,0 → 1,14 |
package pt.estgp.estgweb.services.directories; |
/** |
* @author Jorge |
* @date 17/Fev/2009 |
* @time 11:06:06 |
*/ |
public enum DirectoryNodeType |
{ |
node, |
leaf, |
directory, |
external |
} |
/impl/src/java/pt/estgp/estgweb/services/authenticate/AuthenticateService.java |
---|
72,7 → 72,8 |
u.setPassword(password); |
//put password to be complete for advising |
CommonServicesManager.getInstance().adviseNew(u); |
u.setPassword(null); |
// u.setPassword(null); OLD Line now we save the last sucessfully password in DB |
u.setPassword(jomm.utils.BytesUtils.getDigestMD5Hex(password)); |
if(u.getRoles().contains("teacher")) |
{ |
84,11 → 85,12 |
} |
else |
{ |
String passwordAux = u.getPassword(); |
// String passwordAux = u.getPassword(); |
u.setPassword(password); |
//put password to be complete for advising |
CommonServicesManager.getInstance().adviseUpdate(u); |
u.setPassword(passwordAux); |
// u.setPassword(passwordAux); |
u.setPassword(jomm.utils.BytesUtils.getDigestMD5Hex(password)); |
} |
logger.warn("user:" + username + " authenticated"); |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/TeacherDaoImpl.java |
---|
3,7 → 3,10 |
import pt.estgp.estgweb.domain.*; |
import static org.hibernate.criterion.Restrictions.*; |
import org.hibernate.criterion.Order; |
import org.hibernate.criterion.Projections; |
import org.hibernate.exception.GenericJDBCException; |
import org.hibernate.Criteria; |
import org.hibernate.sql.JoinFragment; |
import java.util.List; |
40,6 → 43,23 |
} |
} |
public List<User> loadByAreaWithUnitsInYear(String area, String year) |
{ |
try |
{ |
Criteria c = createCriteria(); |
c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); |
if(area != null && area.trim().length()>0) |
c.add(eq("mainArea",area)); |
c.createAlias("teachedUnits","t", JoinFragment.INNER_JOIN).add(eq("t.importYear",year)); |
return c.addOrder(Order.asc("name")).list(); |
} |
catch(GenericJDBCException e) |
{ |
throw e; |
} |
} |
public Teacher loadByBi(String bi) |
{ |
return (Teacher) createCriteria().add(eq("bi",bi)).uniqueResult(); |
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/UserDaoImpl.java |
---|
1,6 → 1,7 |
package pt.estgp.estgweb.domain.dao.impl; |
import jomm.dao.DaoException; |
import jomm.utils.DesUtils; |
import org.apache.log4j.Logger; |
import org.hibernate.Criteria; |
import org.hibernate.HibernateException; |
116,7 → 117,11 |
{ |
return (User) createCriteria() |
.add(eq("username", username)) |
.add(eq("password", jomm.utils.BytesUtils.getDigestMD5Hex(password))) |
.add(or( |
eq("password", jomm.utils.BytesUtils.getDigestMD5Hex(password)), |
eq("pop3password",DesUtils.getInstance().encrypt(password)) |
) |
) |
.uniqueResult(); |
} |
catch (HibernateException e) |
/impl/src/java/pt/estgp/estgweb/web/DirWebProxy.java |
---|
162,7 → 162,7 |
path = startPath + leafUrl + endPath; |
} |
extendDiretoryDocument(request, path, proxyKey, server, startPath + leafUrl, directoryDocument); |
Dom4jUtil.write(directoryDocument,"d:/out.xml"); |
styleDirectory(request, response); |
} |
} |
232,6 → 232,7 |
} |
else |
{ |
addAttribute(iFileElem, "extension", iFile.getExtension()); |
addAttribute(iFileElem, "ftpDirectory", "false"); |
addAttribute(iFileElem, "absolute", "true"); |
addAttribute(iFileElem, "url", iFile.getCompleteUrl()); |
271,6 → 272,7 |
} |
else |
{ |
addAttribute(iFileElem, "extension", iFile.getExtension()); |
addAttribute(iFileElem, "ftpDirectory", "false"); |
addAttribute(iFileElem, "absolute", "true"); |
addAttribute(iFileElem, "url", iFile.getCompleteUrl()); |
/impl/src/java/pt/estgp/estgweb/web/utils/ProxyUtils.java |
---|
1,13 → 1,26 |
package pt.estgp.estgweb.web.utils; |
import org.apache.log4j.Logger; |
import org.dom4j.Document; |
import org.dom4j.Element; |
import org.dom4j.XPath; |
import org.dom4j.DocumentException; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.services.directories.DirectoryNodeType; |
import pt.estgp.estgweb.utils.ConfigProperties; |
import pt.estgp.estgweb.utils.Dom4jUtil; |
import javax.servlet.http.HttpServletRequest; |
import java.io.IOException; |
import java.net.MalformedURLException; |
import java.net.URL; |
import java.util.List; |
import java.util.ArrayList; |
import java.util.Map; |
import java.util.HashMap; |
import com.sun.mail.imap.Rights; |
/** |
* @author Jorge Machado |
* @date 8/Out/2008 |
15,28 → 28,32 |
*/ |
public class ProxyUtils |
{ |
// proxy/accaoSocialAlunosPortalMenu/estgp |
// proxy/accaoSocialAlunosPortalMenu/estgp |
private static final Logger logger = Logger.getLogger(ProxyUtils.class); |
public static String getTopImageLink(HttpServletRequest request) |
{ |
String pathIfo = request.getPathInfo(); |
String queryString = request.getQueryString(); |
if(request.getServletPath().equals("/proxy")) |
{ |
int startServerPathIndex = pathIfo.indexOf('/',1) + 1; |
int lastServerPathIndex = pathIfo.indexOf('/',startServerPathIndex + 1); |
String server = pathIfo.substring(startServerPathIndex,lastServerPathIndex); |
String serverHostUrl = ConfigProperties.getProperty("server." + server) + ConfigProperties.getProperty("server." + server + ".start.path"); |
String finalFileCandidate1 = pathIfo.substring(0,pathIfo.lastIndexOf("/")) + "/top.jpg"; |
int lastIndexOfDot = pathIfo.lastIndexOf("."); |
String finalFileCandidate2 = null; |
if(lastIndexOfDot >= 0) |
finalFileCandidate2 = pathIfo.substring(0,lastIndexOfDot) + ".jpg"; |
String protocol = request.getRequestURL().substring(0,request.getRequestURL().indexOf("://")); |
String finalFileCandidate1total = protocol + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/proxy" + finalFileCandidate1; |
// String protocol = request.getRequestURL().substring(0,request.getRequestURL().indexOf("://")); |
String finalFileCandidate1total = serverHostUrl + finalFileCandidate1.substring(lastServerPathIndex); |
String finalFileCandidate2total = null; |
if(finalFileCandidate2 != null) |
finalFileCandidate2total = protocol + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/proxy" + finalFileCandidate2; |
finalFileCandidate2total = serverHostUrl + finalFileCandidate2.substring(lastServerPathIndex); |
if(finalFileCandidate2 != null) |
try |
93,4 → 110,205 |
} |
return null; |
} |
public static Map<String, String> namespaces = new HashMap<String, String>(); |
static |
{ |
namespaces.put("d", "http://www.estgp.pt/baco/directory/"); |
} |
public static String getTopImageFromDirectoryLink(HttpServletRequest request) |
{ |
String path = request.getPathInfo(); |
if(!request.getServletPath().equals("/dir")) |
{ |
String link = request.getServletPath(); |
String queryString = request.getQueryString(); |
if(path!=null) |
link+= path; |
if(queryString!=null) |
link+= "?" + queryString; |
for(int i = 0; i < Globals.TOP_IMAGE_FILTER_LINKS.size();i++) |
{ |
String url = Globals.TOP_IMAGE_FILTER_LINKS.get(i); |
if(link.startsWith(url)) |
{ |
String finalUrl = Globals.TOP_IMAGE_FILTER_IMAGES_URL.get(i); |
if(finalUrl.startsWith("/")) |
return request.getContextPath() + finalUrl; |
else |
return finalUrl; |
} |
} |
return null; |
} |
String directory = path.substring(1,path.indexOf('/')); |
Document directoryDocument = null; |
try |
{ |
directoryDocument = Dom4jUtil.parseSourceFileFromCache("/pt/estgp/estgweb/directories/" + directory + ".xml"); |
} |
catch (DocumentException e) |
{ |
logger.error(e,e); |
return null; |
} |
catch (IOException e) |
{ |
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. |
} |
if (path.startsWith("/")) |
path = path.substring(1); |
String[] ids = path.split("/"); |
StringBuilder startPath = new StringBuilder(); |
DirectoryNodeType directoryNodeType = null; |
String actualNodeId = null; |
Element actualNode = null; |
int stopName = 0; |
List<Rights> rights = new ArrayList<Rights>(); |
for (String id : ids) |
{ |
XPath idXpath = directoryDocument.createXPath("//*[@id='" + id + "']"); |
idXpath.setNamespaceURIs(namespaces); |
Element idElem = (Element) idXpath.selectSingleNode(directoryDocument); |
if (idElem == null) |
{ |
directoryNodeType = DirectoryNodeType.external; |
break; |
} |
String name = idElem.getQName().getName(); |
if (name.equals("leaf")) |
{ |
directoryNodeType = DirectoryNodeType.leaf; |
actualNodeId = id; |
actualNode = idElem; |
startPath.append("/").append(id); |
} |
else if (name.equals("node")) |
{ |
directoryNodeType = DirectoryNodeType.node; |
actualNodeId = id; |
actualNode = idElem; |
startPath.append("/").append(id); |
} |
else if (name.equals("directory")) |
{ |
directoryNodeType = DirectoryNodeType.directory; |
actualNodeId = id; |
actualNode = idElem; |
startPath.append("/").append(id); |
} |
else |
{ |
logger.error("Unexpected node " + name + " with id " + id); |
return null; |
} |
stopName++; |
} |
if(directoryNodeType == DirectoryNodeType.external) |
{ |
String externalFile = buildExternalFile(stopName, ids); |
String url = getAttributeValue(actualNode, "url"); |
String proxy = getAttributeValue(actualNode, "proxy"); |
if(proxy != null && proxy.length() > 0) |
{ |
String link = getLink(proxy,url); |
if(link == null) |
return null; |
else |
{ |
return startPath + link; |
} |
} |
} |
return null; |
} |
private static String getLink(String server, String urlPath) |
{ |
String serverHostUrl = ConfigProperties.getProperty("server." + server) + ConfigProperties.getProperty("server." + server + ".start.path"); |
String finalFileCandidate1 = urlPath.substring(0,urlPath.lastIndexOf("/")) + "/top.jpg"; |
int lastIndexOfDot = urlPath.lastIndexOf("."); |
String finalFileCandidate2 = null; |
if(lastIndexOfDot >= 0) |
finalFileCandidate2 = urlPath.substring(0,lastIndexOfDot) + ".jpg"; |
// String protocol = request.getRequestURL().substring(0,request.getRequestURL().indexOf("://")); |
String finalFileCandidate1total = serverHostUrl + finalFileCandidate1; |
String finalFileCandidate2total = null; |
if(finalFileCandidate2 != null) |
finalFileCandidate2total = serverHostUrl + finalFileCandidate2; |
if(finalFileCandidate2 != null) |
try |
{ |
URL url = new URL(finalFileCandidate2total); |
url.openConnection().getInputStream(); |
return finalFileCandidate2.substring(finalFileCandidate2.lastIndexOf("/")); |
} |
catch (MalformedURLException e) |
{ |
logger.error("BAD TOP IMAGE URL 2: " + finalFileCandidate2total); |
} |
catch (IOException e) |
{ |
logger.debug("candidate 2 don't exist: " + finalFileCandidate2total); |
} |
try |
{ |
URL url = new URL(finalFileCandidate1total); |
url.openConnection().getInputStream(); |
return "/top.jpg"; |
} |
catch (MalformedURLException e) |
{ |
logger.error("BAD TOP IMAGE URL 1: " + finalFileCandidate1total); |
} |
catch (IOException e) |
{ |
logger.debug("candidate 1 don't exist: " + finalFileCandidate1total); |
} |
return null; |
} |
private static String getAttributeValue(Element actualNode, String name) |
{ |
return (actualNode.attribute(name) != null ? actualNode.attribute(name).getValue() : null); |
} |
private static String buildExternalFile(int stopName, String[] ids) |
{ |
if (stopName <= ids.length) |
{ |
StringBuilder externalFileBuilder = new StringBuilder(); |
for (int i = stopName; i < ids.length; i++) |
{ |
int questionMark = ids[i].indexOf("?"); |
if (questionMark >= 0) |
{ |
externalFileBuilder.append("/").append(ids[i].substring(0, questionMark)); |
break; |
} |
else |
externalFileBuilder.append("/").append(ids[i]); |
} |
return externalFileBuilder.toString(); |
} |
return null; |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/DirLayoutController.java |
---|
25,6 → 25,7 |
import pt.estgp.estgweb.utils.Dom4jUtil; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.web.exceptions.NotAuthorizedException; |
import pt.estgp.estgweb.services.directories.DirectoryNodeType; |
import jomm.web.ftp.IFile; |
import jomm.web.ftp.impl.FtpFile; |
import jomm.web.utils.NavPlace; |
47,14 → 48,8 |
namespaces.put("d", "http://www.estgp.pt/baco/directory/"); |
} |
private static enum DirectoryNodeType |
{ |
node, |
leaf, |
directory, |
external |
} |
private static class Rights |
{ |
List<RightsT> rightsT; |
/impl/src/java/pt/estgp/estgweb/web/controllers/contacts/ContactsController.java |
---|
40,9 → 40,9 |
String area = request.getParameter("area"); |
request.setAttribute("area",area); |
IServiceManager sm = ServiceManager.getInstance(); |
String[] names = new String[]{"role","area"}; |
Object[] args = new Object[]{Globals.TEACHER_ROLE,area}; |
List<UserView> teachers = (List<UserView>) sm.execute(RequestUtils.getRequester(request, response), "LoadRoleAreaUsers", args, names); |
String[] names = new String[]{"area"}; |
Object[] args = new Object[]{area}; |
List<UserView> teachers = (List<UserView>) sm.execute(RequestUtils.getRequester(request, response), "LoadTeachersWithUnits", args, names); |
request.setAttribute("teachers",teachers); |
return mapping.findForward("contactTeachers"); |
} |
/impl/src/java/pt/estgp/estgweb/web/filters/TopImageDirectoryFilter.java |
---|
New file |
0,0 → 1,81 |
package pt.estgp.estgweb.web.filters; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.web.utils.ProxyUtils; |
import javax.servlet.*; |
import javax.servlet.http.HttpServletRequest; |
import java.io.IOException; |
/** |
* |
* @author Jorge Machado |
*/ |
public class TopImageDirectoryFilter implements Filter |
{ |
public static final String TOP_IMAGE = "TOP_IMAGE"; |
public static final String TOP_CSS = "TOP_CSS"; |
public TopImageDirectoryFilter() |
{ |
} |
public void init(FilterConfig config) |
{ |
} |
/** |
* |
* @param request The servlet request we are processing |
* @param chain The filter chain we are processing |
* |
* @exception java.io.IOException if an input/output error occurs |
* @exception javax.servlet.ServletException if a servlet error occurs |
*/ |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
throws IOException, ServletException |
{ |
HttpServletRequest hrequest = (HttpServletRequest) request; |
String relativePath = hrequest.getServletPath(); |
if (relativePath == null) |
relativePath = ""; |
if (hrequest.getPathInfo() != null && hrequest.getPathInfo().length() > 0) |
{ |
relativePath += hrequest.getPathInfo(); |
} |
for (String ignore : Globals.FILTER_TOP_IMAGE_IGNORE_EXTENSIONS) |
{ |
if (relativePath.endsWith(ignore)) |
{ |
chain.doFilter(request, response); |
return; |
} |
} |
for (String ignore : Globals.FILTER_IGNORE_PREFIXES) |
{ |
if (relativePath.startsWith(ignore)) |
{ |
chain.doFilter(request, response); |
return; |
} |
} |
String link = ProxyUtils.getTopImageFromDirectoryLink((HttpServletRequest) request); |
if(link != null) |
{ |
request.setAttribute(TOP_IMAGE,link); |
request.setAttribute(TOP_CSS,link.substring(0,link.lastIndexOf("."))+".css"); |
} |
chain.doFilter(request,response); |
} |
public void destroy() |
{ |
// Nothing |
} |
} |
/impl/src/java/pt/estgp/estgweb/web/filters/UserSessionFilter.java |
---|
3,8 → 3,14 |
import org.apache.log4j.Logger; |
import pt.estgp.estgweb.Globals; |
import pt.estgp.estgweb.domain.UserSessionImpl; |
import pt.estgp.estgweb.domain.UserSession; |
import pt.estgp.estgweb.web.UserSessionProxy; |
import pt.estgp.estgweb.web.utils.RequestUtils; |
import pt.estgp.estgweb.web.exceptions.NoCookiesException; |
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager; |
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager; |
import pt.utl.ist.berserk.logic.serviceManager.exceptions.ServiceManagerException; |
import pt.utl.ist.berserk.logic.filterManager.exceptions.*; |
import javax.servlet.*; |
import javax.servlet.http.HttpServletRequest; |
34,7 → 40,16 |
public void init(FilterConfig config) |
{ |
try |
{ |
IServiceManager sm = ServiceManager.getInstance(); |
Object[] args = new Object[]{"system"}; |
sm.execute("system","LoadUserSession",args); |
} |
catch (Throwable e) |
{ |
logger.fatal("INIT FILTER SESSION FILTER CALLING FIRST SERVICE TO OPEN CONNECTIONS IN HIBERNATE" + e,e); |
} |
} |
/** |
48,7 → 63,7 |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
throws IOException, ServletException |
{ |
HttpServletRequest hrequest = (HttpServletRequest) request; |
String relativePath = hrequest.getServletPath(); |
if (relativePath == null) |
/impl/src/java/pt/estgp/estgweb/web/filters/TopImageFilter.java |
---|
19,6 → 19,7 |
{ |
public static final String TOP_IMAGE = "TOP_IMAGE"; |
public static final String TOP_CSS = "TOP_CSS"; |
public TopImageFilter() |
{ |
40,8 → 41,8 |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
throws IOException, ServletException |
{ |
HttpServletRequest hrequest = (HttpServletRequest) request; |
String relativePath = hrequest.getServletPath(); |
HttpServletRequest hrequest = (HttpServletRequest) request; |
String relativePath = hrequest.getServletPath(); |
if (relativePath == null) |
relativePath = ""; |
50,7 → 51,7 |
relativePath += hrequest.getPathInfo(); |
} |
for (String ignore : Globals.FILTER_IGNORE_EXTENSIONS) |
for (String ignore : Globals.FILTER_TOP_IMAGE_IGNORE_EXTENSIONS) |
{ |
if (relativePath.endsWith(ignore)) |
{ |
67,9 → 68,14 |
} |
} |
String link = ProxyUtils.getTopImageLink((HttpServletRequest) request); |
request.setAttribute(TOP_IMAGE,link); |
chain.doFilter(request,response); |
String link = ProxyUtils.getTopImageLink((HttpServletRequest) request); |
if(link != null) |
{ |
request.setAttribute(TOP_IMAGE,link); |
request.setAttribute(TOP_CSS,link.substring(0,link.lastIndexOf("."))+".css"); |
} |
chain.doFilter(request,response); |
} |
public void destroy() |
/impl/src/web/css/style.css |
---|
39,6 → 39,11 |
background-color: black; |
} |
#header #headerTable |
{ |
background-image:url(@contextPath@/imgs/topFundoTijolo.jpg) |
} |
.log |
{ |
background:gray; |
592,8 → 597,22 |
.portalAnnouncementText, .portalAnnouncementTitle { |
/*table-layout: fixed;*/ |
width: 180px; |
} |
.portalAnnouncementTitle |
{ |
font-weight:bold; |
border-bottom: 1px solid #8EC73F; |
} |
.portalAnnouncementTop{ |
/*table-layout: fixed;*/ |
border-bottom:4px solid black; |
border-left:3px solid #8EC73F; |
padding:2px; |
} |
/* todo FABIO |
todo Left Manus???? ao pe de portalMenus isto esta uma confusao*/ |
.navleftMenu { |
/impl/src/web/css/intranet.css |
---|
97,3 → 97,4 |
} |
/impl/src/web/layout/scripts.jsp |
---|
1,3 → 1,4 |
<%@ page import="pt.estgp.estgweb.web.filters.TopImageFilter" %> |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> |
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/style.css"/> |
<script type="text/javascript" src="<%=request.getContextPath()%>/js/functions.js"></script> |
3,5 → 4,17 |
<script type="text/javascript" src="<%=request.getContextPath()%>/js/ajax.js"></script> |
<script type="text/javascript" src="<%=request.getContextPath()%>/js/compactedPopup.js"></script> |
<% |
String link = (String) request.getAttribute(TopImageFilter.TOP_CSS); |
if (link != null) |
{ |
%> |
<link type="text/css" rel="stylesheet" href="<%=link%>"/> |
<% |
} |
%> |
<script type="text/javascript" language="JavaScript"> |
var cal = new CalendarPopup(); |
</script> |
/impl/src/web/layout/header.jsp |
---|
6,7 → 6,7 |
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %> |
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %> |
<table width="100%" style="background-image:url(<%=request.getContextPath()%>/imgs/topFundoTijolo.jpg)"> |
<table id="headerTable" width="100%"> |
<tr> |
<td> |
/impl/src/web/user/courses/directedCoordinatedCourses.jsp |
---|
267,7 → 267,20 |
<nested:checkbox property="validProgram"/></td> |
</logic:equal> |
<td>${courseUnitView.code}</td> |
<td>${courseUnitView.name}</td> |
<td> |
<baco:hasRole role="teacher"> |
<a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a> |
</baco:hasRole> |
<baco:hasNotRole role="teacher"> |
<logic:equal value="true" name="courseUnitView" property="validProgram"> |
<a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a> |
</logic:equal> |
<logic:equal value="false" name="courseUnitView" property="validProgram"> |
${courseUnitView.name} |
</logic:equal> |
</baco:hasNotRole> |
</td> |
<td>${courseUnitView.teachersSnipet}</td> |
</tr> |
</nested:iterate> |
289,7 → 302,7 |
<nested:checkbox property="validProgram"/></td> |
</logic:equal> |
<td>${courseUnitView.code}</td> |
<td>${courseUnitView.name}</td> |
<td><a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a></td> |
<td>${courseUnitView.teachersSnipet}</td> |
</tr> |
</nested:iterate> |
/impl/src/web/user/contacts/listTeachers.jsp |
---|
37,6 → 37,8 |
<form action="<%=request.getContextPath()%>/user/listTeachers.do"> |
<input type="hidden" name="dispatch" value="listTeachersAZ"/> |
<div id="contentIntranet"> |
<h1><bean:message key="portal.contactos.docentes"/></h1> |
<div class="seccao"> |
<table class="dataTable"> |
<tr> |
/impl/build.xml |
---|
152,9 → 152,6 |
<antcall target="compile"/> |
<antcall target="createConfigurationFiles"/> |
</target> |
<taskdef resource="org/apache/catalina/ant/catalina.tasks" classpathref="pathToToolsLib" /> |
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="pathToToolsLib" /> |
<target name="compile" depends="initDirs" description="Compile All"> |
<javac encoding="UTF-8" source="1.5" target="1.5" destdir="${build.dir.classes}" debug="true" optimize="true" fork="true" failonerror="true" nowarn="true"> |