<!--#include file="conn.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="config.asp"-->
<%
dim dl,xl,leixing
dl=request("dl")
xl=request("xl")
leixing=request("leixing")

	dim show
	show=ReadTemplate("template/list_temp.html")
	show=replace(show,"{$siteinfo}",sitename&" "&dl&" "&xl)
    show=replace(show,"{$list_fl}",list_fl())
	show=replace(show,"{$wtlx}",wtlx())
	show=replace(show,"{$wt_list}",wt_list())
	webtop=ReadTemplate("template/webtop.html")
	webbottom=ReadTemplate("template/webbottom.html")
	webright=ReadTemplate("template/webright.html")
	show=replace(show,"{$WebTop}",webtop)
	show=replace(show,"{$WebBottom}",webbottom)
	show=replace(show,"{$WebRight}",webright)
    response.Write(show)

Function list_fl()
dim str
str="<table width=""100%""  border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbcrlf
str=str&"<tr>"&vbcrlf
str=str&"<td height=""30"" colspan=""4"">&nbsp;&nbsp;&nbsp;&nbsp;<b><font style=""font-size:14px"">您的位置：</font></b><a href=""index.html"" class=""show_top"">首页</a>"
if dl<>"" then
str=str&" → <a href=""list.asp?dl="&server.URLEncode(dl)&""" class=""list_fl"">"&dl&"</a>"
end if
if xl<>"" then
str=str&" → <a href=""list.asp?dl="&server.URLEncode(dl)&"&xl="&server.URLEncode(xl)&">"" class=""list_fl"">"&xl&"</a>"
end if
str=str&"</td><tr>"&vbcrlf

if xl="" then
dim rs2,sql2,p
set rs2=server.CreateObject("adodb.recordset")
sql2 ="Select * from kw_xl where dalei='"&dl&"' order by xldm"
rs2.open sql2,conn,1,1
for p=1 to rs2.recordcount
str=str&"<td width=""25%"">"&vbcrlf

    dim rs3,sql3
    set rs3=server.CreateObject("adodb.recordset")
    sql3 ="Select * from kw_wt where xiaolei='"&rs2("xiaolei")&"'"
    rs3.open sql3,conn,1,1
    str=str&"&nbsp;&nbsp;·&nbsp;<a href=""list.asp?dl="&server.URLEncode(dl)&"&xl="&server.URLEncode(rs2("xiaolei"))&""" class=""list_fl"">"&rs2("xiaolei")&"</a>（"&rs3.recordcount&"）</td>"&vbcrlf
    rs2.movenext
      if p mod 4=0 then
      str=str&"</tr>"&vbcrlf
      end if
next
end if
list_fl=str&"</table>"&vbcrlf
End Function

Function wtlx()
dim str

dl=request("dl")
xl=request("xl")
leixing=request("leixing")

str="<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbcrlf
str=str&"<tr  height=""30"" align=""center"">"&vbcrlf
str=str&"<td width=""20%"" "
if leixing="" then
str=str&"bgcolor=""#FBF8F3"""
end if
str=str&"><font color=""#FFFFFF""><a href=""?dl="&server.URLEncode(dl)&"&xl="&server.URLEncode(xl)&"&leixing="&server.URLEncode(lx)&""" >"
if leixing="" then
end if
str=str&"全部问题</a></font></td>"&vbcrlf
str=str&"<td width=""20%"" "
if leixing="hot" then
str=str&"bgcolor=""#FBF8F3"""
end if
str=str&"><font color=""#FFFFFF""><a color=""#FFFFFF"" href=""?dl="&server.URLEncode(dl)&"&xl="&server.URLEncode(xl)&"&leixing=hot"" >"
if leixing="hot" then
end if
str=str&"热点问题</a></font></td>"&vbcrlf
str=str&"<td width=""20%"" "
if leixing="gf" then
str=str&"bgcolor=""#FBF8F3"""
end if
str=str&"><font color=""#FFFFFF""><a href=""?dl="&server.URLEncode(dl)&"&xl="&server.URLEncode(xl)&"&leixing=gf"">"
if leixing="gf" then
end if
str=str&"高分问题</a></font></td>"&vbcrlf
str=str&"<td width=""20%"" "
if leixing="ok" then
str=str&"bgcolor=""#FBF8F3"""
end if
str=str&"><font color=""#FFFFFF""><a href=""?dl="&server.URLEncode(dl)&"&xl="&server.URLEncode(xl)&"&leixing=ok"">"
if leixing="ok" then
end if
str=str&"已解决问题</a></font></td>"&vbcrlf
str=str&"<td width=""20%"" "
if leixing="no" then
str=str&"bgcolor=""#FBF8F3"""
end if
str=str&"><font color=""#FFFFFF""><a href=""?dl="&server.URLEncode(dl)&"&xl="&server.URLEncode(xl)&"&leixing=no"" >"
if leixing="no" then
end if
str=str&"未解决问题</a></font></td>"&vbcrlf
str=str&"</tr>"&vbcrlf
str=str&"<tr bgcolor=""#978674""><td height=""1"" colspan=""5""></td></tr>"&vbcrlf
wtlx=str&"</table>"&vbcrlf
end function

function wt_list()
on Error Resume Next
dim dl,xl,rs,sql,leixing,str
dl=request("dl")
xl=request("xl")
leixing=request("leixing")

set rs=server.CreateObject("adodb.recordset")

if dl="" then
  if leixing="hot" then
  sql ="Select * from kw_wt order by djs desc"
  elseif leixing="gf" then
  sql ="Select * from kw_wt order by xsf desc"
  elseif leixing="ok" then
  sql ="Select * from kw_wt where zt=2 order by id desc"
  elseif leixing="no" then
  sql ="Select * from kw_wt where zt=1 order by id desc"
  elseif leixing="" then
  sql ="Select * from kw_wt order by id desc"
  end if
end if

if dl<>"" and xl="" then
  if leixing="hot" then
  sql ="Select * from kw_wt where dalei='"&dl&"' order by djs desc"
  elseif leixing="gf" then
  sql ="Select * from kw_wt where dalei='"&dl&"' order by xsf desc"
  elseif leixing="ok" then
  sql ="Select * from kw_wt where dalei='"&dl&"' and zt=2 order by id desc"
  elseif leixing="no" then
  sql ="Select * from kw_wt where dalei='"&dl&"' and zt=1 order by id desc"
  elseif leixing="" then
  sql ="Select * from kw_wt where dalei='"&dl&"' order by id desc"
  end if
end if

if dl<>"" and xl<>"" then
  if leixing="hot" then
  sql ="Select * from kw_wt where xiaolei='"&xl&"' order by djs desc"
  elseif leixing="gf" then
  sql ="Select * from kw_wt where xiaolei='"&xl&"' order by xsf desc"
  elseif leixing="ok" then
  sql ="Select * from kw_wt where xiaolei='"&xl&"' and zt=2 order by id desc"
  elseif leixing="no" then
  sql ="Select * from kw_wt where xiaolei='"&xl&"' and zt=1 order by id desc"
  elseif leixing="" then
  sql ="Select * from kw_wt where xiaolei='"&xl&"' order by id desc"
  end if
end if
rs.open sql,conn,1,1
str="<table width=""100%"" border=""0"" cellspacing=""1"" cellpadding=""0"">"&vbcrlf
str=str&"<tr align=""center"" bgcolor=""#D8D8D8"">"&vbcrlf
str=str&"<td height=""25"">标题</td>"&vbcrlf
str=str&"<td width=""7%"">悬赏分</td>"&vbcrlf
str=str&"<td width=""5%"">人气</td>"&vbcrlf
str=str&"<td width=""7%"">回答数</td>"&vbcrlf
str=str&"<td width=""5%"">状态</td>"&vbcrlf
str=str&"<td width=""16%"">时间</td></tr>"&vbcrlf

    dim page,maxperpage,n
        page=clng(Request.QueryString("page"))
        maxperpage=25  '最大每页数
        if page<1 then page=1
        If rs.recordcount Mod maxperpage = 0 Then
            n = rs.recordcount \ maxperpage
        else
            n = rs.recordcount \ maxperpage + 1
        end If
		if page>n then page=n
     '关键分页设置
        rs.move (Page-1)*MaxPerPage
        dim bookmark
        bookmark=rs.bookmark
     '关键分页设置
	 do while not rs.eof
	 str=str&"<tr bgcolor=""#F6F6F6"">"&vbcrlf
	 str=str&"<td height=""26"">&nbsp;<a href=""list.asp?dl="&server.URLEncode(rs("dalei"))&"&xl="&server.URLEncode(rs("xiaolei"))&""" target=""_blank""><font class=""font_fl"">["&rs("xiaolei")&"]</font></a> <a href=""show/"&rs("wt_filename")&""" target='_blank'>"&rs("bt")&"</a></td>"&vbcrlf
     str=str&"<td align=""center"">"&rs("xsf")&"</td>"&vbcrlf
	 str=str&"<td align=""center"">"&rs("djs")&"</td>"&vbcrlf
	 str=str&"<td align=""center"">"&vbcrlf
	       	
			dim rs1,sql1
	        set rs1=server.CreateObject("adodb.recordset")
	        sql1 ="Select * from kw_hd where hdques='"&rs("wt_filename")&"'"
	        rs1.open sql1,conn,1,1
	        if rs1.recordcount=0 then
	        str=str&"<img src=""images/no_an.gif"">"
	        else
	        str=str&rs1.recordcount
	        end if
			rs1.close
			set rs1=nothing
			
			str=str&"</td>"&vbcrlf
			str=str&"<td align=""center"">"&vbcrlf
				if rs("zt")=1 and rs("gq")=1 then
	            str=str&"<img src=""images/no_point.gif"" title=""等待解决"">"
	            elseif rs("zt")=2 then
	            str=str&"<img src=""images/yes_point.gif"" title=""已经解决"">"
	            elseif rs("zt")=3 then
	            str=str&"<img src=""images/wu_point.gif"" title=""无满意答案"">"
	           elseif rs("gq")=2 then
	           str=str&"<img src=""images/gq_point.gif"" title=""问题过期"">"
	           end if
	   str=str&"</td>"&vbcrlf
	   str=str&"<td>"&FormatDateTime(rs("twtime"),2)&"&nbsp;"&FormatDateTime(rs("twtime"),4)&"</td>"&vbcrlf 
	   str=str&"</tr>"&vbcrlf
			   
	rs.movenext
	i=i+1
	if i>=MaxPerPage then exit do
	loop
	str=str&"</table>"&vbcrlf
if n>1 then
str=str&"<table width=""100%"" align=""center"" cellpadding=""0"" cellspacing=""0"">"&vbcrlf
str=str&"<tr>"&vbcrlf
str=str&"<td align=""center"" height=""30"">"&vbcrlf
str=str&"<a href=""list.asp?page=1&dl="&dl&"&xl="&xl&"""><font style=""font-size:14px"">首页</font></a>&nbsp;&nbsp;&nbsp;"&vbcrlf
str=str&"<a href=""list.asp?page="&page-1&"&dl="&dl&"&xl="&xl&"""><font style=""font-size:14px"">上页</font></a>&nbsp;&nbsp;&nbsp;"&vbcrlf
str=str&"<a href=""list.asp?page="&page+1&"&dl="&dl&"&xl="&xl&"""><font style=""font-size:14px"">下页</font></a>&nbsp;&nbsp;&nbsp;"&vbcrlf
str=str&"<a href=""list.asp?page="&n&"&dl="&dl&"&xl="&xl&"""><font style=""font-size:14px"">尾页</font></a>&nbsp;&nbsp;&nbsp;"&vbcrlf
str=str&"<select name=""page"" onchange=""javascript:window.location='list.asp?dl="&dl&"&xl="&xl&"&page='+this.options[this.selectedIndex].value;"">"&vbcrlf
	  dim ii
	  for ii=1 to n
str=str&"<option value="""&ii&""""
if page=ii then
  str=str&"selected"
end if
str=str&">"&ii&"</option>"&vbcrlf
     next
str=str&"</select>"&vbcrlf
wt_list=str&"</td></tr></table>"&vbcrlf
else
wt_list=str
end if
end function
%>