<!--#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()
    Dim oRs, Id, CnName, Px
    Id = Easp.Get("id:n:0")
    If Id = 0 Then
        CmsAdmin.JscriptMsg "参数错误！", "back", "Error", "null"
    End If
    Set oRs = Easp.db.GR(TablePrefix & "AttrType:Id,CnName,Px:1", " Id = "& Id &" ", "")
    If Easp.IsN(oRs) Then
        CmsAdmin.JscriptMsg "不存在的数据！", "back", "Error", "null"
    Else
        CnName = oRs("CnName")
        Px = oRs("Px")
    End If
    Easp.C oRs
%>
<script src="<%=CmsAdminMapPath%>js/check/public.type.check.js"></script>
<form name="myform" id="myform" method="post" action="?action=savemain">
  <input type="hidden" name="id" value="<%=Id%>" />
  <div class="navigation"><a href="Admin.Attr.List.Asp" class="back">属性管理</a>控制面板 &gt; 系统频道管理 &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" value="<%=CnName%>" autocomplete="off" datatype="*2-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="<%=Px%>" 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_channel", "edit"
    '=====================================================================
    Dim Id, CnName, Px
    Id = Easp.Post("id:n:0")
    If Id = 0 Then
        CmsAdmin.JscriptMsg "参数错误！", "back", "Error", "null"
    End If
    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
    '=====================================================================
    ResultVal = Easp.db.UR(TablePrefix & "AttrType", " Id = "& Id &" ", List.Hash)
    '=====================================================================
    Easp.C List
    If ResultVal <> 0 Then
        CmsAdmin.JscriptMsg "编辑属性分类成功！", "Admin.Attr.Type.List.Asp", "Success", "null"
    End If
    '=====================================================================
End Sub
%>
