<%@page import="com.qmth.qrzk.repository.utils.Consts"%>
<%@ 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>
<%@ include file="../common/top.jsp"%>
<link rel="stylesheet" href="${ctx}/resources/css/main.css" type="text/css" />
<link rel='stylesheet' href='${ctx}/resources/css/easyui.css' type='text/css' media='screen' />
<link rel='stylesheet' href='${ctx}/resources/css/easyui/icon.css' type='text/css' media='screen' />
<link rel='stylesheet' href='${ctx}/resources/css/user-center-style.css' type='text/css' media='screen' />
<link rel="stylesheet" href="${ctx}/resources/css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="${ctx}/resources/css/style.css" type="text/css" />
<link rel="stylesheet" href="${ctx}/resources/css/alertify.core.css" type="text/css" media='screen' />
<link rel="stylesheet" href="${ctx}/resources/css/alertify.default.css" type="text/css" media='screen' />

<script type="text/javascript" src="${ctx}/resources/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/lib/bootstrap.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/alertify.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/bootstrap-waitingfor.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/question/questionList.jsp"></script>
<style>
.table{width: 100%}
.table-bordered{border-collapse:collapse;border:none;}
.table-bordered th{border:solid #c9c9c9 1px;padding:2px 2px 2px 2px;}
.table-bordered td{border:solid #c9c9c9 1px;padding:2px 2px 2px 2px;}

.searchTbl th{height: 30px;vertical-align: middle;}
.searchTbl td{height: 30px;vertical-align: middle;}
select {
	margin: 0px;
}
i {font-style:italic;}
em {font-style:italic;}
.myMargin3{
	margin-right: 20px;
}
</style>
<script type="text/javascript">
	var queryType = null;
	
	var codeMap = {};
    <c:forEach items="${codes }" var="code">
    codeMap['${code.itemType}-${code.itemCode}'] = '${code.itemValue}';
    </c:forEach>

	$(document).ready(function(){
	});
	
	function initChooseParam(param){
		quesOperType = "<%=Consts.QuesOperTypeForZj.CHANGE_INTO_PAPER%>";
		$("#blankQuesNum").val(param.blankQuesNum);
		$("#paperId").val(param.paperId);
		$("#pqtId").val(param.pqtId);
		$("#quesTypeId").val(param.quesTypeId);
		$("#score").val(param.score);
		$("#courseId").val(param.courseId);
		$("#bookId").val(param.bookId);
		$("#detailId").val(param.detailId);
		$("#quesId").val(param.quesId);
	}
	
	function initSelectParam(param){
		quesOperType = "<%=Consts.QuesOperTypeForZj.ADD_INTO_PAPER%>";
		$("#blankQuesNum").val(param.blankQuesNum);
		$("#paperId").val(param.paperId);
		$("#pqtId").val(param.pqtId);
		$("#quesTypeId").val(param.quesTypeId);
		$("#score").val(param.score);
		$("#courseId").val(param.courseId);
		$("#bookId").val(param.bookId);
	}

	function searchBtnClick(){
		$("#searchBtn").click();
	}
	
	$(document).ready(function(){
		${param.fun}(${param.paramStr});
		searchBtnClick();
		
		$("#cancelSelectQuesAttrBtn").click(function(){
	    	$('#selectQuesAttrDiv').window('close');
			return false;
	    });
		
		$("#saveSelectQuesAttrBtn").click(function(){
			var value = $("#restQuesDetails").val();
			if(value){
				var qd = restQuesDetailsMap[value];
				$.ajax({
		    		type : "POST",
		    		url : "${ctx}/question/changeQuesAttr",
		    		data : {"quesId":curToChange,
		    			"estimateDifficultyCode":qd.estimateDifficultyCode,
		    			"abilityCode":qd.abilityCode,
		    			"chapterNo":qd.chapterNo},
		    		success : function(res) {
		    			if(res.flag=='success'){
		    				checkQuestion(curToChange);
		    				//parent.closeSelectQuesAttrDiv();
		    			}else{
		    				alertify.error(res.msg);
		    			}
		    		}
		    	});
			}
			return false;
	    });
	});
</script>
</head>
<body style="overflow: auto;">
	<input type="hidden" value="" id="blankQuesNum" />
	<input type="hidden" value="" id="paperId" />
	<input type="hidden" value="" id="pqtId" />
	<input type="hidden" value="" id="quesTypeId" />
	<input type="hidden" value="" id="score" />
	<input type="hidden" value="" id="courseId" />
	<input type="hidden" value="" id="bookId" />
	<input type="hidden" value="" id="detailId" />
	<input type="hidden" value="" id="quesId" />
	<div class="page-bodyList">
	<table class="table table-bordered searchTbl">
		<tbody>
			<tr>
				<th>考核要求</th>
				<td><select id="assessmentDemand" name="assessmentDemand">
						<option value="">请选择</option>
						<c:forEach items="${codes }" var="code">
							<c:if test="${ code.itemType=='ASSESSMENT_DEMAND'}">
								<option value="${code.itemCode}" id="${code.itemCode}">${code.itemValue }</option>
							</c:if>
						</c:forEach>
				</select></td>
				<th>预计难度</th>
				<td><select id="estimateDifficultyCode"
					name="estimateDifficultyCode">
						<option value="">请选择</option>
						<c:forEach items="${codes }" var="code">
							<c:if test="${ code.itemType=='QUESTION_DIFFICULTY'}">
								<option value="${code.itemCode}" id="${code.itemCode}">${code.itemValue }</option>
							</c:if>
						</c:forEach>
				</select></td>
				<th>知识点</th>
				<td><input placeholder="章" class="short" id="chapter" name="chapter" style="width:30px;"/>
					<input placeholder="节" class="short" id="section" name="section" style="width:30px;" /> 
					<input placeholder="目" class="short" id="item" name="item" style="width:30px;" /> 
					<input placeholder="页" class="short" id="ye" name="page" style="width:30px;" />
				</td>
			</tr>
			<tr>
				<th>认知层次</th>
				<td><select id="abilityCode" name="abilityCode">
						<option value="">请选择</option>
						<c:forEach items="${codes }" var="code">
							<c:if test="${ code.itemType=='ABILITY'}">
								<option value="${code.itemCode}">${code.itemValue }</option>
							</c:if>
						</c:forEach>
				</select></td>
				<th>关键字</th>
				<td  style="border-right-style: hidden;"><input
					type="hidden" /> <input placeholder="题号或题干或答案匹配查询"
					style="width: 90%;" id="keyword" /></td>
				<td colspan="2">
					<table border="0">
						<tr>
							<td style="border-width: 0px;padding-right: 0px;"><label for="filterBySkel" style="display: none;">是否按照细目表过滤</label></td>
							<td style="border-width: 0px;padding-left: 10px;"><input type="checkbox" style="display: none;margin: 0px;" checked="checked" id="filterBySkel" value="1"/></td>
							<td style="border-width: 0px;"><input type="submit" id="searchBtn" style="width: 60px;height: 25px;" value="查询" onclick="search('${ctx}','1')" /></td>
						</tr>
					</table>
				</td>
			</tr>
		</tbody>
	</table>
	<div id="row" style="margin-left: 5px;margin-bottom: 5px;color: #ad5a00;font-size: 18px;font-weight: bold;"></div>
	<table class="info questionList" style="font-size: 13px;">
			<tbody>
			</tbody>
		</table>
		<div class="pages"></div>
	</div>

<div id="hiddenDiv" style="display: none;">
	<div id="selectQuesAttrDiv" title="请选择试题属性" class="easyui-window" data-options="modal:true,closed:true,iconCls:'icon-import',draggable:true,maximizable:false,minimizable:false" style="width:600px;height:240px;padding:5px;overflow-x: hidden;">
        <div id="barcode-scan" style="font-size: 12px;margin-top: 30px;">
				<table cellpadding="5">
					<tr>
						<td nowrap="nowrap" valign="top">属性替换成：</td>
						<td><select id="restQuesDetails" style="width: 450px;"></select></td>
					</tr>
					<tr>
						<td colspan="2"><div style="height: 20px;">&nbsp;</div></td>
					</tr>
					<tr>
						<td colspan="2" align="center">
							<button class="btn myMargin3" id="saveSelectQuesAttrBtn">确定</button>
							<button class="btn" id="cancelSelectQuesAttrBtn">取消</button>
						</td>
					</tr>
				</table>
        </div>
    </div>
</div>
</body>
</html>