<!--#include file="../siteconfig/conn.asp"-->
<%
if session("adminlogin")<>sessionvar then
Response.Write("<script language=javascript>alert('你尚未登录，或者超时了！请重新登录');this.location.href='login.asp';</script>")
Response.End
End if
%>
<!--#include file="Admin_ClassFunction.asp"-->
<HTML>
<HEAD>
<TITLE>分类管理</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<LINK REL="stylesheet" HREF="css.css" TYPE="text/css">
</HEAD>
<script language="JavaScript" type="text/javascript" src="js.js"></script>
<BODY>
<%dim Menu,Class_Name,Class_Id,DelClass_Id
Class_Id=Request("Class_Id")
DelClass_Id=Request("DelClass_Id")
Menu=Request("Menu")
if Menu="DelClass" then
   rs.open "select Class_Id from Class where Class_TopClassId="&DelClass_Id,conn,1,3
   if not rs.eof then
      Response.Write("<script language=javascript>alert('请先删除下级分类');javascript:history.go(-1)</script>")
	  Response.End()
   end if
   rs.close
   rs.open "select UrlClass_Id from UrlClass where UrlClass_ClassId="&DelClass_Id,conn,1,3
   while not rs.eof
       conn.execute "delete from Url where Url_UrlClassId="&rs("UrlClass_Id")
   rs.movenext
   wend
   rs.close
   
   conn.execute "delete from UrlClass where UrlClass_ClassId="&DelClass_Id
   
   rs.close
   conn.execute "delete from Class where Class_Id="&DelClass_Id
          Response.Write("<script language=javascript>alert('分类删除成功');this.location.href='?Class_Id="&Class_Id&"';</script>")
	      Response.End()
end if
%>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EEEEEE">
  <tr>
    <td width="45%">删除分类</td>
    <td width="55%" align="right"><a href="#" onClick="javascript:DivOpenClose('',2,'','');return false">关闭</a></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td colspan="2"><div align="center"><br />
	<font color="#FF0000" ><b>注意删除此分类，包括同时删除子分类和子分类下的所有网址！</b></font>
	<br />
	  <%rs.open "select Class_Id from Class where Class_Id="&Class_Id,conn,1,3
	        if rs.eof and rs.bof then%>
			<a href="#" onClick="javascript:parent.window.location.reload();DivOpenClose('',2,0,0);return false">没有找到分类ID或该分类已删除,点击返回！</a>
			<%Response.End()
			end if
			rs.close%>
      <form name="form1" method="post" action="?Menu=DelClass">
<select name="DelClass_Id" class="inputcss" id="DelClass_Id">
<%
set RsClass(0)=server.createobject("adodb.recordset")
RsClass(0).open "select Class_Id,Class_Name from Class where Class_Id="&Class_Id,conn,1,3
while not RsClass(0).eof
   if rs("Class_Id")=Class_Id then
		response.write "<option value='"&RsClass(0)("Class_Id")&"' selected>"&RsClass(0)("Class_Name")&"</option>"&vbCrLf
   else
   		response.write "<option value='"&RsClass(0)("Class_Id")&"'>"&RsClass(0)("Class_Name")&"</option>"&vbCrLf
	end if
	call Dellistunder(1)
	RsClass(0).movenext
wend
%>
</select><br /><br /><input name="Class_Id" type="hidden" value="<%=Class_Id%>">
        <input name="Submit" type="submit" class="SubmitCss" onClick='javascript:return confirm("确定要删除此分类包括？同时删除子分类和子分类下的所有网址！？");' value="确定删除">
      </form>
      </div></td>
  </tr>
</table>
</BODY>
</HTML>

