<!-- #include file="conn.asp" -->
<!-- #include file="cls_main.asp" -->
<% dim obj
set obj = New ViewDownloadURL
	obj.AspInit()
set obj = nothing


class ViewDownloadURL

	Private ID, i, Mesky
	Private Sub Class_Initialize()
		Set Mesky = New Cls_Main
	End Sub
	Private Sub Class_Terminate()
		Set Mesky = Nothing
	End Sub
	Public Sub AspInit()
	
		If Request.QueryString("ID") = "" Then
			Response.Write "非法操作！指定的参数不正确。"
			Response.End
		ElseIf IsNumeric(Request.QueryString("ID")) = False Then
			Response.Write "非法操作！指定的参数不正确。"
			Response.End
		Else
			ID = CLng(Request.QueryString("ID"))
		End If
		call Mesky.LoadSetting()
		If Mesky.Setting(80) = 1 Then
			Response.Write showDownloadAddress(ID, Mesky.Setting(81), 1)
		Else
			Response.Write showDownloadAddress(ID, Mesky.Setting(81), 0)
		End If
	
	End Sub
	'下载地址
	Private Function showDownloadAddress(ID, brNum, show)
		Dim sRs, aRs, s, arrDownloadName, arrDownloadURL, i
		If Mesky.Setting(89) = "1" then
			Set sRs = Mesky.Execute("select * from Mesky_Down_Address where Special<2 and ResourceID=" & ID & " order by Special")
		Else
			Set sRs = Mesky.Execute("select * from Mesky_Down_Address where Special=0 and ResourceID=" & ID & " order by ID")
		End IF
		If Not (sRs.EOF And sRs.BOF) Then
			Do While Not sRs.EOF
			If sRs("SiteID") > 0 Then '使用预定义
				's = s & "<a href=""Download.asp"""
				Set aRs = Mesky.Execute("select ID,DownloadName,DownloadURL,isLB from Mesky_Down_SiteSetting where ID = " & sRs("SiteID"))
				arrDownloadName = Split(aRs(1), ",")
				arrDownloadURL = Split(aRs(2), ",")
				If aRs(3) Then '显示全部分站
					s = s & ("<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""> <b>下载“" & sRs("Name") & "”</b><br>")
					For i = 0 To UBound(arrDownloadName)
						If show Then
							s = s & "·<a href=""../Download.asp?ID=" & sRs("ID") & "&URL=" & arrDownloadURL(i) & sRs("URL") & """>" & arrDownloadName(i) & "</a>　"
						Else
							s = s & "·<a href=""../Download.asp?ID=" & sRs("ID") & "&sID=" & i & """>" & arrDownloadName(i) & "</a>　"
						End If
						If ((i + 1) Mod brNum) = 0 Then s = s & "<br>"
					Next
				Else
					If show Then '在明文显示下载地址是强制显示全部分站
						For i = 0 To UBound(arrDownloadName)
							s = s & "·<a href=""../Download.asp?ID=" & sRs("ID") & "&URL=" & arrDownloadURL(i) & sRs("URL") & """>" & arrDownloadName(i) & "</a>　"
						's = s & "<img src=""images/d_download.gif"" align=""absmiddle"" border=""0""> <a href=""Download.asp?ID=" & sRs("ID") & " & sID=" & sRs("SiteID") & " & URL=" & sRs("URL") & """>" & sRs("Name") & "</a><br>"
						If ((i + 1) Mod brNum) = 0 Then s = s & "<br>"
						Next
					Else
						s = s & "<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""> <a href=""../Download.asp?ID=" & sRs("ID") & """>" & sRs("Name") & "</a><br>"
					End If
				End If
				Set aRs = Nothing
			Else '不使用预定义
				If show Then
					s = s & "<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""> <a href=""../Download.asp?ID=" & sRs("ID") & "&URL=" & sRs("URL") & """>" & sRs("Name") & "</a><br>"
				Else
					s = s & "<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""> <a href=""../Download.asp?ID=" & sRs("ID") & """>" & sRs("Name") & "</a><br>"
				End If
			End If
			sRs.MoveNext
			Loop
			End If
		Set sRs = Nothing
		showDownloadAddress = s
		s = Null
	End Function

End class
%>