<!--#include file="conn.asp"-->
<!--#Include file="ChkAdmin.asp"-->
<!--#include file="../Lib/npwapi.asp"-->
<%
If Instr(Session("permission"),"02")>0 Then
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; chaoRset=gb2312">
<link href="ad.css" rel="stylesheet" type="text/css">
<script language="javascript">
function Allaction(form)  
  {  
  if (form.aid.length>1) {
  for (var i=0;i<form.aid.length;i++)  
    {  
    var e = form.aid[i];
	e.checked = form.alldel.checked;
    } 
  } else {
  form.aid.checked=form.alldel.checked;
  }
  }
function del(id)
{
    if ( confirm("该操作将不可逆！\n您确定要删除吗？"))
        {
            window.location.href = "Del_Announcement.asp?aid=" + id
        }
}
</script>
</head>

<body bgcolor="#E7F3B5">
<%
strSql="SELECT * FROM Announcement ORDER BY amid DESC"

'Response.Write(strSql)
'Response.End()
Set oRs=Server.CreateObject("ADODB.RECORDSET")
oRs.Open strSql,oConn,1

If Cint(oRs.RecordCount)>0 Then 
oRs.PageSize =10
page=CInt(request("page"))
if page<>"" then
  if page<1 then page=1
  if page>oRs.PageCount then page=oRs.PageCount 
  oRs.AbsolutePage =page
%>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="61%"><a href="Announcement_List.asp">公告列表</a><a href="User_List.asp?keywords=5&colname=userlevel"></a></td>
	<form name="form1" method="post" action="">
    <td width="39%" align="right">
        <img src="../images/rent.gif" width="18" height="13" align="absmiddle">页数:第 
        <input type="text" size=1 name="page" value="<%=page%>">
        页/共<%=oRs.PageCount %>页 
        <input name="submit" type="submit" class="tblhead" value="转到">
        &nbsp;<img src="../images/amount.gif" width="15" height="15" align="absmiddle">记录数:<%=oRs.recordcount%> 
    </td>
	</form>
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#42344A">
  <form name="form2" method="post" action="Del_Announcement.asp">
    <tr align="center" class="tblhead"> 
      <td width="7%">编号</td>
      <td width="41%">标题</td>
	  <td width="15%">发布者</td>
      <td width="19%">时间</td>
      <td width="12%">操作</td>
      <td width="6%"> <input name="alldel" type="checkbox" id="alldel" value="on" onclick="Allaction(this.form)"></td>
    </tr>
    <%Dim uRs,strStyle
strStyle="firstalt"
for i=1 to oRs.PageSize
  if oRs.EOF then exit for
  %>
    <tr align="center" class="<%=strStyle%>"> 
      <td><%=oRs(0)%></td>
      <td><a href="Edit_Announcement.asp?ID=<%=oRs(0)%>"><%=oRs(1)%></a></td>
	  <td><%=oRs(3)%></td>
      <td>
	  <%=oRs(4)%>
	  </td>
      <td><a href="Edit_Announcement.asp?ID=<%=oRs(0)%>">编辑</a> 
        <a href="javascript:del(<%=oRs(0)%>)">删除</a></td>
      <td> <input name="aid" type="checkbox" id="aid" value="<%=oRs(0)%>"></td>
    </tr>
    <%
  oRs.MoveNext 
  If strStyle="firstalt" Then
    strStyle="secondalt"
  Else
    strStyle="firstalt"
  End If
next
  %>
    <tr align="right" bgcolor="#BDBABD"> 
      <td height="48" colspan="6"><input name="Submit" type="submit" class="tblhead" value="删除选中的公告"> 
        <%
if page<>1 then
%>
        [<a href="">第一页</a>][<a href="">上一页</a>] 
        <%else%> <font color="#CCCCCC">[第一页][上一页]</font> <%end if
if page<>oRs.PageCount then%>
        [<a href="">下一页</a>][<a href="">最后页</a>] 
        <%else%> <font color="#CCCCCC">[下一页][最后页]</font> <%end if

%> 
      <!-- 结束显示页数-->      </td>
    </tr>
  </form>
</table>
<%
Else
  strMsg="当前没有匹配记录！"
  Call Ok(0)
End If
Else
  strMsg="当前没有匹配记录！"
  Call Ok(0)
End If
%>
</body>
</html>
<%
Else
  strErrMsg="对不起，您没有公告管理的权限！"
  Call DisError()
End If
%>