<% 
data_path="../../" 'ACC连接数据库路径，对SQL无效
numid="31"
dir="../err.asp" 
%>
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include file="../../inc/FileSystem.asp"-->
<!--#include file="../rolecheck.asp"-->
<%
dim chkAll,delAll,noAll
action=Replace_Text(request("action"))
chkAll=Replace_Text(request("shbtn"))
delAll=Replace_Text(request("delbtn"))
idShow=Replace_Text(request("selAnnounce"))

if chkall="批量审核所选" then
		if idShow<>"" then
		idChkList=idShow
		if instr(idChkList,",")>0 then
			dim idChkArr
			idChkArr=split(idChkList)
			dim chkLog_id
			for i = 0 to ubound(idChkArr)
				chkLog_id=clng(idChkArr(i))
				call checkAll(chkLog_id)
			next
		else
			call checkAll(clng(idChkList))
		end if
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	end if
end if

if delall<>"" then
	if idShow<>"" then
		idDelList=idShow
		if instr(idDelList,",")>0 then
			dim idDelArr
			idDelArr=split(idDelList)
			dim delLog_id
			for i = 0 to ubound(idDelArr)
				delLog_id=clng(idDelArr(i))
				call deletAll(delLog_id)
			next
		else
			call deletAll(clng(idDelList))
		end if
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	end if
end if

if chkall="批量取消审核" then
	if idShow<>"" then
		idNoList=idShow
		if instr(idNoList,",")>0 then
			dim idNoArr
			idNoArr=split(idNoList)
			dim NoLog_id
			for i = 0 to ubound(idNoArr)
				NoLog_id=clng(idNoArr(i))
				call noCheckAll(NoLog_id)
			next
		else
			call noCheckAll(clng(idNoList))
		end if
		response.Redirect(request.ServerVariables("HTTP_REFERER"))
	end if
end if

'----------------------
'函数名称： checkAll
'作   用：审核所选
'参   数：
'返回值：
'----------------------
sub checkAll(id)
	info_id=id
	set rs=server.createobject("adodb.recordset")
	sql="update Yixiang_Info set flag=1 where info_id="&Info_ID
	rs.open sql,conn,1,3
	
	set RsHTml=server.createobject("adodb.recordset")
	SqlHTml="Select * From Yixiang_Info Where info_id="&Info_ID
	RsHtml.Open SqlHtml,Conn,1,3
	
	IF NOt RsHtml.Eof then 
	id1=RsHtml("info_id")
	id2=RsHtml("info_id")
	if RsHtml("type")="卖" then 
			HtmlPath="tradeinfo"
		else
			HtmlPath="seller"
		end if
	%>
	<iframe src="../../manage/makehtml/<%=HtmlPath%>/makedetail.asp?all=update&id1=<%=Info_ID%>&id2=<%=Info_ID%>&schtml=开始生成>>" frameborder="0" scrolling="yes" height="0" widht="0"></iframe>
	<%
	End if	
	RsHtml.Close
	Set RsHtml=nothing
end sub


'----------------------
'函数名称：deletAll
'作   用：删除所选
'参   数：
'返回值：
'----------------------
sub deletAll(id)	
	dim rs,sql
	set rs=server.createobject("adodb.recordset")
	if instr(id,",")>0 then  
		sql="delete from [Yixiang_Info] where info_id in("&cstr(id)&")"
		
		Set RsGq=Server.CreateObject("Adodb.Recordset")
			SqlGq="Select * From Yixiang_Info Where info_id in("&cstr(id)&")"
			RsGq.Open SqlGq,Conn,1,3
			IF Not(RsGq.Eof and RsGq.Bof) Then 
				Do While Not RsGq.Eof	
					ttid=RsGq("Info_ID")
					 sortid=RsGq("sortid")
					 typeid=RsGq("typeid")
					 typeid_2=RsGq("typeid_2")
					 showname=RsGq("showname")
					 dateandtime=RsGq("dateandtime")
					 period=Rs("period")
				if RsGq("type")="卖" then 
					HtmlPath="tradeinfo"
				else
					HtmlPath="seller"
				end if
			
				FileName=HOPE_InstallDir&HtmlPath&"/offerdetail/"&sortid&"-"&typeid&"-"&typeid_2&"-"&ttid&".html"
				'Response.write FileName
				'Response.end
				Call FileDel(FileName)'删除文件
				RsGq.MOVenext
					If RsGq.Eof then Exit Do
				Loop
			End if
				
			RsGq.Close
		Set RsGq=Nothing 
	Else
		sql="delete from [Yixiang_Info] where info_id="&cstr(id)
		Set RsGq=Conn.Execute("Select * From Yixiang_Info Where info_id="&cstr(id)&"")
			if not(RsGq.eof and RsGq.bof) then
				 ttid=RsGq("Info_ID")
				 sortid=RsGq("sortid")
				 typeid=RsGq("typeid")
				 typeid_2=RsGq("typeid_2")
				 showname=RsGq("showname")
				 dateandtime=RsGq("dateandtime")
				 period=RsGq("period")
				if RsGq("type")="卖" then 
					HtmlPath="tradeinfo"
				else
					HtmlPath="seller"
				end if
			
				FileName=HOPE_InstallDir&HtmlPath&"/offerdetail/"&sortid&"-"&typeid&"-"&typeid_2&"-"&ttid&".html"
				'Response.write FileName
				'Response.end
				Call FileDel(FileName)'删除文件
			end if
			RsGq.Close
			Set RsGq=Nothing
	
	end if
	conn.execute sql
	
	if err.Number<>0 then
	err.clear
	response.write "删 除 失 败 !<br>"
	end if
end sub


'----------------------
'函数名称：noCheckAll
'作   用：取消所选项的审核
'参   数：
'返回值：
'----------------------
sub noCheckAll(id)
	set rs=server.createobject("adodb.recordset")
	sql="update Yixiang_Info set Flag=0 where info_id="&id
	rs.open sql,conn,1,3 
end sub



%>