<%
'生成下载详细静态方法
Function html_To_Download(ID, bkkey)
	Call SiteInfo()
	
	Set rs = server.CreateObject("adodb.recordset")
	rs.open "select * from BokeCMS_Download where ID="&ID,conn,1,2
	DownName = rs("DownName")
	ClassSeo = rs("ClassSeo")
	Origin = rs("Origin")
	Content = rs("Content")
	AddTime = rs("AddTime")
	UpdateTime = rs("UpdateTime")
	FileSize = rs("FileSize")
	FileUrl = rs("FileUrl")
	
	SortID = rs("SortID")
	SortName = Conn.execute("select * from BokeCMS_DownSort where ID="&rs("SortID"))("SortName")
	
	SeoTitle = rs("DownName")
	If rs("SeoKeywords") <> "" Then
		SeoKeywords = rs("SeoKeywords")
	Else
		SeoKeywords = rs("DownName")
	End If
	If rs("SeoDescription") <> "" Then
		SeoDescription = rs("SeoDescription")
	Else
		SeoDescription = rs("DownName")
	End If
	rs.close : set rs = nothing
	If bkkey = "PC" Then Flag = "ViewFlag"
	If bkkey = "Mobile" Then Flag = "MobileFlag"

	set rs = server.CreateObject("adodb.recordset")
	rs.open "select top 1 * from BokeCMS_Download where ID<" & ID & " and "&Flag&" Order by ID desc", Conn, 1, 2
	if rs.eof then
		PrevLink = "#" : PrevName = "没有了"
	else
		PrevLink = rs("ClassSeo") & Separated & rs("ID") & "." & HTMLName : PrevName = rs("DownName")
	end if
	rs.close
	rs.open "select top 1 * from BokeCMS_Download where ID>" & ID & " and "&Flag&" Order by ID asc", Conn, 1, 2
	if rs.eof then
		NextLink = "#" : NextName = "没有了"
	else
		NextLink = rs("ClassSeo") & Separated & rs("ID") & "." & HTMLName : NextName = rs("DownName")
	end if
	rs.close : set rs = nothing

	If bkkey = "PC" Then
		replace_code = ReadFromUTF(TemplatePath&"/html/DownloadView.html","utf-8")
		FilePath = "/"&DownDir&"/"&ClassSeo&Separated&ID&"."&HTMLName&""
		TemplatePath = TemplatePath
	End If
	If bkkey = "Mobile" Then
		replace_code = ReadFromUTF(mTemplatePath&"/html/DownloadView.html","utf-8")
		FilePath = "/wap/"&DownDir&"/"&ClassSeo&Separated&ID&"."&HTMLName&""
		TemplatePath = mTemplatePath
	End If

	If SiteStatus Then
		replace_code = Position(replace_code, SortID, 5, bkkey)
	
		replace_code = replace(replace_code, "{bokecms:SortName}", SortName)
		replace_code = ReplaceCommon(replace_code, TemplatePath, bkkey)
		
		replace_code = replace(replace_code, "{bokecms:ID}", ID)
		replace_code = replace(replace_code, "{bokecms:DownName}", DownName)
		replace_code = replace(replace_code, "{bokecms:FileSize}", FileSize)
		replace_code = replace(replace_code, "{bokecms:FileUrl}", FileUrl)
		replace_code = replace(replace_code, "{bokecms:SortID}", SortID)
		replace_code = replace(replace_code, "{bokecms:Origin}", Origin)
		replace_code = replace(replace_code, "{bokecms:Content}", Content)		
		replace_code = replace(replace_code, "{bokecms:SeoTitle}", SeoTitle)
		replace_code = replace(replace_code, "{bokecms:SeoKeywords}", SeoKeywords)
		replace_code = replace(replace_code, "{bokecms:SeoDescription}", SeoDescription)

		replace_code = ParseTime(replace_code, AddTime, "AddTime")
		replace_code = ParseTime(replace_code, UpdateTime, "UpdateTime")

		replace_code = replace(replace_code, "{bokecms:PrevName}", PrevName)
		replace_code = replace(replace_code, "{bokecms:PrevLink}", PrevLink)
		replace_code = replace(replace_code, "{bokecms:NextName}", NextName)
		replace_code = replace(replace_code, "{bokecms:NextLink}", NextLink)

		replace_code = HtmlTo(replace_code, "", "", bkkey, "")
	Else
		replace_code = ExplainJS
	End If
	
	If bkkey = "PC" Then replace_code = replace_code & ConstJs
	Call WriteToUTF(FilePath, replace_code)
End Function
%>