<!--#include file="Inc.asp"-->
<!--#include file="Inc/Page_Cls.asp"-->
<%
Dim PageString,strPageInfo
If Request("find")<>"" then
	Response.Redirect"Search.asp?key="&Request("find")&"&SType=2&STime=0&TB="&BBS94KK.TB&"&BoardID="&BBS94KK.BoardID&"&Action=Topic"
	Response.End
End IF
BBS94KK.CheckBoard()
BBS94KK.Head ""
If BBS94KK.BoardChild>0 Then ShowBoard()
If BBS94KK.BoardDepth>0 And BBS94KK.BoardString(0)="0" Then
PageString=ShowTopicList
Else
'版块图例
End If
Response.Write(PageString)
BBS94KK.Footer()
Set BBS94KK=Nothing
	
'获得下级论坛
Sub ShowBoard()
	Dim Board,Rs,i,BigBoard,BoardChild,BoardStr,II
	Dim area,area2,Child,width
	With BBS94KK
	If Not IsArray(.Board_Rs) Then .GetBoardCache()
	If Not IsArray(.Board_Rs) Then Exit Sub
	area=.ReadSkins("版块分区表格")
	area2=.ReadSkins("版块分区简洁表格")
	For i=0 To Ubound(BBS94KK.Board_Rs,2)
		If .Board_Rs(1,i)=.BoardID Then
			If .BoardString(1)="1" or Session(CacheName& "BoardStyle")="1" Then
				BigBoard=area2
				Child=Int(.Board_Rs(8,i))
				If Child<Int(.BoardString(2)) Then
					Width=100\Child
				Else
					width=100\Int(.BoardString(2))
				End If
				II=0
			Else
				BigBoard=area
			End If
				BoardStr=Replace(BigBoard,"{分类名称}",.Board_Rs(3,i))
		ElseIf .Board_Rs(2,i)=.BoardID Then
			If .BoardString(1)="1" or Session(CacheName& "BoardStyle")="1" Then
			Child=Child-Int(.Board_Rs(8,i))
				II=II+1
				If II=Int(.BoardString(2)) or II=Child Then
					BoardChild=BoardChild&"<div><div style='float:left;max-width:"&width&"%'>"&.GetBoardInfo("1",i)&"</div><div style='clear: both;'></div></div>"
				Else
					BoardChild=BoardChild&"<div style='float:left;width:"&width&"%'>"&.GetBoardInfo("1",i)&"</div>"
				End If
			Else
				BoardChild=BoardChild&.GetBoardInfo("0",i)
			End IF
		End If
	Next
	BoardStr=Replace(BoardStr,"{显示版块}",BoardChild)
	Board = Board&BoardStr
	Response.Write Board
	End With
End Sub

Function ShowTopicList()
	Dim S,Button,S1
	Button=""
	IF BBS94KK.BoardString(4)="0" or  BBS94KK.MyAdmin=9 Or (BBS94KK.MyAdmin=7 And BBS94KK.IsBoardAdmin) Then
	Button="<a href='say.asp?BoardID="&BBS94KK.BoardID&"'>"&BBS94KK.SkinsPIC(7)&"</a> <a href='Say.asp?action=vote&BoardID="&BBS94KK.BoardID&"'>"&BBS94KK.SkinsPIC(8)&"</a>"
	End If
	S=BBS94KK.ReadSkins("主题列表表格")
	S=Replace(S,"{发帖按钮}",Button)
	S=Replace(S,"{版主}",BBS94KK.Boardadmin)
	S=Replace(S,"{版块ID}",BBS94KK.BoardID)
	S=Replace(S,"{数据表ID}",BBS94KK.TB)
	S=Replace(S,"{公告}",BBS94KK.Placard(BBS94KK.BoardID))
	S=Replace(S,"{版块名称}",BBS94KK.Boardname)
	If BBS94KK.Info(21)="1" then S=Replace(S,"{显示在线}",ShowOnline()) Else S=Replace(S,"{显示在线}","")
	S=Replace(S,"{版块下拉列表}","<script language=""JavaScript"" type=""text/javascript"">BoardSelect()</script>")
	S1=ShowTopic()
	S=Replace(S,"{分页}",strPageInfo)
	S=Replace(S,"{显示主题列表}",S1)
	ShowTopicList=S
End Function

Function Showonline()
	Dim S,Boardupdate,Temp
	S=BBS94KK.ReadSkins("显示版块在线")
	S=Replace(S,"{显示在线列表}","<span id=""showon""></span>")
	S=Replace(S,"{版块ID}",BBS94KK.BoardID)
	S=Replace(S,"{在线总数}",BBS94KK.AllOnlineNum)
	S=Replace(S,"{本版在线总数}",BBS94KK.BoardOnlineNum)
	S=Replace(S,"{本版在线会员数}",BBS94KK.BoardUserOnlineNum)
	S=Replace(S,"{本版在线游客数}",Int(BBS94KK.BoardOnlineNum)-int(BBS94KK.BoardUserOnlineNum))
	Boardupdate=BBS94KK.GetEachBoardCache(BBS94KK.BoardID)
	S=Replace(S,"{今日帖数}",Boardupdate(2))
	Temp="<iframe name='hiddenframe' frameborder='0' height='0' id='hiddenframe'></iframe>"
	If Session(CacheName&"online")="1" Then 
		Temp=Replace(Temp,"id="," src='online.asp?BoardID="&BBS94KK.BoardID&"&id=1' id=")
	End If
	ShowOnline=s&Temp
End Function

Function ShowTopic()
	Dim S,intPageNow,arr_Rs,i,P,Conut,page,Flag,Condection
	Dim TopicS,Caption,Facepic,Moodpic,LastRe,RePageUrl,UploadType,RePage,leftn,ii
	intPageNow = Request.QueryString("page")
	Condection= "(BoardID="&BBS94KK.BoardID&" or TopType=5 or (TopType=4 and BoardID in ("&BBS94KK.BoardRoots&"))) And IsDel=0"
	Flag=BBS94KK.CheckNum(Request.QueryString("Flag"))
	If Flag=1 Then Condection=Condection&" And IsGood=1"
	If Flag=2 Then Condection=Condection&" And DATEDIFF('d',[LastTime],'"&BBS94KK.NowBbsTime&"')<1"
	If Flag=3 Then Condection=Condection&" And Name='"&BBS94KK.MyName&"'"
	Set P = New Cls_PageView
	P.strTableName = "[KK_Topic]"
	P.strPageUrl = "?Flag="&Flag&"&BoardID="&BBS94KK.BoardID
	P.strFieldsList = "TopicID,Face,Caption,Name,TopType,IsGood,AddTime,BoardID,LastTime,Hits,LastReply,UploadType,IsVote,ReplyNum,SqlTableID,IsLock,Font"
	P.strCondiction = Condection
	P.strOrderList = "TopType desc,LastTime desc"
	P.strPrimaryKey = "TopicID"
	P.intPageSize = Int(BBS94KK.Info(61))
	P.intPageNow = intPageNow
	P.strCookiesName = "List"&BBS94KK.BoardID&"BBS"&Flag'客户端记录总数
	'P.Reloadtime=3'默认三分钟更新Cookies
	P.InitClass
	Arr_Rs = P.arrRecordInfo
	strPageInfo = P.strPageInfo
	Set P = nothing
	If IsArray(Arr_Rs) Then
	For i = 0 to UBound(Arr_Rs, 2)
		Moodpic=BBS94KK.SkinsPIC(16)
		If Arr_Rs(13,i) > Int(BBS94KK.Info(62)) Then Moodpic=BBS94KK.SkinsPIC(15)
		If Arr_Rs(5,i)=1 Then Moodpic=BBS94KK.SkinsPIC(13)'精华
		If Arr_Rs(15,i)=1 Then Moodpic=BBS94KK.SkinsPIC(17)'锁定
		If Arr_Rs(12,i)=1 Then Moodpic=BBS94KK.SkinsPIC(14)'投票
		If Arr_Rs(4,i)=5 Then Moodpic=BBS94KK.SkinsPIC(10)'总顶
		If Arr_Rs(4,i)=4 Then Moodpic=BBS94KK.SkinsPIC(11)'区顶
		If Arr_Rs(4,i)=3 Then Moodpic=BBS94KK.SkinsPIC(12)'顶
		Facepic="<img src='pic/face/"&Arr_Rs(1,i)&".gIf' alt='' />"
		UploadType=""
		If Arr_Rs(11,i)<>"" Then Uploadtype="<img src='pic/FileType/"&Arr_Rs(11,i)&".gif' border='0' atl='"&Arr_Rs(11,i)&"' /> "
		LastRe=split(Arr_Rs(10,i),"|")
		RePage=(Arr_Rs(13,i)+1)\10
		If RePage<(Arr_Rs(13,i)+1)/10 Then RePage=RePage+1
		RePageUrl="Show.asp?id="&Arr_Rs(0,i)&"&BoardID="&BBS94KK.BoardID&"&TB="&Arr_Rs(14,i)
		Leftn=50
			If RePage>4 Then leftn=36
			If Repage>10 Then leftn=30
		S=Arr_Rs(16,i)
		Caption=BBS94KK.Fun.StrLeft(Arr_Rs(2,i),leftn)
		If Not isNull(S) And S<>"" Then
			S=Split(S,"|")
			If S(0)<>"" Then Caption="<"&S(0)&">"&Caption&"</"&S(0)&">"
			If S(1)<>"" Then Caption="<span style='color:"&S(1)&"'>"&Caption&"</span>"
		End If
		'打开方式
		If BBS94KK.Info(69)="1" Then S="target='_blank' " Else S=""
		Caption=UploadType&"<a "&S&"href='"&Repageurl&"' title='主题发布时间："&Arr_Rs(6,i)&VbCrlf&"最后回复内容："&LastRe(1)&"'>"&Caption&"</a>"
		If Repage>1 Then
			Caption=Caption&" [<img src='images/Icon/gopage.gif' width=10 height=12> "
			If RePage<=5 Then
				For ii=2 To RePage
					Caption=Caption&"<a href='"&RePageurl&"&page="&ii&"'>"&ii&"</a> "
				Next
			Else
				For ii=2 To 4
					Caption=Caption&"<a href='"&RePageurl&"&page="&ii&"'>"&ii&"</a> "
				Next
					Caption=Caption&"... <a href='"&RePageurl&"&page="&RePage&"'>"&RePage&"</a> "
			End If
			Caption=Caption&" ]"
		End If
		S=BBS94KK.ReadSkins("显示主题列表")
		If Datediff("n",Arr_Rs(8,i),BBS94KK.NowbbsTime)<=180 Then Caption=Caption&BBS94KK.SkinsPIC(18)
		S=Replace(S,"{状态}",Moodpic)		
		S=Replace(S,"{表情}",Facepic)
		S=Replace(S,"{用户名称}","<a href='UserInfo.asp?name="&Arr_Rs(3,i)&"' title='查看 "&Arr_Rs(3,i)&" 的资料'>"&Arr_Rs(3,i)&"</a>")
		S=Replace(S,"{回复数}",Arr_Rs(13,i))
		S=Replace(S,"{点击数}",Arr_Rs(9,i))
		S=Replace(S,"{主题时间}",Arr_Rs(6,i))
		S=Replace(S,"{最后时间}",Arr_Rs(8,i))
		'S=Replace(S,"{最后时间}","<font title='时间："&FORMATDATETIME(Arr_Rs(8,i),3)&"'>"&FORMATDATETIME(Arr_Rs(8,i),1)&"</font>")
		S=Replace(S,"{回复用户名称}",LastRe(0))
		S=Replace(S,"{主题}",Caption)
		TopicS=TopicS&S
	Next
	End If
	ShowTopic=TopicS
End Function
%>