<!--#include file="../admin_head.asp"-->
<%call conn_mdb(conn,"../../mydata/#alz_db.mdb")%>
</head>
<body>
<%
pageloading()
action=request.QueryString("action")
ids=request.QueryString("ids")
if instr(ids,",")>0 then ids=ids&"0"
select case action
	case "del2"
		call del2_news(ids)
	case "move"
		call move_news(ids)		
	case "del" 
		call do_news(ids,"del",1)
	case "re"
		call do_news(ids,"del",0)
	case "intop"
		call do_news(ids,"intop",1)	
	case "delintop"
		call do_news(ids,"intop",0)
	case "commend"	
		call do_news(ids,"commend",1)
	case "delcommend"	
		call do_news(ids,"commend",0)
	case "setshow"	
		call do_news(ids,"show",1)
	case "delshow"	
		call do_news(ids,"show",0)		
	case "tolist"
		call tolist(ids)
	case "todesc"
		call todesc(ids)
	case "toall"
		call toall(ids)
end select
%>
</body>
</html>
<%
sub toall(ids)
	srs rs,"select classidstr from "&db_&"news where id in("&ids&")",1,1
	do while not rs.eof
		classid=classid&","&rs("classidstr")
		rs.movenext
	loop
	classid=trimstr(classid,",")
	response.Redirect "../tohtml/toList.asp?typeid=2&okgoto=../news/default.asp&classid="&classid&"&toall=1&idstr="&ids
	crs rs
end sub
'==================================================================================================
sub tolist(ids)
	srs rs,"select classidstr from "&db_&"news where id in("&ids&")",1,1
	do while not rs.eof
		classid=classid&","&rs("classidstr")
		rs.movenext
	loop
	classid=trimstr(classid,",")
	response.Redirect "../tohtml/toList.asp?typeid=2&okgoto=../news/default.asp&classid="&classid
	crs rs
end sub
'==================================================================================================
sub todesc(ids)
	response.Redirect "../tohtml/toContent.asp?typeid=2&okgoto=../news/default.asp&classid="&classid&"&idstr="&ids
end sub
'==================================================================================================
sub do_news(ids,thetitle,thevalue)
	conn.execute("update "&db_&"news set "&thetitle&"="&thevalue&" where id in("&ids&")")
end sub
'==================================================================================================批量移动
sub move_news(ids)
%>
<link href="../skins/css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../alz_js.js"></script>
<script type="text/javascript" src="../../alz_jquery.js"></script>
<script type="text/javascript">
function move(ids)
{
	if(!confirm("确定移动？")){return false;}
	var moveto=getId("classid").value;
	getId("doing").innerHTML="<img src='../skins/images/loading.gif' style='margin-left:150px' /> 数据处理中，请稍候……";
	var sec=ajax("admin_ajax_move.asp","ids="+ids+"&moveto="+moveto,"");
	if(sec.substring(sec.length-1,sec.length)=="1"){getId("doing").innerHTML="<u>移动成功！</u>";getId("pro_do_ok").style.display="";}else{getId("doing").innerHTML="<b>移动失败！</b>";}
}
</script>
<div style="text-align:left; margin:10px;">
<span id="doing" class="pro_move_copy">
	<b>移动到：</b><select name="classid"><%call classOption(0,"",new_type)%></select>
	<input type="button" value="确定移动" class="mybutton" onMouseOver="buttonbgcc(this)" onClick="move('<%=ids%>')" />
</span>
<input id="pro_do_ok" type="button" value=" 确定完成 " class="mybutton" onMouseOver="buttonbgcc(this)" onClick="closeMsg('news/default.asp')" style="display:none;" />
<br />
<%call onepage(40)%>
<script type="text/javascript">pageloaded();</script>
</div>
<%
end sub
'==================================================================================================批量彻底删除
sub del2_news(ids)
	set rs = server.createobject("adodb.recordset")
	sql="select id from "&db_&"news where id in("&ids&") and del"
	rs.open sql,conn,1,1
	do while not rs.eof
	delnews(rs("id"))
	rs.movenext
	loop
	rs.close
	set rs = nothing
	call logs(2,mes14&"『"&ids&"』")
end sub
'=================
sub delnews(id)
	set rsdel = server.createobject("adodb.recordset")
	rsdel.open "select * from "&db_&"news where id="&id,conn,1,3
		if not rsdel.eof then
			call del_file("../../"&rsdel("picurl"))
			rsdel.delete			
		end if	
	rsdel.close
	set rsdel = nothing
end sub
crs(conn)
%>