<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="chkuser.asp" -->
<!--#include file="inc/theme.asp" -->
<!--#include file="inc/char.asp"-->
<!--#include file="footer.asp"-->
<% 


   '发贴量图标显示插件
   '版本：for519 
   '作者：rexsp 
   '演示：http://www.jmjh.net/bbs

   dim action
   dim sql2
   dim lastbbsnum
   dim ttodaynum,tlastbbsnum,tlasttopicnum,total
   dim classname
   boardid=request("boardid")
   action=request("action")
     if isnumeric(boardid) then
      boardid=int(boardid)
    else
      boardid=0
   end if
    if boardid=0 then
	boardtype="论坛首页"
	end if

  if action="lastbbsnum" then
   	stats="论坛贴子总数状态图例"
  elseif action="lasttopicnum" then
   	stats="论坛主题总数状态图例"
  else
   	stats="论坛今日贴数状态图例"
  end if

   if founderr then
		call nav()
		if boardid=0 then
	call headline(1)
	   else
	call headline(2)
	end if
		call error()
		call endline()
	else
	call nav()
	if boardid=0 then
	call headline(1)
	else
	call headline(2)
	end if
	call main()
	call endline()
	end if

	
	sub main()



 if boardid=0 then
  sql="select top 1 TodayNum,BbsNum,TopicNum from config where active=1"
  else
  sql="select b.boardtype,b.todaynum,b.lastbbsnum,b.lasttopicnum,c.todaynum,c.bbsnum,c.topicnum from board b ,config c where b.boardid="&boardid&"  and c.active=1"
 end if

 set rs=server.createobject("adodb.recordset")
 rs.open sql,conn,0,1
  if rs.eof then
   founderr=true
   Errmsg=Errmsg+"<br>"+"<li>此论坛不存在"
   call error()

  else

  if boardid=0 then
  boardtype=forumname
   todaynum=rs(0)
   lastbbsnum=rs(1)
   lasttopicnum=rs(2)
   ttodaynum=todaynum
   tlastbbsnum=lastbbsnum
   tlasttopicnum=lasttopicnum
  else
   boardtype=rs(0)
   todaynum=rs(1)
   lastbbsnum=rs(2)
   lasttopicnum=rs(3)
   ttodaynum=rs(4)
   tlastbbsnum=rs(5)
   tlasttopicnum=rs(6)
   
  end if


   if action="lastbbsnum" then
     classname="贴子总数"
     total=tlastbbsnum
   elseif action="lasttopicnum" then
     classname="主题总数"
     total=tlasttopicnum
   else
     classname="今日贴数"
     total=ttodaynum
    end if
if total=0 then
total=1
end if

  rs.close
 
  if action="lastbbsnum" then
   sql2="select boardtype,lastbbsnum,boardid from board order by lastbbsnum desc"
  elseif action="lasttopicnum" then
    sql2="select boardtype,lasttopicnum,boardid from board order by lasttopicnum desc"
  else
    sql2="select boardtype,todaynum,boardid from board  order by todaynum desc"
  end if

  rs.open sql2,conn,0,1
   

%><br>
<table cellpadding=5 cellspacing=1 border=0 width=<%=TableWidth%> bgcolor=<%=Tablebackcolor%> align=center>
	<tr id=tdbg  >
      <td colspan=3 bgcolor='<%=Tabletitlecolor%>'  align=center>
<a href="?boardid=<%=boardid%>" ><b>各分论坛今日帖数图例</b></a> | 
<a href="?action=lasttopicnum&boardid=<%=boardid%>" ><b>各分论坛主题数图例</b></a> | 
<a href="?action=lastbbsnum&boardid=<%=boardid%>" ><b>各分论坛总帖数图例</b></a>
</td>
    </tr>
<tr bgcolor='<%=aTabletitlecolor%>' > 
<td colspan=3 class=coolbg  align=center><font color="#000000">
目前:<b><%=boardtype%></b>  今日帖数：<%=todaynum%> 帖子总数：<%=lastbbsnum%> 主题总数：<%=lasttopicnum%> </font>
</td>
</tr>
   <tr bgcolor='<%=Tabletitlecolor%>' id=atdbg>
      <td align=center width="20%"><b><font color="#000000">论坛名称</font></b></td>
      <td align=center width="70%" ><b>图形比例</b></td>
      <td align=center width="10%" ><b><font color="#000000"><%=classname%></font></b></td>
      </tr>
	  <%dim m
	  m=1
	  do while not rs.eof
	   if m="" then
		m=1
	elseif m>10 then
		m=1
		end if
	  	  %>
	  <tbody>
	 
	     <tr  bgcolor='<%=TableBodyColor%>'>
      <td align=center width="20%"><b><a href="list.asp?boardid=<%=rs(2)%>"><font color="#000000"><%=rs(0)%></font></a></b></td>
      <td  width="70%" ><img src="<%=picurl%>bar<%=m%>.gif"  width=<%=int(replace(FormatPercent(rs(1)/total),"%",""))*10%> height=8>&nbsp;<%=left((rs(1)/total)*100,5)%>%</td>
      <td align=center width="10%" ><b><font color="#000000"><%=rs(1)%></font></b></td>
      </tr>
	  </tbody>
	    <%
   rs.movenext
   m=m+1
   loop
   rs.close
   %>
  </table>
  <br>
  <br>
  <%end if
  end sub%>