diff --git a/YACOSWeb/src/org/yacos/web/author/controller/MainController.java b/YACOSWeb/src/org/yacos/web/author/controller/MainController.java index f61dea4..f21f3be 100644 --- a/YACOSWeb/src/org/yacos/web/author/controller/MainController.java +++ b/YACOSWeb/src/org/yacos/web/author/controller/MainController.java @@ -2,6 +2,7 @@ package org.yacos.web.author.controller; import org.springframework.web.servlet.mvc.SimpleFormController; import org.springframework.web.servlet.ModelAndView; +import org.yacos.core.conferences.Conference; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -19,6 +20,10 @@ public class MainController extends SimpleFormController { logger.info("Returning main view"); + /*ajout en session d'un idconf et loginUser;*/ + request.getSession().setAttribute("user","toto"); + request.getSession().setAttribute("conference",1); + //FIXME return new ModelAndView("main"); } diff --git a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java index 7304fd0..33164d8 100644 --- a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java +++ b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java @@ -18,9 +18,11 @@ import org.springframework.web.multipart.MultipartFile; 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.web.author.form.*; +import org.yacos.core.article.Article; +import org.yacos.core.article.IArticleManager; +import org.yacos.core.conferences.Conference; +import org.yacos.core.users.User; +import org.yacos.web.author.form.FormSubmission; public class SArticleController extends SimpleFormController { @@ -33,9 +35,13 @@ public class SArticleController extends SimpleFormController { HttpServletResponse response, Object command, BindException errors) throws ServletException, IllegalStateException { + //on recupère l'id de conference + Conference conf = (Conference)request.getSession().getAttribute("conference"); + //on recupère le login de l'utilisateur + User user = (User)request.getSession().getAttribute("user"); + String title = ((FormSubmission) command).getTitle(); String theme = ((FormSubmission) command).getTheme(); - String mainauthor = ((FormSubmission) command).getMainauthor(); //String secondaryauthor = ((FormSubmission) command).getSecondaryauthor(); //TODO : get secondary author working List liste = ((FormSubmission) command).getListe(); @@ -68,7 +74,7 @@ public class SArticleController extends SimpleFormController { System.out.println(e); } - articleManager.addArticle(0, title, theme, nomFile, mainauthor, liste, 1); + articleManager.addArticle(title, theme, nomFile, user.getLogin(), liste, Article.State.SUMMARY, conf.getId()); return new ModelAndView(new RedirectView(getSuccessView())); }