Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 119 → Rev 135

/impl/conf/language/MessageResourcesAnnouncements.properties
4,7 → 4,7
#
################################################################################
module.Announcements=Anúncios
 
a
announcement.title=Titulo
announcement.text=Texto
announcement.startDate=Data de Aparecimento
14,11 → 14,17
announcement.typeAnnouncement=Tipo
announcement.sendAnnouncementLike=Enviar como
announcement.priorityAnnouncement=Prioridade
announcement.linkAnnouncement=Url
announcement.linkAnnouncement=URL
announcement.internalLinkAnnouncement=URL interno do sistema
announcement.target.roles=Pessoas a quem destina
announcement.created.success=Anúncio criado com sucesso
announcement.edited.success=Anúncio alterado com sucesso
announcement.created.success=Anúncio criado com sucesso: <a href="{0}/loadAnnouncement.do?id={1}&dispatch=load">{2}</a>
announcement.edited.success=Anúncio alterado com sucesso: <a href="{0}/loadAnnouncement.do?id={1}&dispatch=load">{2}</a>
announcement.deleted.success=Anúncio apagado com sucesso
announcement.deleted.fail=Não foi possivel apagar o anuncio
announcement.status=Válido
announcement.internal=Dominio
announcement.internal.yes=Interno
announcement.internal.no=Público
 
 
announcements.type.news=Notícias
31,3 → 37,14
 
announcements.loading=carregando anúncio...
 
announcement.style.img.left=Imagem à esquerda
announcement.style.img.right=Imagem à direita
announcement.style.img.top=Imagem em cima
announcement.style.img.embedded.left=Imagem embebida à esquerda
announcement.style.img.embedded.right=Imagem embebida à direita
 
announcement.internal.url.include.yes=Incluir o conteudo
announcement.internal.url.include.no=Referênciar o conteudo
 
announcement.image.style=Estilo visual
 
/impl/conf/language/MessageResources.properties
223,24 → 223,33
username=Nome de Utilizador
password=Password
submit=Entrar
edit=Editar
confirm=Confirmar
add=Adicionar
remove=Remover
yes=Sim
no=Não
edit=Editar
 
#Login
login.firts.time.name=Nome
login.first.time.username=Username
login.first.time.name=Nome
login.first.time.targets=Permissões
login.first.time.bi=BI
login.first.time.address=Morada
login.first.time.zip=Código Postal
login.first.time.birthday.date=Data de Nascimento
login.first.time.country=País
login.first.time.email=E-mail
login.first.time.email.institucion=E-mail Institucional*
login.first.time.email.institucion2=E-mail Institucional
login.first.time.email.secundary=E-mail Secundário
login.first.time.phone.number=Telefone
 
#Profile
profile.edited.sucess=Perfil alterado com sucesso
profile.enter.first.time=É a primeira vez que se esta a ligar, seja bem-vindo {0}
profile.edit=Aqui pode editar o seu perfil
profile.email.change=*Para alterar o seu email dirija-se aos serviços centrais
profile.search.user=Procurar Utilizador
 
#Cursos
/impl/conf/WEB-INF/struts/struts-default.xml
137,20 → 137,10
<forward name="load" path="page.load.profile"/>
<forward name="search" path="page.find.profile"/>
</action>
<!--<action path="/profileAdmin"
type="pt.estgp.estgweb.web.controllers.profile.ProfileController"
name="ProfileForm"
scope="request"
parameter="dispatch"
validate="false"
input="page.find.profile">
<forward name="load" path="page.load.profile"/>
</action>-->
 
 
 
 
 
</action-mappings>
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" />
<message-resources parameter="MessageResources"/>
/impl/conf/app.properties
2,7 → 2,7
use.ldap=@use.ldap@
system.language=pt
#Session Settings
user.session.timeout.minutes=15
user.session.timeout.minutes=30
 
email.server=mail.estgp.pt
email.user=
/impl/conf/berserk/sd.xml
110,6 → 110,20
</filterChains>
</service>
<service>
<name>DeleteAnnouncement</name>
<implementationClass>pt.estgp.estgweb.services.announcements.DeleteAnnouncementService</implementationClass>
<description>Delete an Announcement</description>
<isTransactional>true</isTransactional>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="Admins"/>-->
<chain name="OwnersLoadAnnouncement"/>
<!--<chain name="ContextObjectTimer"/>-->
<!--<chain name="ContextStaticTimerExample"/>-->
</filterChains>
</service>
<service>
<name>LoadAnnouncementView</name>
<implementationClass>pt.estgp.estgweb.services.announcements.LoadAnnouncementService</implementationClass>
<description>Load an Announcement view</description>
118,6 → 132,7
<chain name="Logger"/>
<chain name="Session"/>
<!--<chain name="Admins"/>-->
<chain name="InternalAnnouncement"/>
<chain name="TargetRolesAnnouncement"/>
</filterChains>
</service>
264,7 → 279,7
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="OwnerLoadProfile"/>
<!-- <chain name="OwnerLoadProfile"/>-->
</filterChains>
</service>
<service>
275,7 → 290,7
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="OwnerUpdateProfile"/>
<!-- <chain name="OwnerUpdateProfile"/> -->
</filterChains>
</service>
<service>
/impl/conf/berserk/fd.xml
24,6 → 24,12
<isTransactional>false</isTransactional>
</filter>
<filter>
<name>InternalObject</name>
<implementationClass>pt.estgp.estgweb.filters.filters.InternalObject</implementationClass>
<description>Checks if the requested object is internal and if user is authenticated</description>
<isTransactional>false</isTransactional>
</filter>
<filter>
<name>OwnerUsersClass</name>
<implementationClass>pt.estgp.estgweb.filters.filters.OwnerUsersClass</implementationClass>
<description>Checks if the requester contains certain roles</description>
/impl/conf/berserk/fcd.xml
54,6 → 54,13
and referenceClass Name already in 2º filter paramenter
-->
<filterChain>
<name>InternalAnnouncement</name>
<expression>InternalObject("serializable","pt.estgp.estgweb.domain.Announcement")</expression>
<description>Check if the object is internal</description>
<invocationTiming>1</invocationTiming>
<filterClass>pt.estgp.estgweb.filters.chains.LoadControlFilter</filterClass>
</filterChain>
<filterChain>
<name>TargetRolesAnnouncement</name>
<expression>TargetRoleUsersClass("serializable","pt.estgp.estgweb.domain.Announcement") || OwnerUsersClass("serializable","pt.estgp.estgweb.domain.Announcement")</expression>
<description>Owner of an object Control Chain</description>
/impl/src/java/pt/estgp/estgweb/services/profile/EditUserService.java
15,9 → 15,22
 
public User run(UserView userView, UserSession userSession)
{
User user=DaoFactory.getUserDaoImpl().get(userView.getSerializable());
userView.persistViewInObject(user);
logger.info("Editing user:" + userView.getId());
User user;
 
logger.info("Editing user:" + userView.getId());
 
if(userSession.getUser().getRoles().contains("admin"))
{
user=DaoFactory.getUserDaoImpl().get(userView.getSerializable());
userView.persistViewInObjectAdmin(user);
logger.info("User Edited by:" + userSession.getUser().getName());
}
else
{
user=DaoFactory.getUserDaoImpl().get(userSession.getUser().getSerializable());
userView.persistViewInObjectUser(user);
logger.info("User Edited by:" + userSession.getUser().getName());
}
return user;
}
}
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportStudentService.java
2,8 → 2,23
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.services.expceptions.ServiceException;
import pt.estgp.estgweb.Globals;
import pt.estgp.estgweb.domain.Student;
import pt.estgp.estgweb.domain.DomainObjectFactory;
import pt.estgp.estgweb.domain.CourseUnit;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.ipportalegre.siges.web.services.SiGesWEB;
import pt.ipportalegre.siges.web.services.ArrayOfDecimal;
import pt.ipportalegre.siges.web.services.Aluno;
 
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
 
import jomm.dao.impl.AbstractDao;
 
/**
* @author Jorge Machado
* @date 11/May/2008
16,11 → 31,78
private static final Logger logger = Logger.getLogger(ImportStudentService.class);
 
public void run() throws ServiceException {
//todo passar para um utilitario que cria automaticamente o ano lectivo
String year = "200708";
SiGesWEB service = new SiGesWEB();
ArrayOfDecimal codigosAlunos = service.getSiGesWEBSoap().getCodigosAlunosInscritosDaInstituicao(Globals.SIGES_INSTITUTION_CODE,year);
List<BigDecimal> codigos = codigosAlunos.getDecimal();
for(BigDecimal c: codigos)
{
Aluno d = service.getSiGesWEBSoap().getAlunoInscrito(c,Globals.SIGES_INSTITUTION_CODE,year);
Student t = DaoFactory.getStudentDaoImpl().loadBySigesCode(d.getCodigo().intValue());
if(t == null)
{
t = DomainObjectFactory.createStudentImpl();
DaoFactory.getStudentDaoImpl().save(t);
}
persist(d,t);
}
}
 
/**
* Nao esta testado
* jm
* @param d Aluno
* @param t Student
*/
private void persist(Aluno d, Student t)
{
t.setName(d.getNome());
t.setEmail(d.getEmail());
t.setSigesCode(d.getCodigo().intValue());
t.setAddress(d.getMorada());
t.setZip(""+d.getCodigoPostal().intValue());
t.setBi(d.getNumeroBi());
t.setSex(d.getSexo());
t.setUserNameNetpa(d.getUsernameNetpa());
t.setBirthDate(d.getDataNascimento().toGregorianCalendar().getTime());
 
/*Desta forma as relacoes antigas sao ignoradas cria-se uma lista nova e atribui-se ao Teacher, o Hibernate faz resto e apaga as chaves estrangeiras antigas
if(d.getDisciplinas() == null || d.getDisciplinas().getDecimal() == null || d.getDisciplinas().getDecimal().size() == 0)
logger.warn("ATENTION TEACHER WITH ZERO UNITS: codigoFuncionario " + d.getCodigoFuncionario());
else
{
Set<CourseUnit> units = new HashSet<CourseUnit>();
for(BigDecimal unitCode: d.getDisciplinas().getDecimal())
{
List<CourseUnit> l = DaoFactory.getCourseUnitDaoImpl().loadBySigesCode("" + unitCode.intValue());
if(l != null)
units.addAll(l);
else
logger.warn("ATENTION SIGES COURSE UNIT NOT FOUND IN BACO STORAGE: curseUnit " + unitCode.intValue());
}
t.setSubscribedUnits();Units(units);
}
}
 
/**
* Testar por aqui poi requer Super Role e assim e' autmatico
* @param args of main
* @throws ServiceException on error
 
public static void main(String[]args) throws ServiceException
{
AbstractDao.getCurrentSession().beginTransaction();
new ImportStudentService().run();
AbstractDao.getCurrentSession().getTransaction().commit();
}
 
*/
}
 
}
}
 
 
 
 
 
/impl/src/java/pt/estgp/estgweb/services/sigesimports/ImportTeachersService.java
71,9 → 71,9
Set<CourseUnit> units = new HashSet<CourseUnit>();
for(BigDecimal unitCode: d.getDisciplinas().getDecimal())
{
CourseUnit c = DaoFactory.getCourseUnitDaoImpl().loadBySigesCode("" + unitCode.intValue());
if(c != null)
units.add(c);
List<CourseUnit> l = DaoFactory.getCourseUnitDaoImpl().loadBySigesCode("" + unitCode.intValue());
if(l != null)
units.addAll(l);
else
logger.warn("ATENTION SIGES COURSE UNIT NOT FOUND IN BACO STORAGE: curseUnit " + unitCode.intValue());
}
/impl/src/java/pt/estgp/estgweb/services/announcements/AnnouncementsCommonServices.java
19,31 → 19,29
 
import jomm.dao.impl.AbstractDao;
 
/*
* @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
* @date 25/Apr/2008
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class AnnouncementsCommonServices implements IService, IModuleCommonServices {
public class AnnouncementsCommonServices implements IService, IModuleCommonServices
{
 
private static final Logger logger = Logger.getLogger(AnnouncementsCommonServices.class);
 
public int countSearch(String search, SearchTypeEnum searchType, UserSession userSession) {
return 0; //To change body of implemented methods use File | Settings | File Templates.
public int countSearch(String search, SearchTypeEnum searchType, UserSession userSession)
{
return 0; // todo To change body of implemented methods use File | Settings | File Templates.
}
 
public ISearchResults search(String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession) {
public ISearchResults search(String search, SearchTypeEnum searchType, int page, int maxResults, UserSession userSession)
{
DefaultSearchResults searchResults = new DefaultSearchResults();
searchResults.setModule(ModuleEnum.Announcements);
List<String> roles;
if (userSession == null || userSession.getUser() == null || ((UserImpl) userSession.getUser()).getRolesList() == null || ((UserImpl) userSession.getUser()).getRolesList().size() == 0) {
if (userSession == null || userSession.getUser() == null || ((UserImpl) userSession.getUser()).getRolesList() == null || ((UserImpl) userSession.getUser()).getRolesList().size() == 0)
{
roles = new ArrayList<String>();
roles.add(Globals.ALL_ROLE);
}
51,11 → 49,13
roles = ((UserImpl) userSession.getUser()).getRolesList();
 
searchResults.setTotalResults(DaoFactory.getAnnouncementDaoImpl().countAnnouncements(search, searchType, roles, null));
if (searchResults.getTotalResults() > 0) {
if (searchResults.getTotalResults() > 0)
{
List<Announcement> announcements = DaoFactory.getAnnouncementDaoImpl().searchAnnouncements(search, searchType, maxResults, page, roles, null);
if (announcements == null)
return searchResults;
for (Announcement a : announcements) {
for (Announcement a : announcements)
{
DefaultResult defaultResult = new DefaultResult();
defaultResult.setTitle(a.getTitle());
defaultResult.setSubTitle("announcements.type." + a.getType());
68,21 → 68,25
return searchResults;
}
 
public int countToDo(UserSession userSession) {
return 0; //To change body of implemented methods use File | Settings | File Templates.
public int countToDo(UserSession userSession)
{
return 0; //todo To change body of implemented methods use File | Settings | File Templates.
}
 
public IToDoCat getToDo(UserSession userSession) {
return null; //To change body of implemented methods use File | Settings | File Templates.
public IToDoCat getToDo(UserSession userSession)
{
return null; //todo To change body of implemented methods use File | Settings | File Templates.
}
 
public static void main(String[] args) {
public static void main(String[] args)
{
AbstractDao.getCurrentSession().beginTransaction();
UserSession sess = new UserSessionImpl();
sess.setUser(new UserImpl());
sess.getUser().setRoles("all");
ISearchResults searchResults = new AnnouncementsCommonServices().search("teste", SearchTypeEnum.AllWords, 0, 10, sess);
for (IResult result : searchResults.getResults()) {
for (IResult result : searchResults.getResults())
{
System.out.println("title:" + result.getTitle());
System.out.println("subTitle:" + result.getSubTitle());
System.out.println("text:" + result.getText());
/impl/src/java/pt/estgp/estgweb/services/announcements/LoadTopFlashNewsIterateService.java
16,11 → 16,10
import java.util.ArrayList;
 
/**
* Created by IntelliJ IDEA.
* User: Fabio
* Date: 28/Mar/2008
* Time: 11:42:28
* To change this template use File | Settings | File Templates.
* @author Jorge Machado
* @date 28/Mar/2008
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class LoadTopFlashNewsIterateService implements IService
{
37,18 → 36,20
iterator = 0;
 
int size = DaoFactory.getAnnouncementDaoImpl().countAnnouncements(1,null,Globals.ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS,null);
iterator = iterator % size;
List<Announcement> announcements = DaoFactory.getAnnouncementDaoImpl().findAnnouncements(iterator, 1,null,Globals.ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS,subTarget);
iterator++;
((UserSessionImpl)sess).put(flashNewsIterator,iterator);
if(size != 0)
{
iterator = iterator % size;
List<Announcement> announcements = DaoFactory.getAnnouncementDaoImpl().findAnnouncements(iterator, 1,null,Globals.ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS,subTarget);
iterator++;
((UserSessionImpl)sess).put(flashNewsIterator,iterator);
 
if(announcements == null)
return null;
logger.info("Loading announcement top flash iterator");
if(announcements.size() > 0)
{
AnnouncementView announcementView = new AnnouncementView(announcements.get(0));
return announcementView;
if(announcements == null)
return null;
logger.info("Loading announcement top flash iterator");
if(announcements.size() > 0)
{
return new AnnouncementView(announcements.get(0));
}
}
return null;
}
/impl/src/java/pt/estgp/estgweb/services/announcements/DeleteAnnouncementService.java
New file
0,0 → 1,47
package pt.estgp.estgweb.services.announcements;
 
import pt.utl.ist.berserk.logic.serviceManager.IService;
import pt.estgp.estgweb.domain.views.AnnouncementView;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.Announcement;
import pt.estgp.estgweb.domain.DomainObjectFactory;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import org.apache.log4j.Logger;
 
import java.io.Serializable;
 
/*
* @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 DeleteAnnouncementService implements IService {
 
private static final Logger logger = Logger.getLogger(DeleteAnnouncementService.class);
 
 
 
public Boolean run(Serializable id, UserSession userSession)
{
try
{
logger.info("Deleting announcement:" + id);
DaoFactory.getAnnouncementDaoImpl().delete(id);
return true;
}
catch(Exception e)
{
logger.error("Can´t delete announcement:"+id +""+e);
return false;
}
}
}
/impl/src/java/pt/estgp/estgweb/services/authenticate/AuthenticateService.java
85,7 → 85,6
UserImpl u = DomainObjectFactory.createUserImpl();
u.setUsername(username);
u.setName(getName(map));
u.setAddress("urra");
u.setRoles(getRoles(map));
u.setNewUser(true);
DaoFactory.getUserDaoImpl().save(u);
/impl/src/java/pt/estgp/estgweb/domain/UserImpl.java
1,6 → 1,7
package pt.estgp.estgweb.domain;
 
import pt.estgp.estgweb.utils.RoleManager;
import pt.estgp.estgweb.Globals;
 
import java.io.Serializable;
import java.util.Date;
90,4 → 91,19
{
return this;
}
 
public boolean isSuperUser()
{
return super.isSuperuser() || hasRole(Globals.SUPER_USER_ROLE);
}
 
public boolean isAdmin()
{
return hasRole(Globals.ADMIN_ROLE);
}
 
public boolean isSuperUserOrAdmin()
{
return isSuperUser() || isAdmin();
}
}
/impl/src/java/pt/estgp/estgweb/domain/enums/AnnouncementStyleEnum.java
New file
0,0 → 1,39
package pt.estgp.estgweb.domain.enums;
 
/**
* Created by IntelliJ IDEA.
* User: Jorge Machado
* Date: 14/Mai/2008
* Time: 12:24:35
* To change this template use File | Settings | File Templates.
*/
public enum AnnouncementStyleEnum {
imgLeft("announcement.style.img.left"),
imgRight("announcement.style.img.right"),
imgTop("announcement.style.img.top"),
imgEmbeddedLeft("announcement.style.img.embedded.left"),
imgEmbeddedRight("announcement.style.img.embedded.right");
 
private String messageKey;
 
private AnnouncementStyleEnum(String messageKey)
{
this.messageKey = messageKey;
}
 
public String getMessageKey()
{
return messageKey;
}
 
 
public static AnnouncementStyleEnum parse(String type)
{
for(AnnouncementStyleEnum styleEnum: values())
{
if(styleEnum.getMessageKey().equals(type))
return styleEnum;
}
return null;
}
}
/impl/src/java/pt/estgp/estgweb/domain/AnnouncementImpl.java
1,6 → 1,7
package pt.estgp.estgweb.domain;
 
import pt.estgp.estgweb.utils.RoleManager;
import pt.estgp.estgweb.domain.enums.AnnouncementStyleEnum;
 
import java.util.Date;
import java.util.List;
19,6 → 20,13
return super.getOwner();
}
 
public String getStyle()
{
if(super.getStyle() == null)
setStyle(AnnouncementStyleEnum.imgEmbeddedLeft.getMessageKey());
return super.getStyle();
}
 
public Serializable getSerializable()
{
return getId();
/impl/src/java/pt/estgp/estgweb/domain/views/AnnouncementView.java
3,6 → 3,7
import pt.estgp.estgweb.domain.Announcement;
import pt.estgp.estgweb.domain.Image;
import pt.estgp.estgweb.domain.AnnouncementImpl;
import pt.estgp.estgweb.domain.enums.AnnouncementStyleEnum;
import pt.estgp.estgweb.utils.RoleManager;
import pt.estgp.estgweb.utils.ConfigProperties;
 
34,7 → 35,12
private Date expireDate;
private Integer counter;
private boolean status;
private boolean internal;
private long ownerID;
private String style;
private String internalUrlServer;
private String internalUrlPath;
private boolean internalUrlInclude;
 
public AnnouncementView()
{}
57,6 → 63,11
this.expireDate = announcement.getExpireDate();
this.choosedOwnerRole = announcement.getChoosedOwnerRole();
this.ownerID=announcement.getOwner().getId();
this.internalUrlServer = announcement.getInternalUrlServer();
this.internalUrlPath = announcement.getInternalUrlPath();
this.style = announcement.getStyle();
this.internalUrlInclude = announcement.isInternalUrlInclude();
this.internal = announcement.isInternal();
}
 
public void persistViewInObject(Announcement announcement)
73,9 → 84,59
announcement.setStatus(status);
announcement.setCounter(counter);
announcement.setChoosedOwnerRole(choosedOwnerRole);
announcement.setInternalUrlServer(internalUrlServer);
announcement.setInternalUrlPath(internalUrlPath);
announcement.setStyle(style);
announcement.setInternalUrlInclude(internalUrlInclude);
announcement.setInternal(internal);
}
 
 
public boolean isInternal() {
return internal;
}
 
public void setInternal(boolean internal) {
this.internal = internal;
}
 
public boolean isInternalUrlInclude() {
return internalUrlInclude;
}
 
public void setInternalUrlInclude(boolean internalUrlInclude) {
this.internalUrlInclude = internalUrlInclude;
}
 
public String getStyle() {
return style;
}
 
public AnnouncementStyleEnum getStyleEnum()
{
return AnnouncementStyleEnum.parse(style);
}
 
public void setStyle(String style) {
this.style = style;
}
 
public String getInternalUrlPath() {
return internalUrlPath;
}
 
public void setInternalUrlPath(String internalUrlPath) {
this.internalUrlPath = internalUrlPath;
}
 
public String getInternalUrlServer() {
return internalUrlServer;
}
 
public void setInternalUrlServer(String internalUrlServer) {
this.internalUrlServer = internalUrlServer;
}
 
public String getChoosedOwnerRole() {
return choosedOwnerRole;
}
216,6 → 277,25
return getText();
}
 
public String getFormatedText()
{
if(text == null | text.trim().length() == 0)
return "";
 
String formatedText = text.replace(" ","&nbsp;");
StringBuilder finalFormatedText = new StringBuilder();
for(int i =0;i<formatedText.length();i++)
{
if(formatedText.charAt(i) == '\n')
finalFormatedText.append("<br>");
else if(formatedText.charAt(i) == '\t')
finalFormatedText.append("&nbsp;&nbsp;&nbsp;&nbsp;");
else
finalFormatedText.append(formatedText.charAt(i));
}
return finalFormatedText.toString();
}
 
public Boolean getHaveAllText()
{
if(getType().equals("top.flash.news"))
/impl/src/java/pt/estgp/estgweb/domain/views/UserView.java
21,12 → 21,16
{
private long id;
private String name;
private String userRoles;
private List<String> userRoles;
private String address;
private String zip;
private String country;
private String email;
private String outEmail;
private String phonenumber;
private String bi;
private Date birthDate;
private String username;
 
public UserView()
{}
42,10 → 46,14
this.country=user.getCountry();
this.email=user.getEmail();
this.phonenumber=user.getPhonenumber();
this.userRoles = user.getRoles();
this.userRoles = RoleManager.getRolesFromSerial(user.getRoles());
this.outEmail=user.getOutEmail();
this.bi=user.getBi();
this.birthDate=user.getBirthDate();
this.username=user.getUsername();
}
 
public void persistViewInObject(User user)
public void persistViewInObjectAdmin(User user)
{
user.setName(name);
user.setAddress(address);
53,9 → 61,18
user.setCountry(country);
user.setEmail(email);
user.setPhonenumber(phonenumber);
user.setRoles(userRoles);
user.setRoles(RoleManager.getSerialRoles(userRoles));
user.setOutEmail(outEmail);
user.setBi(bi);
user.setBirthDate(birthDate);
user.setUsername(username);
}
 
public void persistViewInObjectUser(User user)
{
user.setOutEmail(outEmail);
}
 
public Class getReferenceClass()
{
return User.class;
82,11 → 99,11
this.name = name;
}
 
public String getUserRoles() {
public List<String> getUserRoles() {
return userRoles;
}
 
public void setUserRoles(String userRoles) {
public void setUserRoles(List<String> userRoles) {
this.userRoles = userRoles;
}
 
129,4 → 146,36
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
 
public String getOutEmail() {
return outEmail;
}
 
public void setOutEmail(String outEmail) {
this.outEmail = outEmail;
}
 
public String getBi() {
return bi;
}
 
public void setBi(String bi) {
this.bi = bi;
}
 
public Date getBirthDate() {
return birthDate;
}
 
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
 
public String getUsername() {
return username;
}
 
public void setUsername(String username) {
this.username = username;
}
}
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseUnitDaoImpl.java
3,6 → 3,9
import pt.estgp.estgweb.domain.CourseUnit;
import static org.hibernate.criterion.Restrictions.*;
 
import java.util.List;
import java.util.Set;
 
/**
* @author Jorge Machado
* @date 28/Fev/2008
23,9 → 26,9
return (CourseUnitDaoImpl) myInstance;
}
 
public CourseUnit loadBySigesCode(String sigesCode)
public List<CourseUnit> loadBySigesCode(String sigesCode)
{
return (CourseUnit) createCriteria().add(eq("code",sigesCode)).uniqueResult();
return createCriteria().add(eq("code",sigesCode)).list();
}
 
}
/impl/src/java/pt/estgp/estgweb/domain/IInternal.java
New file
0,0 → 1,11
package pt.estgp.estgweb.domain;
 
/**
* @author Jorge Machado
* @date 15/Mai/2008
* @see pt.estgp.estgweb.domain
*/
public interface IInternal
{
public boolean isInternal();
}
/impl/src/java/pt/estgp/estgweb/domain/DomainObject.java
14,7 → 14,7
* @time 10:56:46
* @see pt.estgp.estgweb.domain
*/
public abstract class DomainObject implements IOwned, IContextTimerObject, ITargetRoles
public abstract class DomainObject implements IOwned, IContextTimerObject, ITargetRoles, IInternal
{
private static final Date MIN_DATE = new Date(0);
private static final Date MAX_DATE = new Date(Integer.MAX_VALUE);
120,4 → 120,9
roles.add(ALL_ROLE);
return roles;
}
 
public boolean isInternal()
{
return true;
}
}
/impl/src/java/pt/estgp/estgweb/filters/filters/InternalObject.java
New file
0,0 → 1,31
package pt.estgp.estgweb.filters.filters;
 
import org.apache.log4j.Logger;
import pt.estgp.estgweb.domain.IInternal;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.filters.chains.LoadControlFilter;
import pt.estgp.estgweb.filters.exceptions.NeedAuthenticationException;
import pt.estgp.estgweb.filters.filters.utils.LoadObjectFromParameters;
import pt.estgp.estgweb.Globals;
import pt.utl.ist.berserk.ServiceRequest;
import pt.utl.ist.berserk.ServiceResponse;
import pt.utl.ist.berserk.logic.filterManager.FilterParameters;
import pt.utl.ist.berserk.logic.filterManager.exceptions.FilterException;
 
public class InternalObject extends LoadControlFilter
{
private static final Logger logger = Logger.getLogger(InternalObject.class);
 
 
public void execute(ServiceRequest request, ServiceResponse response, FilterParameters filterParameters) throws FilterException, Exception
{
UserSession userSession = (UserSession) request.getServiceParameters().getParameter(Globals.USER_SESSION_KEY);
IInternal iInternal = (IInternal) LoadObjectFromParameters.loadObjectFromClassName((String) filterParameters.getParameter(1),filterParameters,request.getServiceParameters());
 
if(iInternal.isInternal() && userSession.getUser() == null)
{
logger.info("try access restricted area:" + request.getRequester());
throw new NeedAuthenticationException();
}
}
}
/impl/src/java/pt/estgp/estgweb/web/form/profile/ProfileForm.java
3,6 → 3,8
import pt.estgp.estgweb.domain.User;
import pt.estgp.estgweb.domain.views.UserView;
import pt.estgp.estgweb.web.form.ApplicationForm;
import pt.estgp.estgweb.web.form.AddRolesForm;
import pt.estgp.estgweb.web.utils.DatesUtils;
 
import java.util.List;
 
12,11 → 14,13
* @time 17:18:57
* @see pt.estgp.estgweb.web.form.profile
*/
public class ProfileForm extends ApplicationForm
{
public class ProfileForm extends AddRolesForm {
 
private UserView userView;
private String textToSearch;
private static List<UserView> usersFind;
private long userIDToChange;
private String birthDayDate;
 
public ProfileForm()
{
54,5 → 58,32
public void setUsersFind(List<UserView> usersFind) {
ProfileForm.usersFind = usersFind;
}
 
public long getUserIDToChange() {
return userIDToChange;
}
 
public void setUserIDToChange(long userIDToChange) {
this.userIDToChange = userIDToChange;
}
 
public String getBirthDayDate() {
if(userView.getBirthDate()!=null)
{
this.birthDayDate= DatesUtils.getStringFromDate(userView.getBirthDate());
return birthDayDate;
}
else
{
this.birthDayDate="";
return birthDayDate;
}
 
}
 
public void setBirthDayDate(String birthDayDate) {
this.birthDayDate=birthDayDate;
this.userView.setBirthDate(DatesUtils.getDateFromString(birthDayDate));
}
}
 
/impl/src/java/pt/estgp/estgweb/web/controllers/profile/ProfileController.java
1,11 → 1,13
package pt.estgp.estgweb.web.controllers.profile;
 
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.web.controllers.AddRolesController;
import pt.estgp.estgweb.web.controllers.authenticate.AuthenticateController;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.estgp.estgweb.web.exceptions.NoCookiesException;
import pt.estgp.estgweb.web.UserSessionProxy;
import pt.estgp.estgweb.web.form.profile.ProfileForm;
import pt.estgp.estgweb.web.form.AddRolesForm;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.UserImpl;
import pt.estgp.estgweb.domain.User;
23,6 → 25,7
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
 
/**
35,6 → 38,7
 
private static final Logger logger = Logger.getLogger(ProfileController.class);
 
 
public ActionForward editUser(ActionMapping mapping,
ActionForm form ,
HttpServletRequest request,
51,9 → 55,11
String[] names = new String[]{"object"};
Object[] args = new Object[]{userView};
User user = (User) sm.execute(RequestUtils.getRequester(request),"EditUser",args,names);
userSession.setUser(user);
request.setAttribute(Globals.USER_SESSION_KEY,userSession);
logger.info("Puting new user info in session:" + user.getId());
if(userSession.getUser().getId()==user.getId()){
userSession.setUser(user);
request.setAttribute(Globals.USER_SESSION_KEY,userSession);
logger.info("Puting new user info in session:" + user.getId());
}
addMessage(request,"profile.edited.sucess");
return mapping.findForward("success");
}
76,12 → 82,21
try
{
UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request);
String id = request.getParameter("id");
long userToLoad;
 
if(id!=null)
userToLoad=Long.valueOf(id);
else
userToLoad=userSession.getUser().getId();
 
ProfileForm profileForm = new ProfileForm();
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{userSession.getUser().getId()};
Object[] args = new Object[]{userToLoad};
UserView uV = (UserView) sm.execute(RequestUtils.getRequester(request),"LoadUserById",args,names);
profileForm.setUserView(uV);
profileForm.setSelectedRoles(uV.getUserRoles());
request.setAttribute("ProfileForm",profileForm);
return mapping.findForward("load");
}
103,13 → 118,14
throws Throwable, ServletException {
try
{
ProfileForm profileForm = (ProfileForm) form;
ProfileForm fromRequest=(ProfileForm) form;
ProfileForm profileForm = new ProfileForm();
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{profileForm.getTextToSearch()};
Object[] args = new Object[]{fromRequest.getTextToSearch()};
List<UserView> uVs = (List<UserView>) sm.execute(RequestUtils.getRequester(request),"SearchUser",args,names);
profileForm.setUsersFind(uVs);
request.setAttribute("ProfileForm",profileForm);
request.setAttribute("ProfileForm",profileForm);
return mapping.findForward("search");
}
catch(FilterChainFailedException e)
/impl/src/java/pt/estgp/estgweb/web/controllers/announcements/AnnouncementsController.java
28,32 → 28,34
 
/**
* @author Jorge Machado
* @author Fabio Velez
* @date 26/Fev/2008
* @time 18:01:54
* @see pt.estgp.estgweb.web
*/
public class AnnouncementsController extends AddRolesController {
public class AnnouncementsController extends AddRolesController
{
 
private static final Logger logger = Logger.getLogger(AnnouncementsController.class);
 
private static final String TARGET_ROLES_KEY = AddRolesForm.TARGET_ROLES_KEY;
 
public ActionForward save(ActionMapping mapping,
ActionForm form ,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
Image i2=null;
Image i=null;
Image i2 = null;
Image i = null;
AnnouncementsForm announcementForm = (AnnouncementsForm) form;
AnnouncementView view = announcementForm.getAnnouncementView();
String finalUrl="";
if(!announcementForm.getUrl().equals(""))
String finalUrl = "";
if (!announcementForm.getUrl().equals(""))
{
finalUrl=announcementForm.getUrlProtocol()+announcementForm.getUrl();
finalUrl = announcementForm.getUrlProtocol() + announcementForm.getUrl();
view.setUrl(finalUrl);
}
else
61,16 → 63,16
view.setUrl(null);
}
 
if(announcementForm.getBigImage().getFileSize()!= 0)
if (announcementForm.getBigImage().getFileSize() != 0)
{
FormFile bigImage = announcementForm.getBigImage();
InputStream stream = bigImage.getInputStream();
ByteArrayOutputStream b = new ByteArrayOutputStream();
int readedBytes;
byte[] buf = new byte[1024];
while((readedBytes = stream.read(buf)) > 0)
while ((readedBytes = stream.read(buf)) > 0)
{
b.write(buf,0,readedBytes);
b.write(buf, 0, readedBytes);
}
b.close();
i = DomainObjectFactory.createImageImpl();
83,16 → 85,16
 
}
 
if(announcementForm.getSmallImage().getFileSize()!= 0)
if (announcementForm.getSmallImage().getFileSize() != 0)
{
FormFile smallImage = announcementForm.getSmallImage();
InputStream stream2 = smallImage.getInputStream();
ByteArrayOutputStream b2 = new ByteArrayOutputStream();
int readedBytes2;
byte[] buf2 = new byte[1024];
while((readedBytes2 = stream2.read(buf2)) > 0)
while ((readedBytes2 = stream2.read(buf2)) > 0)
{
b2.write(buf2,0,readedBytes2);
b2.write(buf2, 0, readedBytes2);
}
b2.close();
i2 = DomainObjectFactory.createImageImpl();
106,24 → 108,30
 
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"object"};
Object[] args = new Object[]{view,i, i2};
AnnouncementView aV = (AnnouncementView) sm.execute(RequestUtils.getRequester(request),"CreateAnnouncement",args,names);
addMessage(request,"announcement.edited.success","" + aV.getId());
Object[] args = new Object[]{view, i, i2};
boolean newAnnouncement = true;
if (view.getId() > 0)
newAnnouncement = false;
AnnouncementView aV = (AnnouncementView) sm.execute(RequestUtils.getRequester(request), "CreateAnnouncement", args, names);
if (newAnnouncement)
addMessage(request, "announcement.created.success", request.getContextPath(), "" + aV.getId(), view.getTitle());
else
addMessage(request, "announcement.edited.success", request.getContextPath(), "" + aV.getId(), view.getTitle());
return mapping.findForward("success");
}
catch(FilterChainFailedException e)
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e,e);
logger.error(e, e);
throw e;
}
}
 
public ActionForward edit(ActionMapping mapping,
ActionForm form ,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
134,7 → 142,7
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{new Long(request.getParameter("id"))};
AnnouncementView aV = (AnnouncementView) sm.execute(RequestUtils.getRequester(request),"LoadEditAnnouncement",args,names);
AnnouncementView aV = (AnnouncementView) sm.execute(RequestUtils.getRequester(request), "LoadEditAnnouncement", args, names);
AnnouncementsForm announcementsForm = (AnnouncementsForm) form;
announcementsForm.setAnnouncementView(aV);
announcementsForm.setStartDate(DatesUtils.getStringFromDate(aV.getStartDate()));
144,6 → 152,41
sess.serialize(request);
return mapping.getInputForward();
}
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e, e);
throw e;
}
}
 
public ActionForward delete(ActionMapping mapping,
ActionForm form ,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
{
try
{
 
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),"DeleteAnnouncement",args,names);
if(status)
{
addMessage(request,"announcement.deleted.success","" + request.getParameter("id"));
return mapping.findForward("success");
}
else
{
addMessage(request,"announcement.deleted.fail","" + request.getParameter("id"));
return mapping.findForward("success");
}
}
catch(FilterChainFailedException e)
{
return mapping.findForward("error401");
157,7 → 200,7
}
 
public ActionForward list(ActionMapping mapping,
ActionForm form ,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
167,23 → 210,23
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{};
List<AnnouncementView> announcementViews = (List<AnnouncementView>) sm.execute(RequestUtils.getRequester(request),"LoadTargetMaxAnnouncements",args,names);
request.setAttribute("Announcements",announcementViews);
List<AnnouncementView> announcementViews = (List<AnnouncementView>) sm.execute(RequestUtils.getRequester(request), "LoadTargetMaxAnnouncements", args, names);
request.setAttribute("Announcements", announcementViews);
return mapping.findForward("success");
}
catch(FilterChainFailedException e)
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e,e);
logger.error(e, e);
throw e;
}
}
 
public ActionForward load(ActionMapping mapping,
ActionForm form ,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Throwable, ServletException
194,17 → 237,17
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{new Long(id)};
AnnouncementView announcementView = (AnnouncementView) sm.execute(RequestUtils.getRequester(request),"LoadAnnouncementView",args,names);
request.setAttribute("Announcement",announcementView);
AnnouncementView announcementView = (AnnouncementView) sm.execute(RequestUtils.getRequester(request), "LoadAnnouncementView", args, names);
request.setAttribute("Announcement", announcementView);
return mapping.findForward("load");
}
catch(FilterChainFailedException e)
catch (FilterChainFailedException e)
{
return mapping.findForward("error401");
}
catch (Throwable e)
{
logger.error(e,e);
logger.error(e, e);
throw e;
}
}
/impl/src/java/pt/estgp/estgweb/examples/DBInit.java
24,6 → 24,7
AbstractDao.getCurrentSession().beginTransaction();
UserImpl user = DomainObjectFactory.createUserImpl();
user.setUsername("super");
user.setSuperuser(true);
user.setName("super user");
user.setRoles("all,admin");
user.setPassword(BytesUtils.getMD5("1"));
/impl/src/doc/estgweb.eap
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/impl/src/hbm/pt/estgp/estgweb/domain/CourseUnit.hbm.xml
21,7 → 21,7
<property name="courseYear" type="string" />
<property name="institutionCode" type="string" />
<property name="status" type="boolean" />
 
<many-to-one name="courseunit" class="pt.estgp.estgweb.domain.CourseUnit" lazy="false" outer-join="true"/>
<subclass name="pt.estgp.estgweb.domain.CourseUnitImpl" discriminator-value="CourseUnitImpl"/>
</class>
</hibernate-mapping>
/impl/src/hbm/pt/estgp/estgweb/domain/Announcement.hbm.xml
22,7 → 22,12
<property name="targetRoles" type="text"/>
<property name="type" type="string" />
<property name="url" type="string"/>
<property name="internalUrlPath" type="string"/>
<property name="internalUrlServer" type="string"/>
<property name="internalUrlInclude" type="boolean"/>
<property name="style" type="string"/>
<property name="status" type="boolean" />
<property name="internal" type="boolean" />
<property name="counter" type="integer" />
<many-to-one name="bigImage" column="bigImage" class="pt.estgp.estgweb.domain.Image" lazy="no-proxy" outer-join="false" cascade="all" />
<many-to-one name="smallImage" column="smallImage" class="pt.estgp.estgweb.domain.Image" lazy="no-proxy" outer-join="false" cascade="all"/>
/impl/src/web/admin/profile/findUser.jsp
New file
0,0 → 1,36
<%@ 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/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<jsp:useBean id="ProfileForm" class="pt.estgp.estgweb.web.form.profile.ProfileForm"/>
 
<jomm:messages/>
<html:form action="/profile">
<input type="hidden" name="dispatch" value="search">
<html:hidden property="userView.id"/>
<html:hidden property="userView.userRoles"/>
 
<table class="form">
<tr>
<th>
<bean:message key="profile.search.user"/>
</th>
<td>
<html:text property="textToSearch" maxlength="50"/>
</td>
<td>
<input type="button" onclick="set(this.form,'search');this.form.submit()" value="<bean:message key="search"/>">
</td>
</tr>
</table>
 
<logic:present name="ProfileForm" property="usersFind">
<ul>
<logic:iterate id="userView" name="ProfileForm" property="usersFind" type="pt.estgp.estgweb.domain.views.UserView">
<li>${userView.name} <html:link action="/profile?id=${userView.id}&dispatch=changeProfile"><bean:message key="edit"/></html:link></li>
</logic:iterate>
</ul>
</logic:present>
</html:form>
/impl/src/web/admin/profile/profile.jsp
New file
0,0 → 1,141
<%@ page import="java.util.List" %>
<%@ 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/estgweb.tld" prefix="estgweb" %>
 
 
<jomm:messages/>
<jsp:useBean id="ProfileForm" class="pt.estgp.estgweb.web.form.profile.ProfileForm"/>
<html:form action="/profile">
<input type="hidden" name="dispatch" value="editUser">
<html:hidden property="userView.id"/>
<html:hidden property="userView.userRoles"/>
<bean:message key="profile.edit"/>
 
<table class="form">
<estgweb:isNotAdmin>
<tr>
<th><bean:message key="login.first.time.username"/></th>
<td>
<html:text property="userView.username" maxlength="250" readonly="true" styleClass="readOnly"/>
</td>
</tr>
</estgweb:isNotAdmin>
<estgweb:isAdmin>
<tr>
<th><bean:message key="login.first.time.username"/></th>
<td>
<html:text property="userView.username" maxlength="250"/>
</td>
</tr>
<tr>
<th><bean:message key="login.first.time.targets"/></th>
<td>
<html:select property="targetRolesStr">
<logic:present name="ProfileForm" property="targetRoles">
<logic:iterate id="item" name="ProfileForm" property="targetRoles">
<jomm:option itemName="item" comparableObjectName="ProfileForm" 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="ProfileForm" property="selectedRoles">
<logic:notEmpty name="ProfileForm" property="selectedRoles">
<ul>
<logic:iterate id="item" name="ProfileForm" property="selectedRoles">
<li><jomm:message patternMessage="user.role.{0}" name0="item"/><input type="button" value="<bean:message key="remove"/>" onclick="AnnouncementsForm.role.value='${item}';set(this.form,'removeRole');this.form.submit();"></li>
</logic:iterate>
</ul>
</logic:notEmpty>
</logic:present>
</td>
</tr>
</estgweb:isAdmin>
<tr>
<th><bean:message key="login.first.time.bi"/></th>
<td>
<html:text property="userView.bi" maxlength="250" readonly="true" styleClass="readOnly"/>
</td>
</tr>
<tr>
<th><bean:message key="login.first.time.birthday.date"/></th>
<td>
<html:text property="birthDayDate" maxlength="100" readonly="true" styleClass="readOnly"/>
</td>
</tr>
<tr>
<th><bean:message key="login.first.time.name"/></th>
<td>
<html:text property="userView.name" maxlength="250" readonly="true" styleClass="readOnly"/>
</td>
</tr>
<tr>
<th><bean:message key="login.first.time.address"/></th>
<td>
<html:text property="userView.address" maxlength="250" readonly="true" styleClass="readOnly"/>
</td>
</tr>
<tr>
<th><bean:message key="login.first.time.zip"/></th>
<td>
<html:text property="userView.zip" maxlength="8" readonly="true" styleClass="readOnly"/>
</td>
</tr>
<tr>
<th><bean:message key="login.first.time.country"/></th>
<td>
<html:text property="userView.country" maxlength="100" readonly="true" styleClass="readOnly"/>
</td>
</tr>
<tr>
<th><bean:message key="login.first.time.phone.number"/></th>
<td>
<html:text property="userView.phonenumber" maxlength="250" styleClass="readOnly"/>
</td>
</tr>
<estgweb:isNotAdmin>
<tr>
<th><bean:message key="login.first.time.email.institucion"/></th>
<td>
<html:text property="userView.email" maxlength="250" readonly="true" styleClass="readOnly"/>
</td>
</tr>
</estgweb:isNotAdmin>
<estgweb:isAdmin>
<tr>
<estgweb:isAdmin>
<th><bean:message key="login.first.time.email.institucion2"/></th>
</estgweb:isAdmin>
<estgweb:isNotAdmin>
<th><bean:message key="login.first.time.email.institucion"/></th>
</estgweb:isNotAdmin>
<td>
<html:text property="userView.email" maxlength="250"/>
</td>
</tr>
</estgweb:isAdmin>
<tr>
<th><bean:message key="login.first.time.email.secundary"/></th>
<td>
<html:text property="userView.outEmail" maxlength="250"/>
</td>
</tr>
<estgweb:isNotAdmin>
<tr>
<th><bean:message key="profile.email.change"/></th>
</tr>
</estgweb:isNotAdmin>
<tr class="buttons">
<td colspan="2">
<input type="button" onclick="set(this.form,'editUser');this.form.submit()" value="<bean:message key="confirm"/>"/>
</td>
</tr>
</table>
</html:form>
/impl/src/web/admin/announcements/submitAnnouncement.jsp
29,6 → 29,17
</html:select>
</td>
</tr>
<tr>
<th>
<bean:message key="announcement.internal"/>
</th>
<td>
<html:select property="announcementView.internal">
<html:option value="true"><bean:message key="announcement.internal.yes"/></html:option>
<html:option value="false"><bean:message key="announcement.internal.no"/></html:option>
</html:select>
</td>
</tr>
</estgweb:isAdmin>
<tr>
<th>
148,6 → 159,22
 
<tr>
<th>
<bean:message key="announcement.image.style"/>
</th>
<td>
<html:select property="announcementView.style">
<html:option value="announcement.style.img.left"><bean:message key="announcement.style.img.left"/></html:option>
<html:option value="announcement.style.img.right"><bean:message key="announcement.style.img.right"/></html:option>
<html:option value="announcement.style.img.top"><bean:message key="announcement.style.img.top"/></html:option>
<html:option value="announcement.style.img.embedded.left"><bean:message key="announcement.style.img.embedded.left"/></html:option>
<html:option value="announcement.style.img.embedded.right"><bean:message key="announcement.style.img.embedded.right"/></html:option>
</html:select>
</td>
</tr>
 
 
<tr>
<th>
<bean:message key="announcement.linkAnnouncement"/>
</th>
<td>
159,8 → 186,27
<html:text property="url" maxlength="250"/>
</td>
</tr>
 
 
<tr>
<th>
<bean:message key="announcement.internalLinkAnnouncement"/>
</th>
<td>
<html:select property="announcementView.internalUrlServer">
<html:option value="true"><bean:message key="announcement.internal.url.include.yes"/></html:option>
<html:option value="false"><bean:message key="announcement.internal.url.include.no"/></html:option>
</html:select>
<html:text property="announcementView.internalUrlPath"/>
<html:select property="announcementView.internalUrlServer">
<html:option value="estg">ESTG</html:option>
<html:option value="ionline">IONLINE</html:option>
</html:select>
</td>
</tr>
 
<tr>
<th>
<bean:message key="announcement.text"/>
</th>
<td>
/impl/src/web/css/style.css
65,7 → 65,7
 
TD.rightPage, TD.rightPagePortal {
VERTICAL-ALIGN: top;
/*WIDTH: 160px;*/
/*WIDTH: 160px;*/
}
 
.rightPagePosition {
81,7 → 81,7
/************************************** Content Structure ********************************/
.contentPortal {
padding-left: 10px;
 
}
 
.content h2 a {
361,14 → 361,14
 
.portalLeftAnnouncements table {
table-layout: fixed;
/*width: 180px;*/
/*width: 180px;*/
padding-top: 10px;
font-size: 0.8em;
}
 
.portalRightAnnouncements table {
table-layout: fixed;
/*width: 250px;*/
/*width: 250px;*/
font-size: 0.8em;
}
 
391,7 → 391,7
/* todo FABIO
todo Left Manus???? ao pe de portalMenus isto esta uma confusao*/
.navleftMenu {
/*width: 180px;*/
/*width: 180px;*/
padding-left: 10px;
}
 
651,12 → 651,12
}
#leftMenuModule UL {
MARGIN: 0;
/*WIDTH: 155px;*/
/*WIDTH: 155px;*/
}
.linkLeftMenu UL li
{
width:110px;
width:110px;
 
}
 
 
696,7 → 696,7
 
.boxHorizontal {
padding-top: 5px;
 
}
 
.form th, .boxHorizontal th {
747,6 → 747,20
width: 100px;
}
 
 
.form input.readOnly {
background-color:#cccccc;
border-top-width: 1px;
color:#FFFFFF;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
}
 
/* PAGE LAYOUTS */
 
.seccao, .seccao p {
/impl/src/web/public/announcements/loadAnnouncement.jsp
1,46 → 1,139
<%@ page import="jomm.utils.MessageResources" %>
<%@ page import="org.apache.struts.util.RequestUtils" %>
<%@ page import="pt.estgp.estgweb.domain.UserImpl" %>
<%@ page import="pt.estgp.estgweb.domain.UserSessionImpl" %>
<%@ page import="pt.estgp.estgweb.domain.enums.AnnouncementStyleEnum" %>
<%@ page import="pt.estgp.estgweb.web.UserSessionProxy" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/estgweb.tld" prefix="estgweb" %>
<jsp:useBean id="Announcement" type="pt.estgp.estgweb.domain.views.AnnouncementView" scope="request"/>
<% UserSessionImpl userSession = (UserSessionImpl) UserSessionProxy.loadUserSession(request);%>
<html:link href="http://www.sapo.pt"> </html:link>
<html:link href="http://www.sapo.pt"></html:link>
<div class="seccao">
<h2>${Announcement.title}
<%if((userSession.getUser().getId()==Announcement.getOwnerID())||(userSession.getUser().getRoles().contains("all"))||(userSession.getUser().getRoles().contains("admin"))){%>
<html:link action="/loadAnnouncement?id=${Announcement.id}&dispatch=edit"> Editar</html:link><%}%>
</h2>
<p>
<%
if(Announcement.getBigImage() != null)
{
%>
<div class="imageAnnouncement">
<img align="left" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>">
</div>
<%
<h2>${Announcement.title}
<%
if (userSession.getUser() != null && (Announcement.isOwnedBy(userSession.getUser()) || ((UserImpl) userSession.getUser()).isSuperUserOrAdmin()))
{
%>
<html:link action="/loadAnnouncement?id=${Announcement.id}&dispatch=edit"> <bean:message key="edit"/> </html:link>
<html:link action="/loadAnnouncement?id=${Announcement.id}&dispatch=delete">Apagar</html:link>
<%
}
else if(Announcement.getSmallImage() != null)
{
%>
%>
</h2>
<%
AnnouncementStyleEnum styleEnum = Announcement.getStyleEnum();
if (styleEnum == AnnouncementStyleEnum.imgEmbeddedLeft || styleEnum == AnnouncementStyleEnum.imgEmbeddedRight) {
String align = "left";
if (styleEnum == AnnouncementStyleEnum.imgEmbeddedRight)
align = "right";
%>
 
 
<p>
<div class="imageAnnouncement">
<img align="left" alt="<%=Announcement.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>">
<%
if (Announcement.getBigImage() != null) {
%>
<img align="<%=align%>" alt="<%=Announcement.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>">
<%
} else if (Announcement.getSmallImage() != null) {
%>
<img align="<%=align%>" alt="<%=Announcement.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>">
<%
}
%>
</div>
${Announcement.formatedText}
<%
}
if (Announcement.getUrl() != null) {
%>
${Announcement.text}
<%
if(Announcement.getUrl()!=null)
{
%>
<html:link href="${Announcement.url}">Ver +</html:link>
<%
}%>
</p>
</p>
<%
} else if (styleEnum == AnnouncementStyleEnum.imgTop) {
%>
<table>
<tr>
<td>
<div class="imageAnnouncement">
<%
if (Announcement.getBigImage() != null) {
%>
<img alt="<%=Announcement.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>">
<%
} else if (Announcement.getSmallImage() != null) {
%>
<img alt="<%=Announcement.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>">
<%
}
%>
</div>
</td>
</tr>
<tr>
<td>${Announcement.formatedText}</td>
</tr>
</table>
<%
} else if (styleEnum == AnnouncementStyleEnum.imgLeft) {
%>
<table>
<tr>
<td>
<div class="imageAnnouncement">
<%
if (Announcement.getBigImage() != null) {
%>
<img alt="<%=Announcement.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>">
<%
} else if (Announcement.getSmallImage() != null) {
%>
<img alt="<%=Announcement.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>">
<%
}
%>
</div>
</td>
<td>${Announcement.formatedText}</td>
</tr>
</table>
<%
} else if (styleEnum == AnnouncementStyleEnum.imgRight) {
%>
<table>
<tr>
<td>${Announcement.formatedText}</td>
<td>
<div class="imageAnnouncement">
<%
if (Announcement.getBigImage() != null) {
%>
<img alt="<%=Announcement.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getBigImage().getId()%>">
<%
} else if (Announcement.getSmallImage() != null) {
%>
<img alt="<%=Announcement.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=Announcement.getSmallImage().getId()%>">
<%
}
%>
</div>
</td>
</tr>
</table>
<%
}
%>
</div>