<!--#include file="../conn.asp"-->
<!--#include file="admin_check.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="../inc/editor/class_fckeditor.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>管理页面</title>
<link id="maincss" rel="stylesheet" href="images/css/admin_style_<%= AdminSkin %>.css" type="text/css" media="all" />
<script language="javascript">
function CheckAll()
{
var length = document.formed.checkbox.length;
var tocheck = document.formed.SelectAll.checked;

  if (length>=2)
  {
    for (var i=0; i<length; i++){document.formed.checkbox[i].checked = tocheck;}
   }
  else
  {
    document.formed.checkbox.checked = tocheck;    
  }
   
}
</script>
</head>
<body leftmargin="0" bottommargin="0" rightmargin="0" topmargin="5" marginheight="0" marginwidth="0" bgcolor="#DDEEFF">
<%
Call chkFlag(8)
Dim act
act=Trim(Request.QueryString("act"))
opendb
Select Case act
	Case "del"
	  Call del()
	Case else
	   Call Main()
End Select
closedb

Sub DEL()
   dim id
   id=Trim(Request.QueryString("id"))
   IF ID="" Then ID=Trim(Request.Form("checkbox"))
   if ID<>"" then
      conn.execute("delete from "&predb&"Workload where id in("&id&")")
      Call SendMsg("统计删除成功")
	  Response.Write("<script>setTimeout(""location.href='?'"",2000)</script>")
   else
	  Response.Write("<script>location.href='?'</script>")
   end if
	  
End Sub

Sub Main()
dim rs,i,c,rs1,sql,j,recU,str

Dim idcount,maxperpage,n,page,minid
maxperpage=25
page=clng(Request.QueryString("page"))
        set rs=conn.execute("select count(id) from "&predb&"Workload")
		idcount=rs(0) 
		set rs=nothing
		
		If idcount Mod maxperpage = 0 Then
			n = idcount \ maxperpage
		else
			n = idcount \ maxperpage + 1
		end If
		
IF page>n then page=n
IF page<1 then page=1

		if page=1 then
           set rs=conn.execute("select top "&maxperpage&" * from "&predb&"Workload order by id desc")
		else
			set rs1=conn.execute("select min(id) from (select top "&(page-1)*maxperpage&" id from "&predb&"Workload order by id desc) d")
			    minid=rs1(0)
			set rs1=nothing
			set rs=conn.execute("select top "&maxperpage&" * from "&predb&"Workload where id<"&minid&" order by id desc")
		end if
%>
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
  <tr>
	<th height="25" colspan="6" align="left">管理工作量统计</th>
  </tr>
  <form method="post" action="?act=del" name="formed" onSubmit="return confirm('请确认您的操作？');">
  
  <tr>
    <td width="6%" align="center" class="TableRow1"><strong>选择</strong></td>
    <td align="center" class="TableRow1"><strong>操作内容</strong></td>
    <td width="12%" align="center" class="TableRow1"><strong>操作者</strong></td>
    <td width="12%" align="center" class="TableRow1"><strong>属性</strong></td>
    <td width="16%" align="center" class="TableRow1"><strong>操作时间</strong></td>
    <td width="14%" align="center" class="TableRow1"><strong>管理</strong></td>
  </tr>
  <%
  do while not rs.eof
i=i+1
if i mod 2=0 then
  c=1
else
  c=2
end if
  %>
  <tr>
    <td align="center" class="TableRow<%= c %>"><input name="checkbox" type="checkbox" value="<%= rs("id") %>"></td>
    <td class="TableRow<%= c %>"><%= rs("wtext") %></td>
    <td align="center" class="TableRow<%= c %>">
	<%
	IF rs("wtype")=0 Then
	   Set rs1=conn.execute("select userid from "&predb&"user where id="&rs("wid") )
	   IF not(rs1.bof and rs1.eof) 	Then
	   Response.Write("<a href=""../user/userinfo.asp?id="&rs("wid")&""" target=""_blank"">"&rs1(0)&"</a>")
	   End IF
	Else
	   set rs1=conn.execute("select adminname from "&predb&"admin where id="&rs("wid") )
	   IF not(rs1.bof and rs1.eof) 	Then
	   Response.Write(rs1(0))
	   End IF
	End IF
	   set rs1=nothing
	%>
    </td>
    <td align="center" class="TableRow<%= c %>">
    <%IF rs("wtype")=0 then Response.Write("专家") else Response.Write("管理员")%>
    </td>
    <td align="center" class="TableRow<%= c %>"><%= rs("wtime") %></td>
    <td align="center" class="TableRow<%= c %>"><a href="?act=del&id=<%= rs("id") %>" onClick="return confirm('请确认您的操作？');">删除</a></td>
  </tr>
  <% 
  rs.movenext
  loop
  %>
  <tr>
    <td colspan="8" align="center" class="TableRow1">共<b><%= idcount %></b>则 <font color="#FF0000"><%= page %></font>/<%= n %>页&nbsp;&nbsp; <a href="?page=1">首页</a>&nbsp;&nbsp; <a href="?page=<%= page-1 %>">上一页</a>&nbsp;&nbsp; <a href="?page=<%= page+1 %>">下一页</a>&nbsp;&nbsp; <a href="?page=<%= n %>">尾页</a></td>
  </tr>
  <tr>
    <td colspan="6" class="TableRow1"><label><input type="checkbox" name="SelectAll" id="SelectAll" onClick="CheckAll()">全选\全不选</label>
    &nbsp; <input type="submit" name="button" id="button" value="删除选中"></td>
  </tr>
  </form>
</table>
<%
set rs=nothing
End Sub
%>
<br>
</body>
</html>
