<!--#include file=conn.asp-->
<!--#include file=cookies.asp-->
<!--#include file="../inc/function.asp"-->
<link href="inc_style.css" rel="stylesheet" type="text/css">
<script>
function loadThreadFollow(t_id,b_id){
	var targetImg =eval("document.all.followImg" + t_id);
	var targetDiv =eval("document.all.follow" + t_id);
	
	if ("object"==typeof(targetImg)){
		if (targetDiv.style.display!='block'){
			targetDiv.style.display="block";
			
		}else{
			targetDiv.style.display="none";
		}
	}
}
</script>
<%
dim rs,sql,sjcla1,i,k
if request("jle")="sjcla1" then
call add()
response.end
end if
if request("jle")="del" then
call del()
response.end
end if
k=1
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [sjcla1] order by paixu desc" 
rs.open sql,conn,1,1
%> 

<div align="center">
<center>
<form method="POST" action="?jle=sjcla1">
<table width="95%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#c5cfe0" bordercolordark="#FFFFFF" bgcolor="#C5D5E4"  style="font-size:12px; letter-spacing:1px;">
        <tr align="center" bgcolor="#FFFFFF" height="20"> 
<td align="center" height="29"  class="tdbar1" ><p align="center">大类总数:<font color="#ff0000"><b><%=rs.Recordcount%></b></font></td></tr>
<tr><td width="65%" height="25" align="center"  class="tdbar1" ><p>增加大类：<input type="text" name="sjcla1" size="20" value=""> </p></td></tr>
<tr><td width="65%" height="25" align="center"  class="tdbar1" style="border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"><p>排序数字：<input type="text" name="paixu" size="20" value="0"></td></tr>
<tr><td width="65%" height="25"  class="tdbar" style="border-top-style: none; border-top-width: medium"><p align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit" value="提交" name="B1"></td></tr>
</table>
</form>
</center>
</div>
<p align="center">改变分类后请点击“<a href="admin_shop_categories_html.asp"><font color="#0000FF">生成分类页面</font></a>”</p><div align="center"><center>
<table width="95%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#c5cfe0" bordercolordark="#FFFFFF" bgcolor="#C5D5E4"  style="font-size:12px; letter-spacing:1px;">
      <tr align="center" bgcolor="#FFFFFF" height="20"> 
<td align="center" height="29"  class="tdbar"><p align="center">编号</td>
	<td bgcolor="#FEEEBC" class="tdbar" align="center">名称</td>
	<td  height="25"  valign="bottom" width="130" colspan="3"  class="tdbar"><p align="center">操作</td>
	<td height="25"  valign="bottom" width="44"  class="tdbar" ><p align="center">排序</td></tr>
	<%do while not rs.eof%> 
	<tr><td width="50"  height="20"  valign="bottom"  class="tdbar1"><div align="center"><font color="#000000"><b><%=k%></b></font></div></td>
	<td width="175" height="30"  valign="bottom"  class="tdbar1"><p align="left"><font color="#FF0000"><span id="followImg<%=k%>" style="CURSOR: hand" onclick="loadThreadFollow(<%=k%>,5)"><img border="0" src="images/j.gif" width="15" height="15"><%=rs("sjcla1")%></span></font></td>
	<td width="31"  height="30"  valign="bottom"  class="tdbar1"><p align="center"><font color="#800000"><span style="text-decoration: none"><a href="?id=<%=rs("id")%>&jle=del"><font color="#FF0000">[删]</font></a></span></font></td>
	<td width="78"  height="30"  valign="bottom"  class="tdbar1"><p align="center"><font color="#FF0000">[</font><a href="#" ONCLICK="window.open('admin_shop_categories_add.asp?id=<%=rs("id")%>','Sample','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=400,height=150,left=100,top=100')"><font color="#FF0000">添加分类</font></a><font color="#FF0000">]</font></td>
	<td width="24"  height="30"  valign="bottom"  class="tdbar1"><p align="center"><font color="#800000"><span style="text-decoration: none"><a href="#" ONCLICK="window.open('admin_shop_categories_edit.asp?id=<%=rs("id")%>','Sample','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=325,height=100,left=100,top=100')"><font color="#FF0000">[修]</font></a></span></font></td>
	<td  height="20"  valign="bottom"  class="tdbar1"><p align="center"><font color="#FF0000"><%=rs("paixu")%></font></td></tr><tr style="display:none" id="follow<%=k%>">
			<td height="25" colspan="6"  valign="bottom"  class="tdbar1"><div ><center>
				<table cellpadding=0 width="100%" border="0" style="border-collapse: collapse" bordercolor="#111111" ><%
               dim rs1,sql1
               i=1
               set rs1 = Server.CreateObject("ADODB.RecordSet")
               sql1="select * from [sjcla2] where sjcla1="&cstr(rs("id"))&" order by paixu desc"
               rs1.open sql1,conn,1,1
               if rs1.eof then
               response.write "<tr><td><font color=""#ff0000""><p align=""center"">没有类别</font></td></tr>"
               else
               %> <tr><%do while not rs1.eof%> <td height=20 width="72"><p align="center"><font color="#666666"><%=i%></font></td>
						<td height=30 width="205" valign="bottom"><font color="#666666"><img border="0" src="images/-.gif" width="15" height="15"><%=rs1("sjcla2")%></font></td>
						<td height=30 width="39" valign="bottom"><font color="#800000"><span style="text-decoration: none"><a href="admin_shop_categories_del.asp?id=<%=rs1("id")%>"><font color="#666666">[删]</font></a></span></font></td>
						<td height=30 width="49" valign="bottom"><font color="#800000"><span style="text-decoration: none"><a href="#" ONCLICK="window.open('admin_shop_categories_edits.asp?paixu=<%=rs1("paixu")%>&sjcla1=<%=rs1("sjcla1")%>&sjcla2=<%=rs1("sjcla2")%>&classid=<%=rs1("id")%>','Sample','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=325,height=100,left=100,top=100')"><font color="#666666">[修]</font></a></span></font></td>
						<td height=30 width="73" valign="bottom">
						<%if rs1("hot")=1 then%><a href="#" ONCLICK="window.open('admin_shop_categories_add.asp?jle=hotx&sjcla2=<%=rs1("id")%>&sj=add','Sample','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=200,height=200,left=100,top=100')"><font color="#FF0000">热√</font></a><%else%><a href="#" ONCLICK="window.open('admin_shop_categories_add.asp?jle=hoty&sjcla2=<%=rs1("id")%>&sj=add','Sample','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=200,height=200,left=100,top=100')"><font color="#0000FF">热×</font></a><%end if%></td>
	<td height=30 width="53" valign="bottom"><p align="center"><font color="#666666"><%=rs1("paixu")%></font></td></tr><%
               i=i+1
			   rs1.movenext
			   loop
               end if
               rs1.close
               set rs1=nothing
               %> </table></center></div></td></tr><%
             k=k+1
			 rs.movenext
			 loop
			 %> </table></center></div><p align="center"><font color="#666666">说明：排序数字越大越靠前显示</font></p><%
rs.close
set rs=nothing
%> <%
sub add()
sjcla1=HtmlEncode(trim(request("sjcla1")))
if sjcla1="" then
response.write "<li>错误，类别为空！"
response.write "<meta http-equiv=refresh content=""2;URL=?"">"
response.end
end if
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [sjcla1] where sjcla1='"&trim(request("sjcla1"))&"'"  
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("sjcla1")=HtmlEncode(trim(request("sjcla1")))
rs("paixu")=trim(request("paixu"))
rs.update
response.write "<li>添加大类成功。"
response.write "<meta http-equiv=refresh content=""1;URL=?"">"
rs.close
set rs=nothing
else
response.write "<li>错误，名称已经存在！"
rs.close
set rs=nothing
response.write "<meta http-equiv=refresh content=""2;URL=?"">"
response.end
end if
end sub
sub del()
dim rs,sql1,sql2,id
id=trim(request("id"))
if not isnumeric(id) or id="" then
response.write "<li>参数错误！"
response.end
end if

set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [sjcla2] where sjcla1="&cstr(id)
rs.open sql,conn,1,1
if not rs.eof then
Response.Write "<script language='javascript'>alert('请先删除下面的小类!');history.back();</script>" 
rs.close
set rs=nothing
else

set rs=server.createobject("adodb.recordset")
sql1="delete from [sjcla1] where id="&cstr(id)
rs.open sql1,conn,1,3
sql="delete from [jle_shop] where sjcla1="&id&""
rs.open sql,conn,1,3
response.write "<font size=2>删除大类成功!</font><br>"
response.write "<meta http-equiv=refresh content=""1;URL=?"">"
end if
end sub
closedb
%>