<%@language=VBScript.Encode codepage=936 %>
<!--#include file="conn.asp"--><!--#include file="application.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim strFileName
const MaxPerPage=20
dim totalPut,CurrentPage,TotalPages
dim i,j
dim ArticleID
dim Title
dim sql,rs
dim ClassID
strFileName="News.asp" 
Title=Trim(request("Title"))
ID=Request("ID")
if request("page")<>"" then
    currentPage=cint(request("page"))
else
	currentPage=1
end if
sql="select * from News where ID>0"
sql=sql & " order by ID desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<SCRIPT language=javascript>
function unselectall()
{
    if(document.del.chkAll.checked){
	document.del.chkAll.checked = document.del.chkAll.checked&0;
    } 	
}

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;
    }
  }
function ConfirmDel()
{
   if(confirm("确定要删除选中的新闻吗？一旦删除将不能恢复！"))
     return true;
   else
     return false;
}
</SCRIPT>
<!-- #include file="Inc/Head.asp" -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="862" align="center" valign="top"> <br>
    <strong>新 闻 信 息 管 理</strong> <br>
    <br>
      <form name="del" method="Post" action="NewsDel.asp" onSubmit="return ConfirmDel();">
        <table width="736" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
          <tr bgcolor="#A4B6D7"> 
            <td width="547" height="25"><a href="News.asp">&nbsp;新 闻 信 息 管 理</a>  </td>
            <td width="168">&nbsp; 
            <%
  	if rs.eof and rs.bof then
		response.write "共找到 0 条文章</td></tr></table>"
	else
    	totalPut=rs.recordcount
		if currentpage<1 then
       		currentpage=1
    	end if
    	if (currentpage-1)*MaxPerPage>totalput then
	   		if (totalPut mod MaxPerPage)=0 then
	     		currentpage= totalPut \ MaxPerPage
		  	else
		      	currentpage= totalPut \ MaxPerPage + 1
	   		end if

    	end if
		response.Write "共找到 " & totalPut & " 条文章"
%> </td>
          </tr>
        </table>
        <%		
	    if currentPage=1 then
        	showContent
        	showpage strFileName,totalput,MaxPerPage,true,false,"条文章"
   	 	else
   	     	if (currentPage-1)*MaxPerPage<totalPut then
         	   	rs.move  (currentPage-1)*MaxPerPage
         		dim bookmark
           		bookmark=rs.bookmark
            	showContent
            	showpage strFileName,totalput,MaxPerPage,true,false,"条文章"
        	else
	        	currentPage=1
           		showContent
           		showpage strFileName,totalput,MaxPerPage,true,false,"条文章"
	    	end if
		end if
	end if
%>
        <%  
sub showContent
   	dim i
    i=0
%>
        <table width="736" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" class="border" style="word-break:break-all">
          <tr bgcolor="#A4B6D7" class="title"> 
            <td width="38" height="25" align="center">选中</td>
            <td width="48"  height="25" align="center">ID</td>
            <td width="263" align="center" bgcolor="#A4B6D7" >标题</td>
            <td width="82" align="center" bgcolor="#A4B6D7" >类别</td>
            <td width="69" align="center" >编辑</td>
            <td width="84" align="center" >加入时间</td>
            <td width="97" align="center" >操作</td>
            <td width="46" align="center" >&nbsp;</td>
          </tr>
          <%do while not rs.eof%>
          <tr class="tdbg"> 
            <td width="38" height="22" align="center" bgcolor="#A4B6D7"> 
              <input name='ID' type='checkbox' onClick="unselectall()" id="ID" value='<%=cstr(rs("ID"))%>'>            </td>
            <td width="48" align="center" bgcolor="#ECF5FF"><%=rs("ID")%></td>
            <td  bgcolor="#ECF5FF">&nbsp;[<%=rs("Hits")%>]<%=left(rs("Title"),18)%></td>
            <td  bgcolor="#ECF5FF" align="center">&nbsp;<%=rs("ClassID")%></td>
            <td  bgcolor="#ECF5FF"><div align="center"><%=rs("Admin")%></div></td>
            <td align="center" bgcolor="#ECF5FF"><%= FormatDateTime(rs("AddDate"),2) %> </td>
            <td width="97" align="center" bgcolor="#ECF5FF"> <a href="NewsEdit.asp?ID=<%=rs("ID")%>&page=<%=currentPage%>">修改</a> 
              <a href="NewsDel.asp?ID=<%=rs("ID")%>&Action=Del&page=<%=currentPage%>" onClick="return ConfirmDel();">删除</a>            </td>
            <td width="46" align="center" bgcolor="#ECF5FF"><input name="Html" value="生成" type="button" onClick="location.href='HtmlShowNews.asp?ID=<%=Rs("ID")%>'"></td>
          </tr>
          <%
	i=i+1
	      if i>=MaxPerPage then exit do
	      rs.movenext
	loop
%>
        </table>
        <table width="700" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="250" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
              选中本页显示的所有文章</td>
            <td><input name="submit" type='submit' value='删除选定的文章'> 
              <input name="Action" type="hidden" id="Action" value="Del"></td>
          </tr>
        </table>
        <%
   end sub 
%>
      </form>
</td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
<%
rs.close
set rs=nothing 
call CloseConn()

%>