<!--#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 "SaveMod" '保存修改
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&"] Where ItemID="&ItemID,Conn,1,3
Rs("ParentID")=Trim(Request.Form("ParentID"))
Rs("SortName")=Trim(Request.Form("SortName"))
Rs("SortSeq")=Trim(Request.Form("SortSeq"))
Rs("SortSh")=Trim(Request.Form("SortSh"))
Rs.Update
Rs.Close:Set Rs=Nothing
Response.Redirect SortUrl
Response.End
'================================================
'显示编辑项
'================================================
Case "Edit"
Set Rs2=Server.CreateObject("Adodb.RecordSet")
Rs2.Open "Select * From ["&eSort&"] Where ItemID="&ItemID,Conn,1,1
ParentID = Int(Rs2("ParentID"))
SortName = Trim(Rs2("SortName"))
SortSeq = Trim(Rs2("SortSeq"))
SortSh = Trim(Rs2("SortSh"))
Rs2.Close:Set Rs2=Nothing
End Select
'------------------------------------------------
If SortSeq = "" Then SortSeq = 1
SortID = ParentID '匹配分类调用

%>
<div class="content">
<Form name='eForm' method='post' action='?eims=<%=eims%>&action=SaveMod&ItemID=<%=ItemID%>'>
  <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()%>
