<!--#INCLUDE FILE="setup.asp" -->
<!--#INCLUDE FILE="checkuser.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<%
Dim rs
locat="浏览班级"
if membername="" Then
  	ErrMsg=ErrMsg+"<br>"+"<li>您还没有<a href=login.asp>登录</a>。"
	Call top(1,1)
	Call Error("Information",ErrMsg)
Else
	bClsID=Request("classid")
	if not isnumeric(bClsID) Then bClsID=0 Else bClsID=Clng(bClsID)

	Set rs=Conn.Execute("Select * from class where classid="&bClsID)
	if rs.eof and rs.bof Then
	  	ErrMsg=ErrMsg+"<br>"+"<li>您要访问的班级不存在!"
		Call top(1,1)
		Call Error("Exclamation",ErrMsg)
		Set rs=Nothing
	Else
		if sysadmin Then 
			response.redirect "MyClass.asp?ClassID="&bClsID
		Else
			Call top(1,1)
			Call showclassinfo()
		End if
	End if
	Set rs=Nothing
End if



Sub showclassinfo()

creator=rs("creator")
admin1=rs("admin1")
admin2=rs("admin2")

if admin1="" or isnull(admin1) Then 
admin1="空缺"
Else
admin1="<a href=profile.asp?name="&admin1&">"&admin1&"</a>"
End if

admin1=admin1&"(正)"
if admin2="" or isnull(admin2) Then 
admin2="空缺"
Else
admin2="<a href=profile.asp?name="&admin2&">"&admin2&"</a>"
End if
admin2=admin2&"(副)"

%>
<center><BR>
<TABLE cellSpacing=0 cellPadding=0 width=510 border=0>
<TR>
	<TD><IMG src="images/welcome.gif" align=absmiddle>&nbsp;<%=getrealname(membername)&"["&htmlencode(membername)&"]"%>，欢迎你！</TD>
</TR>
<TR>
	<TD  vAlign=middle><font color=#cc0000><%=htmlencode(rs("classname"))%></font>&nbsp;已被访问
	<font color=#cc0000><b><%=rs("visitcount")%></b></font>次，您的身份：<font color=#cc0000>客人</font>。 </TD>
</TR> 
</TABLE>
<BR>
<TABLE cellspacing=0 cellpadding=0 width=510 border=0>
<TR>
	<TD height=50><img src=images/pronouncement.gif></TD>
	<td rowspan=2 width=120><a href="RegClass.asp?action=Join&scID=<%=bClsID%>"><img src=images/add1.gif border=0></a><BR><BR>
	<a href="mailto:<%=StrVar(2)%>"><img src=images/contact.gif border=0></a></td>
</TR>
<TR>
	<TD><%if rs("pronouncement")<>"" Then 
		Response.Write htmlencode(rs("pronouncement"))
	Else 
		Response.Write "共同度过的生活是灿烂的，也是沉重的。<BR>这份灿烂与沉重也是一种生活 <BR>"&_
		"也是一种记忆<BR>至少它是<BR>至少我认为它是“人生大树”上最红的那一片小叶<BR>"&_
		"虽无百花之香，却有其神<BR>虽小，却有其重<BR>愿与诸君佳人共赏，共识之..."
	End if%></TD>
</TR>
</TABLE>
<BR>
<TABLE cellSpacing=0 cellPadding=0 width=510 border=0>
<TR><TD vAlign=top height=35 colspan=2><IMG src="images/class_info.gif"></TD></TR>
<TR><td height=1 background="images/bg_xu.gif"colspan=2></td></TR>
<tr><td height=18 colspan=2></td></tr>  
<TR> 
	<TD width="50%" height=22>班级名称：<%=htmlencode(rs("classname"))%></TD> 
	<TD width="50%" height=18>入学年份：<%=rs("enyear")%></TD>
</TR> 
<TR> 
	<TD width="50%" height=20>注册日期：<%=rs("regdate")%></TD> 
	<TD width="50%" height=18>班级成员：<FONT color=#cc0000><B><%=rs("studcount")%></B></FONT></TD>
</TR> 
<TR>
	<TD width="50%" height=20>班级主页：<a href="<%=htmlencode(rs("homepage"))%>" target="_blank"><%=htmlencode(homepage)%></TD> 
	<TD vAlign=bottom width="50%" height=20>班级创始人：
	<a target=_blank href="profile.asp?name=<%=htmlencode(creator)%>"><%=htmlencode(creator)%></a></TD> 
</TR> 
<TR> 
	<td colspan=2 height=18>现任管理员：<%Response.Write admin1&"&nbsp;"&admin2%></td>
</TR> 

<%Call waitpassmember()
Call onlinemember()%>	  

</TABLE>
<BR> 
	   
<%Call top5list()%></center>
<BR><BR>

<%
Set rs=Nothing

End Sub

Sub waitpassmember()

	Dim WaitRs
	Set WaitRs=Conn.Execute("Select userid from joinclass where isauditing=True and classid="&bClsID)
	if WaitRs.eof Then Exit Sub
	Response.Write "<tr><TD vAlign=bottom colspan=2 height=18>未通过审核同学："

	while not WaitRs.eof
		Response.Write "<a href=profile.asp?name="&htmlencode(WaitRs(0))&" target=_blank title=""查看"&htmlencode(WaitRs(0))&"的个人信息！"">"&htmlencode(WaitRs(0))&"</a>&nbsp;&nbsp;"
		WaitRs.movenext
	wend

	Response.Write "</td></TR>"

End Sub


Sub onlinemember()

	Dim OnlineSQL,OnlineRs
	OnlineSQL="Select o.userid from online o inner join joinclass j on o.userid=j.userid where j.isauditing=False and j.classid="&bClsID
	Set OnlineRs=Conn.Execute(OnlineSQL)
	if OnlineRs.eof Then Exit Sub

	Response.Write "<tr><TD vAlign=bottom colspan=2 height=18>当前在线同学："
	while not OnlineRs.eof
	Response.Write "<a href=profile.asp?action=showdetail&name="&htmlencode(OnlineRs(0))&_
		" target=_blank  title=""查看"&htmlencode(OnlineRs(0))&"的个人信息！"">"&htmlencode(OnlineRs(0))&"</a>&nbsp;&nbsp;"
	OnlineRs.movenext
	wend
	Response.Write "</td></TR>"

End Sub



Sub top5list()
Dim VstRs,VstSQL
%>
<TABLE cellSpacing=0 cellPadding=0 width=510 border=0>
<TR> 
	<TD vAlign=top height=42 colspan=4><IMG src="images/paihang.gif"></TD>
</TR>
<TR><td height=1 background="images/bg_xu.gif" colspan=4></td></TR>
<TR height=22> 
	<TD width=130>成员TOP5</TD> 
	<TD width=100>| 访问次数</TD> 
	<TD width=100>| 身份</TD> 
	<TD width=180>| 最后一次访问时间</TD>
</TR> 
<TR> 
	<TD bgColor=#b4c7d4 colSpan=4 height=1></TD>
</TR>
<%
VstSQL="Select top 5 userid,visitcount,lastvisit,degree from joinclass where isauditing=False "&_
"and classid="&bClsID&" order by visitcount desc,lastvisit desc"
Set vstrs=Conn.Execute(VstSQL)

do until vstrs.eof
	%>
	<TR vAlign=bottom> 
	<TD width=130 height=18><%=htmlencode(vstrs(0))%></TD> 
	<TD width=100>&nbsp;&nbsp;<%=vstrs(1)%></TD> 
	<TD width=100>&nbsp;&nbsp;
	<%if vstrs(3)=1 Then
		Response.Write "成员"
	ElseIf vstrs(3)=7 Then
		Response.Write "副班"
	ElseIf vstrs(3)=8 Then
		Response.Write "班长"
	End if%>
	</TD> 
	<TD width=180>&nbsp;&nbsp;<%=vstrs(2)%></TD></TR>
	<%
	vstrs.movenext
loop%>

</table>
<%End Sub

function GetRealname(byval username)
	Dim rSQL,rRs
	GetRealname=""
	if isnull(username) or username="" then exit function
	rSQL = "select realname from student where userid='"&username&"'"
	set rRs=conn.execute(rSQL)
	if not (rRs.eof and rRs.bof) then
		GetRealname=rRs(0)
	else
		GetRealname=""
	end if
	Set rRs=Nothing
end function

%>

<%Call footer%>

