Correction d'un bug dans evaluation

+ Modif diverses
This commit is contained in:
Frederic Debuire
2008-02-23 20:01:49 +00:00
parent 33febd3dc4
commit 7ab701fc42
6 changed files with 55 additions and 45 deletions

View File

@@ -1,32 +1,33 @@
<%@ include file="/WEB-INF/decorators/include.jsp"%> <%@ include file="/WEB-INF/decorators/include.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><fmt:message key="detail.title"/></title>
</head>
<body>
<div class="article cb"> <html>
<h2>${article.title}</h2> <head>
<p class="author">Author: <b>${article.mainAuthor.firstName} ${article.mainAuthor.lastName}</b></p> </head>
<c:if test="${article.secondaryAuthors!=null}"> <body>
<p class="secondaryAuthors">
Secondary Authors: <h4 class="title">Article's details</h4>
<ul>
<c:forEach items="${article.secondaryAuthors}" var="sAuthor"> <div class="article cbb">
<li>${sAuthor}</li> <h2>${article.title}</h2>
</c:forEach> <p class="author">Author: <b>${article.mainAuthor.firstName}
</ul> ${article.mainAuthor.lastName}</b></p>
</c:if> <c:if test="${article.secondaryAuthors!=null}">
<p class="secondaryAuthors">Secondary Authors:
<p class="topic">Topic: <b>${article.topic}</b></p> <ul>
<p class="topic">State of article: <b>${article.state}</b></p> <c:forEach items="${article.secondaryAuthors}" var="sAuthor">
<p class="article_url"><a href=" <li>${sAuthor}</li>
</c:forEach>
</ul>
</c:if>
<p class="topic">Topic: <b>${article.topic}</b></p>
<p class="topic">State of article: <b>${article.state}</b></p>
<p class="article_url"><a
href="
<c:url value="/download.htm"> <c:url value="/download.htm">
<c:param name="articleId" value="${article.id}"/> <c:param name="articleId" value="${article.id}"/>
</c:url>">Download the article</a> </c:url>">Download</a></p>
</p>
</div>
</div> </body>
</body>
</html> </html>

View File

@@ -237,7 +237,7 @@ public class EvaluationController extends SimpleFormController {
for(SimpleCriterion sc : liste) { for(SimpleCriterion sc : liste) {
Rating rt = new Rating(); Rating rt = new Rating();
for (Rating r : ratings) { for (Rating r : ratings) {
if (r.getCriterion().getId() == sc.getId()) { if (r.getCriterion().getId().intValue() == sc.getId().intValue()) {
rt = r; rt = r;
} }
} }

View File

@@ -9,26 +9,37 @@ 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;
public class DetailArticleController extends SimpleFormController { public class DetailArticleController extends SimpleFormController {
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
private IArticleManager articleManager; private IArticleManager articleManager;
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { throws ServletException, IOException {
logger.info("Returning main view"); logger.info("Returning details view");
String id=request.getParameter("id");
System.out.println("article's id is "+id); String articleId = request.getParameter("id");
Integer idd=new Integer(Integer.parseInt(id));
Article article=articleManager.getArticle(idd); try {
//FIXME Integer id = new Integer(articleId);
return new ModelAndView("detailArticle","article",article);
} Article article = articleManager.getArticle(id);
if (article == null)
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
return new ModelAndView("detailArticle", "article", article);
}
catch (NumberFormatException e) {
throw new ModelAndViewDefiningException(new ModelAndView("404error"));
}
}
public IArticleManager getArticleManager() { public IArticleManager getArticleManager() {
return articleManager; return articleManager;

View File

@@ -20,7 +20,6 @@ public class MainController extends SimpleFormController {
logger.info("Returning main view"); logger.info("Returning main view");
//FIXME
return new ModelAndView("main"); return new ModelAndView("main");
} }
} }

View File

@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.ModelAndViewDefiningException;
import org.springframework.web.servlet.mvc.Controller; import org.springframework.web.servlet.mvc.Controller;
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.Article;
@@ -87,8 +88,7 @@ public class ArticleDownloadController implements Controller {
response.getOutputStream().close(); response.getOutputStream().close();
} catch(NumberFormatException e){ } catch(NumberFormatException e){
// TODO : display something throw new ModelAndViewDefiningException(new ModelAndView("404error"));
return null;
} }
return null; return null;

View File

@@ -68,7 +68,6 @@ public class SessionService {
//request.setAttribute("nbUserConferences",getNbUserConferences()); //request.setAttribute("nbUserConferences",getNbUserConferences());
} catch (NamingException e) { } catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }