<%@page contentType="text/html;charset=GBK"%>
<%@page import="java.sql.*"%>
<%@ include file="/public/checkvalidadmin.jsp"%>

<jsp:useBean id="conn" scope="page" class="test.ConnOracle"/>

<%!
ResultSet rs = null;
String classid   = "";
String classname = "";
String priv_ok = "";

int totaltime    = 0;
int totalques    = 0;
int totalpaper   = 0;
%>

<html>

<head>
	<title>课程信息管理</title>
	<link rel="stylesheet" href="../public/style.css">
</head>

<Body class="ss">
<center>
<%
priv_ok = (String)session.getAttribute("adminpriv");

if(priv_ok!=null && priv_ok.equals("8")) {

	rs = conn.executeQuery("select * from test_classinfo");
	if(!rs.next()) {
    	out.println("<center>");
		out.println("数据库中还没有课程信息！<br>");
		out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
    	out.println("</center>");
	} else {
	%>

	<table bgColor="#00acff" border="1" borderColorDark="#ffff00" borderColorLight="#000000" cellSpacing="1" width="80%">
		<tr>
			<th width="20%">课程代号</th>
			<th width="16%">课程名称</th>
			<th width="16%">考试时间</th>
			<th width="16%">考题数目</th>
			<th width="16%">试卷数目</th>
			<th width="16%" colspan=2>操作</th>
		</tr>
		<%do {
			classid   = rs.getString("classid");
			classname = rs.getString("classname");
			totaltime = rs.getInt("totaltime");
            totalques = rs.getInt("totalques");
            totalpaper= rs.getInt("totalpaper"); 
		%>
		<tr align="center">
     	<form action="classchange.jsp" method="post">
			<td><%=classid%></td>
			<input type="hidden"   name="classid"    value="<%=classid%>">
            <td><input type="text" name="classname"  value="<%=classname%>"></td>
            <td><input type="text" name="totaltime"  value="<%=totaltime%>"></td>
            <td><input type="text" name="totalques"  value="<%=totalques%>"></td>
            <td><%=totalpaper%></td>
            <input type="hidden" name="totalpaper" value="<%=totalpaper%>">
			<td><input type="submit" name="oper" value="修改"></td>
			<td><input type="submit" name="oper" value="删除"></td>
        </form>
		</tr>
		<% } while(rs.next());%>
		<tr>
			<td colspan=7><hr color="white"></td>		
		</tr>
		<form action="classadd.jsp">
		<tr align="center">
            <td><input type="text" name="classid"    value=""></td>
            <td><input type="text" name="classname"  value=""></td>
            <td><input type="text" name="totaltime"  value=""></td>
            <td><input type="text" name="totalques"  value=""></td>
            <td>&nbsp;</td>

			<td colspan="2">
				<Input type="submit" value="添加">
			</td>
		</tr>
		</form>
		</table>
<%
	}	
} else {
	out.println("对不起，您的权限不足！<br>");
	out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
}
%>
</form>
</center>
</Body>

</html>