<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="bbstop.asp"-->
<script language="javascript">
     function viewPage2(ipage){
        document.frmList2.Page.value=ipage
        document.frmList2.submit()        
     }
     function viewPage1(ipage){
        document.frmList2.Page.value=ipage
        document.frmList2.submit()        
     }
</script>
<%   	dim sql,rs
	dim Ers,Esql
   	dim boardtype
   	dim master_1,master_2
   	dim username,cname
    	dim foundErr 
    	dim ErrMsg
    	dim bBoardEmpty
	dim boardid
	dim timeLimited,limitime,tl
	dim totalrec
	dim n,i,RowCount
	dim p
	dim currentpage
    	dim announceIDRange1
    	dim announceIDRange2
	dim skin
	dim tableback
	dim tabletitle
	dim tablebody
	dim atablebody
	dim tablefont
	dim tablecontent
	dim alertfont
	dim Forumlogo
	dim guestlist
    	foundErr = false
    	ErrMsg = ""
    	selStr = "()"
	if memberclass = user_level7 or memberclass = user_level8 or memberclass = user_level9 then
		guestlist=""
	else
		guestlist=" lockboard<>2 and "
	end if

    	Rem ------获取参数(get or post的)------
    	Rem ------包括版面的ID和页次------
	set rs=server.createobject("adodb.recordset")
	set iprs=server.createobject("adodb.recordset")
    	Call getInput()
    	call chkInput()
	'显示版头
	call boardinfo()
    	if foundErr then
		call error()
	else
		call AnnounceList1()
		call listPages3()
		call boardlist()
		if founderr=true then call error()
	if err.number<>0 then err.clear
	end if

	REM 显示版面信息---Headinfo
	sub boardinfo()
  	sql="select boardtype,lockboard,boardmaster,boardskin,Tableback,Tabletitle,Tablebody,aTablebody,TableFont,TableContent,AlertFont,strAllowForumCode,strAllowHTML,strIMGInPosts,strIcons,strflash,Forumlogo from bbs_board where "&guestlist&" boardID="&cstr(boardid)
 	rs.open sql,conn,1,1
 	if not(rs.bof and rs.eof) then
    		boardtype=rs("boardtype")
		lockboard=rs("lockboard")
		Tableback=trim(rs("Tableback"))
		Tabletitle=trim(rs("Tabletitle"))
		Tablebody=trim(rs("Tablebody"))
		aTablebody=trim(rs("aTablebody"))
		TableFont=trim(rs("TableFont"))
		TableContent=trim(rs("TableContent"))
		AlertFont=trim(rs("AlertFont"))
		Forumlogo=rs("Forumlogo")
		if trim(rs("boardmaster"))<>"" then
			master_1=split(rs("boardmaster"), "|")
			for i = 0 to ubound(master_1)
			master_2=""+master_2+"<a href='dispuser.asp?name="+htmlencode(master_1(i))+"' target=_blank>"+htmlencode(master_1(i))+"</a>&nbsp;"
			next
		else
		response.write "无版主"
		end if
	else
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>您选择的版面不存在或者您没有权限察看该版面。"
		exit sub
	end if
	rs.close
%>
<TABLE width=762 bgcolor=#ffffff border=0 align=center class="table-zuoyou">
<tr><td height=25 bgcolor=#f9f9f9 colspan=2>&nbsp;现在时间是：<%=now%>&nbsp;&nbsp;您当前的位置：<a href=index.asp><font color=#ff6600>会员社区首页</font></a>&nbsp;&gt;&gt;&nbsp;<font color=#ff6600>精华帖子</font></td></tr>
</tr><tr><td height="1" bgcolor=#efefef colspan=2></td></tr>
</table>

<TABLE cellSpacing=0 cellPadding=0 width=762 border=0 align=center class=table-zuoyou bgcolor=#f9f9f9>
<tr>
            <td align=center width=34 valign=middle></td>
            <td align=right valign=middle><form action="elist.asp" method="get">
	<input type=hidden name="boardid" value="<%=boardid%>">
        <select name="selTimeLimit" onchange='javascript:submit()'>
        <option value="all">查看所有的主题
        <option value="1">查看一天内的主题
        <option value="2">查看两天内的主题
        <option value="7">查看一星期内的主题
        <option value="15">查看半个月内的主题
        <option value="30">查看一个月内的主题
        <option value="60">查看两个月内的主题
        <option value="180">查看半年内的主题
        </select>
        </form></td>
</tr>
</TABLE>
<table cellpadding=0 cellspacing=0 border=0 width="762" align=center bgcolor=#f9f9f9 class=table-zuoyou>
<tr>
<td align=left valign=middle>
<a href="announce.asp?boardid=<%=boardid%>"><img src="images/post.gif" border="0" alt="发表一个新主题"></a>&nbsp;&nbsp;<b><%if lockboard=1 then%>本论坛已锁定，任何用户均不能发言<%elseif lockboard=2 then%>本论坛为隐含论坛，只有贵宾等级以上方可发言<%end if%></b>
</td>
<td align=right><a href="elist.asp?boardID=<%=boardid%>&amp;page=1"><img src="images/refresh_1.gif" border=0 alt="刷新本论坛"></a>&nbsp;&nbsp;<b><a href="list.asp?boardid=<%=boardid%>">贴子列表</a>&nbsp;&nbsp;</a>
论坛版主</b>： 
<%=master_2%></td></tr>
</table>
<%
end sub

sub boardlist()
%>
<TABLE cellSpacing=0 cellPadding=0 width="762" border=0 align=center bgColor="#ffffff" class=table-zuoyou>
<tr>
<TD>&nbsp;<img src=images/xianhua.gif>&nbsp;目前<%=boardtype%>上共有 <b><%=online()%></b> 位会员与 <b><%=guest()%></b> 位客人.
<%if request("action")<>"online" then%>
  [<a href=elist.asp?action=online>关闭详细列表</a>]
<%else%>
  [<a href=elist.asp>显示详细列表</a>]
<%end if%>&nbsp;<img src=images/ao.gif> 大佬 <img src=images/ao1.gif> 斑猪 <img src=images/messages1.gif> 会员 <img src=images/messages2.gif> 客人<%
if request("action")<>"online" then%>
<%call onlineuser()
end if%>
</TD>
</tr>
</TABLE>
<table border="0" cellpadding="0" cellspacing="3" width="762" class=table-zuoyou bgcolor=#ffffff align="center">
<form action=elist.asp method=get>
<tr>
<td valign="middle" nowrap align=center>
<select name='boardid' onchange='javascript:submit()'>
<option value="">跳转论坛
<%
	dim rs1,sql1
	set rs1=server.createobject("adodb.recordset")
	sql="select * from bbs_class order by id"
	rs.open sql,conn,1,1
	do while not rs.eof
	id=rs("id")
%>
<option value="1">>>&nbsp;<%=rs("class")%> <<
<%
   		sql1="select boardid,boardtype from bbs_board where "&guestlist&" class="&id&" order by boardid"
   		rs1.open sql1,conn,1,1
		if rs1.eof and rs1.bof then
%>
<option value="">没有论坛
<%else%>
<%do while not rs1.eof%>
<option value="<%=rs1("boardid")%>"><%=rs1("boardtype")%>
<%
		rs1.movenext
		loop
		end if
		rs1.close
%>
<%
	rs.movenext
	loop
	rs.close
	set rs1=nothing
%>
</select></td>
  </tr>
</form>
</table>
<%
	end sub

	sub onlineuser()
	response.write "<hr color=#008000 noshade size=1>&nbsp;&nbsp;"
	guests="客人"
	sql="select username,startime,lastimebk,ip,stats,userclass,browser from bbs_online where username<>'"&guests&"'"
	rs.open sql,conn,1,1
	do while not rs.eof
if instr(rs("stats"),boardtype)>0 then
	if rs("userclass")=user_level8 or rs("userclass")=user_level9 then
	response.write "<img src=images/ao.gif alt=特殊人物>&nbsp;"
	response.write "<a href='dispuser.asp?name="&htmlencode(rs("username"))&"' target=_blank>"
	response.write "<ACRONYM TITLE=""目前位置："&rs("stats")&"&#13;&#10;来访时间："&rs("startime")&"&#13;&#10;活动时间："&rs("lastimebk")
	response.write """>"
	response.write htmlencode(rs("username"))
	response.write "</ACRONYM></a>&nbsp;"

	elseif rs("userclass")=user_level7 then
	response.write "<img src=images/ao1.gif alt="&user_level7&">&nbsp;"
	response.write "<a href='dispuser.asp?name="&htmlencode(rs("username"))&"' target=_blank>"
	response.write "<ACRONYM TITLE=""目前位置："&rs("stats")&"&#13;&#10;来访时间："&rs("startime")&"&#13;&#10;活动时间："&rs("lastimebk")
	response.write """>"
	response.write htmlencode(rs("username"))
	response.write "</ACRONYM></a>&nbsp;"

	else
	response.write "<img src=images/messages1.gif>&nbsp;"
	response.write "<a href='dispuser.asp?name="&htmlencode(rs("username"))&"' target=_blank>"
	response.write "<ACRONYM TITLE=""目前位置："&rs("stats")&"&#13;&#10;来访时间："&rs("startime")&"&#13;&#10;活动时间："&rs("lastimebk")
	response.write """>"
	response.write htmlencode(rs("username"))
	response.write "</ACRONYM></a>&nbsp;"
	end if
end if
          rs.movenext
        loop
	rs.close
	if guestuser=1 then
	sql="select username,startime,lastimebk,ip,stats,userclass,browser from bbs_online where username='"&guests&"'"
	rs.open sql,conn,1,1
	do while not rs.eof
if instr(rs("stats"),boardtype)>0 then
	response.write "<img src=images/messages2.gif>&nbsp;"
	'response.write "<a href="""">"
	response.write "<ACRONYM TITLE=""目前位置："&rs("stats")&"&#13;&#10;来访时间："&rs("startime")&"&#13;&#10;活动时间："&rs("lastimebk")
	response.write """>"
	response.write rs("username")
	response.write "</ACRONYM></a>&nbsp;"
end if
	  rs.movenext
	loop
	rs.close
	end if
	end sub

	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.ztop,bbs_content.istop,bbs_content.isbest,bbs_board.lockboard from bbs_content,bbs_board where bbs_content.boardid=bbs_board.boardid and bbs_content.boardID="&cstr(boardID)&" and bbs_content.isbest=1 "&tl&" ORDER BY 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="#ffffff" border=0 cellPadding=0 cellSpacing=0 width="762" align=center class="table-zuoyou">
<TR bgcolor=#66cc00>
    <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=table-zuoyou>
<%
       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("ztop")=1 then
	response.write "<img src=images/ztop.gif alt=总固顶主题>"
else 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("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>
<!--<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%>
<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")%>">
<%
if rs("topic")="" then
	response.write ""&left(htmlencode(rs("body")),26)&"..."
else
if len(rs("topic"))>26 then
	response.write ""&htmlencode(left(rs("topic"),26))&"..."
else
	response.write htmlencode(rs("topic"))
end if
end if
	response.write "</a>"
%></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;<IMG border=0 src="images/lastpost.gif">
<%
	response.write ""&FormatDateTime(rs("dateandtime"),2)&"&nbsp;"&FormatDateTime(rs("dateandtime"),4)&""
	response.write "&nbsp;<font color=#990000>|</font>&nbsp;"
	response.write "<a href='dispuser.asp?name="&htmlencode(rs("username"))&"' target=_blank>"&htmlencode(rs("username"))&"</a>"
%>
</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="3" width="762" bgcolor=#f9f9f9 align="center" class=table-zuoyou>
<form method="post" action="elist.asp" name="frmList2">
<input type=hidden name="selTimeLimit" value="<%=request("selTimeLimit")%>">
<tr>
    <td valign="middle" nowrap>页次：<strong><%=currentPage%></strong>/<strong><%=n%></strong>页 每页<strong><%=MaxAnnouncePerPage%></strong> 主题数<strong><%=totalrec%></strong></td>
    <td valign="middle" nowrap align="right"><p>分页：
<%
	   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"></p> </td>
</tr>
<input type="hidden" name="BoardID" value="<%=BoardID%>">
</form>
</table>
<%	if err.number<>0 then err.clear
	end sub 

	sub showEmptyBoard1()
%>
<TABLE bgColor="#66cc00" border=0 cellPadding=0 cellSpacing=1 width="762" align=center class=table-zuoyou>
<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>
<%
	rs.close
	end sub

	function online()
	guests="客人"
    	tmprs=conn.execute("Select count(id) from bbs_online where username<>'"&guests&"'") 
    	online=tmprs(0) 
	set tmprs=nothing 
	if isnull(online) then online=0
	end function 

	function guest()
	guests="客人"
    	tmprs=conn.execute("Select count(id) from bbs_online where username='"&guests&"'") 
    	guest=tmprs(0) 
	set tmprs=nothing 
	if isnull(guest) then guest=0
	end function 

	Sub getInput()
        	'On Error Resume Next
        	Rem ------获取版面ID------
        	BoardID = Request("BoardID")
        	Rem ------获取页次------
        	currentPage=request("page")
    	End Sub
    
    	sub chkInput
		'on error resume next
		if BoardID="" then
			BoardID=1
		elseif not isInteger(BoardID) then
			BoardID=1
		else
			BoardID=clng(BoardID)
			if err then
				BoardID=1
				err.clear
			end if
		end if
		if currentpage="" then
			currentpage=1
		elseif not isInteger(currentpage) then
			currentpage=1
		else
			currentpage=clng(currentpage)
			if err then
				currentpage=1
				err.clear
			end if
		end if
		if request("selTimeLimit")="all" then
			tl=""
		elseif request("selTimeLimit")="" then
			tl=""
		else
			limitime=request("selTimeLimit")
			tl=" and dateandtime>='"&cstr(cdate(now()-limitime))&"' "
		end if
    	end sub
	set rs=nothing
%>
<TABLE border=0 cellPadding=4 cellSpacing=1 width="762" bgcolor=#ffffff class=table-zuoyou align=center>
<TR><TD align=center>
<p><img src=images/folder.gif>&nbsp;&nbsp;开放的主题&nbsp;&nbsp;&nbsp;&nbsp;
<img src=images/hotfolder.gif>&nbsp;&nbsp;回复超过10贴&nbsp;&nbsp;&nbsp;&nbsp;
<img src=images/lockfolder.gif>&nbsp;&nbsp;锁定的主题&nbsp;&nbsp;&nbsp;&nbsp;
<img src=images/istop.gif>&nbsp;&nbsp;固顶的主题&nbsp;&nbsp;&nbsp;&nbsp;
<img src=images/ztop.gif>&nbsp;&nbsp;总固顶的主题
</td></tr>
</TABLE>
<!--#include file="bbsend.asp"-->