diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp
index 4867f60..e3abdbf 100644
--- a/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp
+++ b/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp
@@ -21,10 +21,13 @@
-
+
+
+
+
-
+
diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/dispatchArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/dispatchArticle.jsp
index 0ffe25f..d6d6d8a 100644
--- a/YACOSWeb/WebContent/WEB-INF/jsp/dispatchArticle.jsp
+++ b/YACOSWeb/WebContent/WEB-INF/jsp/dispatchArticle.jsp
@@ -38,13 +38,13 @@
-
+
diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/registerUser.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/registerUser.jsp
new file mode 100644
index 0000000..962e938
--- /dev/null
+++ b/YACOSWeb/WebContent/WEB-INF/jsp/registerUser.jsp
@@ -0,0 +1,56 @@
+<%@ include file="/WEB-INF/jsp/include.jsp"%>
+<%@ page session="false" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml
index 29e8209..5d1bdb7 100644
--- a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml
+++ b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml
@@ -39,7 +39,7 @@
-
+
diff --git a/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceControllerOK.java b/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceControllerOK.java
index f86ad37..c825363 100644
--- a/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceControllerOK.java
+++ b/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceControllerOK.java
@@ -6,12 +6,9 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import java.io.IOException;
-import java.util.Date;
public class ChoosePreferenceControllerOK extends SimpleFormController {
diff --git a/YACOSWeb/src/org/yacos/web/PCmember/controller/DispatchArticleController.java b/YACOSWeb/src/org/yacos/web/PCmember/controller/DispatchArticleController.java
index c236b73..e9b707a 100644
--- a/YACOSWeb/src/org/yacos/web/PCmember/controller/DispatchArticleController.java
+++ b/YACOSWeb/src/org/yacos/web/PCmember/controller/DispatchArticleController.java
@@ -5,7 +5,6 @@ import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.BindException;
diff --git a/YACOSWeb/src/org/yacos/web/PCmember/controller/ListArticleController.java b/YACOSWeb/src/org/yacos/web/PCmember/controller/ListArticleController.java
index 14da99b..ba954db 100644
--- a/YACOSWeb/src/org/yacos/web/PCmember/controller/ListArticleController.java
+++ b/YACOSWeb/src/org/yacos/web/PCmember/controller/ListArticleController.java
@@ -2,16 +2,12 @@ package org.yacos.web.PCmember.controller;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.ModelAndView;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import java.io.IOException;
-import java.util.Date;
import java.util.List;
import org.yacos.core.article.*;
diff --git a/YACOSWeb/src/org/yacos/web/author/controller/MainController.java b/YACOSWeb/src/org/yacos/web/author/controller/MainController.java
index 63ec69b..73f2b9e 100644
--- a/YACOSWeb/src/org/yacos/web/author/controller/MainController.java
+++ b/YACOSWeb/src/org/yacos/web/author/controller/MainController.java
@@ -6,12 +6,9 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import java.io.IOException;
-import java.util.Date;
public class MainController extends SimpleFormController {
diff --git a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java
index 1b401e4..95e8857 100644
--- a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java
+++ b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java
@@ -36,7 +36,8 @@ public class SArticleController extends SimpleFormController {
String title = ((FormSubmission) command).getTitle();
String theme = ((FormSubmission) command).getTheme();
String mainauthor = ((FormSubmission) command).getMainauthor();
- String secondaryauthor = ((FormSubmission) command).getSecondaryauthor();
+ //String secondaryauthor = ((FormSubmission) command).getSecondaryauthor();
+ //TODO : get secondary author working
List liste = ((FormSubmission) command).getListe();
String nomFile="";
@@ -66,7 +67,7 @@ public class SArticleController extends SimpleFormController {
System.out.println(e);
}
- Article a = new Article(0, title, theme, nomFile, mainauthor, null, 1);
+ Article a = new Article(0, title, theme, nomFile, mainauthor, liste, 1);
articleManager.addArticle(a);
return new ModelAndView(new RedirectView(getSuccessView()));
diff --git a/YACOSWeb/src/org/yacos/web/author/controller/SArticleControllerOK.java b/YACOSWeb/src/org/yacos/web/author/controller/SArticleControllerOK.java
index 11988a2..4f6a5e3 100644
--- a/YACOSWeb/src/org/yacos/web/author/controller/SArticleControllerOK.java
+++ b/YACOSWeb/src/org/yacos/web/author/controller/SArticleControllerOK.java
@@ -2,16 +2,12 @@ package org.yacos.web.author.controller;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.ModelAndView;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import java.io.IOException;
-import java.util.Date;
public class SArticleControllerOK extends SimpleFormController {
diff --git a/YACOSWeb/src/org/yacos/web/system/controller/SUserController.java b/YACOSWeb/src/org/yacos/web/system/controller/SUserController.java
new file mode 100644
index 0000000..83dbc72
--- /dev/null
+++ b/YACOSWeb/src/org/yacos/web/system/controller/SUserController.java
@@ -0,0 +1,86 @@
+/**
+ *
+ */
+package org.yacos.web.system.controller;
+
+import javax.servlet.http.HttpServletRequest;
+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.yacos.core.article.IArticleManager;
+import org.yacos.core.users.IUserManager;
+import org.yacos.core.users.User;
+import org.yacos.core.users.UserManagerBean;
+import org.yacos.web.system.form.FormUser;
+
+/**
+ * FormController class for the user Sign In scenario (user registration)
+ *
+ * TODO: implement the invitation system
+ *
+ * @author christiancorsano
+ *
+ */
+public class SUserController extends SimpleFormController {
+
+ private IUserManager userManager;
+ /**
+ * @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, org.springframework.validation.BindException)
+ */
+ @Override
+ protected ModelAndView onSubmit(HttpServletRequest request,
+ HttpServletResponse response, Object command, BindException errors)
+ throws Exception {
+ FormUser userCommand = (FormUser) command;
+ User user = (User) request.getSession().getAttribute("currentUser");
+
+ if((user == null) && (userManager.getUser(userCommand.getLogin()) != null)){
+ // TODO : we have an "already registered" error here, handle it
+ }
+
+ if(user == null){
+ user = new User();
+ }
+
+ user.setLogin(userCommand.getLogin());
+ user.setEmail(userCommand.getEmail());
+ user.setFirstName(userCommand.getFirstName());
+ user.setLastName(userCommand.getLastName());
+ user.setOrganization(userCommand.getOrganization());
+
+ if(userCommand.passwordWasModified()){
+ user.setPassword(userCommand.getPassword());
+ }
+
+ // TODO Auto-generated method stub
+ return super.onSubmit(request, response, command, errors);
+ }
+
+ /**
+ * @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ protected Object formBackingObject(HttpServletRequest request)
+ throws Exception {
+ FormUser user = new FormUser();
+
+ // We try to see if the user is already registered and logged
+ User currentUser = new User();
+ // TODO : see how JAAS could change the way of getting the current User
+ if(request.getSession().getAttribute("currentUser") != null){
+ // If he is logged, we use his profile information to fill the form
+ currentUser = (User) request.getSession().getAttribute("currentUser");
+ }
+
+ user.setLogin(currentUser.getLogin());
+ user.setFirstName(currentUser.getFirstName());
+ user.setLastName(currentUser.getLastName());
+ user.setEmail(currentUser.getEmail());
+ user.setOrganization(currentUser.getOrganization());
+
+ return super.formBackingObject(request);
+ }
+
+}
diff --git a/YACOSWeb/src/org/yacos/web/system/form/FormUser.java b/YACOSWeb/src/org/yacos/web/system/form/FormUser.java
new file mode 100644
index 0000000..04575b9
--- /dev/null
+++ b/YACOSWeb/src/org/yacos/web/system/form/FormUser.java
@@ -0,0 +1,129 @@
+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
+ *
+ */
+public class FormUser {
+ private String login;
+ private String email;
+ private String password;
+ private String passwordConfirm;
+ private String firstName;
+ private String lastName;
+ private String organization;
+
+ private String passwordPlaceholderValue;
+
+ public FormUser() {
+ this.login = "";
+ this.email = "";
+
+ // We can't use the real password of the user, so we generate
+ // a hopefully unique placeholder value, that we will be able to check for modification at validation
+ Random placeholderSeed = new Random(new Date().getTime());
+ this.passwordPlaceholderValue = "placeholder"+placeholderSeed.nextInt();
+
+ this.password = this.passwordPlaceholderValue;
+ this.passwordConfirm = this.passwordPlaceholderValue;
+ this.firstName = "";
+ this.lastName = "";
+ this.organization = "";
+ }
+ /**
+ * @return the login
+ */
+ public String getLogin() {
+ return login;
+ }
+ /**
+ * @param login the login to set
+ */
+ public void setLogin(String login) {
+ this.login = login;
+ }
+ /**
+ * @return the email
+ */
+ public String getEmail() {
+ return email;
+ }
+ /**
+ * @param email the email to set
+ */
+ public void setEmail(String email) {
+ this.email = email;
+ }
+ /**
+ * @return the password
+ */
+ public String getPassword() {
+ return password;
+ }
+ /**
+ * @param password the password to set
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ /**
+ * @return the passwordConfirm
+ */
+ public String getPasswordConfirm() {
+ return passwordConfirm;
+ }
+ /**
+ * @param passwordConfirm the passwordConfirm to set
+ */
+ public void setPasswordConfirm(String passwordConfirm) {
+ this.passwordConfirm = passwordConfirm;
+ }
+ /**
+ * @return the firstName
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+ /**
+ * @param firstName the firstName to set
+ */
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+ /**
+ * @return the lastName
+ */
+ public String getLastName() {
+ return lastName;
+ }
+ /**
+ * @param lastName the lastName to set
+ */
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+ /**
+ * @return the organization
+ */
+ public String getOrganization() {
+ return organization;
+ }
+ /**
+ * @param organization the organization to set
+ */
+ public void setOrganization(String organization) {
+ this.organization = organization;
+ }
+ public boolean passwordWasModified() {
+ return this.passwordPlaceholderValue.equals(this.getPassword());
+ }
+
+
+}