<!--#include file="system_manage.asp"-->
<%
Dim postid,title

   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_topic where id="&id
tx_common.execute sql
 Call tx_common.message("·专题删除成功<br>·如果你的浏览器不支持跳转，<a href='admin_topic.asp'>点击这里返回</a><meta http-equiv=refresh content='3;URL=admin_topic.asp'>",1)
  Case "addsave"
  postid=request("id")
title=request.Form("title")
        If  title = "" Then Call tx_common.message("·内容不能为空<meta http-equiv=refresh content='1;URL=admin_topic.asp'>",0)
      'Save
	  If postid<>"" Then 
	   rs.open "select title from tx_topic where id="&postid,conn,1,3
	 else
	 rs.open "select title from tx_topic",conn,1,3
	  rs.AddNew
	  End If 
   rs(0) = title
	  rs.update
	  rs.close
	  Call tx_common.message("·专题添加/修改成功<br>·如果你的浏览器不支持跳转，<a href='admin_topic.asp'>点击这里返回</a><meta http-equiv=refresh content='3;URL=admin_topic.asp'>",1)
Case "add"
content=tx_tables.formtop("?action=addsave","添加专题")
content= content & tx_tables.inputs("专题名称","title","text","")
content =content & tx_tables.formfoot
Case "edit"
	 rs.open "select * from tx_topic where id="&tx_common.checkstr(request.querystring("id"),1),conn,1,3
content=tx_tables.formtop("?action=addsave&id="&rs("id"),"添加专题")
content= content & tx_tables.inputs("专题名称","title","text",rs("title"))
content =content & tx_tables.formfoot
  Case Else
content =  "<table width='100%' cellpadding=3 cellspacing=1 class=td1>"
content = content & "<tr class=td4><td colspan=3><strong>专题列表</strong></td></tr>"
content =content & "<tr class=td2><td nowap>ID</td><td width='60%'>标题</td><td width='10%'>操作</td></tr>"
temps=tx_common.query("select * from tx_topic order by id desc")
if isarray(temps) then 
for i=0 to ubound(temps,2)
content =content & "<tr class=td2><td>"&temps(0,i)&"</td><td>"&temps(1,i)&"</td><td><a href=?action=edit&id="&temps(0,i)&">编辑</a> | <a href=?action=del&id="&temps(0,i)&">删除</a></td></tr>"
next
Else 
content = content & "<tr class=td2><td colspan=3>暂时没有任何信息，请添加！</td></tr>"
End If 
content = content & tx_tables.tablesfoot
End Select
Call ClassEnd()
Call DBConnEnd()
response.write content
Call GetBottom()
%>
