www.gusucode.com > CC校友录贴吧 CCBar源码程序asp编程 > forum/forum_list.asp
<% '=================================================================== '= ASP FILENAME : /forum/forum_list.asp '= CREATED TIME : JAN,29,2004 '= LAST MODIFIED: JAN,29,2004 '= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com '= DESCRIPTION : 贴吧主题列表 '= Change Log: '=================================================================== %> <!-- #include file = "../inc/customer/include_customer_action_view.asp" --> <!-- #include file = "../main_func.asp" --> <!-- #include file = "./forum_func.asp" --> <% '======================================================== '== Action参数设置 '======================================================== '== 页面名 Const CONST_PAGE_FILE = "forum/forum_list.asp" '== 页面标题/功能 Const CONST_PAGE_TITLE = "贴吧主题列表" '== 功能函数名字空间 Const CONST_ACTION_FUNC = "ShowForumListCtl" '== 相对根目录路径 GBL_strHomeURL = "../" '== 页面构造 Call ActionBuild() '== 在模板中引用的标签变量 Dim TAG_strVerifyCode '== 表单校验 Dim TAG_objDicUnit '== 单列记录 '== 请求校验与过滤 Call ActionFilter(CONST_PAGE_FILE,CONST_ACTION_FUNC) '== 页面析构 Call ActionOver() %> <% '=================================================================== '= Function : LoadPageTpl() '= Time : Created At 2006-5-4 '= Description : 加载页面模块 '=================================================================== Function LoadPageTpl() %> <!-- #include file = "../template_c/page_forum_cate_list.html.asp" --> <% End Function '=================================================================== '= Function : ShowContentTopics(objRSCont,intMaxPerPage) '= Time : Created At Jan,29,2004 '= Input : objRSCont : rs '= Description : Show per topics '=================================================================== Function ShowContentTopics(objRSCont,intMaxPerPage,intForumId) Dim i Dim clsTable '== the object of table Dim strHtmlCode,strTmp,strNowTitle,strQuery '== 贴吧导航条 Call ShowForumMenu() strNowTitle = "" Set clsTable = New classTable '== Set table prameters clsTable.Border = "0" clsTable.CellPadding = "5" clsTable.CellSpacing = "1" clsTable.Width = "100%" clsTable.ClassType = "TBone" clsTable.Align = "center" strQuery = Trim(Request("pstAddType")) clsTable.PostFile = "forum_list.asp?action=ShowContentTopics&pstAddType=" clsTable.MakeTable() i = 0 '== Set table header clsTable.AddTitleTr "" clsTable.AddTitleTd "<b>ID</b>","TBHead","5%" clsTable.AddTitleTd "<b>主 题</b>","TBHead","42%" clsTable.AddTitleTd "<b>作 者</b>","TBHead","12%" clsTable.AddTitleTd "<b>回复/人气</b>","TBHead","12%" clsTable.AddTitleTd "<b>最后更新 | 回复人</b>","TBHead","" Do While Not objRSCont.Eof i = i + 1 clsTable.AddTr "TBBG1 onmouseover=BgChange(this,'TBBG9') onmouseout=BgChange(this,'TBBG1') " Select Case objRSCont("TOPICS_STATUS") Case 0 : strHtmlCode = MakeImg(GBL_strImgDir & "ico/forum_comm.gif","编号" & objRSCont("TOPICS_ID")) strNowTitle = "" If objRSCont("TOPICS_REPLY_FORBID") = 1 Then strHtmlCode = MakeImg(GBL_strImgDir & "ico/forum_forbid.gif","禁止回复 编号" & objRSCont("TOPICS_ID")) ElseIf objRSCont("TOPICS_REPLIES") > 10 Or objRSCont("TOPICS_HITS") > 30 Then strHtmlCode = MakeImg(GBL_strImgDir & "ico/forum_hot.gif","热贴 编号" & objRSCont("TOPICS_ID")) End If If objRSCont("TOPICS_GOOD") = 1 Then strHtmlCode = MakeImg(GBL_strImgDir & "ico/forum_good.gif","精华贴 编号" & objRSCont("TOPICS_ID")) End If Case 9 : strHtmlCode = MakeImg(GBL_strImgDir & "ico/forum_top.gif","编号" & objRSCont("TOPICS_ID")) strNowTitle = "[置顶贴]" Case 10 : strHtmlCode = MakeImg(GBL_strImgDir & "ico/forum_alltop.gif","编号" & objRSCont("TOPICS_ID")) strNowTitle = "[公共贴]" Case else : strHtmlCode = "不正常" End Select clsTable.AddTd strHtmlCode,"TBBG9 style='text-align:center;'" strTmp = "" If Instr(objRSCont("TOPICS_CONTENT"),"[IMG]http:") > 0 And Instr(objRSCont("TOPICS_CONTENT"),"[/IMG]") > 0 Then strTmp = MakeImg(GBL_strImgDir & "ico/forum_img.gif","") End If If Instr(objRSCont("TOPICS_CONTENT"),"[RM") > 0 And Instr(objRSCont("TOPICS_CONTENT"),"[/RM") > 0 Then strTmp = MakeImg(GBL_strImgDir & "ico/forum_rm.gif","") End If If objRSCont("TOPICS_STATUS") = 10 And objRSCont("TOPICS_FORUM_ID") <> Cint(intForumId) Then '== all top strHtmlCode = "<a href=""" & GBL_strHomeURL & "forum/forum_show.asp?action=ShowForumContent&TopicsId=" & objRSCont("TOPICS_ID") & "&ForumId=" & objRSCont("TOPICS_FORUM_ID") & """ target=_blank title='浏览该贴子'>" & strNowTitle & strTmp & objRSCont("TOPICS_TITLE") & "</a>" Else strHtmlCode = MakeLink("forum/forum_show.asp?action=ShowForumContent&TopicsId=" & objRSCont("TOPICS_ID") & "&ForumId=" & objRSCont("TOPICS_FORUM_ID"),strNowTitle & strTmp & objRSCont("TOPICS_TITLE"),"浏览该贴子") End If clsTable.AddTd " " & strHtmlCode,"" clsTable.AddTd "<span style='cursor:hand' title='查看用户信息' onclick=window.open('../address/address_userinfo_pop.asp?intUserId=" & objRSCont("TOPICS_OWNER_ID") & "','','left=5,top=5,width=450,height=410,scrollbars=yes,status=yes');>" & objRSCont("TOPICS_OWNER") & "</span>","TBBG9 style='text-align:center;'" clsTable.AddTd objRSCont("TOPICS_REPLIES") & "/" & objRSCont("TOPICS_HITS")," style='text-align:center;'" strTmp = FormatDateTime(objRSCont("TOPICS_LAST_POST"),vbShortDate) strTmp = Right(strTmp,Len(strTmp) - 2) strTmp = strTmp & " " & FormatDateTime(objRSCont("TOPICS_LAST_POST"),vbShortTime) If Day(objRSCont("TOPICS_LAST_POST")) = Day(now) And Year(objRSCont("TOPICS_LAST_POST")) = Year(now) And Month(objRSCont("TOPICS_LAST_POST")) = Month(now) Then strTmp = "<font color=red>" & strTmp & "</font>" End If clsTable.AddTd " " & strTmp & " | " & objRSCont("TOPICS_LAST_POSTER"),"TBBG9 " If i >= intMaxPerPage Then Exit Do objRSCont.MoveNext Loop clsTable.OutPutTable() Set clsTable = Nothing End Function '=================================================================== '= Function : ShowForumListCtl() '= Time : Created At 2006-5-4 '= Input : None '= Description : 贴吧主题列表 '=================================================================== Function ShowForumListCtl() Dim strFileName Dim intMaxPerPage Dim strHtmlCode Dim intCurPage,intTotalPut Dim i Dim intClass,GetRSId Dim blnGood,blnSub,strGood,strSub '== forum search If Trim(Request.QueryString("ACT_MODE")) = "ACT_SEARCH" Then Call FormForumSearch() Exit Function End If '== get topics good field strGood = Trim(Request.QueryString("ACT_MODE")) If strGood = "ACT_TOPICS_GOOD" Then blnGood = True Else blnGood = False End If '== get topics subject strSub = Trim(Request.QueryString("ACT_MODE")) If strSub = "ACT_TOPICS_SUBJECT" Then blnSub = True Else blnSub = False End If intMaxPerPage = GBL_intMaxPerPage intMaxPerPage = 20 If Not IsEmpty(Request("intPageNow")) Then intCurPage = Cint(Request("intPageNow")) Else intCurPage = 1 End If GetRSId = Trim(Request("ForumId")) If Not IsNumeric(GetRSId) Then Call ResultExecute(E_USER_PUB,"该帖子ID错误","ES_ERR") End If Call CheckMasterForum(GetRSId) Dim strSearch strSearch = "" If Trim(Request("iptSearchKey")) <> "" Then If IsNumeric(Trim(Request("selKeyMode"))) And Trim(Request("selKeyMode")) = "2" Then strSearch = " AND USER_REALNAME LIKE '%" & Trim(Request("iptSearchKey")) & "%' " Else strSearch = " AND TOPICS_TITLE LIKE '%" & Trim(Request("iptSearchKey")) & "%' " End If End If strFileName = "forum_list.asp?action=ShowForumList&ForumId=" & GetRSId & "&iptSearchKey=" & Trim(Request("iptSearchKey")) & "&selKeyMode=" & Trim(Request("selKeyMode")) If blnGood Then strFileName = "forum_list.asp?action=ShowForumList&ForumId=" & GetRSId & "&ACT_MODE=ACT_TOPICS_GOOD" End If If blnSub Then strFileName = "forum_list.asp?action=ShowForumList&ForumId=" & GetRSId & "&ACT_MODE=ACT_TOPICS_SUBJECT&Subject=" & Trim(Request.QueryString("Subject")) End If GBL_objPubDB.Clear() GBL_objPubDB.TableName = "CLASS_TOPICS,CLASS_USER" GBL_objPubDB.SQLType = "SELECT" GBL_objPubDB.Order = "TOPICS_STATUS DESC,TOPICS_LAST_POST DESC" GBL_objPubDB.Where = " USER_ID=TOPICS_OWNER_ID AND (TOPICS_FORUM_ID=" & GetRSId & " OR TOPICS_STATUS=10) " & strSearch '== get this topics is or not good If blnGood Then GBL_objPubDB.Where = " USER_ID=TOPICS_OWNER_ID AND TOPICS_FORUM_ID=" & GetRSId & " AND TOPICS_GOOD=1 " End If If blnSub Then GBL_objPubDB.Where = " USER_ID=TOPICS_OWNER_ID AND TOPICS_FORUM_ID=" & GetRSId & " AND TOPICS_SUBJECT=" & Trim(Request.QueryString("Subject")) End If GBL_objPubDB.AddField "TOPICS_LAST_POSTER,TOPICS_LAST_POST,TOPICS_OWNER_ID,TOPICS_FORUM_ID,TOPICS_REPLY_FORBID,TOPICS_CONTENT,TOPICS_OWNER,TOPICS_TITLE,TOPICS_ID,TOPICS_STATUS,TOPICS_HITS,TOPICS_REPLIES,TOPICS_GOOD","" '== Get data GBL_objPubDB.SQLRSExecute() Call ResultExecute(GBL_objPubDB.intErrNum,"show forum list","ES_ERR") If GBL_objPubDB.intRSNum > 0 Then intTotalPut = GBL_objPubDB.intRSNum If intCurPage < 1 then intCurPage = 1 End If If (intCurPage - 1) * intMaxPerPage > intTotalPut Then If (intTotalPut Mod intMaxPerPage) = 0 Then intCurPage = intTotalPut \ intMaxPerPage Else intCurPage = intTotalPut \ intMaxPerPage + 1 End If End if If intCurPage = 1 Then Call ShowContentTopics(GBL_objPubDB.objPubRS,intMaxPerPage,GetRSId) Call ShowPage(intTotalPut,intMaxPerPage,intCurPage,strFileName) Else If (intCurPage - 1) * intMaxPerPage < intTotalPut Then GBL_objPubDB.objPubRS.Move (intCurPage - 1) * intMaxPerPage Dim BookMark BookMark = GBL_objPubDB.objPubRS.BookMark Call ShowContentTopics(GBL_objPubDB.objPubRS,intMaxPerPage,GetRSId) Call ShowPage(intTotalPut,intMaxPerPage,intCurPage,strFileName) Else intCurPage = 1 Call ShowContentTopics(GBL_objPubDB.objPubRS,intMaxPerPage,GetRSId) Call ShowPage(intTotalPut,intMaxPerPage,intCurPage,strFileName) End If End If Else Dim strShow If Trim(Request("iptSearchKey")) <> "" Then strShow = "没有找到相关帖子" Else strShow = "目前没有任何帖子" End If Response.Write "<p align=center><font color=red>" & strShow & "</font><br><a href='" & GBL_strHomeURL & "forum/forum_add_topics.asp?action=FormAddTopics&ForumId=" & GetRSId & "'>[发新帖子]</a></p>" End If GBL_objPubDB.Clear() End Function '==================================================================== '= Sub : FormForumSearch() '= Time : Created At June,29,2004 '= Input : None '= Description : search forum topics list '==================================================================== Function FormForumSearch() Dim ForumId : ForumId = Request.QueryString("ForumId") Call ShowForumMenu() %> <table width=100% border="0" cellspacing="1" cellpadding="3" align="center"> <tr bgcolor=#666699 class=TBHead> <td width=50%> <table border="0" cellspacing="0" cellpadding="0" width=50%> <form name=sform id=sform action="forum_list.asp" method=post> <input type=hidden name=ForumId value=<%=ForumId%> > <tr > <td width=8%> 搜索词:</td> <td width=10%><select name=selKeyMode> <option value=1>帖子名称</option> <option value=2>帖子作者</option> </select></td> <td width=17%><input value="" name=iptSearchKey maxlength=255 ></td> <td width=10%> <input type="image" src="<%=GBL_strHomeURL%>images/forum/sch.gif" border="0" id="image1" name="image1" WIDTH="17" height="14" align=absmiddle></td> <td width=*></td> </tr> </form> </table> </td> </tr> </table> <% End Function %>