<%@ 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" 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' />

<script type="text/javascript" src="${ctx}/resources/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/swfupload/import.jsp"></script>
<script type="text/javascript" src="${ctx}/resources/ckeditor4.4.7/ckeditor.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/jquery.alerts.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/question/add.jsp"></script>
<script type="text/javascript" src="${ctx}/resources/js/validator.js"></script>
<script language="javascript" type="text/javascript" src="${ctx}/resources/js/My97DatePicker/WdatePicker.js" ></script>
<%@ include file="../common/validation.jsp"%>
<style type="text/css">
.my-dialog .ui-dialog-titlebar-close{display: none;
 }
.select-knowledge{width:auto;}


.row div,label {
	float: left;
}
	.progressWrapper {
	width: 357px;
	overflow: hidden;
}

.progressContainer {
	margin: 5px;
	padding: 4px;
	border: solid 1px #E8E8E8;
	background-color: #F7F7F7;
	overflow: hidden;
}

.progressBarInProgress,
.progressBarComplete,
.progressBarError {
	font-size: 0;
	width: 0%;
	height: 2px;
	background-color: blue;
	margin-top: 2px;
}

.progressBarComplete {
	width: 100%;
	background-color: green;
	visibility: hidden;
}

.progressBarError {
	width: 100%;
	background-color: red;
	visibility: hidden;
}

.progressBarStatus {
	margin-top: 2px;
	width: 337px;
	font-size: 7pt;
	font-family: Arial;
	text-align: left;
	white-space: nowrap;
}
</style>
<script type="text/javascript">

function ForMatDate(date){
	return date.getFullYear() +"-"+(date.getMonth()+1)+"-"+date.getDate();
}
			var swfu;
			function load() {
				$("#setTime").val(ForMatDate(new Date()));
				$("#course").get(0).selectedIndex=0;
				swfu = new SWFUpload({
					 upload_url :"${ctx}/uploadFile",
					 use_query_string : false,
					 
					// File Upload Settings
					file_size_limit : "10 MB",	// 1000MB
					file_types : "*.*",
					file_types_description : "所有文件",
					file_upload_limit : "0",
									
					file_queue_error_handler : fileQueueError,
					file_dialog_complete_handler : fileDialogComplete,//选择好文件后提交
					file_queued_handler : AccessoryFileQueued,
					upload_progress_handler : uploadProgress,
					upload_error_handler : uploadError,
					upload_success_handler : uploadSuccess,
					upload_complete_handler : uploadComplete,
	
					// Button Settings
					button_image_url : '${ctx}/resources/images/SmallSpyGlassWithTransperancy_17x18.png',
					button_placeholder_id : "attachmentButtonPlaceholder",
					button_width: 180,
					button_height: 18,
					button_text : '<span class="button">添加附件 <span class="buttonSmall">(单个文件最大10 MB)</span></span>',
					button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12px; } .buttonSmall { font-size: 10px; color: #ff0000;}',
					button_text_top_padding: 0,
					button_text_left_padding: 18,
					button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
					button_cursor: SWFUpload.CURSOR.HAND,
					
					// Flash Settings
					flash_url : '${ctx}/resources/js/swfupload/swfupload.swf',
	
					custom_settings : {
						upload_target : "divFileProgressContainer"
					},
					// Debug Settings
					debug: false  //是否显示调试窗口
				});
			};

		</script>
</head>

<body onload="load()">
	<%@ include file="../common/header.jsp"%>
	<div id="content">
		<%@ include file="../common/sub_menu.jsp"%>
		<div id="page">
		<div class="page-header">新增试题</div>
		<div class="page-body">
			<form id="questionUpdateFrm" action="${ctx}/question/insert" method="post"  >
			<div class="questions" style="margin:0;padding-top:10px;">
			    <table style="width:30%;float:left;" class="label-table">
					<tr>
						<td class="label-table-label">课程<span style="color:red">*</span></td>
						<td class="qBox label-table-content">
							<select  id="course" name="courseId" style="height: auto;" onchange="courseChange('${ctx}','${role.id }')" class="validate[groupRequired[courseId]] text-input">
								<option value="">请选择</option>
								<c:forEach items="${courses}" var="course">
									<option value="${course.id}">${course.code}-${course.name}</option>						
								</c:forEach>
							</select>
							<input id="subjectId" name="subjectId" type="hidden"/>
						</td>
					</tr>
					<tr>
						<td class="label-table-label">教材<span style="color:red">*</span></td>
						<td class="qBox label-table-content">
							<select id="bookId" name="bookId" class="validate[groupRequired[bookId]] text-input" style="height: auto;">
								<option value="">请选择</option>
							</select>
						</td>
					</tr>
					<tr>
						<td class="label-table-label">题型<span style="color:red">*</span></td>
						<td class="qBox label-table-content">
							<select id="typeId" name="typeId" class="validate[groupRequired[typeId]] text-input" style="height: auto;" onchange="questionChange('${ctx }')">
								<option value="">请选择</option>
							</select>
						</td>
					</tr>
					<tr>
						<td class="label-table-label">考核要求</td>
						<td class="qBox label-table-content">
						    <input  type="radio" name="assessmentDemand" value="A" checked id="A"/><label for="A" style="float: none">重点内容 </label>&nbsp; &nbsp; 
                            <input  type="radio" name="assessmentDemand" value="B" id="B"/><label for="B" style="float: none">次重要内容</label>&nbsp; &nbsp;
                            <input  type="radio" name="assessmentDemand" value="C" id="C"/><label for="C" style="float: none">一般内容</label>
						</td>
					</tr>
					<tr>
						<td class="label-table-label">预计难度</td>
						<td class="qBox label-table-content">
						    <input  type="radio" name="estimateDifficultyCode" id="estimateDifficultyCode" value="10" checked/>易&nbsp; &nbsp; &nbsp; &nbsp;
                            <input  type="radio" name="estimateDifficultyCode" id="estimateDifficultyCode" value="20" />中等偏易  &nbsp; &nbsp; &nbsp; &nbsp;
                            <input  type="radio" name="estimateDifficultyCode" id="estimateDifficultyCode" value="30" />中等偏难&nbsp; &nbsp; &nbsp; &nbsp;
                            <input  type="radio" name="estimateDifficultyCode" id="estimateDifficultyCode" value="40" />难
						</td>
					</tr>
					<tr>
						<td class="label-table-label">认知层次</td>
						<td class="qBox label-table-content">
						    <div>
                                <input  type="radio" name="abilityCode" value="A" checked/>识记&nbsp; &nbsp; &nbsp; 
                                <input  type="radio" name="abilityCode"  value="B" />理解  &nbsp; &nbsp; &nbsp;
                            </div>
                            <div style="margin-top:5px;">
                                <input  type="radio" name="abilityCode" value="C" />简单应用&nbsp; &nbsp; &nbsp;
                                <input  type="radio" name="abilityCode"  value="D" />综合应用
                            </div>
						</td>
					</tr>
					<tr>
						<td class="label-table-label">命题人<span style="color:red">*</span></td>
						<td class="qBox label-table-content">
							<input type="text" id="createdBy" name="createdBy" style="display: none" value="${user.id}"/>
							<select name="setBy" id="setBy" class="text-input" style="height: auto;">
								<c:if test="${role.code=='PROPOSITION_TEACHER' }">
									<option value="${user.id}">${user.name}</option>
								</c:if>
								<c:if test="${role.code=='QUESTION_INPUTER' }">
									<option value="${user.id}">${user.name}</option>
								</c:if>
							</select>
							<!--  <input type="text" style="display: none" name="createdBy" value="${web_session_user.name }"/>-->
						</td>
					</tr>
					<tr>
						<td class="label-table-label">命题日期<span style="color:red">*</span></td>
						<td class="qBox label-table-content">
							<input type="text" id="setTime" name="setTime" class="validate[required] text-input" onclick='WdatePicker()'   readonly="readonly" value=""/>
						</td>
					</tr>
					 <tr>
                        <td class="label-table-label">备注</td>
                        <td class="qBox label-table-content">
                         <textarea style="height: 38px; width: 200px;" name="remark" id="remark" class="validate[maxSize[250]]"></textarea>
                        </td>
                     </tr>
			    </table>

				<table style="width:60%;float:left;margin-left:10px;" class="label-table">
					<tbody>
					   <tr>
	                        <td class="label-table-label">满分值<span style="color:red">*</span></td>
	                        <td class="qBox label-table-content">
	                            <input type="text" name="score" id="score" class="validate[required,custom[integer],max[150],min[0]] text-input" style="width:30px;" maxlength="3"/>
	                        </td>
	                        <td class="label-table-label">知识点</td>
	                        <td class="qBox label-table-content">
	                                <input type="text" id="chapter" name="chapter" class="validate[required,custom[integer],maxSize[2]] text-input" style="width:30px;" maxlength="2"/>&nbsp;章<span style="color:red">*</span>
                                <input type="text" id="section" name="section" class="text-input validate[custom[integer],maxSize[3]]" style="width:30px;" maxlength="3"/>&nbsp;节
                                <input type="text" id="item" name="item" class="text-input validate[custom[integer],maxSize[4]]" style="width:30px;" maxlength="4"/>&nbsp;目
                                <input type="text" id="ye" name="page" class="text-input validate[custom[integer],maxSize[5]]"  style="width:30px;" maxlength="5"/>&nbsp;页
                            </td>
                        </tr>
						<tr>
							<td class="label-table-label">题干<span style="color:red">*</span></td>
							<td colspan="3" class="qBox label-table-content">								
								<div id="body-content" class="box-content " field="body" name="题干" title="点击输入内容" contenteditable="true" style="height:100px;">
								</div>
							</td>
						</tr>
						<tr id="answer-tr">
							<td class="label-table-label" id="answer_td">选项及答案</td>
							<td colspan="3" class="qBox label-table-content">
								<div id="answer-content" class="box-content " field="answer" name="选项及答案" title="点击输入内容" contenteditable="true" style="height:120px;"></div>
								<div class="container" id="container">
									<div id="Choose" style="display: none">
										<div>
											 <div class="RadioContent">
												<table style="width:100%">
													<tr>
														<td style="width:30px;"><input	type="radio" name="optionsRadios" value="A" class="validate[required] radio"/>A.</td>
														<td><div class="col-lg-5 col-sm-5" id="A_radio_input" contenteditable="true" style="height:25px;"></div></td>
													</tr>
													<tr>
														<td style="width:30px;"><input	type="radio" name="optionsRadios" value="B" class="validate[required] radio"/>B.</td>
														<td><div class="col-lg-5 col-sm-5" id="B_radio_input" contenteditable="true" style="height:25px;"></div></td>
													</tr>
													<tr>
														<td style="width:30px;"><input	type="radio" name="optionsRadios" value="C" class="validate[required] radio"/>C.</td>
														<td><div class="col-lg-5 col-sm-5" id="C_radio_input" contenteditable="true" style="height:25px;"></div></td>
													</tr>
													<tr>
														<td style="width:30px;"><input	type="radio" name="optionsRadios" value="D" class="validate[required] radio"/>D.</td>
														<td><div class="col-lg-5 col-sm-5" id="D_radio_input" contenteditable="true" style="height:25px;"></div></td>
													</tr>														
												</table>
											</div>
										</div>
										<div class="CheckboxContent">
											<table style="width:100%">
												<tr>
													<td style="width:30px;"><input type="checkbox" name="optionsCKs"value="A" class="validate[required] checkbox "/>A.</td>
													<td><div class="col-lg-5 col-sm-5" id="A_checkbox_input" contenteditable="true" style="height:25px;"></div></td>
												</tr>
												<tr>
													<td style="width:30px;"><input type="checkbox" name="optionsCKs"value="B" class="validate[required] checkbox "/>B.</td>
													<td><div class="col-lg-5 col-sm-5" id="B_checkbox_input" contenteditable="true" style="height:25px;"></div></td>
												</tr>
												<tr>
													<td style="width:30px;"><input type="checkbox" name="optionsCKs"value="C" class="validate[required] checkbox "/>C.</td>
													<td><div class="col-lg-5 col-sm-5" id="C_checkbox_input" contenteditable="true" style="height:25px;"></div></td>
												</tr>
												<tr>
													<td style="width:30px;"><input type="checkbox" name="optionsCKs"value="D" class="validate[required] checkbox "/>D.</td>
													<td><div class="col-lg-5 col-sm-5" id="D_checkbox_input" contenteditable="true" style="height:25px;"></div></td>
												</tr>
												<tr>
													<td style="width:30px;"><input type="checkbox" name="optionsCKs"value="E" class="validate[required] checkbox "/>E.</td>
													<td><div class="col-lg-5 col-sm-5" id="E_checkbox_input" contenteditable="true" style="height:25px;"></div></td>
												</tr>
											</table>											
										</div>
									</div>
								</div>
							</td>
						</tr>
						<tr>
							<td class="label-table-label" >题卡</td>
							<td colspan="3" class="qBox label-table-content">
								<div id="answerSheet" class="box-content " field="answerSheet" name="题卡" title="点击输入内容" contenteditable="true" style="height:50px;"></div>
							</td>
						</tr>
						<tr id="answer-tr">
						  <td class="label-table-label" >附件</td>
						  <td colspan="3" class="qBox label-table-content">
						  	 	<div id="content">
									<div style="display: inline;   padding: 2px;">
										<span id="attachmentButtonPlaceholder"></span>
										<!--  <input id="btnCancel" type="button" value="取消所有上传"
											onclick="cancelUpload('infoTable');" disabled="disabled" class="btn3_mouseout" />-->
									</div>
									<div id="divFileProgressContainer" ></div>
									<table id="infoTable" border="0" width="530" style="display: inline;  padding: 2px;margin-top:8px;">
										<tr bgcolor="CCCCCC" align="center">
											<td width="150PX;">文件名</td>
											<td width="150PX;">文件大小(字节)</td>
											<td width="150PX;">文件状态</td>
											<td width="150PX;">操作</td>
										</tr>
									</table>
									</div>
								</div>
						  </td>
						</tr>
					</tbody>
				</table>
			</div>
			</form>
			</div>
			<div class="page-footer">
				<input type="button" class="btn" onclick="goSave('${ctx }','save')" value="保存" />
				<input type="button" class="btn" onclick="goSave('${ctx }','saveAdd')" value="保存并新增" />
			</div>
		</div>
	</div>
	
	<div id="editor-dialog" class="dialog hd">
		<div class="dialog-header" id="dialog-header">内容编辑</div>
		<div class="dialog-body">
		<textarea id="textarea"></textarea></div>
		<div class="dialog-footer">
			<input type="button" class="btn" id="save-button" value="保存" />
			<input type="button" class="btn close" value="关闭" />
		</div>
	</div>
<script type="text/javascript">
	$(function() {
		//表单验证
	    $("#questionUpdateFrm").validationEngine();
	});
</script>
</body>
</html>