<!-- #include file="Setup.asp" --><%
top


ForumID=int(Request("ForumID"))
order=HTMLEncode(Request("order"))
SpecialTopic=HTMLEncode(Request("SpecialTopic"))
SortOrder=Request("SortOrder")
TimeLimit=Request("TimeLimit")
GoodTopic=Request("GoodTopic")
if Len(order)>10 then error("<li>非法操作")
if Len(SpecialTopic)>25 then error("<li>专题名字太长")

sql="select * from [BBSXP_Forums] where id="&ForumID&""
Set Rs=Conn.Execute(sql)
if Rs.eof then error"<li>该论坛已经被删除"
ForumName=Rs("ForumName")
ForumThreads=Rs("ForumThreads")
Moderated=Rs("Moderated")
ForumLogo=Rs("ForumLogo")
followid=Rs("followid")
ForumHide=Rs("ForumHide")
IsModerated=Rs("IsModerated")
ForumRules=YbbEncode(Rs("ForumRules"))
ForumThreads=Rs("ForumThreads")
TolSpecialTopic=Rs("TolSpecialTopic")
Rs.close
%>
<!-- #include file="inc/ForumPermissions.asp" -->
<%if PermissionsView=0 then error("<li>您的<a href=ShowForumPermissions.asp?ForumID="&ForumID&">权限</a>不够")%>

<title><%=ForumName%></title>
<meta http-equiv="refresh" content="300">
<script>if ("<%=ForumLogo%>"!=''){Logo.innerHTML="<img border=0 src=<%=ForumLogo%> onload='javascript:if(this.height>60)this.height=60;'>"}</script>

<%if Request("checkbox")=1 then
BBSList(0)
%>
<form method="POST" action="ForumManage.asp">
<input type=hidden name=ForumID value=<%=ForumID%>>
<%end if%><div class="mainnav">
<table cellspacing=1 cellpadding=5 border=0 width=100% class=a2>
	<tr class="a3">
		<td colspan="7">
		<table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td>&nbsp;<img src="images/Forum_nav.gif">&nbsp; <%ClubTree%> 
				→ <%ForumTree(followid)%><%=ForumTreeList%>
				<a href="ShowForum.asp?ForumID=<%=ForumID%>"><%=ForumName%></a></td>
				<td align="right">
<%
if Moderated<>empty then
filtrate=split(Moderated,"|")
for i = 0 to ubound(filtrate)
ModeratedList=ModeratedList&"<div class=menuitems><a href=Profile.asp?UserName="&filtrate(i)&">"&filtrate(i)&"</a></div>"
next
%><img src=images/team.gif> <a onmouseover="showmenu(event,'<%=ModeratedList%>')" style=cursor:default>
		论坛版主</a>
<%end if%>

<img src=images/Showdigest.gif>
 <a onmouseover="showmenu(event,'&lt;div class=menuitems&gt;&lt;a href=MyFavorites.asp?menu=add&url=<%=Server.URLEncode(""&Request.ServerVariables("script_name")&"?"&Request.ServerVariables("Query_String")&"")%>&name=<%=ForumName%>&gt;收藏论坛&lt;/a&gt;&lt;/div&gt;&lt;div class=menuitems&gt;&lt;a href=MyFavorites.asp?menu=Del&amp;url=<%=Server.URLEncode(""&Request.ServerVariables("script_name")&"?"&Request.ServerVariables("Query_String")&"")%>&name=<%=ForumName%>&gt;取消收藏&lt;/a&gt;&lt;/div&gt;')" style="cursor:default">论坛收藏</a>&nbsp;</td>
			</tr>
		</table>
		</td>
	</tr>
<%
IsShowForum=1
TopEnd=0
i=0
sql="Select * From [BBSXP_Forums] where followid="&ForumID&" and ForumHide=0 order by SortNum"
Set Rs1=Conn.Execute(sql)
if not Rs1.eof then
do while not Rs1.eof
ShowForum()


Rs1.Movenext
loop
IsShowForum=0
end if
Set Rs1 = Nothing


%>
</table>
<br>
<!----------------------广告------------------------->
<%if int(SiteSettings("DisplayTopAD"))=1 then%>
<table class="a2" cellSpacing="1" cellPadding="6" width="100%" border="0" align="center">
		<tr class="a4" align="middle">
			<td width="25%"><%=SiteSettings("TopAD1")%></td>
			<td width="25%"><%=SiteSettings("TopAD2")%></td>
			<td width="25%"><%=SiteSettings("TopAD3")%></td>
			<td width="25%"><%=SiteSettings("TopAD4")%></td>
		</tr>
		<tr class="a4" align="middle">
			<td width="25%"><%=SiteSettings("TopAD5")%></td>
			<td width="25%"><%=SiteSettings("TopAD6")%></td>
			<td width="25%"><%=SiteSettings("TopAD7")%></td>
			<td width="25%"><%=SiteSettings("TopAD8")%></td>
		</tr>
	</table><br>
<%end if%>
<!----------------------广告------------------------->
<%if ForumRules<>"" then%>
<table cellpadding=8 class=a3 width=100% style=" BORDER-RIGHT:#ccc 1px dotted; BORDER-TOP:#ccc 1px dotted; BORDER-LEFT:#ccc 1px dotted; BORDER-BOTTOM:#ccc 1px dotted;">
	<tr>
		<td><strong><font color="#ff0000">版 规 和 导 读</font></strong><br><%=ForumRules%></td>
	</tr>
</table><br><%end if%>

<!-- #include file="inc/line.asp" --><%


if IsShowForum=1 or SiteSettings("SortShowForum")=1 then

ForumIDOnline=Conn.execute("Select count(sessionid)from [BBSXP_UsersOnline] where ForumID="&ForumID&"")(0)
regForumIDOnline=Conn.execute("Select count(sessionid)from [BBSXP_UsersOnline] where ForumID="&ForumID&" and UserName<>''")(0)
%>
<table cellspacing=1 cellpadding=5 border=0 width=100% class=a2>
	<tr class="a1">
		<td colspan="2">　在线统计</td>
	</tr>
	<tr class="a3"><td align="center" width="5%"><img src="images/totel.gif"></td>
		<td valign="top">
<img src="images/plus.gif" id="followImg" style="cursor:hand;" onclick="loadThreadFollow(<%=ForumID%>)"> 
		目前论坛总在线 <b><%=Onlinemany%></b> 人，本分论坛共有 <b><%=ForumIDOnline%></b> 人在线。其中注册用户 
		<b><%=regForumIDOnline%></b> 人，访客 <b><%=ForumIDOnline-regForumIDOnline%></b> 
		人。
		<div style="display:none" id="follow">
			<hr width="90%" SIZE="1" align="left"><span id=followTd><img src=images/loading.gif>正在加载...</span></div>
</td>
	</tr>
</table><br>


<table cellspacing=0 cellpadding=0 border=0 width=100%>
	<tr>
		<td align="Left">
		<a href="NewTopic.asp?ForumID=<%=ForumID%>"><img src=images/Style/<%=Request.Cookies("skins")%>/post.gif border="0" title="发表主题"></a>
<%if PermissionsCreatePoll=1 then%><a href="NewTopic.asp?ForumID=<%=ForumID%>&Poll=1"><img src=images/Style/<%=Request.Cookies("skins")%>/vote.gif border="0" title="发起投票"></a><%end if%>
		</td>
		<td align="right">
		

<%if IsModerated=1 then%>
<a href="ForumManage.asp?menu=Censorship&ForumID=<%=ForumID%>&checkbox=1">帖子审核(<%=conn.Execute("Select count(ID) From [BBSXP_Threads] where IsDel=1 and PostTime=lasttime and ForumID="&ForumID&" ")(0)%>)</a> |
<%end if%>
<a href="?ForumID=<%=ForumID%>&GoodTopic=1">精华主题</a> |
<a href="ShowForumPermissions.asp?ForumID=<%=ForumID%>">论坛权限</a> |
<a href="ForumManage.asp?menu=ForumData&ForumID=<%=ForumID%>">版块管理</a> | 
<a href="Rss.asp?ForumID=<%=ForumID%>"><img src="images/rss_button.gif" border="0" title="订阅 RSS 源"></a> | 
<script>
var AllForumNameList=GetCookieData("ForumNameList");
var NowForumName="<option value='ShowForum.asp?ForumID=<%=ForumID%>'>" + document.title + "</option>";
if(AllForumNameList.indexOf(NowForumName)==-1){document.cookie= "ForumNameList" + "=" + escape(NowForumName+AllForumNameList);}
document.write("<select onchange='location=this.options[this.selectedIndex].value;'><option>最近访问的版块...</option>" + AllForumNameList+ "</select>");
</script>
		</td>
	</tr>
</table>



<table cellspacing=1 cellpadding=5 border=0 width=100% class=a2>
	<%
if TolSpecialTopic<>empty then
response.write "<tr class=a3><td width=100% colSpan=7>专题："
filtrate=split(TolSpecialTopic,"|")
for i = 0 to ubound(filtrate)
response.write "<font face='Old English Text MT'><b>"&i+1&"</b></font>[<a href='ShowForum.asp?ForumID="&ForumID&"&SpecialTopic="&filtrate(i)&"'>"&filtrate(i)&"</a>] "
TolSpecialTopicOptionList=TolSpecialTopicOptionList&"<option value="&filtrate(i)&">"&filtrate(i)&"</option>"
next
response.write "</td></tr>"
end if
%>
<tr id="TableTitleLink" class="a1">
<td align="center" colspan="3">主题</td>
<td align="center" width="10%">作者</td>
<td align="center" width="6%">回复</td>
<td align="center" width="6%">点击</td>
<td align="center" width="25%">最后更新</td>
</tr>
<tr class=a3 height=20><td></td>
<td colspan="6"><span><font color=red><b>置顶主题</b></font></span></td>
</tr>
	<%
if TimeLimit<>"" then SQLTimeLimit="and lasttime>"&SqlNowString&"-"&int(TimeLimit)&""
if SpecialTopic<>"" then SQLSpecialTopic="and SpecialTopic='"&SpecialTopic&"'"
if GoodTopic<>"" then SQLGoodTopic="and IsGood=1"

if order="" then order="lasttime"
if SortOrder="1" then
SqlSortOrder=""
else
SqlSortOrder="Desc"
end if
topsql="[BBSXP_Threads] where IsDel=0 and ForumID="&ForumID&" "&SQLSpecialTopic&" "&SQLTimeLimit&" "&SQLGoodTopic&" or IsTop=2"

if Request("TimeLimit")<>"" or Request("SpecialTopic")<>"" or Request("GoodTopic")<>"" then
TotalCount=conn.Execute("Select count(ID) From "&topsql&" ")(0) '获取数据数量
else
TotalCount=ForumThreads  '获取数据数量
end if

PageSetup=SiteSettings("ThreadsPerPage") '设定每页的显示数量
TotalPage=Abs(Int(TotalCount/PageSetup*(-1))) '总页数
PageCount = cint(Request.QueryString("PageIndex")) '获取当前页
if PageCount <1 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage

sql=""&topsql&" order by IsTop Desc,"&order&" "&SqlSortOrder&""
if PageCount<11 then
Set Rs=Conn.Execute(sql)
else
rs.Open sql,Conn,1
end if


if TotalPage>1 then RS.Move (PageCount-1) * pagesetup

i=0
Do While Not RS.EOF and i<pagesetup
i=i+1
ShowThread()

Rs.MoveNext
loop
Rs.Close
if Request("checkbox")=1 then


%><tr id="TableTitleLink" class="a3">
<td colspan="7"><input type="checkbox" name="chkall" onclick="ThreadIDCheckAll(this.form)" value="ON">全选
<input type="radio" value="BatchDel" name=menu><select name=IsDel>
<option value="1">删除帖子</option>
<option value="0">取消删除</option>
</select>&nbsp;

<input type="radio" value="BatchGOOD" name=menu><select name=IsGOOD>
<option value="1">加入精华</option>
<option value="0">取消精华</option>
</select>&nbsp;

<input type="radio" value="BatchLocked" name=menu><select name=IsLocked>
<option value="1">锁定</option>
<option value="0">解锁</option>
</select>

<input type="radio" value="BatchSpecialTopic" name=menu><select name=SpecialTopic>
<option value="">取消专题</option>
<option selected value="">更改专题</option>
<%=TolSpecialTopicOptionList%>
</select>

<input type="radio" value="BatchMoveTopic" name=menu><select name=AimForumID>
<option selected value="">移动到以下论坛</option>
<%=ForumsList%>
</select>&nbsp;


<input onclick="return confirm('您确定执行本次操作?');" type="submit" value=" 执 行 ">
</td></form>
</tr>

<%end if%>
</table>

<table cellspacing=0 cellpadding=0 border=0 width=100%>
	<tr>
		<td>
		<a onmousedown="ToggleMenuOnOff('ForumOption')" class="CommonImageTextButton" style="BACKGROUND-IMAGE: url(images/ForumSettings.gif)" href="#ForumOption">
		选项</a>
		<a onmousedown="ToggleMenuOnOff('ForumSearch')" class="CommonImageTextButton" style="BACKGROUND-IMAGE: url(images/finds.gif)" href="#ForumSearch">
		搜索</a>
		<div id="ForumSearch" style="position:absolute;display:none;">
			<form name="form" action="Search.asp?menu=ok&ForumID=<%=ForumID%>&Search=key&sessionid=<%=session.sessionid%>" method="POST">
				<input name="content" size="20" onkeyup="ValidateTextboxAdd(this, 'btnadd')" onpropertychange="ValidateTextboxAdd(this, 'btnadd')">
				<input type="submit" value="搜索" id="btnadd" disabled>
			</form>
		</div>
		</td>		
		<td align="right">
<%ShowPage()%>
</td>
	</tr>
</table>

<div id="ForumOption"  style="display:none;">
<table border=0 width=100%>
	<tr>
		<td valign="top">
		<form name="form" action="ShowForum.asp?ForumID=<%=ForumID%>" method="POST">
			排序规则：<select name="order">
			<option value="">最后更新时间</option>
			<option value="id">主题发表时间</option>
			<option value="IsGood">精华帖子</option>
			<option value="IsVote">投票帖子</option>
			<option value="Topic">主题</option>
			<option value="UserName">作者</option>
			<option value="Views">点击数</option>
			<option value="Replies">回复数</option>
			</select> 根据 <select name="SortOrder">
			<option value="0" selected>降序</option>
			<option value="1">升序</option>
			</select> 排列<br>
			日期过滤：<select name="TimeLimit">
			<option value="">显示所有</option>
			<option value="1">一天以来</option>
			<option value="2">两天以来</option>
			<option value="3">三天以来</option>
			<option value="7">一星期以来</option>
			<option value="14">两星期以来</option>
			<option value="30">一个月以来</option>
			<option value="60">两个月以来</option>
			<option value="90">三个月以来</option>
			<option value="180">六个月以来</option>
			</select><br>
			<input type="submit" value=" 应用 "></form></td>
		<td valign="top" align="right">
		您 <b><%if PermissionsPost=0 then%>不<%end if%>能</b> 在此版发表新主题<br>
		您 <b><%if PermissionsReply=0 then%>不<%end if%>能</b> 在此版回复主题<br>
		您 <b><%if PermissionsEdit=0 then%>不<%end if%>能</b> 在此版修改您发表的帖子<br>
		您 <b><%if PermissionsDelete=0 then%>不<%end if%>能</b> 在此版删除您发表的帖子<br>
		您 <b><%if PermissionsCreatePoll=0 then%>不<%end if%>能</b> 在此版发起投票<br>
		您 <b><%if PermissionsVote=0 then%>不<%end if%>能</b> 在此版参与投票<br>
		您 <b><%if PermissionsAttachment=0 then%>不<%end if%>能</b> 在此版上传附件<br>
		该版帖子<b><%if IsModerated =0 then%>不<%end if%>需要审核</b></td>
	</tr>
</table>
</div>
<%
end if

htmlend
%>