<%
	sub AnnounceList1()	
	'on error resume next
	sql="select bbs_content.AnnounceID,bbs_content.parentID,bbs_content.boardID,bbs_content.UserName,bbs_content.child,bbs_content.Topic,bbs_content.body,bbs_content.DateAndTime,bbs_content.hits,bbs_content.RootID,bbs_content.Expression,bbs_content.times,bbs_content.locktopic,bbs_content.istop,bbs_content.isbest,bbs_board.lockboard from bbs_content,bbs_board where bbs_content.ztop<>1 and bbs_content.boardid=bbs_board.boardid and bbs_content.boardID="&cstr(boardID)&" and bbs_content.parentID=0 "&tl&" ORDER BY bbs_content.istop desc,bbs_content.times desc,bbs_content.announceid desc"
	rs.open sql,conn,1,1
	if err.number<>0 then
		foundErr = true
		ErrMsg = "<li>数据库操作失败：" & err.description & "</li>"
	else
		if rs.bof and rs.eof then
			'论坛无内容
			call showEmptyBoard1()
			bBoardEmpty = true
		else
	      		totalrec=rs.recordcount 
      			if currentpage<1 then 
          			currentpage=1 
      			end if 

      			if (currentpage-1)*MaxAnnouncePerPage>totalrec then 
	   			if (totalrec mod MaxAnnouncePerPage)=0 then 
	     				currentpage= totalrec \ MaxAnnouncePerPage 
	   			else 
	      				currentpage= totalrec \ MaxAnnouncePerPage + 1 
	   			end if 
      			end if 
       			if currentPage=1 then 
            			call showpagelist1() 
       			else 
          			if (currentPage-1)*MaxAnnouncePerPage<totalrec then 
            				rs.move  (currentPage-1)*MaxAnnouncePerPage 
            				call showpagelist1() 
        			else 
	        			currentPage=1 
           				call showpagelist1() 
	      			end if 
	   		end if 
		end if
	end if				
		if err.number<>0 then err.clear	
	end sub

	REM 显示贴子列表	
	sub showPageList1()
	i=0
%>
<span id=forum>
<TABLE bgColor="#66cc00" border=0 cellPadding=0 cellSpacing=1 width="762" align=center class=pian>
<TR>
    <TD align=middle height=27 width=32>状态</TD> 
    <TD align=middle  width=365>主 题</TD> 
    <TD align=middle  width=80>作 者</TD> 
    <TD align=middle  width=64>回复/人气</TD>
    <TD align=middle  width=195>最后更新 | 回复人</TD>
</TABLE>
<TABLE bgColor="#efefef" border=0 cellPadding=0 cellSpacing=1 width="762" align=center class=pian>
<%	set rs1=server.createobject("adodb.recordset")
	sql1="select * from bbs_content where ztop=1 order by AnnounceID DESC"
	rs1.open sql1,conn,1,1
	do while not rs1.eof and i<10 and currentpage=1
%>
	<TR bgcolor="#f9f9f9" onmouseover="javascript:this.bgColor='#c3ffbb';this.style.cursor='default';" onmouseout="javascript:this.bgColor='#f9f9f9';">
	<TD align=middle width=32 height=27><img src=images/ztop.gif alt=总固顶主题></td>
	<TD width="365">
<%if rs1("child")=0 then%>
<img src="images/nofollow.gif">
<%else%>
<img src="images/plus.gif">
<%end if%>
<%	set Ers=conn.execute("select username,dateandtime,body,announceid,rootid from bbs_content where announceid="&rs1("times")&"")
%>
<a href='dispbbs.asp?boardID=<%=rs1("boardid")%>&RootID=<%=rs1("RootID")%>&ID=<%=rs1("announceID")%>'  title="《<%=htmlencode(rs1("topic"))%>》&#13;&#10;作者：<%=htmlencode(rs1("username"))%>&#13;&#10;发表于<%=rs1("dateandtime")%>&#13;&#10;最后跟贴：<%=left(Ers("body"),20)%>...">
<%
if len(rs1("topic"))>26 then
	response.write ""&htmlencode(left(rs1("topic"),26))&"..."
else
	response.write htmlencode(rs1("topic"))
end if
	response.write "</a>"
if rs1("child")>Maxtitlelist then
	response.write "&nbsp;&nbsp;[分页："
	Pnum=Cint(rs1("child")/Maxtitlelist)+1
	for p=1 to Pnum
	response.write " <a href='dispbbs.asp?boardID="&rs1("boardid")&"&RootID="&rs1("RootID")&"&ID="&rs1("announceID")&"&star="&P&"'><b>"&p&"</b></a> "
	next
	response.write "]"
end if
%></TD>
    <TD align=middle width=80><a href='dispuser.asp?name=<%=htmlencode(rs1("username"))%>' target=_blank><%=htmlencode(rs1("username"))%></a></TD> 
    <TD align=middle width=64><%=rs1("child")%>/<%=rs1("hits")%></TD> 
    <TD width=195>&nbsp;
<%
	on error resume next
	if Ers.eof and Ers.bof then
	response.write "<IMG border=0 src=images/lastpost.gif>&nbsp;"
	response.write ""&FormatDateTime(rs1("dateandtime"),2)&"&nbsp;"&FormatDateTime(rs1("dateandtime"),4)&""
	response.write "&nbsp;<font color=#990000>|</font>&nbsp;------"
	else
	response.write ""&FormatDateTime(Ers("dateandtime"),2)&"&nbsp;"&FormatDateTime(Ers("dateandtime"),4)&""
	response.write "&nbsp;<font color=#990000>|</font>&nbsp;"
	if rs1("announceid")=rs1("times") then
	response.write "------"
	else
	response.write "<a href='dispuser.asp?name="&htmlencode(Ers("username"))&"' target=_blank>"&htmlencode(Ers("username"))&"</a>"
	end if
	end if
	Ers.close
%></td></tr>
<%
	i=i+1
        rs1.movenext
        loop
	rs1.close
	set rs1=nothing

       do while not rs.eof
%>
<TR bgcolor="#f9f9f9" onmouseover="javascript:this.bgColor='#c3ffbb';this.style.cursor='default';" onmouseout="javascript:this.bgColor='#f9f9f9';">
    <TD align=middle width=32 height=27>
<%
if rs("istop")=1 then
	response.write "<img src=images/istop.gif alt=固顶主题>"
else
	if rs("lockboard")=1 then
		response.write "<img src=images/lockfolder.gif alt=本论坛已锁定>"
	else
		if rs("locktopic")=1 then
		response.write "<img src=images/lockfolder.gif alt=本主题已锁定>"
		else
		if rs("child")>=10 then
			response.write "<img src=images/hotfolder.gif alt=热门主题>"
		else
			response.write "<img src=images/folder.gif alt=开放主题>"
		end if
		end if
	end if
end if%></TD> 
<TD width="365">
<!--<a href='dispbbs.asp?boardID=<%=boardID%>&RootID=<%=rs("RootID")%>&ID=<%=rs("announceID")%>' target=_blank><img src='images/<%=rs("Expression")%>' border=0 alt="开新窗口浏览此主题"></a>-->
<%if rs("child")=0 then%>
<img src="images/nofollow.gif">
<%else%>
<img src="images/plus.gif">
<%end if%>
<%	set Ers=conn.execute("select username,dateandtime,body,announceid,rootid from bbs_content where announceid="&rs("times")&"")
%>
<a href='dispbbs.asp?boardID=<%=boardID%>&RootID=<%=rs("RootID")%>&ID=<%=rs("announceID")%>'  title="《<%=htmlencode(rs("topic"))%>》&#13;&#10;作者：<%=htmlencode(rs("username"))%>&#13;&#10;发表于<%=rs("dateandtime")%>&#13;&#10;最后跟贴：<%=left(Ers("body"),20)%>...">
<%
if len(rs("topic"))>26 then
	response.write ""&htmlencode(left(rs("topic"),26))&"..."
else
	response.write htmlencode(rs("topic"))
end if
	response.write "</a>"
if rs("child")>Maxtitlelist then
	response.write "&nbsp;&nbsp;[分页："
	Pnum=Cint(rs("child")/Maxtitlelist)+1
	for p=1 to Pnum
	response.write " <a href='dispbbs.asp?boardID="&boardID&"&RootID="&rs("RootID")&"&ID="&rs("announceID")&"&star="&P&"'><b>"&p&"</b></a> "
	next
	response.write "]"
end if
%></TD> 
    <TD align=middle width=80><a href='dispuser.asp?name=<%=htmlencode(rs("username"))%>' target=_blank><%=htmlencode(rs("username"))%></a></TD> 
    <TD align=middle width=64><%=rs("child")%>/<%=rs("hits")%></TD> 
    <TD width=195>
&nbsp;
<%
	on error resume next
	if Ers.eof and Ers.bof then
	response.write "<IMG border=0 src=images/lastpost.gif>&nbsp;"
	response.write ""&FormatDateTime(rs("dateandtime"),2)&"&nbsp;"&FormatDateTime(rs("dateandtime"),4)&""
	response.write "&nbsp;<font color=#990000>|</font>&nbsp;------"
	else
	response.write ""&FormatDateTime(Ers("dateandtime"),2)&"&nbsp;"&FormatDateTime(Ers("dateandtime"),4)&""
	response.write "&nbsp;<font color=#990000>|</font>&nbsp;"
	if rs("announceid")=rs("times") then
	response.write "------"
	else
	response.write "<a href='dispuser.asp?name="&htmlencode(Ers("username"))&"' target=_blank>"&htmlencode(Ers("username"))&"</a>"
	end if
	end if
	Ers.close
%></TD>
</TR>
<!--
<tr style="display:none" id="follow<%=rs("rootid")%>"><td colspan=11  id="followTd<%=rs("rootid")%>" style="padding:0px;" bgColor=#ffffff><div style="width:240px;margin-left:18px;border:1px solid black;background-color:lightyellow;color:black;padding:2px;cursor:default;" onclick="loadThreadFollow(<%=rs("rootid")%>)">正在读取关于本主题的跟贴，请稍侯……</div></td></tr>
-->
<%	  i=i+1
	  if i>=MaxAnnouncePerPage then exit do
          rs.movenext
        loop
	rs.close
%>
</TABLE>
</span>
<%	if err.number<>0 then err.clear
	end sub

	sub listPages3()
	'on error resume next

  	dim n
  	if totalrec mod MaxAnnouncePerPage=0 then
     		n= totalrec \ MaxAnnouncePerPage
  	else
     		n= totalrec \ MaxAnnouncePerPage+1
  	end if
%>
<table border="0" cellpadding="0" cellspacing="0" width="762" align="center" class=pian>
<tr><td height=1 bgcolor=#cccccc colspan=2></td></tr>
<tr bgcolor=#efefef><form method="post" action="list.asp" name="frmList2"><input type=hidden name="selTimeLimit" value="<%=request("selTimeLimit")%>">
<td valign="middle" nowrap height=30>&nbsp;&nbsp;页次：<strong><%=currentPage%></strong>/<strong><%=n%></strong>页 每页<strong><%=MaxAnnouncePerPage%></strong> 主题数<strong><%=totalrec%></strong></td>
<td valign="middle" nowrap align=right>分页：
<%	   for p=1 to n
	   if p<10 then
	       if p=currentPage then
	          response.write "["+Cstr(p)+"] "
		   else
		      response.write "<a href='javascript:viewPage2("+Cstr(p)+")' language='javascript'>["+Cstr(p)+"]</a>   "
		   end if
		end if
	next
%>转到:<input type="text" name="Page" size=3 maxlength=10  value="<%=currentpage%>"><input type="button" value="Go" language="javascript" onclick="viewPage1(document.frmList2.Page.value)" id="button1" name="button1">&nbsp;&nbsp;</td>
<input type="hidden" name="BoardID" value="<%=BoardID%>"></tr>
<tr><td height=1 bgcolor=#cccccc colspan=2></td></tr>
</form>
</table>
<%	if err.number<>0 then err.clear
	end sub 
	sub showEmptyBoard1()
%>
<TABLE bgColor='#efefef' border=0 cellPadding=4 cellSpacing=1 width="762" align=center class=pian>
<TR bgColor=#66cc00>
    <TD align=middle noWrap height=25>状态</TD> 
    <TD align=middle noWrap>主 题  (点心情符为开新窗浏览)</TD> 
    <TD align=middle noWrap>作 者</TD> 
    <TD align=middle noWrap>回复/人气</TD> 
    <TD align=middle noWrap>最新回复</TD></TR> 
<tr bgColor=#f9f9f9><td colSpan=5 vAlign=center width="100%">本论坛暂无内容，欢迎发贴：）</td></tr>
</TABLE>
<%rs.close
end sub
%>
