<!--#include file="../conn/conn.asp"-->
<!--#include file="../conn/nosql.asp"-->
<!--#include file="../conn/config.asp"-->
<!--#include file="../conn/md5.asp"-->

<%if Not ChkPosturl then response.redirect ("login.asp")
if session("adminname")="" then
  response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
  response.End
end if
bigname=nosql(request.QueryString("bigname"))
if isChkInteger(request("bigclassid")) then
bigclassid=request("bigclassid")
else
Response.Redirect ("../index.asp")
end if
action=request.QueryString("action")
if action="add" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from mini_smllclass",conn,1,3
rs.AddNew
rs("smllname")=nosql(trim(request("smllname2")))
rs("smllid")=nosql(int(request("smllid2")))
rs("minipic")=nosql(trim(request("minipic2")))
rs("bigclassid")=nosql(int(request("bigclassid2")))
rs.Update
rs.Close
set rs=nothing
response.redirect "mini_smllclass.asp?bigclassid="&bigclassid&"&bigname="&bigname
end if
'//修改数据
if action="edit" then
if isChkInteger(request("smllclassid")) then
smllclassid=request("smllclassid")
else
Response.Redirect ("../index.asp")
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from mini_smllclass where id="&smllclassid,conn,1,3
rs("smllname")=nosql(trim(request("smllname")))
rs("smllid")=nosql(int(request("smllid")))
rs("minipic")=nosql(trim(request("minipic")))
rs("bigclassid")=nosql(trim(request("bigclassid")))
rs.update
rs.close
set rs=nothing
response.redirect "mini_smllclass.asp?bigclassid="&bigclassid&"&bigname="&bigname
end if
'//删除数据
if action="del" then
if isChkInteger(request("smllclassid")) then
smllclassid=request("smllclassid")
else
Response.Redirect ("../index.asp")
end if
conn.execute ("delete from mini_smllclass where id="&smllclassid)
conn.execute ("delete from mini_minilist where smllclassid="&smllclassid)
response.redirect "mini_smllclass.asp?bigclassid="&bigclassid&"&bigname="&bigname
end if
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/right_top2.gif">
  <tr>
    <td width="1%">&nbsp;</td>
    <td width="99%"><table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="30%" style="font-size:14px;color:#ffffff">&nbsp;<strong><font color="#000000">商品小类管理</font></strong></td>
          <td width="70%" align="right">&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table>
<br>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><IMG height=5 src="images/block.gif" width=1><br>
        <select name="select" class="wenbenkuang" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" >
          <option >选择分类</option>
          <%set rs=server.createobject("adodb.recordset")
		rs.Open "select * from mini_bigclass order by bigid",conn,1,1
		do while not rs.eof %>
          <option value="?bigclassid=<%=rs("id")%>&bigname=<%=rs("bigname")%>" <%if rs("id")=cint(request.QueryString("bigclassid")) then %>selected<%end if%>><%=trim(rs("bigname"))%></option>
          <%rs.movenext
		loop
		rs.close
		set rs=nothing
		%>
        </select>
        <%if request.QueryString("bigclassid")<>"" then
        response.Write "当前查讯："&request.QueryString("bigname")
        end if%>
    </td>
  </tr>
</table>
<table width="90%" border="0" cellpadding="3" cellspacing="1" align="center" bgcolor="#9DB2D4">
  <tr bgcolor="#C7D3E6">
    <td>
    <div align="center">分类名称</div></td>
    <td><div align="center">文件夹</div></td>
    <td>
    <div align="center">排序</div></td>
    <td>
    <div align="center">确定操作</div></td>
  </tr>
  <%
        if bigclassid="" then
        response.Write "<div align=center><font color=red>请选择左测的分类</font></div>"
        else
        set rs=server.CreateObject("adodb.recordset")
        rs.Open "select * from mini_smllclass where bigclassid="&bigclassid&" order by smllid",conn,1,1
         if rs.EOF and rs.BOF then
		  response.Write "<div align=center><font color=red>还没有分类</font></center>"
		  paixu=0
		  else
         do while not rs.EOF
         %>
  <form name="form1" method="post" action="?action=edit&smllclassid=<%=rs("id")%>&bigname=<%=request.QueryString("bigname")%>&bigclassid=<%=bigclassid%>">
    <tr bgcolor="#F0F3F8">
      <td>
        <div align="center">
          <input name="smllname" class="wenbenkuang" type="text" id="smllname" size="32" value="<%=trim(rs("smllname"))%>">
          <input name="bigclassid" class="wenbenkuang" type="hidden" value="<%=request.QueryString("bigclassid")%>" id="Hidden1">
      </div></td>
      <td><div align="center">
        <input name="minipic" type="text" class="wenbenkuang" id="minipic" value="<%=rs("minipic")%>" size="14">
      </div></td>
      <td>
        <div align="center">
          <input name="smllid" class="wenbenkuang" type="text" id="bigid" size="14" value="<%=int(rs("smllid"))%>">
      </div></td>
      <td>
        <div align="center">
          <input type="submit" name="Submit" class="go-wenbenkuang" value="立即修改">
&nbsp;<a href="?smllclassid=<%=int(rs("id"))%>&action=del&bigclassid=<%=request.QueryString("bigclassid")%>&bigname=<%=request.QueryString("bigname")%>" onClick="return confirm('您确定进行删除操作吗？')"><font color=red>删除该分类</font></a></div></td>
    </tr>
  </form>
  <%rs.movenext
        loop
        paixu=rs.RecordCount
        rs.close
        set rs=nothing
        end if
        end if
				%>
</table>
<br>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><IMG height=5 src="images/block.gif" width=1><font color="#000000">添加分类</font> 当前分类 <%=request.QueryString("bigname")%></td>
  </tr>
</table>
<table width="90%" border="0" cellpadding="3" cellspacing="1" bgcolor="#9DB2D4" align="center">
  <tr bgcolor="#C7D3E6">
    <td>
    <div align="center">分类名称</div></td>
    <td><div align="center">文件夹</div></td>
    <td>
    <div align="center">排序</div></td>
    <td>
    <div align="center">确定操作</div></td>
  </tr>
  <form name="form2" method="post" action="?action=add&bigname=<%=request.QueryString("bigname")%>&bigclassid=<%=bigclassid%>">
    <tr bgcolor="#F0F3F8">
      <td>
        <div align="center">
          <input name="smllname2" type="text" class="wenbenkuang" id="smllname2" size="32">
          <input name="bigclassid2" class="wenbenkuang" type="hidden" value="<%=request.QueryString("bigclassid")%>">
      </div></td>
      <td><div align="center">
        <input name="minipic2" class="wenbenkuang" type="text" id="minipic2" size="14">
      </div></td>
      <td>
        <div align="center">
          <input name="smllid2" class="wenbenkuang" type="text" id="smllid2" size="14" value="<%=paixu+1%>">
      </div></td>
      <td>
        <div align="center">
          <input type="submit" name="Submit2" class="go-wenbenkuang" value="添加">
      </div></td>
    </tr>
  </form>
</table>
<br>
</body>
</html>
