<!--#include file="conn.asp" -->
<!--#include file="checkout.asp" -->
<%if (session("userkey")=1) then%>
  <script language=javascript>  
    alert( "错误：您无权进行用户管理！"  );
    location.href = "javascript:history.back()"  
  </script>
<%end if%>

<%
code=trim(request("code"))
ty=len(code)
name=trim(request("name"))
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>新闻列表</title>
<LINK href="css.css" rel=stylesheet type=text/css>
</head>
<body>
<table align=center width="796" border="0" cellspacing="3" cellpadding="3"><tr><td height="20" width="780">当前位置：<a href=main.asp>管理首页</a> >>  产品资料</td></tr></table>                                                                      
<table width="791" align=center cellpadding="5" cellspacing="1" bgcolor=#999999 height="189">
 <form action="news_list.asp?code=<%=code%>" method=post name=jhform>
  <tr bgcolor=#cccccc><td colspan=7 width="813" height="20"><center><font color="#0000FF"><%=name%>&lt;&lt;&lt;</font>新闻列表</center></td></tr>
  <tr bgcolor=#CCCCCC>
    <td colspan=7 width="813" bgcolor="#FFFFFF" height="24">
      <p style="margin-left: 10">产品名称：<input name="search_title" type="text" id="search_code2" value="<%=request("search_title")%>" size="15">   
      &nbsp; <input type="submit" value="查询" name="B1"></p>                                                                                         
    </td>  
  </tr>
<%
set rs = server.CreateObject ("Adodb.recordset")
if ty=1 then
	sql="select * from newlist where left(code,1)='"& code &"'"
else
	sql="select * from newlist where code='"& code &"'"
end if
if request("search_title")<>"" then       
	sql=sql & " and title like '%"& request("search_title") &"%'"       
end if             
sql=sql & " order by code desc, addtime desc,id desc"
rs.open sql,conn,1,1       
if not rs.eof then         
	rs.pagesize=10
	page=request("page")       
	if page="" then page=1       
	if page<1 then page=1         
	page=clng(page)                  
	if page>rs.pagecount then page=rs.pagecount                  
	rs.absolutepage=page                                       
end if       
%>
 <tr>
  <td colspan=7 width="813" bgcolor="#F2F2F2" height="20">
    <p align="left">〖<a href="news_add.asp?code=<%=code%>&name=<%=name%>"><font color="#000080">添加新闻<%=code%></font></a>〗</p>
  </td>
 </tr>
  <tr bgcolor=#CCCCCC>
    <td colspan=7 bgcolor="#FFFFFF" width="813" height="5">
<%
		str="<div align='left'>"   
  		str=str & "<center>"   
  		str=str & "<table border='0' cellpadding='0' cellspacing='0' height=20 width='95%'>"   
    	str=str & "<tr>"                                        
    	str=str & "<td width='100%' align='left' colspan='3'><p style='margin-right: 5'>共有"&rs.recordcount&"条数据，页："                                              
		if page>=10 then                                   
       		str=str & "[<A href='#' onclick=nextpage('"&(page\10)*10-1&"')><font color='#0000FF'><<</font></A>]&nbsp;"                                   
		end if                                   
    	for i=(page\10)*10+1 to (page\10)*10+10                                   
        	if i>rs.pagecount then exit for                                   
        	if i=page then                                   
        	   str=str & "<FONT color=#cc0000><B>" & i & "</B></FONT>&nbsp;"                                   
        	else                                   
        	   str=str & "[<A href='#' onclick=nextpage('"&i&"')><font color='#0000FF'>" & i & "</font></A>]&nbsp;"                                   
        	end if                                   
        	if i=(page\10)*10+10 then                                   
        		str=str & "[<A href='#' onclick=nextpage('"&i+1&"')><font color='#0000FF'>>></font></A>]&nbsp;"                                   
        	end if                                                
     	next         
     	str=str & "</p></td>"                                        
     	str=str & "</tr>"                                        
     	str=str & "</table>"                                        
     	str=str & "</center>"                                        
    	str=str & "</div>" 
    	response.write str
%>
    </td> 
  </tr>
  <tr bgcolor=#ffcc00 align=center>
    <td align="center" height="10" bgcolor="#CCFFFF">ID</td>
    <td align="center" height="10" bgcolor="#CCFFFF">排序</td>
    <td nowrap height="10" bgcolor="#CCFFFF">标题</td><td nowrap height="10" bgcolor="#CCFFFF">代码</td>
    <td nowrap height="10" bgcolor="#CCFFFF">状态</td>
    <td nowrap height="10" bgcolor="#CCFFFF">添加时间</td>
    <td nowrap height="10" bgcolor="#CCFFFF">操作</td></tr>
<%
for i=1 to rs.pagesize
	if rs.eof then exit for
%>
<tr bgcolor=#ffffff>
   <td align="center" height="20"><%=htmlencode1(rs("id"))%></td>
   <td align="center" height="20"><%=htmlencode1(rs("num"))%></td>
   <td align="center" height="20">
    <p align="left"><%=htmlencode1(rs("title"))%></td>
   <td align="center" height="20"><%=htmlencode1(rs("code"))%></td>
   <td align="center" height="20"><%=htmlencode1(rs("status"))%></td>
   <td align="center" height="20"><%=htmlencode1(rs("addtime"))%></td>
   <td align="center" height="20"><center>|<a href="news_edit.asp?id=<%=htmlencode1(rs("id"))%>&code=<%=code%>&name=<%=name%>"><font color=green>修改</font></a>|<a href=news_del.asp?id=<%=rs("id")%> onclick="{if(confirm('您确定要删除该产品吗?')){return true;}return false;}"><font color=blue>删除</font></a></center></td>                               
   </tr>
<%
RS.MoveNext()
next
%>
<input type=hidden name=page>
<input type=hidden name=id>
</form></table>
<%response.write str
	 if rs.pagecount>1 then
  		str="<div align='right'>"                                        
  		str=str & "<center>"                                        
  		str=str & "<table border='0' cellpadding='0' cellspacing='0' width='95%' height=25>"                                        
    	str=str & "<tr>"                                        
    	str=str & "<td width='100%' align='right' height='25'>"                                     
    	if page<>1 then                                     
       		str=str & "[<A href='#' onclick=nextpage('1')><font color='#0000FF'>首页</font></A>]"                                        
       		str=str & "[<A href='#' onclick=nextpage('"&page-1&"')><font color='#0000FF'>上页</font></A>]"                                        
      	end if                                        
    	if page<>rs.pagecount then                                     
       		str=str & "[<A href='#' onclick=nextpage('"&page+1&"')><font color='#0000FF'>下页</font></A>]"                                        
       		str=str & "[<A href='#' onclick=nextpage('"&rs.pagecount&"')><font color='#0000FF'>尾页</font></A>]"                                        
      	end if 
     	str=str & "</td>"                                     
     	str=str & "</tr>"                                     
     	str=str & "</table>"                                     
     	str=str & "</center>"                                     
    	str=str & "</div>"
    response.write str
    end if   
%>
<script language="VBScript">
                               
sub nextpage(x)      
	jhform.page.value=x        
	jhform.action="news_list.asp?code=<%=code%>&name=<%=name%>"
	window.event.returnvalue=false        
	jhform.submit()                           
end sub     
</script>
</body>
</html>


