diff --git a/YACOSWeb/WebContent/WEB-INF/classes/messages.properties b/YACOSWeb/WebContent/WEB-INF/classes/messages.properties index 4ad010d..7a258d9 100644 --- a/YACOSWeb/WebContent/WEB-INF/classes/messages.properties +++ b/YACOSWeb/WebContent/WEB-INF/classes/messages.properties @@ -72,6 +72,7 @@ menu.chairman.article.list=Article's list menu.chairman.article.dispatch=Dispatch articles menu.chairman.article.validate=Validate articles menu.chairman.article.conflict=Manage the conflict list +menu.chairman.article.discussion=Article's discussion menu.pcmember.title=PC Member menu.pcmember.article.preference=Article's preference diff --git a/YACOSWeb/WebContent/WEB-INF/decorators/usermenu.jsp b/YACOSWeb/WebContent/WEB-INF/decorators/usermenu.jsp index e193ec6..9bf1c58 100644 --- a/YACOSWeb/WebContent/WEB-INF/decorators/usermenu.jsp +++ b/YACOSWeb/WebContent/WEB-INF/decorators/usermenu.jsp @@ -39,6 +39,7 @@
  • ">
  • ">
  • ">
  • +
  • ">
  • @@ -52,7 +53,7 @@
  • ">
  • ">
  • ">
  • -
  • ">
  • +
  • ">
  • diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/forum.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/forum.jsp new file mode 100644 index 0000000..f7150b5 --- /dev/null +++ b/YACOSWeb/WebContent/WEB-INF/jsp/forum.jsp @@ -0,0 +1,30 @@ +<%@ include file="/WEB-INF/decorators/include.jsp"%> + + + + + + +

    Forum

    + + + + + + + + + + + + + + + + + + +
    ArticleMessage's number
    ">${article.title}Afficher le nombre ici
    + + + \ No newline at end of file diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/forumArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/forumArticle.jsp new file mode 100644 index 0000000..7afcf85 --- /dev/null +++ b/YACOSWeb/WebContent/WEB-INF/jsp/forumArticle.jsp @@ -0,0 +1,61 @@ +<%@ include file="/WEB-INF/decorators/include.jsp"%> + + + + + + +

    + + + + + + + + + + + +
    + There is no message for this article at the moment. + You can post a message if you want using the form below. +
    +
    + + + +
    + + + + + + + + +
    MessageAuthorDate
    ${message.message}${message.user.firstName} ${message.user.lastName}${message.dateMessage}
    + + + + + +

    Add a message

    + +
    +
    + Title + +
    +
    + Your message + +
    +
    + + + +
    + + + \ No newline at end of file diff --git a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml index e87d4a8..144c64e 100644 --- a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml +++ b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml @@ -49,6 +49,8 @@ UserBoardController StateArticleController AdminController + ForumController + ForumArticleController @@ -62,6 +64,22 @@ + + + + + + + + + + + + + + + jndi-name="EvaluationManagerBean/remote" cache="true" /> + listMessage = messageManager.getMessagesForArticle(id); + + request.getSession().setAttribute("listMessage", listMessage); + + FormArticleMessage fam = new FormArticleMessage(); + + return fam; + } + catch (NumberFormatException e) { + throw new ModelAndViewDefiningException(new ModelAndView("404error")); + } + + + } + + @Override + protected ModelAndView onSubmit(HttpServletRequest request, + HttpServletResponse response, Object command, BindException errors) + throws Exception { + + String title = ((FormArticleMessage) command).getTitle(); + String message = ((FormArticleMessage) command).getMessage(); + + String articleId = request.getParameter("articleId"); + + try { + + Integer id = new Integer(articleId); + Article a = articleManager.getArticle(id); + + if (a == null) + throw new ModelAndViewDefiningException(new ModelAndView("404error")); + + messageManager.addMessage(message, title, id, SessionService.getInstance().getCurrentUserLogin()); + + return new ModelAndView(new RedirectView("forumArticle.htm?articleId=" + id)); + + } + catch (NumberFormatException e) { + throw new ModelAndViewDefiningException(new ModelAndView("404error")); + } + } +} diff --git a/YACOSWeb/src/org/yacos/web/PCmember/controller/ForumController.java b/YACOSWeb/src/org/yacos/web/PCmember/controller/ForumController.java new file mode 100644 index 0000000..c0ea2d8 --- /dev/null +++ b/YACOSWeb/src/org/yacos/web/PCmember/controller/ForumController.java @@ -0,0 +1,76 @@ +package org.yacos.web.PCmember.controller; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +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 org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.ModelAndViewDefiningException; +import org.springframework.web.servlet.mvc.SimpleFormController; +import org.yacos.core.article.Article; +import org.yacos.core.article.IArticleManager; +import org.yacos.core.conferences.Conference; +import org.yacos.core.exceptions.ConferenceDoesntExistException; +import org.yacos.core.users.IUserManager; +import org.yacos.core.users.Role.RoleType; +import org.yacos.web.system.controller.NoConferenceSelectedException; +import org.yacos.web.system.session.SessionService; + +public class ForumController extends SimpleFormController { + + protected final Log logger = LogFactory.getLog(getClass()); + + private IArticleManager articleManager; + private IUserManager userManager; + + public IArticleManager getArticleManager() { + return articleManager; + } + + public void setArticleManager(IArticleManager articleManager) { + this.articleManager = articleManager; + } + + public IUserManager getUserManager() { + return userManager; + } + + public void setUserManager(IUserManager userManager) { + this.userManager = userManager; + } + + public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException, NoConferenceSelectedException, ConferenceDoesntExistException { + + logger.info("Returning the forum view"); + + Conference conf = SessionService.getInstance().getCurrentConference(); + List
    listArticle = new ArrayList
    (); + + String person = request.getParameter("role"); + + // TODO : renvoyer un truc s'il n'a pas le role + if (person.equals("pcmember")) { + if (userManager.hasRoleForConference(SessionService.getInstance().getCurrentUserLogin(), RoleType.PCMEMBER, conf.getId())) { + listArticle = articleManager.getArticlesOfMember(conf.getId(), SessionService.getInstance().getCurrentUserLogin()); + } + } + else if (person.equals("chairman")) { + if (userManager.hasRoleForConference(SessionService.getInstance().getCurrentUserLogin(), RoleType.CHAIRMAN, conf.getId())) { + listArticle = articleManager.getArticles(conf.getId()); + } + } + else + throw new ModelAndViewDefiningException(new ModelAndView("404error")); + + + return new ModelAndView("forum", "listArticle", listArticle); + } + +} diff --git a/YACOSWeb/src/org/yacos/web/PCmember/controller/ListEvaluationController.java b/YACOSWeb/src/org/yacos/web/PCmember/controller/ListEvaluationController.java index 4be202d..2929206 100644 --- a/YACOSWeb/src/org/yacos/web/PCmember/controller/ListEvaluationController.java +++ b/YACOSWeb/src/org/yacos/web/PCmember/controller/ListEvaluationController.java @@ -52,6 +52,8 @@ public class ListEvaluationController extends SimpleFormController { String person = request.getParameter("role"); + // TODO : renvoyer un truc s'il n'a pas le role + if (person.equals("pcmember")) { if (userManager.hasRoleForConference(SessionService.getInstance().getCurrentUserLogin(), RoleType.PCMEMBER, conf.getId())) { listArticle = articleManager.getArticlesOfMember(conf.getId(), SessionService.getInstance().getCurrentUserLogin()); diff --git a/YACOSWeb/src/org/yacos/web/PCmember/form/FormArticleMessage.java b/YACOSWeb/src/org/yacos/web/PCmember/form/FormArticleMessage.java new file mode 100644 index 0000000..7875e35 --- /dev/null +++ b/YACOSWeb/src/org/yacos/web/PCmember/form/FormArticleMessage.java @@ -0,0 +1,20 @@ +package org.yacos.web.PCmember.form; + +public class FormArticleMessage { + + private String message; + private String title; + + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } +}