<!-- #include file="include/config_forum.asp" -->
<% if not(isnumeric(forumid)) then call cookies_type("forum_id") %>
<!-- #include file="include/jk_pagecute.asp" -->
<!-- #include file="include/conn.asp" -->
<script language="JavaScript" type="text/JavaScript">
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
</script>
<%
call forum_first()
	dim isdisp,bbseveninfo,forum_id,stats,errmsg,founderr
	dim endpage,sucmsg
	dim totalrec
	dim n
	dim currentpage,page_count,Pcount
	dim bgcolor
	if forumid=0 then
tit="论坛总事件列表"
call web_head(0,0,2,0,0)
	else
tit=forumname&" [事件列表]"
call web_head(0,0,2,0,0)
	end if
	if format_power(login_mode,0)="admin" or format_power(login_mode,0)="super" then
		Errmsg=Errmsg+"<br>"+"<li>您没有浏览本论坛事件的权限，请<a href=login.asp>登陆</a>或者同管理员联系。"
		founderr=true
	end if

dim sea_type,sea_true
select case action
case "manage"
  response.write forum_top("")
case "isgood"
  response.write forum_top("")
case else
  if sea_true="yes" then
    response.write forum_top("")
  else
    response.write forum_top("")
  end if

end select 
%>
<script language=javascript>
<!--
function load_tree(f_id,v_id){
  var targetImg =eval("document.all.followImg" + v_id);
  var targetDiv =eval("document.all.follow" + v_id);
  if (targetImg.src.indexOf("nofollow")!=-1){return false;}
    if ("object"==typeof(targetImg)){
      if (targetDiv.style.display!='block'){
        targetDiv.style.display="block";
        targetImg.src="images/small/fk_minus.gif";
        if (targetImg.loaded=="no"){
          document.frames["hiddenframe"].location.replace("forum_loadtree.asp?forum_id="+f_id+"&view_id="+v_id);
        }
      }else{
      targetDiv.style.display="none";
      targetImg.src="images/small/fk_plus.gif";
    }
  }
}
-->
</script>
<iframe width=0 height=0 src='about:blank' id=hiddenframe></iframe>
<div align="center">
  <center>
<table border=1 width='98%' cellspacing=1 cellpadding=1 bordercolor=<%response.write web_var(web_color,3)%>><tr><td  height=20>
<table width=100% bgcolor=#ffffff><tr><td valign=middle height=20 width=32><b>广播</b></td>
          <td width=20> <img src="images/small/aboard.gif" width="20" height="20"></td><td align="center"><%call xzb_scroll("jt0","",3,15,1)%>　</td></tr></table></tr></table>
  </center>
</div>
<%


	if format_power(login_mode,0)="admin" or format_power(login_mode,0)="super" then founderr=false
	if founderr then
		call db_error()
	else
		if request("action")="dellog" then
			call batch()
		else
			call boardeven()
		end if
		if founderr then call db_error()
	end if
	call web_end(0)
	REM 显示版面讯息---Headinfo
	sub boardeven()
	currentPage=request("page")
	if currentpage="" or not isInteger(currentpage) then
		currentpage=1
	else
		currentpage=clng(currentpage)
	end if
    response.write forum_table1 
	response.write "<form action=forum_even.asp?action=dellog&forum_id="&forumid&" method=post name=even>"
	response.write "<input type=hidden name=forum_id value="&forumid&">"
	response.write "<tr align=center "&forum_table2&" height=20>"
		if request("action")="batch" and (format_power(login_mode,0)="admin" or format_power(login_mode,0)="super") then
	response.write "<td width=5% class=end>操作</td>"
                end if
	response.write "<td width=5% class=end>序号</td>"
	response.write "<td width=10% height=25 class=end>对象</td>"
	response.write "<td width=55% class=end>事件内容</td>"
	response.write "<td width=15% class=end align=center>操作时间</a></td>"
	response.write "<td width=15% class=end>操作人</td></tr>"
	set rs=server.createobject("adodb.recordset")
	if forumid>0 then
	sql="select * from log where l_boardid="&forumid&" order by l_addtime desc"
	else
	sql="select * from log order by l_addtime desc"
	end if
	rs.open sql,conn,1,1
	if rs.bof and rs.eof then
	   if request("action")="batch" and (format_power(login_mode,0)="admin" or format_power(login_mode,0)="super") then
		response.write "<tr><td "&format_table(3,1)&" colspan=6 height=25 align=center>本版还没有任何事件</td></tr>"
           else
		response.write "<tr><td "&format_table(3,1)&" colspan=6 height=25 align=center>本版还没有任何事件</td></tr>"
           end if     
	else
		rs.PageSize = web_var(web_num,2)
		rs.AbsolutePage=currentpage
		page_count=0
      	totalrec=rs.recordcount
		while (not rs.eof) and (not page_count = rs.PageSize)
		response.write "<tr>"
		if request("action")="batch" and (format_power(login_mode,0)="admin" or format_power(login_mode,0)="super") then
		response.write "<td  align=center "&format_table(3,1)&">"
		response.write "<input type=checkbox name=lid value="&rs("l_id")&">"
		response.write "</td>"
		end if
		response.write "<td  align=center "&format_table(3,1)&">"&page_count+(currentpage-1)*web_var(web_num,2)+1&"</td>" 
		response.write "<td  align=center "&format_table(3,1)&" height=24><a href=user_view.asp?username="&rs("l_touser")&" target=_blank>"&rs("l_touser")&"</a></td>"
		response.write "<td  align=left "&format_table(3,1)&">"&rs("l_content")&"</td>"
		response.write "<td  align=center "&format_table(3,1)&">"
		response.write "<font class=gray size=1>"&time_type(rs("l_addtime"),8)&"</font>"
		response.write "</td>"
		response.write "<td align=center "&format_table(3,1)&">"
		if format_power(login_mode,0)="admin" or format_power(login_mode,0)="super" then
			response.write "<a href=user_view.asp?username="&rs("l_username")&" target=_blank>"&rs("l_username")&"</a>"
		elseif forumid=0 and not (format_power(login_mode,0)="admin" or format_power(login_mode,0)="super") then
			response.write "保密"
		end if
		response.write "</td></tr>"
		page_count = page_count + 1
		rs.movenext
		wend
	end if
	if request("action")="batch" then
		if format_power(login_mode,0)="admin" or format_power(login_mode,0)="super" then
		response.write "<tr><td "&forum_table3&" colspan=6>请选择要删除的事件：<input type=checkbox name=chkall value=on onclick=""CheckAll(this.form)"">全选 <input type=submit name=act value=删除  onclick=""{if(confirm('您确定执行的操作吗?')){this.document.even.submit();return true;}return false;}"">"&_
				"　<input type=submit name=act onclick=""{if(confirm('确定清除回收站所有的纪录吗?')){this.document.even.submit();return true;}return false;}"" value=清空日志>"
                else
		response.write "<tr><td "&forum_table3&" colspan=5>请选择要删除的事件：<input type=checkbox name=chkall value=on onclick=""CheckAll(this.form)"">全选 <input type=submit name=act value=删除  onclick=""{if(confirm('您确定执行的操作吗?')){this.document.even.submit();return true;}return false;}"">"&_
				"　<input type=submit name=act onclick=""{if(confirm('确定清除回收站所有的纪录吗?')){this.document.even.submit();return true;}return false;}"" value=清空日志>"
                end if
	response.write "</td></tr>"
	end if
	response.write "</table>"
  	if totalrec mod web_var(web_num,2)=0 then
     		Pcount= totalrec \ web_var(web_num,2)
  	else
     		Pcount= totalrec \ web_var(web_num,2)+1
  	end if
response.write kong & forum_table1
	response.write "<tr height=25 "&forum_table3&"><td width='75%'>"
	response.write "共有 <b>"&totalrec&"</b> 条事件&nbsp;页次：<b>"&currentpage&"</b>/<b>"&Pcount&"</b>"
	response.write "&nbsp;每页<b>"&web_var(web_num,2)&"</b>&nbsp;"
	response.write "分页："
	if currentpage > 4 then
	response.write "<a href=""?page=1&forum_id="&forumid&""">[1]</a> ..."
	end if
	if Pcount>currentpage+3 then
	endpage=currentpage+3
	else
	endpage=Pcount
	end if
	for i=currentpage-3 to endpage
	if not i<1 then
		if i = clng(currentpage) then
        response.write " <font color=red>["&i&"]</font>"
		else
		response.write " <a href=""?page="&i&"&forum_id="&forumid&""">["&i&"]</a>"
		end if
	end if
	next
	if currentpage+3 < Pcount then 
	response.write "... <a href=""?page="&Pcount&"&forum_id="&forumid&""">["&Pcount&"]</a>"
	end if
         if format_power(login_mode,0)="admin" or format_power(login_mode,0)="super" then
	response.write " <a href=forum_even.asp?action=batch&forum_id="&forumid&">管理</a>"
	response.write "</td></tr></table>"
         else
	response.write "</td></tr></table>"
     	 end if

	rs.close
	set rs=nothing
	end sub

	sub batch()
	dim lid
	if login_username="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请登陆后进行操作。"
	end if
	if forumid=0 then
		if not (format_power(login_mode,0)="admin" or format_power(login_mode,0)="super") then
			founderr=true
			Errmsg=Errmsg+"<br>"+"<li>您不是系统管理员，不能管理所有日志。"
		end if
	else
		if not (format_power(login_mode,0)="admin" or format_power(login_mode,0)="super") then
			Errmsg=Errmsg+"<br>"+"<li>您不是该版面斑竹或者系统管理员。<br><li>或者您没有使用该功能的权限。"
			founderr=true
		end if
	end if
	if request("act")="删除" then
		if request.form("lid")="" then
		founderr=true
		Errmsg=Errmsg+"<br>"+"<li>请指定相关事件。"
		else
		lid=replace(request.Form("lid"),"'","")
		end if
	end if

	if founderr then exit sub

	if request("act")="删除" then
	conn.execute("delete from log where l_id in ("&lid&")")
	elseif request("act")="清空日志" then
		if format_power(login_mode,0)="super" then
	conn.execute("delete from log where l_boardid="&forumid&" ")
		elseif format_power(login_mode,0)="admin" then
	conn.execute("delete from log  ")
		end if
	end if
	sucmsg="<li>删除指定事件成功"
	call dvbbs_suc()
	end sub
sub dvbbs_suc()
%>
<table border=0 width=590 cellspacing=0 cellpadding=0>
<tr><td align=right><img src='images/main/center_error.gif' border=0></td></tr>
<tr><td align=center height=380>
<table border=0 cellpadding=0 cellspacing=0 width=534>
  <tr>
   <td colspan=3><img src=images/main/error_r1_c1.gif width=534 height=42 border=0></td>
   <td><img src=images/error/spacer.gif width=1 height=42 border=0></td>
  </tr>
  <tr>
   <td rowspan=2><img src=images/main/error_r2_c1.gif width=43 height=239 border=0></td>
   <td width=479 height=228 align=center bgcolor=#f7f7f7 class=htd><b>操作成功：</b><%=sucmsg%><br><a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一页</a></td>
   <td rowspan=2><img src=images/main/error_r2_c3.gif width=12 height=239 border=0></td>
   <td><img src=images/main/spacer.gif width=1 height=228 border=0></td>
  </tr>
  <tr>
   <td><img src=images/main/error_r3_c2.gif width=479 height=11 border=0></td>
   <td><img src=images/main/spacer.gif width=1 height=11 border=0></td>
  </tr>
</table><br>
</td></tr></table>
<%
end sub
	%>