<%@ 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">

function showConfAll() {
	if ($('confList').visible())
		$('confList').style.display = "none";
	else
		$('confList').style.display = "";
}

function showArticleAll() {
	if ($('articleList').visible())
		$('articleList').style.display = "none";
	else
		$('articleList').style.display = "";
}

function showConfChairman() {
	if ($('confListChairman').visible())
		$('confListChairman').style.display = "none";
	else
		$('confListChairman').style.display = "";
}

function showConfPcmember() {
	if ($('confListPcmember').visible())
		$('confListPcmember').style.display = "none";
	else
		$('confListPcmember').style.display = "";
}

function showConfReferee() {
	if ($('confListReferee').visible())
		$('confListReferee').style.display = "none";
	else
		$('confListReferee').style.display = "";
}

function showConfAuthor() {
	if ($('confListAuthor').visible())
		$('confListAuthor').style.display = "none";
	else
		$('confListAuthor').style.display = "";
}

</script>

</head>

<body>
	
	<h4 class="title">User Board</h4>
	
	<h3 class="descriptionTitle">Generals informations</h3>
	<div class="textBox">
		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="#" onclick="showConfAll();">here</a>.
			
			<div id="confListDiv" class="dynamicFredList">
					<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>
			</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 />
		
		<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.
		</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.
		</c:otherwise>
		</c:choose>
		
		<br /><br />
		<c:if test="${not empty listConfForUser}">
			If you want to see the list of conferences you are registered in, click <a href="#" onclick="showConfChairman();">here</a>.
			
			<div id="confListChairmanDiv" class="dynamicFredList">
					<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>
			</div>
		</c:if>
		
		
	</div>
	
	<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="#" onclick="showConfPcmember();">here</a>.
			
			<div id="confListPcmemberDiv" class="dynamicFredList">
					<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>
			</div>
		</c:if>
	</div>
	
	<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="#" onclick="showConfReferee();">here</a>.
			
			<div id="confListRefereeDiv" class="dynamicFredList">
					<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>
			</div>
		</c:if>
	</div>
	
	<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="#" onclick="showConfAuthor();">here</a>.
			
			<div id="confListAuthorDiv" class="dynamicFredList">
					<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>
			</div>
		</c:if>
		
		<br />
		You have posted <b>${numberArticle}</b> article(s).<br /><br />
		
		<c:if test="${not empty listConfForUser}">
			If you want to see the list of articles you have submitted, click <a href="#" onclick="showArticleAll();">here</a>.
			
			<div id="articleListDiv" class="dynamicFredList">
					<div id="articleList" style="display: none;">
						<table width="100%" align="center">
						<tbody>
							<c:forEach var="article" items="${listAllArticle}" varStatus="i">
							<tr>
								<td align="center" width="25%">${article.title}</td>
								<td align="center" width="25%">
									<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="center" width="25%">
									<a href="chooseConference.htm?idConf=${listConfForArticle[i.index].id}">${listConfForArticle[i.index].title}</a>
								</td>
								<td align="center" width="25%">
									<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>
			</div>
		</c:if>
	</div>

</body>
</html>