<!--#INCLUDE FILE="setup.asp" -->
<!--#include file="checkuser.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<!--#include file="include/char.asp" -->
<%
locat="校友留言"
act="主题列表"
Call top(2,1)

Dim tl
Dim currentPage,TotalPages
Dim rs,sql
Dim MaxTopicList

MaxTopicList=20

if Request("TimeLimit")="all" Then
	tl=""
ElseIf Request("TimeLimit")="" Then
	tl=""
Else
	limitime=Request("TimeLimit")
	tl=" where PostTime>=#"&cstr(cdate(now()-limitime))&"#"
End if


Set rs=server.createobject("adodb.recordset")
sql="Select PostID,UserID,Title,PostTime,hits,Replys,mood,Locked,isTop,LastReply,LastTime from Topic"&tl&" ORDER BY istop,LastTime Desc"

rs.open sql,conn,1,1
%>
<br><br>
<Script language="javascript" src="script/PopText.asp"></Script>
<table width=100% align=center border=0>
<tr><td align=left height=26 valign=bottom><a href=NewTopic.asp><IMG SRC="IMAGES/newthread.gif" BORDER=0 ALT=""></a></td>
<td align=right valign=bottom>
	<Select name=TimeLimit onchange="document.location.href='ForumDisplay.asp?TimeLimit='+TimeLimit.value;">
	<option value=all <%if limitime="" Then Response.Write "selected"%>>查看所有的主题
	<option value=1 <%if limitime=1 Then Response.Write "selected"%>>查看一天内的主题
	<option value=2 <%if limitime=2 Then Response.Write "selected"%>>查看两天内的主题
	<option value=7 <%if limitime=7 Then Response.Write "selected"%>>查看一星期内的主题
	<option value=15 <%if limitime=15 Then Response.Write "selected"%>>查看半个月内的主题
	<option value=30 <%if limitime=30 Then Response.Write "selected"%>>查看一个月内的主题
	<option value=60 <%if limitime=60 Then Response.Write "selected"%>>查看两个月内的主题
	<option value=180 <%if limitime=180 Then Response.Write "selected"%>>查看半年内的主题
	</Select>
</td></tr></table>
<table width=100% border=0 cellspacing=1 cellpadding=4 Class=TableBorder align=center>
<tr height=23><th width=32 align=center>状态</th><th  align=center width=*> 主 题(点心情符为开新窗浏览)</th>
<th width=80  align=center>作&nbsp;者</th><th width=32 align=center>回复</th><th width=32>浏览</th>
<th align=center>最后发表</th></tr>
<%
if rs.bof and rs.eof Then
%>
<tr Class=DarkTableBody><td colSpan=6 width=100% height=27>本论坛暂无内容，欢迎发贴：）
</td></tr>
</table>
<%

Else

	rs.pagesize=MaxTopicList
	TotalPages=rs.pagecount
	totalrecords=rs.recordcount
	currentPage=Request("Page")
	if currentpage="" or not isinteger(currentpage) Then
		currentpage=1
	elseif cint(currentpage)>TotalPages then
		currentpage=TotalPages
	End if
	currentpage=Clng(currentpage)
	rs.absolutepage=currentpage
	Call showTopiclist() 
	Call pagelinks()
End if

%>
<BR><BR>
<table cellspacing=1 cellpadding=5 width=100% border=0 align=center Class=TableBorder>
<tr><th align=left><IMG SRC=IMAGES/2.gif WIDTH=60 HEIGHT=9 BORDER=0>:::论坛图例:::</th></tr>
<tr Class=LightTableBody>
	<td><table width=100% align=center><tr>
			<td align=center><img src=images/folder_general.gif> 开放的主题</td>
			<td align=center><img src=images/folder_hot.gif> 回复超过10贴</td>
			<td align=center><img src=images/folder_locked.gif> 锁定的主题</td>
			<td align=center><img src=images/folder_top.gif> 固定顶端的主题 </td>
		</tr></table>
	</td></tr>
</table>
<BR>
<%


Sub showTopicList()

dim i
dim popinfo
dim LastReply,LastPoster,LastReplyID

for i=1 to MaxTopicList

Response.Write "<TR align=middle>"&_
				"<TD Class=DarkTableBody width=32 height=27>"


If rs("istop")=True Then
	Response.Write "<img src=images/folder_top.gif alt=固顶主题>"
ElseIf rs("locked")=True Then
	Response.Write "<img src=images/folder_locked.gif alt=本主题已锁定>"
ElseIf rs("replys")>=10 Then
	Response.Write "<img src=images/folder_hot.gif alt=热门主题>"
Else
	Response.Write "<img src=images/folder_general.gif alt=开放主题>"
End if

Response.Write "</TD>"&_
				"<TD align=""left"" bgcolor="&LightTBColor&" onmouseover=""javascript:this.bgColor='"&DarkTBColor&"';"" onmouseout=""javascript:this.bgColor='"&LightTBColor&"';"" width=*><a href=""ViewThread.asp?TopicID="&rs("PostID")&""" target=_blank title=""打开新窗口浏览""><img height=14 hspace=4 src=""mood/face"&rs("mood")&".gif"" align=absmiddle border=0></a>"
popinfo="《"&htmlencode(rs("title"))&"》<br>&nbsp;作者："&htmlencode(rs("UserID"))&"<br>&nbsp;发表于"&rs("PostTime")&"<br>&nbsp;最后跟贴："
if rs("lastreply")<>"" then 
	LastReply=split(rs("lastreply"),vbCr)
	popinfo=popinfo&htmlencode(LastReply(1))
	LastPoster=LastReply(0)
	LastReplyID=LastReply(2)
else
	LastPoster=""
	popinfo=popinfo&"......"
end if

Response.Write "<a href=""ViewThread.asp?TopicID="&rs("PostID")&""" title="""&popinfo&""">"&htmlencode(cutstr(rs("title"),36))&"</a>"
MaxPostList=Cint(IntVar(8))
Pnum=1
if rs("replys")+1>MaxPostList Then
	Response.Write "&nbsp;&nbsp;<font face=Tahoma,Verdana>(</font><img src=images/pagelist.gif hspace=3 align=absmiddle>"
  	if (rs("replys")+1) mod MaxPostList=0 Then
     		Pnum= (rs("replys")+1)\MaxPostList
  	Else
     		Pnum= (rs("replys")+1)\MaxPostList+1
  	End if
	for p=1 to Pnum
	if p<>1 then response.write "&nbsp;"
	Response.Write "<a href=""ViewThread.asp?TopicID="&rs("PostID")&"&Page="&P&"""><font color=brown>"&p&"</font></a>"
	if p>3 and p<>Pnum and p<>Pnum-1 then 
		response.write "...<a href=""ViewThread.asp?TopicID="&rs("PostID")&"&Page="&Pnum&"""><font color=brown>"&pnum&"</font></a>"
		exit for
	end if
	next
	Response.Write "<font face=Tahoma,Verdana>)</font>"

End if
if membername<>"" and membername<>rs("userid") then
	if cdate(Request.cookies("fytxl")("logintime"))<rs("posttime") then
		response.write "<img src=""images/topnew.gif"" align=absmiddle alt=新鲜出炉，请多关注！>"
	end if
end if


Response.Write "</TD>"&_
	"<TD Class=DarkTableBody width=80><a href=""Profile.asp?Name="&htmlencode(rs("userid"))&""" target=_blank>"&htmlencode(rs("userid"))&"</a></TD>"&_
	"<TD Class=LightTableBody width=32>"&rs("replys")&"</td>"&_
	"<td Class=LightTableBody width=32>"&rs("hits")&"</TD>"&_
	"<TD align=right Class=DarkTableBody width=175><table cellspacing=0 cellpadding=0 align=right><tr><td align=right>&nbsp;"

st=FormatDateTime(rs("LastTime"),vbShortDate)&"&nbsp;"&FormatDateTime(rs("LastTime"),vbShortTime)

if LastPoster="" Then
	Response.Write "&nbsp;<a href=""ViewThread.asp?TopicID="&rs("PostID")&""">"&st&"</a>&nbsp;<br><font color=gray>No Reply</font>&nbsp;</td><td width=20 align=center><a href=""ViewThread.asp?TopicID="&rs("PostID")&"""><img src=images/lastpost.gif border=0></a></td>"
Else
	Response.Write "&nbsp;<a href=""ViewThread.asp?TopicID="&rs("PostID")&"&Page="&Pnum&"#PID"&_
	LastReplyID&""" title=直接跳转到最后回复帖子>"&st&"</a>&nbsp;<br>By&nbsp;<a href=""Profile.asp?Name="&_
	LastPoster&""" target=_blank>"&htmlencode(LastPoster)&"</a>&nbsp;</td><td width=20 align=center><a href=""ViewThread.asp?TopicID="&rs("PostID")&"&Page="&Pnum&"#PID"&LastReplyID&""" title=直接跳转到最后回复帖子><img src=images/lastpost.gif border=0></a></td>"
End if
Response.Write "</tr></table></td></tr>"

rs.movenext
if currentpage=totalpages then
	if rs.eof then exit for
end if
next
Response.Write "</table>"

End Sub



Sub Pagelinks()
'start page(s) link
Dim p,ii

p=(currentpage-1) \ 8

Response.Write "<table border=0 cellpadding=0 cellspacing=3 width=100% align=center >"&_
	"<tr><td valign=middle nowrap>页次：<B>"& currentPage &"</B>/<strong>"& totalpages &"</strong> 主题数：<b>"&totalrecords&"</b></td>"&_
	"<td valign=middle align=right nowrap><p>分页："
if currentpage=1 then
response.write "<font face=webdings color=gray>9</font> "
else
response.write "<a href=""?Page=1"" title=首页><font face=webdings>9</font></a> "
end if

if p*8>0 Then 
	Response.Write "<a href=""?Page="&Cstr(p*8)&""" title=上八页><font face=webdings>7</font></a> "
end if
for ii=p*8+1 to P*8+8
	   if ii=currentPage Then
		  Response.Write "<font color=gray><B>"&ii&"</B></font> "
	   Else
		  Response.Write "<a href=""?Page="&ii&"""><B>"&ii&"</B></a> "
	   End if
	if ii=totalpages Then Exit for
next
if ii<totalpages Then 
	Response.Write "<a href=""?Page="&ii&""" title=下八页><font face=webdings>8</font></a> "
end if
if currentpage=totalpages then
	Response.Write "<font face=webdings color=gray>"&chr(58)&"</font>  "   
else
	Response.Write "<a href=""?Page="&totalpages&""" title=尾页><font face=webdings>"&chr(58)&"</font></a>  "   
end if

Response.Write "</td></tr></table>"

'end page(s) link

End Sub 


Call footer%>