Modification de trop de choses pr tt dire ici...
This commit is contained in:
@@ -242,7 +242,7 @@ conference.error.noTokenLeft=You have no conference creation token left !\nPleas
|
|||||||
evaluation.title=You are evaluating
|
evaluation.title=You are evaluating
|
||||||
evaluation.commentPCMember=Comment of PC Member
|
evaluation.commentPCMember=Comment of PC Member
|
||||||
evaluation.commentAuthor=Comment of author
|
evaluation.commentAuthor=Comment of author
|
||||||
evaluation.headPage=Here is a report of the evaluation
|
evaluation.headPage=Report of the evaluation
|
||||||
evaluation.titleArticle=The title of article is
|
evaluation.titleArticle=The title of article is
|
||||||
evaluation.note=The note for the criterion
|
evaluation.note=The note for the criterion
|
||||||
evaluation.thisArticle=evaluate this article
|
evaluation.thisArticle=evaluate this article
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="<c:url value="choosePreference.htm"/>"><fmt:message key="menu.pcmember.article.preference" /></a></li>
|
<li><a href="<c:url value="choosePreference.htm"/>"><fmt:message key="menu.pcmember.article.preference" /></a></li>
|
||||||
<li><a href="<c:url value="delegateArticle.htm"/>"><fmt:message key="menu.pcmember.article.delegate" /></a></li>
|
<li><a href="<c:url value="delegateArticle.htm"/>"><fmt:message key="menu.pcmember.article.delegate" /></a></li>
|
||||||
<li><a href="<c:url value="#"/>"><fmt:message key="menu.pcmember.article.evaluation" /></a></li>
|
<li><a href="<c:url value="listEvaluation.htm?role=pcmember"/>"><fmt:message key="menu.pcmember.article.evaluation" /></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.evaluation.modify" /></a></li>
|
||||||
<li><a href="<c:url value="#"/>"><fmt:message key="menu.pcmember.article.discussion" /></a></li>
|
<li><a href="<c:url value="#"/>"><fmt:message key="menu.pcmember.article.discussion" /></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
<div id="mainmenubloc">
|
<div id="mainmenubloc">
|
||||||
<h4><fmt:message key="menu.referee.title" /></h4>
|
<h4><fmt:message key="menu.referee.title" /></h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="<c:url value="listEvaluation.htm"/>"><fmt:message key="menu.referee.article.evaluation" /></a></li>
|
<li><a href="<c:url value="listEvaluation.htm?role=referee"/>"><fmt:message key="menu.referee.article.evaluation" /></a></li>
|
||||||
<li><a href="<c:url value="#"/>"><fmt:message key="menu.referee.article.evaluation.modify" /></a></li>
|
<li><a href="<c:url value="#"/>"><fmt:message key="menu.referee.article.evaluation.modify" /></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="footer"></div>
|
<div id="footer"></div>
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h4 class="title"><fmt:message key="evaluation.headPage" /></h4>
|
<h4 class="title"><fmt:message key="evaluation.headPage" /></h4>
|
||||||
<table>
|
|
||||||
|
|
||||||
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><fmt:message key="evaluation.titleArticle" /></td>
|
<td><fmt:message key="evaluation.titleArticle" /></td>
|
||||||
<td><c:out value="${report.article.title}"/></td>
|
<td>${report.article.title}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<c:forEach items="${report.ratings}" var="rating" varStatus="j">
|
<c:forEach items="${report.ratings}" var="rating">
|
||||||
<tr>
|
<tr>
|
||||||
<td><fmt:message key="evaluation.note" /></td>
|
<td><fmt:message key="evaluation.note" /></td>
|
||||||
<td>${rating.criterion.name} is:</td>
|
<td>${rating.criterion.name} is:</td>
|
||||||
@@ -22,16 +22,16 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><fmt:message key="evaluation.commentPCMember" /></td>
|
<td><fmt:message key="evaluation.commentPCMember" /></td>
|
||||||
<td><c:out value="${report.commentPCMember}"/></td>
|
<td>${report.commentPCMember}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><fmt:message key="evaluation.commentAuthor" /></td>
|
<td><fmt:message key="evaluation.commentAuthor" /></td>
|
||||||
<td><c:out value="${report.commentAuthor}"/></td>
|
<td>${report.commentAuthor}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<a href="<c:url value="main.htm"/>">Home</a>
|
<a href="<c:url value="main.htm"/>">Home</a>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<form:label path="title">${criterion.name}</form:label>
|
<form:label path="title">${criterion.name}</form:label>
|
||||||
<form:hidden path="simpleRatings[${j.index}].name"></form:hidden>
|
<form:hidden path="simpleRatings[${j.index}].name"></form:hidden>
|
||||||
<form:label path="simpleRatings[${j.index}].name"><form:select path="simpleRatings[${j.index}].value">
|
<form:label path="simpleRatings[${j.index}].name"><form:select path="simpleRatings[${j.index}].value">
|
||||||
<c:forEach var="i" begin="${criterion.min_rating}" end="${criterion.max_rating}" step="1">
|
<c:forEach var="i" begin="${criterion.min_rating}" end="${criterion.max_rating}">
|
||||||
<form:option value="${i}"></form:option>
|
<form:option value="${i}"></form:option>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
</form:select></form:label>
|
</form:select></form:label>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="${article.state eq 'EVALUATED'}">
|
<c:if test="${article.state eq 'EVALUATED'}">
|
||||||
<a title="Click to modify evaluation" href="<c:url value="evaluation.htm?id=${article.id}"/>">Modify the evaluation <img src="./images/cc-kedit-32x32.png" alt="Click to modify evaluation" /></a>
|
<a title="Click to modify evaluation" href="<c:url value="evaluation.htm?id=${article.id}&action=modify"/>">Modify the evaluation <img src="./images/cc-kedit-32x32.png" alt="Click to modify evaluation" /></a>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="${article.state eq 'REJECTED'}">
|
<c:if test="${article.state eq 'REJECTED'}">
|
||||||
|
|||||||
@@ -9,16 +9,14 @@
|
|||||||
<c:forEach items="${listReport}" var="report">
|
<c:forEach items="${listReport}" var="report">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td><fmt:message key="report.referee" />: ${report.referee.firstName} ${report.referee.lastName}</td>
|
||||||
<fmt:message key="report.referee"/>: ${report.referee}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><fmt:message key="evaluation.titleArticle" /></td>
|
<td><fmt:message key="evaluation.titleArticle" /></td>
|
||||||
<td><c:out value="${report.article.title}"/></td>
|
<td>${report.article.title}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<c:forEach items="${rtgs}" var="rating" varStatus="j">
|
<c:forEach items="${rtgs}" var="rating">
|
||||||
<tr>
|
<tr>
|
||||||
<td><fmt:message key="evaluation.note" /></td>
|
<td><fmt:message key="evaluation.note" /></td>
|
||||||
<td>${rating.criterion.name} is:</td>
|
<td>${rating.criterion.name} is:</td>
|
||||||
@@ -28,12 +26,12 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><fmt:message key="evaluation.commentPCMember" /></td>
|
<td><fmt:message key="evaluation.commentPCMember" /></td>
|
||||||
<td><c:out value="${report.commentPCMember}"/></td>
|
<td>${report.commentPCMember}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><fmt:message key="evaluation.commentAuthor" /></td>
|
<td><fmt:message key="evaluation.commentAuthor" /></td>
|
||||||
<td><c:out value="${report.commentAuthor}"/></td>
|
<td>${report.commentAuthor}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -26,7 +26,12 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a title="Download" href="<c:url value="/download.htm"><c:param name="articleId" value="${article.id}"/></c:url>">Download<img
|
<td><a title="Download" href="<c:url value="/download.htm"><c:param name="articleId" value="${article.id}"/></c:url>">Download<img
|
||||||
src="./images/cc-download_manager-32x32.png" alt="Download" /></a></td>
|
src="./images/cc-download_manager-32x32.png" alt="Download" /></a></td>
|
||||||
|
<c:if test="${article.state == 'EVALUATED' or article.state == 'REJECTED' or article.state == 'ACCEPTED'}">
|
||||||
<td><a href="<c:url value="listReport.htm?id=${article.id}"/>"><fmt:message key="validate.report" /></a></td>
|
<td><a href="<c:url value="listReport.htm?id=${article.id}"/>"><fmt:message key="validate.report" /></a></td>
|
||||||
|
</c:if>
|
||||||
|
<c:if test="${article.state == 'SUBMITED'}">
|
||||||
|
<td> </td>
|
||||||
|
</c:if>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -257,6 +257,7 @@
|
|||||||
<bean id="ListEvaluationController"
|
<bean id="ListEvaluationController"
|
||||||
class="org.yacos.web.PCmember.controller.ListEvaluationController">
|
class="org.yacos.web.PCmember.controller.ListEvaluationController">
|
||||||
<property name="articleManager" ref="articleManager" />
|
<property name="articleManager" ref="articleManager" />
|
||||||
|
<property name="userManager" ref="userManager" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="StateArticleController"
|
<bean id="StateArticleController"
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package org.yacos.web.PCmember.controller;
|
package org.yacos.web.PCmember.controller;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
@@ -21,8 +19,7 @@ public class CreateReportController extends SimpleFormController {
|
|||||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
|
logger.info("Return report creation view");
|
||||||
logger.info("j'arrive a creer le report");
|
|
||||||
return new ModelAndView("createReport");
|
return new ModelAndView("createReport");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,5 +30,4 @@ public class CreateReportController extends SimpleFormController {
|
|||||||
public void setArticleManager(IArticleManager articleManager) {
|
public void setArticleManager(IArticleManager articleManager) {
|
||||||
this.articleManager = articleManager;
|
this.articleManager = articleManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,18 @@
|
|||||||
package org.yacos.web.PCmember.controller;
|
package org.yacos.web.PCmember.controller;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
||||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||||
import org.springframework.web.servlet.view.RedirectView;
|
|
||||||
import org.yacos.core.article.Article;
|
import org.yacos.core.article.Article;
|
||||||
import org.yacos.core.article.IArticleManager;
|
import org.yacos.core.article.IArticleManager;
|
||||||
|
import org.yacos.core.article.Article.State;
|
||||||
import org.yacos.core.conferences.Conference;
|
import org.yacos.core.conferences.Conference;
|
||||||
import org.yacos.core.conferences.IConferenceManager;
|
import org.yacos.core.conferences.IConferenceManager;
|
||||||
import org.yacos.core.evaluation.Criterion;
|
import org.yacos.core.evaluation.Criterion;
|
||||||
@@ -38,108 +35,6 @@ public class EvaluationController extends SimpleFormController {
|
|||||||
private IConferenceManager conferenceManager;
|
private IConferenceManager conferenceManager;
|
||||||
private IEvaluationManager evaluationManager;
|
private IEvaluationManager evaluationManager;
|
||||||
|
|
||||||
public IEvaluationManager getEvaluationManager() {
|
|
||||||
return evaluationManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEvaluationManager(IEvaluationManager evaluationManager) {
|
|
||||||
this.evaluationManager = evaluationManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Log getLogger() {
|
|
||||||
return logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Object formBackingObject(HttpServletRequest request)
|
|
||||||
throws Exception {
|
|
||||||
|
|
||||||
Conference conf=SessionService.getInstance().getCurrentConference();
|
|
||||||
List<Criterion> criterionList = evaluationManager.getCriterions(conf.getId());
|
|
||||||
|
|
||||||
String id=request.getParameter("id");
|
|
||||||
Article art=articleManager.getArticle(Integer.parseInt(id));
|
|
||||||
String title=art.getTitle();
|
|
||||||
|
|
||||||
FormEvaluation fe=new FormEvaluation();
|
|
||||||
|
|
||||||
List<SimpleCriterion> liste=new ArrayList<SimpleCriterion>();
|
|
||||||
for (Criterion c : criterionList)
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
SimpleCriterion sc=new SimpleCriterion(c.getName(),c.getMin_rating(),c.getMax_rating(),c.getId());
|
|
||||||
|
|
||||||
liste.add(sc);
|
|
||||||
|
|
||||||
}
|
|
||||||
fe.setSimpleRatings(liste);
|
|
||||||
fe.setCommentAuthor("no comment by author");
|
|
||||||
fe.setCommentPCMember("no comment by pc member");
|
|
||||||
fe.setTitle(title);
|
|
||||||
return fe;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ModelAndView onSubmit(HttpServletRequest request,
|
|
||||||
HttpServletResponse response, Object command, BindException errors)
|
|
||||||
throws Exception {
|
|
||||||
String id=request.getParameter("id");
|
|
||||||
logger.info("my article's id is "+id);
|
|
||||||
|
|
||||||
|
|
||||||
FormEvaluation fe=(FormEvaluation)command;
|
|
||||||
|
|
||||||
List<SimpleCriterion> liste=fe.getSimpleRatings();
|
|
||||||
String commentAuthor=fe.getCommentAuthor();
|
|
||||||
String commentPCMember=fe.getCommentPCMember();
|
|
||||||
List<Rating> listeRating=new ArrayList<Rating>();
|
|
||||||
|
|
||||||
for(SimpleCriterion sc : liste){
|
|
||||||
|
|
||||||
Rating rt=new Rating();
|
|
||||||
Criterion cn=new Criterion();
|
|
||||||
|
|
||||||
cn.setMax_rating(sc.getMax_rating());
|
|
||||||
cn.setMin_rating(sc.getMin_rating());
|
|
||||||
cn.setName(sc.getName());
|
|
||||||
cn.setId(sc.getId());
|
|
||||||
|
|
||||||
rt.setCriterion(cn);
|
|
||||||
rt.setValue(sc.getValue());
|
|
||||||
listeRating.add(rt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Article article=articleManager.getArticle(new Integer(1));
|
|
||||||
Article article =articleManager.getArticle(Integer.parseInt(id));
|
|
||||||
|
|
||||||
System.out.println("le title est: "+article.getTitle());
|
|
||||||
User current = SessionService.getInstance().getCurrentUser();
|
|
||||||
if(current == null){
|
|
||||||
current = userManager.addUser("toto",User.hashPassword("toto"), "Toto", "Toto", "Toto corp.", "toto@totocorp.com");
|
|
||||||
}
|
|
||||||
|
|
||||||
int idd=Integer.parseInt(id);
|
|
||||||
|
|
||||||
Report rpt= evaluationManager.addReport(idd, commentPCMember, commentAuthor, listeRating, current.getLogin());
|
|
||||||
//request.getSession().setAttribute("report", rpt);
|
|
||||||
//persister ratings dans la base apres avoir le id report.
|
|
||||||
System.out.println("lengthe is :"+listeRating.size());
|
|
||||||
for (Rating rt : listeRating)
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
if (rpt!=null){System.out.println("report is not null");}
|
|
||||||
evaluationManager.addRating(rt.getValue(), rt.getCriterion().getId(), rpt.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return new ModelAndView(new RedirectView("createReport.htm"), "report", rpt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IArticleManager getArticleManager() {
|
public IArticleManager getArticleManager() {
|
||||||
return articleManager;
|
return articleManager;
|
||||||
}
|
}
|
||||||
@@ -163,4 +58,220 @@ public class EvaluationController extends SimpleFormController {
|
|||||||
public void setConferenceManager(IConferenceManager conferenceManager) {
|
public void setConferenceManager(IConferenceManager conferenceManager) {
|
||||||
this.conferenceManager = conferenceManager;
|
this.conferenceManager = conferenceManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEvaluationManager getEvaluationManager() {
|
||||||
|
return evaluationManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEvaluationManager(IEvaluationManager evaluationManager) {
|
||||||
|
this.evaluationManager = evaluationManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object formBackingObject(HttpServletRequest request)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
Conference conf = SessionService.getInstance().getCurrentConference();
|
||||||
|
List<Criterion> criterionList = evaluationManager.getCriterions(conf.getId());
|
||||||
|
String articleId = request.getParameter("id");
|
||||||
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
// TODO : v<>rifier que le gars a le droit d'<27>valuer cette article
|
||||||
|
// TODO : s'il existe d<>j<EFBFBD> une <20>val, mais que l'action est pas modify, virer le gars
|
||||||
|
|
||||||
|
if (action == null || action.equals("")) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Integer id = new Integer(articleId);
|
||||||
|
Article a = articleManager.getArticle(id);
|
||||||
|
|
||||||
|
if (a == null)
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
|
||||||
|
String title = a.getTitle();
|
||||||
|
|
||||||
|
FormEvaluation fe = new FormEvaluation();
|
||||||
|
|
||||||
|
List<SimpleCriterion> liste = new ArrayList<SimpleCriterion>();
|
||||||
|
for (Criterion c : criterionList) {
|
||||||
|
SimpleCriterion sc = new SimpleCriterion(c.getName(), c.getMin_rating(), c.getMax_rating(), c.getMin_rating(), c.getId());
|
||||||
|
liste.add(sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
fe.setSimpleRatings(liste);
|
||||||
|
fe.setTitle(title);
|
||||||
|
|
||||||
|
return fe;
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (action.equals("modify")) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Integer id = new Integer(articleId);
|
||||||
|
Article a = articleManager.getArticle(id);
|
||||||
|
|
||||||
|
if (a == null)
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
|
||||||
|
String title = a.getTitle();
|
||||||
|
|
||||||
|
Report rpt = evaluationManager.getReportforArticleAndReferee(a.getId(), SessionService.getInstance().getCurrentUserLogin());
|
||||||
|
if (rpt == null)
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
|
||||||
|
List<Rating> ratings = evaluationManager.getRatingForReport(rpt.getId());
|
||||||
|
|
||||||
|
FormEvaluation fe = new FormEvaluation();
|
||||||
|
|
||||||
|
List<SimpleCriterion> liste = new ArrayList<SimpleCriterion>();
|
||||||
|
for (Rating r : ratings) {
|
||||||
|
SimpleCriterion sc = new SimpleCriterion(r.getCriterion().getName(), r.getCriterion().getMin_rating(), r.getCriterion().getMax_rating(), r.getValue(), r.getCriterion().getId());
|
||||||
|
liste.add(sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
fe.setSimpleRatings(liste);
|
||||||
|
fe.setCommentAuthor(rpt.getCommentAuthor());
|
||||||
|
fe.setCommentPCMember(rpt.getCommentPCMember());
|
||||||
|
fe.setTitle(title);
|
||||||
|
|
||||||
|
return fe;
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ModelAndView onSubmit(HttpServletRequest request,
|
||||||
|
HttpServletResponse response, Object command, BindException errors)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
String articleId = request.getParameter("id");
|
||||||
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
logger.info("Article id: " + articleId);
|
||||||
|
|
||||||
|
if (action == null || action.equals("")) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
FormEvaluation fe = (FormEvaluation)command;
|
||||||
|
|
||||||
|
List<SimpleCriterion> liste = fe.getSimpleRatings();
|
||||||
|
String commentAuthor = fe.getCommentAuthor();
|
||||||
|
String commentPCMember = fe.getCommentPCMember();
|
||||||
|
List<Rating> listeRating = new ArrayList<Rating>();
|
||||||
|
|
||||||
|
for(SimpleCriterion sc : liste){
|
||||||
|
Rating rt = new Rating();
|
||||||
|
Criterion cn = new Criterion();
|
||||||
|
|
||||||
|
cn.setMax_rating(sc.getMax_rating());
|
||||||
|
cn.setMin_rating(sc.getMin_rating());
|
||||||
|
cn.setName(sc.getName());
|
||||||
|
cn.setId(sc.getId());
|
||||||
|
|
||||||
|
rt.setCriterion(cn);
|
||||||
|
rt.setValue(sc.getValue());
|
||||||
|
listeRating.add(rt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer id = new Integer(articleId);
|
||||||
|
|
||||||
|
Article article = articleManager.getArticle(id);
|
||||||
|
|
||||||
|
if (article == null)
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
|
||||||
|
User current = SessionService.getInstance().getCurrentUser();
|
||||||
|
|
||||||
|
Report rpt = evaluationManager.addReport(id, commentPCMember, commentAuthor, listeRating, current.getLogin());
|
||||||
|
|
||||||
|
for (Rating rt : listeRating) {
|
||||||
|
evaluationManager.addRating(rt.getValue(), rt.getCriterion().getId(), rpt.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
article.setState(State.EVALUATED);
|
||||||
|
articleManager.updateArticle(article);
|
||||||
|
|
||||||
|
return new ModelAndView("createReport", "report", rpt);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (action.equals("modify")) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
Integer id = new Integer(articleId);
|
||||||
|
|
||||||
|
Article article = articleManager.getArticle(id);
|
||||||
|
|
||||||
|
if (article == null)
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
|
||||||
|
User current = SessionService.getInstance().getCurrentUser();
|
||||||
|
|
||||||
|
Report rpt = evaluationManager.getReportforArticleAndReferee(article.getId(), current.getLogin());
|
||||||
|
if (rpt == null)
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
|
||||||
|
List<Rating> ratings = evaluationManager.getRatingForReport(rpt.getId());
|
||||||
|
|
||||||
|
FormEvaluation fe = (FormEvaluation)command;
|
||||||
|
|
||||||
|
List<SimpleCriterion> liste = fe.getSimpleRatings();
|
||||||
|
String commentAuthor = fe.getCommentAuthor();
|
||||||
|
String commentPCMember = fe.getCommentPCMember();
|
||||||
|
|
||||||
|
|
||||||
|
for(SimpleCriterion sc : liste) {
|
||||||
|
Rating rt = new Rating();
|
||||||
|
for (Rating r : ratings) {
|
||||||
|
if (r.getCriterion().getId() == sc.getId()) {
|
||||||
|
rt = r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Criterion cn = rt.getCriterion();
|
||||||
|
|
||||||
|
cn.setMax_rating(sc.getMax_rating());
|
||||||
|
cn.setMin_rating(sc.getMin_rating());
|
||||||
|
cn.setName(sc.getName());
|
||||||
|
cn.setId(sc.getId());
|
||||||
|
|
||||||
|
rt.setCriterion(cn);
|
||||||
|
rt.setValue(sc.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
rpt.setCommentAuthor(commentAuthor);
|
||||||
|
rpt.setCommentPCMember(commentPCMember);
|
||||||
|
rpt.setRatings(ratings);
|
||||||
|
|
||||||
|
evaluationManager.updateReport(rpt);
|
||||||
|
|
||||||
|
for (Rating rt : ratings) {
|
||||||
|
evaluationManager.updateRating(rt);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ModelAndView("createReport", "report", rpt);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,21 @@
|
|||||||
package org.yacos.web.PCmember.controller;
|
package org.yacos.web.PCmember.controller;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
||||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||||
import org.yacos.core.article.Article;
|
import org.yacos.core.article.Article;
|
||||||
import org.yacos.core.article.IArticleManager;
|
import org.yacos.core.article.IArticleManager;
|
||||||
import org.yacos.core.exceptions.ConferenceDoesntExistException;
|
import org.yacos.core.conferences.Conference;
|
||||||
|
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.controller.NoConferenceSelectedException;
|
||||||
import org.yacos.web.system.session.SessionService;
|
import org.yacos.web.system.session.SessionService;
|
||||||
|
|
||||||
@@ -22,22 +24,7 @@ public class ListEvaluationController extends SimpleFormController {
|
|||||||
protected final Log logger = LogFactory.getLog(getClass());
|
protected final Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
private IArticleManager articleManager;
|
private IArticleManager articleManager;
|
||||||
|
private IUserManager userManager;
|
||||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
|
||||||
throws ServletException, IOException, NoConferenceSelectedException {
|
|
||||||
|
|
||||||
logger.info("Returning listArticle view");
|
|
||||||
|
|
||||||
List<Article> listArticle;
|
|
||||||
try {
|
|
||||||
listArticle = articleManager.getArticles(SessionService.getInstance().getCurrentConferenceId());
|
|
||||||
request.getSession().setAttribute("listArticle", listArticle);
|
|
||||||
} catch (ConferenceDoesntExistException e) {
|
|
||||||
logger.error(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ModelAndView("listEvaluation");
|
|
||||||
}
|
|
||||||
|
|
||||||
public IArticleManager getArticleManager() {
|
public IArticleManager getArticleManager() {
|
||||||
return articleManager;
|
return articleManager;
|
||||||
@@ -46,4 +33,47 @@ public class ListEvaluationController extends SimpleFormController {
|
|||||||
public void setArticleManager(IArticleManager articleManager) {
|
public void setArticleManager(IArticleManager articleManager) {
|
||||||
this.articleManager = 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 {
|
||||||
|
|
||||||
|
logger.info("Returning the article's list to evaluate view");
|
||||||
|
|
||||||
|
Conference conf = SessionService.getInstance().getCurrentConference();
|
||||||
|
List<Article> listArticle = new ArrayList<Article>();
|
||||||
|
|
||||||
|
String person = request.getParameter("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("referee")) {
|
||||||
|
if (userManager.hasRoleForConference(SessionService.getInstance().getCurrentUserLogin(), RoleType.REFEREE, conf.getId())) {
|
||||||
|
List<Article> listArticleTmp;
|
||||||
|
listArticleTmp = articleManager.getArticlesOfReferee(SessionService.getInstance().getCurrentUserLogin());
|
||||||
|
if (listArticleTmp != null) {
|
||||||
|
for (Article a : listArticleTmp) {
|
||||||
|
Conference confTmp = articleManager.getConferenceForArticle(a.getId());
|
||||||
|
if (confTmp.getId() == conf.getId())
|
||||||
|
listArticle.add(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
|
||||||
|
|
||||||
|
return new ModelAndView("listEvaluation", "listArticle", listArticle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
||||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||||
import org.yacos.core.evaluation.IEvaluationManager;
|
import org.yacos.core.evaluation.IEvaluationManager;
|
||||||
import org.yacos.core.evaluation.Rating;
|
import org.yacos.core.evaluation.Rating;
|
||||||
@@ -31,12 +32,19 @@ public class ListReportController extends SimpleFormController {
|
|||||||
logger.info("Returning listReport view");
|
logger.info("Returning listReport view");
|
||||||
|
|
||||||
List<Report> listReport;
|
List<Report> listReport;
|
||||||
String id=request.getParameter("id");
|
String reportId = request.getParameter("id");
|
||||||
int idd=Integer.parseInt(id);
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Integer id = new Integer(reportId);
|
||||||
|
|
||||||
Map <String, Object> model = new HashMap<String, Object>();
|
Map <String, Object> model = new HashMap<String, Object>();
|
||||||
|
|
||||||
listReport = evaluationManager.getReportsForArticle(idd);
|
listReport = evaluationManager.getReportsForArticle(id);
|
||||||
|
|
||||||
|
if (listReport.isEmpty())
|
||||||
|
return new ModelAndView("listReport", "listReport", null);
|
||||||
|
|
||||||
model.put("listReport", listReport);
|
model.put("listReport", listReport);
|
||||||
|
|
||||||
List<Rating> ratings = evaluationManager.getRatingForReport(listReport.get(listReport.size() - 1).getId());
|
List<Rating> ratings = evaluationManager.getRatingForReport(listReport.get(listReport.size() - 1).getId());
|
||||||
@@ -45,6 +53,11 @@ public class ListReportController extends SimpleFormController {
|
|||||||
return new ModelAndView("listReport", model);
|
return new ModelAndView("listReport", model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
catch (NumberFormatException e) {
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IEvaluationManager getEvaluationManager() {
|
public IEvaluationManager getEvaluationManager() {
|
||||||
return evaluationManager;
|
return evaluationManager;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public class ValidateOrRejectController extends SimpleFormController {
|
|||||||
catch (NumberFormatException e) {
|
catch (NumberFormatException e) {
|
||||||
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ModelAndView(new RedirectView("validateArticle.htm"));
|
return new ModelAndView(new RedirectView("validateArticle.htm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,34 +8,37 @@ public class SimpleCriterion {
|
|||||||
private Integer value;
|
private Integer value;
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
public SimpleCriterion(String name, Integer min_rating, Integer max_rating,Integer id) {
|
public SimpleCriterion(String name, Integer min_rating, Integer max_rating, Integer value, Integer id) {
|
||||||
super();
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.min_rating = min_rating;
|
this.min_rating = min_rating;
|
||||||
this.max_rating = max_rating;
|
this.max_rating = max_rating;
|
||||||
this.value=(this.max_rating+this.min_rating)/2;
|
this.value = value;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMin_rating() {
|
public Integer getMin_rating() {
|
||||||
return min_rating;
|
return min_rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMin_rating(Integer min_rating) {
|
public void setMin_rating(Integer min_rating) {
|
||||||
this.min_rating = min_rating;
|
this.min_rating = min_rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getMax_rating() {
|
public Integer getMax_rating() {
|
||||||
return max_rating;
|
return max_rating;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMax_rating(Integer max_rating) {
|
public void setMax_rating(Integer max_rating) {
|
||||||
this.max_rating = max_rating;
|
this.max_rating = max_rating;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getValue() {
|
public Integer getValue() {
|
||||||
@@ -50,9 +53,8 @@ public class SimpleCriterion {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Integer id)
|
public void setId(Integer id) {
|
||||||
|
this.id=id;
|
||||||
{ this.id=id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user