<!--#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 "savemain"
        Call SaveMain()
    Case Else
        Call PageLoad()
End Select
CmsAdmin.LoadFooter()
Set CmsAdmin = Nothing

Sub PageLoad()
%>
<script src="<%=CmsAdminMapPath%>js/check/public.type.check.js"></script>
<form name="myform" id="myform" method="post" action="?action=savemain">
  <div class="navigation"><a href="Admin.Type.List.Asp" class="back">分类管理</a> 插件管理 &gt; 幻灯片管理 &gt; 分类管理 &gt; 添加分类 </div>
  <div id="contentTab">
    <div class="content-tab">
      <ul class="tab_nav">
        <li><a onclick="tabs(this);" class="selected" href="javascript:void(0);">添加分类</a></li>
      </ul>
    </div>
    <div class="tab_con" style="display: block;">
      <table class="form_table">
        <col width="200px">
          </col>
        
        <tbody>
          <tr>
            <th> 分类名称： </th>
            <td class="td2"><input type="text" class="txtInput w250" name="CnName" id="CnName" autocomplete="off" datatype="*4-150" nullmsg="分类名称必须填写" errormsg="至少4个字符,最多150个字符!" />
              <span class="Validform_checktip">*</span></td>
          </tr>
          <tr>
            <th> 分类排序： </th>
            <td class="td2"><input type="text" class="txtInput w100" name="Px" id="Px" autocomplete="off" value="100" datatype="px" nullmsg="排序必须填写" errormsg="只能是数字越小越排前,不可为：0,最多5位数" />
              <span class="Validform_checktip">*</span></td>
          </tr>
          <tr>
            <th></th>
            <td><input type="submit" class="btnSubmit" value="提交保存" />
              &nbsp;
              <input name="重置" type="reset" class="btnSubmit" value="重 置" /></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</form>
<%
End Sub

Sub SaveMain()
    ChkSysAdminLevel "sys_hdp", "add"
    '=====================================================================
    Dim CnName, Px
    CnName = Trim(Easp.Post("CnName:s"))
    Px = Easp.Post("Px:n:0")
    '=====================================================================
    If Easp.IsN(CnName) Then
        CmsAdmin.JscriptMsg "分类名称,不可为空！", "back", "Error", "null"
    End If
    If Px = 0 Then
        CmsAdmin.JscriptMsg "排序必须填写！", "back", "Error", "null"
    End If
    '=====================================================================
    Dim List, ResultVal
    Easp.Use "list"
    Set List = Easp.List.New
    List("CnName") = CnName
    List("Px") = Px
    List("AddTime") = Now()
    '=====================================================================
    ResultVal = Easp.db.AR(TablePrefix & "HdpType:id", List.Hash)
    '=====================================================================
    Easp.C List
    If ResultVal <> 0 Then
        CmsAdmin.JscriptMsg "添加幻灯片分类成功！", "Admin.Type.List.Asp", "Success", "null"
    End If
    '=====================================================================
End Sub
%>
