<!--#include file="setup.asp"-->
<%
Response.Buffer = True
Set NC_Admin = New Check
NC_Admin.AdminChk = "36"
NC_Admin.Check
DownsysClass.admin_header
If Not(DownsysClass.IsObjectFSO(DownsysClass.Script_FSO) And CInt(DownsysClass.Setting(5)) = 0 ) Then
	NC_Admin.Error_Msg ("<b><font color=red>你的服务器不支持 FSO(Scripting.FileSystemObject)或你后台没有选择为html方式</font></b>")
	DownsysClass.admin_footer
	Response.End
End If
NewArticleInfo
DownsysClass.admin_footer
NothingObject
CloseConn

Private Sub NewArticleInfo()
	Dim i, j
	Dim stype, DownloadClass_Ads
	Dim Style_CSS, HtmlTempStr, ArticleTypeSrt
	Dim NowStats, HtmlTitle
	Dim InfoTime, title, ClassName
	Dim FSO,Fout,CreateHtml
	ArticleType = Split(DownsysClass.Setting(36), ",")
	On Error Resume Next
	Server.ScriptTimeOut = 99999
	Set DownloadClass_Ads = New Adcolumn_Cls
	For j = -1 to UBound(ArticleType)
		If j=-1 then
			stype = ""

		Else
			stype = Replace(Trim(ArticleType(j)),"'", "''")
		End if
	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)
	HtmlTempStr = Replace(HtmlTempStr, "{$NewAllName}", "NewArticle.html")
	Dim ArticleType, NewFileName
	For i = 0 To UBound(ArticleType)
		HtmlTempStr = HtmlTempStr & DownsysClass.temphtml(5)
		NewFileName = "NewArticle_" & i & ".html"
		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))
	Set FSO = Server.CreateObject("ADODB.STREAM")
	If j=-1 then
		CreateHtml = Server.MapPath(DownsysClass.SetupDir & "Article/NewArticle.Html")
	Else
		CreateHtml = Server.MapPath(DownsysClass.SetupDir & "Article/NewArticle_" & j & ".Html")
	End If
		With FSO
			.Open
			.Charset = "GB2312"
			.WriteText HtmlTempStr
			.SaveToFile CreateHtml,2
			.Close
		End With
	Set FSO = Nothing
	Next
	NC_Admin.Succeed_Msg ("生成最近更新文章HTML页完成!")
	Set DownloadClass_Ads = Nothing
End Sub
%>
