<!--#include file="../inc/config.asp" -->
<!--#include file="../inc/conn.asp" -->
<!--#include file="inc/function.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p01")
'''''''''''''''''''''''''''''''''''''''''''''''
Dim id,newsarr,newsid,savepath,parentid
if(request.QueryString("id")<>"") then
	id=Cint(request.QueryString("id"))
	parentid=getparentid(id)
	if(parentid>0) then
		application.Lock()
		application(CachePrefix&"_catalogoption_"&parentid)=""
		application.UnLock()
	end if
	conn.execute("delete from catalogs where id="&id)
	set rs=server.createobject("adodb.recordset")
	rs.open "select id,pagepath,isoutlink from news where classid="&id,conn,3,1
	if not rs.eof and not rs.bof then
		newsarr=rs.GetRows()
		rs.close
		set rs=nothing
		Set fso = Server.CreateObject("Scripting.FileSystemObject")
		for i=0 to ubound(newsarr,2)
			newsid=newsarr(0,i)
			savepath=newsarr(1,i)
			isoutlink=newsarr(2,i)
			if(isoutlink=0) then
				if not fso.FileExists(server.MapPath("../"&savepath)) then  
 					Response.Write("<h1>Error:</h1>" & server.MapPath("../"&savepath)&" does not exist<p>") 							
 				else
 					fso.DeleteFile(server.MapPath("../"&savepath))
 					'Response.Write("<h1>成功删除文件:</h1>" & server.MapPath("../"&savepath))
 				end if
			end if
			conn.execute("delete from news where id="&newsid)
		next
		set fso=nothing	
	else
		rs.close
		set rs=nothing
	end if
	response.Write("<iframe src=""catalog_genjs.asp"" width=""0"" height=""0""></iframe>")
	response.Write("<script>alert(""成功删除栏目！"");location.href=""tree.asp"";</script>")
else
	response.Write("<script>alert(""没有此栏目！"");location.href=""tree.asp"";</script>")
end if

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>删除栏目</title>
</head>

<body>
</body>
</html>
<%
call connclose()
%>