<!--#include file="inc/right.asp"--> 
<!--#include file="inc/conn.asp"-->
<%
action=Request("action")
id=Request("id")
%>
<html>
<head>
<title><%=sysConfig%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/main.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td bgcolor="#FFFFFF">
    <%if action="list" then%>
	<br>
   <table width="96%"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
	<tr align="center" bgcolor="#F2FDFF">
	  <td colspan="7"  class="optiontitle">课程选修列表</td>
	</tr>
	<tr align="center" bgcolor="#ebf0f7">
	  <td width="5%">序号</td>
	  <td>课程名称</td>
	  <td>课程学分</td>
	  <td>授课老师</td>
	  <td>课程人数</td>
	  <td>已选人数</td>
	  <td width="20%">执行操作</td>
	</tr>
		
<%
sql="select * from Info order by id asc"
 set rs=server.createobject("adodb.recordset") 
 rs.open sql,conn,1,1
 if not rs.eof then
 proCount=rs.recordcount
	rs.PageSize=20
     if not IsEmpty(Request("ToPage")) then
	    ToPage=CInt(Request("ToPage"))
		if ToPage>rs.PageCount then
		   rs.AbsolutePage=rs.PageCount
		   intCurPage=rs.PageCount
		elseif ToPage<=0 then
		   rs.AbsolutePage=1
		   intCurPage=1
		else
		   rs.AbsolutePage=ToPage
		   intCurPage=ToPage
		end if
	 else
		rs.AbsolutePage=1
		intCurPage=1
	 end if
	 intCurPage=CInt(intCurPage)
	 For i = 1 to rs.PageSize
	 if rs.eof then     
	 Exit For 
	 end if 
%>
	<tr align='center' bgcolor='#FFFFFF' onmouseover='this.style.background="#F2FDFF"' onmouseout='this.style.background="#FFFFFF"'>
	  <td width="5%"><%=rs("id")%></td>
	  <td><%=rs("title")%></td>
	  <td><%=rs("xx3")%></td>
	  <td><%=rs("xx6")%></td>
	  <td><%=rs("xx2")%></td>
	  <td><%=rs("xkrs")%></td>
	  <td align='center'><img src="images/view.gif" align="absmiddle"><a href="?action=view&id=<%=rs("id")%>">详细名单</a></td>
	</tr>
<%
rs.movenext 
next
%>
        <tr align="center" bgcolor="#ebf0f7">
          <td colspan="7"> 总共：<font color="#ff0000"><%=rs.PageCount%></font>页，<font color="#ff0000"><%=proCount%></font>条记录，当前页：<font color="#ff0000"><%=intCurPage%> </font><%if intCurPage<>1 then%><a href="?action=list">首页</a> | <a href="?action=list&ToPage=<%=intCurPage-1%>">上一页</a> | <% end if
if intCurPage<>rs.PageCount then %><a href="?action=list&ToPage=<%=intCurPage+1%>">下一页</a> | <a href="?action=list&ToPage=<%=rs.PageCount%>"> 最后页</a><% end if%></span></td>
        </tr>
<%
else
%>
        <tr align="center" bgcolor="#ffffff">
          <td colspan="7">对不起！目前数据库中还没有添加课程内容！</td>
        </tr>
<%
rs.close
set rs=nothing
end if
%>
      </table>
<%end if%>
	  <br>
<%if action="view" then
set rs=server.createobject("adodb.recordset") 
Tid=Request("id")
sql="select * from Info where id="&Tid
rs.open sql,conn,1,1
if not rs.eof Then
%>
	  <table width="96%"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
		<tr align="center" bgcolor="#F2FDFF">
		  <td colspan=2  class="optiontitle">查看学生名单</td>
		</tr>
		<tr bgcolor='#F2FDFF'>
		  <td align='right'> 课程名称：</td>
		  <td align='left'><%=rs("title")%></td>
		</tr>
		<tr align='center' bgcolor='#FFFFFF'>
		  <td align='right'>课程学分：</td>
		  <td align='left'><%=rs("xx3")%></td>
		</tr>
		<tr align='center' bgcolor='#FFFFFF'>
		  <td align='right'>授课老师：</td>
		  <td align='left'><%=rs("xx6")%></td>
		</tr>
		<tr align='center' bgcolor='#FFFFFF'>
		  <td align='right'>课程人数：</td>
		  <td align='left'><%=rs("xx2")%></td>
		</tr>
		<tr align='center' bgcolor='#FFFFFF'>
		  <td align='right'>已选人数：</td>
		  <td align='left'><%=rs("xkrs")%></td>
		</tr>
        <tr align="center" bgcolor="#FFFFFF">
          <td width="10%" align="right">已选学生：</td>
		  <td align="left">
<%
sql2="select * from result where cid="&Tid&" order by id asc"
set rs2=server.createobject("adodb.recordset") 
rs2.open sql2,conn,1,1
if not rs2.eof then
For i=1 to rs2.recordcount
%>
          <%=rs2("sname")%>(<%=rs2("sno")%>)、
<%
rs2.movenext 
next
rs2.close
set rs2=nothing
else
 response.Write("暂无学生信息")
end if
%>        </td>
        </tr>	
		<tr align="center" bgcolor="#ebf0f7">
		  <td colspan="2">
          <input type="button" name="Submit2" value="返回" onClick="history.back(-1)">
		  </td>
		</tr>
  	</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
end if
%>    
    </td>
  </tr>
</table>
</body>
</html>