Policy failures:

Code warning
- failed on resource MainController.java. Reason: The import org.yacos.core.conferences.Conference is never used, line 5
- failed on resource SArticleController.java. Reason: The method toURL() from the type File is deprecated, line 6
Override reason:   
s
This commit is contained in:
Maxime Dagnicourt
2008-01-24 15:27:03 +00:00
parent 0a7f675aa4
commit c24a45c732
2 changed files with 16 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ package org.yacos.web.author.controller;
import org.springframework.web.servlet.mvc.SimpleFormController; import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.yacos.core.conferences.Conference;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -19,6 +20,10 @@ public class MainController extends SimpleFormController {
logger.info("Returning main view"); 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"); return new ModelAndView("main");
} }

View File

@@ -18,9 +18,11 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController; import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
import org.yacos.core.article.Article;
import org.yacos.core.article.*; import org.yacos.core.article.IArticleManager;
import org.yacos.web.author.form.*; import org.yacos.core.conferences.Conference;
import org.yacos.core.users.User;
import org.yacos.web.author.form.FormSubmission;
public class SArticleController extends SimpleFormController { public class SArticleController extends SimpleFormController {
@@ -33,9 +35,13 @@ public class SArticleController extends SimpleFormController {
HttpServletResponse response, Object command, BindException errors) HttpServletResponse response, Object command, BindException errors)
throws ServletException, IllegalStateException { 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 title = ((FormSubmission) command).getTitle();
String theme = ((FormSubmission) command).getTheme(); 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 //TODO : get secondary author working
List<String> liste = ((FormSubmission) command).getListe(); List<String> liste = ((FormSubmission) command).getListe();
@@ -68,7 +74,7 @@ public class SArticleController extends SimpleFormController {
System.out.println(e); 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())); return new ModelAndView(new RedirectView(getSuccessView()));
} }