<!--#include file=CONN.ASP-->
<!--#include file=cookies.asp-->
<%
dim flag
flag=request.cookies("foxwww")("fox")
if flag<8 then
response.Write "<script LANGUAGE='javascript'>alert('你目前的级别不允许此操作！');history.go(-1);</script>"
response.end
end if
if flag=10 then
response.Write "<script LANGUAGE='javascript'>alert('您只是后台测试员，请注意身份！');window.location='right.asp';</script>"
response.end
end if
%>
<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,class1,i,k
if request("fox")="class1" then
call add()
response.end
end if
if request("fox")="del" then
call del()
response.end
end if
k=1
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [FOX_class1] order by paixu desc" 
rs.open sql,conn,1,1
%>
<link rel="stylesheet" type="text/css" href="../fox.CSS">
<style type=text/css>
BODY{
	margin:0px;
	FONT-SIZE: 12px;
	FONT-FAMILY: "宋体", "Verdana", "Arial", "Helvetica", "sans-serif";
	background-color: #CCCC99; 
	scrollbar-highlight-color: #CC9933; 
	scrollbar-arrow-color: #FFFFFF; 
	scrollbar-base-color: #CC9933
}
table { border:0px; }
td { font:normal 12px 宋体; }
img { vertical-align:bottom; border:0px; }
a { font:normal 12px 宋体; color:#111111; text-decoration:none; }
a:hover { color:#384780;text-decoration:underline; }
.sec_menu { border-left:2px solid #CC3300; border-right:2px solid #CC3300; border-bottom:2px solid #CC3300; overflow:hidden; background:#ffffff; }
.menu_title {background-color: #335EA8;color: white;font-size: 12px;font-weight:bold;height: 25; }
.menu_title span { position:relative; top:2px; left:8px; color:#FFFF00; font-weight:bold; }
.menu_title2 {background-color: #335EA8;color: white;font-size: 12px;font-weight:bold;height: 25; }
.menu_title2 span { position:relative; top:2px; left:8px; color:#FEFEFE; font-weight:bold; }
input,select,Textarea{
font-family:宋体,Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
</style>
<div align="center">
  <center>
  <form method="POST" action="fenlei.asp?fox=class1">
  <table border="1" cellpadding="0" cellspacing="0" style="border-width:1px; border-collapse: collapse" bordercolor="#CC0000" width="100%" height="68">
    <tr>
    <td height="28" width="322" bgcolor="#CC0000">
    <p class="style1"><span class="style2"><span style="font-size: 9pt"><font size="2">&nbsp;</font></span></span><font color="#FFFFFF">分类总数：<%=rs.Recordcount%></font></td>
    </tr>
    <tr>
      <td width="322" height="21" align="center" style="border-bottom-style: none; border-bottom-width: medium">

<p>增加大类：<input type="text" name="class1" size="20" value=""> </p>

      </td>
    </tr>
    <tr>
      <td width="322" height="25" align="center" 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="322" height="25" 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" style="color: #000000; border: 0px solid #000000; background-color: #eeeeee"></td>
    </tr>
  </table>
  </form>
  </center>
</div>
             <div align="center">
               <center>
             <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CC0000" style="border-width:1px; border-collapse: collapse">
           
			  <tr valign="middle" bgcolor="#BDBEDE">
              <td width="45" height="20" style="border-bottom-style: none; border-bottom-width: medium" bgcolor="#CC0000"> 
              <p align="center"><font color="#FFFFFF">编号</font></td>

              <td width="364" height="28" bgcolor="#CC0000" style="border-bottom-style: none; border-bottom-width: medium"> 
                <font color="#FFFFFF">名称</font></td>

              <td style="border-bottom-style: none; border-bottom-width: medium" height="20" colspan="3" bgcolor="#CC0000"> 
                <p align="center"><font color="#FFFFFF">操作</font></td>

              <td height="20" width="83" style="border-bottom-style: none; border-bottom-width: medium" bgcolor="#CC0000">
              <p align="center"><font color="#FFFFFF">排序</font></td>
             </tr>
             <%do while not rs.eof%>
			  <tr bgcolor="#FFFFFF">
              <td width="45" height="20"  valign="bottom" bgcolor="#FAFAFA" style="border-bottom-style: none; border-bottom-width: medium; border-left-style:none; border-left-width:medium; border-top-style:none; border-top-width:medium"> 
               <div align="center">
                 <font color="#000000"><%=k%></font></div>
              </td>

              <td width="364" height="20"  valign="bottom" style="border-bottom-style: none; border-bottom-width: medium; border-top-style:none; border-top-width:medium"> 
              <p align="left"> 
              <font color="#FF0000"> 
              <span id="followImg<%=k%>" style="CURSOR: hand" onclick="loadThreadFollow(<%=k%>,5)"><%=rs("class1")%></span></font></td>

              <td width="57" height="20"  valign="bottom" bgcolor="#FAFAFA" style="border-bottom-style: none; border-bottom-width: medium; border-top-style:none; border-top-width:medium"> 
              <p align="center"> 
                <span style="text-decoration: none"><a href="fenlei.asp?id=<%=rs("id")%>&fox=del">
              [删]</a></span></td>

              <td width="142" height="20"  valign="bottom" style="border-bottom-style: none; border-bottom-width: medium; border-top-style:none; border-top-width:medium"> 
              <p align="center">[<a href="fenlei_2.asp?id=<%=rs("id")%>">添加分类</a>]</td>

              <td width="44" height="20"  valign="bottom" bgcolor="#FAFAFA" style="border-bottom-style: none; border-bottom-width: medium; border-top-style:none; border-top-width:medium"> 
              <p align="center"> 
                <span style="text-decoration: none"><a href="fenleiedit.asp?id=<%=rs("id")%>">
              [修]</a></span></td>

              <td height="20"  valign="bottom" style="border-bottom-style: none; border-bottom-width: medium; border-right-style:none; border-right-width:medium; border-top-style:none; border-top-width:medium">
              <p align="center"><font color="#FF0000"><%=rs("paixu")%></font></td>
             </tr>
			  <tr bgcolor="#eeeeee" id="follow<%=k%>" style="display:none">
              <td height="20" colspan="6"  valign="bottom"> 
               
               <div >
                 <center>
                   <table cellpadding=0 cellspacing=0 width="90%" border="0" style="border-collapse: collapse" bordercolor="#111111" >
               <%
               dim rs1,sql1
               i=1
               set rs1 = Server.CreateObject("ADODB.RecordSet")
               sql1="select * from [FOX_class2] where class1="&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=20 width="200">
               <font color="#666666"><%=rs1("class2")%></font></td>
                 <td height=20 width="27"> 
              <font color="#800000"><span style="text-decoration: none"><a href="fenlei_2editdel.asp?id=<%=rs1("id")%>&fox=del">
              <font color="#666666">[删]</font></a></span></font></td>
                 <td height=20 width="29"> 
              <font color="#800000"><span style="text-decoration: none"><a href="fenlei_2edit.asp?paixu=<%=rs1("paixu")%>&class1=<%=rs1("class1")%>&class2=<%=rs1("class2")%>&classid=<%=rs1("id")%>">
              <font color="#666666">[修]</font></a></span></font></td>
                 <td height=20 width="31">　</td>
                 <td height=20 width="46">
                 <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" class="style3">说明：排序数字越大越靠前显示！</p>

<%
rs.close
set rs=nothing
%>
<%
sub add()
class1=trim(request("class1"))
if class1="" then
response.write "<li>错误，类别为空！"
response.write "<meta http-equiv=refresh content=""2;URL=fenlei.asp"">"
response.end
end if
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [FOX_class1] where class1='"&trim(request("class1"))&"'"  
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("class1")=trim(request("class1"))
rs("paixu")=trim(request("paixu"))
rs.update
response.write "<li>添加大类成功。"
response.write "<meta http-equiv=refresh content=""1;URL=fenlei.asp"">"
rs.close
set rs=nothing
else
response.write "<li>错误，名称已经存在！"
rs.close
set rs=nothing
response.write "<meta http-equiv=refresh content=""2;URL=fenlei.asp"">"
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")
sql1="delete from [FOX_class1] where id="&cstr(id)
rs.open sql1,conn,1,3
sql2="delete from [FOX_class2] where class1="&id&""
rs.open sql2,conn,1,3
sql="delete from [FOX_xinxi] where class1="&id&""
rs.open sql,conn,1,3
response.write "<font size=2>删除大类成功!</font><br>"
response.write "<meta http-equiv=refresh content=""1;URL=fenlei.asp"">"
end sub
closedb
%>