<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--#include file="session.asp"-->
<!--#include file="../conn.asp"-->
<meta http-equiv="Content-Language" content="zh-cn">
<title>资讯管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function selectall(v){
var f = document.forms["listform"];
for (i=0;i<f.elements.length;i++)
if (f.elements[i].name=="ids")
     f.elements[i].checked = v;
	 }
</script>
<link rel="stylesheet" type="text/css" href="images/admin.css">
</head>
<body>
<div class="comment">
<div  class="w760box">
<form name="listform" action="cmd.asp?act=Del_All_Info&type=news" method="post">
<div class="w730box">
	<div class="fl ml15">
		<input type="checkbox" name="checkall"  onclick="selectall(this.checked);"  style="margin-top:10px;"/> 
		<input type="submit" value=" " name="B3" class="ibbtn" />
	</div>
	<a href="add_news.asp" style="width:70px;background-position: left center;  background-image:url('images/add.gif'); background-repeat:no-repeat;display:block;float:right;text-align:right;">发布新闻</a>
</div>
	
	<div class="c10"></div>

	<table cellspacing="0" id="table1" style="width:730px;margin-left:15px;">
<%
dim search_sql,search_nclss,search_keywords,search_id,filego
search_nclass=request("nclass")
search_keywords=request("keywords")
search_id=request("search_id")

filego="news.asp?nclass="&search_nclass&"&keywords="&search_keywords&"&search_id="&search_id

search_sql="select * from [news] where 1=1"

if search_ntype<>"" and search_ntype<>"不限" then
   search_sql=search_sql & " and ntype="&search_ntype
end if


if search_keywords<>"" then
      search_sql=search_sql & "  and (loupan like '%"&search_keywords&"%' or title like '%"&search_keywords&"%')"
end if

if search_id<>""  then
      search_sql=search_sql & " and id="&search_id
end if


search_sql=search_sql & " order by pubdate desc"

'response.write search_sql
'response.end
set rs=Server.CreateObject("ADODB.RecordSet")
rs.open search_sql,conn,1,1
	
if not rs.eof then
	    rs.pagesize=20
	    page=request("page")
	    If Not Isnumeric(page) or page="" Then
	      page=1
	    else
	      page=cint(page)
	    End if
	    if page<1 then page=1
	    if page>rs.pagecount then page=rs.pagecount
	    rs.AbsolutePage = page
	    for i=1 to rs.pagesize
%>
				<tr class="info">
					<td class="listtxt" width="30" height="28"><input type="checkbox" name="ids" value="<%=rs("id")%>"></td>
					<td class="listtxt" width="391" height="28"><a href="/Show_news.asp?id=<%=rs("id")%>" target="_blank"><%=left(rs("title"),20)%></a></td>
					<td class="listtxt" width="89" height="28"  align="center"><a href="cmd.asp?act=To_Top&type=news&id=<%=rs("id")%>"><% if rs("top")=1 then response.write "推荐" else response.write "未推荐" end if%></a></td>
					<td class="listtxt" width="141" height="28"  align="center">	
<%
sql2="select * from news_class where id="&rs("nclass")
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.open sql2,conn,1,1
news_class_name=rs2("news_class_name")
rs2.close()
set rs2=nothing
%>
<%=news_class_name%>
					</td>
					<td class="listtxt" width="77" height="28">
						<p style="text-align: center">
						<a href="edit_news.asp?id=<%=rs("id")%>"><img src="images/edit.gif" style="margin-top:8px;"></a>　
						<a onclick='{if(confirm("您确定删除吗?此操作将不能恢复!")){return true;}return false;}' href="cmd.asp?act=Del_Info&type=news&id=<%=rs("id")%>"><img src="images/del.gif" style="margin-top:8px;"></a>
					</td>
	</tr>
		<%
    rs.movenext
    if rs.eof then
      Exit For
    End if
    next
%>
			</form>
			
			<% else%>
	
				<tr class="info">
					<td height="28" class="listtxt" colspan="5">没有找到相关记录</td>
				</tr>
				
			<% end if %>
				</table>
			
		
	
			
		<div class="fenye">
		<%
		if filego<>"news.asp" then 
		filego2=filego&"&" 
		else 
		filego2="news.asp?" 
		end if
		
	
			if page>10 then s1=page else s1=1
		 
		if page<rs.pagecount-10 then s2=page+10 else s2=rs.pagecount
		
		if s1>=10 then response.write "<a style=""width:60px;"">上一页</a>"
		for j=s1 to s2
		   if j=page then
		     response.write "<a href="&filego2&"page="&j&" class=""page-current"">"&j&"</a>&nbsp;"
		   else
		     response.write "<a href="&filego2&"page="&j&">"&j&"</a>&nbsp;"
		   end if
		next
		if s2<rs.pagecount then response.write "<a style=""width:60px;"">下一页</a>"
		
		response.write "　　　　　　　　　共"&rs.RecordCount&"条记录，每页显示"&rs.pagesize&"条，共"&rs.pagecount&"页，当前第"&page&"页"
		rs.close
		set rs=nothing
		%>
		</div>
</div>
</div>

</body>
</html>