www.gusucode.com > 全球营销软件站整站源码4月最新数据 4.0源码程序 > 801wyxqf\ask\showlist.asp

    <!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<%
Dim HtmlContent,XMLDom
Dim AskedPageList,strLink,topicmode
Dim classid,classname,child,HeadTitle
Dim maxperpage,CurrentPage,Pcount,totalrec,totalnumber
Dim MaxParentNum,MaxChildNum,TopicMaxPageList
Dim FastPostshare,FastPostAsked,UserPoints

FastPostshare = 1
FastPostAsked = 1
UserPoints = NewAsp.CheckNumeric(NewAsp.UserPoint)
MaxParentNum = Newasp.ChkNumeric(NewAsp.Posts_Setting(26))
MaxChildNum = Newasp.ChkNumeric(NewAsp.Posts_Setting(27))
maxperpage = Newasp.ChkNumeric(NewAsp.Posts_Setting(28))
If maxperpage = 0 Then maxperpage = 20

CurrentPage = NewAsp.ChkNumeric(Request("page"))
If CurrentPage = 0 Then CurrentPage = 1
classid = NewAsp.ChkNumeric(Request("classid"))
topicmode = NewAsp.ChkNumeric(Request("topicmode"))

HtmlContent = NewAsp.LoadTemplate("showlist")
Call ChildCategory()
HtmlContent = Replace(HtmlContent, "{$HeadTitle}", "分类-"& HeadTitle)

LoadTopiclist()

HtmlContent = Replace(HtmlContent, "{$AskedPageList}", AskedPageList)
HtmlContent = Replace(HtmlContent, "{$NowPage}", CurrentPage)
HtmlContent = Replace(HtmlContent, "{$TotalNumber}", totalnumber)
HtmlContent = Replace(HtmlContent, "{$PageCount}", Pcount)
HtmlContent = Replace(HtmlContent, "{$totalrec}", totalrec)
HtmlContent = Replace(HtmlContent, "{$maxperpage}", maxperpage)
HtmlContent = Replace(HtmlContent, "{$classid}", classid)
HtmlContent = Replace(HtmlContent, "{$ClassID}", classid)
HtmlContent = Replace(HtmlContent, "{$topicmode}", topicmode)

Response.Write NewAsp.ArchiveHtml(HtmlContent)

NewAsp.CloseConn()

Sub ChildCategory()
	Dim SQL,Rs,TempHtmlCode,iAskCount,cid,cNameText
	Dim Catelist,Childlist,Node,parentid,Parentstr
	Dim AskedCount,AskPendNum,AskDoneNum,AskVoteNum,AskshareNum
	cid = classid
	child = 0
	Set Catelist = Application(NewAsp.CacheName&"_classlist")
	If Not Catelist Is Nothing Then
		For Each Node in Catelist.documentElement.SelectNodes("row[@classid="&classid&"]")
			classname=Node.selectSingleNode("@classname").text
			child=CLng(Node.selectSingleNode("@child").text)
			parentid=CLng(Node.selectSingleNode("@parentid").text)
			Parentstr=Node.selectSingleNode("@parentstr").text
			If child>0 Then
				cid=classid
			Else
				cid=CLng(Node.selectSingleNode("@parentid").text)
			End If
		Next
		cNameText = ""
		If parentid>0 Then
			Dim classType,cateid
			Dim ArrayParent,i,n,DocNodes
			ArrayParent = Split(Parentstr, ",")
			n=0
			For i=0 To UBound(ArrayParent)
				If NewAsp.ChkNumeric(ArrayParent(i))>0 Then
					If n=0 Then
						DocNodes="row[@classid="&ArrayParent(i)&""
					Else
						DocNodes=DocNodes&" or @classid="&ArrayParent(i)&""
					End If
					n=n+1
				End If
			Next
			If DocNodes<>"" Then
				DocNodes=DocNodes&"]"
				For Each Node in Catelist.documentElement.SelectNodes(DocNodes)
					classType=Node.selectSingleNode("@classname").text
					cateid=Node.selectSingleNode("@classid").text
					cNameText=cNameText&"<a href="""&NewAsp.InstallDir&"showlist.asp?classid="&cateid&"&topicmode="&topicmode&"&page=1"">"&classType&"</a> &gt; "
					HeadTitle=HeadTitle&classType&"-"
				Next
			End If
		End If
		cNameText=cNameText&"<a href="""&NewAsp.InstallDir&"showlist.asp?classid="&classid&"&topicmode="&topicmode&"&page=1"">"&classname&"</a>"
		HeadTitle=HeadTitle&classname
		Set Catelist = Nothing
	End If
	
	SQL = "SELECT classid,classname,AskPendNum,AskDoneNum,AskVoteNum,AskshareNum FROM NC_Ask_Class WHERE parentid="&cid&" ORDER BY orders,classid"
	Set Rs = Newasp.Execute(SQL)
	SQL=Rs.GetRows(-1)
	Set Childlist = NewAsp.ArrayToxml(SQL,Rs,"row","childlist")
	Rs.Close:Set Rs = Nothing
	SQL=Empty
	TempHtmlCode = ""
	If Not Childlist Is Nothing Then
		Dim iClassID,iClassName
		For Each Node in Childlist.documentElement.SelectNodes("row")
			iClassID = CLng(Node.selectSingleNode("@classid").text)
			iClassName = Node.selectSingleNode("@classname").text
			Select Case topicmode
				Case 0
					iAskCount = CLng(Node.selectSingleNode("@askpendnum").text)
				Case 1
					iAskCount = CLng(Node.selectSingleNode("@askdonenum").text)
				Case 2
					iAskCount = CLng(Node.selectSingleNode("@askvotenum").text)
				Case 3
					iAskCount = CLng(Node.selectSingleNode("@asksharenum").text)
				Case Else
					iAskCount = CLng(Node.selectSingleNode("@askpendnum").text) +_
					CLng(Node.selectSingleNode("@askdonenum").text) +_
					CLng(Node.selectSingleNode("@askvotenum").text) +_
					CLng(Node.selectSingleNode("@asksharenum").text)
			End Select
			iAskCount = CLng(Node.selectSingleNode("@askpendnum").text) +_
					CLng(Node.selectSingleNode("@askdonenum").text) +_
					CLng(Node.selectSingleNode("@askvotenum").text) +_
					CLng(Node.selectSingleNode("@asksharenum").text)
			TempHtmlCode = TempHtmlCode & "<li>"
			TempHtmlCode = TempHtmlCode & "<a href="""&NewAsp.InstallDir&"showlist.asp?classid="&iClassID&"&topicmode="&topicmode&"&page=1"">"
			'TempHtmlCode = TempHtmlCode & "<a href="""&NewAsp.InstallDir&"showlist.asp?classid="&iClassID&""">"
			TempHtmlCode = TempHtmlCode & iClassName
			TempHtmlCode = TempHtmlCode & "("&iAskCount&")</a>"
			TempHtmlCode = TempHtmlCode & "</li>" & vbCrLf
		Next
		Set Childlist = Nothing
	End If
	
	HtmlContent = Replace(HtmlContent, "{$Current}", cNameText)
	'HtmlContent = Replace(HtmlContent, "{$AskedCount}", AskedCount)
	HtmlContent = Replace(HtmlContent, "{$ClassName}", classname)
	HtmlContent = Replace(HtmlContent, "{$ChildCategory}", TempHtmlCode)
End Sub

Sub LoadTopiclist()
	Dim SQL,Rs,topiclist,Node
	totalnumber = 0 : Pcount = 1 : TopicMaxPageList = ""
	Set XMLDom = NewAsp.CreateXMLDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
	XMLDom.appendChild(XMLDom.createElement("xml"))
	XMLDom.documentElement.setAttribute "action",0
	XMLDom.documentElement.setAttribute "classid",classid
	XMLDom.documentElement.setAttribute "classname",classname
	XMLDom.documentElement.setAttribute "topicmode",topicmode
	XMLDom.documentElement.setAttribute "fastpostshare",FastPostshare
	XMLDom.documentElement.setAttribute "fastpostasked",FastPostAsked
	XMLDom.documentElement.setAttribute "userpoints",UserPoints
	XMLDom.documentElement.setAttribute "userid",NewAsp.UserID
	XMLDom.documentElement.setAttribute "child",child
	If child > 0 Then
		If MaxParentNum > 0 Then
			TopicMaxPageList = "TOP " & MaxParentNum
		Else
			totalnumber = NewAsp.Execute("SELECT COUNT(*) FROM NC_Ask_Topic WHERE classid in (SELECT classid FROM NC_Ask_Class WHERE classid="&classid&" Or parentid="&classid&") And topicmode="&topicmode&" And isTop=0 And LockTopic=0")(0)
			totalrec = totalnumber
		End If
	Else
		If MaxChildNum > 0 Then
			TopicMaxPageList = "TOP " & MaxChildNum
		Else
			totalnumber = NewAsp.Execute("SELECT COUNT(*) FROM NC_Ask_Topic WHERE classid="&classid&" And topicmode="&topicmode&" And isTop=0 And LockTopic=0")(0)
			totalrec = totalnumber
		End If
	End If
	
	If Not IsObject(Conn) Then ConnectionDatabase
	Set Rs = NewAsp.CreateAXObject("ADODB.Recordset")
	If child > 0 Then
		SQL="SELECT " & TopicMaxPageList & " TopicID,classid,userid,classname,title,PostUsername,Expired,Closed,PostTable,DateAndTime,LastPostTime,LockTopic,Reward,Hits,PostNum,CommentNum,TopicMode,Highlight,Broadcast,Anonymous,IsTop FROM NC_Ask_Topic WHERE classid in (SELECT classid FROM NC_Ask_Class WHERE classid="&classid&" Or parentid="&classid&") And topicmode="&topicmode&" And isTop=0 And LockTopic=0 ORDER BY LastPostTime DESC"
	Else
		SQL="SELECT " & TopicMaxPageList & " TopicID,classid,userid,classname,title,PostUsername,Expired,Closed,PostTable,DateAndTime,LastPostTime,LockTopic,Reward,Hits,PostNum,CommentNum,TopicMode,Highlight,Broadcast,Anonymous,IsTop FROM NC_Ask_Topic WHERE classid="&classid&" And topicmode="&topicmode&" And isTop=0 And LockTopic=0 ORDER BY LastPostTime DESC"
	End If
	Rs.Open SQL,Conn,1,1
	If Not (Rs.BOF And Rs.EOF) Then
		If TopicMaxPageList <> "" Then
			totalnumber = CLng(Rs.recordcount) '###记录总数
		End If
		totalrec = totalnumber
		Pcount = CLng(totalrec / maxperpage)  '得到总页数
		If Pcount < totalrec / maxperpage Then Pcount = Pcount + 1
		If Pcount < 1 Then Pcount = 1
		If CurrentPage < 1 Then CurrentPage = 1
		If CurrentPage > Pcount Then CurrentPage = Pcount
		If CurrentPage >1 Then
			Rs.Move (CurrentPage-1) * maxperpage
		End If
	End If
	If Not Rs.EOF Then
		SQL=Rs.GetRows(maxperpage)
		Set topiclist=NewAsp.ArrayToxml(SQL,Rs,"row","topic")
	Else
		Set topiclist=Nothing
	End If
	Set Rs=Nothing
	SQL=Empty
	XMLDom.documentElement.setAttribute "pagesize",maxperpage
	XMLDom.documentElement.setAttribute "page",CurrentPage
	XMLDom.documentElement.setAttribute "totalnumber",totalnumber
	XMLDom.documentElement.setAttribute "totalrec",totalrec
	XMLDom.documentElement.setAttribute "pagecount",Pcount
	If Not topiclist Is Nothing Then 
		For Each Node in topiclist.documentElement.SelectNodes("row")
			Node.selectSingleNode("@title").text=NewAsp.Checkstr(Node.selectSingleNode("@title").text)
			Node.selectSingleNode("@dateandtime").text=NewAsp.FormatDate(Node.selectSingleNode("@dateandtime").text,5)
			'Response.Write Node.selectSingleNode("@title").text
		Next
		XMLDom.documentElement.appendChild(topiclist.documentElement)
		Set topiclist=Nothing
	End If
	strLink = NewAsp.InstallDir & "showlist.asp?classid=" & classid & "&topicmode=" & topicmode & "&"
	AskedPageList = showlistpage(CurrentPage,Pcount,strLink)
	transform_topicList()
End Sub
Sub transform_topicList()
	Dim proc,XMLStyle,node,cnode,XSLTemplate
	Set XSLTemplate=NewAsp.CreateAXObject("Msxml2.XSLTemplate" & MsxmlVersion )
	Set XMLStyle=NewAsp.CreateXmlDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion )
	XMLStyle.load Server.MapPath(NewAsp.TemplatePath & "xslt/showlist.xslt")
	Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
	Set CNode=XMLStyle.createNode(2,"name","")
	CNode.text="installdir"
	Node.attributes.setNamedItem(CNode)
	Node.text=NewAsp.InstallDir
	XMLStyle.documentElement.appendChild(node)
	Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
	Set CNode=XMLStyle.createNode(2,"name","")
	CNode.text="AskedPageList"
	Node.attributes.setNamedItem(CNode)
	Node.text=AskedPageList
	XMLStyle.documentElement.appendChild(node)
	Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
	Set CNode=XMLStyle.createNode(2,"name","")
	CNode.text="skinurl"
	Node.attributes.setNamedItem(CNode)
	node.text=NewAsp.AskedSkinUrl
	XMLStyle.documentElement.appendChild(node)

	XSLTemplate.stylesheet=XMLStyle
	Set proc = XSLTemplate.createProcessor()
	proc.input = XMLDom
	proc.transform()
	Dim procstr
	procstr = proc.output
	'Response.Write  procstr
	HtmlContent = Replace(HtmlContent, "{$Topiclist}", procstr)
	'Response.Write XMLDom.xml
	Set XMLDom=Nothing 
	Set proc=Nothing
	Set XMLStyle=Nothing
	Set XSLTemplate=Nothing
End Sub

%>