<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/function.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p02")
'''''''''''''''''''''''''''''''''''''''''''''''
BeginTime=Timer
dim act,newsidStr,newsidArr,newsUrl,isoutlink
if not isempty(request.Form("act")) then
	act=request.Form("act")
else
	response.Write("请选择操作方式")
	response.Write("<a href=""#"" onClick=""javascript:history.back();"">返回</a>")
	response.End()
end if
if not isempty(request.Form("newsid")) then
	newsidStr=request.Form("newsid")
else
	response.Write("请选择需要操作的文章记录")
	response.Write("<a href=""#"" onClick=""javascript:history.back();"">返回</a>")
	response.End()
end if
newsidArr=split(newsidStr,",")
Select Case LCase(act)
	Case "check"
		for i=0 to ubound(newsidArr)
			response.Write(newsidArr(i))
			conn.execute("update news set checked=true where id="&newsidArr(i))
		next
		response.Write("批量审核成功！")
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	Case "nocheck"
		for i=0 to ubound(newsidArr)
			response.Write(newsidArr(i))
			conn.execute("update news set checked=false where id="&newsidArr(i))
		next
		response.Write("批量取消审核成功！")		
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	Case "notrecomme"
		for i=0 to ubound(newsidArr)
			response.Write(newsidArr(i))
			conn.execute("update news set recommend=false where id="&newsidArr(i))
		next
		response.Write("批量取消推荐成功！")		
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	Case "recomme"
		for i=0 to ubound(newsidArr)
			response.Write(newsidArr(i))
			conn.execute("update news set recommend=true where id="&newsidArr(i))
		next
		response.Write("批量推荐成功！")		
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	Case "nottop"
		for i=0 to ubound(newsidArr)
			response.Write(newsidArr(i))
			conn.execute("update news set totop=0 where id="&newsidArr(i))
		next
		response.Write("批量取消置顶成功！")		
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	Case "top"
		for i=0 to ubound(newsidArr)
			response.Write(newsidArr(i))
			conn.execute("update news set totop=1 where id="&newsidArr(i))
		next
		response.Write("批量置顶成功！")		
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	Case "del"
		for i=0 to ubound(newsidArr)
			response.Write(newsidArr(i))
			newsUrl=conn.execute("select pagepath from news where id="&newsidArr(i))(0)
 			isoutlink=Cint(conn.execute("select isoutlink from news where id="&newsidArr(i))(0))
 			if(isoutlink=0) then
 				Set fso = Server.CreateObject("Scripting.FileSystemObject")
 				if not fso.FileExists(server.MapPath("../"&newsUrl)) then  
 					Response.Write("<h1>Error:</h1>" & server.MapPath("../"&newsUrl)&" does not exist<p>") 					
 				else
 					fso.DeleteFile(server.MapPath("../"&newsUrl))
 					Response.Write("<h1>成功删除文件:</h1>" & server.MapPath("../"&newsUrl))
 				end if
 			end if
			conn.execute("delete from news where id="&newsidArr(i))
		next
		response.Write("批量删除成功！")		
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	Case "remove"
		dim toCatalogId,toParentId
		toCatalogId=Cint(request.Form("toCatalogId"))
		toParentId=getparentid(toCatalogId)
		for i=0 to ubound(newsidArr)
			response.Write(newsidArr(i))
			conn.execute("update news set classid="&toCatalogId&",parentid="&toParentId&" where id="&newsidArr(i))
		next
		response.Write("批量移动文章成功！")		
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
end Select
%>
<html>
<head>
<title>新闻操作</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
	font-size:12px;
}
-->
</style>
</head>
<body>
<%
  	'set rs=server.createobject("adodb.recordset")
  	'rs.open "select count(*) AS co from news where classid="&classid,conn,3,1
%>
</body>
</html>
<%

call connclose()
%>
执行时间：<%=CStr(FormatNumber((Timer-BeginTime)*1000,2))& "毫秒"%>