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

<html>
<head>

<script type='text/javascript' src='./javascripts/prototype.js'></script>
<script type='text/javascript' src='./javascripts/scriptaculous.js'></script>
<script type='text/javascript' src='./javascripts/effects.js'></script>

<script type="text/javascript">
//<![CDATA[
function showConfAll() {
	if ($('confList').visible())
		$('confList').fade();
	else
		$('confList').appear();
}

function showArticleAll() {
	if ($('articleList').visible())
		$('articleList').fade();
	else
		$('articleList').appear();
}

function showConfChairman() {
	if ($('confListChairman').visible())
		$('confListChairman').fade();
	else
		$('confListChairman').appear();
}

function showConfPcmember() {
	if ($('confListPcmember').visible())
		$('confListPcmember').fade();
	else
		$('confListPcmember').appear();
}

function showConfReferee() {
	if ($('confListReferee').visible())
		$('confListReferee').fade();
	else
		$('confListReferee').appear();
}

function showConfAuthor() {
	if ($('confListAuthor').visible())
		$('confListAuthor').fade();
	else
		$('confListAuthor').appear();
}

function showArticlePcMember() {
	if ($('articleListPcMember').visible())
		$('articleListPcMember').fade();
	else
		$('articleListPcMember').appear();
}

function showArticleReferee() {
	if ($('articleListReferee').visible())
		$('articleListReferee').fade();
	else
		$('articleListReferee').appear();
}
//]]>
</script>

</head>

<body>
	
	<h4 class="title">User Board</h4>
	
	<a name="listConf"></a> 
	<h3 class="descriptionTitle">Generals informations</h3>
	<div class="textBox">
		<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.<br /><br />
		</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.<br /><br />
		</c:otherwise>
		</c:choose>
	
		You currently follow <b>${numberConference}</b> conference(s)<br /><br />
		
		<c:if test="${not empty listConfForUser}">
			If you want to see the list of conferences you are registered in, click <a href="#listConf" onclick="showConfAll();">here</a>.
			
			
					<div id="confList" style="display: none;">
						<table width="100%" align="center">
						<tbody>
							<c:forEach var="conf" items="${listConfForUser}">
							<tr>
								<td align="center">${conf.title}</td>
								<td align="center"><a href="chooseConference.htm?idConf=${conf.id}">Select</a></td>
							</tr>
							</c:forEach>
						</tbody>
						</table>
					</div>
			
		</c:if>
	</div>
	
	<a name="listConfAuthor"></a> 
	<h3 class="descriptionTitle">Author's informations</h3>
	<div class="textBox">	
		You are Author in <b>${numberAuthor}</b> conference(s)<br /><br />
		
		<c:if test="${not empty listConfForUser}">
			If you want to see the list of conferences you are registered in, click <a href="#listConfAuthor" onclick="showConfAuthor();">here</a>.
			
			
					<div id="confListAuthor" style="display: none;">
						<table width="100%" align="center">
						<tbody>
							<c:forEach items="${listConfForUser}" var="conf">
								<c:forEach items="${listRole}" var="role">
								<c:if test="${conf.id == role.conference.id and role.type == 'AUTHOR'}">
									<tr>
										<td align="center">${conf.title}</td>
										<td align="center"><a href="chooseConference.htm?idConf=${conf.id}">Select</a></td>
									</tr>			
								</c:if>
								</c:forEach>
							</c:forEach>
						</tbody>
						</table>
					</div>
			<br /><br />
		</c:if>
		
		<a name="listArticleAuthor"></a> 
		You have posted <b>${numberArticle}</b> article(s).<br /><br />
		
		<c:if test="${not empty listAllArticle}">
			If you want to see the list of articles you have submitted, click <a href="#listArticleAuthor" onclick="showArticleAll();">here</a>.
			
			
					<div id="articleList" style="display: none;">
						<table width="100%" align="center">
						<tbody>
							<tr bgcolor="#FFCE64">
								<td align="center" width="25%">Title</td>
								<td align="center" width="10%">State</td>
								<td align="center" width="45%">Conference</td>
								<td align="center" width="20%">Download</td>
							</tr>
							<c:forEach var="article" items="${listAllArticle}" varStatus="i">
							<tr>
								<td align="left">
									<span title="${article.title }">${fn:substring(article.title, 0, 40)}
									<c:if test="${fn:length(article.title) > 41}">
									...
									</c:if></span>
								</td>
								<td>
									<c:if test="${article.state == 'SUBMITED'}">
										Submitted
									</c:if>
									<c:if test="${article.state == 'EVALUATED'}">
										Evaluated
									</c:if>
									<c:if test="${article.state == 'REJECTED'}">
										Rejected
									</c:if>
									<c:if test="${article.state == 'ACCEPTED'}">
										Accepted
									</c:if>								
								</td>
								<td align="left">
									<a href="chooseConference.htm?idConf=${article.conference.id}" title="${article.conference.title }">
										${fn:substring(article.conference.title, 0, 45)}
									<c:if test="${fn:length(article.conference.title) > 46}">
									...
									</c:if>
									</a>
								</td>
								<td>
									<a class="manage_link" id="articleURL" 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>
							</tr>
							</c:forEach>
						</tbody>
						</table>
					</div>
			
		</c:if>
	</div>
	
	<a name="listConfReferee"></a> 
	<h3 class="descriptionTitle">Referee's informations</h3>
	<div class="textBox">
		You are Referee in <b>${numberReferee}</b> conference(s)<br /><br />
		
		<c:if test="${not empty listConfForUser}">
			If you want to see the list of conferences you are registered in, click <a href="#listConfReferee" onclick="showConfReferee();">here</a>.
			
			
					<div id="confListReferee" style="display: none;">
						<table width="100%" align="center">
						<tbody>
							<c:forEach items="${listConfForUser}" var="conf">
								<c:forEach items="${listRole}" var="role">
								<c:if test="${conf.id == role.conference.id and role.type == 'REFEREE'}">
									<tr>
										<td align="center">${conf.title}</td>
										<td align="center"><a href="chooseConference.htm?idConf=${conf.id}">Select</a></td>
									</tr>			
								</c:if>
								</c:forEach>
							</c:forEach>
						</tbody>
						</table>
					</div>
		<br /><br />	
		</c:if>
		
		<a name="listArticleReferee"></a> 
		You have <b>${numberArticleReferee}</b> article(s) in your evaluation list.<br />
		You have evaluated <b>${numberEvaluatedReferee}</b> article(s)<br />
		You have to evaluate <b>${numberNotEvaluatedReferee}</b> article(s)<br /><br />
		
		<c:if test="${not empty listArticleReferee}">
			If you want to see the list of articles you have in your evaluation list, click <a href="#listArticleReferee" onclick="showArticleReferee();">here</a>.
			
			
					<div id="articleListReferee" style="display: none;">
						<table width="100%" align="center">
						<tr bgcolor="#FFCE64">
								<td align="center" width="25%">Title</td>
								<td align="center" width="10%">State</td>
								<td align="center" width="45%">Conference</td>
								<td align="center" width="20%">Download</td>
							</tr>
							<tbody>
							<c:forEach var="article" items="${listArticleReferee}" varStatus="i">
							<tr>
								<td align="left">
									<span title="${article.title }">${fn:substring(article.title, 0, 40)}
									<c:if test="${fn:length(article.title) > 41}">
									...
									</c:if></span>
								</td>
								<td>
									<c:if test="${article.evaluated == false}">
        								<c:if test="${article.state != 'REJECTED' and  article.state != 'ACCEPTED'}">
											To evaluate
										</c:if>
        							</c:if>
									<c:if test="${article.evaluated == true}">
        								<c:if test="${article.state != 'REJECTED' and  article.state != 'ACCEPTED'}">
											Evaluated
										</c:if>
        							</c:if>
									<c:if test="${article.state == 'REJECTED'}">
										Rejected
									</c:if>
									<c:if test="${article.state == 'ACCEPTED'}">
										Accepted
									</c:if>								
								</td>
								<td align="left">
									<a href="chooseConference.htm?idConf=${article.conference.id}" title="${article.conference.title }">
										${fn:substring(article.conference.title, 0, 45)}
									<c:if test="${fn:length(article.conference.title) > 46}">
									...
									</c:if>
									</a>
								</td>
								<td>
									<a class="manage_link" id="articleURL" 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>
							</tr>
							</c:forEach>
						</tbody>
						</table>
					</div>
			
		</c:if>
	</div>
	
	<a name="listConfPcmember"></a> 
	<h3 class="descriptionTitle">PCMember's informations</h3> 
	<div class="textBox">
		You are PCMember in <b>${numberPCMember}</b> conference(s)<br /><br />
		
		<c:if test="${not empty listConfForUser}">
			If you want to see the list of conferences you are registered in, click <a href="#listConfPcmember" onclick="showConfPcmember();">here</a>.
			
			
					<div id="confListPcmember" style="display: none;">
						<table width="100%" align="center">
						<tbody>
							<c:forEach items="${listConfForUser}" var="conf">
								<c:forEach items="${listRole}" var="role">
								<c:if test="${conf.id == role.conference.id and role.type == 'PCMEMBER'}">
									<tr>
										<td align="center">${conf.title}</td>
										<td align="center"><a href="chooseConference.htm?idConf=${conf.id}">Select</a></td>
									</tr>			
								</c:if>
								</c:forEach>
							</c:forEach>
						</tbody>
						</table>
					</div>
		<br /><br />	
		</c:if>
		
		
		<a name="listArticlePcMember"></a> 
		You have <b>${numberArticlePCMember}</b> article(s) in your evaluation list.<br />
		You have evaluated <b>${numberEvaluatedPCMember}</b> article(s)<br />
		You have to evaluate <b>${numberNotEvaluatedPCMember}</b> article(s)<br /><br />
		
		<c:if test="${not empty listArticlePCMember}">
			If you want to see the list of articles you have in your evaluation list, click <a href="#listArticlePcMember" onclick="showArticlePcMember();">here</a>.
			
			
					<div id="articleListPcMember" style="display: none;">
						<table width="100%" align="center">
							<tr bgcolor="#FFCE64">
								<td align="center" width="25%">Title</td>
								<td align="center" width="20%">Delegated to...</td>
								<td align="center" width="10%">State</td>
								<td align="center" width="25%">Conference</td>
								<td align="center" width="20%">Download</td>
							</tr>
						<tbody>
							<c:forEach var="article" items="${listArticlePCMember}" varStatus="i">
							<tr>
								<td align="left">
								<span title="${article.title }">${fn:substring(article.title, 0, 30)}
									<c:if test="${fn:length(article.title) > 31}">
									...
									</c:if></span>
								</td>
								<td>
								<c:choose>
								<c:when test="${not empty article.referee}">
									<c:forEach var="referee" items="${article.referee}">
										${referee.firstName} ${referee.lastName}<br/>
									</c:forEach>
								</c:when>
								<c:otherwise>
									-
								</c:otherwise>
								</c:choose>
								</td>
								<td>
									<c:if test="${article.evaluated == false}">
        								<c:if test="${article.state != 'REJECTED' and  article.state != 'ACCEPTED'}">
											To evaluate
										</c:if>
        							</c:if>
									<c:if test="${article.evaluated == true}">
        								<c:if test="${article.state != 'REJECTED' and  article.state != 'ACCEPTED'}">
											Evaluated
										</c:if>
        							</c:if>
									<c:if test="${article.state == 'REJECTED'}">
										Rejected
									</c:if>
									<c:if test="${article.state == 'ACCEPTED'}">
										Accepted
									</c:if>																	
								</td>
								<td align="left">
									<a href="chooseConference.htm?idConf=${article.conference.id}" title="${article.conference.title }">
										${fn:substring(article.conference.title, 0, 27)}
									<c:if test="${fn:length(article.conference.title) > 281}">
									...
									</c:if>
									</a>
								</td>
								<td align="right">
									<a class="manage_link" id="articleURL" 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>
							</tr>
							</c:forEach>
						</tbody>
						</table>
					</div>
			
		</c:if>
	</div>
	
	<h3 class="descriptionTitle">Chairman's informations</h3>
	<div class="textBox">
		You are Chairman in <b>${numberChairman}</b> conference(s)<br /><br />
		
		<a name="listConfChairman"></a> 
		<c:if test="${not empty listConfForUser}">
			If you want to see the list of conferences you are registered in, click <a href="#listConfChairman" onclick="showConfChairman();">here</a>.
			
			
					<div id="confListChairman" style="display: none;">
						<table width="100%" align="center">
						<tbody>
							<c:forEach items="${listConfForUser}" var="conf">
								<c:forEach items="${listRole}" var="role">
								<c:if test="${conf.id == role.conference.id and role.type == 'CHAIRMAN'}">
									<tr>
										<td align="center">${conf.title}</td>
										<td align="center"><a href="chooseConference.htm?idConf=${conf.id}">Select</a></td>
									</tr>			
								</c:if>
								</c:forEach>
							</c:forEach>
						</tbody>
						</table>
					</div>
			
		</c:if>
		
		
	</div>
	
</body>
</html>