<!--#include file="../utf-8.asp" -->
<!--#include file="../js/Function.asp" -->
<!--#include file="../CheckAdmin.asp" -->
<!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>
<META NAME="copyright" CONTENT="Copyright 2010-2012 - yidacms.com" />
<META NAME="Author" CONTENT="世纪伟成  yidacms.com" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../js/admin.css" rel="stylesheet" type="text/css">
<title>新闻列表！</title>
<script language="javascript">
<!--
function gopage() {
window.location.href="<%=myself%>?page="+ page.value;
}
//-->
</script>
</head>
<body>
<%
'版权：世纪伟成(http://yidacms.com)
'本信息不会影响您网站的正常访问，无论免费用户或是收费用户请保留这里的信息.
'如果您删除了这里的版权信息,将追究法律责任.

dim idcount'记录总数
dim pages'每页条数
dim pagec'总页数
dim page'页码
dim pagenc '每页显示的分页页码数量=pagenc*2+1
pagenc=2
dim pagenmax '每页显示的分页的最大页码
dim pagenmin '每页显示的分页的最小页码
page=clng(request("page"))
dim start'程序开始的时间
dim endt'程序结束的时间
dim datafrom'数据表名
datafrom="shuaiweb_news"
dim conn,rs
dim datapath '数据库路经
dim sqlid'本页需要用到的id
dim myself'本页地址
myself = request.servervariables("path_info")
dim sql'sql语句
dim taxis'排序的语句
taxis="order by id desc"
dim i'用于循环的整数
start=timer()
pages=30


'获取记录总数
sql="select count(id) as idcount from ["& datafrom &"]"
set rs=server.createobject("adodb.recordset")
rs.open sql,dbok,0,1

idcount=rs("idcount")'获取记录总数

if idcount=0 then
			No_record = "暂无新闻记录!"
				Else

 if(idcount>0) then'如果记录总数=0,则不处理
	if(idcount mod pages=0)then'如果记录总数除以每页条数有余数,则=记录总数/每页条数+1
		pagec=int(idcount/pages)'获取总页数
	else
		pagec=int(idcount/pages)+1'获取总页数
	end if

	'获取本页需要用到的id============================================
	'读取所有记录的id数值,因为只有id所以速度很快
	sql="select id from ["& datafrom &"] " & taxis
	set rs=server.createobject("adodb.recordset")
	rs.open sql,dbok,1,1

	   rs.pagesize = pages '每页显示记录数
	   if page < 1 then page = 1
	   if page > pagec then page = pagec
	   if pagec > 0 then rs.absolutepage = page  

	for i=1 to rs.pagesize
	if rs.eof then exit for  
		if(i=1)then
			sqlid=rs("id")
		else
			sqlid=sqlid &","&rs("id")
		end if
	rs.movenext
	next
	'获取本页需要用到的id结束============================================
 end if
end if

        if(idcount>0 and sqlid<>"") then'如果记录总数=0,则不处理
	'用in刷选本页所语言的数据,仅读取本页所需的数据,所以速度快
	sql="select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
	set rs=server.createobject("adodb.recordset")
	rs.open sql,dbok,0,1

%>
       <FORM METHOD=POST ACTION="?shuaiweb=newsxxx" >
	<table width="98%" height="40" border="1" cellpadding="6" cellspacing="0" bordercolor="#cccccc" style="border-collapse:collapse" bgcolor="#FFFFFF" align="center">
  <tr>
			<td width="54" bgcolor="#CCCCCC">ID</td>
			<td width="316" bgcolor="#CCCCCC">新闻标题</td>
			<td width="90" bgcolor="#CCCCCC">作者</td>	
			<td width="130" bgcolor="#CCCCCC">发布时间</td>
			<td width="111" bgcolor="#CCCCCC">操作！</td>
  </tr>
<%		 
	while(not rs.eof)'填充数据到表格


                if rs("yida_language") = "ch" then
                language = "<font color=red>简</font>"
                else
                language = "<font color=blue>英</font>"
                end if
%>
  <tr onMouseOver="this.id='aa'" onMouseOut="this.id='bb'" class="cc">
    <td><input type="checkbox" name="id" id="id" value="<%=rs("id")%>"> <%=rs("id")%></td>
    <td><a href="../../zh_news_view.asp?id=<%=rs("id")%>" target=_blank>[<%=language%>] <%=rs("shuaiweb_newstitle")%></a></td>
    <td><%=rs("shuaiweb_newsAuthor")%></td>
    <td><%=rs("time")%></td>	
    <td><a href="admin_newslistedit.asp?id=<%=rs("id")%>"><img src="../images/023.jpg" alt="修改"/></a> <a href="../admin_del.asp?t=newseditdel&id=<%=rs("id")%>"><img src="../images/015.gif" alt="删除" onclick="{if(confirm('确定删除它吗?')){return true;}return false;}"/></a></td>
  </tr>
	<%
	rs.movenext
	wend
	%>
<tr>
 <td><input name="chkAll" type="checkbox" id="chkAll" onClick=CheckAll(this.form) value="checkbox">全选</td>
 <td colspan="4">
<input type=submit name=submit1 value="执行选定的操作"  onclick="{if(confirm('确定删除它们吗?')){return true;}return false;}"></td>
</tr> 
</table> 
</form> 
<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 = form.chkAll.checked;
    }
  }
</script>
		  <br>
		  <table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="zw">
		    <tr align="center">
		      <td align="left">共有<strong><font color="#ff6600"><%=idcount%></font></strong>条记录,<strong><font color="#ff6600"><%=page%></font></strong>/<%=pagec%>,每页<strong><font color="#ff6600"><%=pages%></font></strong>条。</td>
		      </tr>
		  </table>          
		  <table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="zw">
		    <tr align="center">
		      <td align="right">
		      <%
	'设置分页页码开始===============================
	pagenmin=page-pagenc'计算页码开始值
	pagenmax=page+pagenc'计算页码结束值
	if(pagenmin<1) then'如果页码开始值小于1则=1
	    pagenmin=1
	end if

	if(page>1) then'如果页码大于1则显示(第一页)
		response.write ("<a href='"& myself &"?page=1'><font color='#000000'>第一页</font></a>&nbsp;")	
	end if
	if(pagenmin>1) then'如果页码开始值大于1则显示(更前)
		response.write ("<a href='"& myself &"?page="& page-(pagenc*2+1) &"'><font color='#000000'>更前</font></a>&nbsp;")
	end if

	if(pagenmax>pagec) then'如果页码结束值大于总页数,则=总页数
	    pagenmax=pagec
	end if

	for i = pagenmin to pagenmax'循环输出页码
	    if(i=page) then
		response.write ("<font color='#ff6600'><strong>"& i &"</strong></font>&nbsp;")
	    else
		response.write ("[&nbsp;<a href="& myself &"?page="& i &"><font color='#000000'>"& i &"</font></a>&nbsp;]&nbsp;")
	    end if
	next
	if(pagenmax<pagec) then'如果页码结束值小于总页数则显示(更后)
		response.write ("<a href='"& myself &"?page="& page+(pagenc*2+1) &"'><font color='#000000'>更后</font></a>&nbsp;")
	end if
	if(page<pagec) then'如果页码小于总页数则显示(最后页)	
		response.write ("<a href='"& myself &"?page="& pagec &"'><font color='#000000'>最后页</font></a>&nbsp;")
	end if
	'设置分页页码结束===============================
	%> 转到<input name="page" type="text" value="<%=page%>" size="5">页<input type="button" name="submit" value="跳转" onclick="gopage()"></td>
		      </tr>
		  </table> 
<%
end if
%><br>
 <table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="zw">
  <tr>
    <td colspan="5"><%=No_record%></td>
  </tr>
  <tr>
    <td align="center">
<%
endt=timer()
rs.close
set rs=nothing
%> 执行 <%=formatnumber((endt-start)*1000,3)%> 毫秒</td>
  </tr>
</table>
<% 
if request("shuaiweb")="newsxxx" Then 
dim delid,url
url=request.servervariables("HTTP_REFERER")
if url ="" then url="http://"&Request.ServerVariables("SERVER_NAME")
delid=replace(request("id"),"'","") '
set rs = server.createobject("adodb.recordset")
sql="delete from shuaiweb_news  where id in ("&delid&")"
rs.open sql,dbok,3,2
%>
<script language=Javascript>
<!--
alert("删除成功！");
window.location="<%=url%>"
-->
</script>
<%
end if
response.end()
%>
</body>
</html>
