<%@ 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' />
<link rel="stylesheet" href="${ctx}/resources/css/component.css" type="text/css" />
<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>

<%@ include file="../common/validation.jsp"%>
<style type="text/css">
	.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">
	var swfuImport;
	function load() {
		swfuImport = new SWFUpload({
			 upload_url :"${ctx}/importQuestion",
			 post_params: {"importBy" : $("#importBy").val()},
			 use_query_string : false,
			 
			// File Upload Settings
			file_size_limit : "100 MB",	// 100MB
			file_types : "*.qmq",
			file_types_description : "所有文件",
			file_upload_limit : "0",

			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,//选择好文件后提交
			file_queued_handler : ImportFileQueued,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadImportFileSuccess,
			upload_complete_handler : uploadComplete,
			
			// Button Settings
			button_image_url : '${ctx}/resources/images/SmallSpyGlassWithTransperancy_17x18.png',
			button_placeholder_id : "spanButtonPlaceholder",
			button_width: 180,
			button_height: 18,
			button_text : '<span class="button">导入试题 <span class="buttonSmall">(单个文件最大100 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 : "importDivFileProgressContainer"
			},
			// 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" class="page">
	   <div class="page-header">导入试题</div>
	   <input type="hidden" value="${user.id}" id="importBy"/>
		<div class="page-body">
			<div align="center">
				<div style="display: inline;   padding: 2px;">
					<span id="spanButtonPlaceholder"></span> <button class="btn" onclick="viewImportHistory()">查看历史导入记录</button>
				</div>
				<div id="importDivFileProgressContainer"></div>
				<table class="listTable" style="width:70%" id="importTable">
	                   <thead>
	                       <tr class="title">
	                           <th width="15%">文件名</th>
	                           <th width="30%">文件唯一标识</th>
	                           <th width="20%">文件大小</th>
	                           <th width="20%">导入状态</th>
	                           <th width="15%">操作</th>
	                       </tr>
	                   </thead>
	             </table>
			</div>
		</div>	
	</div>
</div>
</body>
</html>