<%@ 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" %>
	<style type="text/css">.sort{color:#0663A2;cursor:pointer;}</style>
</head>
<body>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/admin/exam-param/subjective/import" method="post" enctype="multipart/form-data"
			style="padding-left:20px;text-align:center;" class="form-search" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="导入"/>
			<a href="${ctx}/admin/exam-param/subjective/template">下载模板</a>
		</form>
	</div>  
	<!--  
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/admin/exam-param/subjective">主观大题列表</a></li>
		<li><a href="#">添加主观题</a></li>
	</ul>
	-->
	<form id="searchForm"  action="${ctx}/admin/exam-param/subjective" method="post" class="breadcrumb form-search">
		<input type="hidden" id="pageNumber" name="pageNumber" value="${query.pageNumber }"/>
		<input type="hidden" id="pageSize" name="pageSize" value="${query.pageSize }"/>
		<div>
			<label>科目：</label>
			<select name="subjectCode">
				<option value="">请选择</option>
				<c:forEach items="${subjectList}" var="subject">
				<option value="${subject.code}" <c:if test="${subject.code==query.subjectCode}">selected</c:if>>${subject.code}-${subject.name}</option>
				</c:forEach>
			</select>
			&nbsp;<input id="btnSubmit" class="btn btn-primary" type="button" value="查询" onclick="goSearch()"/>
			&nbsp;<input id="btnImport" class="btn btn-primary" type="button" value="导入"/>
		</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>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${query.result}" var="block">
			<tr>
				<td>${block.examSubject.code}-${block.examSubject.name}</td>
				<td>${block.number}</td>
				<td>${block.title}</td>
				<td>${block.totalScore }</td>
				<td>${block.stepCount }</td>
				<td>
				<a href="${ctx}/admin/exam-param/subjective/${block.id}">详情</a>
				<a class="delete-button" href="${ctx}/admin/exam-param/subjective/delete/${block.id}" onclick="return confirmx('确定要删除该大题吗?？', this.href)">删除</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${query}</div>
	<form id="hiddenFrm" action="${ctx}/admin/exam-param/subjective/distribution" method="post">
		<input type="hidden" id="subject_code" name="subject_code"/>
		<input type="hidden" id="blockId" name="blockId"/>
	</form>
<script type="text/javascript">
$("#btnImport").click(function(){
	$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
		bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
});
function page(n,s){
	$("#pageNumber").val(n);
	$("#pageSize").val(s);
	$("#searchForm").attr("action","${ctx}/admin/exam-param/subjective");
	$("#searchForm").submit();
	return false;
}
function goSearch(){
	$("#pageNumber").val(1);
	$("#pageSize").val('${query.pageSize}');
	$("#searchForm").attr("action","${ctx}/admin/exam-param/subjective");
	$("#searchForm").submit();
	return false;
}
function distribution(subjectCode,blockId){
	$("#subject_code").val(subjectCode);
	$("#blockId").val(blockId);
	$("#hiddenFrm").submit();
}
</script>	
</body>
</html>