<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"pext04")
'''''''''''''''''''''''''''''''''''''''''''''''
const recpage=15
dim i,classid,currentpage,BeginTime,by
BeginTime=Timer
if not isempty(request.QueryString("page")) then 
	currentpage=Clng(request.QueryString("page"))
else 
	currentpage=1
end if
if(request.QueryString("by")<>"") then
	by=Cint(request.QueryString("by"))
else
	by=2
end if
%>
<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;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
form{margin:0;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="?by=<%=by%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href(gourl);
}</script>
</head>
<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#EEEEEE" style="border-left:1px solid #999999; border-right:1px solid #999999;">
  <tr>
    <td height="20" bgcolor="#FFFFFF">·<a href="?by=1&page=<%=currentpage%>">已审核</a> ·<a href="?by=0&page=<%=currentpage%>">未审核</a> ·<a href="?page=<%=currentpage%>">全部</a></td>
  </tr>
</table>
<form action="news_do_bypriv.asp" method="post" enctype="application/x-www-form-urlencoded">
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="7"><div align="center" class="style1">◆ 新闻管理 ◆</div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="6%">&nbsp;</td>
    <td width="5%" height="22"><div align="center">ID</div></td>
    <td width="11%"><div align="center">图片</div></td>
    <td width="12%"><div align="center">转向链接</div></td>
    <td width="33%"><div align="center">新闻标题</div></td>
    <td width="13%"><div align="center">添加时间</div></td>
    <td width="4%"><div align="center">审核</div></td>
    </tr>
  <!-- 开始按行循环----------------------->
  <%
  		dim countSql,querySql,newsArr
		set rs=server.createobject("adodb.recordset")
		countSql="select count(*) from news where checked<>2"
		if(by=0) then
			countSql=countSql&" and checked=0"
		elseif(by=1) then
			countSql=countSql&" and checked=1"
		end if		
  		rs.open countSql,conn,3,1
		allrec=rs(0)
		rs.close
		set rs=nothing
		totalpage=int((allrec+recpage-1)/recpage)		
		set rs=server.createobject("adodb.recordset")
		if(currentpage=1) then
			querySql="select top "&recpage&" id,photo,isoutlink,pagepath,title,moditime,checked,classid,linkurl from news where checked<>2"			
			if(by=0) then
				querySql=querySql&" and checked=0"
			elseif(by=1) then
				querySql=querySql&" and checked=1"
			end if	
			querySql=querySql&" order by id desc"
		else
			querySql="select top "&recpage&" id,photo,isoutlink,pagepath,title,moditime,checked,classid,linkurl from news where id < (select min(id) from (select top "&(recpage*(currentpage-1))&" id from news where checked<>2"	
			if(by=0) then
				querySql=querySql&" and checked=0"
			elseif(by=1) then
				querySql=querySql&" and checked=1"
			end if			
			querySql=querySql&" order by id desc) as t)"
			querySql=querySql&" and checked<>2"
			if(by=0) then
				querySql=querySql&" and checked=0"
			elseif(by=1) then
				querySql=querySql&" and checked=1"
			end if	
			 querySql=querySql&" order by id desc "
		end if
		rs.open querySql,conn,3,1
		if rs.eof or rs.bof then
			response.Write("没有信息!")			
		else
			newsArr=rs.GetRows()
		end if
		rs.close
		set rs=nothing
		if isarray(newsArr) then
		for i=0 to ubound(newsArr,2)
	%>
  <tr>
    <td bgcolor="#FFFFFF"><div align="center"><input type="checkbox" name="newsid" value="<%=newsArr(0,i)%>"></div></td>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=newsArr(0,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center">
	<%if newsArr(1,i)<>"" then%>
	<a href="<%=newsArr(1,i)%>" target="_blank"><img src="<%=newsArr(1,i)%>" width="39" height="37" border="0"></a>
	<%
	else
		response.Write("没有图片")
	end if
	%>
	</div></td>
    <td bgcolor="#FFFFFF">
	<div align="center">
	<%
	if(newsArr(2,i)=0) then
		response.Write("否")
	else
		response.Write("<font color=""red"">是</font>")
	end if
	%>
	</div></td>
    <td bgcolor="#FFFFFF">
	<div align="left">
	<a href="<%=newsArr(8,i)%>" target="_blank"><%=newsArr(4,i)%></a>	</div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=newsArr(5,i)%></div></td>
    <td bgcolor="#FFFFFF">
	<div align="center">
	<%
	if(Cbool(newsArr(6,i))=true) then 
		response.Write("<font color=""red"">√</font>")
	else
		response.Write("×")
	end if
	%>
	</div></td>
    </tr>
  
  <%
	next	
	end if  
  %>
  <tr>
    <td height="22" colspan="7" bgcolor="#FFFFFF"><div align="center">
      <input class=Button type="button" name="chkall" value="全选" onClick="CheckAll(this.form)">
      <input class=Button type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">
管理选项：
<select name="act">
  <option value="0">请选择操作选项↓</option>
  <option value="check">→批量审核</option>  
  <option value="nocheck">→取消审核</option>  
</select>
<input class=Button type="submit" name="Submit2" value="执行操作" onClick="return confirm('您确定执行该操作吗?')">
  </div></td>
  </tr>
  <!--按行循环结束------------------------>
</table>
</form>
<table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<form name="form1" method="post" action="" style="margin:0 0 0 0">
      <div align="center">
<%
dim n,p
n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='?by="&by&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='?by="&by&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
            <input type="hidden" name="hid" value="<%=totalpage%>">
&nbsp;&nbsp;跳至
<input name="page" type="text" size="5" onKeyPress="if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
          页
          <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
          </div>
    </form></td>
  </tr>
</table>
<script language="javascript">
function CheckAll(form) {  
	for (var i=0;i<form.elements.length;i++)  {  
		var e = form.elements[i];  
		if (e.name != 'chkall')  
		e.checked = true // form.chkall.checked;  
	}  
} 
 
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name != 'chkall')
		e.checked=!e.checked;
	}
}
</script>
</body>
</html>
<%
call connclose()
%>
执行时间：<%=CStr(FormatNumber((Timer-BeginTime)*1000,2))& "毫秒"%>             