<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<%
Dim Rs, SQL, i
Dim stype, DownloadClass_Ads
Dim Style_CSS, HtmlTempStr, ArticleTypeSrt
Dim NowStats, HtmlTitle
Dim InfoTime, title, ClassName
Set DownloadClass_Ads = New Adcolumn_Cls
stype = Replace(Request("type"), "'", "''")
Response.Write NewArticleInfo(stype)
CloseConn

Private Function NewArticleInfo(stype)
	DownsysClass.LoadTemplates ("article")
	Style_CSS = Replace(Replace(DownsysClass.Style_CSS, "{$SetupDir}", DownsysClass.SetupDir), "{$PicUrl}", DownsysClass.TempDir)
	HtmlTempStr = DownsysClass.mainhtml(0) & DownsysClass.mainhtml(1) & DownsysClass.mainhtml(2) & DownsysClass.mainhtml(3)
	HtmlTempStr = Replace(HtmlTempStr, "{$NavMenu}", DownsysClass.ClassMenu)
	HtmlTempStr = Replace(HtmlTempStr, "{$Style_CSS}", Style_CSS)
	Set Rs = Server.CreateObject("adodb.recordset")
	If stype <> "" Then
		SQL = "select top " & CInt(DownsysClass.TempSet(12)) & " * from NC_Article where isLock=0 and ArticleType='" & stype & "' order by InfoTime desc,ID desc"
		ArticleTypeSrt = stype
	Else
		SQL = "select top " & CInt(DownsysClass.TempSet(12)) & " * from NC_Article where isLock=0 order by InfoTime desc,ID desc"
		ArticleTypeSrt = "最近更新文章"
	End If
	NowStats = ArticleTypeSrt
	HtmlTitle = ArticleTypeSrt
	HtmlTempStr = HtmlTempStr & DownsysClass.temphtml(4)
	If CInt(DownsysClass.Setting(5)) = 0 Then
		HtmlTempStr = Replace(HtmlTempStr, "{$NewAllName}", "NewArticle.html")
	Else
		HtmlTempStr = Replace(HtmlTempStr, "{$NewAllName}", "NewArticle.Asp")
	End If
	Dim ArticleType, NewFileName
	ArticleType = Split(DownsysClass.Setting(36), ",")
	For i = 0 To UBound(ArticleType)
		HtmlTempStr = HtmlTempStr & DownsysClass.temphtml(5)
		If CInt(DownsysClass.Setting(5)) = 0 Then
			NewFileName = "NewArticle" & i & ".html"
		Else
			NewFileName = "?type=" & Trim(ArticleType(i))
		End If
		If Trim(ArticleType(i)) = stype Then HtmlTempStr = Replace(HtmlTempStr, "{$Selected}", "selected")
		HtmlTempStr = Replace(HtmlTempStr, "{$ArticleTypeName}", Trim(ArticleType(i)))
		HtmlTempStr = Replace(HtmlTempStr, "{$NewFileName}", NewFileName)

	Next
	HtmlTempStr = HtmlTempStr & DownsysClass.temphtml(6)
	Rs.Open SQL, Conn, 1, 1
	If Rs.bof And Rs.EOF Then
		HtmlTempStr = HtmlTempStr & "<tr><td colspan=5 class=Border2>还没有找到任何文章！</td></tr>"
	Else
		Do While Not Rs.EOF
			HtmlTempStr = HtmlTempStr & DownsysClass.temphtml(7)
			If Rs("InfoTime") >= Date Then
				InfoTime = "<FONT color=red>" & FormatDateTime(Rs("InfoTime"), 2) & "</FONT >"
			Else
				InfoTime = FormatDateTime(Rs("InfoTime"), 2)
			End If
			If CInt(DownsysClass.Setting(5)) = 0 Then
				Title = "<a href='" & DownsysClass.SetupDir & "Article/Catalog" & Rs("classid") & "/" & Rs("ID") & ".html'>" & Rs("Title") & "</A>"
				ClassName = "<a href='" & DownsysClass.SetupDir & "Listing/Catalog" & Rs("classid") & "/Listing_Indate_Desc_1.html'>" & Rs("ClassName") & "</a>"
			Else
				Title = "<a href='" & DownsysClass.SetupDir & "Article.Asp?id=" & Rs("ID") & "'>" & Rs("Title") & "</a>"
				ClassName = "<a href='" & DownsysClass.SetupDir & "Listing.Asp?classid=" & Rs("classid") & "'>" & Rs("ClassName") & "</a>"
			End If
			HtmlTempStr = Replace(HtmlTempStr, "{$Hits}", Rs("Hits"))
			HtmlTempStr = Replace(HtmlTempStr, "{$Topic}", Title)
			HtmlTempStr = Replace(HtmlTempStr, "{$InfoTime}", InfoTime)
			HtmlTempStr = Replace(HtmlTempStr, "{$ClassName}", ClassName)
			Rs.movenext
		Loop
	End If
	Rs.Close
	Set Rs = Nothing
	HtmlTempStr = HtmlTempStr & DownsysClass.mainhtml(10)
	HtmlTempStr = HtmlTempStr & DownsysClass.mainhtml(4)
	If CInt(DownsysClass.Setting(5)) = 0 Then
		HtmlTempStr = Replace(HtmlTempStr, "{$TopMeun}", DownsysClass.mainset(9))
	Else
		HtmlTempStr = Replace(HtmlTempStr, "{$TopMeun}", DownsysClass.mainset(10))
	End If
	HtmlTempStr = Replace(HtmlTempStr, "{$NowStats}", NowStats)
	HtmlTempStr = Replace(HtmlTempStr, "{$Title}", HtmlTitle)
	HtmlTempStr = Replace(HtmlTempStr, "{$Width}", DownsysClass.mainset(0))
	HtmlTempStr = Replace(HtmlTempStr, "{$FootMeun}", DownsysClass.mainset(11))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(0)}", DownloadClass_Ads.RunScriptAds(7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(1)}", DownloadClass_Ads.BannerAds(7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(2)}", DownloadClass_Ads.AdsColumn(7, 2))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(3)}", DownloadClass_Ads.AdsColumn(7, 3))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(6)}", DownloadClass_Ads.AdsColumn(7, 7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(4)}", DownloadClass_Ads.ScriptFloatAds(7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(5)}", DownloadClass_Ads.ScriptFixedAds(7))
	NewArticleInfo = HtmlTempStr
End Function
%>
