Ajout du remove d'evaluation
This commit is contained in:
@@ -1,7 +1,19 @@
|
|||||||
<%@ include file="/WEB-INF/decorators/include.jsp"%>
|
<%@ include file="/WEB-INF/decorators/include.jsp"%>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head></head>
|
<head>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function deleteReport(articleId) {
|
||||||
|
if (confirm("Are you sure you want to remove your evaluation?")) {
|
||||||
|
document.location.href = "removeEvaluation.htm?articleId=" + articleId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h4 class="title"><fmt:message key="evaluation.choose" /></h4>
|
<h4 class="title"><fmt:message key="evaluation.choose" /></h4>
|
||||||
@@ -50,7 +62,8 @@
|
|||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<c:if test="${article.evaluated == true and empty article.referee}">
|
<c:if test="${article.evaluated == true and empty article.referee}">
|
||||||
<c:if test="${article.article.state != 'REJECTED' and article.article.state != 'ACCEPTED'}">
|
<c:if test="${article.article.state != 'REJECTED' and article.article.state != 'ACCEPTED'}">
|
||||||
|
<a title="Delete the evaluation" id="suppressArticle" title="Delete" href="javascript:deleteReport(${article.article.id});">Remove your evaluation<img src="./images/cc-button_cancel-32x32.png" alt="Delete"/></a><br />
|
||||||
<a title="Click to modify evaluation" href="<c:url value="evaluation.htm?id=${article.article.id}&action=modify"/>">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.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>
|
</c:if>
|
||||||
|
|||||||
@@ -42,7 +42,8 @@
|
|||||||
<prop key="/login.htm">LogonController</prop>
|
<prop key="/login.htm">LogonController</prop>
|
||||||
<prop key="/listEvaluation.htm">ListEvaluationController</prop>
|
<prop key="/listEvaluation.htm">ListEvaluationController</prop>
|
||||||
<prop key="/download.htm">ArticleDownloadController</prop>
|
<prop key="/download.htm">ArticleDownloadController</prop>
|
||||||
<prop key="/deleteArticle.htm">ArticleDeleteController</prop>
|
<prop key="/deleteArticle.htm">ArticleDeleteController</prop>
|
||||||
|
<prop key="/removeEvaluation.htm">EvaluationRemoveController</prop>
|
||||||
<prop key="/listReport.htm">ListReportController</prop>
|
<prop key="/listReport.htm">ListReportController</prop>
|
||||||
<prop key="/listReportAuthor.htm">ListReportAuthorController</prop>
|
<prop key="/listReportAuthor.htm">ListReportAuthorController</prop>
|
||||||
<prop key="/forgotPassword.htm">ForgotPasswordController</prop>
|
<prop key="/forgotPassword.htm">ForgotPasswordController</prop>
|
||||||
@@ -116,6 +117,11 @@
|
|||||||
|
|
||||||
<bean id="ArticleDeleteController" class="org.yacos.web.author.controller.ArticleDeleteController">
|
<bean id="ArticleDeleteController" class="org.yacos.web.author.controller.ArticleDeleteController">
|
||||||
<property name="articleManager" ref="articleManager" />
|
<property name="articleManager" ref="articleManager" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="EvaluationRemoveController" class="org.yacos.web.PCmember.controller.EvaluationRemoveController">
|
||||||
|
<property name="articleManager" ref="articleManager" />
|
||||||
|
<property name="evaluationManager" ref="evaluationManager" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="SUserRegistrationController"
|
<bean id="SUserRegistrationController"
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package org.yacos.web.PCmember.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
||||||
|
import org.springframework.web.servlet.mvc.Controller;
|
||||||
|
import org.springframework.web.servlet.view.RedirectView;
|
||||||
|
import org.yacos.core.article.Article;
|
||||||
|
import org.yacos.core.article.IArticleManager;
|
||||||
|
import org.yacos.core.evaluation.IEvaluationManager;
|
||||||
|
import org.yacos.core.evaluation.Rating;
|
||||||
|
import org.yacos.core.evaluation.Report;
|
||||||
|
import org.yacos.web.system.session.SessionService;
|
||||||
|
|
||||||
|
public class EvaluationRemoveController implements Controller {
|
||||||
|
private IArticleManager articleManager;
|
||||||
|
private IEvaluationManager evaluationManager;
|
||||||
|
|
||||||
|
public IArticleManager getArticleManager() {
|
||||||
|
return articleManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArticleManager(IArticleManager articleManager) {
|
||||||
|
this.articleManager = articleManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEvaluationManager getEvaluationManager() {
|
||||||
|
return evaluationManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEvaluationManager(IEvaluationManager evaluationManager) {
|
||||||
|
this.evaluationManager = evaluationManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelAndView handleRequest(HttpServletRequest request,
|
||||||
|
HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
|
try {
|
||||||
|
Integer articleId = Integer.parseInt(request.getParameter("articleId"));
|
||||||
|
Article article = articleManager.getArticle(articleId);
|
||||||
|
|
||||||
|
// FIXME : v<>rifier si le gars a le droit de suppr ou pas
|
||||||
|
|
||||||
|
if(article == null){
|
||||||
|
return new ModelAndView(new RedirectView("404error.htm"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Report rpt = evaluationManager.getReportforArticleAndReferee(article.getId(), SessionService.getInstance().getCurrentUserLogin());
|
||||||
|
|
||||||
|
if (rpt == null)
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
|
||||||
|
List<Rating> listRating = evaluationManager.getRatingForReport(rpt.getId());
|
||||||
|
|
||||||
|
for (Rating rt : listRating) {
|
||||||
|
evaluationManager.removeRating(rt.getCriterion(), rpt);
|
||||||
|
}
|
||||||
|
|
||||||
|
evaluationManager.removeReport(rpt.getId());
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(NumberFormatException e) {
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : mettre le bon lien ici
|
||||||
|
return new ModelAndView(new RedirectView("listEvaluation.htm"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -70,6 +70,8 @@ public class ListEvaluationController extends SimpleFormController {
|
|||||||
List<EvaluationArticleBean> listArticleBean = new ArrayList<EvaluationArticleBean>();
|
List<EvaluationArticleBean> listArticleBean = new ArrayList<EvaluationArticleBean>();
|
||||||
|
|
||||||
String person = request.getParameter("role");
|
String person = request.getParameter("role");
|
||||||
|
if (person == null || person.equals(""))
|
||||||
|
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
|
||||||
|
|
||||||
// TODO : renvoyer un truc s'il n'a pas le role
|
// TODO : renvoyer un truc s'il n'a pas le role
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user