<!--#INCLUDE FILE="conn.asp" -->
<!--#include file="Class_Checkuser.asp" -->
<!--#INCLUDE FILE="Class_Top.asp" -->
<!--#include file="inc/char.asp" -->
<%
locat="论坛首页"
act="贴子列表"
Call top(4,1)

Dim tl,boardid
Dim currentPage,TotalPages
Dim rs,sql
Dim MaxTopicList
boardid=clng(request("boardid"))
MaxTopicList=20
'以下代码为更新今日发贴数
dim rsu,sqlu
set rsu=server.createobject("adodb.recordset")
sqlu="select top 1 * from Topic where boardid="&boardid&" order by posttime desc"
rsu.open sqlu,conn,1,1
%>
<%
if not rsu.eof then
if datediff("d",rsu("posttime"),now())>0 then
sqlu="update bbs set todaynum=0 where boardid="&boardid
conn.execute(sqlu)
end if
end if
rsu.close
set rsu=nothing
'更新结束
if Request("TimeLimit")="all" Then
	tl=""
ElseIf Request("TimeLimit")="" Then
	tl=""
Else
	limitime=Request("TimeLimit")
	tl="and 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,boardid from Topic where boardid="&boardid&" "&tl&" ORDER BY istop desc,LastTime Desc"

rs.open sql,conn,1,1
%>
<br><br>
<Script language="javascript" src="inc/PopText.asp"></Script>
<%
dim rsad,sqlad,boardmaster1,ad
set rsad=server.createobject("adodb.recordset")
sqlad="select boardmaster from bbs where boardid="&boardid
rsad.open sqlad,conn,1,1
boardmaster1=split(rsad(0),"$")
%>
<table width=100% align=center border=0>
  <tr>
    <td align=left height=26 valign=bottom><a href=Bbs_NewTopic.asp?boardid=<%=boardid%>><IMG SRC="images/newthread.gif" BORDER=0 ALT=""></a></td>
    <td align=left valign=bottom><img src="images/member.gif" width="20" height="20">版主：<%dim adnum
adnum=1
for ad=0 to ubound(boardmaster1)

response.write "<a href=Class_Userinfo.asp?name="&boardmaster1(ad)&" target=_blank>"&boardmaster1(ad)&"</a> "

if adnum>4 then
response.write " ..."
exit for
end if
adnum=adnum+1
next
rsad.close
set rsad=nothing
%></td>
    <td align=right valign=bottom> 
      <Select name=TimeLimit onChange="document.location.href='Bbs_ForumDisplay.asp?boardid=<%=boardid%>&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>
<div align="right"><%Call bbsboardlist()%></div>
<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 bbsboardList() 

	Dim bbsboardSQL,bbsboardRs
	bbsboardSQL="select boardid,boardname from bbs order by boardid"
	Set bbsboardRs=Conn.Execute(bbsboardSQL)
		Response.write "<select name=bbsboardlist onchange=""location.href='Bbs_ForumDisplay.asp?boardid='+options[this.selectedIndex].value"">"
		Response.write "<option value=0>=== 跳转论坛到 ===</option>"
		Do until bbsboardRs.eof
			Response.write 	"<option value="&bbsboardRs(0)&">"&htmlencode(bbsboardRs(1))&"</option>"
			bbsboardRs.movenext
		Loop
		Response.write "</select>"
	Set bbsboardRs=Nothing

End Sub 


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")=1 Then
	Response.Write "<img src=images/folder_top.gif alt=固顶主题>"
ElseIf rs("locked")=1 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=""Bbs_ViewThread.asp?boardid="&boardid&"&TopicID="&rs("PostID")&""" target=_blank title=""打开新窗口浏览""><img height=20 hspace=4 src=""images/mood/"&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=""Bbs_ViewThread.asp?boardid="&boardid&"&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=""Bbs_ViewThread.asp?boardid="&boardid&"&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=""Bbs_ViewThread.asp?boardid="&boardid&"&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("fenglingtxl_520")("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=""Class_Userinfo.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=""Bbs_ViewThread.asp?boardid="&boardid&"&TopicID="&rs("PostID")&""">"&st&"</a>&nbsp;<br><font color=gray>No Reply</font>&nbsp;</td><td width=20 align=center><a href=""Bbs_ViewThread.asp?boardid="&boardid&"&TopicID="&rs("PostID")&"""><img src=images/lastpost.gif border=0></a></td>"
Else
	Response.Write "&nbsp;<a href=""Bbs_ViewThread.asp?boardid="&boardid&"&TopicID="&rs("PostID")&"&Page="&Pnum&"#PID"&_
	LastReplyID&""" title=直接跳转到最后回复帖子>"&st&"</a>&nbsp;<br>By&nbsp;<a href=""Class_Userinfo.asp?Name="&_
	LastPoster&""" target=_blank>"&htmlencode(LastPoster)&"</a>&nbsp;</td><td width=20 align=center><a href=""Bbs_ViewThread.asp?boardid="&boardid&"&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=""?boardid="&boardid&"&Page=1"" title=首页><font face=webdings>9</font></a> "
end if

if p*8>0 Then 
	Response.Write "<a href=""?boardid="&boardid&"&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=""?boardid="&boardid&"&Page="&ii&"""><B>"&ii&"</B></a> "
	   End if
	if ii=totalpages Then Exit for
next
if ii<totalpages Then 
	Response.Write "<a href=""?boardid="&boardid&"&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=""?boardid="&boardid&"&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%>