<%
Dim IsDispToplist	'--是否显示置顶列表；True=是；False=否
Dim maxperpage,totalrec,Pcount,pagenow,topcount
Dim m_intOrder,m_strOrder,SQLQuery,SQLField
Dim classid,Topiclist,TopTopic,m_strLinks,HtmlFileDir,m_strTitle
Dim XMLDom,dataNode,i,n,m,im
Dim HtmlContent,IsHtmlPage
m_intOrder=0:topcount=0:totalrec=0:IsHtmlPage=True
SQLField = "A.ArticleID,A.ChannelID,A.classid,A.SpecialID,A.BriefTopic,A.[title],A.subtitle,A.ColorMode,A.FontMode,A.[content],A.OuterLinks,A.Author,A.ComeFrom,A.ImageUrl,A.PointNum,A.username,A.star,A.WriteTime,A.AllHits,A.isTop,A.isBest,A.HtmlFileDate,A.Taglist,C.ClassName,C.HtmlFileDir,C.readme"

Sub ParseTopiclistNode(sToken)
	Dim TopicArry,strTitle,strLen,strContent,strLinks,strLink2,strChannDir,strImagesLink
	strTitle=NewAsp.CutStr(Topiclist(5,i),NewAsp.ChkNumeric(TPL_Config(2)))
	strTitle=NewAsp.ReadFontMode(Replace(strTitle, "<", "&lt;"),Topiclist(7,i),Topiclist(8,i))
	If NewAsp.IsCreateHtml=0 Then
		If IsURLRewrite Then
			strLinks=CheckURLRewrite(NewAsp.ChannelPath,Topiclist(0,i)&NewAsp.HtmlExtName)
			strLink2=CheckURLRewrite(NewAsp.ChannelPath,"list_1_"&Topiclist(2,i)&NewAsp.HtmlExtName)
		Else
			strLinks="show.asp?id="&Topiclist(0,i)
			strLink2="list.asp?classid="&Topiclist(2,i)
		End If
	Else
		If NewAsp.BindDomain=0 Then
			strChannDir=NewAsp.ChannelDir
		End If
		strLinks=NewAsp.HtmlDestination(NewAsp.InfoDestination, strChannDir, Topiclist(21,i),Topiclist(24,i),Topiclist(2,i),Topiclist(0,i),1,"")
		strLink2=NewAsp.HtmlDestination(NewAsp.sortDestination, strChannDir, Topiclist(21,i),Topiclist(24,i),Topiclist(2,i),Topiclist(0,i),1,"")
	End If
	If Len(Topiclist(10,i)&"")>3 Then strLinks=Topiclist(10,i)
	Select Case sToken
		Case "i"			:	TPL_Echo i
		Case "n"			:	TPL_Echo n
		Case "m"			:	TPL_Echo m
		Case "link"			:	TPL_Echo strLinks
		Case "link2"		:	TPL_Echo strLink2
		Case "articleid"	:	TPL_Echo Topiclist(0,i)
		Case "channelid"	:	TPL_Echo Topiclist(1,i)
		Case "classid"		:	TPL_Echo Topiclist(2,i)
		Case "specialid"	:	TPL_Echo Topiclist(3,i)
		Case "brieftopic"	:	TPL_Echo Topiclist(4,i)
		Case "mintopic"		:	TPL_Echo NewAsp.ReadBriefTopic(Topiclist(4,i))
		Case "topic"		:	TPL_Echo strTitle
		Case "title2"		:	TPL_Echo NewAsp.RemoveHtml(Topiclist(5,i))
		Case "title"
			TPL_Echo "<a href="""&strLinks&""">"&strTitle&"</a>"
		Case "subtitle"		:	TPL_Echo Topiclist(6,i)
		Case "content"
			strLen = NewAsp.ChkNumeric(TPL_Config(3))
			TPL_Echo NewAsp.CutString(Topiclist(9,i),strLen)
		Case "size"			:	TPL_Echo NewAsp.strLength(Topiclist(9,i))
		Case "datetime"		:	TPL_Echo NewAsp.DateToString(Topiclist(17,i),TPL_Config(8))
		Case "writetime"	:	TPL_Echo NewAsp.FormatToDate(Topiclist(17,i),TPL_Config(8))
		Case "new"			:	TPL_Echo NewAsp.ChkIsNewDate(Topiclist(17,i))
		Case "outerlinks"	:	TPL_Echo Topiclist(10,i)
		Case "author"		:	TPL_Echo Topiclist(11,i)
		Case "comefrom"		:	TPL_Echo Topiclist(12,i)
		Case "imageurl","images"
			Dim arrImageSize
			arrImageSize = Split(TPL_Config(7)&"|", "|")
			strImagesLink = NewAsp.GetImagePath(Topiclist(13,i)&"",NewAsp.ChannelPath)
			TPL_Echo "<a target=""_blank"" href="""&strLinks&""">"&NewAsp.GetFlashAndPic(strImagesLink, arrImageSize(0), arrImageSize(1))&"</a>"
		Case "image"
			strImagesLink = NewAsp.GetImagePath(Topiclist(13,i)&"",NewAsp.ChannelPath)
			TPL_Echo strImagesLink
		Case "pointnum"		:	TPL_Echo Topiclist(14,i)
		Case "username"		:	TPL_Echo Topiclist(15,i)
		Case "star"			:	TPL_Echo Topiclist(16,i)
		Case "allhits","hits":	TPL_Echo Topiclist(18,i)
		Case "istop"		:	TPL_Echo Topiclist(19,i)
		Case "isbest"		:	TPL_Echo Topiclist(20,i)
		Case "tagstring"	:	TPL_Echo ParseTagstring(Topiclist(22,i))
		Case "taglinks"		:	TPL_Echo ParseTaglinks(Topiclist(22,i))
		Case "classname"	:	TPL_Echo Topiclist(23,i)
		Case "classtitle"	:	TPL_Echo "<a href="""&strLink2&""">"&Topiclist(23,i)&"</a>"
		Case "readme"		:	TPL_Echo Topiclist(25,i)
	End Select
End Sub

Sub ParseTopTopicNode(sToken)
	Dim strTitle,strLen,strContent,strLinks,strLink2,strChannDir,strImagesLink
	strTitle=NewAsp.CutStr(TopTopic(5,i),NewAsp.ChkNumeric(TPL_Config(2)))
	strTitle=NewAsp.ReadFontMode(Replace(strTitle, "<", "&lt;"),TopTopic(7,i),TopTopic(8,i))
	If NewAsp.IsCreateHtml=0 Then
		If IsURLRewrite Then
			strLinks=CheckURLRewrite(NewAsp.ChannelPath,TopTopic(0,i)&NewAsp.HtmlExtName)
			strLink2=CheckURLRewrite(NewAsp.ChannelPath,"list_1_"&TopTopic(2,i)&NewAsp.HtmlExtName)
		Else
			strLinks="show.asp?id="&TopTopic(0,i)
			strLink2="list.asp?classid="&TopTopic(2,i)
		End If
	Else
		If NewAsp.BindDomain=0 Then
			strChannDir=NewAsp.ChannelDir
		End If
		strLinks=NewAsp.HtmlDestination(NewAsp.InfoDestination, strChannDir, TopTopic(21,i),TopTopic(24,i),TopTopic(2,i),TopTopic(0,i),1,"")
		strLink2=NewAsp.HtmlDestination(NewAsp.sortDestination, strChannDir, TopTopic(21,i),TopTopic(24,i),TopTopic(2,i),TopTopic(0,i),1,"")
	End If
	If Len(TopTopic(10,i)&"")>3 Then strLinks=TopTopic(10,i)
	Select Case sToken
		Case "i"			:	TPL_Echo i
		Case "n"			:	TPL_Echo n
		Case "m"			:	TPL_Echo m
		Case "link"			:	TPL_Echo strLinks
		Case "link2"		:	TPL_Echo strLink2
		Case "articleid"	:	TPL_Echo TopTopic(0,i)
		Case "channelid"	:	TPL_Echo TopTopic(1,i)
		Case "classid"		:	TPL_Echo TopTopic(2,i)
		Case "specialid"	:	TPL_Echo TopTopic(3,i)
		Case "brieftopic"	:	TPL_Echo TopTopic(4,i)
		Case "mintopic"		:	TPL_Echo NewAsp.ReadBriefTopic(TopTopic(4,i))
		Case "topic"		:	TPL_Echo strTitle
		Case "title2"		:	TPL_Echo NewAsp.RemoveHtml(TopTopic(5,i))
		Case "title"
			TPL_Echo "<a href="""&strLinks&""">"&strTitle&"</a>"
		Case "subtitle"		:	TPL_Echo TopTopic(6,i)
		Case "content"
			strLen = NewAsp.ChkNumeric(TPL_Config(3))
			TPL_Echo NewAsp.CutString(TopTopic(9,i),strLen)
		Case "size"			:	TPL_Echo NewAsp.strLength(TopTopic(9,i))
		Case "datetime"		:	TPL_Echo NewAsp.DateToString(TopTopic(17,i),TPL_Config(8))
		Case "writetime"	:	TPL_Echo NewAsp.FormatToDate(TopTopic(17,i),TPL_Config(8))
		Case "new"			:	TPL_Echo NewAsp.ChkIsNewDate(TopTopic(17,i))
		Case "outerlinks"	:	TPL_Echo TopTopic(10,i)
		Case "author"		:	TPL_Echo TopTopic(11,i)
		Case "comefrom"		:	TPL_Echo TopTopic(12,i)
		Case "imageurl","images"
			Dim arrImageSize
			arrImageSize = Split(TPL_Config(7)&"|", "|")
			strImagesLink = NewAsp.GetImagePath(TopTopic(13,i)&"",NewAsp.ChannelPath)
			TPL_Echo "<a target=""_blank"" href="""&strLinks&""">"&NewAsp.GetFlashAndPic(strImagesLink, arrImageSize(0), arrImageSize(1))&"</a>"
		Case "image"
			strImagesLink = NewAsp.GetImagePath(TopTopic(13,i)&"",NewAsp.ChannelPath)
			TPL_Echo strImagesLink
		Case "pointnum"		:	TPL_Echo TopTopic(14,i)
		Case "username"		:	TPL_Echo TopTopic(15,i)
		Case "star"			:	TPL_Echo TopTopic(16,i)
		Case "allhits","hits":	TPL_Echo TopTopic(18,i)
		Case "istop"		:	TPL_Echo TopTopic(19,i)
		Case "isbest"		:	TPL_Echo TopTopic(20,i)
		Case "tagstring"	:	TPL_Echo ParseTagstring(TopTopic(22,i))
		Case "taglinks"		:	TPL_Echo ParseTaglinks(TopTopic(22,i))
		Case "classname"	:	TPL_Echo TopTopic(23,i)
		Case "classtitle"	:	TPL_Echo "<a href="""&strLink2&""">"&TopTopic(23,i)&"</a>"
		Case "readme"		:	TPL_Echo TopTopic(25,i)
	End Select
End Sub

Function XmlDatalistNode(iXMLDom,sTokenAttrib)
	Select Case sTokenAttrib
		Case "showpage"		: Set XmlDatalistNode=showPageNode(iXMLDom)
		Case Else
			Set XmlDatalistNode=showPageNode(iXMLDom)
	End Select
End Function

Function showPageNode(iXMLDom)
	Dim datalist,Node,i,n,m,max
	iXMLDom.documentElement.setAttribute "pagenow",pagenow
	iXMLDom.documentElement.setAttribute "pagesize",maxperpage
	iXMLDom.documentElement.setAttribute "pagecount",Pcount
	iXMLDom.documentElement.setAttribute "totalrec",totalrec
	iXMLDom.documentElement.setAttribute "topcount",topcount
	iXMLDom.documentElement.setAttribute "link",m_strLinks
	iXMLDom.documentElement.setAttribute "titles",classname

	max		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("max"))
	If max=0 Then max=8
	m = max-2

	If Pcount > m And pagenow > (m\2) Then
		If Pcount-pagenow <= (m\2) Then
			n = Pcount-(m+1)
		Else
			n = pagenow-(m\2)
		End If
	Else
		n = 2
	End If
	If n<2 Then n=2
	iXMLDom.documentElement.setAttribute "n",n
	iXMLDom.documentElement.setAttribute "m",max\2
	If IsNull(iXMLDom.documentElement.getAttribute("max")) Then iXMLDom.documentElement.setAttribute "max",max
	If IsNull(iXMLDom.documentElement.getAttribute("channelid")) Then iXMLDom.documentElement.setAttribute "channelid",NewAsp.ChannelID
	If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
	If ((NewAsp.IsCreateHtml=1 Or IsURLRewrite) And IsHtmlPage) Then
		iXMLDom.documentElement.setAttribute "action","1"
	End If

	Set datalist=NewAsp.CreateXMLDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
	datalist.appendChild(datalist.createElement("datalist"))

	If Pcount >= max Then
		For i = n To n + m
			Set Node=datalist.createNode(1,"row","")
			Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
			Node.attributes.setNamedItem(datalist.createNode(2,"s","")).text=1
			datalist.documentElement.appendChild(Node)
			Set Node=Nothing
			If i => Pcount Then Exit For
		Next
	Else
		For i = 2 To max
			If i > Pcount Then
				Set Node=datalist.createNode(1,"row","")
				Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
				Node.attributes.setNamedItem(datalist.createNode(2,"s","")).text=0
				datalist.documentElement.appendChild(Node)
				Set Node=Nothing
			Else
				Set Node=datalist.createNode(1,"row","")
				Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
				Node.attributes.setNamedItem(datalist.createNode(2,"s","")).text=1
				datalist.documentElement.appendChild(Node)
				Set Node=Nothing
			End If
		Next
	End If
	iXMLDom.documentElement.setAttribute "i",i

	Set showPageNode=datalist
	Set datalist=Nothing
End Function

Sub ParseTopicNode(sToken)
	Dim strTitle,strLen,strContent,strLinks,strLink2,strChannDir,strImagesLink
	strTitle=NewAsp.ReadFontMode(Replace(Topiclist(5,i), "<", "&lt;"),Topiclist(7,i),Topiclist(8,i))
	If NewAsp.IsCreateHtml=0 Then
		If IsURLRewrite Then
			strLinks=CheckURLRewrite(NewAsp.ChannelPath,Topiclist(0,i)&NewAsp.HtmlExtName)
			strLink2=CheckURLRewrite(NewAsp.ChannelPath,"list_1_"&Topiclist(2,i)&NewAsp.HtmlExtName)
		Else
			strLinks="show.asp?id="&Topiclist(0,i)
			strLink2="list.asp?classid="&Topiclist(2,i)
		End If
	Else
		If NewAsp.BindDomain=0 Then
			strChannDir=NewAsp.ChannelDir
		End If
		strLinks=NewAsp.HtmlDestination(NewAsp.InfoDestination, strChannDir, Topiclist(18,i),Topiclist(22,i),Topiclist(2,i),Topiclist(0,i),1,"")
		strLink2=NewAsp.HtmlDestination(NewAsp.sortDestination, strChannDir, Topiclist(18,i),Topiclist(22,i),Topiclist(2,i),Topiclist(0,i),1,"")
	End If
	If Len(Topiclist(9,i)&"")>3 Then strLinks=Topiclist(9,i)
	Select Case sToken
		Case "i"			:	TPL_Echo i
		Case "n"			:	TPL_Echo n
		Case "m"			:	TPL_Echo m
		Case "link"			:	TPL_Echo strLinks
		Case "link2"		:	TPL_Echo strLink2
		Case "softid"		:	TPL_Echo Topiclist(0,i)
		Case "channelid"	:	TPL_Echo Topiclist(1,i)
		Case "classid"		:	TPL_Echo Topiclist(2,i)
		Case "specialid"	:	TPL_Echo Topiclist(3,i)
		Case "brieftopic"	:	TPL_Echo Topiclist(4,i)
		Case "mintopic"		:	TPL_Echo NewAsp.ReadBriefTopic(Topiclist(4,i))
		Case "topic"		:	TPL_Echo strTitle
		Case "title2"		:	TPL_Echo NewAsp.RemoveHtml(Topiclist(4,i)&" "&Topiclist(5,i))
		Case "title"		:	TPL_Echo "<a href="""&strLinks&""">"&strTitle&"</a>"
		Case "subtitle"		:	TPL_Echo Topiclist(6,i)
		Case "outerlinks"	:	TPL_Echo Topiclist(9,i)
		Case "author"		:	TPL_Echo Topiclist(10,i)
		Case "comefrom"		:	TPL_Echo Topiclist(11,i)
		Case "username"		:	TPL_Echo Topiclist(12,i)
		Case "star"			:	TPL_Echo Topiclist(13,i)
		Case "datetime"		:	TPL_Echo NewAsp.DateToString(Topiclist(14,i),TPL_Config(19))
		Case "writetime"	:	TPL_Echo NewAsp.FormatToDate(Topiclist(14,i),TPL_Config(19))
		Case "new"			:	TPL_Echo NewAsp.ChkIsNewDate(Topiclist(14,i))
		Case "allhits","hits"
			TPL_Echo Topiclist(15,i)
		Case "istop"		:	TPL_Echo Topiclist(16,i)
		Case "isbest"		:	TPL_Echo Topiclist(17,i)
		Case "tagstring"	:	TPL_Echo ParseTagstring(Topiclist(19,i))
		Case "taglinks"		:	TPL_Echo ParseTaglinks(Topiclist(19,i))
		Case "imageurl","images"
			Dim arrImageSize
			arrImageSize = Split(TPL_Config(7)&"|", "|")
			strImagesLink = NewAsp.GetImagePath(Topiclist(20,i)&"",NewAsp.ChannelPath)
			TPL_Echo "<a target=""_blank"" href="""&strLinks&""">"&NewAsp.GetFlashAndPic(strImagesLink, arrImageSize(0), arrImageSize(1))&"</a>"
		Case "image"
			strImagesLink = NewAsp.GetImagePath(Topiclist(20,i)&"",NewAsp.ChannelPath)
			TPL_Echo strImagesLink
		Case "classname"	:	TPL_Echo Topiclist(21,i)
		Case "classtitle"	:	TPL_Echo "<a href="""&strLink2&""">"&Topiclist(21,i)&"</a>"
		Case "readme"		:	TPL_Echo Topiclist(23,i)
	End Select
End Sub
%>