<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
else
if request.cookies("sundxshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
end if
end if

dim categoryid,category,follows
categoryid=FormatSQL(SafeRequest("id",0))
category=FormatSQL(SafeRequest("sorts",0))
%>
<title>图书小类管理</title>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" BGCOLOR="#39867B">
  <tr BGCOLOR="#39867B"> 
    <td height="20" colspan="2" align="center"><font color="#FFFFFF">小类管理</font></td>
  </tr>
  <tr> 
    <td width="24%" height="37" valign="top" bgcolor="#FFFFFF" align="center"><br>
        <select name="select" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" ><base target=Right> 
          <option selected>选择分类</option>
          <%set rs=server.createobject("adodb.recordset")
		rs.Open "select * from category order by categoryorder",conn,1,1
		do while not rs.eof %>
          <option value="sclass.asp?id=<%=rs("categoryid")%>&category=<%=rs("category")%>" ><%=trim(rs("category"))%></option>
          <%rs.movenext
		loop
		rs.close
		set rs=nothing
		%>
        </select>
        <br>
        <%if FormatSQL(SafeRequest("id",0))<>"" then
        response.Write "当前查询："&FormatSQL(SafeRequest("category",0))
        end if%>
      </td>
    <td width="100%" bgcolor="#FFFFFF"><br>
	 <table width="90%" align="center" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
        <tr align="center" bgcolor="#FFFFFF" height="20"> 
          <td width="40%">分类名称</td>
          <td width="20%">分类排序</td>
          <td width="20%">显示</td>
          <td width="20%">确定操作</td>
        </tr>
        <%
        if categoryid="" then
        response.Write "<div align=center><font color=red>请选择左测的分类</font></div>"
        else
        set rs=server.CreateObject("adodb.recordset")
        rs.Open "select * from sorts where categoryid="&categoryid&" order by sortsorder",conn,1,1
         if rs.EOF and rs.BOF then
		  response.Write "<div align=center><font color=red>还没有分类</font></center>"
		  follows=0
		  else
         do while not rs.EOF
         %>
        <form name="form1" method="post" action="savesclass.asp?action=edit&id=<%=Trim(rs("sortsid"))%>&category=<%=FormatSQL(SafeRequest("category",0))%>">
          <tr align="center" bgcolor="#FFFFFF"> 
            <td><input name="sorts" type="text" id="sorts" size="16" value="<%=trim(rs("sorts"))%>">
                <input name="categoryid2" type="hidden" value="<%= categoryid %>" id="Hidden1"></td>
            <td><input name="sortsorder" type="text" id="sortsorder" size="4" value="<%=int(rs("sortsorder"))%>"></td>
            <td><select name="first" id="first">
			    <option value="0" <% if rs("first")=0 Then Response.write("Selected") %>>显示</option>
                <option value="1" <% if rs("first")=1 Then Response.write("Selected") %>>隐藏</option>
              </select>
              </td>
            <td><input type="submit" name="Submit" value="修 改">
                &nbsp;<a href="savesclass.asp?id=<%=int(rs("sortsid"))%>&action=del&categoryid=<%=SafeRequest("id",1)%>&category=<%=FormatSQL(SafeRequest("category",0))%>" onClick="return confirm('您确定进行删除操作吗？')"><font color=red>删除</font></a> 
              </td>
          </tr>
        </form>
        <%rs.movenext
        loop
        follows=rs.RecordCount
        rs.close
        set rs=nothing
        end if
        end if
				%>
      </table><br></td>
  </tr>
</table>
<br>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" BGCOLOR="#39867B">
  <tr BGCOLOR="#39867B"> 
    <td height="20" colspan="2" align="center"><font color="#FFFFFF">添加分类</font></td>
  </tr>
  <tr> 
    <td width="24%" valign="top" bgcolor="#FFFFFF" align="center"><br>
        当前分类：<%=FormatSQL(SafeRequest("category",0))%></div></td>
    <td width="100%" bgcolor="#FFFFFF" align="center"><br>
	 <table width="90%" align="center"border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
        <tr bgcolor="#FFFFFF" align="center" height="20"> 
          <td width="40%">分类名称</td>
          <td width="20%">分类排序</td>
          <td width="20%">显示</td>
          <td width="20%">确定操作</td>
        </tr>
        <form name="form2" method="post" action="savesclass.asp?action=add&category=<%=FormatSQL(SafeRequest("category",0))%>">
          <tr bgcolor="#FFFFFF" align="center"> 
            <td><input name="sorts2" type="text" id="sorts2" size="16"></td>
            <td><input name="sortsorder2" type="text" id="sortsorder2" size="4" value="<%=follows+1%>">
                <input name="categoryid" type="hidden" value="<%=categoryid%>"></td>
            <td><select name="first2" id="first2">
                <option value="0" selected>显示</option>
                <option value="1" >隐藏</option>
              </select></td>
            <td><input type="submit" name="Submit2" value="添 加"></td>
          </tr>
        </form>
      </table><br></td>
  </tr>
</table>
<br>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" BGCOLOR="#39867B">
  <tr> 
    <td height="20" BGCOLOR="#39867B" align="center"><font color="#FFFFFF">操作注意事项及说明</font></td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF"> <table width="80%" border="0" align="center" cellpadding="5" cellspacing="0">
        <tr> 
          <td height="16"><font color="#930000">·请注意分类名称不要含有非法字符。<br>
            ·增加一级分类时，如果没有选择此小类所属大类为一级分类，则被列为&quot;其它&quot;分类。<br>
            ·进行删除操作的同时，会删除此分类下的所有图书。</font></td>
        </tr>
      </table></td>
  </tr>
</table>
<!--#include file="footer.asp"-->
