Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 178 → Rev 179

/impl/conf/language/MessageResources.properties
223,6 → 223,11
menu.antigosAlunos=Antigos Alunos
menu.futurosAlunos=Futuros Alunos
 
student=Estudante
worker=Funcionario
teacher=Professor
user=Usuario
 
#Mensagens Status
authentication.ok=Benvindo Fulano
logout.ok=Caro {0}, obrigado por usar o nosso serviço.
266,6 → 271,7
profile.create.teacher=Criar Professor
profile.create.student=Criar Aluno
profile.create.user=Criar Utilizador
profile.create.users=Criar Usuario
 
profile.pop3server=Servidor de POP3
profile.pop3username=Username do Servidor de POP3
/impl/conf/WEB-INF/struts/struts-searchusers.xml
44,6 → 44,7
input="page.load.profile.from.service.zone">
<forward name="success" path="page.separators.serviceZone"/>
<forward name="load" path="page.load.profile.from.service.zone"/>
<forward name="create" path="page.create.profile.from.service.zone"/>
<forward name="search" path="page.find.profile.from.service.zone"/>
<forward name="from.add.role" path="page.load.profile.from.service.zone"/>
</action>
/impl/conf/WEB-INF/struts/tiles-searchusers.xml
35,6 → 35,12
<put name="topnav" value="/user/serviceZone/topnavSearchProfile.jsp"/>
<put name="body" value="/admin/profile/findUser.jsp" />
</definition>
<definition name="page.create.profile.from.service.zone" extends="base.separators">
<put name="title" value="Find User Profile" />
<put name="separator" value="4" type="string" />
<put name="topnav" value="/user/serviceZone/topnavCreateProfile.jsp"/>
<put name="body" value="/admin/profile/profile.jsp" />
</definition>
<definition name="page.load.profile.from.service.zone" extends="base.separators">
<put name="title" value="Find User Profile" />
<put name="separator" value="4" type="string" />
/impl/src/java/pt/estgp/estgweb/services/profile/SearchUserService.java
14,9 → 14,9
 
private static final Logger logger = Logger.getLogger(SearchUserService.class);
 
public List<UserView> run(String textToSearch, UserSession userSession)
public List<UserView> run(String textToSearch,String typeToSearch, UserSession userSession)
{
List<User> users = DaoFactory.getUserDaoImpl().findUsers(textToSearch);
List<User> users =DaoFactory.getUserDaoImpl().findUsers(textToSearch,typeToSearch);
if(users == null)
return null;
List<UserView> userViews = new ArrayList<UserView>();
/impl/src/java/pt/estgp/estgweb/domain/dao/impl/UserDaoImpl.java
8,6 → 8,7
import static org.hibernate.criterion.Restrictions.*;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.SimpleExpression;
import org.apache.log4j.Logger;
 
 
import java.util.List;
25,6 → 26,9
*/
public class UserDaoImpl<Announcement> extends UserDao
{
 
private static final Logger logger = Logger.getLogger(UserDaoImpl.class);
 
public static UserDaoImpl getInstance()
{
if (myInstance == null)
125,7 → 129,27
 
public List<User> findUsers (String textToSearch)
{
Criteria criteria = createCriteria();
return findUsers(textToSearch,null);
}
 
public List<User> findUsers (String textToSearch,String typeToSearch)
{
Criteria criteria=null;
if(typeToSearch!=null && typeToSearch.trim().length()!=0)
{
try
{
criteria = createCriteria(Class.forName(typeToSearch));
}
catch (ClassNotFoundException e)
{
logger.error(e,e);
}
}
else
{
criteria=createCriteria();
}
Criterion name= or(like("name","%"+textToSearch+"%"),like("name","%"+textToSearch+"%"));
Criterion username = or(like("username", "%" + textToSearch + "%"), like("username", "%" + textToSearch + "%"));
Criterion email = or(like("email", "%" + textToSearch + "%"), like("email", "%" + textToSearch + "%"));
/impl/src/java/pt/estgp/estgweb/web/form/profile/ProfileForm.java
27,6 → 27,7
private long userIDToChange;
private String birthDayDate;
private String typeClass;
private String typeToSearch;
 
public ProfileForm()
{
67,6 → 68,16
}
 
 
public String getTypeToSearch()
{
return typeToSearch;
}
 
public void setTypeToSearch(String typeToSearch)
{
this.typeToSearch = typeToSearch;
}
 
public List<UserView> getUsersFind() {
return usersFind;
}
/impl/src/java/pt/estgp/estgweb/web/controllers/profile/ProfileController.java
128,7 → 128,7
pF.setSelectedRoles(uV.getUserRoles());
userSession.put(TARGET_ROLES_KEY, (Serializable) uV.getUserRoles());
userSession.serialize(request, response);
return mapping.findForward("load"); //todo muda para new copy paste do load mas muda topnav
return mapping.findForward("create");
}
catch (FilterChainFailedException e)
{
197,7 → 197,7
ProfileForm profileForm = new ProfileForm();
IServiceManager sm = ServiceManager.getInstance();
String[] names = new String[]{"serializable"};
Object[] args = new Object[]{fromRequest.getTextToSearch()};
Object[] args = new Object[]{fromRequest.getTextToSearch(),profileForm.getTypeToSearch()};
List<UserView> uVs = (List<UserView>) sm.execute(RequestUtils.getRequester(request, response), "SearchUser", args, names);
profileForm.setUsersFind(uVs);
request.setAttribute("ProfileForm", profileForm);
/impl/src/web/admin/profile/findUser.jsp
1,3 → 1,7
<%@ page import="pt.estgp.estgweb.domain.User" %>
<%@ page import="pt.estgp.estgweb.domain.UserImpl" %>
<%@ page import="pt.estgp.estgweb.domain.TeacherImpl" %>
<%@ page import="pt.estgp.estgweb.domain.StudentImpl" %>
<%@ 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" %>
18,6 → 22,13
<html:text property="textToSearch" maxlength="50"/>
</td>
<td>
<html:select property="typeToSearch">
<html:option value="<%=(UserImpl.class).getName()%>"><bean:message key="user"/></html:option>
<html:option value="<%=(StudentImpl.class).getName()%>"><bean:message key="student"/></html:option>
<html:option value="<%=(TeacherImpl.class).getName()%>"><bean:message key="teacher"/></html:option>
</html:select>
</td>
<td>
<input type="button" onclick="set(this.form,'search');this.form.submit()" value="<bean:message key="search"/>">
</td>
</tr>
/impl/src/web/admin/profile/profile.jsp
142,7 → 142,7
<bean:message key="address"/>
</th>
<td>
<html:text property="userView.address" maxlength="250" readonly="true"/>
<html:text property="userView.address" maxlength="250"/>
</td>
</tr>
<tr>
/impl/src/web/user/serviceZone/topnavCreateProfile.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, "profile.create.users");
%>
<jsp:include page="/layout/topnav.jsp"/>