Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 456 → Rev 457

/impl/conf/language/MessageResourcesSruSources.properties
11,19 → 11,26
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 Collecção
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.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?
/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
/impl/conf/WEB-INF/struts/struts-srusource.xml
20,16 → 20,13
 
<action-mappings>
 
 
 
<action path="/findProfile" forward="page.find.profile"/>
 
 
 
 
<!--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"
39,6 → 36,8
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>
 
/impl/conf/WEB-INF/struts/tiles-srusource.xml
17,6 → 17,15
<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>
 
 
 
/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>
1419,6 → 1429,17
</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>
1430,15 → 1451,26
<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/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);
 
/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/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/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,8
public int getMaxResultsPage();
public String getQuery();
public String getSearchType();
public String getModuleInternalKey();
public String getDescription();
 
 
}
/impl/src/java/pt/estgp/estgweb/services/common/impl/DefaultResult.java
21,6 → 21,7
private boolean titleKey = false;
private boolean subTitleKey = false;
private boolean textKey = false;
private boolean absoluteUrl = false;
 
private LabelGroup subTitlesGroup = null;
 
104,4 → 105,13
{
this.subTitlesGroup = subTitlesGroup;
}
 
 
public boolean isAbsoluteUrl() {
return absoluteUrl;
}
 
public void setAbsoluteUrl(boolean absoluteUrl) {
this.absoluteUrl = absoluteUrl;
}
}
/impl/src/java/pt/estgp/estgweb/services/common/impl/DefaultSearchResults.java
26,6 → 26,8
private int maxResultsPage;
private String query;
private String searchType;
private String moduleInternalKey = null;
private String description;
 
 
public ModuleEnum getModule() {
124,8 → 126,25
public String getSearchType() {
return searchType;
}
 
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;
}
}
/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/CommonServicesManager.java
75,12 → 75,16
{
if (module.getModuleCommonServices() != null)
{
ISearchResults iSearchResults = search(userSession, query, searchType, module, 0, from);
if (iSearchResults != null && iSearchResults.getTotalResults() > 0)
{
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);
104,7 → 108,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 → 116,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("'", " "));
150,10 → 158,8
}
}
}
return searchResults;
}
else
return null;
return searchResultsList;
}
catch (FilterRetrieveException e)
{
/impl/src/java/pt/estgp/estgweb/services/common/IResult.java
19,6 → 19,7
public String getText();
public boolean isTextKey();
public String getUrl();
public boolean isAbsoluteUrl();
public LabelGroup getSubTitlesGroup();
 
/**
/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/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/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);
 
/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);
 
/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);
75,6 → 75,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/SruSourcesCommonServices.java
40,7 → 40,7
* <p/>
* Created at 17/Out/2003 , 23:45:24
*/
public class SruSourcesCommonServices implements IService, IModuleCommonServices
public class SruSourcesCommonServices extends MultipleSearchResults implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(SruSourcesCommonServices.class);
51,21 → 51,35
return 0;
}
 
public ISearchResults search(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)
{
return search(null, search, searchType, page, maxResults, userSession);
return searchList(moduleInternalKey, null, search, searchType, page, maxResults, userSession);
}
 
public ISearchResults search(String from, 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)
{
DefaultSearchResults searchResults = new DefaultSearchResults();
searchResults.setModule(ModuleEnum.SruSource);
List<ISearchResults> searchResults = new ArrayList<ISearchResults>();
 
if(userSession.getUser() == null)
return searchResults;
 
List<SruSource> sruSources = DaoFactory.getSruSourceDaoImpl().findAll();
List<SruSourceView> admitedSources = new ArrayList<SruSourceView>();
//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>();
86,89 → 100,98
 
if(admitedSources.size() > 0)
{
SruSourceView sruSourceView = admitedSources.get(0);
 
try
for(SruSourceView sruSourceView: admitedSources)
{
StringBuilder collectionQuery = new StringBuilder();
String appender = "";
for(SruSourceCollectionView collectionView: sruSourceView.getCollections())
DefaultSearchResults searchResultsSource = new DefaultSearchResults();
searchResultsSource.setResults(new ArrayList<IResult>());
searchResultsSource.setModuleInternalKey("" + sruSourceView.getId());
searchResultsSource.setModule(ModuleEnum.SruSource);
searchResultsSource.setDescription(sruSourceView.getName());
try
{
collectionQuery.append(appender).append(collectionView.getCollection());
appender = " OR ";
}
String finalQuery = sruSourceView.getCollectionField() + ":(" + collectionQuery.toString() + ") AND (" + search + ")";
logger.error("Sru server " + sruSourceView.getName() + " final query: " + finalQuery);
String sruRequest = sruSourceView.getUrl() + "?query=" + URLEncoder.encode(finalQuery,"UTF-8") + "&verb=getSRUResponseWithThisQuery&startRecord=" + page + "&maximumRecords=" + maxResults;
URL url = new URL(sruRequest);
Document dom = Dom4jUtil.parse(url);
StringBuilder collectionQuery = new StringBuilder();
String appender = "";
for(SruSourceCollectionView collectionView: sruSourceView.getCollections())
{
collectionQuery.append(appender).append(collectionView.getCollection());
appender = " OR ";
}
String finalQuery = sruSourceView.getCollectionField() + ":(" + collectionQuery.toString() + ") AND (" + search + ")";
logger.error("Sru server " + sruSourceView.getName() + " final query: " + finalQuery);
String sruRequest = sruSourceView.getUrl() + "?query=" + URLEncoder.encode(finalQuery,"UTF-8") + "&verb=getSRUResponseWithThisQuery&startRecord=" + page + "&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/");
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)
return searchResults;
searchResults.setTotalResults(Integer.parseInt(numberOfRecords.getTextTrim()));
XPath xPathNumberOfRecords = dom.createXPath("//srw:numberOfRecords");
xPathNumberOfRecords.setNamespaceURIs(namespaces);
Element numberOfRecords = (Element) xPathNumberOfRecords.selectSingleNode(dom);
if(numberOfRecords == null)
return searchResults;
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);
if(fileRelativePath != null )
XPath xPathRecords = dom.createXPath("//files:doc");
xPathRecords.setNamespaceURIs(namespaces);
List<Element> docs = xPathRecords.selectNodes(dom);
for(Element doc: docs)
{
XPath xPathFileUrl = dom.createXPath("./files:url");
xPathFileUrl.setNamespaceURIs(namespaces);
Object fileUrl = xPathFileUrl.selectSingleNode(doc);
if(fileUrl != null)
XPath xPathFileRelativePath = dom.createXPath("./files:fileRelativePath");
xPathFileRelativePath.setNamespaceURIs(namespaces);
Object fileRelativePath = xPathFileRelativePath.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();
defaultResult.setTitle(((Element)fileRelativePath).getText());
DefaultResult defaultResult = new DefaultResult();
defaultResult.setTitle(((Element)fileRelativePath).getText());
// defaultResult.setSubTitle(courseUnit.getCourseName());
// defaultResult.setSubTitleKey(false);
// defaultResult.setText(courseUnit.getObjectives());
defaultResult.setUrl(((Element)fileUrl).getTextTrim());
defaultResult.setUrl(((Element)fileUrl).getTextTrim());
defaultResult.setAbsoluteUrl(true);
 
XPath xPathCollection = dom.createXPath("./files:collection");
xPathFileUrl.setNamespaceURIs(namespaces);
Element collection = (Element) xPathCollection.selectSingleNode(doc);
defaultResult.setSubTitle(collection.getTextTrim());
XPath xPathCollection = dom.createXPath("./files:collection");
xPathFileUrl.setNamespaceURIs(namespaces);
Element collection = (Element) xPathCollection.selectSingleNode(doc);
defaultResult.setSubTitle(collection.getTextTrim());
 
 
XPath xPathFragment = dom.createXPath("./files:snippet/files:fragment");
xPathFragment.setNamespaceURIs(namespaces);
List<Element> fragments = (List<Element>) xPathFragment.selectNodes(doc);
Element fragmentsA = (Element) xPathFragment.selectSingleNode(doc);
Object fragmentsB = xPathFragment.evaluate(doc);
if(fragments != null)
{
defaultResult.setBestFragments("");
for(Element fragment: fragments)
XPath xPathFragment = dom.createXPath("./files:snippet/files:fragment");
xPathFragment.setNamespaceURIs(namespaces);
List<Element> fragments = (List<Element>) xPathFragment.selectNodes(doc);
if(fragments != null)
{
defaultResult.setBestFragments(defaultResult.getBestFragments() + " ... " + fragment.getTextTrim().replace("<em>","<b><i>").replace("</em>","</i></b>"));
defaultResult.setBestFragments("");
for(Element fragment: fragments)
{
defaultResult.setBestFragments(defaultResult.getBestFragments() + " ... " + fragment.getTextTrim().replace("<em>","<b><i>").replace("</em>","</i></b>"));
}
}
searchResultsSource.addResult(defaultResult);
}
searchResults.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 + " path:" + ((Element)fileRelativePath).getText() );
logger.warn("File retured from SRU without filePath query:" + search + " page:" + page);
}
else
logger.warn("File retured from SRU without filePath query:" + search + " page:" + page);
 
}
catch (Throwable e)
{
logger.error(e,e);
}
 
if(searchResultsSource.getResults() != null && searchResultsSource.getResults().size() > 0)
searchResults.add(searchResultsSource);
}
catch (Throwable e)
{
logger.error(e,e);
}
}
return searchResults;
}
/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/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/web/form/srusource/SruSourceForm.java
23,6 → 23,7
 
private SruSourceView sruSourceView = new SruSourceView();
private SruSourceCollectionView sruSourceCollectionView = new SruSourceCollectionView();
private long auxId;
 
 
public SruSourceForm()
57,6 → 58,14
this.sruSourceView = sruSourceView;
}
 
public long getAuxId() {
return auxId;
}
 
public void setAuxId(long auxId) {
this.auxId = auxId;
}
 
public SruSourceCollectionView getSruSourceCollectionView() {
return sruSourceCollectionView;
}
/impl/src/java/pt/estgp/estgweb/web/controllers/srusource/SruSourceController.java
87,50 → 87,42
else
addMessage(request, "srusource.edited.success");
 
// UserView userView = profileForm.getUserView();
// try
// {
// UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request, response);
// userView.setUserRoles((List<String>) userSession.get(TARGET_ROLES_KEY));
// IServiceManager sm = ServiceManager.getInstance();
// String[] names = new String[]{"object"};
// Object[] args = new Object[]{userView, profileForm.getTypeClass()};
// try
// {
// userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "SubmitUser", args, names);
// }
// catch (AlreadyExistsException e)
// {
// if(profileForm.getUserView().getId() > 0)
// {
// UserView uV = loadUser(profileForm.getUserView().getId(), request, response);
// profileForm.getUserView().setPasswordLocal(uV.isPasswordLocal());
// }
// addErrorWithKeys(request,"user.exists",e.getMessage());
// return mapping.getInputForward();
// }
// profileForm.setUserView(userView);
// if (userSession.getUser().getId() == userView.getId())
// {
// userSession.setUser(userView.getUser());
// request.setAttribute(Globals.USER_SESSION_KEY, userSession);
// logger.info("Puting new user info in session:" + userView.getId());
// }
// addMessage(request, "profile.edited.sucess");
return mapping.findForward("success");
// }
// catch (FilterChainFailedException e)
// {
// return mapping.findForward("error401");
// }
// catch (Throwable e)
// {
// logger.error(e, e);
// throw e;
// }
}
 
 
 
 
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,
191,13 → 183,28
 
 
 
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};
SruSourceView sruSourceView = (SruSourceView) sm.execute(RequestUtils.getRequester(request, response), "LoadSruSourceById", args, names);
return sruSourceView;
return (SruSourceView) sm.execute(RequestUtils.getRequester(request, response), "LoadSruSourceById", args, names);
}
 
 
210,65 → 217,19
try
{
 
SruSourceForm sruSourceForm = (SruSourceForm) form;
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{new Long(request.getParameter("id"))};
Boolean status = (Boolean) sm.execute(RequestUtils.getRequester(request, response), "DeleteUser", args, names);
if (status)
{
addMessage(request, "user.deleted.sucess");
return mapping.findForward("success");
}
else
{
addMessage(request, "user.deleted.fail");
return mapping.findForward("success");
}
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
Object[] args = new Object[]{sruSourceForm.getSruSourceView().getId()};
Boolean status = (Boolean) sm.execute(RequestUtils.getRequester(request, response), "DeleteSruSource", args, names);
 
public ActionForward createRecord(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
ProfileForm profileForm = (ProfileForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"object"};
 
Object[] args;
if (profileForm.getUploadFile() != null)
args = new Object[]{profileForm.getRecordView(), profileForm.getUploadFile().getInputStream(), profileForm.getUploadFile().getFileName(), profileForm.getUploadFile().getContentType(), profileForm.getUploadFile().getFileSize()};
if (status != null && status)
addMessage(request, "srusource.deleted.sucess");
else
args = new Object[]{profileForm.getRecordView(), null, null, null, 0};
addMessage(request, "srusource.deleted.fail");
 
boolean newRecord = false;
if(profileForm.getRecordView().getId() <= 0)
newRecord = true;
UserView userView;
if (profileForm.getRecordView().getId() > 0)
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "EditUserProfileRecord", args, names);
else
userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "CreateUserProfileRecord", args, names);
 
if(newRecord)
addMessage(request, "profile.record.add.sucess", profileForm.getRecordView().getTitle());
else
addMessage(request, "profile.record.updated.sucess", profileForm.getRecordView().getTitle());
profileForm.setUserView(userView);
return mapping.findForward("home");
return mapping.findForward("loadSruSources");
}
catch (FilterChainFailedException e)
{
281,66 → 242,5
}
}
 
public ActionForward deleteRecord(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
ProfileForm profileForm = (ProfileForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args;
args = new Object[]{profileForm.getRecordView().getId()};
 
UserView userView = (UserView) sm.execute(RequestUtils.getRequester(request, response), "DeleteUserProfileRecord", args, names);
addMessage(request, "profile.record.deleted.sucess");
profileForm.setUserView(userView);
return mapping.findForward("home");
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
public ActionForward loadEditRecord(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
ProfileForm profileForm = (ProfileForm) form;
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args;
args = new Object[]{profileForm.getRecordView().getId()};
 
RecordView recordView = (RecordView) sm.execute(RequestUtils.getRequester(request, response), "LoadEditUserProfileRecord", args, names);
UserView uV = recordView.getOwnerUserView();
// addMessage(request, "profile.record.deleted.sucess");
profileForm.setUserView(uV);
profileForm.setRecordView(recordView);
return mapping.findForward("curriculum");
}
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
76,7 → 76,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/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
17,6 → 17,7
<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">
44,6 → 45,7
</th>
<td>
<html:text styleClass="text" property="sruSourceView.url" maxlength="250"/>
(e.g: http://deptal.estgp.pt:8983/telHandler/Handler2)
</td>
</tr>
<tr>
87,6 → 89,9
</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>
104,7 → 109,10
</tr>
<tr>
<th><bean:message key="srusource.collection"/></th>
<td><html:text property="sruSourceCollectionView.collection"/></td>
<td>
<html:hidden property="sruSourceCollectionView.id"/>
<html:text property="sruSourceCollectionView.collection"/>
</td>
</tr>
<tr>
<th>
119,8 → 127,7
<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();">
<input type="button" value="<bean:message key="add"/>" onclick="set(this.form,'addRole');this.form.submit();">
</logic:present>
</html:select>
 
/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/js/ajax.js
281,6 → 281,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,88
<%@ 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">
<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"/>
 
 
<%
if(request.getParameter("size") == null)
{
%>
<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>
<%
}
else if(request.getParameter("size").equals("small"))
{
%>
<table>
<tr>
<td style="vertical-align:middle; white-space:nowrap;">
<html:image page="/imgs/lupa.gif" altKey="search"/><input type="text" class="small" name="query" value="<%=query%>"/> <input type="submit" value=">>">
</td>
</tr>
</table>
<input type="hidden" name="searchType" value="search.type.all"/>
<%
}
%>
</html:form>
</td>
</baco:isModuleOn>
/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/search/searchResults.jsp
142,7 → 142,12
type="pt.estgp.estgweb.services.common.ISearchResults">
<li>
<h1>
<bean:message key="${searchResults.module.messageKey}"/>
<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>(${searchResults.totalResults})</b>
<a id="${searchResults.module.messageKey}SeeMore"
href="javascript:showOrHideOne('${searchResults.module.messageKey}')">
164,7 → 169,20
<div class="result">
<h2>
<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}
207,14 → 225,14
<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')">
<a href="javascript:searchCall('${searchResults.module.messageKey}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>
${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')">
<a href="javascript:searchCall('${searchResults.module.messageKey}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>
/impl/src/web/public/search/searchResultsModule.jsp
9,7 → 9,27
<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>
 
<h2>
<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="subTitle">
(
<logic:equal value="true" name="result" property="subTitleKey">
25,13 → 45,13
<p>${result.bestFragments} ...</p>
</div>
</logic:iterate>
Pages:
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>
<a href="javascript:searchCall('${ISearchResults.module.messageKey}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}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.nextPage}','${ISearchResults.module.messageKey}','<%=request.getContextPath()%>/search.do')">next &gt;</a>
<a href="javascript:searchCall('${ISearchResults.module.messageKey}Results','${ISearchResults.query}','${ISearchResults.searchType}','${ISearchResults.nextPage}','${ISearchResults.module.messageKey}','${ISearchResults.moduleInternalKey}','<%=request.getContextPath()%>/search.do')">next &gt;</a>
</logic:equal>
 
 
/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>
<baco:isAuthenticated>
<tr>
<td>
<jsp:include page="/layout/searchForm.jsp?size=small"/>
</td>
</tr>
<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>
<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/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/courseunits/menu.jsp
1,4 → 1,9
<%@ 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 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" %>
50,7 → 55,7
<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>-->
<li>
<a href="<%=request.getContextPath()%>${user}/startLoadCourseUnitWorks${fromAction}.do?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.menu.assignements"/></a>
68,18 → 73,71
<html:link action="${user}/startLoadCourseUnitStudents${fromAction}?courseUnitView.id=${CourseUnitView.id}"><bean:message key="courseunit.students"/></html:link>
</li>
 
<baco:isAuthenticated>
<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>
</baco:isAuthenticated>
 
<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/serviceZone/serviceZone.jsp
219,6 → 219,11
<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>
/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"/>