<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>考试管理</title>
	<meta name="decorator" content="default"/>
	<%@include file="/WEB-INF/views/include/head.jsp" %>
	<%@include file="/WEB-INF/views/include/dialog.jsp" %>
	<style type="text/css">.sort{color:#0663A2;cursor:pointer;}</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/admin/exam">考试列表</a></li>
		<c:if test="${web_user.type.value==0}">
		<li><a href="${ctx}/admin/exam/form">添加考试</a></li>
		</c:if>
	</ul>
	<form id="searchForm"  action="${ctx}/admin/exam" method="post" class="breadcrumb form-search">
		<input id="pageNumber" name="pageNumber" type="hidden"/>
		<input id="pageSize" name="pageSize" type="hidden"/>
		<div>
			<label>名称：</label><input type="text" id="name" name="name" value="${query.name }" htmlEscape="false" maxlength="50" class="input-small"/>
			&nbsp;<input id="btnSubmit" class="btn btn-primary" type="button" value="查询" onclick="goSearch()"/>
		</div>
	</form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>编号</th>
				<th>考试名称</th>
				<th>考试时间</th>
				<th>状态</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${examList}" var="exam">
			<tr>
				<td>${exam.id}</td>
				<td><a href="${ctx}/admin/exam/view/${exam.id}">${exam.name}</a></td>
				<td><fmt:formatDate value="${exam.examTime}" pattern="yyyy-MM-dd" /></td>
				<td>${exam.status.name}</td>
				<td>
    				<a href="${ctx}/admin/exam/view/${exam.id}">详情</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${query}</div>
<script type="text/javascript">
function page(n,s){
	$("#pageNumber").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
	return false;
}
function goSearch(){
	$("#pageNumber").val(1);
	$("#pageSize").val('${query.pageSize}');
	$("#searchForm").submit();
	return false;
}
$(document).keydown(function(event) {
	if(event.keyCode == 13 || event.keyCode== 108){
		goSearch();
		return false;
	}
});
</script>	
</body>
</html>