<%@page import="com.zky.para.Para"%>
<%@include file="/auth.jsp"%>
<%@page language="java" contentType="text/html;charset=utf-8"%>
<jsp:useBean id="getPara" scope="application" class="com.zky.para.SyncPara"/>
<%
    String Id       = Common.convertNull(request.getParameter("Id"));
    String createperson       = Common.convertNull(request.getParameter("createperson"));
    String tklxtype        = Common.convertNull(request.getParameter("tklxtype"));
    String q_subject       = Common.convertNull(request.getParameter("q_subject"));
    String operate = (String)request.getParameter("operate");
    Login login = (Login) request.getSession().getAttribute("login");
%>
<html>
<head>
<title>题库管理</title>
<link rel="stylesheet" type="text/css" href="../../css/font.css">
<script src="../../js/check.js"></script>
<link rel="stylesheet" type="text/css" href="../../js/2k3Grid.css">
<link rel="stylesheet" type="text/css" href="../../js/2k3Menu.css">
<link rel="stylesheet" type="text/css" href="../../js/2k3Dialog.css">
<style type="text/css">
select
{
   width:155px;
}
#myGrid .gridHead{
	height: 50px;
	line-height: 50px;
	background-color: #cce7f5;
	color: #000;
	font-size: 16px;
	font-weight: bold;
	box-sizing: border-box;
}
#myGrid .gridHead .gridRow{
	display: flex;
	justify-content: start;
}
#myGrid .gridHead span{
	text-align: center;
	display: inline-block;
	border-right: 1px solid #000000;
	box-sizing: border-box;
}
#myGrid .gridHead span:nth-child(1){
	width: 80px;
}
#myGrid .gridHead span:nth-child(2){
	width: 80px;
}
#myGrid .gridHead span:nth-child(3){
	width: 100px;
}
#myGrid .gridHead span:nth-child(4){
	width: 200px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridHead span:nth-child(5){
	width: 160px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridHead span:nth-child(6){
	width: 160px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridHead span:nth-child(7){
	width: 160px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridHead span:nth-child(8){
	width: 160px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridHead span:nth-child(9){
	width: 100px;
}
#myGrid .gridHead span:nth-child(10){
	width: 100px;
}
#myGrid .gridHead span:nth-child(11){
	width: 162px;
	border-right: none;
}
#myGrid .gridBody .gridRow{
	height: 30px;
	/*margin-top: 5px;*/
	display: flex;
	justify-content: start;
	align-items: center;
	border-bottom: 1px solid #000;
	color: #000;
}
#myGrid .gridBody .gridRow span{
	width: 148px;
	display: inline-block;
	border-right: 1px solid;
	text-align: center;
	height: 30px;
	line-height: 30px;
	box-sizing: border-box;
}
#myGrid .gridBody .gridRow span:nth-child(1){
	width: 80px;
}
#myGrid .gridBody .gridRow span:nth-child(2){
	width: 80px;
}
#myGrid .gridBody .gridRow span:nth-child(3){
	width: 100px;
}
#myGrid .gridBody .gridRow span:nth-child(4){
	width: 200px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridBody .gridRow span:nth-child(5){
	width: 160px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridBody .gridRow span:nth-child(6){
	width: 160px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridBody .gridRow span:nth-child(7){
	width: 160px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridBody .gridRow span:nth-child(8){
	width: 160px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#myGrid .gridBody .gridRow span:nth-child(9){
	width: 100px;
}
#myGrid .gridBody .gridRow span:nth-child(10){
	width: 100px;
}
#myGrid .gridBody .gridRow span:nth-child(11){
	width: 162px;
	border-right: none;
}
#myGrid .gridBody .gridRow span a,#myGrid .gridBody .gridRow span img,#myGrid .gridBody .gridRow span input {
	margin-right: 6px;
	margin-top: 6px;
}
form{
	height: 98%;
}
</style>
<script>
function setValue() {
<%
	if (!Common.isNull(operate)) {
		out.println("form1.operate.value='" + operate + "';");
	}
if (!Common.isNull(createperson)) {
	out.println("form1.createperson.value='" + createperson + "';");
}
if (!Common.isNull(tklxtype)) {
	out.println("form1.tklxtype.value='" + tklxtype + "';");
}
if (!Common.isNull(createperson)) {
	out.println("form1.q_subject.value='" + q_subject + "';");
}
if (!Common.isNull(operate)) {
	out.println("form1.operate.value='" + operate + "';");
}
%>	
}
function check(operate,id) {
	form1.operate.value=operate;
	if(operate=="importExcel")
	{
		form1.action = "/zhyw/smsj/ImportExcelQuestionData.jsp";
	}
	if (operate == "addQuestion") {
		form1.action = "/zhyw/smsj/QuestionEdit.jsp";
	}
	if (operate == "queryTryById") {
		form1.action = "/servlet/TryManage?operate=queryTryById&id=" + id;
	}	
	if (operate == "UpdateQuestion") {
		//form1.action = "/servlet/TryManage?operate=UpdateQuestion&id=" + id;
		form1.action = "/zhyw/smsj/QuestionUpdate.jsp";
	}		
	if (operate == "canceQuestion") {
		var questions = form1.questions;
		var count = 0;
		if (questions) {
			if (questions.length) {
				for (var i=0; i<questions.length; i++) {
					if (questions[i].checked==true) {
						count++;
					}
				}
			} else {
				if (questions.checked==true) {
					count++;
				}
			}
		} else {
			alert("没有查到试卷!");
			return false;
		}
		if (count==0) {
			alert("请选择要删除的试卷!");
			return false;
		}
		if (!confirm("确定要删除这条试题吗?")) {
			return false;
		}
	}
	if (operate == "queryTryBook") {
		form1.action = "/servlet/TryManage?operate=queryTryBook";
		return false;
	}
	form1.button1.disabled=true;
	form1.button2.disabled=true;
	form1.submit();
}
function selectChange(i)
{
	form1.action = "/zhyw/smsj/QuestionManage.jsp";
	form1.submit();
}
</script>
</head>
<body onLoad="setValue();" scroll="no">
<form name="form1" method="post" action="/servlet/TryManage">
<input type="hidden" name="operate" value=""/>
<table width="99%"  border="0" align="center" cellpadding="0" cellspacing="1" class="box">
  <tr>
    <td valign="top"><table width="100%" height="23"  border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="25%" background="/images/tab_search_01.jpg"><table width="100%" height="23" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="6%" align="right"><img src="/images/little_red.jpg" width="12" height="12"></td>
                <td width="94%" class="font12b">&nbsp;<b>涉密题库管理</b></td>
              </tr>
          </table></td>
          <td width="75%" background="/images/tab_search_03.jpg"><img src="/images/tab_search_02.jpg" width="12" height="23"></td>
        </tr>
      </table> 	
   <table width="100%"  border="0" align="center" cellpadding="2" cellspacing="1" class="table02">
	    <tr bgcolor="#FFFFFF">
		<td class="cell1">人员编号</td>
		<td class="cell2">
		<input type="text" name="empid" onChange="textToUpperCase()">
		</td>		
		<td class="cell1">人员姓名</td>
		<td class="cell2">
			<input type="text" name="createperson" id="createperson">
		</td>
		<td class="cell1">题目名称</td>
		<td class="cell2" >
			<input type="text" name="q_subject" id="q_subject">
		</td>
		<td class="cell1">试题类型</td>
		<td class="cell2" >
		   <select class='aselect' name="tklxtype" id="tklxtype"  >
		   		<%=Para.getTKLXType(getPara,"TKLX")%>            					
			</select>
		</td>
		<td class="cell1" align="left">
			<input type="image" name="button1" src="../../images1/cx.png" onClick="check('queryTryBook');" alt="查询"/>
		</td>
		<td class="cell2">
		</td>
	</tr>
</table>
</td>
</tr>
</table> 
<table width="99%" align="center" style="margin-bottom: -2px;">
	<tr align="left">
		<td>
		<input name="button2"  onclick="check('addQuestion');" type="image"  alt="添加" src="../../images1/tj.png"/> 
<%--	   <input name="button2"  onclick="check('canceQuestion');" type="image"  alt="删除" src="../../images1/cc.png"/>--%>
	    <input name="button2"  onclick="check('importExcel');" type="image"  alt="批量导入" src="../../images1/pl.png"/>
		</td>
	</tr>
</table>
<%
	HashFmlBuf buf = (HashFmlBuf) request.getAttribute("tryBook_info");
	if (buf != null) {
		int rowcount = buf.getRowCount();
%>
<table width="99%"  border="0" align="center" style="height:85%" cellpadding="0" cellspacing="1" class="box">
  <tr>
    <td>
	   <div style="width:100%; height:96%;overflow: auto;">
  				<div id="myGrid" class="2k3Grid" borderWidth="0" contextMenu="mnuGridContextMenu" altRowColor="oldLace">
    				<div class="gridHead">
    				 <!--div align="left"><span width="5%">共检索到<%=rowcount%>条记录</span></div-->
          				<div class="gridRow">
		<span width="5px" style="text-align: center;">序号</span>
		<span width="5px" style="text-align: center;">选择项</span>
		<span width="6px"><b>出卷人</b></span>
		<span width="30px">题目问题</span>
		 <span>答案A</span>
		 <span>答案B</span>
		 <span>答案C</span>
		 <span>答案D</span>
		 <span>正确答案</span>
		 <span>试题类型</span>
		 <span><b>管理</b></span>
		</div>
    </div>
		<div class="gridBody"> 
<%	
		for (int i=0; i<rowcount; i++) {
			String disabled = "";
			String tempTrainid = buf.fget("id",i);

%>	
		<div class="gridRow">
		<span width="5px" style="text-align: center;"><%=i+1%></span>
		<span><input type="checkbox" name="Infos" value="<%=tempTrainid%>"></span>
		<span><%=buf.fget("createperson",i) %></span>
		<span width="30px" title="<%=buf.fget("q_subject",i) %>"><%=buf.fget("q_subject",i) %></span>
		<span title="<%=buf.fget("optiona",i) %>"><%=buf.fget("optiona",i) %></span>
		<span title="<%=buf.fget("optionb",i) %>"><%=buf.fget("optionb",i) %></span>
		<span title="<%=buf.fget("optionc",i) %>"><%=buf.fget("optionc",i) %></span>
		<span title="<%=buf.fget("optiond",i) %>"><%=buf.fget("optiond",i) %></span>
	    <span style="text-align: center;"><%=buf.fget("note",i) %></span>
	    <span>
	    <%
	    if(buf.fget("typeid",i).equals("1") ){
	    %>
	    	专业题库
	      <% }else if(buf.fget("typeid",i).equals("2")) {%> 	
	                  基础题库
	   <%
	   }
	   %>
	 </span>
	    <span>
	       <a href="/servlet/TryManage?operate=queryTryById&id=<%=tempTrainid%>&tklxtype=<%=tklxtype%>"><img src="/images1/read_document.png" border="0" alt="查看"/></a>
		   <a href="/servlet/TryManage?operate=queryTryById&id=<%=tempTrainid%>&tklxtype=<%=tklxtype%>"><img src="/images1/edit.gif" border="0" alt="修改"/></a>
		   <a href="/servlet/TryManage?operate=canceQuestion&id=<%=tempTrainid%>&tklxtype=<%=tklxtype%>"><img src="/images1/delete.gif" border="0" alt="删除"/></a>
	    </span>
		</div>
<%
		}
%>	
	           </div>
			<!-- gridBody end -->
	       </div>
		   <!-- myGrid end -->
    	</div>
        <tag:PageLinkTag operate="queryTryBook"  scope="request" width="99%" align="center"/>
<%} %>
    </td>
   </tr>
 </table>	
</form>
<%@include file="/foot.jsp"%>
</body>
</html>