<!-- #include file="Setup.asp" -->
<%
if SiteSettings("AdminPassword")<>session("pass") then response.redirect "Admin_Default.asp?menu=Login"
Log("")
id=int(Request("id"))


AdminTop

select case Request("menu")

case "Affichelist"
Affichelist


case "addAffiche"
addAffiche

case "addAfficheok"
sql="select * from [BBSXP_Affiche] where id="&id&""
Rs.Open sql,Conn,1,3
if Rs.eof then Rs.addNew
Rs("title")=""&Request("Subject")&""
Rs("content")=ContentEncode(Request("content"))
Rs("UserName")=""&CookieUserName&""
Rs("Posttime")=now()
Rs.update
Rs.close
sql="select top 2 * from [BBSXP_Affiche] order by Posttime Desc"
Set Rs=Conn.Execute(sql)
Do While Not Rs.EOF
Affiche=Affiche&"<b>"&Rs("title")&"</b> ("&Rs("Posttime")&")　　　"
Rs.MoveNext
loop
Set Rs = Nothing

%> 发布成功<br><br><a href=javascript:history.back()>返 回</a><%

case "DelAffiche"
Conn.execute("Delete from [BBSXP_Affiche] where id="&id&"")
sql="select top 2 * from [BBSXP_Affiche] order by Posttime Desc"
Set Rs=Conn.Execute(sql)
Do While Not Rs.EOF
Affiche=Affiche&"<b>"&Rs("title")&"</b> ("&Rs("Posttime")&")　　　"
Rs.MoveNext
loop
Set Rs = Nothing

%> 删除成功<br><br><a href=javascript:history.back()>返 回</a><%


end select

sub Affichelist
%>

<a href="?menu=addAffiche">发布公告</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<a href="javascript:this.location.reload()">刷新列表</a><br>
　<table border="0" cellpadding="5" cellspacing="1" class=a2 width=100%>
<tr>
<td width="5%" align="center" class=a1>ID</td>
<td width="35%" align="center" class=a1>标题</td>
<td width="10%" align="center" class=a1>发布人</td>
<td width="15%" align="center" class=a1>发布时间</td>
<td width="15%" align="center" class=a1>管理</td>
</tr>
<%
sql="select * from [BBSXP_Affiche] order by Posttime Desc"
Rs.Open sql,Conn,1
PageSetup=20 '设定每页的显示数量
Rs.Pagesize=PageSetup
TotalPage=Rs.Pagecount  '总页数
PageCount = cint(Request.QueryString("PageIndex"))
if PageCount <1 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage
if TotalPage>0 then Rs.absolutePage=PageCount '跳转到指定页数
i=0
Do While Not Rs.EOF and i<PageSetup
i=i+1%>
<tr class=a3>
<td align="center"> <%=Rs("id")%>
<td align="center"><%=Rs("title")%>
<td align="center"><a target="_blank" href="Profile.asp?UserName=<%=Rs("UserName")%>"><%=Rs("UserName")%></a>
<td align="center"><%=Rs("Posttime")%>
<td align="center"><a href="?menu=addAffiche&id=<%=Rs("id")%>">修改公告</a> <a onclick="return confirm('您确定要删除该公告？')" href="?menu=DelAffiche&id=<%=Rs("id")%>">删除公告</a></td>
</tr>
<%
Rs.MoveNext
loop
Rs.Close
%>
</table>
<table border=0 width=100% align=center><tr><td>
<%ShowPage()%>
</tr></td></table>
<%
end sub
sub addAffiche


if Request("id")<>empty then
sql="select * from [BBSXP_Affiche] where id="&id&""
Set Rs=Conn.Execute(sql)
content=Rs("content")
title=Rs("title")
end if

%>
<form name="form" method="POST" action="?menu=addAfficheok" onSubmit="return CheckForm(this);">
<input name="content" type="hidden" value='<%=content%>'>
<input name="id" type="hidden" value='<%=id%>'>

<table cellspacing="1" cellpadding="5" width="90%" border="0" class="a2" align="center">
  <tr>
    <td class=a1 align=center colspan=2>发布公告</td>
  </tr>
   <tr>
    <td class=a3 align=center width="16%">
标题：</td>
    <td class=a3 width="82%">
<input type="text" name="Subject" size="60" value="<%=title%>"></td></tr>
   <tr>
    <td class=a3 align=center width="16%">
内容：</td>
    <td class=a3 width="82%" height="250">
    
    <SCRIPT src="inc/Post.js"></SCRIPT>

</td></tr>
   <tr>
    <td class=a3 align=center colspan=2>
<INPUT type=submit value=" 发表 " name=EditSubmit>　<input type="Button" value=" 预览 " onclick="Preview()">　<INPUT onclick="history.back()" type="button" value=" 取消 ">
</TD></TR></FORM>
</TABLE>
<form name=preview action=preview.asp method=post target=preview_page><input name="content" type="hidden"></form>
<a href=javascript:history.back()>返 回</a>
<%
end sub


htmlend

%>