<!--#include file=CONN.ASP-->
<%if session(hxCacheName&"_admin")<>"OK" then
    response.redirect("admin_login.asp")
    end if
 if request.cookies(hxCacheName&"_rank")("rank")>2 then
  	response.write "<script language='javascript'>"
	response.write "alert('您的级别不够！');"
	response.write "location.href='javascript:history.go(-1)';"			
	response.write "</script>"
    end if%>
<%
dim rs,sql,class1,k
if request("dick")="class1" then
call add()
response.end
end if
if request("dick")="del" then
call del()
response.end
end if
k=1
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [tt_WebType] order by Orderid" 
rs.open sql,conn,1,1
%>
<link href="../style.css" rel="stylesheet" type="text/css">
<BODY background="../images/back.gif">
<style type="text/css">
<!--
body {
	background-color: #dadae9;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size: 12;
}
.style2 {color: #FFFFFF;
	font-weight: bold;
}
.style3 {color: #FF0000}
-->
</style><div align="center">
  <center>
  <form method="POST" action="admin_fenlei.asp?dick=class1">
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#ADAED6" width="100%" height="68">

    <tr>
    <td height="28" width="322" bgcolor="#BDBEDE">
    <p class="main_title<%=skin%>"><span class="style2"><span style="font-size: 9pt"><font size="3"><font size="2">&nbsp;</font></font></span></span>分类总数：<%=rs.Recordcount%></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">
  <%dim maxorderid
maxorderid = hx.execute("select max(id) from tt_WebType")(0)+1%>
<p>排序数字：<input type="text" name="Orderid" size="20" value="<%=maxorderid%>"></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="#ADAED6" style="border-collapse: collapse">
           
			  <tr valign="middle" bgcolor="#BDBEDE">
              <td width="45" height="20" style="border-bottom-style: none; border-bottom-width: medium"> 
              <p align="center">编号</td>

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

              <td style="border-bottom-style: none; border-bottom-width: medium" height="20" colspan="2"> 
                <p align="center">操作</td>

              <td height="20" width="83" style="border-bottom-style: none; border-bottom-width: medium">
              <p align="center">排序</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"> 
              <%=rs("name")%></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 onclick='{if(confirm("您确定删除吗?此操作会造成已有链接类别不能正确显示!")){return true;}return false;}' href="admin_fenlei.asp?id=<%=rs("id")%>&dick=del">
                <font color="#FF0000">删除</font></a></span></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="#" ONCLICK="window.open('admin_fenleiedit.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=350,top=350')">
              [修]</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("Orderid")%></font></td>
             </tr>

            <%
             k=k+1
			 rs.movenext
			 loop
			 %>
         </table>
               </center>
</div>
<p align="center" >1.排序数字越小排越前，但最好不要有重复。您可以随意修改排序数字来修改分类的排列。<br>
2.如果删除了已有站点选择的类别，系统会将这些站点的网站类别设为0，即没有选择状态。您可以在全部类别中看到这些站点。
</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=admin_fenlei.asp"">"
response.end
end if
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [tt_WebType] where name='"&trim(request("class1"))&"'"  
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("name")=trim(request("class1"))
rs("Orderid")=trim(request("Orderid"))
rs.update
response.write "<li>添加大类成功。"
response.write "<meta http-equiv=refresh content=""1;URL=admin_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=admin_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 [tt_WebType] where id="&cstr(id)
rs.open sql1,conn,1,3
response.write "<font size=2>删除大类成功!</font><br>"
response.write "<meta http-equiv=refresh content=""1;URL=admin_fenlei.asp"">"
end sub
'closedb
%>
