<!-- #include file="conn.asp" -->
<!-- #include file="cls_main.asp" -->
<!-- #include file="cls_Mesky_showPage.asp" -->
<!-- #include file="cls_regExp.asp" -->
<% dim obj,Mesky
set obj = New ViewDownNew
	obj.AspInit()
set obj = nothing

class ViewDownNew
	Private Sub Class_Initialize()
		Set Mesky = New Cls_Main
	End Sub
	Private Sub Class_Terminate()
		Set Mesky = Nothing
	End Sub
	Public Sub AspInit()
		Call Mesky.LoadSetting()
		Dim arrNew,sID
		arrNew = "全部软件," & Mesky.Setting(143)
		arrNew = Split(arrNew,",")
		IF Request.QueryString("s") <>"" then 
			sID = Mesky.checkStr(Trim(Request.QueryString("s")))
			Call show_Down_New(sID, arrNew(sID))
		Else
			Call show_Down_New(0, arrNew(0))
		End If		
	End Sub
	Public Sub show_Down_New(sID, stype)
	
		Dim arrPage, arrMainPage, sFileName, sXml, strSQL, x, selectType
		
		arrPage = Split(Mesky.ReadStylePage("Style_Down_New"), "<!--|||-->")
		arrMainPage = Split(Mesky.ReadStylePage("Style_Down_Main"), "<!--|||-->")
		
		selectType = selectType & "<select name=""select"" onChange='javascript:window.open(this.options[this.selectedIndex].value,""_top"")'>" & vbCrLf
		selectType = selectType & "<option value=""../" & Replace(Replace(Mesky.Setting(75), "{$s}", "0"), "{$pages}", "1") & """>全部软件</option> " & vbCrLf
		For x = 1 To UBound(Split(Mesky.Setting(143), ",")) + 1
			selectType = selectType & "<option value=""../" & Replace(Replace(Mesky.Setting(75), "{$s}", x), "{$pages}", "1") & """ "
			If x = sID Then
				selectType = selectType & "selected"
			End If
			selectType = selectType & ">" & Split(Mesky.Setting(143), ",")(x - 1) & "</option>" & vbCrLf
		Next
		selectType = selectType & "</select>" & vbCrLf
		
		If sID = 0 Then
			strSQL = "isAuditing=1"
		Else
			
			strSQL = " ResType = '" & stype & "' and isAuditing=1"
		End If
		
		Dim Rs, showPageRs, sql, i, sColumn, currentPage, Pages, tempStr, s
		Dim fso, fout		
		
		Set showPageRs = New cls_Mesky_showPage
		
		If Mesky.Setting(84) Mod Mesky.Setting(83) = 0 Then
			Pages = CLng(Mesky.Setting(84) / Mesky.Setting(85) * -1) * -1
		Else
			Pages = CLng(Mesky.Setting(84) / Mesky.Setting(85) * -1) * -1 + 1
		End If
		
		If Trim(Request.QueryString("Page")) = "" then
			currentPage = 1
		Else
			currentPage = Trim(Request.QueryString("Page"))
		End if
		
			If IsSqlDataBase = 1 Then
				showPageRs.DbType = "MSSQL_SP"
			Else
				showPageRs.DbType = "AC"
			End If
			sColumn = "ID,rootID,catalogID,catalogName,ResName,ResVer,UpdateTime,ResRank,HitsTotal,ResSize,isHot,isTop,isBest,excerpt"
			showPageRs.RecType = 3
			showPageRs.RecSql = Mesky.Setting(84)
			showPageRs.RecTerm = 2
			showPageRs.CookieName = "downNew" & sID
			showPageRs.Order = 1
			showPageRs.PageSize = Int(Mesky.Setting(85))
			showPageRs.currentPage = Int(currentPage)
			showPageRs.sql = sColumn & "$Mesky_Down_Resource$" & strSQL & "$UpdateTime Desc$UpdateTime"
	
			Dim iRecCount, sqlRs
			iRecCount = showPageRs.RecCount()			
			
			sFileName = "../" & Replace(Mesky.Setting(75), "{$s}", sID & "&Page={$pages}")
			tempStr = Replace(arrMainPage(0), "{$page_title}", Mesky.Setting(0) & " - 最近更新 - " & stype) & arrMainPage(1) & arrMainPage(2)
			tempStr = tempStr & Replace(Replace(arrPage(0), "{$site_nav}", Mesky.site_nav(0, "Mesky_Down_catalog", stype & " 最近更新", "")), "{$select_toptype}", selectType)
			tempStr = tempStr & Replace(Replace(arrPage(1), "{$strsql}", strSQL), "{$showpage}", showPageRs.showPage(sFileName))
			tempStr = regExp_showDownRes(tempStr)
			'Response.Write iRecCount
			If iRecCount < 1 Then
				s = "<tr> <td colspan=""5"">Sorry！没有找到任何记录。</td></tr>"
				tempStr = tempStr & s
				s = Null
			Else
				'Set sqlRs = showPageRs.ResultSet()
				Rs = showPageRs.ResultSet()
				For i = 0 To UBound(Rs, 2)
					s = arrPage(2)
					If Rs(11, i) Then
						s = Replace(s, "{$dot_images}", "<img src=""../images/isTop.gif"" align=""absmiddle"">")
					ElseIf Rs(10, i) Then
						s = Replace(s, "{$dot_images}", "<img src=""../images/isHot.gif"" align=""absmiddle"">")
					ElseIf Rs(12, i) Then
						s = Replace(s, "{$dot_images}", "<img src=""../images/isBest.gif"" align=""absmiddle"">")
					Else
						s = Replace(s, "{$dot_images}", "<img src=""../images/isList.gif"" align=""absmiddle"">")
					End If
					s = Replace(s, "{$catalogurl}", "../" & Replace(Replace(Mesky.Setting(73), "{$id}", Rs(2, i)), "{$pages}", "1"))
					s = Replace(s, "{$catalogname}", Rs(3, i))
					s = Replace(s, "{$softurl}", Replace(Mesky.Setting(77), "{$id}", Rs(0, i)))
					s = Replace(s, "{$softname}", Rs(4, i))
					s = Replace(s, "{$softver}", Rs(5, i))
					s = Replace(s, "{$updatetime}", Mesky.FormatMyDate(Rs(6, i), "{Y}-{m}-{d}"))
					s = Replace(s, "{$softrank}", Rs(7, i))
					s = Replace(s, "{$hitstotal}", Rs(8, i))
					If Rs(9, i) > 1024 Then
						s = Replace(s, "{$softsize}", Round(Rs(9, i) / 1024, 2) & " MB")
					Else
						s = Replace(s, "{$softsize}", Rs(9, i) & " KB")
					End If
					s = Replace(s, "{$excerpt}", Rs(13, i))
					tempStr = tempStr & s
					s = Null
				Next
				Rs = Null
				'Set sqlRs = Nothing
			End If
			tempStr = tempStr & Replace(arrPage(3), "{$showpage}", showPageRs.showPage(sFileName)) & arrMainPage(5)
		
		Response.Write Replace(Mesky.HtmlHead() & tempStr,"../","")
		Response.Flush
		tempStr = Null
		Set showPageRs = Nothing
	End Sub
End Class
%>