Changement du tableau de bord pour l'user.

This commit is contained in:
Frederic Debuire
2008-02-19 18:40:35 +00:00
parent 448bcf60c2
commit e9e3a6f992
6 changed files with 179 additions and 127 deletions

View File

@@ -5,7 +5,7 @@
<head></head> <head></head>
<body> <body>
<br /> <br />
<a href="tableBord.htm"><b>${ currentUser.firstName } ${ currentUser.lastName }</b></a><br /> <a href="userBoard.htm"><b>${ currentUser.firstName } ${ currentUser.lastName }</b></a><br />
<a href="listConference.htm" > <a href="listConference.htm" >
<fmt:message key="user.information.followconference" > <fmt:message key="user.information.followconference" >

View File

@@ -1,89 +0,0 @@
<%@ include file="/WEB-INF/decorators/include.jsp"%>
<html>
<head></head>
<body>
<!-- Different roles : ROLE_CHAIRMAN, ROLE_PCMEMBER, ROLE_REFEREE, ROLE_AUTHOR, ROLE_ANONYMOUS -->
<div class="cbb">
<!-- The menus are displayed only if a conference has been selected -->
<c:if test="${currentConferenceId != null}">
<!-- MENU : CHAIRMAN -->
<authz:authorize ifAllGranted="ROLE_CHAIRMAN">
<div class="cbb">
<h4><fmt:message key="menu.chairman.title" /></h4>
<ul>
<li><a href="<c:url value="addConference.htm"/>"><fmt:message key="menu.chairman.conference.create" /></a></li>
<li><a href="<c:url value="addConference.htm?action=modify"/>"><fmt:message key="menu.chairman.conference.modify" /></a></li>
<li><a href="<c:url value="dispatchArticleList.htm"/>"><fmt:message key="menu.chairman.article.dispatch" /></a></li>
<li><a href="<c:url value="validateArticle.htm"/>"><fmt:message key="menu.chairman.article.validate" /></a></li>
</ul>
<div id="footer"></div>
</div>
</authz:authorize>
<!-- MENU : ROLE_PCMEMBER -->
<authz:authorize ifAllGranted="ROLE_PCMEMBER">
<div class="cbb">
<h4><fmt:message key="menu.pcmember.title" /></h4>
<ul>
<li><a href="<c:url value="choosePreference.htm"/>"><fmt:message key="menu.pcmember.article.preference" /></a></li>
<li><a href="<c:url value="#"/>"><fmt:message key="menu.pcmember.article.delegate" /></a></li>
<li><a href="<c:url value="listEvaluation.htm"/>"><fmt:message key="menu.pcmember.article.evaluation" /></a></li>
<li><a href="<c:url value="stateArticle.htm?role=referee"/>"><fmt:message key="tableBord.state" /></a></li>
<li><a href="<c:url value="#"/>"><fmt:message key="menu.pcmember.article.evaluation.modify" /></a></li>
<li><a href="<c:url value="#"/>"><fmt:message key="menu.pcmember.article.discussion" /></a></li>
</ul>
<div id="footer"></div>
</div>
</authz:authorize>
<!-- MENU : ROLE_REFEREE -->
<authz:authorize ifAllGranted="ROLE_REFEREE">
<div class="cbb">
<h4><fmt:message key="menu.referee.title" /></h4>
<ul>
<li><a href="<c:url value="listEvaluation.htm"/>"><fmt:message key="menu.referee.article.evaluation" /></a></li>
<li><a href="<c:url value="stateArticle.htm?role=referee"/>"><fmt:message key="tableBord.state" /></a></li>
<li><a href="<c:url value="#"/>"><fmt:message key="menu.referee.article.evaluation.modify" /></a></li>
</ul>
<div id="footer"></div>
</div>
</authz:authorize>
<!-- MENU : ROLE_AUTHOR -->
<authz:authorize ifAllGranted="ROLE_AUTHOR">
<div class="cbb">
<h4><fmt:message key="menu.author.title" /></h4>
<ul>
<li><a href="<c:url value="submissionArticle.htm"/>"><fmt:message key="menu.author.article.submission" /></a></li>
<li><a href="<c:url value="manageArticle.htm"/>"><fmt:message key="tableBord.manage" /></a></li>
<li><a href="<c:url value="stateArticle.htm?role=author"/>"><fmt:message key="tableBord.state" /></a></li>
</ul>
<div id="footer"></div>
</div>
</authz:authorize>
<!-- MENU : ROLE_ANONYMOUS-->
<authz:authorize ifNotGranted="ROLE_AUTHOR">
<div class="cbb">
<h4><fmt:message key="menu.anonymous.title" /></h4>
<ul>
<li><a href="<c:url value="submissionArticle.htm"/>"><fmt:message key="menu.anonymous.article.submission" /></a></li>
</ul>
<div id="footer"></div>
</div>
</authz:authorize>
</c:if>
</div>
</body>
</html>

View File

@@ -0,0 +1,54 @@
<%@ include file="/WEB-INF/decorators/include.jsp"%>
<html>
<head>
</head>
<body>
<h4 class="title">User Board</h4>
<h3 class="descriptionTitle">Generals informations</h3>
<div class="textBox">
You currently follow <b>${numberConference}</b> conference(s)<br /><br />
If you want to see the list of conferences you are registered in, click here.
</div>
<h3 class="descriptionTitle">Chairman's informations</h3>
<div class="textBox">
You are Chairman in <b>${numberChairman}</b> conference(s)<br /><br />
<c:choose>
<c:when test="${numberCreationTokens} != 0">
You can create <b>${numberCreationTokens}</b> conference(s). Click
<a href="addConference.htm">here</a> to create one now.
</c:when>
<c:otherwise>
You can't create a conference at the moment. If you want to create a conference, you should address to the <a href="mailto:admin@yacos.org">administrator</a> of this site.
</c:otherwise>
</c:choose>
</div>
<h3 class="descriptionTitle">PCMember's informations</h3>
<div class="textBox">
You are PCMember in <b>${numberPCMember}</b> conference(s)<br /><br />
</div>
<h3 class="descriptionTitle">Referee's informations</h3>
<div class="textBox">
You are Referee in <b>${numberReferee}</b> conference(s)<br /><br />
</div>
<h3 class="descriptionTitle">Author's informations</h3>
<div class="textBox">
You are Author in <b>${numberAuthor}</b> conference(s)<br /><br />
You have posted <b>${numberArticle}</b> article(s).<br /><br />
If you want to see the list of articles you have submited, click here.
</div>
</body>
</html>

View File

@@ -44,7 +44,7 @@
<prop key="/listReport.htm">ListReportController</prop> <prop key="/listReport.htm">ListReportController</prop>
<prop key="/forgotPassword.htm">ForgotPasswordController</prop> <prop key="/forgotPassword.htm">ForgotPasswordController</prop>
<prop key="/detailArticle.htm">DetailArticleController</prop> <prop key="/detailArticle.htm">DetailArticleController</prop>
<prop key="/tableBord.htm">TableBordController</prop> <prop key="/userBoard.htm">UserBoardController</prop>
<prop key="/stateArticle.htm">StateArticleController</prop> <prop key="/stateArticle.htm">StateArticleController</prop>
<prop key="/admin.htm">AdminController</prop> <prop key="/admin.htm">AdminController</prop>
</props> </props>
@@ -138,8 +138,12 @@
</bean> </bean>
<bean id="TableBordController" <bean id="UserBoardController"
class="org.yacos.web.system.controller.TableBordController"> class="org.yacos.web.system.controller.UserBoardController">
<property name="conferenceManager" ref="conferenceManager" />
<property name="userManager" ref="userManager" />
<property name="evaluationManager" ref="evaluationManager" />
<property name="articleManager" ref="articleManager" />
</bean> </bean>
<bean id="ChoosePreferenceController" <bean id="ChoosePreferenceController"

View File

@@ -1,34 +0,0 @@
package org.yacos.web.system.controller;
import java.io.IOException;
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.mvc.SimpleFormController;
import org.yacos.web.system.controller.NoConferenceSelectedException;
public class TableBordController extends SimpleFormController {
protected final Log logger = LogFactory.getLog(getClass());
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, NoConferenceSelectedException {
logger.info("Returning TableBord view");
/*String confID=SessionService.getInstance().getCurrentConferenceId().toString();
getServletContext().setAttribute("confID", confID);
*/
return new ModelAndView("tableBord");
}
}

View File

@@ -0,0 +1,117 @@
package org.yacos.web.system.controller;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.mvc.SimpleFormController;
import org.yacos.core.article.Article;
import org.yacos.core.article.IArticleManager;
import org.yacos.core.conferences.Conference;
import org.yacos.core.conferences.IConferenceManager;
import org.yacos.core.evaluation.IEvaluationManager;
import org.yacos.core.users.IUserManager;
import org.yacos.core.users.Role;
import org.yacos.core.users.Role.RoleType;
import org.yacos.web.system.controller.NoConferenceSelectedException;
import org.yacos.web.system.session.SessionService;
public class UserBoardController extends SimpleFormController {
protected final Log logger = LogFactory.getLog(getClass());
private IArticleManager articleManager;
private IUserManager userManager;
private IConferenceManager conferenceManager;
private IEvaluationManager evaluationManager;
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 IConferenceManager getConferenceManager() {
return conferenceManager;
}
public void setConferenceManager(IConferenceManager conferenceManager) {
this.conferenceManager = conferenceManager;
}
public IEvaluationManager getEvaluationManager() {
return evaluationManager;
}
public void setEvaluationManager(IEvaluationManager evaluationManager) {
this.evaluationManager = evaluationManager;
}
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, NoConferenceSelectedException {
logger.info("Returning UserBoard view");
Map<String, Object> model = new HashMap<String, Object>();
logger.info("Get the list of roles of an user");
List<Role> listRole = userManager.getRolesForUser(SessionService.getInstance().getCurrentUserLogin());
Integer numberChairman = 0;
Integer numberPCMember = 0;
Integer numberReferee = 0;
Integer numberAuthor = 0;
for (Role r : listRole) {
if (r.getType() == RoleType.CHAIRMAN)
numberChairman++;
else if (r.getType() == RoleType.PCMEMBER)
numberPCMember++;
else if (r.getType() == RoleType.REFEREE)
numberReferee++;
else if (r.getType() == RoleType.AUTHOR)
numberAuthor++;
}
model.put("numberChairman", numberChairman);
model.put("numberPCMember", numberPCMember);
model.put("numberReferee", numberReferee);
model.put("numberAuthor", numberAuthor);
logger.info("Get the list of articles of an author");
List<Article> listAllArticle = articleManager.getArticleOfAuthor(SessionService.getInstance().getCurrentUserLogin());
Integer numberArticle = listAllArticle.size();
model.put("numberArticle", numberArticle);
model.put("listAllArticle", listAllArticle);
logger.info("Get the list of conferences of an user");
List<Conference> listConfForUser = conferenceManager.getConferences(SessionService.getInstance().getCurrentUser());
Integer numberConference = listConfForUser.size();
model.put("numberConference", numberConference);
model.put("listConfForUser", listConfForUser);
logger.info("Get the number of conferences the user can create");
Integer numberCreationTokens = conferenceManager.conferenceCreationTokens(SessionService.getInstance().getCurrentUserLogin());
model.put("numberCreationTokens", numberCreationTokens);
return new ModelAndView("userBoard", model);
}
}