<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/init.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>试题中心</title>
<%@ include file="../common/top.jsp"%>
<link href="${ctx}/resources/css/main.css" rel="stylesheet" type="text/css" />
<link href='${ctx}/resources/css/user-center-style.css' rel='stylesheet' type='text/css' />
<link href="${ctx}/resources/css/component.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="${ctx}/resources/css/pager.css"/>
<script type="text/javascript" src="${ctx}/resources/js/pagination/jquery.pager.js"></script>
<link href="${ctx}/resources/css/jquery.alerts.css" rel="stylesheet"type="text/css" />
<script type="text/javascript" src="${ctx}/resources/js/jquery.alerts.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/jquery.checktable.js"></script>
</head>

<body>
<%@ include file="../common/header.jsp"%>
<div id="content">	
	<%@ include file="../common/sub_menu.jsp"%>
	<div id="page">
	<div class="page-body">
		<div class="Preview">
		<div class="view">
			<div>
				<c:if test="${message!=null}">
				<span>${message}</span>
				</c:if>
			</div>
		</div>
		<div style="padding-left: 8px;">
			<a type="button" class="btn" href="${ctx}/question/list/1">返回</a>
		</div>
		<c:forEach items="${list}" var="question">
			<div class="subfield">
			<div class="subfield-title">
			编号: ${question.id} &nbsp;&nbsp;&nbsp;
			课程: <code:category fromTable="Y" type="QR_SUBJECT" codeCol="ID" valueCol="NAME" code="${question.subjectId}" />&nbsp;&nbsp;&nbsp;
			题型: <code:category fromTable="Y" type="QR_QUESTION_TYPE" codeCol="ID" valueCol="NAME" code="${question.typeId}" />&nbsp;&nbsp;&nbsp;
			命题人: ${question.setter}&nbsp;&nbsp;&nbsp;
			状态: ${question.status.name}&nbsp;&nbsp;&nbsp;
			<c:if test="${web_session_authority.questionEdit==1 || web_session_authority.questionEditSub==1 || web_session_authority.questionEditSelf==1}"><a class="edit" href="${ctx}/question/edit/${question.id}/${pageIndex}">编辑</a></c:if>
			<c:if test="${web_session_authority.questionVerify==1 || web_session_authority.questionVerifySub==1}"><a class="edit" href="${ctx}/question/audit/${question.id}/${pageIndex}">审核</a></c:if>
			<a class="del" href="#" onclick="goDel('${question.id}')">删除</a></div>
			<div class="subfield-qbody">
				<p>${question.body}</p>
				<c:forEach items="${question.options}" var="option">
					<li>${option.code}：${option.content}</li>
				</c:forEach>
				<c:if test="${question.answer!=null && question.answer!=''}">
				<p>正确答案：</p>
				<p>${question.answer}</p>
				</c:if>
				<c:if test="${question.analysis!=null && question.analysis!=''}">
				<p>评分标准及解析：</p>
				<p>${question.analysis}</p>
				</c:if>
			</div>
			</div>
		</c:forEach>
		</div>
		<div id="pager" style="margin-top:10px;line-height: 25px;"></div>
	</div>
	</div>	
</div>

<form id="questionDelForm" action="" method="post">
</form>

<script type="text/javascript">
$(document).ready(function() {
	$("#pager").pager({ pagenumber: ${pageIndex}, pagecount: ${sum}/10, buttonClickCallback: onChange});
	function onChange(page) {
        $("#queryFrm").attr("action", "${ctx}/question/import/preview/"+page);
		$("#queryFrm").submit();
	}
	
	if(subjectId!=''){
		changeSubject(subjectId, typeId);
	}
});

function goDel(obj){
	jConfirm('确定删除当前小题?', '删除对话框', function(r) {
		if(r){
			var action = "${ctx }/question/delete/"+obj
			$("#questionDelForm").attr("action",action);
			$("#questionDelForm").submit();
		}
	});
}
</script>
</body>
</html>