<%@ 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" %>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#name").focus();
            var pictureConfig = '${pictureConfig}';
            window.localStorage.setItem("pictureConfig", pictureConfig);
            $("#inputForm").validate({
                submitHandler: function (form) {
                	var endTime = new Date($("#endTime").val()).getTime();
					var startTime = new Date($("#startTime").val()).getTime();
					if(startTime>=endTime){
						alert("评卷结束时间必须晚于开始时间");
						return;
					}else{
						loading('正在提交，请稍等...');
						form.submit();
					}
                },
                errorContainer: "#messageBox",
                errorPlacement: function (error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
            
            var forbiddenInfo = ${exam.forbiddenInfo};
            if (forbiddenInfo != null && forbiddenInfo ==true) {
                $("#forbiddenScoreDiv").show();
            } else {
            	$("#forbiddenScore").prop("checked", false);
                $("#forbiddenScoreDiv").hide();
            }
            $("#forbiddenInfo").change(function () {
                if ($("#forbiddenInfo").is(':checked')) {
                    $("#forbiddenScoreDiv").show();
                } else {
                	$("#forbiddenScore").prop("checked", false);
                    $("#forbiddenScoreDiv").hide();
                }
            });
        });
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/admin/exam/list">考试列表</a></li>
    <li class="active"><a href="##">编辑考试</a></li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="exam" action="${ctx}/admin/exam/edit" method="post" class="form-horizontal">
    <form:hidden path="id"/>
     <input type="hidden" id="pageNumber" name="pageNumber" value="${query.pageNumber }"/>
	 <input type="hidden" id="type" name="queryType" value="${query.type.value }"/>
	 <input type="hidden" id="status" name="queryStatus" value="${query.status.value }"/>
    <tags:message content="${message}"/>
    <div class="control-group">
        <label class="control-label">考试名称</label>
        <div class="controls">
            <form:input path="name" htmlEscape="false" maxlength="63" class="required"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">类型</label>
        <div class="controls">
            <select class="input-small" name="type" disabled="disabled" id="examType">
                <option value="${exam.type.value}">${exam.type.name}</option>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">考试日期</label>
        <div class="controls">
            <input name="examTime" type="text" readonly="readonly" maxlength="20" class="Wdate required"
                   value="${exam.examTime }"
                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
        </div>
    </div>
    <div class="control-group">
			<label class="control-label">评卷开始日期</label>
			<div class="controls">
				<input name="startTime" type="text" readonly="readonly" maxlength="30" class="Wdate " id="startTime"
					value="<fmt:formatDate value="${exam.startTime}" pattern="yyyy-MM-dd HH:mm:ss" />"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
			</div>
	</div>
	<div class="control-group">
			<label class="control-label">评卷结束日期</label>
			<div class="controls">
				<input name="endTime" type="text" readonly="readonly" maxlength="30" class="Wdate " id="endTime"
					value="<fmt:formatDate value="${exam.endTime}" pattern="yyyy-MM-dd HH:mm:ss" />"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
			</div>
	</div>
    <c:if test="${exam.type!='MULTI_MEDIA'}">
    	<div class="control-group">
	        <label class="control-label">评卷模式</label>
	        <div class="controls">
	            <select name="markMode">
	                <option value="">不限</option>
	                <c:forEach items="${markModeList}" var="item">
	                    <option value="${item}"
	                            <c:if test="${exam.markMode!=null && exam.markMode==item}">selected</c:if>>${item.name}</option>
	                </c:forEach>
	            </select>
	        </div>
    	</div>
        <div class="control-group">
            <label class="control-label">强制标记</label>
            <div class="controls">
                <input name="forceSpecialTag" type="checkbox" <c:if test="${exam.forceSpecialTag}">checked</c:if>/>
            </div>
        </div>
    </c:if>
	<div class="control-group">
        <label class="control-label">禁止其他人查看考生信息</label>
        <div class="controls">
            <input name="forbiddenInfo" id="forbiddenInfo" type="checkbox" <c:if test="${exam.forbiddenInfo}">checked</c:if>/>
        </div>
    </div>
	<div id="forbiddenScoreDiv">
	<div class="control-group" >
        <label class="control-label">禁止评卷组长成绩查询</label>
        <div class="controls">
            <input name="forbiddenScore" id="forbiddenScore" type="checkbox" <c:if test="${exam.forbiddenScore}">checked</c:if>/>
        </div>
    </div>
    </div>
    <div style="display:none">
   	<div class="control-group">
        <label class="control-label">全卷多次复核不能同一账号</label>
        <div class="controls">
            <input name="inspectUnrepeated" id="inspectUnrepeated" type="checkbox" <c:if test="${exam.inspectUnrepeated}">checked</c:if>/>
        </div>
    </div>
  	<div class="control-group">
        <label class="control-label">全卷复核强制试卷拉到底部</label>
        <div class="controls">
            <input name="inspectScrollBottom" id="inspectScrollBottom" type="checkbox" <c:if test="${exam.inspectScrollBottom}">checked</c:if>/>
        </div>
    </div>
    </div>
   	<div class="control-group">
        <label class="control-label">评卷端是否显示客观分</label>
        <div class="controls">
            <input name="showObjectiveScore" id="showObjectiveScore" type="checkbox" <c:if test="${exam.showObjectiveScore}">checked</c:if>/>
        </div>
    </div>
    <div class="control-group">
    	<label class="control-label">打回后显示原分值</label>
		<div class="controls">
		<input name="showReject" type="checkbox" <c:if test="${exam.showReject}">checked</c:if>/>
		</div>
	</div>
    <div class="control-group">
        <label class="control-label">回评卷数</label>
        <div class="controls">
            <input name="remarkCount" type="number" value="${exam.remarkCount }"
                   oninput="if(value<0)value=0"  class="digits"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">及格分</label>
        <div class="controls">
            <input name="passScore" type="number" value="${passScore }" class="required"
                   oninput="if(value<0)value=0"/>%
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">优秀分</label>
        <div class="controls">
            <input name="excellentScore" type="number" value="${excellentScore }" class="required"
                   oninput="if(value<0)value=0"/>%
        </div>
    </div>
    <c:if test="${exam.id!=null }">
        <div class="control-group">
            <label class="control-label">状态</label>
            <div class="controls">
                <select class="input-small" name="status">
                    <c:forEach items="${statusList}" var="item">
                        <option value="${item.value}"
                                <c:if test="${item.value==exam.status.value}">selected</c:if>>${item.name}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <c:if test="${exam.type!='MULTI_MEDIA'}">
            <div class="control-group">
                <label class="control-label">原图遮盖</label>
                <div class="controls">
                    <input name="picList" id="picList" type="hidden"/>
                    <a href="${ctx}/admin/exam/getSheetConfig?examId=${exam.id}" target="_blank" class="required"
                       id="configuration" rel="opener">设置</a>
                </div>
            </div>
			<div class="control-group">
		        <label class="control-label">原卷显示</label>
		        <div class="controls">
		        <input name="sheetView" type="checkbox" <c:if test="${exam.sheetView}">checked</c:if>/>
		        </div>
			</div>
			<div class="control-group">
		        <label class="control-label">评卷提交自动定位</label>
		        <div class="controls">
		        <input name="autoScroll" type="checkbox" <c:if test="${exam.autoScroll}">checked</c:if>/>*开启后，当前试卷评完后，下份试卷自动定位到上份试卷的第一个轨迹点
		        </div>
			</div>
			<div class="control-group">
			        <label class="control-label">自动对切题卡</label>
			        <div class="controls">
			        <input name="enableSplit" type="checkbox" <c:if test="${exam.enableSplit}">checked</c:if>/>*选持自动对切题卡后，在阅卷端自动按照题卡的55%的比例进行对切，纸张大小A4时不生效
			        </div>
			</div>
        </c:if>
    </c:if>
    <div class="control-group">
        <label class="control-label">描述</label>
        <div class="controls">
            <form:textarea path="description" htmlEscape="false" rows="4" maxlength="127" class="input-xxlarge"/>
        </div>
    </div>
    <div class="form-actions">
        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
        &nbsp;
        <a href="javascript:" onclick="history.go(-1);"  class="btn">返回</a>
    </div>
</form:form>
</body>
</html>
