<!--#include file="../Conn.asp"-->
<!--#include file="../inc/function.asp"-->
<%
Dim dl,xl,wtlx,wtys,zs,wts,showfl,showuser,showxsf
Dim showtime,showdjs,showzt,addpoint,showhd,Openstyle

'参数一
dl=Request.QueryString("dl")
'
xl=Request.QueryString("xl")
'
wtlx=int(Request.QueryString("wtlx"))
'
wtys=Request.QueryString("wtys")
'
zs=int(Request.QueryString("zs"))
'
nrzs=int(Request.QueryString("nrzs"))
'问题内容的字数
wts=int(Request.QueryString("wts"))
'
showfl=Request.QueryString("showfl")
'
showuser=Request.QueryString("showuser")
'
showtime=Request.QueryString("showtime")
'
showdjs=Request.QueryString("showdjs")
'
showzt=Request.QueryString("showzt")
'
addpoint=Request.QueryString("addpoint")
'是否需要回答,1=未回答，2=有回答
showhd=Request.QueryString("showhd")
'
showxsf=Request.QueryString("showxsf")
'
Openstyle=Request.QueryString("Openstyle")
'
zt=Request.QueryString("zt")
'问题的类型，如已回答，未回答
how=Request.QueryString("how") 
'输出问题标签，如li,dd,dt
op=Request.QueryString("op")

Dim Rs,Sql,i
Set Rs=server.CreateObject("adodb.recordSet")		
If zt=2 Then
	Sql ="SELECT top " & wts & " * FROM kw_wt WHERE zt=2 order by id desc"
Else
	Sql ="SELECT top " & wts & " * FROM kw_wt WHERE zt=1 order by id desc"
End If
		   
Rs.Open Sql,Conn,1,1

If how="li" OR how="dd" OR how="dt" Then
	howBegin="<"&how&">"
	howEnd="</"&how&">"
End If

Dim Rs1,Sql1,i1
Dim str
If Rs.eof and Rs.bof Then
	str="document.write('该类还没有提问！');"
	Response.End()
End If
		

If op="list" Then
	For i=1 to wts
		If Rs("bt")="" Then  Exit for
			str=str&"document.write('<strong>"&leftstr(Rs("bt"),zs)&"');"
			
			If checklen(Rs("bt"))>zs and addpoint="true" Then
			    str=str&"document.write('&nbsp;…');"
			End If
			
			If zt=2 Then
			    str=str&"document.write('</strong>');"
			Else
			    str=str&"document.write('"&howEnd&"');"
			End If		
			If showhd="true" Then
			    str=str&"document.write('<p>');"
			  
			    Set Rs1=server.CreateObject("adodb.recordSet")
			    Sql1 ="SELECT * FROM kw_hd WHERE hdques='"&Rs("wt_filename")&"'"
			    Rs1.Open Sql1,Conn,1,1
			  
			    str=str&"document.write('"&leftstr(nohtml(Rs1("wtans")),nrzs)&"...<a href=""/ask/show/"&Rs("wt_filename")&""">[详细]</a></p>');"
			End If
	    Rs.MoveNext
	Next
ElseIf op="kouqiang" Then
	For i=1 to wts
		If Rs("bt")="" Then  Exit for
			str=str&"document.write('<li class=""q"">"&leftstr(Rs("bt"),zs)&"');"
			
			If checklen(Rs("bt"))>zs and addpoint="true" Then
			    str=str&"document.write('&nbsp;…');"
			End If
			
			If zt=2 Then
			    str=str&"document.write('</li>');"
			Else
			    str=str&"document.write('"&howEnd&"');"
			End If		
			If showhd="true" Then
			    str=str&"document.write('<li class=""a"">');"
			  
			    Set Rs1=server.CreateObject("adodb.recordSet")
			    Sql1 ="SELECT * FROM kw_hd WHERE hdques='"&Rs("wt_filename")&"'"
			    Rs1.Open Sql1,Conn,1,1
			  
			    str=str&"document.write('"&leftstr(Rs1("wtans"),nrzs)&"...<a href=""/ask/show/"&Rs("wt_filename")&""">[详细]</a></li>');"
			End If
	    Rs.MoveNext
	Next
	
ElseIf op="zt" Then
	For i=1 to wts
		If Rs("bt")="" Then
			Exit for
		End If
		If i=1 Then
			str=str&"document.write('<strong><a href=""/ask/show/"&Rs("wt_filename")&""">"&leftstr(Rs("bt"),zs)&"');"
			If checklen(Rs("bt"))>zs and addpoint="true" Then
				str=str&"document.write('&nbsp;…');"
			End If
			
			If zt=2 Then
				str=str&"document.write('</a></strong>');"
			Else
				str=str&"document.write('</a>"&howEnd&"');"
			End If		
			If showhd="true" Then
				str=str&"document.write('<span>');"
				Set Rs1=server.CreateObject("adodb.recordSet")
				Sql1 ="SELECT * FROM kw_hd WHERE hdques='"&Rs("wt_filename")&"'"
				Rs1.Open Sql1,Conn,1,1
				
				str=str&"document.write('"&leftstr(nohtml(Rs1("wtans")),nrzs)&"...<a href=""/ask/show/"&Rs("wt_filename")&""">[详细内容]</a></span>');"
			End If
		else
		   str=str&"document.write('<dl class=""nob""><dt>"&leftstr(Rs("bt"),zs)&"');"
			If checklen(Rs("bt"))>zs and addpoint="true" Then
				str=str&"document.write('&nbsp;…');"
			End If
			
			If zt=2 Then
				str=str&"document.write('</dt>');"
			Else
				str=str&"document.write('</a>"&howEnd&"');"
			End If		
			If showhd="true" Then
				str=str&"document.write('<dd>');"
				Set Rs1=server.CreateObject("adodb.recordSet")
				Sql1 ="SELECT * FROM kw_hd WHERE hdques='"&Rs("wt_filename")&"'"
				Rs1.Open Sql1,Conn,1,1
				
				str=str&"document.write('"&leftstr(nohtml(Rs1("wtans")),nrzs)&"...<a href=""/ask/show/"&Rs("wt_filename")&""">[详细内容]</a></dd></dl>');"
			End If
		End If
		Rs.MoveNext
	Next


Else
	For i=1 to wts
		If Rs("bt")="" Then 
			Exit for
		End If
		'If i>2 Then
			str=str&"document.write('"&howBegin&"<a href=""/ask/show/"&Rs("wt_filename")&""">"&leftstr(Rs("bt"),zs)&"');"
			
			If checklen(Rs("bt"))>zs and addpoint="true" Then
				str=str&"document.write('&nbsp;…');"
			End If
			
			If zt=2 Then
				str=str&"document.write('</a>【已解决】"&howEnd&"');"
			Else
				str=str&"document.write('</a>【已解决】"&howEnd&"');"
			End If	
				
			If showhd="true" Then
				str=str&"document.write('"&howBegin&"<a href=""/ask/show/"&Rs("wt_filename")&""">');"
				Set Rs1=server.CreateObject("adodb.recordSet")
				Sql1 ="SELECT * FROM kw_hd WHERE hdques='"&Rs("wt_filename")&"'"
				Rs1.Open Sql1,Conn,1,1
				str=str&"document.write('"&leftstr(Rs1("wtans"),nrzs)&"</a>"&howEnd&"');"
			End If
		'End If
		Rs.MoveNext
	Next
End If
Response.Write(str)
Rs.Close
Set Rs=nothing
Closedb

Function nohtml(str)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="(\<.[^\<]*\>)"
str=re.replace(str,"")
re.Pattern="(\<\/[^\<]*\>)"
str=re.replace(str,"")
nohtml=str
set re=nothing
End Function
%>