<!-- #include file=../inc/BBSsetup.asp -->
<!-- #include file=../inc/Board_Popfun.asp -->
<!-- #include file=inc/UserTopic.asp -->
<!--#include file="xgcity_community_head.asp" -->
<%
dim Assort_id
Assort_id=0
%>
<script>
if(self!=top){top.location=self.location;}
function switchSysBar(){
if (switchPoint.innerText==3){
switchPoint.innerText=4
document.all("frmTitle").style.display="none"
}else{
switchPoint.innerText=3
document.all("frmTitle").style.display=""
}}
</script>
<table border="0" cellPadding="0" cellSpacing="0" height="100%" width="100%">
<tbody>
  <tr>
    <td height="100%" align="left" vAlign="top" noWrap id="frmTitle">
    <iframe frameBorder="0" id="carnoc" name="carnoc" scrolling="no" src="../left.asp?Assort_id=<%=Assort_id%>" style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 92px; Z-INDEX: 2">
    </iframe>    </td>
    <td style="WIDTH: 9pt" >
    <table border="0" cellPadding="0" cellSpacing="0" height="100%">
	<tbody>
      <tr>
        <td style="HEIGHT: 100%" onclick="switchSysBar()" background="../images/left/bg.gif" style=CURSOR:hand; title=开启/关闭左边导航栏>
<font style=COLOR:#ffffff;CURSOR:hand;FONT-FAMILY:Webdings;FONT-SIZE:9pt;>
<SPAN id=switchPoint>3</SPAN></font></td>
      </tr>
	  </tbody>
    </table>
    </td>
    <td align="left" valign="top" style="WIDTH: 100%">

<%
DEF_BBS_HomeUrl = "../"
Dim GBL_ID,GBL_Name
GBL_CHK_TempStr = ""
GBL_Name = Request("Name")
GBL_ID = Left(Request("ID"),14)
If GBL_Name = "" Then GBL_Name = GBL_ID
If GBL_ID="" or isNumeric(GBL_ID)=0 Then GBL_ID = 0
GBL_ID = cCur(GBL_ID)
If GBL_ID > 0 or GBL_Name <> "" Then GBL_CHK_PWdFlag = 0
initDatabase

SiteHead(DEF_SiteNameString & " - 社员社员区")
UpdateOnlineUserAtInfo GBL_board_ID,"查看社员发表的精华帖子"

If GBL_ID = 0 and GBL_Name = "" Then
	If GBL_ID = 0 Then GBL_ID = GBL_UserID
	GBL_CHK_TempStr = ""
	If GBL_ID = 0 Then
		GBL_CHK_TempStr = "找不到社员，要查看自己的资料请先登录。<br>" & VbCrLf
	End If
Else
	If GBL_ID <> 0 Then GBL_Name = ""
	GBL_CHK_TempStr = ""
End If

UserTopicTopInfo
DisplayUserNavigate("查看社员发表的精华帖子")
If GBL_CHK_TempStr <> "" Then
	Response.Write "<br><p align=left><font color=ff0000 class=RedFont><b>" & GBL_CHK_TempStr & "</b></font>"
Else
	GBL_CHK_TempStr = ""
	DisplayCenter
End If

UserTopicBottomInfo
closeDataBase
SiteBottom
If GBL_ShowBottomSure = 1 Then Response.Write GBL_SiteBottomString

Function DisplayCenter

	Dim Rs,SQL,NewNum,UserName,recordCount
	
	If GBL_ID > 0 Then
		Set Rs = Con.ExeCute("Select top 1 ID,UserName,AnnounceGood from LeadBBS_User where ID=" & GBL_ID)
		GBL_DBNum = GBL_DBNum + 1
	Else
		Set Rs = Con.ExeCute("Select top 1 ID,UserName,AnnounceGood from LeadBBS_User where UserName='" & Replace(GBL_Name,"'","''") & "'")
		GBL_DBNum = GBL_DBNum + 1
	End If
	If Not Rs.Eof Then
		UserName = Rs(1)
		GBL_ID = cCur(Rs(0))
		recordCount = cCur(Rs(2))
	Else
		recordCount = 0
		Response.Write "<br><br>&nbsp; &nbsp; &nbsp; 错误，此社员不存在！"
		Rs.Close
		Set Rs = Nothing
		Exit Function
	End if
	Rs.close
	Set Rs = Nothing
	
	GBL_CHK_TempStr=""
	Dim UpDownPageFlag
	UpDownPageFlag = Request("UpDownPageFlag")

	Dim Start,key
	Dim SQLendString

	Start = Left(Trim(Request("Start")),14)
	Start = start
	If isNumeric(Start)=0 or Start="" Then Start=999999999
	Start = cCur(Start)
	If Start = 0 Then Start=999999999

	Dim SQLCountString,whereFlag
	whereFlag = 1
	SQLendString = " where GoodFlag=1 and UserID=" & GBL_ID

	SQLCountString = SQLendString
	If UpDownPageFlag = "1" and Start>0 then
		If whereFlag = 1 Then
			SQLendString = SQLendString & " and ID>" & Start
		Else
			SQLendString = SQLendString & " where ID>" & Start
			whereFlag = 1
		End If
	Else
		If whereFlag = 1 Then
			SQLendString = SQLendString & " and ID<" & Start
		Else
			SQLendString = SQLendString & " where ID<" & Start
			whereFlag = 1
		End If
	end If

	If UpDownPageFlag = "1" then
		SQLendString = SQLendString & " Order by  ID ASC"
	Else
		SQLendString = SQLendString & " Order by ID DESC"
	End If
	
	Dim MaxRecordID,MinRecordID
	MaxRecordID = 0

	SQL = "select Max(id) from LeadBBS_Topic " & SQLCountString
	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1
	
	If not Rs.Eof Then
		If Rs(0) <> "" Then
			MaxRecordID = cCur(Rs(0))
		Else
			MaxRecordID = 0
		End If
	End If
	Rs.Close
	Set Rs = Nothing
	
	SQL = "select Min(id) from LeadBBS_Topic " & SQLCountString
	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1

	If not Rs.Eof Then
		If Rs(0) <> "" Then
			MinRecordID = cCur(Rs(0))
		else
			MinRecordID = 0
		end If
	End If
	Rs.Close
	Set Rs = Nothing

	Dim FirstID,LastID
	'SQL = "select count(*) from LeadBBS_Topic " & SQLCountString
	'Rs.Open sql,con,1,1
	'GBL_DBNum = GBL_DBNum + 1
	'if rs.eof then
	'	recordCount=0
	'else
	'	recordCount=rs(0)
	'	if recordCount="" or isNull(recordCount) or len(recordCount)<1 Then recordCount=0
	'End If
	'Rs.Close

	SQL = "select TOP "&DEF_MaxListNum&" ID,Title,Length,ndatetime,Hits,FaceIcon,ChildNum,BoardID,GoodFlag,0,TitleStyle from LeadBBS_Topic " & SQLendString
	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1
	Dim Num
	Dim GetData
	If Not rs.Eof Then
		GetData = Rs.GetRows(-1)
		Num = Ubound(GetData,2)
	Else
		Num = -1
	End If
	Rs.close
	Set Rs = Nothing
	
	Dim i,N
	If Num>=0 Then
		i=1
	
		Dim MinN,MaxN,StepValue
		SQL = ubound(getdata,2)
		If UpDownPageFlag = "1" then
			MinN = SQL
			MaxN = 0
			StepValue = -1
		Else
			MinN = 0
			MaxN = SQL
			StepValue = 1
		End If
		
		LastID = cCur(GetData(0,MaxN))
		FirstID = cCur(GetData(0,MinN))
	
		Dim EndwriteQueryString,PageSplictString
		EndwriteQueryString = "?ID=" & GBL_ID
		If key<>"" Then EndwriteQueryString = EndwriteQueryString & "&key=" & urlencode(key)
	
		PageSplictString = PageSplictString & "<table><tr><td>&nbsp;"
		If FirstID >= MaxRecordID Then
			PageSplictString = PageSplictString & "<font color=999999 class=GrayFont>首页</font> " & VbCrLf
			PageSplictString = PageSplictString & " <font color=999999 class=GrayFont>上页</font> " & VbCrLf
		else
			PageSplictString = PageSplictString & "<a href=UserAncGood.asp" & EndwriteQueryString & "&Start=0>首页</a> " & VbCrLf
			PageSplictString = PageSplictString & " <a href=UserAncGood.asp" & EndwriteQueryString & "&Start=" & FirstID & "&UpDownPageFlag=1>上页</a> " & VbCrLf
		end if
	
		if LastID<MaxRecordID and LastID<>0 then
		else
		end if
	
		If LastID <= MinRecordID Then
			PageSplictString = PageSplictString & " <font color=999999 class=GrayFont>下页</font> " & VbCrLf
			PageSplictString = PageSplictString & " <font color=999999 class=GrayFont>尾页</font> " & VbCrLf
		else
			PageSplictString = PageSplictString & " <a href=UserAncGood.asp" & EndwriteQueryString & "&Start=" & LastID & ">下页</a> " & VbCrLf
			PageSplictString = PageSplictString & " <a href=UserAncGood.asp" & EndwriteQueryString & "&Start=1&UpDownPageFlag=1>尾页</a> " & VbCrLf
		end if
		
		PageSplictString = PageSplictString & "共<b>" & recordCount & "</b>条信息"
		If (recordCount mod DEF_MaxListNum)=0 Then
			PageSplictString = PageSplictString & " 计<b>" & clng(recordCount/DEF_MaxListNum) & "</b>页"
		Else
			If recordCount>=DEF_MaxListNum Then
				PageSplictString = PageSplictString & " 计<b>" & clng(recordCount/DEF_MaxListNum)+1 & "</b>页"
			Else
				PageSplictString = PageSplictString & " 计<b>1</b>页"
			End If
		End If
		PageSplictString = PageSplictString & " 每页<b>" & DEF_MaxListNum & "</b>条记录"
		PageSplictString = PageSplictString & "</td></tr></table>"
	
	End If

	%>
	<table cellspacing=0 cellpadding=0 width=100% border=0 height=5>
	<tr> 
		<td colspan="2" height="0"><img src="../images/BLANK.GIF" width="2" height="14"></td>
	</tr>
	</table>
	
	<br><p>[<b><%=htmlencode(Username)%></b>] <b><a href=LookUserInfo.asp?ID=<%=GBL_ID%>>基本资料</a>
	<a href=UserAnc.asp?ID=<%=GBL_ID%>>所有帖子</a>
	<a href=UserAncTopic.asp?ID=<%=GBL_ID%>>主题帖子</a>
	<font color=888888 class=GrayFont>精华帖子</font>
	<a href=UserUpload.asp?ID=<%=GBL_ID%>>上传附件</a></b>
	<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor=<%=DEF_BBS_LightColor%> class=TBBG1>
	  <tbody> 
	  <tr height="19" bgcolor="<%=DEF_BBS_TableHeadColor%>" class=TBfour>
	    <td width=20 align=center>&nbsp;</td>
	    <td><img src=img/blank.gif width=151 height=3><br>&nbsp;帖子&nbsp;</td>
	    <td width=50 align=center><img src=<%=DEF_BBS_HomeUrl%>images/null.gif width=2 height=2><br><span title="回复/点击">人气</span></td>
	    <td width=125><img src=img/blank.gif width=1 height=3><br>&nbsp;发表时间</td>
	  </tr>
	<%
	If Num = -1 Then
		response.write "<tr bgcolor=" & DEF_BBS_LightestColor & " class=TBBG9><td colspan=5 height=30>&nbsp; 没有任何帖子!</td></tr>"
	end if
	
	
	Dim TempN,Temp,Temp1
	
	if Num <> -1 then
		i=1
		LastID = GetData(0,ubound(getdata,2))
		for n= MinN to MaxN Step StepValue
			Response.Write "<tr height=19 bgcolor=" & DEF_BBS_LightestColor & " class=TBBG9><td width=20>"
			Response.Write "<img src=../images/bf/face" & GetData(5,N) & ".gif align=absbottom width=20 height=20> "
			Response.Write "</td><td>&nbsp;<a href=../Announce/"
			If cCur(GetData(9,n)) = 0 Then
				Response.Write "Announce.asp"
			Else
				Response.Write "Announce2.asp"
			End If
			Response.Write "?BoardID=" & GetData(7,n) & "&ID=" & GetData(0,N) & ">"
			
			GetData(6,N) = cCur(GetData(6,N))
			Temp1 = Fix((GetData(6,N)+1)/DEF_TopicContentMaxListNum)
			If ((GetData(6,N)+1) mod DEF_TopicContentMaxListNum) > 0 Then Temp1 = Temp1 + 1
			If GetData(6,N)>=DEF_TopicContentMaxListNum Then
				Temp = DEF_BBS_DisplayTopicLength - (Len(Temp1) + 3)
			Else
				Temp = DEF_BBS_DisplayTopicLength
			End If
		
			'If GetData(8,n) = True or GetData(8,n) = 1 Then Temp = Temp - 3
			
			If GetData(10,n) <> 1 and strLength(GetData(1,N))>Temp-1 Then GetData(1,N) = LeftTrue(GetData(1,N),Temp-4) & "..."
			Response.Write DisplayAnnounceTitle(GetData(1,n),GetData(10,n))
			Response.Write "</a>"

			If GetData(6,N)>=DEF_TopicContentMaxListNum Then
				Response.Write " [<a href=../Announce/Announce.asp?BoardID=" & GetData(7,N) & "&ID=" & GetData(0,N) & "&AUpflag=1&ANum=1 title=" & GetData(2,n) & "字节>" & Temp1 & "</b></a>]"
			End If
	
			'If GetData(8,n) = 1 or GetData(8,n) = True Then
			'	Response.Write "<img src=../images/" & GBL_DefineImage & "jh1.GIF border=0 title=精华帖子 align=absbottom width=15 height=16>"
			'End If
			Response.Write "</td><td align=center width=50>&nbsp;"
			Response.Write GetData(6,N) & "/" & GetData(4,N)
			Response.Write "</td><td valign=top width=125>&nbsp;"
			Response.Write Left(RestoreTime(GetData(3,n)),16) & "</td>"
			Response.Write "</tr>" & VbCrLf
			i=i+1
		next
	End If
	If PageSplictString<>"" Then Response.Write "<tr bgcolor=" & DEF_BBS_TableHeadColor & " class=TBfour><td colspan=5>" & PageSplictString & "</td></tr>"
	%>
	      </table>
	<br><%

End Function
%>
 </td>
  </tr>
  </tbody>
</table>
<script>
if(window.screen.width<'1024'){switchSysBar()}
</script>
