<!--#include file="Config.asp" -->
<div class='menu'>&nbsp;分类编辑</div>
<%
eTable = Prefix&eims
eSort = Prefix&eims&"Sort"
SortUrl = "Sort.asp?eims="&eims
ListUrl = "Sort.asp?eims="&eims
EditUrl = "SortEdit.asp?eims="&eims
Mgt("admin") 'Cookies : Permission

Select Case action
Case "SaveAdd" '保存添加
If Trim(Request.Form("SortName")) = "" Then WtMsg("请填写分类名称")
If Not isNumeric(Trim(Request.Form("SortSeq"))) Then WtMsg("分类排序必须为数字")
Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.Open "Select * From ["&eSort&"]",Conn,1,3
Rs.AddNew
Rs("ParentID")=Trim(Request.Form("ParentID"))
Rs("SortName")=Trim(Request.Form("SortName"))
Rs("SortSeq")=Int(Request.Form("SortSeq"))
Rs("SortSh")=Int(Request.Form("SortSh"))
Rs.Update
Rs.Close:Set Rs=Nothing
Response.Redirect SortUrl
Response.End
End Select
'------------------------------------------------
if SaveStr="" then SaveStr="SaveAdd"
If SortSeq<1 Then SortSeq = CreSeq(eims&"Sort")
SortID = int(request("ParentID")) '匹配分类调用
%>
<div class="content">
<Form name='eForm' method='post' action='?eims=<%=eims%>&action=<%=SaveStr%>'>
  <table width="100%" border="0" cellspacing="1" cellpAdding="1" align="center">
    <tr>
      <td align="center">所属分类</td>
      <td><select name="ParentID">
          <option value="0">一级分类</option>
		  <% ListSort(0) %>
          </select>
      </td>
    </tr>
    <tr>
      <td align="center">分类名称</td>
      <td><input name="SortName" type="text" value="<%=SortName%>"></td>
    </tr>
    <tr>
      <td align="center">分类排序</td>
      <td><input name="SortSeq" type="text" value="<%=SortSeq%>" size="4"></td>
    </tr>
    <tr>
      <td align="center">分类状态</td>
      <td><select name="SortSh">
          <option value="1">显示</option>
		  <option value="0" <%If SortSh="0" Then Response.Write("selected") %>>隐藏</option>
        </select></td>
    </tr>
    <tr>
      <td></td>
      <td><input type="submit" value="保 存">
        &nbsp;&nbsp;
        <input type="button" value="返 回" onClick="history.go(-1);">
      </td>
    </tr>    
  </table>
  </form>    
  <br>
</div>
<br>
</body></html>
<%Call CloseConn()%>
