<!--#include file="../../Inc/Cls_Main.Asp"-->
<!--#include file="../inc/Cls_Admin.Asp"-->
<!--#include file="../inc/Cls_MapPath.Asp"-->
<!--#include file="../Admin_Check.Asp"-->
<%
Dim CmsAdmin, ToUrl
ToUrl = CmsFun.LoadToUrl()
'=============================================================================
Set CmsAdmin = New Cls_Admin
CmsAdmin.SetAdminTitle = CmsSiteName
CmsAdmin.SetBodyCssName = "mainbody"
CmsAdmin.SetAdminPath = CmsAdminMapPath
CmsAdmin.LoadHead()
'=============================================================================
Dim Action
'=============================================================================
Action = Easp.Get("action")
Select Case Action
    Case "pageload"
        Call PageLoad()
    Case "delall"
        Call DelAll()
    Case Else
        Call PageLoad()
End Select
CmsAdmin.LoadFooter()
Set CmsAdmin = Nothing

Sub PageLoad()
    ChkSysAdminLevel "sys_manager", "show"
    '=====================================================================
%>
<div class="navigation"><a href="Admin.Role.List.Asp" class="back">角色管理</a> 控制面板 &gt; 管理员管理</div>
<div class="tools_box">
  <div class="tools_bar">
    <ul>
      <li><a href="Admin.Add.Asp" class="tools_btn"><span><b class="add">添加管理员</b></span></a></li>
      <li><a href="Admin.Role.List.Asp" class="tools_btn"><span><b class="return">角色管理</b></span></a></li>
      <li><a href="javascript:void(0);" onclick="checkAll(this);" class="tools_btn"><span><b class="all">全选</b></span></a></li>
      <li><a href="javascript:void(0);" onclick="return ExePostBack('确定要删除吗？','myform','?action=delall');" class="tools_btn"><span><b class="delete">批量删除</b></span></a></li>
      <li><a href="Admin.Index.Asp" class="tools_btn"><span><b class="refresh">刷新列表</b></span></a></li>
    </ul>
  </div>
</div>
<form id="myform" action="?action=delall" method="post">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable">
    <tr>
      <th width="5%">选择</th>
      <th width="35%" align="left">用户名</th>
      <th width="20%">角色</th>
      <th width="15%">上次登录时间</th>
      <th width="5%"> 状态 </th>
      <th width="10%">添加时间</th>
      <th width="10%"> 操作 </th>
    </tr>
    <%
    Dim ShowPage, oRs, PageNum, ArrayList, i, oSQL
    ShowPage = ""
    PageNum = 20
    '============================ page
    Easp.db.PageSize = PageNum
    Easp.db.SetPager "default", "<span class=""disableds"">总记录数:{recordcount},每页:{pagesize},页次:{pageindex}/{pagecount}</span> {first}{prev}{list}{next}{last}{jump}", Array("first:首　页", "last:尾　页", "prev:上一页", "next:下一页", "list:*")
    oSQL = "Select a.Id,a.AdminName,b.RoleName,a.LoginTime,a.IsLock,a.AddTime From ["& TablePrefix & "Admin] a "
    oSQL = oSQL & " Left Join ["& TablePrefix & "Admin_Role] b On a.RoleId = b.id "
    oSQL = oSQL & " Where 1 = 1 "
    oSQL = oSQL & " Order By a.id desc "
    Set oRs = Easp.db.GPR("1:p", oSQL)
    If Easp.IsN(oRs) Then
        Easp.C(oRs)
    Else
        ShowPage = Easp.db.GetPager("default")
        ArrayList = oRs.GetRows(PageNum)
    End If
    Easp.C oRs
    If IsArray(ArrayList) Then
        For i = 0 To UBound(ArrayList, 2)
    %>
    <tr align="center">
      <td><input type="checkbox" name="chkId" value="<%=ArrayList(0,i)%>" /></td>
      <td align="left"><%=ArrayList(1,i)%></td>
      <td><%=ArrayList(2,i)%></td>
      <td><%=CmsFun.TimeToString(ArrayList(3,i),"yyyy-mm-dd")%></td>
      <td><%=Easp.IIf(ArrayList(4, i) = 1, "<img title=""禁用"" src=""../images/icon_disable.png"" />", "<img title=""正常"" src=""../images/icon_correct.png"" />")%></td>
      <td><%=CmsFun.TimeToString(ArrayList(5,i),"yyyy-mm-dd")%></td>
      <td><a href="Admin.Edit.Asp?id=<%=ArrayList(0,i)%>">编辑</a></td>
    </tr>
    <%
        Next
    End If
    %>
  </table>
  <div class="line15"> </div>
  <div class="page_box">
    <div class="flickr right"><%=ShowPage%></div>
  </div>
</form>
<%
End Sub

Sub DelAll()
    ChkSysAdminLevel "sys_manager", "del"
    '=====================================================================
    Dim chkId, ResultVal
    chkId = Easp.Post("chkId:s")
    If Easp.IsN(chkId) Then
        CmsAdmin.JscriptMsg "对不起，请选中您要操作的记录！", "back", "Error", "null"
    Else
        ResultVal = Easp.db.DR(TablePrefix & "Admin", " id <> "& CmsFun.ChkNumEric(Easp.Cookie("ZjjCmsCms>AdminId")) &" And Id in("& chkId &") ")
        If ResultVal <> 0 Then
            CmsAdmin.JscriptMsg "批量删除成功！", ToUrl, "Success", "null"
        End If
    End If
End Sub
%>
