<%@ 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 rel='stylesheet' type='text/css' href='${ctx}/resources/css/themes/default/easyui.css'/>
<link rel="stylesheet" type="text/css" href="${ctx}/resources/css/themes/icon.css"/>
<link rel="stylesheet" href="${ctx}/resources/css/main.css" type="text/css" />
<link href='${ctx}/resources/css/user-center-style.css' rel='stylesheet' type='text/css' />

<script type="text/javascript" src="${ctx}/resources/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/validator.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/question/list.jsp"></script>
<style>
@charset "utf-8";
.pages {text-align:center;width:100%;margin:20px auto;padding-top:20px;height:26px;overflow:hidden;}
.pages a {padding:5px;border:1px solid #CCC;margin:0px 5px;text-decoration:none;color:#333;}
.pages a:hover {border:1px solid #FC0;color:#F60;}
.pages .this {border:1px solid #FC0;color:#F60;}

.title {text-align: center;background-color: #FFF9E7;}
.short {width: 30px;}
.container {width: 98%;margin: auto;padding-top: 15px;}
.caption {width: 100%;border-collapse:collapse;}
.info{width: 100%;border-collapse:collapse;}
.caption tr td{border: solid 1px #E0BF8D;color: #E84100;font-size: 16px;font-weight: bold;}
th{border: solid 1px #E0BF8D;}
.caption tr td select{width: 90%;}
.row{height: 30px;padding-top: 15px;}
.question-body {
    line-height: 1.5em;
    cursor: pointer;
    color: #333;
}

.logDiv{
	margin-bottom: 10px;
	border-style: solid;
	border-width: 1px;
	border-color: #000000;
}

.myMargin1{
	margin-right: 10px;
}
.myMargin3{
	margin-right: 30px;
}
.myMargin4{
	margin-left: 3px;
}
.myTd1{
	width: 35px;
	text-align: left;
}
.myTd2{
	text-align: left;
}
</style>
<script type="text/javascript">
	function load(){
		$("#course").get(0).selectedIndex=0;
		search('${ctx}','1');
	}

	var codeMap = {};
    <c:forEach items="${codes }" var="code">
    codeMap['${code.itemType}-${code.itemCode}'] = '${code.itemValue}';
    </c:forEach>

	$(document).ready(function(){
	});
	
	function toAddQues(){
		var courseId = $('#course').val();
		if(courseId == ""){
			$.messager.alert('提示','请选择课程!', 'error',function(){
			});
	       	return false;
		}
		showQuesAddWin({courseId:courseId});
	}

	function showQuesAddWin(ques){
		var paramStr = JSON.stringify(ques);
		var src = "${ctx}/question/questionForEdit?courseId=" + ques.courseId + "&fun=initAddQuesParam&paramStr=" + encodeURIComponent(paramStr);
		$("#quesAddDiv").window({top:$(document).scrollTop() + 20,
			left:$(document).scrollLeft() + 20,
			height:$(document).height()-40,
			width:$(document).width()-40,
			onResize:function(){
				var winBody = $("#quesAddDiv").window("body");
				$("#quesAddFrame").css({width:winBody.width(),
					height:winBody.height()
				});
			}
		});
		var winBody = $("#quesAddDiv").window("body");
		$("#quesAddFrame").css({width:winBody.width(),
			height:winBody.height()
		});
		$("#quesAddFrame").attr("src", src);
		$(document).mask('正在加载试题，请稍等...');
		window.setTimeout(function(){
			$(document).unmask();
			$("#quesAddDiv").window('open');
		},300);
	}

	function closeAddQuestionDiv(){
		$("#quesAddDiv").window('close');
	}

	function toEditQues(courseId,quesId){
		var ques = {courseId:courseId,quesId:quesId};
		showQuesEditWin(ques);
	}

	function showQuesEditWin(ques){
		var paramStr = JSON.stringify(ques);
		var src = "${ctx}/question/questionForEdit?courseId=" + ques.courseId + "&fun=initEditQuesParam&paramStr=" + encodeURIComponent(paramStr);
		$("#quesEditDiv").window({top:$(document).scrollTop() + 20,
			left:$(document).scrollLeft() + 20,
			height:$(document).height()-40,
			width:$(document).width()-40,
			onResize:function(){
				var winBody = $("#quesEditDiv").window("body");
				$("#quesEditFrame").css({width:winBody.width(),
					height:winBody.height()
				});
			}
		});
		var winBody = $("#quesEditDiv").window("body");
		$("#quesEditFrame").css({width:winBody.width(),
			height:winBody.height()
		});
		$("#quesEditFrame").attr("src", src);
		$(document).mask('正在加载试题，请稍等...');
		window.setTimeout(function(){
			$(document).unmask();
			$("#quesEditDiv").window('open');
		},300);
	}

	function closeEditQuestionDiv(){
		$("#quesEditDiv").window('close');
	}
</script>
</head>

<body onload="load()">
<%@ include file="../common/header.jsp"%>
<div>	
	<%@ include file="../common/sub_menu.jsp"%>
	<div id="page">
		<div class="page-header">试题中心-试题列表</div>
		<div class="page-body" >
			    <table class="caption">
			        <tbody>
			        <tr>
			            <td class="title">状态：</td>
			            <td>
			                <select id="status" name="statusCode">
			                    <option value="">全部</option>
			                    <c:forEach items="${status }" var="status">
			                    	<option value="${status.itemType}">${status.itemCode }</option>
			                    </c:forEach>
			                </select>
			            </td>
			            <td class="title">课程：</td>
			            <td>
			                <select id="course" name="courseId" onchange="courseChange('${ctx}')">
			                    <c:forEach items="${courses }" var="c">
			                    <option value="${c.id }">${c.code}-${c.name }</option>
			                    </c:forEach>
			                </select>
			            </td>
			            <td class="title" >题型：</td>
			            <td>
			                <select id="typeId" name="typeId" onchange="questionChange('${ctx }')">
			                    <option value="">全部题型</option>
			                </select>
			            </td>
			            <td class="title">教材：</td>
			            <td>
			                <select id="bookId" name="bookId">
			                    <option value="0">全部教材</option>
			                </select>
			            </td>
			        </tr>
			        <tr>
			            <td class="title">知识点：</td>
			            <td>
			                <input placeholder="章" class="short" id="chapter" name="chapter" />
			                <input placeholder="节" class="short"  id="section" name="section"/>
			                <input placeholder="目" class="short" id="item" name="item"/>
			                <input placeholder="页" class="short" id="ye" name="page"/>
			            </td>
			            <td class="title">能力要求：</td>
			            <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>
			            <td class="title">预计难度：</td>
			            <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>
			            <td class="title">考核要求：</td>
			            <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>
			        </tr>
			        <tr>
			            <td class="title">关键字：</td>
			            <td colspan="2" style="border-right-style: hidden;" >
			            <input type="hidden"/>
			                <input placeholder="命题号或关键字查询" style="width: 90%;" id="keyword"/>
			            </td>
			            <td colspan="5">
			            	<input type="submit" value="查询" class="myMargin3" onclick="search('${ctx}','1')"/>
			            	<input type="button" value="添加试题" onclick="toAddQues()"/>
			            </td>
			        </tr>
			        </tbody>
			    </table>
		    <div class="row" id="row">
		    	
		    </div>
		    <table class="info questionList" style="font-size:13px;">
		        <tbody>
		        </tbody>
		    </table>
			<div class="pages"></div>
		</div>
	</div>	
</div>
<div style="display: none;">
	<div id="quesAddDiv" class="easyui-window" title="新建试题" data-options="modal:true,closed:true,iconCls:'icon-import',minimizable:false" style="width:400px;height:190px;padding:0px;overflow: hidden;margin: 0px;">
		<iframe frameborder="0" name="quesAddFrame" id="quesAddFrame" style="width:1010px;height:570px;" scrolling="auto" src="">
		</iframe>
	</div>
		
	<div id="quesEditDiv" class="easyui-window" title="编辑试题" data-options="modal:true,closed:true,iconCls:'icon-import',minimizable:false" style="width:400px;height:190px;padding:0px;overflow: hidden;margin: 0px;">
		<iframe frameborder="0" name="quesEditFrame" id="quesEditFrame" style="width:1010px;height:570px;" scrolling="auto" src="">
		</iframe>
	</div>
</div>
</body>
</html>