Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 55 → Rev 56

/impl/conf/language/MessageResources.properties
173,6 → 173,7
portal.contactos.centro.informatico=Centro informático
portal.contactos.reprografia=Reprografia
portal.contactos.docentes=Docentes
portal.contactos.associacao.estudantes=Associação de Estudantes
portal.contactos.gabinete.comunicacao=Gabinete de Comunicação
portal.contactos.aaaipp=AAAIPP
portal.contactos.conselho.directivo=Conselho Directivo
/impl/conf/app.properties
61,6 → 61,12
announcements.automatic.validation.role.3=ci
announcements.automatic.validation.role.4=administrativeCouncil
 
student.auto.validation.targets=student,oldStudent,futureStudent,erasmusStudent
 
 
student.auto.validation.types=news,top.flash.news
 
 
announcements.max.visible=10
announcements.top.flash.news.timeout.miliseconds=7000
 
/impl/src/java/openldap/Test.java
7,40 → 7,106
import java.util.Set;
import openldap.LdapManagerFactory;
 
public class Test
public class Test
{
public static void main(String[] args) throws Exception
 
public String getName(HashMap text)
{
//System.out.println(LdapManagerFactory.getLdapManager().login("a8824","21286"));
HashMap map = LdapManagerFactory.getLdapManager().getUserInfo("a8822");
Set s = map.entrySet();
Set s = text.entrySet();
Iterator iter = s.iterator();
/* while(iter.hasNext())
int iterCount=0;
String name=null;
 
while(iter.hasNext())
{
Map.Entry e = (Entry) iter.next();
System.out.println(e.getKey() + ":" + e.getValue());
if(iterCount==3)
{
name=e.getValue().toString();
}
iterCount++;
}
map = LdapManagerFactory.getLdapManager().getUserInfo("a8822");
s = map.entrySet();
iter = s.iterator();*/
int iterNumber=0;
String[] messageBrokenDot=null;
String[] spliters={",","="};
return name;
}
 
public String getRoles(HashMap text)
{
Set s = text.entrySet();
Iterator iter = s.iterator();
int iterCount=0;
String roles=null;
 
while(iter.hasNext())
{
Map.Entry e = (Entry) iter.next();
if(iterNumber==3)
if(iterCount==0)
{
messageBrokenDot=e.getValue().toString().split(spliters[0]);
String[] splitText=e.getValue().toString().split(",");
if(splitText[1].contains("CN"))
{
roles="student";
}
else if(splitText[1].contains("OU"))
{
roles="teacher";
}
}
iterNumber++;
//System.out.println(e.getKey() + ":" + e.getValue());
iterCount++;
}
for (int i = 0 ; i < iterNumber ; i++) {
// System.out.println("->" + messageBrokenDot[i].split(spliters[1]));
return roles;
}
 
public static void main(String[] args) throws Exception
{
//System.out.println(LdapManagerFactory.getLdapManager().login("a8824","21286"));
HashMap map = LdapManagerFactory.getLdapManager().getUserInfo("jmachado");
Set s = map.entrySet();
Iterator iter = s.iterator();
/* while(iter.hasNext())
{
Map.Entry e = (Entry) iter.next();
System.out.println(e.getKey() + ":" + e.getValue());
}
map = LdapManagerFactory.getLdapManager().getUserInfo("a8822");
s = map.entrySet();
iter = s.iterator();*/
 
/*while(iter.hasNext())
{
Map.Entry e = (Entry) iter.next();
 
System.out.println(e.getKey() + "-->" + e.getValue());
} */
//Set s = text.entrySet();
//Iterator iter = s.iterator();
int iterCount=0;
String name=null;
String roles=null;
 
while(iter.hasNext())
{
Map.Entry e = (Entry) iter.next();
if(iterCount==0)
{
String[] splitText=e.getValue().toString().split(",");
if(splitText[1].contains("CN"))
{
roles="student";
}
else if(splitText[1].contains("OU"))
{
roles="teacher";
}
}
 
if(iterCount==3)
{
name=e.getValue().toString();
}
iterCount++;
}
System.out.println("nome-->" + name);
System.out.println("nome-->" + roles);
 
}
}
/impl/src/java/pt/estgp/estgweb/services/announcements/CreateAnnouncementService.java
44,9 → 44,85
 
//Se for de validacao automatica ha de aparecer a combobox na web page e o user é que escolhe
//se não pomos false
if(!RoleManager.hasRole(userSession.getUser(),Globals.AUTOMATIC_VALIDATION_ROLES))
announcement.setStatus(false);
if(RoleManager.hasRole(userSession.getUser(),Globals.AUTOMATIC_VALIDATION_ROLES))
announcement.setStatus(true);
else
{
String[] userRoles=announcement.getChoosedOwnerRole().split(",");
Boolean validation=false;
 
for(String role: userRoles)
{
if(!role.equals("all")&&validation==false)
{
try
{
String validationTargets=role+".auto.validation.targets";
String userAutoValitation=ConfigProperties.getProperty(validationTargets);
String[] userAutoValitationRoles=userAutoValitation.split(",");
int validTargetRoles=0;
if(announcement.getTargetRoles().contains(","))
{
String[] targetRolesAnnouncementSplited=announcement.getTargetRoles().split(",");
 
//Percorre os targets todos a quem se destina
for(String target: targetRolesAnnouncementSplited)
{
//Percorre todos os validation targets
for(String userTargetRoles: userAutoValitationRoles)
{
//Se o target a quem se destina constar na lista dos validation targets então incrementa
//o validTargetRoles
if(target.equals(userTargetRoles))
{
validTargetRoles++;
}
}
}
//Se o numero de roles validados for igual ao numero de targets a quem se destina
//Vai verificar se possui validationType para o type announcement
if(validTargetRoles==targetRolesAnnouncementSplited.length)
{
String validationTypes=role +".auto.validation.types";
String userAutoTypes=ConfigProperties.getProperty(validationTypes);
String[] userAutoValitationTypes=userAutoTypes.split(",");
for(String types: userAutoValitationTypes)
{
if(types.equals(announcement.getType()))
validation=true;
}
}
}
else
{
String targetRolesAnnouncement=announcement.getTargetRoles();
//Percorre todos os validation targets
for(String userTargetRoles: userAutoValitationRoles)
{
if(targetRolesAnnouncement.equals(userTargetRoles))
{
validTargetRoles++;
}
}
if(validTargetRoles==1)
{
String validationTypes=role +".auto.validation.types";
String userAutoTypes=ConfigProperties.getProperty(validationTypes);
String[] userAutoValitationTypes=userAutoTypes.split(",");
for(String types: userAutoValitationTypes)
{
if(types.equals(announcement.getType()))
validation=true;
}
}
}
}
catch(Exception e){}
}
}
announcement.setStatus(validation);
}
 
DaoFactory.getAnnouncementDaoImpl().save(announcement);
logger.info("Creating announcement:" + announcement.getId());
return new AnnouncementView(announcement);
/impl/src/java/pt/estgp/estgweb/services/authenticate/AuthenticateService.java
13,6 → 13,9
import openldap.LdapManagerFactory;
 
import java.util.HashMap;
import java.util.Set;
import java.util.Iterator;
import java.util.Map;
 
 
/*
81,13 → 84,59
{
HashMap map = ldapManager.getUserInfo(username);
UserImpl u = DomainObjectFactory.createUserImpl();
u.setUsername(username);
u.setEmail((String) map.get("email"));
u.setName((String) map.get("name")); //isto esta mal e so para exemplificar depois tem de se ver isto bem
u.setUsername(username);
u.setName(getName(map));
u.setRoles(getRoles(map));
u.setNewUser(true);
DaoFactory.getUserDaoImpl().save(u);
return u;
}
 
private String getName(HashMap text)
{
Set s = text.entrySet();
Iterator iter = s.iterator();
int iterCount=0;
String name=null;
 
while(iter.hasNext())
{
Map.Entry e = (Map.Entry) iter.next();
if(iterCount==3)
{
name=e.getValue().toString();
}
iterCount++;
}
return name;
}
 
public String getRoles(HashMap text)
{
Set s = text.entrySet();
Iterator iter = s.iterator();
int iterCount=0;
String roles=null;
 
while(iter.hasNext())
{
Map.Entry e = (Map.Entry) iter.next();
if(iterCount==0)
{
String[] splitText=e.getValue().toString().split(",");
if(splitText[1].contains("CN"))
{
roles="student";
}
else if(splitText[1].contains("OU"))
{
roles="teacher";
}
}
iterCount++;
}
return roles;
}
}
 
 
/impl/src/java/pt/estgp/estgweb/web/ImageStream.java
31,7 → 31,6
AbstractDao.getCurrentSession().beginTransaction();
Image image = new ImageDaoImpl().get(id);
try {
//String mimeType = MimeTypeGuesser.getInstance().guessMimeType(a.getName());
response.setContentType(image.getContentType());
byte[] imagemStream = image.getImage();
response.setContentLength(imagemStream.length);
/impl/src/web/auth/autenticationok.jsp
8,4 → 8,4
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
 
<bean:message key="authentication.ok"/> <bean:write name="UserSession" property="username"/>
<bean:message key="authentication.ok"/> <bean:write name="UserSession" property="name"/>
/impl/src/web/css/style.css
282,11 → 282,16
text-decoration:none;
}
 
.portalLeftAnnouncements img
{
height:133px;
}
 
/*PASSA PARA AQUI TUDO O QUE SEJA DE BLOCOS E VAMOS LIMPAR TUDO */
 
/*Isto tem de ser generico o H1 jáe um header nao necessita da classe .header para nada*/
/*Block Titles*/
.content h1, #lastnews h1
.content h1, #lastnews h1
{
margin-bottom:1px;
color:#FFFFFF;
322,10 → 327,11
{
margin:0;
text-align :right;
text-decoration:none;
}
#flashTopNews img
{
height:100px;
height:167px;
}
#flashTopNews * td
{
345,10 → 351,12
{
color:#8EC73F;
font-weight:bold;
text-decoration:none;
}
#flashTopNews p a:link, #flashTopNews p a:visited
{
color:#FFFFFF;
text-decoration:none;
}
 
/*FlashCenterNews*/
371,22 → 379,37
{
color:#8EC73F;
font-weight:bold;
text-decoration:none;
}
#flashCenterNews p a:link, #flashCenterNews p a:visited
{
color:#4d4d4d;
text-decoration:none;
}
#flashCenterNews img
#flashCenterNews img,#flashCenterNews td.imageContainer
{
width:100px;
width:133px;
}
 
 
 
/*FlashBottomNews*/
#flashBottomNews img
{
width:50px;
width:100px;
}
 
#flashBottomNews h2 a:link,#flashBottomNews h2 a:visited
{
color:#8EC73F;
font-weight:bold;
}
 
#flashBottomNews p a:link,#flashBottomNews p a:visited
{
color:#4d4d4d;
}
 
/*Last News Block*/
#lastnews ul
{
420,7 → 443,7
color:#4d4d4d;
}
#lastnews li h2 a:hover,.linkLeftMenu a:hover
{
{
color:#8EC73F;
}
 
/impl/src/web/public/index.jsp
45,16 → 45,19
</table>
</div>
 
<div id="flashCenterNews">
<table class="container">
<tr>
<logic:iterate id="item" name="Announcements" type="pt.estgp.estgweb.domain.views.AnnouncementView">
<logic:equal value="bottom.flash.news" name="item" property="type">
<%if(centerAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS_INDEX)
{
%>
<logic:iterate id="item" name="Announcements" type="pt.estgp.estgweb.domain.views.AnnouncementView">
<logic:equal value="bottom.flash.news" name="item" property="type">
 
<%if(centerAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS_INDEX)
{
if(centerAnnouncements==1)
{ %>
<div id="flashCenterNews">
<table class="container">
<tr>
<%}%>
<td class="imageContainer">
<img alt="Tens de por sempre um alt boas praticas W3C. jm" src="<%=request.getContextPath()%>/imgs/destaque_2_1.jpg"/>
<%if(item.getSmallImage() != null){%><img alt="<%=item.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=item.getSmallImage().getId()%>"><%}%>
</td>
<td class="textContainer">
<h2>
64,68 → 67,65
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load" >${item.text}</html:link>
</p>
</td>
<%
}
else
{
//todo este else não tinha nada
}
centerAnnouncements++;
%>
</logic:equal>
</logic:iterate>
</tr>
</table>
</div>
 
<div id="flashBottomNews">
<table class="container">
<tr>
<div class="textNewsBottom">
<logic:iterate id="item" name="Announcements" type="pt.estgp.estgweb.domain.views.AnnouncementView">
<logic:equal value="news" name="item" property="type">
<%if(bottomAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_NEW_INDEX)
{
%>
<td class="imageNewsBottom">
<img src="<%=request.getContextPath()%>/imgs/destaque_3_3.gif"/>
</td>
<%
}
else{
}
bottomAnnouncements++;
%>
</logic:equal>
</logic:iterate>
</div>
</tr>
<tr>
<%bottomAnnouncements=0;%>
<div class="textNewsBottom">
<logic:iterate length="5" id="item" name="Announcements" type="pt.estgp.estgweb.domain.views.AnnouncementView">
<logic:equal value="news" name="item" property="type">
<%
if(bottomAnnouncements<=4)
{
%>
<td width="50px">
<div class="titleNewsBottom">
<%if(centerAnnouncements==Globals.NUMBER_ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS_INDEX)
{%>
</tr>
</table>
</div>
<%
}
centerAnnouncements++;
}
else if(bottomAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_NEW_INDEX)
{
if(bottomAnnouncements==1)
{
%>
 
<div id="flashBottomNews">
<table class="container">
<tr>
<%}%>
<td>
<div class="imageContainer">
<%if(item.getSmallImage() != null){%><img alt="<%=item.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=item.getSmallImage().getId()%>"><%}%>
</div>
<div class="textContainer">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</div>
<div class="descriptionNewsBottom">
</h2>
<p>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load" >${item.text}</html:link>
</div>
</td>
<%
}
bottomAnnouncements++;
%>
</logic:equal>
</logic:iterate>
</div>
</tr>
</table>
</div>
</p>
</div>
</td>
<%if(bottomAnnouncements==Globals.NUMBER_ANNOUNCEMENT_TYPE_NEW_INDEX)
{%>
</tr>
</table>
</div>
<%
}
 
bottomAnnouncements++;
}
%>
</logic:equal>
</logic:iterate>
<%if(bottomAnnouncements>1 && bottomAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_NEW_INDEX)
{
%>
</tr>
</table>
</div>
<%}%>
<%if(centerAnnouncements>1 && centerAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS_INDEX)
{
%>
</tr>
</table>
</div>
<%}%>
</div>
 
/impl/src/web/public/portals/alunos/contactosLinks.jsp
13,4 → 13,5
topNav.addNavPlace(startLink + "/contactosGabineteComunicacao.html"+Globals.PORTAL_ROLE_VIEW_STUDENT, "portal.contactos.gabinete.comunicacao");
topNav.addNavPlace(startLink + "/contactosReprografia.html"+Globals.PORTAL_ROLE_VIEW_STUDENT, "portal.contactos.reprografia");
topNav.addNavPlace(startLink + "/contactosDocentesContactos.html"+Globals.PORTAL_ROLE_VIEW_STUDENT, "portal.contactos.docentes");
topNav.addNavPlace(startLink + "/associacaoEstudantes.html"+Globals.PORTAL_ROLE_VIEW_STUDENT, "portal.contactos.associacao.estudantes");
%>
/impl/src/web/public/portals/alunos/accaoSocialLinks.jsp
13,4 → 13,5
topNav.addNavPlace(startLink + "/accaoSocialDesportoCultura.html"+Globals.PORTAL_ROLE_VIEW_STUDENT, "portal.accao.social.desporto.cultura");
topNav.addNavPlace(startLink + "/accaoSocialGaap.html"+Globals.PORTAL_ROLE_VIEW_STUDENT, "portal.accao.social.gapp");
topNav.addNavPlace(startLink + "/accaoSocialInformacoes.html"+Globals.PORTAL_ROLE_VIEW_STUDENT, "portal.accao.social.informacoes");
topNav.addNavPlace(startLink + "/cantinas"+Globals.PORTAL_ROLE_VIEW_STUDENT, "portal.accao.social.cantinas");
%>
/impl/src/web/public/announcements/announcementsPortalLeft.jsp
18,7 → 18,7
<%
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{};
Object[] args = new Object[]{request.getParameter("role"), Globals.ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS};
Object[] args = new Object[]{request.getParameter("role"), Globals.ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS};
List<AnnouncementView> announcementViews = (List<AnnouncementView>) sm.execute(RequestUtils.getRequester(request), "LoadRoleTypeMaxAnnouncements", args, names);
request.setAttribute("Announcements", announcementViews);
%>
31,7 → 31,7
<td>
<div class="portalAnnouncementTop">
<div class="imageAnnouncementTop">
<img src="<%=request.getContextPath()%>/imgs/destaque_2_1.jpg"/>
<%if(item.getSmallImage() != null){%><img alt="<%=item.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=item.getSmallImage().getId()%>"><%}%>
</div>
<div class="portalAnnouncement">
<logic:empty name="item" property="url">
44,11 → 44,9
</logic:notEmpty>
</div>
</div>
 
</td>
 
</tr>
</logic:iterate>
</logic:present>
</table>
</div>
</div>
/impl/build.xml
277,7 → 277,7
</fileset>
</copy>
<replace file="${build.dir.war}/js/ajax.js">
<replacefilter token="@server.base.url@" value="${tomcat.context.path}"/>
<replacefilter token="@server.base.url@" value="${service.url}"/>
</replace>
</target>