<%@ LANGUAGE=VBScript CodePage=65001%>
<% response.charset="utf-8" %>
<% session.codepage=65001 %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--#include file="../LyricInc/access.asp"  -->
<!-- #include file="LyricInc/functions.asp" -->
<!--#include file="../LyricInc/web_config.asp"  -->

	<%
Call header()
%>

	<table cellpadding='3' cellspacing='0' border='0' class='tableBorder' align=center>
	<tr>
	  <th width="100%" height=25 class='tableHeaderText'>删除栏目</th>
	
	<tr><td height="400" valign="top"  class='forumRow'><br>
	    <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="25" bgcolor="#B1CFF8"><div align="center"></div></td>
          </tr>
          <tr>
            <td height="100">
			<%page=request.querystring("page")
			act=request.querystring("act")
			keywords=request.querystring("keywords")
			article_id=cint(request.querystring("id"))

Select Case request.querystring("CType")
Case 1
JumpUrl="article_list.asp?act=search&cid="&article_id
sqlc="select [id] from [article] where cid='"&article_id&"' "
Case 4
JumpUrl="info_list.asp?act=search&cid="&article_id
sqlc="select [id] from [web_info] where cid='"&article_id&"' "
Case 5
JumpUrl="article_list.asp?act=search&cid="&article_id
sqlc="select [id] from [article] where cid='"&article_id&"' "
End Select 
'Content Check Start
set rsc=server.createobject("adodb.recordset")
rsc.open(sqlc),cn,1,1
if not rsc.eof then
response.Write "<script language='javascript'>alert('该栏目下已添加内容，请先到[内容管理]处删除内容后再删除栏目!');location.href='"&JumpUrl&"';</script>"

Else



'如果该栏目下有子栏目需要先删除该栏目下的下级栏目
	set rs=server.createobject("adodb.recordset")
sql="select [id] from [category] where pid="&article_id
rs.open(sql),cn,1,1
if not rs.eof then
response.Write "<script language='javascript'>alert('该栏目下存在子栏目，请先删除子栏目！');history.go(-1);</script>"
Else
rs.close
set rs=Nothing

	set rs=server.createobject("adodb.recordset")
sql="select [id],[folder],pid,ppid,ClassType from [category] where id="&article_id
rs.open(sql),cn,1,3

if rs("ppid")=1 Then
FolderPath="/"&rs("folder")
MFolderPath="/"&web_Folder&"/"&rs("folder")
end If

if rs("ppid")=2 then
set rs2=server.createobject("adodb.recordset")
sql="select [folder] from [category] where id="&rs("pid")
rs2.open(sql),cn,1,1
if not rs2.eof then
FolderPath="/"&rs2("folder")&"/"&rs("folder")
MFolderPath="/"&web_Folder&"/"&rs2("folder")&"/"&rs("folder")
end if
rs2.close 
set rs2=nothing
end if

if rs("ppid")=3 then
set rs3=server.createobject("adodb.recordset")
sql="select [folder],pid from [category] where id="&rs("pid")
rs3.open(sql),cn,1,1
if not rs3.eof then
set rs2=server.createobject("adodb.recordset")
sql="select [folder] from [category] where id="&rs3("pid")
rs2.open(sql),cn,1,1
if not rs2.eof then

FolderPath="/"&rs2("folder")&"/"&rs3("folder")&"/"&rs("folder")
MFolderPath="/"&web_Folder&"/"&rs2("folder")&"/"&rs3("folder")&"/"&rs("folder")
end if
rs2.close 
set rs2=nothing
end if
rs3.close 
set rs3=nothing
end if

Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath(FolderPath)) Then
call DelFolder(FolderPath)
end If
'Mobile Folder Del
FolderPath=MFolderPath
Set Fso=Server.CreateObject("Scripting.FileSystemObject") 
If Fso.FolderExists(Server.MapPath(FolderPath))  And  web_Show=0 Then
call DelFolder(FolderPath)
end if


rs.delete
response.Write "<script language='javascript'>alert('删除成功！');location.href='category_list.asp?page="&page&"&act="&act&"&keywords="&keywords&"';</script>"
rs.close
set rs=nothing
end If

End if
rsc.close
set rsc=Nothing

			%></td>
          </tr>
        </table>
	    </td>
	</tr>
	</table>


<%
Call DbconnEnd()
 %>