<!--#include file="../inc/Conn.asp"-->
<!--#include file="../Inc/Cls.Common.asp"-->
<!--#include file="../Inc/Cls.Templates.asp"-->
<!--#include file="Channel_Config.asp"-->
<%
    Dim ParentPath,I,CycList,ShowNum,TempList,CycTemp
	Dim Title,Pic,Tag,Tags,n,ShowIncludePic,ContentNum,TitleNum,Con,Term
	Dim PageUrl,ClassUrl
    ClassID = WRMPS.CheckStr(Request.QueryString("ID"),1)
    If ClassID = "" Then Call WRMPS.ErrView("返回"&ChannelName&"首页","index.asp","<li>操作错误",0)
    Page = WRMPS.CheckStr(Request("Page"),1)
	If Page = "" Then Page = 1

	SitePath = ",<a href="&WR_Setting(3)&ChannelDir&"/>"&ChannelName&"</a>"
	Call DBConnBegin()
    Set Rs = Server.CreateObject("ADODB.Recordset")
	Rs.Open"Select WM_ID,WM_Name,WM_ParentPath,WM_Child,WM_Type,WM_ChannelDir,WM_ParentDir,WM_Dir,WM_Url,WM_ChannelID,WM_TempID,WM_NoTempID,WM_MetaKey,WM_MetaContent From WM_ArticleSort Where WM_ID="&ClassID ,Conn,1,1
	If Not Rs.Eof Then
	      ClassName = Rs(1)
	      Select Case Rs(4)
	           Case 0
			     Response.Redirect(Rs(8))
				 Response.End
		       Case 1
		         CrePagePath = WRMPS.GetClassUrl(1,1,Rs(5)&Rs(6)&Rs(7),Rs(0))
	      End Select
		  Call WRMPS.FsoBegin()
		  If Int(Rs(3)) > 0 Then TempStr = WRTemp.SiteTemplates(1,Rs(10),22,ChannelID) Else TempStr = WRTemp.SiteTemplates(1,Rs(11),23,ChannelID)
		  Call WRMPS.FsoEnd()
		  MetaKey = Rs(12)
		  MetaContent = Rs(13)
		  If Rs(2) <> "0" Then
	        ParentPath = Right(Rs(2),Len(Rs(2))-2)
	        ParentPath = Split(ParentPath,",")
		    For I=0 to UBound(ParentPath)
	          Set Rso = Conn.Execute("Select WM_ID,WM_Name,WM_Type,WM_ChannelDir,WM_ParentDir,WM_Dir,WM_Url From WM_ArticleSort Where WM_ID="&Int(ParentPath(I))&"")
			  SitePath = SitePath & ",<a href="
	          Select Case Rso(2)
	            Case 0
		          SitePath = SitePath & WRMPS.GetClassUrl(1,0,Rso(6),Rso(0),1)
		        Case 1
		          SitePath = SitePath & WRMPS.GetClassUrl(1,1,Rso(3)&Rso(4)&Rso(5),Rso(0))
	          End Select
			  SitePath = SitePath & ">"&Rso(1)&"</a>"
			  Rso.Close
	        Next
	      End If
	      SitePath = SitePath & ",<a href="&CrePagePath&">"&Rs(1)&"</a>"
		  Rs.Close
	Else
	    Rs.Close
		Call WRMPS.ErrView("返回"&ChannelName&"首页","index.asp","<li>栏目不存在",0)
	End If
	Set Rso = Nothing
	Set Rs = Nothing
	SitePath = WRMPS.GetSitePath(-1,SitePath)

	ClassUrl = WRMPS.GetClassUrl(1,1,ChannelDir&"/",ClassID)
	PageUrl = WRMPS.GetClassUrl(Page,1,ChannelDir&"/",ClassID)

	ContentNum = 0
	Term = WRMPS.HCode(2,TempStr,"{\$CycBegin}【","】")
	CycList = WRMPS.HCode(2,TempStr,"{\$CycBegin}【"&Term&"】","{\$CycEnd}")
	ShowNum = Split(Term,",")(0)
	TitleNum = Split(Term,",")(1)
	ContentNum = Split(Term,",")(2)

	If MyCityID > 0 Then SQL = " and WM_AreaID in("&WRDB.GetChildClass(MyCityID,"WM_Area")&")"&SQL
	SQL = "WM_ClassID in("&WRDB.GetChildClass(ClassID,"WM_ArticleSort")&")" & SQL & " and WM_Passed=1 and WM_IsDeleted=0"

    Set ClsPageList = New Cls_PageView
      ClsPageList.strTableName = "WM_Article"
      ClsPageList.strPageUrl = PageUrl
      ClsPageList.strFieldsList = "WM_ID,WM_Title,WM_TitleColor,WM_TitleFont,WM_AddTime,WM_ClassDir,WM_DefaultPicUrl,WM_Keyword,WM_TitlePrefixion,WM_TitleReview,WM_Hot,WM_Commend,WM_CopyFrom,WM_Author,WM_Post,WM_Hit,WM_Re,WM_Collection,WM_Synopsis"
      ClsPageList.strCondiction = SQL
      ClsPageList.strOrderList = "WM_ID Desc"
      ClsPageList.strPrimaryKey = "WM_ID"
      ClsPageList.intPageSize = ShowNum
      ClsPageList.intPageNow = Page
      ClsPageList.strCookiesName = "RecordCount"
      ClsPageList.strPageVar = "Page"
      ClsPageList.intRefresh = 1
      ClsPageList.objConn = Conn
      ClsPageList.InitClass
      arrPage = ClsPageList.arrPage
      strPageList = ClsPageList.strPageList
    Set ClsPageList = nothing

    TempList = "":CycTemp=""
    If IsArray(arrPage) Then
      For i = 0 to UBound(arrPage, 2)
	    Tag="":Tags="":PIC = ""
	    CycTemp = CycList
		CycTemp = WRMPS.GetReplace(CycTemp,"{$ID}",arrPage(0,i))
		CycTemp = WRMPS.GetReplace(CycTemp,"{$No}",i+1+(Page-1)*ShowNum)
		Title = arrPage(1,i)
		If TitleNum > 0 Then Title = WRMPS.GotTopic(Title,Int(TitleNum),0)
		If arrPage(2,i) <> "" Then Title = "<Font Color="&arrPage(2,i)&">"&Title&"</Font>"
		Select Case arrPage(3,i)
		  Case 1
		    Title = "<strong>"&Title&"</strong>"
		  Case 2
		    Title = "<i>"&Title&"</i>"
		  Case 3
		    Title = "<strong><i>"&Title&"</i></strong>"
		End Select
		CycTemp = WRMPS.GetReplace(CycTemp,"{$Title}",Title)
		CycTemp = WRMPS.GetReplace(CycTemp,"{$Url}",WRMPS.GetShowUrl(1,1,0,arrPage(0,i),arrPage(4,i),ChannelDir&arrPage(5,i),ChannelID))
		Pic = WRMPS.CheckStr(arrPage(6,i),5)
		If Pic = "" Then Pic = WR_Setting(3)&"Skins/"&WR_Setting(5)&"/nopic.gif"
		CycTemp = WRMPS.GetReplace(CycTemp,"{$Pic}",Pic)
		If Instr(CycTemp,"{$Tags}") > 0 Then
	        Tag = arrPage(7,i)
			If Tag <> "" and IsNUll(Tag) = False Then
		        Tag = Split(Tag,",")
		        For n=0 To UBound(Tag)
		         If Tag(n) <> "" Then
		          If Tags = "" Then
			        Tags = "<a href="&WR_Setting(3)&"Search/A?Key="&escape(Tag(n))&" target=_blank>"&Tag(n)&"</a>"
		          Else
			        Tags = Tags&",<a href="&WR_Setting(3)&"Search/A?Key="&escape(Tag(n))&" target=_blank>"&Tag(n)&"</a>"
			      End If
		    	 End If
		        Next
		    End If
			CycTemp = WRMPS.GetReplace(CycTemp,"{$Tags}",Tags)
		End If
		If Instr(CycTemp,"{$Prefixion}") > 0 Then
  			Select Case arrPage(8,i)
   			 Case "[图]"
   			   ShowIncludePic="<Font Color=#003366>[图]</Font>"
   			 Case "[图文]"
   			   ShowIncludePic="<Font Color=#336600>[图文]</Font>"
   			 Case "[组图]"
   			   ShowIncludePic="<Font Color=#666600>[组图]</Font>"
   			 Case "[讨论]"
   			   ShowIncludePic="<Font Color=#663333>[讨论]</Font>"
             Case "[公告]"
   			   ShowIncludePic="<Font Color=#CC0000>[公告]</Font>"
    	     Case "[转载]"
    		   ShowIncludePic="<Font Color=#990033>[转载]</Font>"
    	     Case "[推荐]"
     		   ShowIncludePic="<Font Color=#FF00FF>[推荐]</Font>"
   			 Case "[原创]"
               ShowIncludePic="<Font Color=#FF6600>[原创]</Font>"
   			 Case Else
               ShowIncludePic=""
			End Select
	        CycTemp = WRMPS.GetReplace(CycTemp,"{$Prefixion}",ShowIncludePic)
		End If
		If Instr(CycTemp,"{$ReviewLink}") > 0 Then If arrPage(9,i) > 0 Then CycTemp = WRMPS.GetReplace(CycTemp,"{$ReviewLink}","<a href="&WRMPS.GetShowUrl(1,1,0,arrPage(0,i),arrPage(4,i),ChannelDir&arrPage(5,i),ChannelID)&"#Re target='_blank'><img src='"&WR_Setting(3)&"Skins/"&WR_Setting(5)&"/Re.gif' border=0 align=absmiddle></a>") Else CycTemp = WRMPS.GetReplace(CycTemp,"{$ReviewLink}","")
        If Instr(CycTemp,"{$HotSign}") > 0 Then If arrPage(10,i)>0 Then  CycTemp = WRMPS.GetReplace(CycTemp,"{$HotSign}","<Img Src='"&WR_Setting(3)&"Skins/"&WR_Setting(5)&"/Hot.gif' alt='热门' align=absmiddle>") Else CycTemp = WRMPS.GetReplace(CycTemp,"{$HotSign}","")
        If Instr(CycTemp,"{$CommendSign}") > 0 Then If arrPage(11,i)>0 Then CycTemp = WRMPS.GetReplace(CycTemp,"{$CommendSign}","<Img Src='"&WR_Setting(3)&"Skins/"&WR_Setting(5)&"/Elite.gif' alt='推荐' align=absmiddle>") Else CycTemp = WRMPS.GetReplace(CycTemp,"{$CommendSign}","")
        If Instr(CycTemp,"{$NewSign}") > 0 Then If arrPage(4,i) >= (Now()-1) Then CycTemp = WRMPS.GetReplace(CycTemp,"{$NewSign}","<Img Src='"&WR_Setting(3)&"Skins/"&WR_Setting(5)&"/New.gif' alt='新进' align=absmiddle>") Else CycTemp = WRMPS.GetReplace(CycTemp,"{$NewSign}","")
        CycTemp = WRMPS.GetReplace(CycTemp,"{$CopyForm}",arrPage(12,i))
        CycTemp = WRMPS.GetReplace(CycTemp,"{$Author}",arrPage(13,i))
        CycTemp = WRMPS.GetReplace(CycTemp,"{$Editor}",arrPage(14,i))
        CycTemp = WRMPS.GetReplace(CycTemp,"{$Hit}",arrPage(15,i))
        CycTemp = WRMPS.GetReplace(CycTemp,"{$Re}",arrPage(16,i))
        CycTemp = WRMPS.GetReplace(CycTemp,"{$Time}",arrPage(4,i))
        CycTemp = WRMPS.GetReplace(CycTemp,"{$Collection}",arrPage(17,i))
        CycTemp = WRMPS.GetReplace(CycTemp,"{$Page}",Page)
		If Instr(CycTemp,"{$Content}") > 0 Then
		  Con = arrPage(18,i)
		  If Int(ContentNum) > 0 Then Con = WRMPS.GotTopic(WRMPS.LeachHTML(Con),Int(ContentNum),1) Else Con = ""
          CycTemp = WRMPS.GetReplace(CycTemp,"{$Content}",Con)
		End If
        TempList = TempList & CycTemp
      Next
    End If

    TempStr = WRMPS.GetReplace(TempStr,"{$NextPage}",strPageList)

	TempStr = WRMPS.GetReplace(TempStr,"{$ClassUrl}",ClassUrl)
    TempStr = WRMPS.HCode(1,TempStr,"{\$CycBegin}","{\$CycEnd}") & TempList & WRMPS.HCode(3,TempStr,"{\$CycBegin}","{\$CycEnd}")
	TempStr = WRTemp.SiteClass(TempStr)
	TempStr = WRTemp.SiteChannel(TempStr)
	TempStr = WRTemp.SiteLabel(TempStr)
	Call ClassEnd()
    Call DBConnEnd()
	Response.write TempStr
%>