<!--#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
'=============================================================================
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 "px"
        Call Px()
    Case "delall"
        Call DelAll()
    Case Else
        Call PageLoad()
End Select
CmsAdmin.LoadFooter()
Set CmsAdmin = Nothing

Sub PageLoad()
%>
<div class="navigation"><a href="Admin.Index.Asp" class="back">留言管理</a> 插件管理 &gt; 留言管理 &gt; 分类管理 </div>
<div class="tools_box">
  <div class="tools_bar">
    <ul>
      <li><a href="Admin.Type.Add.Asp" class="tools_btn"><span><b class="add">添加分类</b></span></a></li>
      <li><a href="javascript:GetSubmit('myform','?action=px')" class="tools_btn"><span><b class="send">保存排序</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.Type.List.Asp" class="tools_btn"><span><b class="refresh">刷新列表</b></span></a></li>
    </ul>
  </div>
</div>
<form id="myform" action="?action=px" method="post">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="msgtable">
    <tr>
      <th width="10%">选择</th>
      <th width="10%">编号</th>
      <th align="left" width="40%">分类名称</th>
      <th width="15%">排序</th>
      <th width="15%">添加时间</th>
      <th width="10%">操作</th>
    </tr>
    <%
    Dim oRs, i, arrList
    Set oRs = Easp.db.GR(TablePrefix & "BookType:Id,CnName,Px,AddTime", "", " Px Asc,Id Desc")
    If Easp.IsN(oRs) Then
    %>
    <tr>
      <td align="center" colspan="6">暂无记录</td>
    </tr>
    <%
    Else
        arrList = oRs.GetRows()
    End If
    Easp.C oRs
    If IsArray(arrList) Then
        For i = 0 To UBound(arrList, 2)
    %>
    <tr align="center">
      <td><input type="checkbox" name="chkId" value="<%=arrList(0,i)%>" /></td>
      <td><%=arrList(0,i)%></td>
      <td align="left"><%=arrList(1,i)%></td>
      <td><input type="hidden" name="hidId" value="<%=arrList(0,i)%>" />
        <input type="text" class="txtInput2 w50" name="Px" value="<%=arrList(2,i)%>" maxlength="5" onfocus="ChkNumEric(this)" autocomplete="off" /></td>
      <td><%=CmsFun.TimeToString(arrList(3,i),"yyyy-mm-dd")%></td>
      <td><a href="Admin.Type.Edit.Asp?id=<%=arrList(0,i)%>">编辑</a></td>
    </tr>
    <%
        Next
    End If
    %>
  </table>
</form>
<%
End Sub

Sub Px()
    Dim hidId, Px, i, spHidId, spPx
    hidId = Replace(Easp.Post("hidId:s"), ", ", ",")
    Px = Replace(Easp.Post("Px:s"), ", ", ",")
    If Easp.IsN(hidId) Then
        CmsAdmin.JscriptMsg "对不起，请选中您要操作的记录！", "back", "Error", "null"
    End If
    spHidId = Split(hidId, ",")
    spPx = Split(Px, ",")
    For i = 0 To UBound(spHidId)
        Easp.db.UR TablePrefix & "BookType", " Id = "& spHidId(i) &" ", Array("px:" & spPx(i))
    Next
    CmsAdmin.JscriptMsg "批量排序成功！", "Admin.Type.List.Asp", "Success", "null"
End Sub

Sub DelAll()
    Dim chkId, ResultVal
    chkId = Easp.Post("chkId:s")
    If Easp.IsN(chkId) Then
        CmsAdmin.JscriptMsg "对不起，请选中您要操作的记录！", "back", "Error", "null"
    Else
        ResultVal = Easp.db.DR(TablePrefix & "BookType", "Id:" & chkId)
        If ResultVal <> 0 Then
            CmsAdmin.JscriptMsg "批量删除成功！", "Admin.Type.List.Asp", "Success", "null"
        End If
    End If
End Sub
%>
