<%@ include file="/WEB-INF/decorators/include.jsp"%>

<html>
<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>

<h4 class="title"><fmt:message key="evaluation.choose" /></h4>

<p class="formHelp">
  <fmt:message key="evaluation.help"/>	
</p>

<c:forEach items="${listArticle}" var="article">
	<div style="border: 1px solid orange;">
		<table style="width: 100%">
			<tr>
				<td colspan="3" align="center">
					<a title="To see the detail and download" href="<c:url value="/detailArticle.htm"><c:param name="id" value="${article.article.id}"/></c:url>"><b>${article.article.title}</b></a> by ${article.article.mainAuthor.firstName} ${article.article.mainAuthor.lastName}
				</td>
			</tr>
			<tr>
				<td align="left" width="33%">
					<c:choose>
					<c:when test="${not empty article.referee}">
						Delegated to:<br />
						<c:forEach var="referee" items="${article.referee}">
							${referee.firstName} ${referee.lastName}<br/>
						</c:forEach>
					</c:when>
					<c:otherwise>
						&nbsp;
					</c:otherwise>
					</c:choose>
				</td>
				<td align="center" width="33%">
					<c:choose>
					<c:when test="${article.article.state == 'EVALUATED' or article.article.state == 'REJECTED' or article.article.state == 'ACCEPTED'}">
						<a href="<c:url value="listReport.htm?id=${article.article.id}"/>"><fmt:message	key="validate.report" /></a>
					</c:when>
					<c:otherwise>
						&nbsp;
					</c:otherwise>
					</c:choose>
				</td>
				<td align="right" width="33%">
        			<c:if test="${article.evaluated == false and empty article.referee}">
        				<c:if test="${article.article.state != 'REJECTED' and  article.article.state != 'ACCEPTED'}">
							<a title="Click to evaluate" href="<c:url value="evaluation.htm?id=${article.article.id}"/>">Evaluate <img src="./images/button_follow_32x32.png" alt="Click to evaluate" /></a>
						</c:if>
        			</c:if>
        
        			<c:if test="${article.evaluated == true and empty article.referee}">
        				<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>
						</c:if>
        			</c:if>
        
        			<c:if test="${article.article.state eq 'REJECTED'}">
						Rejected <img src="./images/cancel32.png" alt="This article has been rejected" />
        			</c:if>
        
        			<c:if test="${article.article.state eq 'ACCEPTED'}">
						Accepted <img src="./images/ok32.png" alt="This article has been accepted" />
        			</c:if>
				</td>
			</tr>
		</table>
	</div>
</c:forEach>

</body>
</html>