Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 448 → Rev 496

/impl/importRoutines.xml
14,8 → 14,11
<target name="students">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportStudentsService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
<target name="grades">
<java classname="pt.estgp.estgweb.services.sigesimports.ImportGradesService" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
</target>
<target name="jobs">
<java fork="true" classname="pt.estgp.estgweb.services.jobs.JobDeamon" classpath="${build.dir.classes}" classpathref="pathToToolsLib"/>
<java 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"/>
/impl/Features1.1.3alfa
New file
0,0 → 1,11
 
 
SQL Updates:
CREATE TABLE `rfid`.`interfaces` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`ip` VARCHAR(255),
`url` TEXT,
`isnew` TINYINT UNSIGNED NOT NULL DEFAULT 1,
PRIMARY KEY (`id`)
)
ENGINE = InnoDB;
/impl/conf/language/MessageResourcesCommon.properties
3,6 → 3,9
# ANNOUNCEMENTS MESSAGE RESOURCES
#
################################################################################
result.turn.off.filters=Limpar Filtros
search.pages.to=a
search.result.creator=Autor
search=Pesquisar
search.form=Formulário de Pesquisa
search.results=Resultados da Pesquisa ({0})
/impl/conf/language/MessageResourcesSruSources.properties
New file
0,0 → 1,53
################################################################################
#
# SRU SOURCES MESSAGE RESOURCES
#
################################################################################
module.SruSource=Pastas Partilhadas do Donald
 
srusource.filter.dirs=Filtrar Resultados por directório
srusource=Fontes de Pesquisa SRU (Search and Retrieve via URL)
srusource.create.srusource=Nova fonte SRU
srusource.name=Nome
srusource.zero.collections=De momento não existem colecções atribuidas
srusource.new.collection=Adicione colecção usando este formulário
srusource.admited.roles=Papeis Admitidos
 
srusource.description=Descrição
srusource.url=URL
srusource.collection=Colecção de Pesquisa
srusource.collections=Colecções
srusource.metadataSchema=Esquema de Metadados
srusource.metadataSchema.files=Pastas Partilhadas ESTG
srusource.collection.add=Adicionar Colecção
 
srusource.collectionField=Indice da Colecção No SRU (se não souber coloque: collection)
 
srusource.create.new=Criar nova fonte SRU
srusource.choose.srusources=Escolha uma das Fontes SRU para editar
srusource.edit.srusources=Editar Fontes SRU
srusource.edit.srusource=Editar Fonte SRU
 
srusource.created.success=Fonte SRU criada com sucesso
srusource.edited.success=Fonte SRU editada com sucesso
 
srusource.deleted.sucess=Fonte de SRU apagada com sucesso
srusource.deleted.fail=Falhou a remoção da Fonte de SRU
 
srusource.confirm.delete=Tem a certeza que deseja apagar esta Fonte de SRU?
 
 
facet.facetType=Tipo
facet.facetLastModified=Ultima Modificação
facet.facetDir=Directorios
 
facet.facetType=Tipo
facet.facetLastModified=Ultima Modificação
facet.facetDir=Directorios
facet.date=Dia da Última Modificação
facet.year=Ano da Última Modificação
facet.month=Mês da Última Modificação
facet.type=Tipo de Ficheiro
facet.dir=Directório
 
facets=Filtre por Facetas
/impl/conf/language/MessageResources.properties
126,12 → 126,13
fail.role=Lamentamos o incómodo, mas necessita de permissões especiais para aceder a esta área.
fail.owner=Lamentamos o incómodo, mas não tem permissões sobre o objecto ao qual tentou aceder.
fail.timer=Lamentamos o incomodo, mas a acção que tentou efectuar não pode ser executada nesta data.
fail.authenticate=Falhou a autênticação
fail.authenticate=O nome de utilizador ou a palavra passe estão errados. Por favor tente de novo.
 
#palavras comuns
courseunit=Unidade Curricular
grade=Nota
date=Data
last.modification.date=Última modificação
code=Código
none=Nenhum
description=Descrição
323,6 → 324,7
remove=Remover
yes=Sim
no=Não
url=URL
wait=Aguarde um instante por favor
name=Nome
targets=Papeis
/impl/conf/language/MessageResourcesCourseUnits.properties
7,6 → 7,8
course={0} &gt
courseunit={0}
 
courseunit.menu.unit.old.units=Anos anteriores
courseunit.menu.unit.other.units=Outros Anos
courseunit.menu.unit=Unidade
courseunit.teachers=Corpo Docente
courseunit.objectives=Objectivos da Unidade
56,6 → 58,8
courseunit.S2=2ª Semestre
courseunit.ALL=Todos os Semestres
courseunit.assignement.delivered.date=Data de Entrega
courseunit.assignement.delivered.date.first.version=Data de Entrega da Primeira Versão
courseunit.assignement.delivered.versions=Total de Versões Entregues
courseunit.assignement.deliver.date=Data Limite de Entrega
courseunit.assignement.deliver.type=Tipo de entrega
courseunit.assignement.deliver.type.zipfile=Ficheiro Comprimido (ZIP)
121,6 → 125,10
 
 
 
courseunits.contentsGrants=Permissões de Consulta dos Ficheiros de Conteúdos
courseunits.contentsGrants.PUBLIC=PUBLICAS
courseunits.contentsGrants.PRIVATE=PRIVADOS A ESTUDANTES E DOCENTES DA UNIDADE
courseunits.contentsGrants.INTERNAL=COMUNIDADE ACADÉMICA
 
 
 
/impl/conf/WEB-INF/struts/struts-intranet.xml
48,7 → 48,16
</action>
 
 
<action path="/user/courseUnits"
type="pt.estgp.estgweb.web.controllers. Controller"
scope="request"
parameter="dispatch"
validate="false">
<forward name="contactTeachers" path="page.layoutIntranetContacts.listTeachers"/>
</action>
 
 
 
</action-mappings>
 
</struts-config>
/impl/conf/WEB-INF/struts/struts-srusource.xml
New file
0,0 → 1,46
<?xml version="1.0" encoding="UTF-8"?>
 
<!--<!DOCTYPE struts-config PUBLIC-->
<!--"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"-->
<!--"http://struts.apache.org/dtds/struts-config_1_3.dtd">-->
 
<struts-config>
 
 
<form-beans>
<form-bean type="pt.estgp.estgweb.web.form.srusource.SruSourceForm" name="SruSourceForm"/>
</form-beans>
 
<global-exceptions>
</global-exceptions>
 
<global-forwards>
</global-forwards>
 
 
<action-mappings>
 
<!--Mudar o perfil da area de servico pelo administrador-->
 
<action path="/user/startNewSruSourceFromServiceZone" forward="/user/sruSourceFromServiceZone.do?dispatch=newSruSource&amp;from=ServiceZone"/>
<action path="/user/startChooseSruSourceFromServiceZone" forward="page.load.srusources.from.service.zone"/>
<action path="/user/chooseSruSourceFromServiceZone" forward="/user/sruSourceFromServiceZone.do?dispatch=loadSruSource&amp;from=ServiceZone"/>
<action path="/user/deleteSruSourceFromServiceZone" forward="/user/sruSourceFromServiceZone.do?dispatch=delete&amp;from=ServiceZone"/>
deleteSruSourceFromServiceZone
<action path="/user/sruSourceFromServiceZone"
type="pt.estgp.estgweb.web.controllers.srusource.SruSourceController"
name="SruSourceForm"
scope="request"
parameter="dispatch"
validate="false"
input="page.load.srusource.from.service.zone">
<forward name="success" path="page.separators.serviceZone"/>
<forward name="sruSourceData" path="page.load.srusource.from.service.zone"/>
<forward name="loadSruSources" path="page.load.srusources.from.service.zone"/>
<forward name="loadSruSource" path="page.choose.load.srusource.from.service.zone"/>
<forward name="from.add.role" path="page.load.srusource.from.service.zone"/>
</action>
 
</action-mappings>
 
</struts-config>
/impl/conf/WEB-INF/struts/tiles-srusource.xml
New file
0,0 → 1,32
<?xml version="1.0" encoding="UTF-8" ?>
 
<!--<!DOCTYPE tiles-definitions PUBLIC-->
<!--"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"-->
<!--"http://struts.apache.org/dtds/tiles-config_1_1.dtd">-->
 
 
<tiles-definitions>
 
 
<!--From Service Zone-->
 
<definition name="page.load.srusource.from.service.zone" extends="base.separators">
<put name="title" value="Sru Source" />
<put name="separator" value="4" type="string" />
<put name="topnav" value="/user/serviceZone/topnavCreateSruSource.jsp"/>
<put name="body" value="/admin/srusource/sruSourceData.jsp" />
</definition>
<definition name="page.load.srusources.from.service.zone" extends="base.separators">
<put name="title" value="Choose Sru Source" />
<put name="separator" value="4" type="string" />
<put name="topnav" value="/user/serviceZone/topnavChooseSruSources.jsp"/>
<put name="body" value="/admin/srusource/chooseSruSource.jsp" />
</definition>
<definition name="page.choose.load.srusource.from.service.zone" extends="page.load.srusource.from.service.zone">
<put name="topnav" value="/user/serviceZone/topnavLoadSruSource.jsp"/>
</definition>
 
 
 
</tiles-definitions>
/impl/conf/WEB-INF/struts/struts-default.xml
195,7 → 195,8
/WEB-INF/struts/tiles-commons.xml,
/WEB-INF/struts/tiles-intranet.xml,
/WEB-INF/struts/tiles-reminders.xml,
/WEB-INF/struts/tiles-managedidentifier.xml"/>
/WEB-INF/struts/tiles-managedidentifier.xml,
/WEB-INF/struts/tiles-srusource.xml"/>
</plug-in>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
/impl/conf/WEB-INF/web.xml
143,7 → 143,8
/WEB-INF/struts/struts-commons.xml,
/WEB-INF/struts/struts-intranet.xml,
/WEB-INF/struts/struts-reminders.xml,
/WEB-INF/struts/struts-managedidentifier.xml
/WEB-INF/struts/struts-managedidentifier.xml,
/WEB-INF/struts/struts-srusource.xml
</param-value>
</init-param>
<init-param>
/impl/conf/app.properties
64,6 → 64,7
module.profile=true
module.sms=false
module.quotasImpressao=true
module.srusource=true
##################################################
# SMS
#
80,13 → 81,15
##################################################
##Proxy Servers
#If is an HTTP Server needs encoding config if FTP needs user pass config
#This server is the server for unit contents, must be named ionline, it is hardcoded
server.ionline=ftp://www.global.estgp.pt
server.ionline.start.path=
ionline.pass=baco
ionline.user=Baco_web
ionline.use.default.credentials.to.updates.and.deletes=false
 
server.estgp.start.path=
server.estgp=http://deptal.estgp.pt:9090/static
server.estgp=http://localhost:9090/static
estgp.encoding=UTF-8
estgp.proxy.host=
estgp.proxy.port=
418,6 → 421,7
home.courseunit.last.anouncements.max=3
 
 
 
#########################################
# Servicos de Impressao API
#
428,3 → 432,25
impressao.servicos.auth.pass.property=ionline.pass
impressao.servicos.auth.user=
impressao.servicos.auth.pass=
 
 
 
############################################
# SRU Sources Layout Configuration
#
# Example Assessoria.De.Administracao.9685 \ AnoLectivo.2009-2010 \ Semestre1 \ Lingua.E.Cultura.I.Espanhola \ Conteudos
# for this example the following condition :
# directory pattern: .[\\\/]Semestre[12][\\\/]. This regex means *\Semestre1\* or *\Semestre2\* ignoring slash / or \
# the SubTitle Expression is the follow: "([3] - [0])"
#
#The result is this one: ICON filename [kb] (Lingua.E.Cultura.I.Espanhola - Assessoria.De.Administracao.9685)
# @collection@ is a special token to be replaced by collection name
############################################
 
 
srusource.path.condition.pattern.01=.[\\\\\\/]Semestre[12][\\\\\\/].
srusource.path.condition.template.01= ... > <b>{3}</b> > @collection@
 
srusource.path.condition.pattern.99=.
srusource.path.condition.template.99=(@collection@)
 
/impl/conf/berserk/sd.xml
750,6 → 750,16
</filterChains>
</service>
<service>
<name>LoadCourseUnitsBySigesCodes</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadCourseUnitsBySigesCodesService</implementationClass>
<description>Load course old units</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
<service>
<name>LoadCourseUnitWorks</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.CourseUnitWorkService</implementationClass>
<description>Load course unit works</description>
1404,12 → 1414,63
<!---->
 
 
 
 
<!--SRU Services-->
<service>
<name>LoadSruSourceById</name>
<implementationClass>pt.estgp.estgweb.services.srusources.LoadSruSourceByIdService</implementationClass>
<description>Load SruSource By ID</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
<service>
<name>LoadSruSources</name>
<implementationClass>pt.estgp.estgweb.services.srusources.LoadSruSourcesService</implementationClass>
<description>Load all SruSources</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
<service>
<name>SubmitSruSource</name>
<implementationClass>pt.estgp.estgweb.services.srusources.SruSourceService</implementationClass>
<description>Submit SruSource By ID</description>
<isTransactional>true</isTransactional>
<defaultMethod>submit</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
<service>
<name>DeleteSruSource</name>
<implementationClass>pt.estgp.estgweb.services.srusources.DeleteSruSourceService</implementationClass>
<description>Delete SruSource By ID</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Admins"/>
</filterChains>
</service>
 
 
 
DeleteSruSource
 
 
 
 
 
 
 
</serviceDefinitions>
/impl/conf/hibernate.cfg.xml
19,7 → 19,8
<property name="hibernate.connection.release_mode">after_transaction</property>
<property name="hibernate.c3p0.min_size">2</property>
<property name="hibernate.c3p0.max_size">30</property>
<property name="hibernate.c3p0.timeout">500</property>
<property name="hibernate.c3p0.timeout">300</property>
<property name="hibernate.c3p0.idle_test_period">150</property>
<property name="hibernate.max_statements">50</property>
 
 
/impl/src/java/jomm/utils/StringsUtils.java
30,19 → 30,30
 
public static String getFormatedText(String text)
{
return getFormatedText(text,Integer.MAX_VALUE,Integer.MAX_VALUE);
}
public static String getFormatedText(String text, int maxlines, int maxLineSize)
{
int linesCounter = 1;
int lineSize = 0;
if (text == null || text.trim().length() == 0)
return "";
 
StringBuilder finalFormatedText = new StringBuilder();
boolean newLine = true;
for (int i = 0; i < text.length(); i++)
for (int i = 0; i < text.length() && linesCounter < maxlines; i++)
{
lineSize++;
 
if (newLine && text.charAt(i) == ' ')
{
finalFormatedText.append("&nbsp;");
}
else if (text.charAt(i) == '\n')
{
linesCounter++;
lineSize = 0;
finalFormatedText.append("<br>");
newLine = true;
}
63,6 → 74,13
finalFormatedText.append(text.charAt(i));
newLine = false;
}
 
/*Line Size Simulation*/
if(lineSize > maxLineSize)
{
linesCounter++;
lineSize = 0;
}
}
return finalFormatedText.toString();
}
/impl/src/java/jomm/dao/impl/AbstractDao.java
235,6 → 235,13
}
}
 
public List<CLAZZ> getAll()
{
Session s = getCurrentSession();
Query q = s.createQuery("select * from i where i in class " + getReferenceClass().getName());
return q.list();
}
 
/**
* Return all objects related to the implementation of this DAO with no
* filters.
/impl/src/java/jomm/web/ftp/impl/FtpFile.java
11,6 → 11,7
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
45,7 → 46,7
this.lastUpdate = ftpFile.getTimestamp().getTime();
this.name = ftpFile.getName();
this.directory = ftpFile.isDirectory();
this.size = ftpFile.getSize();
this.size = ftpFile.getSize() / 1024;
if(name.lastIndexOf('.')>=0)
this.extension = name.substring(name.lastIndexOf('.'));
if (ftpFile.getType() == FTPFile.DIRECTORY_TYPE)
83,6 → 84,32
return name;
}
 
 
public String getNameEncoded() throws URIException
{
return URIUtil.encodePath(name,"ISO-8859-1");
}
 
 
public String getNameEscapedHtml()
{
try {
return jomm.utils.TextToHTMLEnconder.escapeHTML(new String(name.getBytes("ISO-8859-1")));
} catch (UnsupportedEncodingException e) {
logger.error(e,e);
return name;
}
}
public String getNameHtml()
{
try {
return new String(name.getBytes("ISO-8859-1"));
} catch (UnsupportedEncodingException e) {
logger.error(e,e);
return name;
}
}
 
public String getExtension()
{
return extension;
/impl/src/java/jomm/web/ftp/IFile.java
22,6 → 22,9
public InputStream getInputStream() throws IOException;
public Date getLastUpdate();
public String getName();
public String getNameEncoded() throws URIException;
public String getNameEscapedHtml();
public String getNameHtml();
public String getExtension();
public String getName(HttpServletRequest request) throws URIException;
public long getSize();
/impl/src/java/pt/estgp/estgweb/utils/HttpClient.java
New file
0,0 → 1,70
package pt.estgp.estgweb.utils;
 
import jomm.utils.MimeTypeGuesser;
 
import java.io.*;
import java.net.ProtocolException;
import java.net.URL;
import java.net.URLConnection;
import java.net.HttpURLConnection;
 
/**
* @author Jorge Machado
* @date 13/Nov/2009
* @time 17:24:38
* @email machadofisher@gmail.com
*/
public class HttpClient
{
public static InputStream sendFile(String url, File file) throws IOException, ProtocolException {
 
String mimeType = MimeTypeGuesser.getInstance().guessMimeType(file);
 
URL urlSolr = new URL(url);
URLConnection urlConnection = urlSolr.openConnection();
urlConnection.addRequestProperty("Content-type",mimeType);
 
((HttpURLConnection) urlConnection).setRequestMethod("GET");
 
 
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);
urlConnection.setUseCaches(false);
OutputStream outputStream = new DataOutputStream(urlConnection.getOutputStream());
 
FileInputStream fStream = new FileInputStream(file);
byte[] bytes = new byte[1024];
int read;
while((read = fStream.read(bytes)) >= 0)
{
outputStream.write(bytes,0,read);
}
outputStream.flush();
outputStream.close();
 
return new DataInputStream(urlConnection.getInputStream());
}
 
public static InputStream sendXmlData(String url, String xmlData) throws IOException, ProtocolException {
 
URL urlSolr = new URL(url);
URLConnection urlConnection = urlSolr.openConnection();
urlConnection.addRequestProperty("Content-type","text/xml");
 
((HttpURLConnection) urlConnection).setRequestMethod("GET");
 
 
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);
urlConnection.setUseCaches(false);
OutputStream outputStream = new DataOutputStream(urlConnection.getOutputStream());
 
outputStream.write(xmlData.getBytes());
 
outputStream.flush();
outputStream.close();
 
return new DataInputStream(urlConnection.getInputStream());
}
 
}
/impl/src/java/pt/estgp/estgweb/services/courses/CoursesCommonServices.java
27,7 → 27,7
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class CoursesCommonServices implements IService, IModuleCommonServices
public class CoursesCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(CoursesCommonServices.class);
 
/impl/src/java/pt/estgp/estgweb/services/courseunits/CourseUnitsCommonServices.java
26,7 → 26,7
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class CourseUnitsCommonServices implements IService, IModuleCommonServices
public class CourseUnitsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(CourseUnitsCommonServices.class);
 
59,6 → 59,7
defaultResult.setSubTitle(courseUnit.getCourseName());
defaultResult.setSubTitleKey(false);
defaultResult.setText(courseUnit.getObjectives());
defaultResult.setDate(courseUnit.getImportYear());
if (from == null)
defaultResult.setUrl("/startLoadCourseUnit.do?id=" + courseUnit.getId());
else
/impl/src/java/pt/estgp/estgweb/services/courseunits/LoadCourseUnitsBySigesCodesService.java
New file
0,0 → 1,42
package pt.estgp.estgweb.services.courseunits;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.domain.views.CourseUnitSummaryView;
import pt.estgp.estgweb.domain.views.AnnouncementView;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.RepositoryFile;
import pt.estgp.estgweb.domain.CourseUnitSummary;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import org.apache.log4j.Logger;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 2:50:07
* @email machadofisher@gmail.com
*/
public class LoadCourseUnitsBySigesCodesService implements IService
{
private static final Logger logger = Logger.getLogger(LoadCourseUnitsBySigesCodesService.class);
 
public List<CourseUnitView> run(String code, String courseCode, UserSession userSession) throws ServiceException {
 
List<CourseUnit> courseUnits = DaoFactory.getCourseUnitDaoImpl().loadBySigesCodes(code, courseCode);
 
if(courseUnits == null || courseUnits.size() == 0)
return new ArrayList<CourseUnitView>();
List<CourseUnitView> courseUnitViews = new ArrayList<CourseUnitView>();
for(CourseUnit cU : courseUnits)
{
CourseUnitView cV = new CourseUnitView(cU);
courseUnitViews.add(cV);
}
return courseUnitViews;
}
}
/impl/src/java/pt/estgp/estgweb/services/courseunits/CreateCourseUnitWorksBackupService.java
419,7 → 419,25
{
if (deliverable.getDeliverableRepositoryStream() != null && deliverable.getDeliverableRepositoryStream().length() > 0)
{
String deliverDir = toDir + "/deliverable" + deliverable.getId() + "-" + deliverable.getStudent().getId() + "numero" + deliverable.getStudent().getSigesCode();
BytesUtils.generateHexKey();
String studentId;
String sigesCode;
if(deliverable.getStudent() != null)
{
studentId = "" + deliverable.getStudent().getId();
sigesCode = "" + deliverable.getStudent().getSigesCode();
}
else if(deliverable.getStudentId() > 0)
{
studentId = "" + deliverable.getStudentId();
sigesCode = "desconhecido" + BytesUtils.generateHexKey();
}
else
{
sigesCode = "desconhecido" + BytesUtils.generateHexKey();
studentId = "desconhecido" + BytesUtils.generateHexKey();
}
String deliverDir = toDir + "/deliverable" + deliverable.getId() + "-" + studentId + "-numero" + sigesCode;
new File(deliverDir).mkdirs();
List<IRepositoryFile> iRepositoryFiles = repositoryService.loadVersions(deliverable.getDeliverableRepositoryStream(), userSession);
for (IRepositoryFile iRepositoryFile : iRepositoryFiles)
/impl/src/java/pt/estgp/estgweb/services/courseunits/CourseUnitWorkService.java
10,6 → 10,7
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.services.data.RepositoryService;
import pt.estgp.estgweb.services.data.IRepositoryFile;
import pt.estgp.estgweb.services.blogs.CreateBlogService;
import pt.estgp.estgweb.services.email.SendEmailService;
import pt.estgp.estgweb.services.email.EMAILJob;
220,7 → 221,10
CourseUnitAssignementView courseUnitAssignementView = new CourseUnitAssignementView(assignement,assignement.getDeliverables().size());
for(CourseUnitDeliverable d: assignement.getDeliverables())
{
views.add(new CourseUnitDeliverableView(d,courseUnitAssignementView));
CourseUnitDeliverableView c = new CourseUnitDeliverableView(d,courseUnitAssignementView);
views.add(c);
RepositoryFileImpl repositoryFile = repositoryService.loadView(d.getDeliverableRepositoryStream());
c.setVersions(new ArrayList<RepositoryFileVersion>(repositoryFile.getRepositoryFileVersions()));
}
courseUnitAssignementView.setDeliverables(views);
courseUnitAssignementView.setCourseUnitView(new CourseUnitView(assignement.getCourseUnit()));
/impl/src/java/pt/estgp/estgweb/services/email/SendEmailService.java
65,8 → 65,12
 
message.setFrom(new InternetAddress(email.getFrom()));
message.setSubject(email.getSubject());
message.setText(fullMessage);
message.setText(fullMessage,"utf-8");
 
 
message.setHeader("Content-Type","text/plain; charset=\"utf-8\"");
message.setHeader("Content-Transfer-Encoding", "quoted-printable");
 
Transport.send(message);
}
}
215,7 → 219,7
arguments.add("unknown");
 
arguments.add( DatesUtils.getStringFromDate(assignement.getDeliverDate()));
 
String subjectTxt;
String template;
 
/impl/src/java/pt/estgp/estgweb/services/email/EmailCommonServices.java
16,7 → 16,7
* @date 22/Mai/2008
* @see pt.estgp.estgweb.services.email
*/
public class EmailCommonServices implements IModuleCommonServices
public class EmailCommonServices extends SingleSearchResults implements IModuleCommonServices
{
 
public int countSearch(String search, SearchTypeEnum searchType, UserSession userSession)
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportGradesService.java
217,7 → 217,10
*/
public static void main(String[] args) throws ServiceException
{
new ImportGradesService().run(DatesUtils.getImportYear());
String year = DatesUtils.getImportYear();
if(args != null && args.length > 0)
year = args[0];
new ImportGradesService().run(year);
}
 
 
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportSumaries.java
178,7 → 178,10
*/
public static void main(String[] args) throws ServiceException
{
new ImportSumaries().run(DatesUtils.getImportYear());
String year = DatesUtils.getImportYear();
if(args != null && args.length > 0)
year = args[0];
new ImportSumaries().run(year);
}
 
 
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportStudentsService.java
217,7 → 217,10
 
public static void main(String[] args) throws ServiceException
{
new ImportStudentsService().run(DatesUtils.getImportYear());
String year = DatesUtils.getImportYear();
if(args != null && args.length > 0)
year = args[0];
new ImportStudentsService().run(year);
}
}
 
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportTeachersService.java
119,13 → 119,13
if(t.getName() == null || t.getName().length() == 0)
t.setName(d.getNomeFuncionarioInt());
//Email instituicao
t.setEmail(d.getEmail());
if(t.getEmail() == null || t.getEmail().indexOf("@") < 0)
t.setEmail(d.getEmail());
if (d.getEmail() != null && d.getEmail().endsWith(Globals.EMAIL_LOCAL_SUFFIX))
{
int atIndex = d.getEmail().indexOf("@");
if (atIndex > 0)
t.setUsername(d.getEmail().substring(0, atIndex));
 
}
t.setSigesCode(d.getCodigoFuncionario().intValue());
if(t.getAddress() == null || t.getAddress().length() == 0)
201,8 → 201,11
*/
public static void main(String[] args) throws ServiceException
{
String year = DatesUtils.getImportYear();
if(args != null && args.length > 0)
year = args[0];
AbstractDao.getCurrentSession().beginTransaction();
new ImportTeachersService().run(DatesUtils.getImportYear());
new ImportTeachersService().run(year);
AbstractDao.getCurrentSession().getTransaction().commit();
}
 
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportCourseService.java
166,8 → 166,11
 
public static void main(String[] args) throws ServiceException
{
String year = DatesUtils.getImportYear();
if(args != null && args.length > 0)
year = args[0];
AbstractDao.getCurrentSession().beginTransaction();
new ImportCourseService().run(DatesUtils.getImportYear());
new ImportCourseService().run(year);
AbstractDao.getCurrentSession().getTransaction().commit();
}
 
/impl/src/java/pt/estgp/estgweb/services/reminders/RemindersCommonServices.java
21,7 → 21,7
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class RemindersCommonServices implements IService, IModuleCommonServices
public class RemindersCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(RemindersCommonServices.class);
/impl/src/java/pt/estgp/estgweb/services/common/ISearchResults.java
22,6 → 22,11
public int getMaxResultsPage();
public String getQuery();
public String getSearchType();
public String getModuleInternalKey();
public String getDescription();
public List<IFacet> getFacets();
public String getQueryNoEncode();
public String getQueryUtf();
 
 
}
/impl/src/java/pt/estgp/estgweb/services/common/MultipleSearchResults.java
New file
0,0 → 1,31
package pt.estgp.estgweb.services.common;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.services.common.impl.DefaultSearchResults;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 1:10:00
* @email machadofisher@gmail.com
*/
public abstract class MultipleSearchResults implements IService, IModuleCommonServices
{
public ISearchResults search(String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) {
List<ISearchResults> searchResultsList = searchList(null, search, searchType,page,maxResults,userSession);
if(searchResultsList == null || searchResultsList.size() == 0)
return null;
return searchResultsList.get(0);
}
 
public ISearchResults search(String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) {
List<ISearchResults> searchResultsList = searchList(null, from,search, searchType,page,maxResults,userSession);
if(searchResultsList == null || searchResultsList.size() == 0)
return null;
return searchResultsList.get(0);
}
}
/impl/src/java/pt/estgp/estgweb/services/common/ModuleEnum.java
9,6 → 9,7
import pt.estgp.estgweb.services.courseunits.CourseUnitsCommonServices;
import pt.estgp.estgweb.services.courses.CoursesCommonServices;
import pt.estgp.estgweb.services.profile.ProfileCommonServices;
import pt.estgp.estgweb.services.srusources.SruSourcesCommonServices;
 
/**
* @author Jorge Machado
28,8 → 29,9
BlogPosts("module.BlogPosts", new BlogPostsCommonServices()),
CourseUnits("module.CourseUnits", new CourseUnitsCommonServices()),
Courses("module.Courses", new CoursesCommonServices()),
Profile("module.Profile", new ProfileCommonServices());
Profile("module.Profile", new ProfileCommonServices()),
// Questionarios("module.Qustionarios", new QuestionariosCommonServices());
SruSource("module.SruSource", new SruSourcesCommonServices());
 
// Events("module.Events",null),
// Blogs("module.Blogs",null),
/impl/src/java/pt/estgp/estgweb/services/common/IModuleCommonServices.java
18,6 → 18,9
public ISearchResults search(String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession);
public ISearchResults search(String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession);
 
public List<ISearchResults> searchList(String moduleInternalKey, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession);
public List<ISearchResults> searchList(String moduleInternalKey, String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession);
 
public int countToDo(UserSession userSession);
public IToDoCat getToDo(UserSession userSession);
public List<IToDo> getAllToDos(UserSession userSession);
/impl/src/java/pt/estgp/estgweb/services/common/CommonServicesService.java
29,11 → 29,16
}
}
 
public ISearchResults searchModule(String from, String query, SearchTypeEnum searchType, ModuleEnum moduleKey, int page,UserSession userSession) throws Throwable
public ISearchResults searchModule(String from, String query, SearchTypeEnum searchType, ModuleEnum moduleKey, String moduleInternalKey, int page,UserSession userSession) throws Throwable
{
try
{
return CommonServicesManager.getInstance().search(userSession, query, searchType,moduleKey,page, from);
//In this case we are allays invoking one specific search source (in MultipleSearchResults services internalKey will be filled and the results come from one
// and one only source)
List<ISearchResults> results = CommonServicesManager.getInstance().search(userSession, query, searchType,moduleKey,moduleInternalKey, page, from);
if(results == null)
return null;
return results.get(0);
}
catch (Throwable throwable)
{
/impl/src/java/pt/estgp/estgweb/services/common/impl/DefaultResult.java
1,6 → 1,7
package pt.estgp.estgweb.services.common.impl;
 
import pt.estgp.estgweb.services.common.IResult;
import jomm.utils.StringsUtils;
 
/**
* @author Jorge Machado
21,6 → 22,12
private boolean titleKey = false;
private boolean subTitleKey = false;
private boolean textKey = false;
private boolean absoluteUrl = false;
private String date;
private String creator;
private String directory;
private String sizeKb;
private String mime;
 
private LabelGroup subTitlesGroup = null;
 
45,6 → 52,14
this.bestFragments = bestFragments;
}
 
public String getMime() {
return mime;
}
 
public void setMime(String mime) {
this.mime = mime;
}
 
public String getTitle() {
return title;
}
65,6 → 80,13
return text;
}
 
public String getTextSummary()
{
if(text!=null)
return StringsUtils.getFragment(text,300);
return null;
}
 
public String getUrl() {
return url;
}
100,8 → 122,51
return subTitlesGroup;
}
 
 
public String getDate() {
return date;
}
 
public void setDate(String date) {
this.date = date;
}
 
public String getCreator() {
return creator;
}
 
public void setCreator(String creator) {
this.creator = creator;
}
 
public String getDirectory() {
return directory;
}
 
public void setDirectory(String directory) {
this.directory = directory;
}
 
public void setSubTitlesGroup(LabelGroup subTitlesGroup)
{
this.subTitlesGroup = subTitlesGroup;
}
 
 
public boolean isAbsoluteUrl() {
return absoluteUrl;
}
 
public void setAbsoluteUrl(boolean absoluteUrl) {
this.absoluteUrl = absoluteUrl;
}
 
 
public String getSizeKb() {
return sizeKb;
}
 
public void setSizeKb(String sizeKb) {
this.sizeKb = sizeKb;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/impl/DefaultSearchResults.java
3,6 → 3,7
import pt.estgp.estgweb.services.common.ISearchResults;
import pt.estgp.estgweb.services.common.ModuleEnum;
import pt.estgp.estgweb.services.common.IResult;
import pt.estgp.estgweb.services.common.IFacet;
 
import java.util.List;
import java.util.ArrayList;
26,6 → 27,9
private int maxResultsPage;
private String query;
private String searchType;
private String moduleInternalKey = null;
private String description;
private List<IFacet> facets;
 
 
public ModuleEnum getModule() {
116,7 → 120,23
}
return query;
}
public String getQueryUtf() {
try
{
return URIUtil.encodePath(query,"UTF-8");
}
catch (URIException e)
{
e.printStackTrace();
}
return query;
}
public String getQueryNoEncode() {
 
return query;
 
}
 
public void setQuery(String query) {
this.query = query;
}
128,4 → 148,30
public void setSearchType(String searchType) {
this.searchType = searchType;
}
 
public String getModuleInternalKey() {
return moduleInternalKey;
}
 
public void setModuleInternalKey(String moduleInternalKey) {
this.moduleInternalKey = moduleInternalKey;
}
 
 
public String getDescription() {
return description;
}
 
public void setDescription(String description) {
this.description = description;
}
 
 
public List<IFacet> getFacets() {
return facets;
}
 
public void setFacets(List<IFacet> facets) {
this.facets = facets;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/CommonServicesManager.java
69,21 → 69,34
if (searchType == null)
searchType = SearchTypeEnum.AllWords;
CommonSearchResults commonSearchResults = new CommonSearchResults();
List<ISearchResults> results = new ArrayList<ISearchResults>();
if(query != null && query.trim().length() > 0)
{
 
for (ModuleEnum module : ModuleEnum.values())
{
if (module.getModuleCommonServices() != null)
 
List<ISearchResults> results = new ArrayList<ISearchResults>();
 
for (ModuleEnum module : ModuleEnum.values())
{
ISearchResults iSearchResults = search(userSession, query, searchType, module, 0, from);
if (iSearchResults != null && iSearchResults.getTotalResults() > 0)
if (module.getModuleCommonServices() != null)
{
results.add(iSearchResults);
commonSearchResults.addMoreResults(iSearchResults.getTotalResults());
List<ISearchResults> iSearchResultsList = search(userSession, query, searchType, module,null, 0, from);
if(iSearchResultsList != null && iSearchResultsList.size() > 0)
for(ISearchResults iSearchResults: iSearchResultsList)
{
if (iSearchResults != null && iSearchResults.getTotalResults() > 0)
{
results.add(iSearchResults);
commonSearchResults.addMoreResults(iSearchResults.getTotalResults());
}
}
}
}
commonSearchResults.setResults(results);
}
commonSearchResults.setResults(results);
else
{
commonSearchResults.setResults(new ArrayList<ISearchResults>());
}
commonSearchResults.setQuery(query);
commonSearchResults.setSearchType(searchType.getMessageKey());
return commonSearchResults;
104,7 → 117,7
* @return searchResults
* @throws Throwable on not authorized and internal error
*/
public ISearchResults search(UserSession userSession, String query, SearchTypeEnum searchType, ModuleEnum moduleKey, int page, String from) throws Throwable
public List<ISearchResults> search(UserSession userSession, String query, SearchTypeEnum searchType, ModuleEnum moduleKey,String moduleInternalKey, int page, String from) throws Throwable
{
try
{
112,9 → 125,13
// String[] names = new String[]{};
// Object[] args = new Object[]{query, searchType, page, SEARCH_MAX_RESULTS};
 
DefaultSearchResults searchResults = (DefaultSearchResults) moduleKey.getModuleCommonServices().search(from, query, searchType, page, SEARCH_MAX_RESULTS, userSession); //(DefaultSearchResults) sm.execute(requester, moduleKey.getSearchService(), "search", args, names);
if(searchResults!=null)
List<ISearchResults> searchResultsList = moduleKey.getModuleCommonServices().searchList(moduleInternalKey, from, query, searchType, page, SEARCH_MAX_RESULTS, userSession); //(DefaultSearchResults) sm.execute(requester, moduleKey.getSearchService(), "search", args, names);
if(searchResultsList == null || searchResultsList.size() == 0)
return null;
for(ISearchResults iSearchResults: searchResultsList)
{
DefaultSearchResults searchResults = (DefaultSearchResults) iSearchResults;
 
searchResults.setPage(page);
searchResults.setMaxResultsPage(SEARCH_MAX_RESULTS);
searchResults.setQuery(query.replace("'", " "));
124,7 → 141,10
for (IResult result : searchResults.getResults())
{
DefaultResult defaultResult = (DefaultResult) result;
defaultResult.setBestFragments(LuceneUtils.doStandardHighlights(defaultResult.getText(), query, SEARCH_FRAGMENT_SIZE, SEARCH_MAX_FRAGMENTS));
if(defaultResult.getBestFragments() == null || defaultResult.getBestFragments().trim().length() == 0)
{
defaultResult.setBestFragments(LuceneUtils.doStandardHighlights(defaultResult.getText(), query, SEARCH_FRAGMENT_SIZE, SEARCH_MAX_FRAGMENTS));
}
if (!defaultResult.isTitleKey())
{
String title = defaultResult.getTitle();
139,16 → 159,27
if (defaultResult.getSubTitle() == null || defaultResult.getSubTitle().length() == 0)
defaultResult.setSubTitle(subTitle);
}
String text = defaultResult.getText();
defaultResult.setText(LuceneUtils.highlight(defaultResult.getText(), query));
if (defaultResult.getText() == null || defaultResult.getText().length() == 0)
defaultResult.setText(text);
if(defaultResult.getText() != null && defaultResult.getText().trim().length() > 0)
{
String text = defaultResult.getText();
 
defaultResult.setText(LuceneUtils.highlight(defaultResult.getText(), query));
if (defaultResult.getText() == null || defaultResult.getText().length() == 0)
defaultResult.setText(text);
}
 
if(defaultResult.getCreator() != null && defaultResult.getCreator().trim().length() > 0)
{
String creator = defaultResult.getCreator();
 
defaultResult.setCreator(LuceneUtils.highlight(defaultResult.getCreator(), query));
if (defaultResult.getCreator() == null || defaultResult.getCreator().length() == 0)
defaultResult.setCreator(creator);
}
}
}
return searchResults;
}
else
return null;
return searchResultsList;
}
catch (FilterRetrieveException e)
{
/impl/src/java/pt/estgp/estgweb/services/common/DefaultFacet.java
New file
0,0 → 1,31
package pt.estgp.estgweb.services.common;
 
import java.util.List;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 11:20:10
* @email machadofisher@gmail.com
*/
public class DefaultFacet implements IFacet{
 
String index;
List<IFacetLabel> labels;
 
public String getIndex() {
return index;
}
 
public void setIndex(String index) {
this.index = index;
}
 
public List<IFacetLabel> getLabels() {
return labels;
}
 
public void setLabels(List<IFacetLabel> labels) {
this.labels = labels;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/DefaultFacetLabel.java
New file
0,0 → 1,30
package pt.estgp.estgweb.services.common;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 11:21:02
* @email machadofisher@gmail.com
*/
public class DefaultFacetLabel implements IFacetLabel
{
String label;
int ocurrences;
 
 
public String getLabel() {
return label;
}
 
public void setLabel(String label) {
this.label = label;
}
 
public int getOccurrences() {
return ocurrences;
}
 
public void setOccurrences(int ocurrences) {
this.ocurrences = ocurrences;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/IResult.java
17,9 → 17,16
public boolean isSubTitleKey();
public String getBestFragments();
public String getText();
public String getTextSummary();
public boolean isTextKey();
public String getUrl();
public boolean isAbsoluteUrl();
public LabelGroup getSubTitlesGroup();
public String getDate();
public String getCreator();
public String getDirectory();
public String getSizeKb();
public String getMime();
 
/**
* Class to support groups of labels
/impl/src/java/pt/estgp/estgweb/services/common/SingleSearchResults.java
New file
0,0 → 1,34
package pt.estgp.estgweb.services.common;
 
import pt.estgp.estgweb.domain.UserSession;
import pt.utl.ist.berserk.logic.serviceManager.IService;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 1:10:00
* @email machadofisher@gmail.com
*/
public abstract class SingleSearchResults implements IService, IModuleCommonServices
{
public List<ISearchResults> searchList(String moduleInternalKey, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) {
ISearchResults searchResults = search(search, searchType,page,maxResults,userSession);
if(searchResults == null)
return null;
List<ISearchResults> finalResults = new ArrayList<ISearchResults>();
finalResults.add(searchResults);
return finalResults;
}
 
public List<ISearchResults> searchList(String moduleInternalKey, String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) {
ISearchResults searchResults = search(from, search, searchType, page, maxResults, userSession);
if(searchResults == null)
return null;
List<ISearchResults> finalResults = new ArrayList<ISearchResults>();
finalResults.add(searchResults);
return finalResults;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/QueryLanguageChars.java
New file
0,0 → 1,94
package pt.estgp.estgweb.services.common;
 
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.log4j.Logger;
 
/**
* @author Jorge Machado
* @date 20/Nov/2009
* @time 10:32:07
* @email machadofisher@gmail.com
*/
public enum QueryLanguageChars {
 
SLASH_ESCAPE("\"",false),
PLUS("+",false),
MINUS("-",false),
ANDe ("&&",false),
OR("||",false),
EXCL("!",false),
BRACKET_L("(",true),
BRACKET_R(")",true),
CHAV_L("{",false),
CHAV_R("}",false),
RECT_BRACKETS_L("[",false),
RECT_BRACKETS_R("]",false),
CIRCUNFLEX("^",false),
QUOTE("\"",false),
TIL("~",false),
ASTRISK("*",false),
QUESTION_MARK("?",false),
TWO_DOTS(":",true);
 
String chars;
boolean usual;
private static final Logger logger = Logger.getLogger(QueryLanguageChars.class);
 
private QueryLanguageChars(String chars, boolean usual)
{
this.usual = usual;
this.chars = chars;
}
 
public static String escape(String string)
{
for(QueryLanguageChars chars: values())
{
string = string.replace(chars.chars,"\\" + chars.chars);
}
logger.info("Final Escaped Query: " + string);
return string;
}
 
 
public static boolean containsSpecialNotUsual(String string)
{
for(QueryLanguageChars chars: values())
{
 
if(!chars.usual && string.indexOf(chars.chars) >= 0)
return true;
}
return false;
}
 
public static boolean contains(String string)
{
for(QueryLanguageChars chars: values())
{
if(string.indexOf(chars.chars) >= 0)
return true;
}
return false;
}
 
static QueryParser queryParser = new QueryParser("",new SimpleAnalyzer());
 
 
public static boolean isValid(String query)
{
if(query == null)
return false;
try {
queryParser.parse(query);
return true;
} catch (ParseException e) {
logger.info("bad query for SruSearchService:" + query + " -> " + e.toString());
logger.debug(e,e);
}
return false;
}
 
}
/impl/src/java/pt/estgp/estgweb/services/common/IFacetLabel.java
New file
0,0 → 1,12
package pt.estgp.estgweb.services.common;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 11:19:24
* @email machadofisher@gmail.com
*/
public interface IFacetLabel {
public String getLabel();
public int getOccurrences();
}
/impl/src/java/pt/estgp/estgweb/services/common/IFacet.java
New file
0,0 → 1,14
package pt.estgp.estgweb.services.common;
 
import java.util.List;
 
/**
* @author Jorge Machado
* @date 18/Nov/2009
* @time 11:06:18
* @email machadofisher@gmail.com
*/
public interface IFacet {
public String getIndex();
public List<IFacetLabel> getLabels();
}
/impl/src/java/pt/estgp/estgweb/services/ftpservices/FtpRequestForm.java
5,6 → 5,9
import java.io.InputStream;
import java.util.List;
 
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.views.CourseUnitView;
 
/**
* @author Jorge
* @date 26/Fev/2009
13,9 → 16,11
public class FtpRequestForm
{
 
CourseUnitView courseUnitView;
boolean savePassword = false;
String startPath;
String serverUrl;
String serverConfName;
 
String username;
String password;
26,6 → 31,22
String folderToDelete;
 
 
public CourseUnitView getCourseUnitView() {
return courseUnitView;
}
 
public void setCourseUnitView(CourseUnitView courseUnitView) {
this.courseUnitView = courseUnitView;
}
 
public String getServerConfName() {
return serverConfName;
}
 
public void setServerConfName(String serverConfName) {
this.serverConfName = serverConfName;
}
 
public boolean isSavePassword()
{
return savePassword;
/impl/src/java/pt/estgp/estgweb/services/ftpservices/FtpService.java
6,10 → 6,10
import pt.estgp.estgweb.services.email.IAddress;
import pt.estgp.estgweb.services.email.impl.DefaultPopEmail;
import pt.estgp.estgweb.services.email.impl.DefaultAddress;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.UserImpl;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.web.utils.DatesUtils;
import pt.estgp.estgweb.web.FtpServer;
import org.apache.log4j.Logger;
42,34 → 42,59
 
private static final String FTP_PASSWORD = "pt.estgp.estgweb.services.ftpservices.FtpService.FTP_PASSWORD";
 
 
public String run(FtpRequestForm ftpRequestForm, UserSession userSession) throws IOException
{
if(ftpRequestForm.isSavePassword() && ftpRequestForm.getPassword() != null && ftpRequestForm.getPassword().trim().length() > 0)
{
((UserSessionImpl)userSession).put(FTP_PASSWORD,DesUtils.getInstance().encrypt(ftpRequestForm.getPassword()));
}
String passwordCode = (String) ((UserSessionImpl)userSession).get(FTP_PASSWORD);
 
boolean isStaticAccess = ConfigProperties.getBooleanProperty(ftpRequestForm.getServerConfName()+".use.default.credentials.to.updates.and.deletes");
String password;
if(passwordCode != null)
String username;
//This only works for Contents of CourseUnits, if user uses SavePassword than the password saved will be used
if(!ftpRequestForm.isSavePassword() && isStaticAccess)
{
logger.info("using saved password");
password = DesUtils.getInstance().decrypt(passwordCode);
if(ftpRequestForm.getCourseUnitView() != null)
{
CourseUnitImpl courseUnit = (CourseUnitImpl) DaoFactory.getCourseUnitDaoImpl().load(ftpRequestForm.getCourseUnitView().getId());
if(!courseUnit.isOwnedBy(userSession.getUser(),true))
{
logger.warn("Trying to admin FTP Folder, no permission for username:" + userSession.getUsername());
return "errors.ftp.no.permission";
}
username = ConfigProperties.getProperty(ftpRequestForm.getServerConfName() + ".user");
password = ConfigProperties.getProperty(ftpRequestForm.getServerConfName() + ".pass");
}
else
return "errors.ftp.no.permission";
}
else
{
logger.info("trying pop 3 password");
password = DesUtils.getInstance().decrypt(userSession.getUser().getPop3password());
if(ftpRequestForm.isSavePassword() && ftpRequestForm.getPassword() != null && ftpRequestForm.getPassword().trim().length() > 0)
{
((UserSessionImpl)userSession).put(FTP_PASSWORD,DesUtils.getInstance().encrypt(ftpRequestForm.getPassword()));
}
String passwordCode = (String) ((UserSessionImpl)userSession).get(FTP_PASSWORD);
 
if(passwordCode != null)
{
logger.info("using saved password");
password = DesUtils.getInstance().decrypt(passwordCode);
}
else
{
logger.info("trying pop 3 password");
password = DesUtils.getInstance().decrypt(userSession.getUser().getPop3password());
}
username = ftpRequestForm.getUsername();
if(username == null || username.trim().length() == 0)
username = userSession.getUsername();
}
String username = ftpRequestForm.getUsername();
if(username == null || username.trim().length() == 0)
username = userSession.getUsername();
FtpServer server = FtpServer.getNewServer(ftpRequestForm.getServerUrl(),username,password);
FTPClient client = server.getClient();
String result = "ftp.operation.success";
client.setFileType(FTP.BINARY_FILE_TYPE);
client.changeWorkingDirectory(ftpRequestForm.getStartPath());
if(ftpRequestForm.getFilesToImport() != null)
{
{
for(FileItem item: ftpRequestForm.getFilesToImport())
{
 
/impl/src/java/pt/estgp/estgweb/services/profile/ProfileCommonServices.java
28,7 → 28,7
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class ProfileCommonServices implements IService, IModuleCommonServices
public class ProfileCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(ProfileCommonServices.class);
 
/impl/src/java/pt/estgp/estgweb/services/blogs/BlogsCommonServices.java
30,7 → 30,7
* Created at 17/Out/2003 , 23:45:24
*
*/
public class BlogsCommonServices implements IService, IModuleCommonServices
public class BlogsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(BlogsCommonServices.class);
 
73,6 → 73,9
defaultResult.setSubTitle(null);
defaultResult.setSubTitleKey(true);
defaultResult.setText(blog.getDescription());
defaultResult.setDate(new java.text.SimpleDateFormat("yyyy.MM.dd").format(blog.getUpdateDate()));
if(blog.getOwner() != null)
defaultResult.setCreator(blog.getOwner().getName());
if(blog instanceof CourseUnitBlog)
defaultResult.setUrl("/user/startLoadBlogFromCourseUnit.do?id=" + blog.getId());
else if(from == null)
/impl/src/java/pt/estgp/estgweb/services/blogs/BlogPostsCommonServices.java
28,7 → 28,7
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class BlogPostsCommonServices implements IService, IModuleCommonServices
public class BlogPostsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
private static final Logger logger = Logger.getLogger(BlogPostsCommonServices.class);
 
72,6 → 72,9
defaultResult.setSubTitle(null);
defaultResult.setSubTitleKey(true);
defaultResult.setText(blogPost.getText());
defaultResult.setDate(new java.text.SimpleDateFormat("yyyy.MM.dd").format(blogPost.getUpdateDate()));
if(blogPost.getOwner() != null)
defaultResult.setCreator(blogPost.getOwner().getName());
MyCalendar myCalendar = new MyCalendar();
if (myCalendar.getMonth() != blogPost.getMonth() || myCalendar.getYear() != blogPost.getYear())
{
/impl/src/java/pt/estgp/estgweb/services/announcements/TodoAnnouncementsCommonServices.java
21,7 → 21,7
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class TodoAnnouncementsCommonServices implements IService, IModuleCommonServices
public class TodoAnnouncementsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(TodoAnnouncementsCommonServices.class);
/impl/src/java/pt/estgp/estgweb/services/announcements/AnnouncementsCommonServices.java
21,7 → 21,7
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class AnnouncementsCommonServices implements IService, IModuleCommonServices
public class AnnouncementsCommonServices extends SingleSearchResults implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(AnnouncementsCommonServices.class);
63,6 → 63,9
DefaultResult defaultResult = new DefaultResult();
defaultResult.setTitle(a.getTitle());
defaultResult.setSubTitle("announcements.type." + a.getType());
defaultResult.setDate(new java.text.SimpleDateFormat("yyyy.MM.dd").format(a.getUpdateDate()));
if(a.getOwner() != null)
defaultResult.setCreator(a.getOwner().getName());
defaultResult.setSubTitleKey(true);
defaultResult.setText(a.getText());
if(from == null)
75,6 → 78,8
return searchResults;
}
 
 
 
public int countToDo(UserSession userSession)
{
return 0; //todo To change body of implemented methods use File | Settings | File Templates.
/impl/src/java/pt/estgp/estgweb/services/srusources/LoadSruSourceByIdService.java
New file
0,0 → 1,28
package pt.estgp.estgweb.services.srusources;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.services.profile.LoadUserByIdService;
import pt.estgp.estgweb.domain.views.UserView;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.User;
import pt.estgp.estgweb.domain.SruSource;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
 
import java.io.Serializable;
 
public class LoadSruSourceByIdService implements IService {
 
private static final Logger logger = Logger.getLogger(LoadSruSourceByIdService.class);
 
 
 
public SruSourceView run(Serializable id, UserSession userSession)
{
SruSource sruSource = DaoFactory.getSruSourceDaoImpl().load(id);
SruSourceView sruSourceView = new SruSourceView(sruSource,sruSource.getCollections());
logger.info("Loading srusource view:" + sruSourceView.getId());
return sruSourceView;
}
}
/impl/src/java/pt/estgp/estgweb/services/srusources/SruSourcesCommonServices.java
New file
0,0 → 1,349
package pt.estgp.estgweb.services.srusources;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.services.common.*;
import pt.estgp.estgweb.services.common.impl.DefaultSearchResults;
import pt.estgp.estgweb.services.common.impl.DefaultResult;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.domain.views.SruSourceCollectionView;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.utils.RoleManager;
import pt.estgp.estgweb.utils.Dom4jUtil;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.Globals;
import org.apache.log4j.Logger;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.analysis.SimpleAnalyzer;
import org.apache.lucene.analysis.Analyzer;
import org.dom4j.Document;
import org.dom4j.XPath;
import org.dom4j.Element;
 
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.net.URLEncoder;
import java.net.URL;
 
/*
* @author Goncalo Luiz gedl [AT] rnl [DOT] ist [DOT] utl [DOT] pt
*
*
* Created at 17/Out/2003 , 23:45:24
*
*/
/**
* @author Jorge Machado
* <p/>
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class SruSourcesCommonServices extends MultipleSearchResults implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(SruSourcesCommonServices.class);
 
 
public int countSearch(String search, SearchTypeEnum searchType, UserSession userSession)
{
return 0;
}
 
public List<ISearchResults> searchList(String moduleInternalKey, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession)
{
return searchList(moduleInternalKey, null, search, searchType, page, maxResults, userSession);
}
 
public List<ISearchResults> searchList(String moduleInternalKey, String from, String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession)
{
boolean containsSpecialChars = false;
 
if(!QueryLanguageChars.isValid(search))
return null;
if(QueryLanguageChars.containsSpecialNotUsual(search))
{
containsSpecialChars = true;
}
 
// if(searchType == SearchTypeEnum.ExactPhrase && search.indexOf("AND") < 0)
// search = "\"" + search + "\"";
// if(searchType == SearchTypeEnum.AllWords && search)
// search = search.replace("(","\\(").replace(")","\\)").replace("[","\\[").replace("]","\\]").replace("{","\\{").replace("}","\\}").replace(":","\\:").replace("^","\\^");
List<ISearchResults> searchResults = new ArrayList<ISearchResults>();
 
if(userSession.getUser() == null)
return searchResults;
 
//obtain source, in case of internal key means hat we are in the presence of a page search
List<SruSource> sruSources;
List<SruSourceView> admitedSources;
if(moduleInternalKey == null)
{
sruSources = DaoFactory.getSruSourceDaoImpl().findAll();
}
else
{
long sourceId = Long.parseLong(moduleInternalKey);
SruSource sruSource = DaoFactory.getSruSourceDaoImpl().load(sourceId);
sruSources = new ArrayList<SruSource>();
sruSources.add(sruSource);
}
 
 
//filtering the admited sources
admitedSources = new ArrayList<SruSourceView>();
for(SruSource source: sruSources)
{
List<SruSourceCollection> admitedCollections = new ArrayList<SruSourceCollection>();
 
for(SruSourceCollection sruSourceCollection : source.getCollections())
{
if(sruSourceCollection.getAdmitedRoles() == null || sruSourceCollection.getAdmitedRoles().trim().length() == 0 || RoleManager.hasRole(userSession.getUser(), RoleManager.getRolesFromSerial(sruSourceCollection.getAdmitedRoles())))
{
admitedCollections.add(sruSourceCollection);
}
}
if(admitedCollections.size() > 0)
{
SruSourceView sruSourceView = new SruSourceView(source,admitedCollections);
admitedSources.add(sruSourceView);
}
}
 
if(admitedSources.size() > 0)
{
for(SruSourceView sruSourceView: admitedSources)
{
DefaultSearchResults searchResultsSource = new DefaultSearchResults();
searchResultsSource.setResults(new ArrayList<IResult>());
searchResultsSource.setModuleInternalKey("" + sruSourceView.getId());
searchResultsSource.setModule(ModuleEnum.SruSource);
searchResultsSource.setDescription(sruSourceView.getName());
try
{
StringBuilder collectionQuery = new StringBuilder();
String appender = "";
for(SruSourceCollectionView collectionView: sruSourceView.getCollections())
{
collectionQuery.append(appender).append(sruSourceView.getCollectionField()).append(":\"" + collectionView.getCollection() + "\"");
appender = " OR ";
}
String finalQuery = "(" + collectionQuery.toString() + ") AND (" + search + ")";
logger.info("Sru server " + sruSourceView.getName() + " final query: " + finalQuery);
String service = "getSRUResponseWithThisQueryPhraseBoost";
if(containsSpecialChars)
service = "getSRUResponseWithThisQuery";
String sruRequest = sruSourceView.getUrl() + "?query=" + URLEncoder.encode(finalQuery,"UTF-8") + "&verb=" + service + "&startRecord=" + ((page*maxResults)+1) + "&maximumRecords=" + maxResults;
URL url = new URL(sruRequest);
Document dom = Dom4jUtil.parse(url);
 
Map<String,String> namespaces = new HashMap<String,String>();
namespaces.put("files","http://www.estgp.pt/sru/solrFilesManager");
namespaces.put("srw","http://www.loc.gov/zing/srw/");
 
XPath xPathNumberOfRecords = dom.createXPath("//srw:numberOfRecords");
xPathNumberOfRecords.setNamespaceURIs(namespaces);
Element numberOfRecords = (Element) xPathNumberOfRecords.selectSingleNode(dom);
if(numberOfRecords == null)
continue;
searchResultsSource.setTotalResults(Integer.parseInt(numberOfRecords.getTextTrim()));
 
XPath xPathRecords = dom.createXPath("//files:doc");
xPathRecords.setNamespaceURIs(namespaces);
List<Element> docs = xPathRecords.selectNodes(dom);
for(Element doc: docs)
{
XPath xPathFileRelativePath = dom.createXPath("./files:fileRelativePath");
xPathFileRelativePath.setNamespaceURIs(namespaces);
Object fileRelativePath = xPathFileRelativePath.selectSingleNode(doc);
 
XPath xPathFileName = dom.createXPath("./files:fileName");
xPathFileName.setNamespaceURIs(namespaces);
Element fileName = (Element) xPathFileName.selectSingleNode(doc);
 
XPath xPathFileSize = dom.createXPath("./files:fileSizeKB");
xPathFileSize.setNamespaceURIs(namespaces);
Element fileSizeKB = (Element) xPathFileSize.selectSingleNode(doc);
 
XPath xPathFileType = dom.createXPath("./files:fileType");
xPathFileType.setNamespaceURIs(namespaces);
Element fileType = (Element) xPathFileType.selectSingleNode(doc);
 
XPath xPathFileDateLastModified = dom.createXPath("./files:fileDateLastModified");
xPathFileDateLastModified.setNamespaceURIs(namespaces);
Element fileDateLastModified = (Element) xPathFileDateLastModified.selectSingleNode(doc);
if(fileRelativePath != null )
{
XPath xPathFileUrl = dom.createXPath("./files:url");
xPathFileUrl.setNamespaceURIs(namespaces);
Object fileUrl = xPathFileUrl.selectSingleNode(doc);
if(fileUrl != null)
{
 
DefaultResult defaultResult = new DefaultResult();
String relativePathStr = ((Element)fileRelativePath).getText();
defaultResult.setTitle(fileName.getText());
defaultResult.setSizeKb(fileSizeKB.getTextTrim());
defaultResult.setDirectory(relativePathStr);
 
 
 
 
defaultResult.setDate(fileDateLastModified.getTextTrim());
defaultResult.setMime(fileType.getTextTrim());
// defaultResult.setSubTitle(courseUnit.getCourseName());
// defaultResult.setSubTitleKey(false);
// defaultResult.setText(courseUnit.getObjectives());
String urlStr = ((Element)fileUrl).getTextTrim();
String[] pathItems = relativePathStr.trim().split("\\\\");
StringBuilder pathBuidler = new StringBuilder();
for(String item: pathItems)
{
if(item.trim().length() > 0)
pathBuidler.append("/").append(URLEncoder.encode(item,"ISO-8859-1").replace("+","%20"));
}
urlStr = urlStr.substring(0,urlStr.length() - (relativePathStr.length())) + pathBuidler.toString();
 
 
defaultResult.setUrl(urlStr);
 
defaultResult.setAbsoluteUrl(true);
 
XPath xPathCollection = dom.createXPath("./files:collection");
xPathFileUrl.setNamespaceURIs(namespaces);
Element collection = (Element) xPathCollection.selectSingleNode(doc);
defaultResult.setSubTitle(formatSubtitle(relativePathStr,collection.getTextTrim()));
 
 
XPath xPathFragment = dom.createXPath("./files:snippet/files:fragment");
xPathFragment.setNamespaceURIs(namespaces);
List<Element> fragments = (List<Element>) xPathFragment.selectNodes(doc);
if(fragments != null)
{
defaultResult.setBestFragments("");
for(Element fragment: fragments)
{
defaultResult.setBestFragments(defaultResult.getBestFragments() + " ... " + fragment.getTextTrim().replace("<em>","<b><i>").replace("</em>","</i></b>"));
}
}
searchResultsSource.addResult(defaultResult);
}
else
logger.warn("File retured from SRU without filePath query:" + search + " page:" + page + " path:" + ((Element)fileRelativePath).getText() );
}
else
logger.warn("File retured from SRU without filePath query:" + search + " page:" + page);
}
 
/*Facets*/
List<IFacet> facets = new ArrayList<IFacet>();
XPath xPathFacets = dom.createXPath("//files:facet");
xPathFacets.setNamespaceURIs(namespaces);
List<Element> facetsElems = xPathFacets.selectNodes(dom);
for(Element facetElem: facetsElems)
{
DefaultFacet defaultFacet = new DefaultFacet();
defaultFacet.setLabels(new ArrayList<IFacetLabel>());
defaultFacet.setIndex(facetElem.attribute("name").getValue());
if(!defaultFacet.getIndex().equals("dir") && !defaultFacet.getIndex().equals("facetDir"))
{
XPath xPathFacetLabel = dom.createXPath("./files:facetLabel");
xPathFacetLabel.setNamespaceURIs(namespaces);
List<Element> facetLabelElems = xPathFacetLabel.selectNodes(facetElem);
 
for(Element facetLabelElem: facetLabelElems)
{
DefaultFacetLabel facetLabel = new DefaultFacetLabel();
facetLabel.setOccurrences(Integer.parseInt(facetLabelElem.attribute("ocurr").getValue()));
facetLabel.setLabel(facetLabelElem.getTextTrim());
if(facetLabel.getOccurrences() > 0)
defaultFacet.getLabels().add(facetLabel);
}
if(defaultFacet.getLabels().size()>0)
facets.add(defaultFacet);
}
}
if(facets.size() > 0)
searchResultsSource.setFacets(facets);
}
catch (Throwable e)
{
logger.error(e,e);
}
 
if(searchResultsSource.getResults() != null && searchResultsSource.getResults().size() > 0)
searchResults.add(searchResultsSource);
}
}
return searchResults;
}
 
 
 
 
static HashMap<String, Pattern> patterns = new HashMap<String,Pattern>();
private String formatSubtitle(String path, String collection)
{
path = path.trim();
if(path.startsWith("\\") || path.startsWith("/"))
path = path.substring(1);
List<String> regexProps = ConfigProperties.getListProperties("srusource.path.condition.pattern");
for(String regexProp: regexProps)
{
String id = regexProp.substring(regexProp.lastIndexOf("."));
String patternStr = ConfigProperties.getProperty(regexProp);
 
String template = ConfigProperties.getProperty("srusource.path.condition.template" + id);
Pattern pattern = patterns.get(patternStr);
if(pattern == null)
{
pattern = Pattern.compile(patternStr);
patterns.put(patternStr,pattern);
}
Matcher matcher = pattern.matcher(path);
if(matcher.find())
{
String[] paths = path.split("[\\\\]");
template = template.replace("@collection@", collection);
return java.text.MessageFormat.format(template,paths);
}
}
return "(" + collection + ")";
}
 
 
 
public int countToDo(UserSession userSession)
{
return 0;
}
 
public IToDoCat getToDo(UserSession userSession)
{
return null;
}
 
public List<IToDo> getAllToDos(UserSession userSession)
{
return null;
}/*This method is invoked from object creation*/
 
public void adviseNew(DomainObject object)
{
//To change body of implemented methods use File | Settings | File Templates.
}
 
public void adviseUpdate(DomainObject object)
{
//To change body of implemented methods use File | Settings | File Templates.
}
 
 
 
 
}
/impl/src/java/pt/estgp/estgweb/services/srusources/SruSourceService.java
New file
0,0 → 1,114
package pt.estgp.estgweb.services.srusources;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.services.data.RepositoryService;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.domain.views.CourseView;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.domain.views.SruSourceCollectionView;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
 
import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;
 
/*
* @author Goncalo Luiz gedl [AT] rnl [DOT] ist [DOT] utl [DOT] pt
*
*
* Created at 17/Out/2003 , 23:45:24
*
*/
/**
* @author Jorge Machado
*
*
* Created at 17/Out/2003 , 23:45:24
*
*/
public class SruSourceService implements IService
{
 
private static final Logger logger = Logger.getLogger(SruSourceService.class);
 
 
 
public SruSourceView submit(SruSourceView sruSourceView, UserSession userSession) throws ServiceException
{
if(sruSourceView.getId() <= 0)
{
logger.info("Creating new SRU Source with URL: " + sruSourceView.getUrl());
 
SruSource sruSource = DomainObjectFactory.createSruSourceImpl();
sruSourceView.persistViewInObject(sruSource);
sruSource.setCreator(userSession.getUser());
DaoFactory.getSruSourceDaoImpl().save(sruSource);
if(sruSourceView.getCollections() != null)
{
addNewCollections(sruSource,sruSourceView);
}
}
else
{
SruSource sruSource = DaoFactory.getSruSourceDaoImpl().load(sruSourceView.getId());
sruSourceView.persistViewInObject(sruSource);
if(sruSourceView.getCollections() != null)
{
if(sruSource.getCollections() == null || sruSource.getCollections().size() == 0)
{
addNewCollections(sruSource,sruSourceView);
}
else
{
List<SruSourceCollectionView> toAdd = new ArrayList<SruSourceCollectionView>(sruSourceView.getCollections());
List<SruSourceCollection> toRemove = new ArrayList<SruSourceCollection>();
for(SruSourceCollection collection: sruSource.getCollections())
{
boolean found = false;
for(SruSourceCollectionView collectionView: sruSourceView.getCollections())
{
if(collectionView.getId() == collection.getId() || collectionView.getCollection().equals(collection.getCollection()))
{
collectionView.persistViewInObject(collection);
toAdd.remove(collectionView);
found = true;
break;
}
}
if(!found)
{
toRemove.add(collection);
}
}
sruSource.getCollections().removeAll(toRemove);
DaoFactory.getSruSourceCollectionDaoImpl().delete(toRemove);
for(SruSourceCollectionView collectionView: toAdd)
{
addNewCollection(sruSource,collectionView);
}
}
}
}
return sruSourceView;
}
 
private void addNewCollections(SruSource sruSource, SruSourceView sruSourceView)
{
sruSource.setCollections(new HashSet<SruSourceCollection>());
for(SruSourceCollectionView collectionView: sruSourceView.getCollections())
{
addNewCollection(sruSource,collectionView);
}
}
 
private void addNewCollection(SruSource sruSource, SruSourceCollectionView collectionView)
{
SruSourceCollection collection = DomainObjectFactory.createSruSourceCollectionImpl();
collectionView.persistViewInObject(collection);
collection.setSruSource(sruSource);
sruSource.getCollections().add(collection);
DaoFactory.getSruSourceCollectionDaoImpl().save(collection);
}
}
/impl/src/java/pt/estgp/estgweb/services/srusources/DeleteSruSourceService.java
New file
0,0 → 1,26
package pt.estgp.estgweb.services.srusources;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.SruSource;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
 
import java.io.Serializable;
 
public class DeleteSruSourceService implements IService {
 
private static final Logger logger = Logger.getLogger(DeleteSruSourceService.class);
 
 
 
public Boolean run(Serializable id, UserSession userSession)
{
SruSource sruSource = DaoFactory.getSruSourceDaoImpl().load(id);
 
logger.warn("Deleting srusource view:" + sruSource.getId() + " url:" + sruSource.getUrl());
DaoFactory.getSruSourceDaoImpl().delete(sruSource);
return true;
}
}
/impl/src/java/pt/estgp/estgweb/services/srusources/LoadSruSourcesService.java
New file
0,0 → 1,34
package pt.estgp.estgweb.services.srusources;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.SruSource;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
 
import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
 
public class LoadSruSourcesService implements IService {
 
private static final Logger logger = Logger.getLogger(LoadSruSourcesService.class);
 
 
 
public List<SruSourceView> run(UserSession userSession)
{
List<SruSourceView> sruSourceViews = new ArrayList<SruSourceView>();
List<SruSource> sruSources = DaoFactory.getSruSourceDaoImpl().findAll();
if(sruSources == null || sruSources.size() == 0)
return sruSourceViews;
logger.debug("Loading all srusource views:");
for(SruSource sruSource: sruSources)
{
SruSourceView sruSourceView = new SruSourceView(sruSource,sruSource.getCollections());
sruSourceViews.add(sruSourceView);
}
return sruSourceViews;
}
}
/impl/src/java/pt/estgp/estgweb/domain/enums/CourseUnitContentsGrants.java
New file
0,0 → 1,30
package pt.estgp.estgweb.domain.enums;
 
/**
* @author Jorge Machado
* @date 11/Mai/2010
* @time 15:54:05
* @email machadofisher@gmail.com
*/
public enum CourseUnitContentsGrants {
 
PUBLIC,
PRIVATE,
INTERNAL;
 
private CourseUnitContentsGrants()
{
}
 
public static CourseUnitContentsGrants parse(String grants)
{
if(grants == null)
return INTERNAL;
for(CourseUnitContentsGrants c: values())
{
if(grants.equals(c.name()))
return c;
}
return INTERNAL;
}
}
/impl/src/java/pt/estgp/estgweb/domain/CourseUnitImpl.java
1,5 → 1,7
package pt.estgp.estgweb.domain;
 
import pt.estgp.estgweb.domain.enums.CourseUnitContentsGrants;
 
import java.io.Serializable;
import java.util.List;
 
12,11 → 14,26
*/
public class CourseUnitImpl extends CourseUnit implements ICanManage
{
 
CourseUnitContentsGrants courseUnitContentsGrants = null;
 
public Serializable getSerializable()
{
return getId();
}
 
 
public CourseUnitContentsGrants getCourseUnitContentsGrants() {
if(courseUnitContentsGrants == null)
courseUnitContentsGrants = CourseUnitContentsGrants.parse(super.getContentsGrants());
return courseUnitContentsGrants;
}
 
public void setCourseUnitContentsGrants(CourseUnitContentsGrants courseUnitContentsGrants) {
super.setContentsGrants(courseUnitContentsGrants.name());
this.courseUnitContentsGrants = courseUnitContentsGrants;
}
 
public boolean isValid()
{
return true; //To change body of implemented methods use File | Settings | File Templates.
84,4 → 101,7
return false;
 
}
 
 
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/SruSourceDaoImpl.java
New file
0,0 → 1,35
package pt.estgp.estgweb.domain.dao.impl;
 
import pt.estgp.estgweb.services.common.SearchTypeEnum;
import pt.estgp.estgweb.domain.dao.DaoUtils;
import pt.estgp.estgweb.domain.SruSource;
import pt.estgp.estgweb.domain.User;
import pt.estgp.estgweb.domain.GenericUser;
import pt.estgp.estgweb.domain.SruSourceCollection;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.utils.DatesUtils;
import pt.estgp.estgweb.utils.StringsUtils;
import pt.estgp.estgweb.utils.RoleManager;
import org.hibernate.criterion.Criterion;
import static org.hibernate.criterion.Restrictions.eq;
import org.hibernate.Criteria;
 
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Jorge Machado
* @date 13/Nov/2009
* @time 12:22:38
* @email machadofisher@gmail.com
*/
public class SruSourceDaoImpl extends SruSourceDao
{
public static SruSourceDaoImpl getInstance()
{
if (myInstance == null)
myInstance = new SruSourceDaoImpl();
return (SruSourceDaoImpl) myInstance;
}
 
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/BlogDaoImpl.java
120,16 → 120,18
 
public int countBlogs(String query, SearchTypeEnum searchType, List<String> roles, Object o, boolean internal)
{
Criterion c = DaoUtils.createSearchQuery(query,searchType,"description","title");
Criterion c = DaoUtils.createSearchQuery(query,searchType,"description","title","o.name");
Criteria criteria = createRestrictionsCriteria(roles, internal);
criteria.createAlias("owner","o");
criteria.add(c);
return criteria.list().size();
}
 
public List<Blog> searchBlogs(String query, SearchTypeEnum searchTypeEnum, int maxBlogs, int page, List<String> roles, boolean internal)
{
Criterion c = DaoUtils.createSearchQuery(query, searchTypeEnum, "description", "title");
Criterion c = DaoUtils.createSearchQuery(query, searchTypeEnum, "description", "title","o.name");
Criteria criteria = createRestrictionsCriteria(roles, internal);
criteria.createAlias("owner","o");
criteria.add(c)
.setMaxResults(maxBlogs)
.setFirstResult(page * maxBlogs);
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/BlogPostDaoImpl.java
125,16 → 125,18
 
public int countBlogPosts(String query, SearchTypeEnum searchType, List<String> roles, Object o, boolean internal)
{
Criterion c = DaoUtils.createSearchQuery(query,searchType,"text","title");
Criterion c = DaoUtils.createSearchQuery(query,searchType,"text","title","o.name");
Criteria criteria = createRestrictionsCriteria(roles, internal);
criteria.createAlias("owner","o");
criteria.add(c);
return criteria.list().size();
}
 
public List<BlogPost> searchBlogPosts(String query, SearchTypeEnum searchTypeEnum, int maxBlogs, int page, List<String> roles, boolean internal)
{
Criterion c = DaoUtils.createSearchQuery(query, searchTypeEnum, "text", "title");
Criterion c = DaoUtils.createSearchQuery(query, searchTypeEnum, "text", "title","o.name");
Criteria criteria = createRestrictionsCriteria(roles, internal);
criteria.createAlias("owner","o");
criteria.add(c)
.setMaxResults(maxBlogs)
.setFirstResult(page * maxBlogs);
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseUnitDaoImpl.java
176,7 → 176,17
.add(eq("importYear", year))
.uniqueResult();
}
public List<CourseUnit> loadBySigesCodes(String sigesCode, String courseCode)
{
return (List<CourseUnit>) createCriteria()
.add(eq("code", sigesCode))
.add(eq("courseCode", courseCode))
.addOrder(Order.desc("importYear"))
.list();
}
 
 
 
public List<CourseUnit> loadCourseUnits(long courseId, String semestre, String year, boolean withTeacher, boolean withNoTeacher)
{
Criteria c = createCriteria();
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/SruSourceCollectionDaoImpl.java
New file
0,0 → 1,27
package pt.estgp.estgweb.domain.dao.impl;
 
import pt.estgp.estgweb.domain.SruSource;
import pt.estgp.estgweb.domain.GenericUser;
import pt.estgp.estgweb.utils.RoleManager;
 
import java.util.List;
import java.util.ArrayList;
 
import org.hibernate.Criteria;
 
/**
* @author Jorge Machado
* @date 13/Nov/2009
* @time 12:22:38
* @email machadofisher@gmail.com
*/
public class SruSourceCollectionDaoImpl extends SruSourceCollectionDao
{
public static SruSourceCollectionDaoImpl getInstance()
{
if (myInstance == null)
myInstance = new SruSourceCollectionDaoImpl();
return (SruSourceCollectionDaoImpl) myInstance;
}
 
}
/impl/src/java/pt/estgp/estgweb/domain/dao/DaoUtils.java
12,7 → 12,7
* @see pt.estgp.estgweb.domain.dao
*/
public class DaoUtils
{
{
public static Criterion createSearchQuery(String query, SearchTypeEnum searchTypeEnum, String field1, String field2)
{
44,6 → 44,36
return c;
}
 
public static Criterion createSearchQuery(String query, SearchTypeEnum searchTypeEnum, String field1, String field2,String field3)
{
Criterion c = null;
if (searchTypeEnum == SearchTypeEnum.ExactPhrase)
c = or(or(like(field1, "%" + query + "%"), like(field2, "%" + query + "%")),like(field3, "%" + query + "%"));
else if (searchTypeEnum == SearchTypeEnum.AllWords)
{
String[] fields = query.trim().split(" ");
for (String field : fields)
{
if (c == null)
c = or(or(like(field1, "%" + field + "%"), like(field2, "%" + field + "%")),like(field3, "%" + field + "%"));
else
c = and(c, or(or(like(field1, "%" + field + "%"), like(field2, "%" + field + "%")),like(field3, "%" + field + "%")));
}
}
else
{
String[] fields = query.trim().split(" ");
for (String field : fields)
{
if (c == null)
c = or(or(like(field1, "%" + field + "%"), like(field2, "%" + field + "%")),like(field3, "%" + field + "%"));
else
c = or(c, or(or(like(field1, "%" + field + "%"), like(field2, "%" + field + "%")), like(field3, "%" + field + "%")));
}
}
return c;
}
 
public static Criterion createSearchQuery(String query, SearchTypeEnum searchTypeEnum, String field1)
{
Criterion c = null;
/impl/src/java/pt/estgp/estgweb/domain/dao/DaoFactory.java
187,4 → 187,14
{
return RepositoryFileVersionDaoImpl.getInstance();
}
 
public static SruSourceDaoImpl getSruSourceDaoImpl()
{
return SruSourceDaoImpl.getInstance();
}
 
public static SruSourceCollectionDaoImpl getSruSourceCollectionDaoImpl()
{
return SruSourceCollectionDaoImpl.getInstance();
}
}
/impl/src/java/pt/estgp/estgweb/domain/SruSourceCollectionImpl.java
New file
0,0 → 1,17
package pt.estgp.estgweb.domain;
 
import java.io.Serializable;
 
/**
* @author Jorge Machado
* @date 13/Nov/2009
* @time 12:20:53
* @email machadofisher@gmail.com
*/
public class SruSourceCollectionImpl extends SruSourceCollection
{
public Serializable getSerializable()
{
return getId();
}
}
/impl/src/java/pt/estgp/estgweb/domain/SruSourceImpl.java
New file
0,0 → 1,17
package pt.estgp.estgweb.domain;
 
import java.io.Serializable;
 
/**
* @author Jorge Machado
* @date 13/Nov/2009
* @time 12:20:53
* @email machadofisher@gmail.com
*/
public class SruSourceImpl extends SruSource
{
public Serializable getSerializable()
{
return getId();
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/SruSourceCollectionView.java
New file
0,0 → 1,124
package pt.estgp.estgweb.domain.views;
 
import pt.estgp.estgweb.domain.SruSourceCollection;
import pt.estgp.estgweb.utils.RoleManager;
 
import java.io.Serializable;
import java.util.*;
 
/**
* @author Jorge Machado
* @date 2/Mar/2008
* @time 19:34:49
* @see pt.estgp.estgweb.domain.views
*/
public class SruSourceCollectionView extends DomainObjectView
{
// private static final Logger logger = Logger.getLogger(SruSourceCollectionView.class);
 
 
private long id;
private Date updateDate;
private Date saveDate;
private String collection;
private String admitedRoles;
private SruSourceView sruSourceView;
 
 
public Class getReferenceClass()
{
return SruSourceCollection.class;
}
 
public Serializable getSerializable()
{
return id;
}
 
public SruSourceCollectionView() {
}
 
public SruSourceCollectionView(SruSourceCollection sruSourceCollection, SruSourceView sruSourceView)
{
super(sruSourceCollection);
init(sruSourceCollection,sruSourceView);
}
 
 
private void init(SruSourceCollection sruSourceCollection,SruSourceView sruSourceView)
{
this.id = sruSourceCollection.getId();
this.collection = sruSourceCollection.getCollection();
this.saveDate = sruSourceCollection.getSaveDate();
this.updateDate = sruSourceCollection.getUpdateDate();
this.admitedRoles = sruSourceCollection.getAdmitedRoles();
this.sruSourceView = sruSourceView;
}
 
public void persistViewInObject(SruSourceCollection c)
{
c.setAdmitedRoles(admitedRoles);
c.setCollection(collection);
}
 
 
public long getId()
{
return id;
}
 
public void setId(long id)
{
this.id = id;
}
 
 
public Date getUpdateDate() {
return updateDate;
}
 
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
 
public Date getSaveDate() {
return saveDate;
}
 
public void setSaveDate(Date saveDate) {
this.saveDate = saveDate;
}
 
public String getCollection() {
return collection;
}
 
public void setCollection(String collection) {
this.collection = collection;
}
 
public String getAdmitedRoles() {
return admitedRoles;
}
 
public void setAdmitedRoles(String admitedRoles) {
this.admitedRoles = admitedRoles;
}
 
public SruSourceView getSruSourceView() {
return sruSourceView;
}
 
public void setSruSourceView(SruSourceView sruSourceView) {
this.sruSourceView = sruSourceView;
}
 
 
public List<String> getAdmitedRolesSet()
{
if(admitedRoles != null && admitedRoles.trim().length() > 0)
return RoleManager.getRolesFromSerial(admitedRoles);
else
return new ArrayList<String>();
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/UserView.java
264,8 → 264,13
public void persistViewInObjectUser(User user)
{
user.setName(name);
user.setAddress(address);
user.setZip(zip);
user.setCountry(country);
user.setEmail(email);
user.setPhonenumber(phonenumber);
user.setOutEmail(outEmail);
 
user.setPop3server(pop3server);
user.setPop3username(pop3username);
if(pop3password != null && pop3password.length()> 0)
273,9 → 278,12
user.setSkype(skype);
user.setGmail(gmail);
user.setMsn(msn);
user.setPhonenumber(phonenumber);
user.setAddress(address);
user.setZip(zip);
user.setOffice(office);
user.setExt(ext);
 
 
 
user.setScholarDegree(scholarDegree);
if(user.getPassword() != null && user.getPassword().length() > 0 && password != null && password.length() > 0)
{
user.setPassword(BytesUtils.getDigestMD5Hex(password));
/impl/src/java/pt/estgp/estgweb/domain/views/utils/CourseUnitDeliverableComparator.java
New file
0,0 → 1,49
package pt.estgp.estgweb.domain.views.utils;
 
import pt.estgp.estgweb.domain.RepositoryFileVersion;
import pt.estgp.estgweb.domain.views.CourseUnitDeliverableView;
 
import java.util.Comparator;
 
/**
* @author Jorge Machado
* @date 15/Dez/2009
* @time 18:15:22
* @email machadofisher@gmail.com
*/
public class CourseUnitDeliverableComparator implements Comparator<CourseUnitDeliverableView> {
 
 
public static CourseUnitDeliverableComparator FIRST_VERSION_DESC = new CourseUnitDeliverableComparator(true,true);
public static CourseUnitDeliverableComparator FIRST_VERSION_ASC = new CourseUnitDeliverableComparator(false,true);
public static CourseUnitDeliverableComparator LAST_VERSION_DESC = new CourseUnitDeliverableComparator(true,false);
public static CourseUnitDeliverableComparator LAST_VERSION_ASC = new CourseUnitDeliverableComparator(false,false);
 
int sort;
boolean first;
 
private CourseUnitDeliverableComparator(boolean desc, boolean first)
{
if(desc)
sort = 1;
else
sort = -1;
this.first = first;
}
 
public int compare(CourseUnitDeliverableView o1, CourseUnitDeliverableView o2)
{
if(!first)
{
if(o1.getDeliverDate().getTime() < o2.getDeliverDate().getTime()) return 1 * sort;
else if(o1.getDeliverDate().getTime() < o2.getDeliverDate().getTime()) return -1 * sort;
else return 0;
}
else
{
if(o1.getVersions().get(0).getSaveDate().getTime() < o2.getVersions().get(0).getSaveDate().getTime()) return 1 * sort;
else if(o1.getVersions().get(0).getSaveDate().getTime() < o2.getVersions().get(0).getSaveDate().getTime()) return -1 * sort;
else return 0;
}
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/utils/RepositoryFileVersionComparator.java
New file
0,0 → 1,35
package pt.estgp.estgweb.domain.views.utils;
 
import pt.estgp.estgweb.domain.RepositoryFileVersion;
 
import java.util.Comparator;
 
/**
* @author Jorge Machado
* @date 15/Dez/2009
* @time 18:15:22
* @email machadofisher@gmail.com
*/
public class RepositoryFileVersionComparator implements Comparator<RepositoryFileVersion> {
 
 
public static RepositoryFileVersionComparator DESC = new RepositoryFileVersionComparator(true);
public static RepositoryFileVersionComparator ASC = new RepositoryFileVersionComparator(false);
 
int sort;
 
private RepositoryFileVersionComparator(boolean desc)
{
if(desc)
sort = 1;
else
sort = -1;
}
 
public int compare(RepositoryFileVersion o1, RepositoryFileVersion o2)
{
if(o1.getSaveDate().getTime() < o2.getSaveDate().getTime()) return 1 * sort;
else if(o1.getSaveDate().getTime() < o2.getSaveDate().getTime()) return -1 * sort;
else return 0;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/BlogPostView.java
29,6 → 29,7
private String text;
private Image image;
private GenericUser owner;
private long ownerId;
private String ownerUsername;
private String ownerName;
private String ownerEmail;
52,6 → 53,7
this.id = blogPost.getId();
this.owner = blogPost.getOwner();
ownerUsername = owner.getUsername();
ownerId = owner.getId();
ownerName = owner.getName();
ownerEmail = owner.getEmail();
this.blogId = blogPost.getBlog().getId();
203,6 → 205,11
return ownerUsername;
}
 
public long getOwnerId()
{
return ownerId;
}
 
public String getOwnerName()
{
return ownerName;
/impl/src/java/pt/estgp/estgweb/domain/views/AnnouncementView.java
371,6 → 371,16
return StringsUtils.getFormatedText(text);
}
 
public String getFormatedTextSummary(int maxLines, int maxLineSize)
{
return StringsUtils.getFormatedText(getText(),maxLines, maxLineSize);
}
 
public Boolean getFormatedTextBiggerThenPermited(int maxLines, int maxLineSize)
{
return StringsUtils.getFormatedText(getText()).length() > StringsUtils.getFormatedText(getText(),maxLines, maxLineSize).length();
}
 
public Boolean getTextBiggerThenPermited()
{
if(getInternalUrlPath() != null && getInternalUrlPath().trim().length()>0)
/impl/src/java/pt/estgp/estgweb/domain/views/SruSourceView.java
New file
0,0 → 1,166
package pt.estgp.estgweb.domain.views;
 
import pt.estgp.estgweb.domain.Course;
import pt.estgp.estgweb.domain.SruSource;
import pt.estgp.estgweb.domain.SruSourceCollection;
 
import java.io.Serializable;
import java.util.*;
 
/**
* @author Jorge Machado
* @date 2/Mar/2008
* @time 19:34:49
* @see pt.estgp.estgweb.domain.views
*/
public class SruSourceView extends DomainObjectView
{
// private static final Logger logger = Logger.getLogger(SruSourceView.class);
 
private long id;
private Date updateDate;
private Date saveDate;
private String name;
private String collectionField;
private String description;
private String url;
private String metadataSchema;
private UserView creator;
private List<SruSourceCollectionView> collections = new ArrayList<SruSourceCollectionView>();
 
 
public Class getReferenceClass()
{
return SruSource.class;
}
 
public Serializable getSerializable()
{
return id;
}
 
public SruSourceView()
{
}
 
public SruSourceView(SruSource sruSource, Collection<SruSourceCollection> collections)
{
super(sruSource);
init(sruSource,collections);
 
}
private void init(SruSource sruSource, Collection<SruSourceCollection> collections)
{
 
this.id = sruSource.getId();
this.saveDate = sruSource.getSaveDate();
this.updateDate = sruSource.getUpdateDate();
this.name = sruSource.getName();
this.collectionField = sruSource.getCollectionField();
this.description = sruSource.getDescription();
this.metadataSchema = sruSource.getMetadataSchema();
this.creator = new UserView(sruSource.getCreator());
this.collections = new ArrayList<SruSourceCollectionView>();
this.url = sruSource.getUrl();
 
for(SruSourceCollection collection: collections)
{
SruSourceCollectionView sruSourceCollectionView = new SruSourceCollectionView(collection,this);
this.collections.add(sruSourceCollectionView);
}
}
 
public void persistViewInObject(SruSource s)
{
s.setDescription(description);
s.setMetadataSchema(metadataSchema);
s.setCollectionField(collectionField);
s.setName(name);
s.setUrl(url);
}
 
 
public long getId()
{
return id;
}
 
public void setId(long id)
{
this.id = id;
}
 
 
public Date getUpdateDate() {
return updateDate;
}
 
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
 
public Date getSaveDate() {
return saveDate;
}
 
public void setSaveDate(Date saveDate) {
this.saveDate = saveDate;
}
 
public String getName() {
return name;
}
 
public void setName(String name) {
this.name = name;
}
 
public String getCollectionField() {
return collectionField;
}
 
public void setCollectionField(String collectionField) {
this.collectionField = collectionField;
}
 
public String getDescription() {
return description;
}
 
public void setDescription(String description) {
this.description = description;
}
 
public String getUrl() {
return url;
}
 
public void setUrl(String url) {
this.url = url;
}
 
public String getMetadataSchema() {
return metadataSchema;
}
 
public void setMetadataSchema(String metadataSchema) {
this.metadataSchema = metadataSchema;
}
 
public UserView getCreator() {
return creator;
}
 
public void setCreator(UserView creator) {
this.creator = creator;
}
 
public List<SruSourceCollectionView> getCollections() {
return collections;
}
 
public void setCollections(List<SruSourceCollectionView> collections) {
this.collections = collections;
}
}
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitDeliverableView.java
1,13 → 1,15
package pt.estgp.estgweb.domain.views;
 
import pt.estgp.estgweb.domain.CourseUnitAssignement;
import pt.estgp.estgweb.domain.CourseUnitAssignementImpl;
import pt.estgp.estgweb.domain.CourseUnitDeliverableImpl;
import pt.estgp.estgweb.domain.CourseUnitDeliverable;
import pt.estgp.estgweb.domain.*;
import pt.estgp.estgweb.domain.views.utils.RepositoryFileVersionComparator;
import pt.estgp.estgweb.web.utils.DatesUtils;
import pt.estgp.estgweb.services.data.RepositoryService;
import pt.estgp.estgweb.services.data.IRepositoryFile;
 
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Collections;
 
/**
* @author Jorge Machado
22,9 → 24,13
private String fileStreamId;
private Date deliverDate;
private String deliverDateStr;
private String deliverDateMinutesSecondsStr;
private String deliverDateStrFirstVersion;
private String deliverDateMinutesSecondsStrFirstVersion;
private UserView student;
private String grade;
private String obs;
private List<RepositoryFileVersion> versions;
 
private CourseUnitDeliverable courseUnitDeliverable;
private CourseUnitAssignementView courseUnitAssignementView;
55,6 → 61,7
this.fileStreamId = courseUnitDeliverable.getDeliverableRepositoryStream();
this.deliverDate = courseUnitDeliverable.getDeliverDate();
this.deliverDateStr = DatesUtils.getStringFromDate(deliverDate);
this.deliverDateMinutesSecondsStr = DatesUtils.getStringFromDateWithMinutesAndSeconds(getDeliverDate());
//if is null will create a userview even if deleted
this.student = new UserView(courseUnitDeliverable.getStudent());
if(this.student.isDeleted() && courseUnitDeliverable.getStudentId() > 0)
106,6 → 113,40
}
 
 
public String getDeliverDateMinutesSecondsStrFirstVersion() {
return deliverDateMinutesSecondsStrFirstVersion;
}
 
public List<RepositoryFileVersion> getVersions() {
return versions;
}
 
public int getVersionsSize() {
if(versions == null)
return 0;
return versions.size();
}
 
public void setVersions(List<RepositoryFileVersion> versions)
{
this.versions = versions;
if(versions != null)
{
Collections.sort(versions, RepositoryFileVersionComparator.DESC);
deliverDateStrFirstVersion = DatesUtils.getStringFromDate(versions.get(0).getSaveDate());
deliverDateMinutesSecondsStrFirstVersion = DatesUtils.getStringFromDateWithMinutesAndSeconds(versions.get(0).getSaveDate());
}
}
 
 
public String getDeliverDateMinutesSecondsStr() {
return deliverDateMinutesSecondsStr;
}
 
public String getDeliverDateStrFirstVersion() {
return deliverDateStrFirstVersion;
}
 
public String getObs()
{
return obs;
157,6 → 198,11
this.deliverDateStr = deliverDateStr;
}
 
public String getDeliverDateStrMinutesSeconds()
{
return deliverDateMinutesSecondsStr;
}
 
private static final long milisecondsof24Hours=24*60*60*1000;
 
public boolean isLateDeliver()
/impl/src/java/pt/estgp/estgweb/domain/views/CourseUnitView.java
9,6 → 9,8
import java.io.Serializable;
import java.util.*;
 
import jomm.utils.StringsUtils;
 
/**
* @author Jorge Machado
* @date 2/Mar/2008
30,6 → 32,7
private String courseName;
private String semestre;
private String importYear;
private String contentsGrants;
private BlogView blog;
private String pathIntranet;
private String normalizedName;
110,6 → 113,7
this.semestre = courseUnit.getSemestre();
this.courseCode = courseUnit.getCourseCode();
this.objectives = courseUnit.getObjectives();
this.contentsGrants = courseUnit.getContentsGrants();
if(courseUnit.getProgramStreamId() != null)
{
programStreamId = courseUnit.getProgramStreamId();
232,6 → 236,14
return courseUnitAssignements;
}
 
public String getContentsGrants() {
return contentsGrants;
}
 
public void setContentsGrants(String contentsGrants) {
this.contentsGrants = contentsGrants;
}
 
public void setId(long id)
{
this.id = id;
260,6 → 272,7
public void persistViewInObject(CourseUnit c)
{
c.setObjectives(objectives);
c.setContentsGrants(contentsGrants);
}
 
public void persistViewAdminInObject(CourseUnit c)
279,6 → 292,11
return objectives;
}
 
public String getFormatedObjectives()
{
return StringsUtils.getFormatedText(objectives);
}
 
public void setObjectives(String objectives)
{
this.objectives = objectives;
/impl/src/java/pt/estgp/estgweb/domain/DomainObjectFactory.java
200,4 → 200,12
{
return new RepositoryFileVersionImpl();
}
 
public static SruSourceImpl createSruSourceImpl() {
return new SruSourceImpl();
}
 
public static SruSourceCollectionImpl createSruSourceCollectionImpl() {
return new SruSourceCollectionImpl();
}
}
/impl/src/java/pt/estgp/estgweb/filters/filters/CanAddAnnouncementInCourseUnit.java
9,6 → 9,7
import pt.estgp.estgweb.domain.UserImpl;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.utils.ReflectionBean;
import pt.estgp.estgweb.utils.RoleManager;
import pt.utl.ist.berserk.ServiceRequest;
import pt.utl.ist.berserk.ServiceResponse;
import pt.utl.ist.berserk.logic.filterManager.FilterParameters;
42,7 → 43,7
{
CourseUnit courseUnit = (CourseUnit) LoadObjectFromParameters.loadObjectFromClassName(CourseUnit.class.getName(),filterParameters,request.getServiceParameters());
 
if(!((UserImpl)userSession.getUser()).isTeacherOfCourseUnit(courseUnit.getId(),true))
if(!((UserImpl)userSession.getUser()).isTeacherOfCourseUnit(courseUnit.getId(),true) || !userSession.getUser().hasRole("services"))
{
logger.warn(userSession.getUser().getUsername() + ": try access restricted area");
throw new AccessDeniedOperationException("fail.owner");
/impl/src/java/pt/estgp/estgweb/web/utils/DatesUtils.java
19,6 → 19,7
 
private static final Logger logger = Logger.getLogger(DatesUtils.class);
 
private static SimpleDateFormat minutesSecondsDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
private static SimpleDateFormat filenameDateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
private static SimpleDateFormat userViewDateFormat = new SimpleDateFormat("yyyy/MM/dd");
 
29,6 → 30,13
return userViewDateFormat.format(d);
}
 
public static String getStringFromDateWithMinutesAndSeconds(Date d)
{
if(d == null)
return "";
return minutesSecondsDateFormat.format(d);
}
 
public static String getStringFromDateForFilename(Date d)
{
if(d == null)
/impl/src/java/pt/estgp/estgweb/web/FtpServer.java
143,7 → 143,7
int port = url.getPort();
if (port <= 0)
port = 21;
logger.info("Connecting to " + host + "in port:" + port);
logger.info("Connecting to " + host + " in port:" + port);
FtpServer ftpServer = new FtpServer(host, port, user, pass);
servers.put(urlStr, ftpServer);
return ftpServer;
/impl/src/java/pt/estgp/estgweb/web/LayoutController.java
47,6 → 47,7
String server = ConfigProperties.getProperty("server." + serverParameter);
 
 
 
if (serverParameter == null || server == null || server.length() == 0 || path == null || layout == null)
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
 
63,6 → 64,8
path = startPath + path;
request.setAttribute("path", path);
request.setAttribute("server", server);
request.setAttribute("serverConfName", serverParameter);
request.setAttribute("requestedStartPath", startPath);
 
String proxyHost = ConfigProperties.getProperty(serverParameter + ".proxy.host");
String proxyPort = ConfigProperties.getProperty(serverParameter + ".proxy.port");
/impl/src/java/pt/estgp/estgweb/web/form/blogs/BlogForm.java
100,9 → 100,9
addMessageWithKeys(errors, httpServletRequest, "errors.required", "blog.description");
if(blogView.getName()!=null)
blogView.setName(blogView.getName().trim());
if(blogView.getName() == null || !StringsUtils.checkLetters09AZazHiffenUnderScore(blogView.getName()))
if(blogView.getName() != null && blogView.getName().trim().length() > 0 && !StringsUtils.checkLetters09AZazHiffenUnderScore(blogView.getName()))
addMessage(errors, httpServletRequest, "blog.bad.name");
else
else if(blogView.getName() != null && blogView.getName().trim().length() > 0)
{
IServiceManager sm;
try
120,7 → 120,8
addMessage(errors, httpServletRequest, "error.500");
}
 
}
}else if(blogView.getName() != null && blogView.getName().trim().length() == 0)
blogView.setName(null);
return errors;
}
 
/impl/src/java/pt/estgp/estgweb/web/form/srusource/SruSourceForm.java
New file
0,0 → 1,109
package pt.estgp.estgweb.web.form.srusource;
 
import pt.estgp.estgweb.web.form.AddRolesForm;
import pt.estgp.estgweb.web.utils.DatesUtils;
import pt.estgp.estgweb.domain.views.RecordView;
import pt.estgp.estgweb.domain.views.UserView;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.domain.views.SruSourceCollectionView;
import org.apache.struts.upload.FormFile;
import org.apache.struts.action.ActionErrors;
 
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.ArrayList;
 
/**
* @author Fabio
* @date 30/Abr/2008
* @time 17:18:57
* @see pt.estgp.estgweb.web.form.profile
*/
public class SruSourceForm extends AddRolesForm {
 
private SruSourceView sruSourceView = new SruSourceView();
private SruSourceCollectionView sruSourceCollectionView = new SruSourceCollectionView();
private long auxId;
 
 
public SruSourceForm()
{
sruSourceView = new SruSourceView();
}
 
public SruSourceForm(SruSourceView sruSourceView)
{
this.sruSourceView = sruSourceView;
}
 
 
public void reset(org.apache.struts.action.ActionMapping actionMapping, HttpServletRequest request)
{
 
if(request.getParameter("collectionSize") != null)
{
int size = Integer.parseInt(request.getParameter("collectionSize"));
sruSourceView.setCollections(new ArrayList<SruSourceCollectionView>());
for(int i = 0;i < size;i++)
sruSourceView.getCollections().add(new SruSourceCollectionView());
}
}
 
 
public SruSourceView getSruSourceView() {
return sruSourceView;
}
 
public void setSruSourceView(SruSourceView sruSourceView) {
this.sruSourceView = sruSourceView;
}
 
public long getAuxId() {
return auxId;
}
 
public void setAuxId(long auxId) {
this.auxId = auxId;
}
 
public SruSourceCollectionView getSruSourceCollectionView() {
return sruSourceCollectionView;
}
 
public void setSruSourceCollectionView(SruSourceCollectionView sruSourceCollectionView) {
this.sruSourceCollectionView = sruSourceCollectionView;
}
 
public ActionErrors validate(org.apache.struts.action.ActionMapping actionMapping, javax.servlet.http.HttpServletRequest httpServletRequest)
{
ActionErrors errors = new ActionErrors();
if(sruSourceView.getName() == null || sruSourceView.getName().length() == 0)
{
addMessageWithKeys(errors, httpServletRequest, "errors.required","name");
}
if(sruSourceView.getUrl() == null || sruSourceView.getUrl().length() == 0)
{
addMessageWithKeys(errors, httpServletRequest, "errors.required","url");
}
if(sruSourceView.getCollectionField() == null || sruSourceView.getCollectionField().length() == 0)
{
addMessageWithKeys(errors, httpServletRequest, "errors.required","srusource.collectionField");
}
return errors;
}
 
public ActionErrors validateCollection(org.apache.struts.action.ActionMapping actionMapping, javax.servlet.http.HttpServletRequest httpServletRequest)
{
ActionErrors errors = new ActionErrors();
if(sruSourceCollectionView.getCollection() == null || sruSourceCollectionView.getCollection().length() == 0)
{
addMessageWithKeys(errors, httpServletRequest, "errors.required","srusource.collection");
}
if(sruSourceCollectionView.getAdmitedRoles() == null)
{
sruSourceCollectionView.setAdmitedRoles("");
}
 
return errors;
}
}
/impl/src/java/pt/estgp/estgweb/web/UserSessionProxy.java
70,5 → 70,10
return (UserSession) request.getAttribute(Globals.USER_SESSION_KEY);
}
 
public static boolean isAuthenticated(HttpServletRequest request)
{
return request.getAttribute(Globals.USER_SESSION_KEY) != null && ((UserSession)request.getAttribute(Globals.USER_SESSION_KEY)).getUser() != null;
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/FtpManager.java
8,6 → 8,7
import pt.estgp.estgweb.services.ftpservices.FtpRequestForm;
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.estgp.estgweb.domain.views.CourseUnitView;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
 
69,6 → 70,7
String startPath = (String) request.getAttribute(DirWebProxy.FTP_ACTUAL_PATH_KEY);
if (startPath == null)
startPath = (String) request.getAttribute(LayoutController.FTP_ACTUAL_PATH_KEY);
String serverConfName = (String) request.getAttribute("serverConfName");
String savePassword = (String) request.getAttribute("savePassword");
String newFolder = (String) request.getAttribute("newFolder");
String deleteFile = (String) request.getAttribute("deleteFile");
83,6 → 85,10
{
 
FtpRequestForm ftpRequestForm = new FtpRequestForm();
CourseUnitView courseUnitView = (CourseUnitView) request.getAttribute("CourseUnitView");
if(courseUnitView != null)
ftpRequestForm.setCourseUnitView(courseUnitView);
ftpRequestForm.setServerConfName(serverConfName);
ftpRequestForm.setUsername(username);
ftpRequestForm.setPassword(password);
if (savePassword != null && savePassword.trim().length() > 0)
104,7 → 110,6
messageBack.addError(request, result);
else
messageBack.addMessage(request, result);
 
}
catch (Exception e)
{
/impl/src/java/pt/estgp/estgweb/web/controllers/srusource/SruSourceController.java
New file
0,0 → 1,246
package pt.estgp.estgweb.web.controllers.srusource;
 
import pt.estgp.estgweb.web.controllers.AddRolesController;
import pt.estgp.estgweb.web.controllers.profile.ProfileController;
import pt.estgp.estgweb.web.form.AddRolesForm;
import pt.estgp.estgweb.web.form.srusource.SruSourceForm;
import pt.estgp.estgweb.web.form.profile.ProfileForm;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.exceptions.NoCookiesException;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.estgp.estgweb.domain.views.UserView;
import pt.estgp.estgweb.domain.views.RecordView;
import pt.estgp.estgweb.domain.views.SruSourceView;
import pt.estgp.estgweb.domain.views.SruSourceCollectionView;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.domain.DomainObjectFactory;
import pt.estgp.estgweb.domain.User;
import pt.estgp.estgweb.domain.SruSource;
import pt.estgp.estgweb.services.expceptions.AlreadyExistsException;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.utils.RoleManager;
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.InvalidFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.InvalidFilterExpressionException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.IncompatibleFilterException;
import pt.utl.ist.berserk.logic.filterManager.exceptions.FilterRetrieveException;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionErrors;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.util.List;
import java.util.ArrayList;
import java.util.HashSet;
import java.io.Serializable;
 
/**
* @author Jorge Machado
* @date 26/Fev/2008
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class SruSourceController extends AddRolesController {
 
private static final Logger logger = Logger.getLogger(SruSourceController.class);
private static final String TARGET_ROLES_KEY = AddRolesForm.TARGET_ROLES_KEY;
 
 
public ActionForward editSruSource(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException {
SruSourceForm sruSourceForm = (SruSourceForm) form;
ActionErrors errors = sruSourceForm.validate(mapping, request);
if (!errors.isEmpty())
{
// if(sruSourceForm.getSruSourceView().getId() > 0)
// {
// SruSourceView sruSourceView = loadSruSource(sruSourceForm.getSruSourceView().getId(), request, response);
// UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
// sruSourceForm.setSelectedRoles((List<String>) userSession.get(TARGET_ROLES_KEY));
// }
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
sruSourceForm.setSelectedRoles((List<String>) userSession.get(TARGET_ROLES_KEY));
saveMessages(request, errors);
return mapping.getInputForward();
}
SruSourceView sruSourceView = sruSourceForm.getSruSourceView();
// UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{sruSourceView};
boolean isNew=false;
if(sruSourceView.getId()<=0 )
isNew = true;
sruSourceView = (SruSourceView) sm.execute(RequestUtils.getRequester(request, response), "SubmitSruSource", args, names);
if(isNew)
addMessage(request, "srusource.created.success");
else
addMessage(request, "srusource.edited.success");
 
return mapping.findForward("success");
}
 
 
 
 
public ActionForward removeCollection(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException {
SruSourceForm sruSourceForm = (SruSourceForm) form;
 
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
long id = sruSourceForm.getAuxId();
if(sruSourceForm.getSruSourceView().getCollections() != null)
{
for(SruSourceCollectionView collectionView: sruSourceForm.getSruSourceView().getCollections())
{
if(collectionView.getId() == id)
{
sruSourceForm.getSruSourceView().getCollections().remove(collectionView);
sruSourceForm.setSruSourceCollectionView(collectionView);
userSession.remove(TARGET_ROLES_KEY);
userSession.serialize(request,response);
userSession.put(TARGET_ROLES_KEY,((ArrayList<String>)collectionView.getAdmitedRolesSet()));
userSession.serialize(request,response);
sruSourceForm.setSelectedRoles(collectionView.getAdmitedRolesSet());
break;
}
}
}
return mapping.getInputForward();
}
 
 
public ActionForward addSruSourceCollection(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException {
SruSourceForm sruSourceForm = (SruSourceForm) form;
ActionErrors errors = sruSourceForm.validateCollection(mapping, request);
if (!errors.isEmpty())
{
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
sruSourceForm.setSelectedRoles((List<String>) userSession.get(TARGET_ROLES_KEY));
saveMessages(request, errors);
return mapping.getInputForward();
}
SruSourceView sruSourceView = sruSourceForm.getSruSourceView();
if(sruSourceView.getCollections() == null)
sruSourceView.setCollections(new ArrayList<SruSourceCollectionView>());
SruSourceCollectionView collectionView = sruSourceForm.getSruSourceCollectionView();
 
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
collectionView.setAdmitedRoles(RoleManager.getSerialRoles((List<String>) userSession.get(TARGET_ROLES_KEY)));
userSession.remove(TARGET_ROLES_KEY);
userSession.serialize(request,response);
 
sruSourceView.getCollections().add(collectionView);
sruSourceForm.setSruSourceCollectionView(new SruSourceCollectionView());
return mapping.getInputForward();
}
 
 
 
 
 
public ActionForward newSruSource(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
userSession.put(TARGET_ROLES_KEY,new ArrayList<String>());
userSession.serialize(request, response);
return mapping.findForward("sruSourceData");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
 
 
 
public ActionForward loadSruSource(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException {
SruSourceForm sruSourceForm = (SruSourceForm) form;
SruSourceView sruSourceView = loadSruSource(sruSourceForm.getSruSourceView().getId(),request,response);
sruSourceForm.setSruSourceView(sruSourceView);
 
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
userSession.remove(TARGET_ROLES_KEY);
userSession.serialize(request,response);
 
return mapping.findForward("loadSruSource");
}
 
 
private SruSourceView loadSruSource(long id, HttpServletRequest request, HttpServletResponse response) throws Throwable, InvalidFilterException, ServiceManagerException, InvalidFilterExpressionException, IncompatibleFilterException, FilterRetrieveException, NoCookiesException {
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{id};
return (SruSourceView) sm.execute(RequestUtils.getRequester(request, response), "LoadSruSourceById", args, names);
}
 
 
public ActionForward delete(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
 
SruSourceForm sruSourceForm = (SruSourceForm) form;
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{sruSourceForm.getSruSourceView().getId()};
Boolean status = (Boolean) sm.execute(RequestUtils.getRequester(request, response), "DeleteSruSource", args, names);
 
if (status != null && status)
addMessage(request, "srusource.deleted.sucess");
else
addMessage(request, "srusource.deleted.fail");
 
return mapping.findForward("loadSruSources");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
 
}
/impl/src/java/pt/estgp/estgweb/web/controllers/commons/CommonsController.java
47,9 → 47,18
{
try
{
 
String query = request.getParameter("query");
if(query != null && query.trim().length() > 0)
{
if(!QueryLanguageChars.isValid(request.getParameter("query")))
query = QueryLanguageChars.escape(query);
}
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{request.getParameter("from"), request.getParameter("query"), SearchTypeEnum.parse(request.getParameter("searchType"))};
Object[] args = new Object[]{request.getParameter("from"), query, SearchTypeEnum.parse(request.getParameter("searchType"))};
 
ICommonSearchResults commonSearchResults = (ICommonSearchResults) sm.execute(RequestUtils.getRequester(request, response), "CommonServicesSearch", args, names);
request.setAttribute("ICommonSearchResults", commonSearchResults);
return mapping.findForward("searchResults");
76,7 → 85,7
{
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{request.getParameter("from"), request.getParameter("query"), SearchTypeEnum.parse(request.getParameter("searchType")), ModuleEnum.parse(request.getParameter("module")), Integer.parseInt(request.getParameter("page"))};
Object[] args = new Object[]{request.getParameter("from"), request.getParameter("query"), SearchTypeEnum.parse(request.getParameter("searchType")), ModuleEnum.parse(request.getParameter("module")),request.getParameter("moduleInternalKey"), Integer.parseInt(request.getParameter("page"))};
ISearchResults searchResults = (ISearchResults) sm.execute(RequestUtils.getRequester(request, response), "CommonServicesSearchModule", args, names);
request.setAttribute("ISearchResults", searchResults);
return mapping.findForward("searchModule");
/impl/src/java/CopyPhotos.java
New file
0,0 → 1,35
import jomm.utils.FilesUtils;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
 
/**
* @author Jorge Machado
* @date 4/Set/2010
* @time 12:33:37
* @email machadofisher@gmail.com
*/
public class CopyPhotos {
 
public static void main(String [] args) throws IOException {
 
args = new String[]{"D:\\Jorge\\Documents\\Fotos\\FotosMae\\102HPIMG"};
File dir = new File(args[0] + "\\0");
dir.mkdirs();
File[] files = new File(args[0]).listFiles();
for (int i = 0; i < files.length;i++)
{
if(files[i].isFile())
{
if(i > 0 && i % 100 == 0)
{
dir = new File( args[0] + "\\" + i);
dir.mkdirs();
}
FilesUtils.copy(new FileInputStream(files[i]),dir.getAbsolutePath() + "\\" + files[i].getName());
}
}
 
}
}
/impl/src/doc/bacoCandidaturaBoasPraticas.doc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/src/doc/estgweb.eap
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/impl/src/doc/baco.ppt
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/src/updates/db/update5.sql
New file
0,0 → 1,30
DROP TABLE IF EXISTS `sru_source`;
CREATE TABLE `sru_source` (
`id` bigint(20) NOT NULL auto_increment,
`discrimitator` varchar(255) NOT NULL,
`updateDate` datetime NOT NULL,
`saveDate` datetime default NULL,
`name` varchar(255) default NULL,
`collection_field` varchar(255) default NULL,
`description` text,
`url` varchar(255) default NULL,
`metadata_schema` varchar(255) default NULL,
`creator` bigint(20) default NULL,
PRIMARY KEY (`id`),
KEY `creatorFK` (`creator`),
CONSTRAINT `creatorFK` FOREIGN KEY (`creator`) REFERENCES `user` (`id`)
) ENGINE=Innodb DEFAULT CHARSET=latin1;
 
DROP TABLE IF EXISTS `sru_source_collection`;
CREATE TABLE `sru_source_collection` (
`id` bigint(20) NOT NULL auto_increment,
`discrimitator` varchar(255) NOT NULL,
`updateDate` datetime NOT NULL,
`saveDate` datetime default NULL,
`collection` varchar(255) default NULL,
`admited_roles` varchar(255) default NULL,
`sru_source_id` bigint(20) default NULL,
PRIMARY KEY (`id`),
KEY `sru_sourceFK` (`sru_source_id`),
CONSTRAINT `sru_sourceFK` FOREIGN KEY (`sru_source_id`) REFERENCES `sru_source` (`id`)
) ENGINE=Innodb DEFAULT CHARSET=latin1;
/impl/src/updates/db/update6.sql
New file
0,0 → 1,2
ALTER TABLE `courseunit` ADD COLUMN `contentsGrants` VARCHAR(100) NOT NULL default 'INTERNAL' AFTER `status`;
ALTER TABLE `courseunit` ADD INDEX `pathIntranetIndex`(`pathIntranet`);
/impl/src/updates/db/update7.sql
New file
0,0 → 1,0
ALTER TABLE `courseunit` MODIFY COLUMN `contentsGrants` VARCHAR(100) DEFAULT 'all';
/impl/src/hbm/pt/estgp/estgweb/domain/SruSource.hbm.xml
New file
0,0 → 1,44
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 
<hibernate-mapping>
<class name="pt.estgp.estgweb.domain.SruSource" table="sru_source" abstract="true">
<meta attribute="extends">pt.estgp.estgweb.domain.DomainSerializableObject</meta>
<meta attribute="scope-class">public abstract</meta>
<id name="id" type="long">
<generator class="native"/>
</id>
<discriminator column="discrimitator"/>
<timestamp name="updateDate" unsaved-value="null"/>
<property name="saveDate" type="timestamp"/>
<property name="name" type="string"/>
<property name="collectionField" column="collection_field" type="string"/>
<property name="description" type="text"/>
<property name="url" type="string"/>
<property name="metadataSchema" type="string" column="metadata_schema"/>
<many-to-one name="creator" class="pt.estgp.estgweb.domain.User" outer-join="false" lazy="proxy"/>
<set name="collections" order-by="collection asc" lazy="true" cascade="delete">
<key column="sru_source_id"/>
<one-to-many class="pt.estgp.estgweb.domain.SruSourceCollection"/>
</set>
<subclass name="pt.estgp.estgweb.domain.SruSourceImpl" discriminator-value="SruSourceImpl"/>
</class>
 
<class name="pt.estgp.estgweb.domain.SruSourceCollection" table="sru_source_collection" abstract="true">
<meta attribute="extends">pt.estgp.estgweb.domain.DomainSerializableObject</meta>
<meta attribute="scope-class">public abstract</meta>
<id name="id" type="long">
<generator class="native"/>
</id>
<discriminator column="discrimitator"/>
<timestamp name="updateDate" unsaved-value="null"/>
<property name="saveDate" type="timestamp"/>
<property name="collection" type="string"/>
<property name="admitedRoles" type="string" column="admited_roles"/>
<many-to-one name="sruSource" column="sru_source_id" class="pt.estgp.estgweb.domain.SruSource" outer-join="false" lazy="proxy"/>
<subclass name="pt.estgp.estgweb.domain.SruSourceCollectionImpl" discriminator-value="SruSourceCollectionImpl"/>
</class>
</hibernate-mapping>
/impl/src/hbm/pt/estgp/estgweb/domain/CourseUnit.hbm.xml
27,6 → 27,7
<property name="programStreamId" type="string" index="programStreamIdIndex" />
<property name="validProgram" type="boolean" index="validProgramIndex"/>
<property name="status" type="boolean" index="statusIndex" />
<property name="contentsGrants" type="string"/>
<many-to-one name="validatorUser" class="pt.estgp.estgweb.domain.Teacher" lazy="false" outer-join="true"/>
<many-to-one name="course" class="pt.estgp.estgweb.domain.Course" lazy="false" outer-join="true"/>
<set name="blogs" cascade="delete" lazy="true" order-by="saveDate asc">
/impl/src/web/imgs/lupa.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/src/web/admin/srusource/sruSourceData.jsp
New file
0,0 → 1,173
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.web.form.srusource.SruSourceForm" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<div id="contentIntranet">
<div id="contentPane">
 
<jomm:messages/>
<html:errors/>
 
 
<html:form action="/user/sruSourceFromServiceZone">
<input type="hidden" name="dispatch" value="editSruSource">
<html:hidden property="sruSourceView.id"/>
<html:hidden property="auxId"/>
<html:hidden property="role"/>
<input type="hidden" name="collectionSize" value="<%=((SruSourceForm)request.getAttribute("SruSourceForm")).getSruSourceView().getCollections().size()%>">
<table class="form">
 
<baco:isAdmin>
<tr>
<th>
<bean:message key="srusource.name"/>
</th>
<td>
<html:text styleClass="text" property="sruSourceView.name" maxlength="250"/>
</td>
</tr>
<tr>
<th>
<bean:message key="srusource.description"/>
</th>
<td>
<html:text styleClass="text" property="sruSourceView.description" maxlength="250"/>
</td>
</tr>
<tr>
<th>
<bean:message key="srusource.url"/>
</th>
<td>
<html:text styleClass="text" property="sruSourceView.url" maxlength="250"/>
(e.g: http://deptal.estgp.pt:8983/telHandler/Handler2)
</td>
</tr>
<tr>
<th>
<bean:message key="srusource.collectionField"/>
</th>
<td>
<html:text styleClass="text" property="sruSourceView.collectionField" maxlength="250"/>
</td>
</tr>
<tr>
<th>
<bean:message key="srusource.metadataSchema"/>
</th>
<td>
<html:select property="sruSourceView.metadataSchema">
<html:option value="files"><bean:message key="srusource.metadataSchema.files"/></html:option>
</html:select>
</td>
</tr>
<tr>
<th><bean:message key="srusource.collections"/></th>
<td>
<table class="dataTable">
 
<logic:notEmpty name="SruSourceForm" property="sruSourceView.collections">
<tr>
<th><bean:message key="srusource.collection"/></th>
<th><bean:message key="srusource.admited.roles"/></th>
</tr>
<nested:iterate id="collectionView" name="SruSourceForm" property="sruSourceView.collections" >
<tr>
<td><bean:write name="collectionView" property="collection"/></td>
<td>
<nested:hidden property="id"/>
<nested:hidden property="collection"/>
<nested:hidden property="admitedRoles"/>
<nested:notEmpty name="collectionView" property="admitedRolesSet">
<nested:iterate id="admitedRole" name="collectionView" property="admitedRolesSet">
<bean:message key="user.role.${admitedRole}"/>,
</nested:iterate>
</nested:notEmpty>
</td>
<td>
<input type="button" class="removeButton" value="" onclick="SruSourceForm.auxId.value='${collectionView.id}';set(this.form,'removeCollection');this.form.submit();">
</td>
</tr>
</nested:iterate>
</logic:notEmpty>
<logic:empty name="SruSourceForm" property="sruSourceView.collections">
<tr>
<td colspan="2">
<bean:message key="srusource.zero.collections"/>
</td>
</tr>
</logic:empty>
</table>
<table style="border:1px solid black">
<tr>
<th colspan="2"><bean:message key="srusource.new.collection"/></th>
</tr>
<tr>
<th><bean:message key="srusource.collection"/></th>
<td>
<html:hidden property="sruSourceCollectionView.id"/>
<html:text property="sruSourceCollectionView.collection"/>
</td>
</tr>
<tr>
<th>
<bean:message key="srusource.admited.roles"/>
</th>
<td>
<html:select property="targetRolesStr">
<logic:present name="SruSourceForm" property="targetRoles">
<logic:iterate id="item" name="SruSourceForm" property="targetRoles">
<jomm:option itemName="item" comparableObjectName="SruSourceForm"
comparableObjectProperty="targetRolesStr">
<jomm:message patternMessage="user.role.{0}" name0="item"/>
</jomm:option>
</logic:iterate>
<input type="button" value="<bean:message key="add"/>" onclick="set(this.form,'addRole');this.form.submit();">
</logic:present>
</html:select>
 
<logic:present name="SruSourceForm" property="selectedRoles">
<logic:notEmpty name="SruSourceForm" property="selectedRoles">
<table class="dataTable removeButton">
<logic:iterate id="item" name="SruSourceForm" property="selectedRoles">
<tr>
<th>
<jomm:message patternMessage="user.role.{0}" name0="item"/>
</th>
<td>
<input type="button" class="removeButton" value=""
onclick="SruSourceForm.role.value='${item}';set(this.form,'removeRole');this.form.submit();">
</td>
</tr>
</logic:iterate>
</table>
</logic:notEmpty>
</logic:present>
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" onclick="set(this.form,'addSruSourceCollection');this.form.submit()" value="<bean:message key="srusource.collection.add"/>"/>
</td>
</tr>
</table>
 
</td>
</tr>
 
</baco:isAdmin>
<tr class="buttons">
<td colspan="2">
<input type="button" onclick="set(this.form,'editSruSource');this.form.submit()"
value="<bean:message key="confirm"/>"/>
</td>
</tr>
</table>
</html:form>
</div>
</div>
/impl/src/web/admin/srusource/chooseSruSource.jsp
New file
0,0 → 1,45
<%@ page import="jomm.utils.MessageResources" %>
<%@ page import="pt.estgp.estgweb.domain.views.SruSourceView" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{};
List<SruSourceView> courseViews = (List<SruSourceView>) sm.execute(RequestUtils.getRequester(request, response), "LoadSruSources", args, names);
request.setAttribute("SruSources", courseViews);
%>
<jsp:useBean id="SruSources" type="java.util.List" scope="request"/>
<jomm:messages/>
<html:errors/>
 
<div class="seccao">
<h2><bean:message key="srusource.choose.srusources"/> </h2>
<table class="dataTable">
<tr>
<th><bean:message key="srusource.name"/></th>
<th><bean:message key="srusource.url"/></th>
</tr>
<%
String confirmDelete = MessageResources.getMessage(request, "srusource.confirm.delete");
request.setAttribute("confirmDelete", confirmDelete);
%>
<logic:iterate id="sruSource" name="SruSources" type="pt.estgp.estgweb.domain.views.SruSourceView">
<tr>
<td><html:link action="/user/chooseSruSourceFromServiceZone?sruSourceView.id=${sruSource.id}">${sruSource.name}</html:link></td>
<td>${sruSource.url}</td>
<td><html:link onclick="return confirm('${confirmDelete}')" action="/user/deleteSruSourceFromServiceZone?sruSourceView.id=${sruSource.id}"><bean:message key="delete"/></html:link></td>
</tr>
</logic:iterate>
</table>
</div>
/impl/src/web/css/style.css
202,7 → 202,7
}
 
#content h2 a {
font-size: 0.8em;
font-size: 1em;
}
 
#content h2 {
432,6 → 432,18
*
*****************************************************************/
 
.intranetLayout .searchTab
{
text-align:right;
padding:4px;
padding-bottom:4px;
white-space:nowrap;
margin:0;
}
.intranetLayout .searchTab input[type='text']
{
}
#searchResults li h1 {
 
background-color: #D6F0B2;
441,6 → 453,19
color: black;
}
 
#searchResults li .fragments {
padding-left:30px;
padding-right:10px;
}
#searchResults li .smallGreen {
 
padding-left:10px;
color: green;
text-decoration: none;
FONT: 10px "bitstream vera sans", "Lucida Grande", "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif
 
}
 
#searchResults li a {
cursor: pointer;
}
464,8 → 489,14
margin-top: 10px;
cursor: pointer;
padding-bottom: 0;
FONT: 12px "bitstream vera sans", "Lucida Grande", "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif
}
 
#searchResults li .module .result h2 a, #searchResults #googleModule .result h2, #searchResults #googleModule .result h2 a b i,{
 
FONT: 18px "bitstream vera sans", "Lucida Grande", "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif
}
 
#searchResults li .module .result p {
margin-top: 5px;
cursor: pointer;
881,11 → 912,23
text-align:justify;
}
 
 
 
#flashBottomNews .flashNew{
height:230px;
}
 
.flashNew
{
 
width:100%;
 
}
.flashNew th
{
vertical-align:top;
}
 
.flashNew td
{
background-color: #D3D3D3;
1487,24 → 1530,29
{
border-top:1px solid #8ec73f;
}
.remindersContainer, .quotasImpressaoContainer
.remindersContainer, .quotasImpressaoContainer, .messagesContainer, .searchTabContainer
{
vertical-align:top;
padding:0;
border:1px solid #8ec73f;
vertical-align:top;
}
.remindersContainer input { width:85px }
 
.reminders
{
text-align:center;
vertical-align:top;
width:200px;
float:right;
text-align:right;
padding:0;
margin:0;
}
.reminders #reminderForm, #quotasImpressao
{
border: 1px solid #8ec73f;
}
#reminderForm
{
border-top: 1px solid #8fc840;
margin-top:4px;
}
.reminders .new input[type="text"]:hover,#activeReminders * img:hover,#expiredReminders * img:hover
1513,7 → 1561,7
}
#reminderForm textarea, #reminderForm table
{
width:100%;
width:95%;
}
#activeReminders, #expiredReminders
{
1521,8 → 1569,8
border-right: 1px solid #8ec73f;
margin-top:10px;
margin-bottom:10px;
margin-left:0;
margin-right:0;
margin-left:1px;
margin-right:1px;
padding-left:0;
padding-bottom:0;
padding-top:0;
1549,6 → 1597,8
.reminders .new .title
{
text-align:right;
padding-top:1px;
padding-right:3px;
}
.reminder
{
1653,5 → 1703,25
.ects
{
background-color:#EBFCD6;
}
}
 
 
 
/*FACETS*/
.facets .title {
background-color: #8EC73F;
color: #FFFFFF;
font-size: 1.2em;
 
}
.facets
{
border-left: 1px solid #8ec73f;
border-bottom: 1px solid #8ec73f;
}
 
.facets table
{
width:100%;
}
 
/impl/src/web/js/ajax.js
206,7 → 206,9
var objXmlHttp = null;
if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera") ;
objXmlHttp=new XMLHttpRequest();
objXmlHttp.onload=handler;
objXmlHttp.onerror=handler;
return objXmlHttp;
}
if (navigator.userAgent.indexOf("MSIE")>=0)
281,6 → 283,13
xmlHttpSearch=GetXmlHttpObject(stateChangedSearchCall);
startRequest(xmlHttpSearch,"dispatch=searchModule&query=" + query + "&searchType=" + searchType + "&page=" + page + "&module=" + module,"",stateChangedSearchCall,"",action);
}
 
function searchCall(div,query,searchType,page,module,moduleInternalKey,action)
{
searchResultsDiv = div;
xmlHttpSearch=GetXmlHttpObject(stateChangedSearchCall);
startRequest(xmlHttpSearch,"dispatch=searchModule&query=" + query + "&searchType=" + searchType + "&page=" + page + "&module=" + module + "&moduleInternalKey=" + moduleInternalKey,"",stateChangedSearchCall,"",action);
}
function stateChangedSearchCall()
{
if (xmlHttpSearch.readyState==4 || xmlHttpSearch.readyState=="complete")
/impl/src/web/layout/searchForm.jsp
New file
0,0 → 1,93
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<baco:isModuleOn module="search">
 
 
<%
String allChecked = "";
String anyChecked = "";
String phraseChecked = "";
String query = request.getParameter("query");
String searchType = request.getParameter("searchType");
if(query == null)
query = "";
 
allChecked = "checked=\"checked\"";
if(searchType == null)
allChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.all"))
allChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.any"))
anyChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.phrase"))
phraseChecked = "checked=\"checked\"";
 
 
%>
 
 
 
 
<%
if(request.getParameter("size") == null)
{
%>
<td class="searchTab">
<html:form action="/search" method="post">
<!--<input type="hidden" name="from" value="home"/>-->
<input type="hidden" name="dispatch" value="search"/>
<table>
<tr>
<td>
<bean:message key="search"/>
</td>
<td>
<input type="text" class="small" name="query" value="<%=query.replace("\"","&quot;")%>"/>
</td>
<td>
<input type="submit" value="<bean:message key="search"/>">
</td>
 
</tr>
<tr>
<td nowrap="nowrap" colspan="3">
<table>
<tr>
<td><input type="radio" name="searchType" value="search.type.all" <%=allChecked%>/></td>
<td><bean:message key="search.type.all"/></td>
<td><input type="radio" name="searchType" value="search.type.any" <%=anyChecked%>/></td>
<td><bean:message key="search.type.any"/></td>
<td><input type="radio" name="searchType" value="search.type.phrase" <%=phraseChecked%>/></td>
<td><bean:message key="search.type.phrase"/></td>
</tr>
</table>
</td>
</tr>
</table>
<input type="hidden" name="searchType" value="search.type.all"/>
</html:form>
</td>
<%
}
else if(request.getParameter("size").equals("small"))
{
%>
<html:form action="/search" method="post">
<input type="hidden" name="dispatch" value="search"/>
<input type="hidden" name="from" value="Home"/>
<div class="searchTab">
<html:image page="/imgs/lupa.gif" altKey="search"/><input type="text" class="small" name="query" value="<%=query%>"/> <input type="submit" value=">>">
</div>
<input type="hidden" name="searchType" value="search.type.all"/>
</html:form>
<%
}
%>
 
 
</baco:isModuleOn>
/impl/src/web/layout/navigationLeftMenu.jsp
28,25 → 28,3
</div>
 
 
<br/>
<br/>
<p>Directorios</p>
 
<div class="linkLeftMenu">
<div class="listClean">
<ul>
<%
for (DirectoryImpl directory: Globals.getDirectories("home"))
{
request.setAttribute("dir",directory);
%>
<li>
<a href="<%=request.getContextPath()%>/dir/${dir.id}?role=${dir.role}&menu=${dir.key}"><bean:message key="${dir.key}"/></a>
</li>
<%
}
%>
</ul>
</div>
</div>
 
/impl/src/web/layout/putIcon.jsp
New file
0,0 → 1,77
<%--
Created by IntelliJ IDEA.
User: Jorge
Date: 19/Nov/2009
Time: 11:22:24
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
String mime = (String) request.getAttribute("ICON_mime");
String label = (String) request.getAttribute("ICON_alt");
 
if(mime != null)
{
if (mime.toLowerCase().endsWith("doc") || mime.toLowerCase().endsWith("docx") || mime.endsWith("rtf"))
{
%>
<img alt="<%=mime%>" src="<%=request.getContextPath()%>/imgs/mime/doc.gif">
<%
}
else if (mime.toLowerCase().endsWith("pdf"))
{
%>
<img alt="<%=mime%>" src="<%=request.getContextPath()%>/imgs/mime/pdf.gif">
<%
}
else if (mime.toLowerCase().endsWith("ppt"))
{
%>
<img alt="<%=mime%>" src="<%=request.getContextPath()%>/imgs/mime/ppt.gif">
<%
}
else if (mime.toLowerCase().endsWith("zip") || mime.endsWith(".gz") || mime.endsWith("tgz"))
{
%>
<img alt="<%=mime%>" src="<%=request.getContextPath()%>/imgs/mime/zip.gif">
<%
}
else if (mime.toLowerCase().endsWith("rar"))
{
%>
<img alt="<%=label%>" src="<%=request.getContextPath()%>/imgs/mime/rar.gif">
<%
}
else if (mime.toLowerCase().endsWith("html") || mime.endsWith("htm"))
{
%>
<img alt="<%=label%>" src="<%=request.getContextPath()%>/imgs/mime/html.gif">
<%
}
else if (mime.toLowerCase().endsWith("xls") || mime.endsWith("xlsx"))
{
%>
<img alt="<%=label%>" src="<%=request.getContextPath()%>/imgs/mime/xls.gif">
<%
}
else if (mime.toLowerCase().endsWith("txt"))
{
%>
<img alt="<%=label%>" src="<%=request.getContextPath()%>/imgs/mime/txt.gif">
<%
}
else if (mime.toLowerCase().endsWith("xml"))
{
%>
<img alt="<%=label%>" src="<%=request.getContextPath()%>/imgs/mime/xml.gif">
<%
}
else
{
%>
<img alt="<%=label%>" src="<%=request.getContextPath()%>/imgs/mime/unknown.gif">
<%
}
}
 
%>
/impl/src/web/layout/navigationTop.jsp
81,63 → 81,7
 
 
</td>
<baco:isModuleOn module="search">
<td class="searchTab">
 
<%
String allChecked = "";
String anyChecked = "";
String phraseChecked = "";
String query = request.getParameter("query");
String searchType = request.getParameter("searchType");
if(query == null)
query = "";
 
allChecked = "checked=\"checked\"";
if(searchType == null)
allChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.all"))
allChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.any"))
anyChecked = "checked=\"checked\"";
else if(searchType.equals("search.type.phrase"))
phraseChecked = "checked=\"checked\"";
 
 
%>
<html:form action="/search" method="post">
<input type="hidden" name="dispatch" value="search"/>
<table>
<tr>
<td>
<bean:message key="search"/>
</td>
<td>
<input type="text" class="small" name="query" value="<%=query%>"/>
</td>
<td>
<input type="submit" value="<bean:message key="search"/>">
</td>
 
</tr>
<tr>
<td nowrap="nowrap" colspan="3">
<table>
<tr>
<td><input type="radio" name="searchType" value="search.type.all" <%=allChecked%>/></td>
<td><bean:message key="search.type.all"/></td>
<td><input type="radio" name="searchType" value="search.type.any" <%=anyChecked%>/></td>
<td><bean:message key="search.type.any"/></td>
<td><input type="radio" name="searchType" value="search.type.phrase" <%=phraseChecked%>/></td>
<td><bean:message key="search.type.phrase"/></td>
</tr>
</table>
</td>
</tr>
</table>
</html:form>
</td>
</baco:isModuleOn>
<jsp:include page="searchForm.jsp"/>
</tr>
</table>
</div>
/impl/src/web/public/courseunits/listCourseUnits.jsp
New file
0,0 → 1,0
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
/impl/src/web/public/search/searchResults.jsp
12,7 → 12,7
<baco:isModuleOff module="searchGoogle">
<script language="Javascript" type="text/javascript">
var moduleResults = <%=ICommonSearchResults.getTotalResults()%>;
var query = '<%=ICommonSearchResults.getQuery()%>';
var query = '<%=ICommonSearchResults.getQuery()%>';
var searchType = '<%=ICommonSearchResults.getSearchType()%>';
if (moduleResults == 0 )
{
71,7 → 71,7
gWebSearch.gotoPage(googlePage);
else
{
var searchresults = document.getElementById("googleSearchResults");
var searchresults = getObjectById("googleSearchResults");
searchresults.innerHTML = "";
 
if (gWebSearch.cursor.estimatedResultCount > 0)
84,9 → 84,9
{
var thisResult = gWebSearch.results[i];
results += "<div class=\"result\">";
results += "<h2><a href=\"" + thisResult.url + "\">" + thisResult.title + "</a></h2>";
results += "<h2><a href=\"" + thisResult.unescapedUrl + "\">" + thisResult.title + "</a></h2>";
results += "<p>" + thisResult.content + "</p>";
// results += "<p class=\"smallUrl\">" + thisResult.url + "</p>";
// results += "<p class=\"smallUrl\">" + thisResult.unescapedUrl + "</p>";
// if (thisResult.cacheUrl) {
// results += " - <a class=\"cached\" href=\"" + thisResult.cacheUrl + "\">Cached <\/a>";
// }
142,10 → 142,15
type="pt.estgp.estgweb.services.common.ISearchResults">
<li>
<h1>
<bean:message key="${searchResults.module.messageKey}"/>
<b>(${searchResults.totalResults})</b>
<logic:empty name="searchResults" property="description">
<bean:message key="${searchResults.module.messageKey}"/>
</logic:empty>
<logic:notEmpty name="searchResults" property="description">
<bean:write name="searchResults" property="description"/>
</logic:notEmpty>
<b id="${searchResults.module.messageKey}_total">(${searchResults.totalResults})</b>
<a id="${searchResults.module.messageKey}SeeMore"
href="javascript:showOrHideOne('${searchResults.module.messageKey}')">
href="javascript:showOrHideOne('${searchResults.module.messageKey}_${searchResults.moduleInternalKey}')">
<bean:message key="search.see.more"/>
</a>
</h1>
157,71 → 162,199
else
visibility = Globals.HIDDEN;
%>
<div class="module" id="<%=searchResults.getModule().getMessageKey()%>" style="<%=visibility%>">
<div id="${searchResults.module.messageKey}Results">
<logic:iterate id="result" name="searchResults" property="results"
type="pt.estgp.estgweb.services.common.IResult">
<div class="result">
<h2>
<logic:notEmpty name="result" property="url">
<a href="<%=request.getContextPath()%>${result.url}">${result.title}</a>
</logic:notEmpty>
<logic:empty name="result" property="url">
${result.title}
</logic:empty>
<logic:notEmpty name="result" property="subTitle">
(
<logic:equal value="true" name="result" property="subTitleKey">
<bean:message key="${result.subTitle}"/>
<div class="module" id="${searchResults.module.messageKey}_${searchResults.moduleInternalKey}" style="<%=visibility%>">
<div align="right" id="turnOffFilters${searchResults.module.messageKey}_${searchResults.moduleInternalKey}" style="<%=Globals.HIDDEN%>;" >
<a onclick="hideOne('turnOffFilters${searchResults.module.messageKey}_${searchResults.moduleInternalKey}');return true;" href="javascript:searchCall('${searchResults.module.messageKey}_${searchResults.moduleInternalKey}Results','${searchResults.query}','${searchResults.searchType}','0','${searchResults.module.messageKey}','${searchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">
<bean:message key="result.turn.off.filters"/>
</a>
</div>
<br/>
<div id="${searchResults.module.messageKey}_${searchResults.moduleInternalKey}Results">
<table cellpadding="0" cellspacing="0" width="100%" style="padding:10px">
<tr>
<td valign="top">
<!--RESULTS-->
<%
int from = searchResults.getPage()*searchResults.getMaxResultsPage() + 1;
 
int to = (searchResults.getPage()+1)*searchResults.getMaxResultsPage();
if(to > searchResults.getTotalResults())
to = searchResults.getTotalResults();
%>
<p><bean:message key="search.pages.found.results"/> <%=from%> <bean:message key="search.pages.to"/> <%=to%> <bean:message key="search.pages.for.about"/> ${searchResults.totalResults}</p>
<logic:iterate id="result" name="searchResults" property="results"
type="pt.estgp.estgweb.services.common.IResult">
<div class="result">
<h2>
<logic:notEmpty name="result" property="mime">
<%
request.setAttribute("ICON_mime",result.getMime());
request.setAttribute("ICON_alt",result.getMime());
%>
<jsp:include page="/layout/putIcon.jsp"/>
</logic:notEmpty>
 
<logic:notEmpty name="result" property="url">
<%
if(result.isAbsoluteUrl())
{
%>
<a href="${result.url}">${result.title}</a>
<%
}
else
{
%>
<a href="<%=request.getContextPath()%>${result.url}">${result.title}</a>
<%
}
%>
</logic:notEmpty>
<logic:empty name="result" property="url">
${result.title}
</logic:empty>
<logic:notEmpty name="result" property="sizeKb">
[${result.sizeKb} KB]
</logic:notEmpty>
<logic:notEmpty name="result" property="subTitle">
<logic:equal value="true" name="result" property="subTitleKey">
<bean:message key="${result.subTitle}"/>
</logic:equal>
<logic:notEqual value="true" name="result" property="subTitleKey">
${result.subTitle}
</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>
<logic:notEmpty name="result" property="date">
<p><b><bean:message key="last.modification.date"/>:</b> ${result.date}</p>
</logic:notEmpty>
<logic:notEmpty name="result" property="creator">
<p><b><bean:message key="search.result.creator"/>:</b> ${result.creator}</p>
</logic:notEmpty>
<logic:empty name="result" property="bestFragments">
<p class="fragments">${result.text}</p>
</logic:empty>
<logic:notEmpty name="result" property="bestFragments">
<p class="fragments">${result.bestFragments}</p>
</logic:notEmpty>
 
<logic:notEmpty name="result" property="directory">
<p class="smallGreen">${result.directory}</p>
<p> <bean:message key="srusource.filter.dirs"/> :
<%
String directory = result.getDirectory();
String[] paths = directory.split("[\\\\]");
String finalPath = "";
for(int i = 0; i < paths.length -1;i++)
{
String path = paths[i];
if(path.trim().length() > 0)
{
finalPath += "/" + path;
%>
\
<a href="javascript:searchCall('${searchResults.module.messageKey}_${searchResults.moduleInternalKey}Results','(<%=searchResults.getQueryNoEncode().replace("\"","&quot;")%>) AND dir:&quot;<%=finalPath%>&quot;','${searchResults.searchType}','0','${searchResults.module.messageKey}','${searchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')" onclick="showOne('turnOffFilters${searchResults.module.messageKey}_${searchResults.moduleInternalKey}');return true;">
<%=path%>
</a>
<%
}
}
%>
</p>
</logic:notEmpty>
 
 
 
</div>
</logic:iterate>
<p class="pages">
<bean:message key="search.pages"/>
<logic:equal value="true" name="searchResults" property="hasPreviousPage">
<a href="javascript:searchCall('${searchResults.module.messageKey}_${searchResults.moduleInternalKey}Results','${searchResults.query}','${searchResults.searchType}','${searchResults.previousPage}','${searchResults.module.messageKey}','${searchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">
&lt;
<bean:message key="result.previous"/>
</a>
</logic:equal>
<logic:notEqual value="true" name="result" property="subTitleKey">
${result.subTitle}
</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>
${searchResults.page2Screen}
<logic:equal value="true" name="searchResults" property="hasNextPage">
<a href="javascript:searchCall('${searchResults.module.messageKey}_${searchResults.moduleInternalKey}Results','${searchResults.query}','${searchResults.searchType}','${searchResults.nextPage}','${searchResults.module.messageKey}','${searchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">
<bean:message key="result.next"/>
&gt;</a>
</logic:equal>
</p>
 
<%
subTitleSeparator = ", ";
%>
</logic:iterate>
)
</logic:notEmpty>
</h2>
 
<p>${result.bestFragments} ...</p>
</div>
</logic:iterate>
<p class="pages">
<bean:message key="search.pages"/>
<logic:equal value="true" name="searchResults" property="hasPreviousPage">
<a href="javascript:searchCall('${searchResults.module.messageKey}Results','${searchResults.query}','${searchResults.searchType}','${searchResults.previousPage}','${searchResults.module.messageKey}','<%=request.getContextPath()%>/search.do')">
&lt;
<bean:message key="result.previous"/>
</a>
</logic:equal>
${searchResults.page2Screen}
<logic:equal value="true" name="searchResults" property="hasNextPage">
<a href="javascript:searchCall('${searchResults.module.messageKey}Results','${searchResults.query}','${searchResults.searchType}','${searchResults.nextPage}','${searchResults.module.messageKey}','<%=request.getContextPath()%>/search.do')">
<bean:message key="result.next"/>
&gt;</a>
</logic:equal>
</p>
</div>
</td>
<td valign="top">
<!--FACETS-->
<logic:notEmpty name="searchResults" property="facets">
<div class="facets">
<div class="title" style="white-space:nowrap;"><bean:message key="facets"/></div>
<table class="dataTable">
<logic:iterate id="facet" name="searchResults" property="facets" type="pt.estgp.estgweb.services.common.IFacet">
<tr>
<th colspan="2">
<bean:message key="facet.${facet.index}"/>
</th>
</tr>
<logic:iterate id="label" name="facet" property="labels" type="pt.estgp.estgweb.services.common.IFacetLabel">
<tr>
<td>
<%
if(facet.getIndex().equals("type") || facet.getIndex().equals("facetType"))
{
request.setAttribute("ICON_mime",label.getLabel());
request.setAttribute("ICON_alt",label.getLabel());
%>
<jsp:include page="/layout/putIcon.jsp"/> ${label.label}
<%
}
else
{
%>
${label.label}
<%
}
%>
</td>
<td align="right">
<a href="javascript:searchCall('${searchResults.module.messageKey}_${searchResults.moduleInternalKey}Results','(${searchResults.query}) AND ${facet.index}:&quot;${label.label}&quot;','${searchResults.searchType}','0','${searchResults.module.messageKey}','${searchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')" onclick="showOne('turnOffFilters${searchResults.module.messageKey}_${searchResults.moduleInternalKey}');return true;">
${label.occurrences}
</a>
</td>
</tr>
</logic:iterate>
</logic:iterate>
</table>
</div>
</logic:notEmpty>
</td>
</tr>
</table>
</div>
<h3>
<a href="javascript:hide('${searchResults.module.messageKey}','${searchResults.module.messageKey}SeeMore')">Fechar</a>
<a href="javascript:hide('${searchResults.module.messageKey}_${searchResults.moduleInternalKey}','${searchResults.module.messageKey}SeeMore')">Fechar</a>
</h3>
</div>
</li>
/impl/src/web/public/search/searchForm.jsp
26,7 → 26,7
<bean:message key="search"/>
</td>
<td>
<html:text size="100%" styleClass="small" property="query" value=""/>
<html:text size="100%" styleClass="small" property="query" value=""/>
</td>
<td>
<input type="button" onclick="set(this.form,'search');this.form.submit()" value="<bean:message key="search"/>">
/impl/src/web/public/search/searchResultsModule.jsp
1,37 → 1,160
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="pt.estgp.estgweb.services.common.*" %>
<%@ page import="pt.estgp.estgweb.web.Globals" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<jsp:useBean id="ISearchResults" type="pt.estgp.estgweb.services.common.ISearchResults" scope="request"/>
<logic:iterate id="result" name="ISearchResults" property="results"
type="pt.estgp.estgweb.services.common.IResult">
<div class="result">
<h2><a href="<%=request.getContextPath()%>${result.url}">${result.title}</a>
<logic:notEmpty name="result" property="subTitle">
(
<logic:equal value="true" name="result" property="subTitleKey">
<bean:message key="${result.subTitle}"/>
</logic:equal>
<logic:notEqual value="true" name="result" property="subTitleKey">
${result.subTitle}
</logic:notEqual>
)
<table cellpadding="0" cellspacing="0" width="100%" style="padding:10px">
<tr>
<td valign="top">
<!--RESULTS-->
<%
int from = (ISearchResults.getPage()*ISearchResults.getMaxResultsPage()) + 1;
int to = (ISearchResults.getPage()+1)*ISearchResults.getMaxResultsPage();
if(to > ISearchResults.getTotalResults())
to = ISearchResults.getTotalResults();
%>
<p><bean:message key="search.pages.found.results"/> <%=from%> <bean:message key="search.pages.to"/> <%=to%> <bean:message key="search.pages.for.about"/> ${ISearchResults.totalResults}</p>
<logic:iterate id="result" name="ISearchResults" property="results"
type="pt.estgp.estgweb.services.common.IResult">
<div class="result">
 
<h2>
<logic:notEmpty name="result" property="mime">
<%
request.setAttribute("ICON_mime",result.getMime());
request.setAttribute("ICON_alt",result.getMime());
%>
<jsp:include page="/layout/putIcon.jsp"/>
</logic:notEmpty>
<logic:notEmpty name="result" property="url">
<%
if(result.isAbsoluteUrl())
{
%>
<a href="${result.url}">${result.title}</a>
<%
}
else
{
%>
<a href="<%=request.getContextPath()%>${result.url}">${result.title}</a>
<%
}
%>
</logic:notEmpty>
<logic:empty name="result" property="url">
${result.title}
</logic:empty>
<logic:notEmpty name="result" property="sizeKb">
[${result.sizeKb} KB]
</logic:notEmpty>
<logic:notEmpty name="result" property="subTitle">
(
<logic:equal value="true" name="result" property="subTitleKey">
<bean:message key="${result.subTitle}"/>
</logic:equal>
<logic:notEqual value="true" name="result" property="subTitleKey">
${result.subTitle}
</logic:notEqual>
)
</logic:notEmpty>
</h2>
<logic:notEmpty name="result" property="date">
<p><b><bean:message key="last.modification.date"/>:</b> ${result.date}</p>
</logic:notEmpty>
<logic:notEmpty name="result" property="creator">
<p><b><bean:message key="search.result.creator"/>:</b> ${result.creator}</p>
</logic:notEmpty>
<logic:empty name="result" property="bestFragments">
<p class="fragments">${result.text}</p>
</logic:empty>
<logic:notEmpty name="result" property="bestFragments">
<p class="fragments">${result.bestFragments}</p>
</logic:notEmpty>
<logic:notEmpty name="result" property="directory">
<p class="smallGreen">${result.directory}</p>
<p> <bean:message key="srusource.filter.dirs"/> :
<%
String directory = result.getDirectory();
String[] paths = directory.split("[\\\\]");
String finalPath = "";
for(int i = 0; i < paths.length -1;i++)
{
String path = paths[i];
if(path.trim().length() > 0)
{
finalPath += "/" + path;
%>
\
<a href="javascript:searchCall('${ISearchResults.module.messageKey}_${ISearchResults.moduleInternalKey}Results','(<%=ISearchResults.getQueryNoEncode().replace("\"","&quot;")%>) AND dir:&quot;<%=finalPath%>&quot;','${ISearchResults.searchType}','0','${ISearchResults.module.messageKey}','${ISearchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')" onclick="showOne('turnOffFilters${ISearchResults.module.messageKey}_${ISearchResults.moduleInternalKey}');return true;">
<%=path%>
</a>
<%
}
}
%>
</p>
</logic:notEmpty>
</div>
</logic:iterate>
Pages:
<logic:equal value="true" name="ISearchResults" property="hasPreviousPage">
<a href="javascript:searchCall('${ISearchResults.module.messageKey}_${ISearchResults.moduleInternalKey}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.previousPage}','${ISearchResults.module.messageKey}','${ISearchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">&lt; previous</a>
</logic:equal>
${ISearchResults.page2Screen}
<logic:equal value="true" name="ISearchResults" property="hasNextPage">
<a href="javascript:searchCall('${ISearchResults.module.messageKey}_${ISearchResults.moduleInternalKey}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.nextPage}','${ISearchResults.module.messageKey}','${ISearchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">next &gt;</a>
</logic:equal>
</td>
<td valign="top">
<!--FACETS-->
<logic:notEmpty name="ISearchResults" property="facets">
<div class="facets">
<div class="title" style="white-space:nowrap;"><bean:message key="facets"/></div>
<table class="dataTable">
<logic:iterate id="facet" name="ISearchResults" property="facets" type="pt.estgp.estgweb.services.common.IFacet">
<tr>
<th colspan="2">
<bean:message key="facet.${facet.index}"/>
</th>
</tr>
<logic:iterate id="label" name="facet" property="labels" type="pt.estgp.estgweb.services.common.IFacetLabel">
<tr>
<td>
<%
if(facet.getIndex().equals("type") || facet.getIndex().equals("facetType"))
{
request.setAttribute("ICON_mime",label.getLabel());
request.setAttribute("ICON_alt",label.getLabel());
%>
<jsp:include page="/layout/putIcon.jsp"/>
<%
}
else
{
%>
${label.label}
<%
}
%>
</td>
<td align="right">
<a href="javascript:searchCall('${ISearchResults.module.messageKey}_${ISearchResults.moduleInternalKey}Results','(${ISearchResults.query}) AND ${facet.index}:&quot;${label.label}&quot;','${ISearchResults.searchType}','0','${ISearchResults.module.messageKey}','${ISearchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')" onclick="showOne('turnOffFilters${ISearchResults.module.messageKey}_${ISearchResults.moduleInternalKey}');return true;">
${label.occurrences}
</a>
</td>
</tr>
</logic:iterate>
</logic:iterate>
</table>
</div>
</logic:notEmpty>
</h2>
</td>
</tr>
</table>
 
<p>${result.bestFragments} ...</p>
</div>
</logic:iterate>
Pages:
<logic:equal value="true" name="ISearchResults" property="hasPreviousPage">
<a href="javascript:searchCall('${ISearchResults.module.messageKey}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.previousPage}','${ISearchResults.module.messageKey}','<%=request.getContextPath()%>/search.do')">&lt; previous</a>
</logic:equal>
${ISearchResults.page2Screen}
<logic:equal value="true" name="ISearchResults" property="hasNextPage">
<a href="javascript:searchCall('${ISearchResults.module.messageKey}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.nextPage}','${ISearchResults.module.messageKey}','<%=request.getContextPath()%>/search.do')">next &gt;</a>
</logic:equal>
 
 
/impl/src/web/public/blogs/blog.jsp
189,7 → 189,7
</tr>
<tr>
<td colspan="2" class="pFooter">
Posted by: (${post.ownerUsername}) ${post.ownerName} [AT] ${post.formatedSaveDate}
Posted by: <html:link page="/startProfile.do?userView.id=${post.ownerId}">(${post.ownerUsername}) ${post.ownerName}</html:link> [AT] ${post.formatedSaveDate}
</td>
</tr>
</baco:canLoad>
229,11 → 229,15
<%
String identifier = "" + BlogView.getId();
if(BlogView.getName() != null && BlogView.getName().length() > 0)
identifier = BlogView.getName();
{ identifier = BlogView.getName();
 
%>
<a href="<%=request.getContextPath()%>/blog/<%=identifier%>">
<%=Globals.SITE_URL + "/blog/" + identifier%>
</a>
<%
}
%>
<bean:message key="blog.owner"/>
<a href="mailto:${BlogView.ownerEmail}">${BlogView.owner.name}</a>
<bean:message key="at"/>
/impl/src/web/public/announcements/announcementsPortalRightHome.jsp
New file
0,0 → 1,124
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="pt.estgp.estgweb.domain.views.AnnouncementView" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%
IServiceManager sm = ServiceManager.getInstance();
String subTarget = null;
String[] names = new String[]{};
Object[] args = new Object[]{request.getParameter("role"), Globals.ANNOUNCEMENT_TYPE_NEWS, subTarget};
List<AnnouncementView> announcementViews = (List<AnnouncementView>) sm.execute(RequestUtils.getRequester(request, response), "LoadRoleTypeMaxAnnouncements", args, names);
request.setAttribute("Announcements", announcementViews);
 
String fromAction = "";
String user = "";
if(request.getParameter("from")!=null)
{
request.setAttribute("from","from=" + request.getParameter("from"));
user = "/user";
fromAction = "From" + request.getParameter("from");
}
else
{
request.setAttribute("from","");
}
request.setAttribute("user",user);
request.setAttribute("fromAction",fromAction);
 
%>
 
<div class="portalRightAnnouncements">
 
<table width="100%">
<baco:isAuthenticated>
<tr>
<td colspan="2" class="searchTabContainer">
<jsp:include page="/layout/searchForm.jsp?size=small"/>
</td>
</tr>
<tr>
<td colspan="2" class="quotasImpressaoContainer" align="center">
<jsp:include page="/user/quotasImpressao/quotasImpressao.jsp"/>
</td>
</tr>
<tr>
<td colspan="2" class="remindersContainer" align="center">
<jsp:include page="/user/reminders/reminders.jsp"/>
</td>
</tr>
 
<tr>
<td colspan="2" class="messagesContainer" align="center"><jsp:include page="/user/pop/messagesContainer.jsp"/></td>
</tr>
</baco:isAuthenticated>
<logic:present name="Announcements">
<logic:notEmpty name="Announcements">
<tr>
<td colspan="2">
<h1><bean:message key="announcements"/></h1>
</td>
</tr>
<logic:iterate id="item" name="Announcements" type="pt.estgp.estgweb.domain.views.AnnouncementView">
<tr>
<td width="25%">
<div class="imageAnnouncementNews">
<baco:ownerImageRole name="item"/>
</div>
</td>
<td>
<div class="portalAnnouncementNews">
<div class="portalAnnouncement">
<logic:empty name="item" property="url">
<div class="portalAnnouncementTitle">
<html:link
action="${user}/startLoadAnnouncement${fromAction}?id=${item.id}">${item.title}</html:link>
</div>
<div class="portalAnnouncementText">
<html:link
action="${user}/startLoadAnnouncement${fromAction}?id=${item.id}">${item.textSummarySmall}</html:link>
</div>
</logic:empty>
<logic:notEmpty name="item" property="url">
<%
if (!item.getTextBiggerThenPermited())
{
%>
<div class="portalAnnouncementTitle">
<html:link href="${item.url}">${item.title}</html:link>
</div>
<div class="portalAnnouncementText">
<html:link href="${item.url}">${item.textSummarySmall}</html:link>
</div>
<%
}
else
{
%>
<div class="portalAnnouncementTitle">
<html:link
action="${user}/startLoadAnnouncement${fromAction}?id=${item.id}">${item.title}</html:link>
</div>
<div class="portalAnnouncementText">
<html:link
action="${user}/startLoadAnnouncement${fromAction}?id=${item.id}">${item.textSummarySmall}</html:link>
</div>
<%}%>
</logic:notEmpty>
</div>
</div>
</td>
 
</tr>
</logic:iterate>
</logic:notEmpty>
</logic:present>
</table>
</div>
/impl/src/web/public/announcements/getFlashNews.jsp
26,20 → 26,21
<table class="container">
<tr>
<td class="textContainer">
<%if(announcementView.getUrl()==null)
<%
if(announcementView.getUrl()==null)
{%>
<h2><a href="<%=request.getContextPath()%>/loadAnnouncement.do?id=<%=announcementView.getId()%>&dispatch=load"><%=announcementView.getTitle()%></a></h2>
<p><a href="<%=request.getContextPath()%>/loadAnnouncement.do?id=<%=announcementView.getId()%>&dispatch=load"><%=announcementView.getTextSummary()%></a></p>
<p><a href="<%=request.getContextPath()%>/loadAnnouncement.do?id=<%=announcementView.getId()%>&dispatch=load"><%=announcementView.getFormatedTextSummary(10,150)%> ... </a></p>
<%}
else if (!announcementView.getTextBiggerThenPermited())
else if (!announcementView.getFormatedTextBiggerThenPermited(10,150))
{%>
<h2><a href="<%=announcementView.getUrl()%>"><%=announcementView.getTitle()%></a></h2>
<p><a href="<%=announcementView.getUrl()%>"><%=announcementView.getText()%></a></p>
<p><a href="<%=announcementView.getUrl()%>"><%=announcementView.getFormatedText()%></a></p>
<%}
else
{%>
<h2><a href="<%=request.getContextPath()%>/loadAnnouncement.do?id=<%=announcementView.getId()%>&dispatch=load"><%=announcementView.getTitle()%></a></h2>
<p><a href="<%=request.getContextPath()%>/loadAnnouncement.do?id=<%=announcementView.getId()%>&dispatch=load"><%=announcementView.getTextSummary()%></a></p>
<p><a href="<%=request.getContextPath()%>/loadAnnouncement.do?id=<%=announcementView.getId()%>&dispatch=load"><%=announcementView.getFormatedTextSummary(10,150)%> ... </a></p>
<%}%>
</td>
<td class="imageContainer">
/impl/src/web/public/announcements/loadAnnouncement.jsp
55,6 → 55,9
</html:link>
</baco:canManage>
</h2>
<logic:notEmpty name="Announcement" property="url">
<p>URL: <html:link page="${Announcement.url}"><script type="text/javascript">document.write((""+document.location).substr(0,(""+document.location).lastIndexOf("/")));</script>${Announcement.url}</html:link></p>
</logic:notEmpty>
<%
AnnouncementStyleEnum styleEnum = Announcement.getStyleEnum();
 
77,6 → 80,7
%>
 
 
 
<p>
<div class="imageAnnouncement">
<%
308,7 → 312,9
</tr>
<logic:notEmpty name="Announcement" property="url">
<tr>
<td colspan="2"> &nbsp;&nbsp;&gt;&gt; <html:link href="${Announcement.url}">${Announcement.url}</html:link></td>
<td colspan="2">
URL: <html:link page="${Announcement.url}"><script type="text/javascript">document.write((""+document.location).substr(0,(""+document.location).lastIndexOf("/")));</script>${Announcement.url}</html:link>
</td>
</tr>
</logic:notEmpty>
<tr>
/impl/src/web/public/announcements/announcementsPortalRight.jsp
38,21 → 38,6
<div class="portalRightAnnouncements">
 
<table>
<baco:isAuthenticated>
<tr>
<td colspan="2" class="quotasImpressaoContainer">
<jsp:include page="/user/quotasImpressao/quotasImpressao.jsp"/>
</td>
</tr>
<tr>
<td colspan="2" class="remindersContainer">
<jsp:include page="/user/reminders/reminders.jsp"/>
</td>
</tr>
<tr>
<td colspan="2" class="messagesContainer"><jsp:include page="/user/pop/messagesContainer.jsp"/></td>
</tr>
</baco:isAuthenticated>
<logic:present name="Announcements">
<logic:notEmpty name="Announcements">
<tr>
/impl/src/web/user/courses/directedCoordinatedCourses.jsp
159,7 → 159,7
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithNoProgramS1" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<td>${courseUnitView.code}</td>
<td> <a href="<%=request.getContextPath()%>/user/startLoadCourseUnitFromHome.do?id=${courseUnitView.id}">${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
185,7 → 185,7
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td> <a href="<%=request.getContextPath()%>/user/startLoadCourseUnitFromHome.do?id=${courseUnitView.id}">${courseUnitView.code}</td>
<td>
<baco:hasRole role="teacher">
<a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a>
223,7 → 223,7
<nested:hidden property="id"/>
<nested:checkbox property="validProgram"/></td>
</logic:equal>
<td>${courseUnitView.code}</td>
<td> <a href="<%=request.getContextPath()%>/user/startLoadCourseUnitFromHome.do?id=${courseUnitView.id}">${courseUnitView.code}</td>
<td><a href="<%=request.getContextPath()%>/repositoryStream/${courseUnitView.programStreamId}">${courseUnitView.name}</a></td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
244,7 → 244,7
<table class="dataTable">
<nested:iterate id="courseUnitView" property="courseUnitsWithNoProgramS2" type="pt.estgp.estgweb.domain.views.CourseUnitView">
<tr>
<td>${courseUnitView.code}</td>
<td> <a href="<%=request.getContextPath()%>/user/startLoadCourseUnitFromHome.do?id=${courseUnitView.id}">${courseUnitView.code}</td>
<td>${courseUnitView.name}</td>
<td>${courseUnitView.teachersSnipet}</td>
</tr>
/impl/src/web/user/courseunits/courseunitassignement.jsp
1,6 → 1,8
<%@ page import="pt.estgp.estgweb.domain.Teacher" %>
<%@ page import="pt.estgp.estgweb.domain.TeacherImpl" %>
<%@ page import="jomm.utils.MessageResources" %>
<%@ page import="java.util.Collections" %>
<%@ page import="pt.estgp.estgweb.domain.views.utils.CourseUnitDeliverableComparator" %>
<%@ 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" %>
95,15 → 97,72
</logic:notEmpty>
</table>
</div>
 
<bean:define id="orderFirst" type="java.lang.String" scope="request" value=""/>
<bean:define id="orderLast" type="java.lang.String" scope="request" value=""/>
 
<%
// String orderFirst = "";
// String orderLast = "";
 
if (request.getParameter("sort") != null) {
String sortBy = request.getParameter("sort");
if (sortBy.equals("firstAsc"))
{
Collections.sort(CourseUnitAssignementView.getDeliverables(), CourseUnitDeliverableComparator.FIRST_VERSION_ASC);
%>
<bean:define id="orderFirst" type="java.lang.String" scope="request" value="firstDesc"/>
<bean:define id="orderLast" type="java.lang.String" scope="request" value="lastAsc"/>
<%
}
else if (sortBy.equals("firstDesc"))
{
Collections.sort(CourseUnitAssignementView.getDeliverables(), CourseUnitDeliverableComparator.FIRST_VERSION_DESC);
%>
<bean:define id="orderFirst" type="java.lang.String" scope="request" value="firstAsc"/>
<bean:define id="orderLast" type="java.lang.String" scope="request" value="lastAsc"/>
<%
}
else if (sortBy.equals("lastAsc"))
{
Collections.sort(CourseUnitAssignementView.getDeliverables(), CourseUnitDeliverableComparator.LAST_VERSION_ASC);
%>
<bean:define id="orderLast" type="java.lang.String" scope="request" value="lastDesc"/>
<bean:define id="orderFirst" type="java.lang.String" scope="request" value="firstAsc"/>
<%
}
else if (sortBy.equals("lastDesc"))
{
Collections.sort(CourseUnitAssignementView.getDeliverables(), CourseUnitDeliverableComparator.LAST_VERSION_DESC);
%>
<bean:define id="orderLast" type="java.lang.String" scope="request" value="lastAsc"/>
<bean:define id="orderFirst" type="java.lang.String" scope="request" value="firstAsc"/>
<%
}
else
{
%>
<bean:define id="orderFirst" type="java.lang.String" scope="request" value="firstAsc"/>
<bean:define id="orderLast" type="java.lang.String" scope="request" value="lastAsc"/>
 
<%
}
}
 
%>
 
<nested:form action="/user/courseUnitControllerFromHome">
<input type="hidden" name="dispatch" value="updateDeliverables">
<html:hidden property="courseUnitAssignementView.id" value="${CourseUnitAssignementView.id}"/>
 
<html:hidden property="courseUnitView.id" value="${CourseUnitView.id}"/>
 
<a name="works"/>
<table class="dataTable">
<tr>
<th><bean:message key="courseunit.assignement.delivered.date"/></th>
<th><bean:message key="courseunit.assignement.delivered.versions"/></th>
<th><html:link action="/user/startLoadCourseUnitAssignementFromHome?courseUnitAssignementView.id=${CourseUnitAssignementView.id}&sort=${orderFirst}#works"><bean:message key="courseunit.assignement.delivered.date.first.version"/></html:link></th>
<th><html:link action="/user/startLoadCourseUnitAssignementFromHome?courseUnitAssignementView.id=${CourseUnitAssignementView.id}&sort=${orderLast}#works"><bean:message key="courseunit.assignement.delivered.date"/></html:link></th>
<th><bean:message key="courseunit.assignement.deliver.time"/></th>
<th><bean:message key="number"/></th>
<th><bean:message key="name"/></th>
113,7 → 172,18
</tr>
<nested:iterate id="deliverable" property="courseUnitAssignementView.deliverables" type="pt.estgp.estgweb.domain.views.CourseUnitDeliverableView">
<tr>
<td>${deliverable.deliverDateStr} </td>
<td align="right">
 
<a href="javascript:showOrHideOne('work${deliverable.id}')">${deliverable.versionsSize}</a>
<div id="work${deliverable.id}" style="display:none;">
<nested:iterate id="version" name="deliverable" property="versions" type="pt.estgp.estgweb.domain.RepositoryFileVersion">
- <bean:message key="courseunit.assignement.deliver.version"/> (${version.saveDate})&nbsp;<br/>
</nested:iterate>
</div>
 
</td>
<td nowrap="nowrap" align="center">${deliverable.deliverDateMinutesSecondsStrFirstVersion} </td>
<td nowrap="nowrap" align="center">${deliverable.deliverDateStrMinutesSeconds} </td>
<logic:equal name="deliverable" property="lateDeliver" value="true">
<td class="statusERROR">
<bean:message key="courseunit.assignement.deliver.time.late"/>
126,7 → 196,7
</logic:notEqual>
<td align="right">${deliverable.student.code}</td>
<td>${deliverable.student.name}</td>
<td><a target="_blank" href="<%=request.getContextPath()%>/repositoryStream/${deliverable.fileStreamId}"><bean:message key="courseunit.assignement.deliver.version"/> (${deliverable.deliverDateStr})</a></td>
<td><a target="_blank" href="<%=request.getContextPath()%>/repositoryStream/${deliverable.fileStreamId}"><bean:message key="courseunit.assignement.deliver.version"/> (${deliverable.deliverDateMinutesSecondsStr})</a></td>
<td>
<nested:hidden property="id"/>
<nested:text property="grade"/>
/impl/src/web/user/courseunits/courseunit.jsp
39,7 → 39,7
<p>
<baco:cantManage name="CourseUnitView">
<logic:present name="CourseUnitView" property="objectives">
${CourseUnitView.objectives}
${CourseUnitView.formatedObjectives}
</logic:present>
<logic:notPresent name="CourseUnitView" property="objectives">
<bean:message key="courseunit.objectives.not.available"/>
49,7 → 49,18
<html:textarea styleClass="textarea" property="courseUnitView.objectives"/>
</baco:canManage>
</p>
<baco:canManage name="CourseUnitView">
<h2><bean:message key="courseunits.contentsGrants"/></h2>
<p>
<html:select property="courseUnitView.contentsGrants">
<%--<html:option value="PUBLIC"><bean:message key="courseunits.contentsGrants.PUBLIC"/></html:option>--%>
<html:option value="INTERNAL"><bean:message key="courseunits.contentsGrants.INTERNAL"/></html:option>
<html:option value="PRIVATE"><bean:message key="courseunits.contentsGrants.PRIVATE"/></html:option>
</html:select>
</p>
</baco:canManage>
<h2><bean:message key="courseunit.programfilepath"/></h2>
<p>
<baco:canManage name="CourseUnitView">
<logic:equal value="false" name="CourseUnitView" property="validProgram">
<html:file property="programFile"/>
/impl/src/web/user/courseunits/menu.jsp
1,4 → 1,13
<%@ page import="pt.estgp.estgweb.domain.views.BlogView" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.utils.DatesUtils" %>
<%@ page import="pt.estgp.estgweb.domain.enums.CourseUnitContentsGrants" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page import="pt.estgp.estgweb.domain.UserImpl" %>
<%@ page import="pt.estgp.estgweb.domain.UserSession" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
45,17 → 54,25
<html:link action="${user}/startLoadCourseUnit${fromAction}?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.home"/></html:link>
</li>
 
<baco:isInCourseUnit courseUnitId="${CourseUnitView.id}">
<baco:isTeacherOfCourseUnit courseUnitId="${CourseUnitView.id}">
<li>
<html:link action="/user/startSubmitAnnouncementFromCourseUnit?announcementView.courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.put.announcement"/></html:link>
</li>
<!--<li>
<a href="<%=request.getContextPath()%>/"><bean:message key="courseunit.menu.put.question"/></a>
<a href="<%=request.getContextPath()%>/"><bean:message key="courseunit.menu.put.question"/></a>
</li>-->
</baco:isTeacherOfCourseUnit>
<baco:hasRole role="services">
<li>
<html:link action="/user/startSubmitAnnouncementFromCourseUnit?announcementView.courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.put.announcement"/></html:link>
</li>
<!--<li>
<a href="<%=request.getContextPath()%>/"><bean:message key="courseunit.menu.put.question"/></a>
</li>-->
</baco:hasRole>
<li>
<a href="<%=request.getContextPath()%>${user}/startLoadCourseUnitWorks${fromAction}.do?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.assignements"/></a>
</li>
</baco:isInCourseUnit>
 
 
<li>
68,18 → 85,83
<html:link action="${user}/startLoadCourseUnitStudents${fromAction}?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.students"/></html:link>
</li>
 
<%
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
CourseUnitContentsGrants contentsGrants = CourseUnitContentsGrants.parse(CourseUnitView.getContentsGrants());
if ( contentsGrants == CourseUnitContentsGrants.PUBLIC ||
(contentsGrants == CourseUnitContentsGrants.INTERNAL && UserSessionProxy.isAuthenticated(request)) ||
(contentsGrants == CourseUnitContentsGrants.PRIVATE && UserSessionProxy.isAuthenticated(request) &&
(((UserImpl) ((userSession.getUser()))).isTeacherOfCourseUnit(CourseUnitView.getId()) ||
((UserImpl) ((userSession.getUser()))).isStudentfCourseUnit(CourseUnitView.getId()))))
{
%>
<li>
<html:link action="/user/startLoadCourseUnitContentsFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.contents"/></html:link>
</li>
<li>
<html:link action="/user/startLoadCourseUnitPresencesFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.presences"/></html:link>
</li>
<li>
<html:link action="/user/startLoadCourseUnitGradesFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.grades"/></html:link>
</li>
<%
}
%>
 
<li>
<html:link action="/user/startLoadCourseUnitContentsFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.contents"/></html:link>
</li>
<li>
<html:link action="/user/startLoadCourseUnitPresencesFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.presences"/></html:link>
</li>
<li>
<html:link action="/user/startLoadCourseUnitGradesFromHome?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.grades"/></html:link>
</li>
 
 
 
</ul>
</div>
</div>
</div>
</div>
 
 
<%
IServiceManager sm = ServiceManager.getInstance();
 
String[] names = new String[]{};
Object[] args = new Object[]{CourseUnitView.getCode(), CourseUnitView.getCourseCode()};
 
List<pt.estgp.estgweb.domain.views.CourseUnitView> courseUnitViews = (List<pt.estgp.estgweb.domain.views.CourseUnitView>) sm.execute(RequestUtils.getRequester(request, response), "LoadCourseUnitsBySigesCodes", args, names);
if(courseUnitViews.size() > 1)
{
request.setAttribute("OldUnits",courseUnitViews);
}
%>
<logic:present name="OldUnits">
<div class="linkMenuBlock">
<div class="linkMenuBlockTitle">
<%
if (CourseUnitView.getImportYear().equals(DatesUtils.getImportYear()))
{
%>
<bean:message key="courseunit.menu.unit.old.units"/>
<%
}else{
%>
<bean:message key="courseunit.menu.unit.other.units"/>
<%
}
%>
</div>
<div class="linkLeftMenu">
<div class="listClean">
<ul>
<logic:iterate id="item" name="OldUnits">
<li>
<logic:equal value="${CourseUnitView.id}" name="item" property="id">
&gt;${item.importYear}
</logic:equal>
<logic:notEqual value="${CourseUnitView.id}" name="item" property="id">
<html:link action="${user}/startLoadCourseUnit${fromAction}?courseUnitView.id=${item.id}">${item.importYear}</html:link>
</logic:notEqual>
 
</li>
</logic:iterate>
</ul>
</div>
</div>
</div>
</logic:present>
/impl/src/web/user/home.jsp
24,7 → 24,7
<%--</table>--%>
</td>
<td id="rightPagePortal">
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=${UserSession.user.roles}&from=Home"/>
<jsp:include page="/public/announcements/announcementsPortalRightHome.jsp?role=${UserSession.user.roles}&from=Home"/>
</td>
</tr>
</table>
44,7 → 44,7
<%--</table>--%>
</td>
<td id="rightPagePortal">
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=${UserSession.user.roles}&from=Home"/>
<jsp:include page="/public/announcements/announcementsPortalRightHome.jsp?role=${UserSession.user.roles}&from=Home"/>
</td>
</tr>
</table>
66,7 → 66,7
<%--</table> --%>
</td>
<td id="rightPagePortal">
<jsp:include page="/public/announcements/announcementsPortalRight.jsp?role=all&from=Home"/>
<jsp:include page="/public/announcements/announcementsPortalRightHome.jsp?role=all&from=Home"/>
</td>
</tr>
</table>
/impl/src/web/user/ftpclient/ftpclient.jsp
125,10 → 125,10
<tr class="dir">
<td colspan="3">
 
<a id="FTP_NODE_<%=++counter%>" style="display:none" href="javascript:if(confirmLink('<bean:message key="ftp.comfirm.delete" arg0="${i.name}"/>')){document.FormFtpManager.deleteFolder.value='<%=i.getName()%>';document.FormFtpManager.submit();}"><img border="0" src="<%=request.getContextPath()%>/imgs/delete.gif" alt="apagar"></a>
<a id="FTP_NODE_<%=++counter%>" style="display:none" href="javascript:if(confirmLink('<bean:message key="ftp.comfirm.delete" arg0="${i.nameHtml}"/>')){document.FormFtpManager.deleteFolder.value='<%=i.getNameHtml()%>';document.FormFtpManager.submit();}"><img border="0" src="<%=request.getContextPath()%>/imgs/delete.gif" alt="apagar"></a>
&nbsp;
<img alt="<%=i.getCompleteUrl()%>" src="<%=request.getContextPath()%>/imgs/folder.gif">&nbsp;<a
href="<%=i.getName(request)%>"><%=i.getName()%>
href="<%=i.getName(request)%>"><%=i.getNameEscapedHtml()%>
</a>
</td>
</tr>
212,8 → 212,7
<%
}
%>
<a target="_blank" href="<%=i.getCompleteUrl()%>"><%=i.getName()%>
</a>
<a target="_blank" href="<%=i.getCompleteUrl()%>"><%=i.getName()%></a>
 
</td>
<td>
/impl/src/web/user/reminders/reminders.jsp
42,9 → 42,7
 
<baco:isModuleOn module="reminders">
<div class="reminders">
<div id="reminderStatus">
 
</div>
<div class="new">
<div class="title">
<!--<a href="javascript:showOrHide('reminderForm');">-->
52,6 → 50,9
<!--</a>-->
 
</div>
<div id="reminderStatus">
 
</div>
<div id="reminderForm">
<form action="#" name="RemindersForm">
<table>
/impl/src/web/user/serviceZone/serviceZone.jsp
210,6 → 210,23
</ul>
</li>
</baco:isModuleOn>
<baco:isModuleOn module="srusource">
<li>
<bean:message key="srusource"/>
<ul>
<li>
<html:link target="_blank" action="/user/startNewSruSourceFromServiceZone">
<bean:message key="srusource.create.new"/>
</html:link>
</li>
<li>
<html:link target="_blank" action="/user/startChooseSruSourceFromServiceZone">
<bean:message key="srusource.edit.srusources"/>
</html:link>
</li>
</ul>
</li>
</baco:isModuleOn>
</baco:isAdmin>
<baco:hasRole role="identifiersManager,identifiersCollectionCreator">
<baco:isModuleOn module="manageidentifiers">
/impl/src/web/user/serviceZone/topnavCreateSruSource.jsp
New file
0,0 → 1,12
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@ page import="jomm.web.utils.NavPlace" %>
<%@ page import="jomm.web.utils.NavPlaceServer" %>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "srusource.create.srusource");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavChooseSruSources.jsp
New file
0,0 → 1,12
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@ page import="jomm.web.utils.NavPlace" %>
<%@ page import="jomm.web.utils.NavPlaceServer" %>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace(null, "srusource.choose.srusources");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/web/user/serviceZone/topnavLoadSruSource.jsp
New file
0,0 → 1,13
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@ page import="jomm.web.utils.NavPlace" %>
<%@ page import="jomm.web.utils.NavPlaceServer" %>
<%@ page import="jomm.web.utils.TopNav" %>
<%
TopNav topNav = NavPlaceServer.getInstance().createTopNav(request);
topNav.addNavPlace("/user/startServiceZone.do", "intranet.separator.service.zone.back");
topNav.addNavPlace("/user/startChooseSruSourceFromServiceZone.do", "srusource.edit.srusources");
topNav.addNavPlace(null, "srusource.edit.srusource");
%>
<jsp:include page="/layout/topnav.jsp"/>
/impl/src/xsd/curso_DAM.xml
1,5 → 1,6
<?xml version="1.0" encoding="UTF-8"?>
<curso xmlns="http://www.estgp.pt/xsd/planoestudos/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.estgp.pt/xsd/planoestudos/1.0/ planoestudos.xsd">
 
<nome>Design de Animação e Multimédia</nome>
<area>DG</area>
<semestre id="S1">
/impl/etc/solr/schema.xml
New file
0,0 → 1,106
<?xml version="1.0" encoding="UTF-8" ?>
 
 
<schema name="example" version="1.2">
 
 
<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/>
 
<!-- A Trie based date field for faster date range queries and date faceting. -->
<fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/>
 
<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ISOLatin1AccentFilterFactory"/>
<filter class="solr.SnowballPorterFilterFactory" language="Portuguese" protected="protwords.txt"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ISOLatin1AccentFilterFactory"/>
<filter class="solr.SnowballPorterFilterFactory" language="Portuguese" protected="protwords.txt"/>
</analyzer>
</fieldType>
 
<fieldType name="words" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ISOLatin1AccentFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ISOLatin1AccentFilterFactory"/>
<filter class="solr.SnowballPorterFilterFactory" language="Portuguese" protected="protwords.txt"/>
</analyzer>
</fieldType>
 
 
</types>
<fields>
 
<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="collection" type="string" indexed="true" stored="true"/>
<field name="text" type="text" indexed="true" multiValued="true" termVectors="true" termPositions="true" termOffsets="true"/>
<field name="fulltext" type="text" indexed="true" stored="true" multiValued="true"/>
<field name="fileDateTimeLastModified" type="string" indexed="true" stored="true"/>
<field name="fileDateLastModified" type="string" indexed="true" stored="true"/>
<field name="fileDateMonthLastModified" type="string" indexed="true" stored="true"/>
<field name="fileDateYearLastModified" type="string" indexed="true" stored="true"/>
<field name="url" type="string" indexed="false" stored="true"/>
<field name="baseUrl" type="string" indexed="true" stored="true"/>
<field name="fileType" type="string" indexed="true" stored="true"/>
<field name="fileSizeKB" type="int" indexed="true" stored="true"/>
<field name="fileRelativePath" type="string" indexed="true" stored="true"/>
<field name="fileAbsolutePath" type="string" indexed="true" stored="true"/>
<field name="fileRelativeDir" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="fileName" type="text" indexed="true" stored="true"/>
<field name="date" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="year" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="month" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="type" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="dir" type="string" indexed="true" stored="true" multiValued="true"/>
 
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>text</defaultSearchField>
<solrQueryParser defaultOperator="OR"/>
<copyField source="fulltext" dest="text"/>
<copyField source="fileName" dest="text"/>
 
<copyField source="fileDateYearLastModified" dest="year"/>
<copyField source="fileDateMonthLastModified" dest="month"/>
<copyField source="fileDateLastModified" dest="date"/>
<copyField source="fileType" dest="type"/>
<copyField source="fileRelativeDir" dest="dir"/>
 
 
 
</schema>
/impl/etc/solr/solrconfig.xml
New file
0,0 → 1,1070
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
 
http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
For more details about configurations options that may appear in this
file, see http://wiki.apache.org/solr/SolrConfigXml.
 
Specifically, the Solr Config can support XInclude, which may make it easier to manage
the configuration. See https://issues.apache.org/jira/browse/SOLR-1167
-->
<config>
<!-- Set this to 'false' if you want solr to continue working after it has
encountered an severe configuration error. In a production environment,
you may want solr to keep working even if one handler is mis-configured.
 
You may also set this to false using by setting the system property:
-Dsolr.abortOnConfigurationError=false
-->
<abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
 
<!-- lib directives can be used to instruct Solr to load an Jars identified
and use them to resolve any "plugins" specified in your solrconfig.xml or
schema.xml (ie: Analyzers, Request Handlers, etc...).
 
All directories and paths are resolved relative the instanceDir.
 
If a "./lib" directory exists in your instanceDir, all files found in it
are included as if you had used the following syntax...
<lib dir="./lib" />
-->
<!-- A dir option by itself adds any files found in the directory to the
classpath, this is useful for including all jars in a directory.
-->
<lib dir="../../contrib/extraction/lib" />
<!-- When a regex is specified in addition to a directory, only the files in that
directory which completely match the regex (anchored on both ends)
will be included.
-->
<lib dir="../../dist/" regex="apache-solr-cell-\d.*\.jar" />
<lib dir="../../dist/" regex="apache-solr-clustering-\d.*\.jar" />
<!-- If a dir option (with or without a regex) is used and nothing is found
that matches, it will be ignored
-->
<lib dir="../../contrib/clustering/lib/downloads/" />
<lib dir="../../contrib/clustering/lib/" />
<lib dir="/total/crap/dir/ignored" />
<!-- an exact path can be used to specify a specific file. This will cause
a serious error to be logged if it can't be loaded.
<lib path="../a-jar-that-does-not-exist.jar" />
-->
 
<!-- Used to specify an alternate directory to hold all index data
other than the default ./data under the Solr home.
If replication is in use, this should match the replication configuration. -->
<dataDir>${solr.data.dir:./solr/data}</dataDir>
 
 
<!-- WARNING: this <indexDefaults> section only provides defaults for index writers
in general. See also the <mainIndex> section after that when changing parameters
for Solr's main Lucene index. -->
<indexDefaults>
<!-- Values here affect all index writers and act as a default unless overridden. -->
<useCompoundFile>false</useCompoundFile>
 
<mergeFactor>10</mergeFactor>
<!-- If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush
based on whichever limit is hit first. -->
<!--<maxBufferedDocs>1000</maxBufferedDocs>-->
 
<!-- Sets the amount of RAM that may be used by Lucene indexing
for buffering added documents and deletions before they are
flushed to the Directory. -->
<ramBufferSizeMB>32</ramBufferSizeMB>
<!-- <maxMergeDocs>2147483647</maxMergeDocs> -->
<maxFieldLength>10000</maxFieldLength>
<writeLockTimeout>1000</writeLockTimeout>
<commitLockTimeout>10000</commitLockTimeout>
 
<!--
Expert: Turn on Lucene's auto commit capability. This causes intermediate
segment flushes to write a new lucene index descriptor, enabling it to be
opened by an external IndexReader. This can greatly slow down indexing
speed. NOTE: Despite the name, this value does not have any relation to
Solr's autoCommit functionality
-->
<!--<luceneAutoCommit>false</luceneAutoCommit>-->
 
<!--
Expert: The Merge Policy in Lucene controls how merging is handled by
Lucene. The default in 2.3 is the LogByteSizeMergePolicy, previous
versions used LogDocMergePolicy.
 
LogByteSizeMergePolicy chooses segments to merge based on their size. The
Lucene 2.2 default, LogDocMergePolicy chose when to merge based on number
of documents
 
Other implementations of MergePolicy must have a no-argument constructor
-->
<!--<mergePolicy class="org.apache.lucene.index.LogByteSizeMergePolicy"/>-->
 
<!--
Expert:
The Merge Scheduler in Lucene controls how merges are performed. The
ConcurrentMergeScheduler (Lucene 2.3 default) can perform merges in the
background using separate threads. The SerialMergeScheduler (Lucene 2.2
default) does not.
-->
<!--<mergeScheduler class="org.apache.lucene.index.ConcurrentMergeScheduler"/>-->
 
<!--
This option specifies which Lucene LockFactory implementation to use.
single = SingleInstanceLockFactory - suggested for a read-only index
or when there is no possibility of another process trying
to modify the index.
native = NativeFSLockFactory - uses OS native file locking
simple = SimpleFSLockFactory - uses a plain file for locking
 
(For backwards compatibility with Solr 1.2, 'simple' is the default
if not specified.)
-->
<lockType>native</lockType>
<!--
Expert:
Controls how often Lucene loads terms into memory -->
<!--<termIndexInterval>256</termIndexInterval>-->
</indexDefaults>
 
<mainIndex>
<!-- options specific to the main on-disk lucene index -->
<useCompoundFile>false</useCompoundFile>
<ramBufferSizeMB>32</ramBufferSizeMB>
<mergeFactor>10</mergeFactor>
<!-- Deprecated -->
<!--<maxBufferedDocs>1000</maxBufferedDocs>-->
<!--<maxMergeDocs>2147483647</maxMergeDocs>-->
 
<!-- inherit from indexDefaults <maxFieldLength>10000</maxFieldLength> -->
 
<!-- If true, unlock any held write or commit locks on startup.
This defeats the locking mechanism that allows multiple
processes to safely access a lucene index, and should be
used with care.
This is not needed if lock type is 'none' or 'single'
-->
<unlockOnStartup>false</unlockOnStartup>
<!-- If true, IndexReaders will be reopened (often more efficient) instead
of closed and then opened. -->
<reopenReaders>true</reopenReaders>
 
<!--
Expert:
Controls how often Lucene loads terms into memory. Default is 128 and is likely good for most everyone. -->
<!--<termIndexInterval>256</termIndexInterval>-->
 
<!--
Custom deletion policies can specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.
 
http://lucene.apache.org/java/2_3_2/api/org/apache/lucene/index/IndexDeletionPolicy.html
 
The standard Solr IndexDeletionPolicy implementation supports deleting
index commit points on number of commits, age of commit point and
optimized status.
 
The latest commit point should always be preserved regardless
of the criteria.
-->
<deletionPolicy class="solr.SolrDeletionPolicy">
<!-- The number of commit points to be kept -->
<str name="maxCommitsToKeep">1</str>
<!-- The number of optimized commit points to be kept -->
<str name="maxOptimizedCommitsToKeep">0</str>
<!--
Delete all commit points once they have reached the given age.
Supports DateMathParser syntax e.g.
<str name="maxCommitAge">30MINUTES</str>
<str name="maxCommitAge">1DAY</str>
-->
</deletionPolicy>
 
<!-- To aid in advanced debugging, you may turn on IndexWriter debug logging.
Setting to true will set the file that the underlying Lucene IndexWriter
will write its debug infostream to. -->
<infoStream file="INFOSTREAM.txt">false</infoStream>
 
</mainIndex>
 
<!-- Enables JMX if and only if an existing MBeanServer is found, use this
if you want to configure JMX through JVM parameters. Remove this to disable
exposing Solr configuration and statistics to JMX.
 
If you want to connect to a particular server, specify the agentId
e.g. <jmx agentId="myAgent" />
 
If you want to start a new MBeanServer, specify the serviceUrl
e.g <jmx serviceUrl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr"/>
 
For more details see http://wiki.apache.org/solr/SolrJmx
-->
<jmx />
 
<!-- the default high-performance update handler -->
<updateHandler class="solr.DirectUpdateHandler2">
<!-- A prefix of "solr." for class names is an alias that
causes solr to search appropriate packages, including
org.apache.solr.(search|update|request|core|analysis)
-->
 
<!-- Perform a <commit/> automatically under certain conditions:
maxDocs - number of updates since last commit is greater than this
maxTime - oldest uncommited update (in ms) is this long ago
Instead of enabling autoCommit, consider using "commitWithin"
when adding documents. http://wiki.apache.org/solr/UpdateXmlMessages
<autoCommit>
<maxDocs>10000</maxDocs>
<maxTime>1000</maxTime>
</autoCommit>
-->
 
 
<!-- The RunExecutableListener executes an external command from a
hook such as postCommit or postOptimize.
exe - the name of the executable to run
dir - dir to use as the current working directory. default="."
wait - the calling thread waits until the executable returns. default="true"
args - the arguments to pass to the program. default=nothing
env - environment variables to set. default=nothing
-->
<!-- A postCommit event is fired after every commit or optimize command
<listener event="postCommit" class="solr.RunExecutableListener">
<str name="exe">solr/bin/snapshooter</str>
<str name="dir">.</str>
<bool name="wait">true</bool>
<arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
<arr name="env"> <str>MYVAR=val1</str> </arr>
</listener>
-->
<!-- A postOptimize event is fired only after every optimize command
<listener event="postOptimize" class="solr.RunExecutableListener">
<str name="exe">snapshooter</str>
<str name="dir">solr/bin</str>
<bool name="wait">true</bool>
</listener>
-->
 
</updateHandler>
<!-- Use the following format to specify a custom IndexReaderFactory - allows for alternate
IndexReader implementations.
 
** Experimental Feature **
Please note - Using a custom IndexReaderFactory may prevent certain other features
from working. The API to IndexReaderFactory may change without warning or may even
be removed from future releases if the problems cannot be resolved.
 
** Features that may not work with custom IndexReaderFactory **
The ReplicationHandler assumes a disk-resident index. Using a custom
IndexReader implementation may cause incompatibility with ReplicationHandler and
may cause replication to not work correctly. See SOLR-1366 for details.
 
<indexReaderFactory name="IndexReaderFactory" class="package.class">
Parameters as required by the implementation
</indexReaderFactory >
-->
<!-- To set the termInfosIndexDivisor, do this: -->
<!--<indexReaderFactory name="IndexReaderFactory" class="org.apache.solr.core.StandardIndexReaderFactory">
<int name="termInfosIndexDivisor">12</int>
</indexReaderFactory >-->
 
 
<query>
<!-- Maximum number of clauses in a boolean query... in the past, this affected
range or prefix queries that expanded to big boolean queries - built in Solr
query parsers no longer create queries with this limitation.
An exception is thrown if exceeded. -->
<maxBooleanClauses>1024</maxBooleanClauses>
 
 
<!-- There are two implementations of cache available for Solr,
LRUCache, based on a synchronized LinkedHashMap, and
FastLRUCache, based on a ConcurrentHashMap. FastLRUCache has faster gets
and slower puts in single threaded operation and thus is generally faster
than LRUCache when the hit ratio of the cache is high (> 75%), and may be
faster under other scenarios on multi-cpu systems. -->
<!-- Cache used by SolrIndexSearcher for filters (DocSets),
unordered sets of *all* documents that match a query.
When a new searcher is opened, its caches may be prepopulated
or "autowarmed" using data from caches in the old searcher.
autowarmCount is the number of items to prepopulate. For LRUCache,
the autowarmed items will be the most recently accessed items.
Parameters:
class - the SolrCache implementation LRUCache or FastLRUCache
size - the maximum number of entries in the cache
initialSize - the initial capacity (number of entries) of
the cache. (seel java.util.HashMap)
autowarmCount - the number of entries to prepopulate from
and old cache.
-->
<filterCache
class="solr.FastLRUCache"
size="512"
initialSize="512"
autowarmCount="0"/>
 
<!-- Cache used to hold field values that are quickly accessible
by document id. The fieldValueCache is created by default
even if not configured here.
<fieldValueCache
class="solr.FastLRUCache"
size="512"
autowarmCount="128"
showItems="32"
/>
-->
 
<!-- queryResultCache caches results of searches - ordered lists of
document ids (DocList) based on a query, a sort, and the range
of documents requested. -->
<queryResultCache
class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="0"/>
 
<!-- documentCache caches Lucene Document objects (the stored fields for each document).
Since Lucene internal document ids are transient, this cache will not be autowarmed. -->
<documentCache
class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="0"/>
 
<!-- If true, stored fields that are not requested will be loaded lazily.
This can result in a significant speed improvement if the usual case is to
not load all stored fields, especially if the skipped fields are large
compressed text fields.
-->
<enableLazyFieldLoading>true</enableLazyFieldLoading>
 
<!-- Example of a generic cache. These caches may be accessed by name
through SolrIndexSearcher.getCache(),cacheLookup(), and cacheInsert().
The purpose is to enable easy caching of user/application level data.
The regenerator argument should be specified as an implementation
of solr.search.CacheRegenerator if autowarming is desired. -->
<!--
<cache name="myUserCache"
class="solr.LRUCache"
size="4096"
initialSize="1024"
autowarmCount="1024"
regenerator="org.mycompany.mypackage.MyRegenerator"
/>
-->
 
<!-- An optimization that attempts to use a filter to satisfy a search.
If the requested sort does not include score, then the filterCache
will be checked for a filter matching the query. If found, the filter
will be used as the source of document ids, and then the sort will be
applied to that.
<useFilterForSortedQuery>true</useFilterForSortedQuery>
-->
 
<!-- An optimization for use with the queryResultCache. When a search
is requested, a superset of the requested number of document ids
are collected. For example, if a search for a particular query
requests matching documents 10 through 19, and queryWindowSize is 50,
then documents 0 through 49 will be collected and cached. Any further
requests in that range can be satisfied via the cache. -->
<queryResultWindowSize>20</queryResultWindowSize>
 
<!-- Maximum number of documents to cache for any entry in the
queryResultCache. -->
<queryResultMaxDocsCached>200</queryResultMaxDocsCached>
 
<!-- a newSearcher event is fired whenever a new searcher is being prepared
and there is a current searcher handling requests (aka registered).
It can be used to prime certain caches to prevent long request times for
certain requests.
-->
<!-- QuerySenderListener takes an array of NamedList and executes a
local query request for each NamedList in sequence. -->
<listener event="newSearcher" class="solr.QuerySenderListener">
<arr name="queries">
<!--
<lst> <str name="q">solr</str> <str name="start">0</str> <str name="rows">10</str> </lst>
<lst> <str name="q">rocks</str> <str name="start">0</str> <str name="rows">10</str> </lst>
<lst><str name="q">static newSearcher warming query from solrconfig.xml</str></lst>
-->
</arr>
</listener>
 
<!-- a firstSearcher event is fired whenever a new searcher is being
prepared but there is no current registered searcher to handle
requests or to gain autowarming data from. -->
<listener event="firstSearcher" class="solr.QuerySenderListener">
<arr name="queries">
<lst> <str name="q">solr rocks</str><str name="start">0</str><str name="rows">10</str></lst>
<lst><str name="q">static firstSearcher warming query from solrconfig.xml</str></lst>
</arr>
</listener>
 
<!-- If a search request comes in and there is no current registered searcher,
then immediately register the still warming searcher and use it. If
"false" then all requests will block until the first searcher is done
warming. -->
<useColdSearcher>false</useColdSearcher>
 
<!-- Maximum number of searchers that may be warming in the background
concurrently. An error is returned if this limit is exceeded. Recommend
1-2 for read-only slaves, higher for masters w/o cache warming. -->
<maxWarmingSearchers>2</maxWarmingSearchers>
 
</query>
 
<!--
Let the dispatch filter handler /select?qt=XXX
handleSelect=true will use consistent error handling for /select and /update
handleSelect=false will use solr1.1 style error formatting
-->
<requestDispatcher handleSelect="true" >
<!--Make sure your system has some authentication before enabling remote streaming! -->
<requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" />
 
<!-- Set HTTP caching related parameters (for proxy caches and clients).
To get the behaviour of Solr 1.2 (ie: no caching related headers)
use the never304="true" option and do not specify a value for
<cacheControl>
-->
<!-- <httpCaching never304="true"> -->
<httpCaching lastModifiedFrom="openTime"
etagSeed="Solr">
<!-- lastModFrom="openTime" is the default, the Last-Modified value
(and validation against If-Modified-Since requests) will all be
relative to when the current Searcher was opened.
You can change it to lastModFrom="dirLastMod" if you want the
value to exactly corrispond to when the physical index was last
modified.
 
etagSeed="..." is an option you can change to force the ETag
header (and validation against If-None-Match requests) to be
differnet even if the index has not changed (ie: when making
significant changes to your config file)
 
lastModifiedFrom and etagSeed are both ignored if you use the
never304="true" option.
-->
<!-- If you include a <cacheControl> directive, it will be used to
generate a Cache-Control header, as well as an Expires header
if the value contains "max-age="
 
By default, no Cache-Control header is generated.
 
You can use the <cacheControl> option even if you have set
never304="true"
-->
<!-- <cacheControl>max-age=30, public</cacheControl> -->
</httpCaching>
</requestDispatcher>
 
 
<!-- requestHandler plugins... incoming queries will be dispatched to the
correct handler based on the path or the qt (query type) param.
Names starting with a '/' are accessed with the a path equal to the
registered name. Names without a leading '/' are accessed with:
http://host/app/select?qt=name
If no qt is defined, the requestHandler that declares default="true"
will be used.
-->
<requestHandler name="standard" class="solr.SearchHandler" default="true">
<!-- default values for query parameters -->
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="fl">
id,collection,fileDateYearLastModified,fileRelativeDir,fileDateMonthLastModified,fileDateTimeLastModified,fileDateTimeLastModified,fileDateLastModified,url,fileType,fileSizeKB,fileRelativePath,fileRelativeDir,fileName,score
</str>
<!--
<int name="rows">10</int>
<str name="fl">*</str>
<str name="version">2.1</str>
-->
<!-- example highlighter config, enable per-query with hl=true -->
<str name="hl.fl">fulltext</str>
<!-- for this field, we want no fragmenting, just highlighting -->
<str name="f.fulltext.hl.fragsize">300</str>
<!-- instructs Solr to return the field itself if no query terms are
found -->
<str name="f.name.hl.alternateField">name</str>
<str name="f.fulltext.hl.fragmenter">regex</str> <!-- defined below -->
 
 
 
<!-- omp = Only More Popular -->
<str name="spellcheck.onlyMorePopular">false</str>
<!-- exr = Extended Results -->
<str name="spellcheck.extendedResults">false</str>
<!-- The number of suggestions to return -->
<str name="spellcheck.count">1</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
 
<!-- Please refer to http://wiki.apache.org/solr/SolrReplication for details on configuring replication -->
<!-- remove the <lst name="master"> section if this is just a slave -->
<!-- remove the <lst name="slave"> section if this is just a master -->
<!--
<requestHandler name="/replication" class="solr.ReplicationHandler" >
<lst name="master">
<str name="replicateAfter">commit</str>
<str name="replicateAfter">startup</str>
<str name="confFiles">schema.xml,stopwords.txt</str>
</lst>
<lst name="slave">
<str name="masterUrl">http://localhost:8983/solr/replication</str>
<str name="pollInterval">00:00:60</str>
</lst>
</requestHandler>-->
 
<!-- DisMaxRequestHandler allows easy searching across multiple fields
for simple user-entered phrases. It's implementation is now
just the standard SearchHandler with a default query type
of "dismax".
see http://wiki.apache.org/solr/DisMaxRequestHandler
-->
<requestHandler name="dismax" class="solr.SearchHandler" >
<lst name="defaults">
<str name="defType">dismax</str>
<str name="echoParams">explicit</str>
<float name="tie">0.01</float>
<str name="qf">
text^1
</str>
<str name="pf">
text^1
</str>
<str name="mm">
2&lt;-1 5&lt;-2 6&lt;90%
</str>
<str name="fl">
id,score,dc_title,dc_creator,dc_subject,dc_date,dc_type,dc_language
</str>
<int name="ps">100</int>
<str name="q.alt">*:*</str>
<!-- example highlighter config, enable per-query with hl=true -->
<str name="hl.fl">fulltext</str>
<!-- for this field, we want no fragmenting, just highlighting -->
<str name="f.fulltext.hl.fragsize">300</str>
<!-- instructs Solr to return the field itself if no query terms are
found -->
<str name="f.name.hl.alternateField">name</str>
<str name="f.fulltext.hl.fragmenter">regex</str> <!-- defined below -->
 
<!-- omp = Only More Popular -->
<str name="spellcheck.onlyMorePopular">false</str>
<!-- exr = Extended Results -->
<str name="spellcheck.extendedResults">false</str>
<!-- The number of suggestions to return -->
<str name="spellcheck.count">1</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
 
<!-- Note how you can register the same handler multiple times with
different names (and different init parameters)
-->
<requestHandler name="partitioned" class="solr.SearchHandler" >
<lst name="defaults">
<str name="defType">dismax</str>
<str name="echoParams">explicit</str>
<str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str>
<str name="mm">2&lt;-1 5&lt;-2 6&lt;90%</str>
<!-- This is an example of using Date Math to specify a constantly
moving date range in a config...
-->
<str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str>
</lst>
<!-- In addition to defaults, "appends" params can be specified
to identify values which should be appended to the list of
multi-val params from the query (or the existing "defaults").
 
In this example, the param "fq=instock:true" will be appended to
any query time fq params the user may specify, as a mechanism for
partitioning the index, independent of any user selected filtering
that may also be desired (perhaps as a result of faceted searching).
 
NOTE: there is *absolutely* nothing a client can do to prevent these
"appends" values from being used, so don't use this mechanism
unless you are sure you always want it.
-->
<lst name="appends">
<str name="fq">inStock:true</str>
</lst>
<!-- "invariants" are a way of letting the Solr maintainer lock down
the options available to Solr clients. Any params values
specified here are used regardless of what values may be specified
in either the query, the "defaults", or the "appends" params.
 
In this example, the facet.field and facet.query params are fixed,
limiting the facets clients can use. Faceting is not turned on by
default - but if the client does specify facet=true in the request,
these are the only facets they will be able to see counts for;
regardless of what other facet.field or facet.query params they
may specify.
 
NOTE: there is *absolutely* nothing a client can do to prevent these
"invariants" values from being used, so don't use this mechanism
unless you are sure you always want it.
-->
<lst name="invariants">
<str name="facet.field">cat</str>
<str name="facet.field">manu_exact</str>
<str name="facet.query">price:[* TO 500]</str>
<str name="facet.query">price:[500 TO *]</str>
</lst>
</requestHandler>
 
 
<!--
Search components are registered to SolrCore and used by Search Handlers
By default, the following components are avaliable:
<searchComponent name="query" class="org.apache.solr.handler.component.QueryComponent" />
<searchComponent name="facet" class="org.apache.solr.handler.component.FacetComponent" />
<searchComponent name="mlt" class="org.apache.solr.handler.component.MoreLikeThisComponent" />
<searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" />
<searchComponent name="stats" class="org.apache.solr.handler.component.StatsComponent" />
<searchComponent name="debug" class="org.apache.solr.handler.component.DebugComponent" />
Default configuration in a requestHandler would look like:
<arr name="components">
<str>query</str>
<str>facet</str>
<str>mlt</str>
<str>highlight</str>
<str>stats</str>
<str>debug</str>
</arr>
 
If you register a searchComponent to one of the standard names, that will be used instead.
To insert components before or after the 'standard' components, use:
<arr name="first-components">
<str>myFirstComponentName</str>
</arr>
<arr name="last-components">
<str>myLastComponentName</str>
</arr>
-->
 
<!-- The spell check component can return a list of alternative spelling
suggestions. -->
<searchComponent name="spellcheck" class="solr.SpellCheckComponent">
 
<str name="queryAnalyzerFieldType">textSpell</str>
<!--<str name="queryAnalyzerFieldType">text</str>-->
<lst name="spellchecker">
<str name="name">default</str>
<str name="field">text</str>
<str name="buildOnCommit">true</str>
<str name="spellcheckIndexDir">./spellchecker</str>
</lst>
<!-- a spellchecker that uses a different distance measure
<lst name="spellchecker">
<str name="name">jarowinkler</str>
<str name="field">text</str>
<str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>
<str name="spellcheckIndexDir">./spellchecker2</str>
</lst>
-->
 
<!-- a file based spell checker
<lst name="spellchecker">
<str name="classname">solr.FileBasedSpellChecker</str>
<str name="name">file</str>
<str name="sourceLocation">spellings.txt</str>
<str name="characterEncoding">UTF-8</str>
<str name="spellcheckIndexDir">./spellcheckerFile</str>
</lst>
-->
</searchComponent>
 
<!-- A request handler utilizing the spellcheck component.
#############################################################################
NOTE: This is purely as an example. The whole purpose of the
SpellCheckComponent is to hook it into the request handler that handles (i.e.
the standard or dismax SearchHandler) queries such that a separate request is
not needed to get suggestions.
 
IN OTHER WORDS, THERE IS REALLY GOOD CHANCE THE SETUP BELOW IS NOT WHAT YOU
WANT FOR YOUR PRODUCTION SYSTEM!
#############################################################################
-->
<requestHandler name="/spell" class="solr.SearchHandler" lazy="true">
<lst name="defaults">
<!-- omp = Only More Popular -->
<str name="spellcheck.onlyMorePopular">false</str>
<!-- exr = Extended Results -->
<str name="spellcheck.extendedResults">false</str>
<!-- The number of suggestions to return -->
<str name="spellcheck.count">1</str>
</lst>
<arr name="last-components">
<str>spellcheck</str>
</arr>
</requestHandler>
 
<searchComponent name="tvComponent" class="org.apache.solr.handler.component.TermVectorComponent"/>
<!-- A Req Handler for working with the tvComponent. This is purely as an example.
You will likely want to add the component to your already specified request handlers. -->
<requestHandler name="tvrh" class="org.apache.solr.handler.component.SearchHandler">
<lst name="defaults">
<bool name="tv">true</bool>
</lst>
<arr name="last-components">
<str>tvComponent</str>
</arr>
</requestHandler>
 
<!-- Clustering Component
http://wiki.apache.org/solr/ClusteringComponent
This relies on third party jars which are not included in the release.
To use this component (and the "/clustering" handler)
Those jars will need to be downloaded, and you'll need to set the
solr.cluster.enabled system property when running solr...
java -Dsolr.clustering.enabled=true -jar start.jar
-->
<searchComponent
name="clusteringComponent"
enable="${solr.clustering.enabled:false}"
class="org.apache.solr.handler.clustering.ClusteringComponent" >
<!-- Declare an engine -->
<lst name="engine">
<!-- The name, only one can be named "default" -->
<str name="name">default</str>
<!--
Class name of Carrot2 clustering algorithm. Currently available algorithms are:
* org.carrot2.clustering.lingo.LingoClusteringAlgorithm
* org.carrot2.clustering.stc.STCClusteringAlgorithm
See http://project.carrot2.org/algorithms.html for the algorithm's characteristics.
-->
<str name="carrot.algorithm">org.carrot2.clustering.lingo.LingoClusteringAlgorithm</str>
<!--
Overriding values for Carrot2 default algorithm attributes. For a description
of all available attributes, see: http://download.carrot2.org/stable/manual/#chapter.components.
Use attribute key as name attribute of str elements below. These can be further
overridden for individual requests by specifying attribute key as request
parameter name and attribute value as parameter value.
-->
<str name="LingoClusteringAlgorithm.desiredClusterCountBase">20</str>
</lst>
<lst name="engine">
<str name="name">stc</str>
<str name="carrot.algorithm">org.carrot2.clustering.stc.STCClusteringAlgorithm</str>
</lst>
</searchComponent>
<requestHandler name="/clustering"
enable="${solr.clustering.enabled:false}"
class="solr.SearchHandler">
<lst name="defaults">
<bool name="clustering">true</bool>
<str name="clustering.engine">default</str>
<bool name="clustering.results">true</bool>
<!-- The title field -->
<str name="carrot.title">dc_title</str>
<str name="carrot.url">id</str>
<!-- The field to cluster on -->
<str name="carrot.snippet">features</str>
<!-- produce summaries -->
<bool name="carrot.produceSummary">true</bool>
<!-- the maximum number of labels per cluster -->
<!--<int name="carrot.numDescriptions">5</int>-->
<!-- produce sub clusters -->
<bool name="carrot.outputSubClusters">true</bool>
</lst>
<arr name="last-components">
<str>clusteringComponent</str>
</arr>
</requestHandler>
<!-- Solr Cell: http://wiki.apache.org/solr/ExtractingRequestHandler -->
<requestHandler name="/update/extract" class="org.apache.solr.handler.extraction.ExtractingRequestHandler" startup="lazy">
<lst name="defaults">
<!-- All the main content goes into "text"... if you need to return
the extracted text or do highlighting, use a stored field. -->
<str name="fmap.content">text</str>
<str name="lowernames">true</str>
<str name="uprefix">ignored_</str>
 
<!-- capture link hrefs but ignore div attributes -->
<str name="captureAttr">true</str>
<str name="fmap.a">links</str>
<str name="fmap.div">ignored_</str>
</lst>
</requestHandler>
 
 
<!-- A component to return terms and document frequency of those terms.
This component does not yet support distributed search. -->
<searchComponent name="termsComponent" class="org.apache.solr.handler.component.TermsComponent"/>
 
<requestHandler name="/terms" class="org.apache.solr.handler.component.SearchHandler">
<lst name="defaults">
<bool name="terms">true</bool>
</lst>
<arr name="components">
<str>termsComponent</str>
</arr>
</requestHandler>
 
 
<!-- a search component that enables you to configure the top results for
a given query regardless of the normal lucene scoring.-->
<searchComponent name="elevator" class="solr.QueryElevationComponent" >
<!-- pick a fieldType to analyze queries -->
<str name="queryFieldType">string</str>
<str name="config-file">elevate.xml</str>
</searchComponent>
 
<!-- a request handler utilizing the elevator component -->
<requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<str name="echoParams">explicit</str>
</lst>
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>
 
 
<!-- Update request handler.
 
Note: Since solr1.1 requestHandlers requires a valid content type header if posted in
the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8'
The response format differs from solr1.1 formatting and returns a standard error code.
To enable solr1.1 behavior, remove the /update handler or change its path
-->
<requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
 
 
<requestHandler name="/update/javabin" class="solr.BinaryUpdateRequestHandler" />
 
<!--
Analysis request handler. Since Solr 1.3. Use to return how a document is analyzed. Useful
for debugging and as a token server for other types of applications.
 
This is deprecated in favor of the improved DocumentAnalysisRequestHandler and FieldAnalysisRequestHandler
 
<requestHandler name="/analysis" class="solr.AnalysisRequestHandler" />
-->
 
<!--
An analysis handler that provides a breakdown of the analysis process of provided docuemnts. This handler expects a
(single) content stream with the following format:
 
<docs>
<doc>
<field name="id">1</field>
<field name="name">The Name</field>
<field name="text">The Text Value</field>
<doc>
<doc>...</doc>
<doc>...</doc>
...
</docs>
 
Note: Each document must contain a field which serves as the unique key. This key is used in the returned
response to assoicate an analysis breakdown to the analyzed document.
 
Like the FieldAnalysisRequestHandler, this handler also supports query analysis by
sending either an "analysis.query" or "q" request paraemter that holds the query text to be analyized. It also
supports the "analysis.showmatch" parameter which when set to true, all field tokens that match the query
tokens will be marked as a "match".
-->
<requestHandler name="/analysis/document" class="solr.DocumentAnalysisRequestHandler" />
 
<!--
RequestHandler that provides much the same functionality as analysis.jsp. Provides the ability
to specify multiple field types and field names in the same request and outputs index-time and
query-time analysis for each of them.
 
Request parameters are:
analysis.fieldname - The field name whose analyzers are to be used
analysis.fieldtype - The field type whose analyzers are to be used
analysis.fieldvalue - The text for index-time analysis
q (or analysis.q) - The text for query time analysis
analysis.showmatch (true|false) - When set to true and when query analysis is performed, the produced
tokens of the field value analysis will be marked as "matched" for every
token that is produces by the query analysis
-->
<requestHandler name="/analysis/field" class="solr.FieldAnalysisRequestHandler" />
 
 
<!-- CSV update handler, loaded on demand -->
<requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
 
 
<!--
Admin Handlers - This will register all the standard admin RequestHandlers. Adding
this single handler is equivalent to registering:
<requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" />
<requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" />
<requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" />
<requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" />
<requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" />
<requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
If you wish to hide files under ${solr.home}/conf, explicitly register the ShowFileRequestHandler using:
<requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
<lst name="invariants">
<str name="hidden">synonyms.txt</str>
<str name="hidden">anotherfile.txt</str>
</lst>
</requestHandler>
-->
<requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
 
<!-- ping/healthcheck -->
<requestHandler name="/admin/ping" class="PingRequestHandler">
<lst name="defaults">
<str name="qt">standard</str>
<str name="q">solrpingquery</str>
<str name="echoParams">all</str>
</lst>
</requestHandler>
 
<!-- Echo the request contents back to the client -->
<requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
<lst name="defaults">
<str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' -->
<str name="echoHandler">true</str>
</lst>
</requestHandler>
 
<highlighting>
<!-- Configure the standard fragmenter -->
<!-- This could most likely be commented out in the "default" case -->
<fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true">
<lst name="defaults">
<int name="hl.fragsize">300</int>
</lst>
</fragmenter>
 
<!-- A regular-expression-based fragmenter (f.i., for sentence extraction) -->
<fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">
<lst name="defaults">
<!-- slightly smaller fragsizes work better because of slop -->
<int name="hl.fragsize">300</int>
<!-- allow 50% slop on fragment sizes -->
<float name="hl.regex.slop">0.5</float>
<!-- a basic sentence pattern -->
<str name="hl.regex.pattern">[-\w ,/\n\"']{20,300}</str>
</lst>
</fragmenter>
 
<!-- Configure the standard formatter -->
<formatter name="html" class="org.apache.solr.highlight.HtmlFormatter" default="true">
<lst name="defaults">
<str name="hl.simple.pre"><![CDATA[<em>]]></str>
<str name="hl.simple.post"><![CDATA[</em>]]></str>
</lst>
</formatter>
</highlighting>
 
<!-- An example dedup update processor that creates the "id" field on the fly
based on the hash code of some other fields. This example has overwriteDupes
set to false since we are using the id field as the signatureField and Solr
will maintain uniqueness based on that anyway.
You have to link the chain to an update handler above to use it ie:
<requestHandler name="/update "class="solr.XmlUpdateRequestHandler">
<lst name="defaults">
<str name="update.processor">dedupe</str>
</lst>
</requestHandler>
-->
<!--
<updateRequestProcessorChain name="dedupe">
<processor class="org.apache.solr.update.processor.SignatureUpdateProcessorFactory">
<bool name="enabled">true</bool>
<str name="signatureField">id</str>
<bool name="overwriteDupes">false</bool>
<str name="fields">name,features,cat</str>
<str name="signatureClass">org.apache.solr.update.processor.Lookup3Signature</str>
</processor>
<processor class="solr.LogUpdateProcessorFactory" />
<processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>
-->
 
 
<!-- queryResponseWriter plugins... query responses will be written using the
writer specified by the 'wt' request parameter matching the name of a registered
writer.
The "default" writer is the default and will be used if 'wt' is not specified
in the request. XMLResponseWriter will be used if nothing is specified here.
The json, python, and ruby writers are also available by default.
 
<queryResponseWriter name="xml" class="org.apache.solr.request.XMLResponseWriter" default="true"/>
<queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter"/>
<queryResponseWriter name="python" class="org.apache.solr.request.PythonResponseWriter"/>
<queryResponseWriter name="ruby" class="org.apache.solr.request.RubyResponseWriter"/>
<queryResponseWriter name="php" class="org.apache.solr.request.PHPResponseWriter"/>
<queryResponseWriter name="phps" class="org.apache.solr.request.PHPSerializedResponseWriter"/>
 
<queryResponseWriter name="custom" class="com.example.MyResponseWriter"/>
-->
 
<!-- XSLT response writer transforms the XML output by any xslt file found
in Solr's conf/xslt directory. Changes to xslt files are checked for
every xsltCacheLifetimeSeconds.
-->
<queryResponseWriter name="xslt" class="org.apache.solr.request.XSLTResponseWriter">
<int name="xsltCacheLifetimeSeconds">5</int>
</queryResponseWriter>
 
 
<!-- example of registering a query parser
<queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/>
-->
 
<!-- example of registering a custom function parser
<valueSourceParser name="myfunc" class="com.mycompany.MyValueSourceParser" />
-->
 
<!-- config for the admin interface -->
<admin>
<defaultQuery>solr</defaultQuery>
 
<!-- configure a healthcheck file for servers behind a loadbalancer
<healthcheck type="file">server-enabled</healthcheck>
-->
</admin>
 
</config>
/impl/etc/solr/telHandler.war
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/etc/solr/1.3ScriptsDonald.zip
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/etc/solr/solrManager-jar-with-dependencies.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/impl/etc/solr/README
New file
0,0 → 1,5
To index shared folders
 
Use SOLR 1.4 and replace the configuration files
Than install the telHaldler SRU Application to work as bridge with SOLR
Finnaly use the SOLR indexer Manager to preprocess and index folders