<!--#include file="Conn.asp" -->
<!--#include file="CheckLogin.asp" -->


<link type=text/css href='private.css' rel=stylesheet>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
</head>
<table border=0 cellspacing=1 align=center class=navi>
	<tr align=left><th>&nbsp;当前位置：公告</th></tr>
	</table>
	<br>
	<br>
<table  cellspacing='1'   class=list align=center>
<tr align=left ><th colspan=3>&nbsp;公告 <a href=notice.asp?action=add>添加</a></th></tr>
<%
set NewOpenConn=New Conn
set OpenCn= NewOpenConn.OpenConn
set rs = server.createobject("ADODB.recordset")
asql="select  * from   notice order by  paixu asc "
rs.open asql,OpenCn
if  rs.eof and rs.bof then

else

while not rs.eof
%>
<tr><td>
显示：<%
 xianshi1=rs("xianshi")
if  xianshi1=true then
response.write "<font color=#ff0000>显示</font>"
else
response.write"<font color=#ff0000>不显示</font>"

end if 

%> 排序 <%=rs("paixu")%> | 公告名称：<a  href=notice.asp?action=edit&id=<%=rs("id")%>><%=rs("Title")%></a> ;<input  type=button  onclick="location.href='notice.asp?action=edit&id=<%=rs("id")%>';"     type=button   value='修  改'  style='background:url(left.files/bb.jpg);width:70px;height:18px;padding-top:2px;'> <input  type=button style='background:url(left.files/bb.jpg);width:70px;height:18px;padding-top:2px;'  value='删 除'  onclick="javascript:if(confirm('确实要删除吗?'))location='notice.asp?action=Delete&id=<%=rs("id")%>'"      >
</td></tr>
<%
rs.movenext
wend
rs.Close
set rs=nothing

end  if
%>


<%
action=request.querystring("action")
if action="edit" then
id=request.querystring("id")
set rs = server.createobject("ADODB.recordset")
bsql="select  * from notice  where id="&id&""
rs.open bsql,OpenCn

%>
<form action=notice.asp?action=resave&id=<%=rs("id")%> method=post>

<tr><td>
公告名称：<input type=text name="Title"  value="<%=rs("Title")%>">
公告排序：<input type=text name="paixu"   value="<%=rs("paixu")%>">&nbsp;
显示：&nbsp; 
     <% xianshi=rs("xianshi")
     if xianshi=true then
     %> 
      是 <input type="radio" name="xianshi" value="true"  checked>
           
      否 <input name="xianshi" type="radio" value="false"  >
      <%else%>
       是 <input type="radio" name="xianshi" value="true" >
           
      否 <input name="xianshi" type="radio" value="false"  checked >

   <%end if%>
</td></tr><tr><td>

</td></tr>
<tr><td>
内容<textarea name='content' id=content rows="9" cols="70"    ><%=rs("Content")%></textarea>


</td></tr>
<tr><td> <input  type=submit value="提交修改"  style='background:url(left.files/bb.jpg);width:70px;height:18px;padding-top:2px;'></td></tr>
</form>
<%
rs.Close
set rs=nothing

end if
%>


<%
reaction=request.querystring("action")
if reaction="resave"  then
id=request.querystring("id")

Title=request.form("Title")
paixu=request.form("paixu")
content=request.form("content")
xianshi=request.form("xianshi")
set rs = server.createobject("ADODB.recordset")
bsql="select  * from  notice  where id="&id&""
rs.open bsql,OpenCn,1,3

rs("Title")=Title
rs("paixu")=paixu
rs("content")=content
rs("xianshi")=xianshi

rs.update
Response.Write"<script language=javascript>alert('公告修改成功');this.location.href='notice.asp';</script>"
end if
%>

<%
if Action="Delete" then
id=request.querystring("id")

 OpenCn.execute "delete from notice where id = "&id&" ",,adcmdtext
 response.write("<script>alert('删除成功!');window.location.href='notice.asp'</script>")
 Response.end
 end   if
%>

<%if  action="add"  then
%>
<form action=notice.asp?action=addsave method=post>
<tr><td>&nbsp;公告名称：<input type=text name=Title1>公告排序：<input type=text name="paixu1"   >
显示：是 <input type="radio" name="xianshi" value="true"  checked>
           
      否 <input name="xianshi" type="radio" value="false"  >
</td></tr>
<tr><td>
内容<textarea name='content' id=content cols="70" rows="9"  ></textarea>
</td></tr>
<tr><td><input   type=submit   value="提 交"  style='background:url(left.files/bb.jpg);width:70px;height:18px;padding-top:2px;'></td></tr>
</form>


<%
end if %>

</table>

<%
action=request.querystring("action")
if action="addsave"  then

paixu1=request.form("paixu1")

if not isnumeric(paixu1) then
Response.Write"<script language=javascript>alert('排序，请输入数字！');this.location.href='notice.asp';</script>"
Response.end
end if
Title1=request.form("Title1")
xianshi1=request.form("xianshi")
content1=request.form("content")
set rs = server.createobject("ADODB.recordset")
bsql="select  * from notice  "
rs.open bsql,OpenCn,1,3

rs.addnew
rs("Title")=Title1
rs("xianshi")=xianshi1
rs("paixu")=paixu1
rs("content")=content1

rs.update
Response.Write"<script language=javascript>alert('公告添加成功');this.location.href='notice.asp';</script>"
end if
%>