<!--#include file="system_manage.asp"-->
<%
Dim sid,stitle,scontent,sauthor

   Call DBConnBegin()
	  Set rs = server.createobject("adodb.recordset")
Select Case Request("action")
Case "del"
id=tx_common.checkstr(request.querystring("id"),1)
sql="delete from tx_link where id="&id
tx_common.execute sql
 Call tx_common.message("ɾɹ<br>֧ת<a href='admin_link.asp'>ﷵ</a><meta http-equiv=refresh content='3;URL=admin_announce.asp'>",1)
  Case "addsave"
	stitle=request.Form("title")
	sauthor=request.Form("author")
	scontent=request.Form("content")
        If stitle="" Or scontent = "" Then Call tx_common.message("ݲΪ<meta http-equiv=refresh content='1;URL=admin_announce.asp'>",0)
      'Save
	 rs.open "select tx_title,tx_author,tx_content,tx_time from tx_announce",conn,1,3
	  rs.AddNew
   rs(0) = stitle
   rs(1) = sauthor
   rs(2) = scontent 
   rs(3) = Now()
	  rs.update
	  rs.close
	  Call tx_common.message("վӳɹ<br>֧ת<a href='admin_announce.asp'>ﷵ</a><meta http-equiv=refresh content='3;URL=admin_announce.asp'>",1)
  Case "editsave"
  sid=request.Form("id")
stitle=request.Form("title")
	sauthor=request.Form("author")
	scontent=request.Form("content")
        If stitle="" Or scontent = "" Then Call tx_common.message("ݲΪ<meta http-equiv=refresh content='1;URL=admin_announce.asp'>",0)
      'Save
	 rs.open "select tx_title,tx_author,tx_content,tx_time from tx_announce where id="&sid,conn,1,3
   rs(0) = stitle
   rs(1) = sauthor
   rs(2) = scontent 
   rs(3) = Now()
	  rs.update
	  rs.close
	  Call tx_common.message("վĳɹ<br>֧ת<a href='admin_announce.asp'>ﷵ</a><meta http-equiv=refresh content='3;URL=admin_announce.asp'>",1)
Case "add"
content=tx_tables.formtop("?action=addsave","ӹ")
content =content & tx_tables.inputs("","title","text","")
content =content & tx_tables.inputs("","author","text","")
content =content & tx_tables.textarea("","content","")
content =content & tx_tables.formfoot
Case "edit"
	 rs.open "select id,tx_title,tx_author,tx_content,tx_time from tx_announce where id="&tx_common.checkstr(request.querystring("id"),1),conn,1,3
content = tx_tables.formtop("?action=editsave","Ĺ")
content =content & tx_tables.inputhidden("id",rs(0))
content =content & tx_tables.inputs("","title","text",rs(1))
content =content & tx_tables.inputs("","author","text",rs(2))
content =content & tx_tables.textarea("","content",rs(3))
content = content & tx_tables.formfoot
  Case Else

content =  "<table width='100%' cellpadding=3 cellspacing=1 class=td1>"
content = content & "<tr class=td4><td colspan=5><strong>б&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HRef='?action=add'></a></strong></td></tr>"
content =content & "<tr class=td2><td nowap>ID</td><td width='40%'></td><td width='20%'></td><td width='20%'>ʱ</td><td width='10%'></td></tr>"
Set rso=conn.execute("select id,tx_title,tx_author,tx_time from tx_announce order by id desc")
If Not rso.bof And Not rso.eof Then
Do While Not rso.bof And Not rso.eof 
content =content & "<tr class=td2><td>"&rso(0)&"</td><td>"&rso(1)&"</td><td>"&rso(2)&"</td><td>"&rso(3)&"</td><td><a href=?action=edit&id="&rso(0)&">༭</a> | <a href=?action=del&id="&rso(0)&">ɾ</a></td></tr>"
rso.movenext
Loop
Else 
content = content & "<tr class=td2><td colspan=5>ʱûκι棬ӣ</td></tr>"
End If 
content = content & tx_tables.tablesfoot
rso.close 
End Select
Call ClassEnd()
Call DBConnEnd()
response.write content
Call GetBottom()
%>
