Correction de choose preference en rapport avec les corrections du core de la révision 141
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<name>YACOSWeb</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>YACOSCore</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
<wb-module deploy-name="YACOSWeb">
|
||||
<wb-resource deploy-path="/" source-path="/WebContent"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
|
||||
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/YACOSCore/YACOSCore">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="context-root" value="YACOSWeb"/>
|
||||
<property name="java-output-path" value="build/classes"/>
|
||||
</wb-module>
|
||||
|
||||
@@ -10,6 +10,20 @@ form.submission.mainauthor=Main author
|
||||
form.submission.secondaryauthor=Secondary author
|
||||
form.submission.file=File
|
||||
|
||||
register.title=User Registration
|
||||
form.register.user.login=Login
|
||||
form.register.user.email=eMail
|
||||
form.register.user.password=Password
|
||||
form.register.user.passwordConfirm=Confirm password
|
||||
form.register.user.firstName=First Name
|
||||
form.register.user.lastName=Last Name
|
||||
form.register.user.organization=Organization
|
||||
form.register.error.loginTooShort=Login must be at least 3 characters long
|
||||
form.register.error.loginInvalid=
|
||||
form.register.error.passwordsDontMatches=The password doesn't match the confirmation
|
||||
form.register.error.firstNameEmpty=First name is required
|
||||
form.register.error.lastNameEmpty=Last name is required
|
||||
|
||||
button.add=Add
|
||||
button.browse=Browse
|
||||
button.reset=Reset
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<h2 align="center"><fmt:message key="preference.title" /></h2>
|
||||
|
||||
<c:if test="${message}">
|
||||
<fmt:message key="${message}"/>
|
||||
<fmt:message key="message"/>
|
||||
</c:if>
|
||||
|
||||
<form:form method="post" commandName="choosePreference">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title><fmt:message key="title"/></title>
|
||||
<link rel="stylesheet" href="./stylesheets/base.css" type="text/css" />
|
||||
</head>
|
||||
@@ -22,7 +22,7 @@
|
||||
<div id="main_content">
|
||||
|
||||
|
||||
<h2 align="center"><fmt:message key="register.title" /></h2>
|
||||
<h2><fmt:message key="register.title" /></h2>
|
||||
<form:form method="post" commandName="registerUser">
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
<input type="reset" value="<fmt:message key="button.reset" />"/>
|
||||
<input type="submit" value="<fmt:message key="button.OK" />"/> <br/><br/>
|
||||
|
||||
</form:form>
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,15 @@
|
||||
<property name="articleManager" ref="articleManager" />
|
||||
</bean>
|
||||
|
||||
<bean name="/registerUser.htm" class="org.yacos.web.system.controller.SUserRegistrationController">
|
||||
<property name="sessionForm" value="true"/>
|
||||
<property name="commandName" value="registerUser"/>
|
||||
<property name="commandClass" value="org.yacos.web.system.form.FormUser"/>
|
||||
<property name="formView" value="registerUser"/>
|
||||
<property name="successView" value="listArticle.htm" />
|
||||
<property name="usersManager" ref="usersManager" />
|
||||
</bean>
|
||||
|
||||
<bean name="/submissionArticle.htm" class="org.yacos.web.author.controller.SArticleController">
|
||||
<property name="sessionForm" value="true" />
|
||||
<property name="commandName" value="submissionArticle" />
|
||||
@@ -76,7 +85,6 @@
|
||||
<property name="successView" value="addConference2.htm" />
|
||||
<property name="conferenceManager" ref="conferenceManager" />
|
||||
</bean> -->
|
||||
</bean>
|
||||
|
||||
<!-- List all conference -->
|
||||
<bean name="/listConference.htm" class="org.yacos.web.system.controller.ListConferenceController">
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.yacos.web.PCmember.controller;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -10,6 +11,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||
import org.springframework.web.servlet.view.RedirectView;
|
||||
|
||||
import org.yacos.core.article.*;
|
||||
import org.yacos.core.users.IUserManager;
|
||||
@@ -23,7 +25,7 @@ public class ChoosePreferenceController extends SimpleFormController {
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private IArticleManager articleManager;
|
||||
private IUserManager usersManager;
|
||||
private IUserManager userManager;
|
||||
|
||||
@Override
|
||||
protected Object formBackingObject(HttpServletRequest request)
|
||||
@@ -33,11 +35,15 @@ public class ChoosePreferenceController extends SimpleFormController {
|
||||
|
||||
getServletContext().setAttribute("articleList", articleList);
|
||||
|
||||
User toto = usersManager.getUser("toto");
|
||||
// TODO : mock object, replace with real user management
|
||||
User toto = userManager.getUser("toto");
|
||||
if(toto == null){
|
||||
toto = userManager.addUser("toto", "toto", "Toto", "Toto", "Toto corp.", "toto@totocorp.com");
|
||||
}
|
||||
ArrayList<Preference> preferencesList = new ArrayList<Preference>();
|
||||
Preference pref;
|
||||
for(Article article : articleList){
|
||||
pref = articleManager.getArticlePreferenceForUser(article, toto.getLogin());
|
||||
pref = articleManager.getArticlePreferenceForUser(article.getId(), toto.getLogin());
|
||||
if(pref == null){
|
||||
pref = new Preference();
|
||||
pref.setArticle(article);
|
||||
@@ -63,13 +69,15 @@ public class ChoosePreferenceController extends SimpleFormController {
|
||||
List<Preference> listPreference=fp.getPreferences();
|
||||
|
||||
for(Preference preference : listPreference){
|
||||
articleManager.addArticlePreference(
|
||||
articleManager.addOrUpdatePreference(
|
||||
preference.getArticle().getId(),
|
||||
preference.getPcMember().getLogin(),
|
||||
preference.getPreference());
|
||||
}
|
||||
|
||||
return new ModelAndView("choosePreferenceOK");
|
||||
|
||||
Map<String, String> model = new HashMap<String, String>();
|
||||
model.put("message", "preference.ok");
|
||||
return new ModelAndView(new RedirectView(getSuccessView()),model);
|
||||
|
||||
}
|
||||
|
||||
@@ -82,10 +90,10 @@ public class ChoosePreferenceController extends SimpleFormController {
|
||||
}
|
||||
|
||||
public IUserManager getUsersManager() {
|
||||
return usersManager;
|
||||
return userManager;
|
||||
}
|
||||
|
||||
public void setUsersManager(IUserManager usersManager) {
|
||||
this.usersManager = usersManager;
|
||||
this.userManager = usersManager;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||
import org.springframework.web.servlet.view.RedirectView;
|
||||
import org.yacos.core.article.IArticleManager;
|
||||
import org.yacos.core.users.IUserManager;
|
||||
import org.yacos.core.users.User;
|
||||
@@ -23,9 +24,9 @@ import org.yacos.web.system.form.FormUser;
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
public class SUserController extends SimpleFormController {
|
||||
public class SUserRegistrationController extends SimpleFormController {
|
||||
|
||||
private IUserManager userManager;
|
||||
private IUserManager usersManager;
|
||||
/**
|
||||
* @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException)
|
||||
*/
|
||||
@@ -36,7 +37,7 @@ public class SUserController extends SimpleFormController {
|
||||
FormUser userCommand = (FormUser) command;
|
||||
User user = (User) request.getSession().getAttribute("currentUser");
|
||||
|
||||
if((user == null) && (userManager.getUser(userCommand.getLogin()) != null)){
|
||||
if((user == null) && (usersManager.getUser(userCommand.getLogin()) != null)){
|
||||
// TODO : we have an "already registered" error here, handle it
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ public class SUserController extends SimpleFormController {
|
||||
}
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
return super.onSubmit(request, response, command, errors);
|
||||
return new ModelAndView(new RedirectView(getSuccessView()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,5 +83,12 @@ public class SUserController extends SimpleFormController {
|
||||
|
||||
return super.formBackingObject(request);
|
||||
}
|
||||
|
||||
|
||||
public void setUsersManager(IUserManager usersManager) {
|
||||
this.usersManager = usersManager;
|
||||
}
|
||||
|
||||
public IUserManager getUsersManager() {
|
||||
return usersManager;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
package org.yacos.web.system.form;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
|
||||
import sun.security.krb5.internal.Ticket;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author christiancorsano
|
||||
@@ -124,6 +121,9 @@ public class FormUser {
|
||||
public boolean passwordWasModified() {
|
||||
return this.passwordPlaceholderValue.equals(this.getPassword());
|
||||
}
|
||||
public boolean passwordsMatches() {
|
||||
return this.password.equals(this.passwordConfirm);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user