<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/ConnSiteData.Asp" -->
<!--#include file="../Include/System_Language.asp" -->
<!--#include file="../Include/Version.Asp" -->
<!--#include file="html_Config.Asp"-->
<!--#include file="html_Function.Asp"-->

<!--#include file="html_To_Apage.Asp"-->
<!--#include file="html_To_ApageSort.Asp"-->
<!--#include file="html_To_Case.Asp"-->
<!--#include file="html_To_CaseSort.Asp"-->
<!--#include file="html_To_Video.Asp"-->
<!--#include file="html_To_VideoSort.Asp"-->
<!--#include file="html_To_Download.Asp"-->
<!--#include file="html_To_DownSort.Asp"-->
<!--#include file="html_To_Job.Asp"-->
<!--#include file="html_To_JobSort.Asp"-->
<!--#include file="html_To_Team.Asp"-->
<!--#include file="html_To_TeamSort.Asp"-->
<!--#include file="html_To_News.Asp"-->
<!--#include file="html_To_NewsSort.Asp"-->
<!--#include file="html_To_Product.Asp"-->
<!--#include file="html_To_ProductSort.Asp"-->
<!--#include file="html_To_Index.Asp"-->

<%
'生成静态AJAX调用
Dim ErrMsg
Call SiteInfo()
ID        = request("ID")
Ke01      = request("Ke01")
DataTable = request("DataTable")

If ID <> "" Then Where = " and ID=" & ID
If Ke01 = "PC" Then Flag = " ViewFlag " : TemplatePath = TemplatePath : TemFilePath = TemplatePath & "/html"
If Ke01 = "Mobile" Then Flag = " MobileFlag " : TemplatePath = mTemplatePath : TemFilePath = mTemplatePath & "/html"
dim Page, HideSort, lNum

If DataTable = "Site" Then
	HtmlSelect("Index")

	set rs = Conn.execute("select * from keyicms_System where DataForm=1")
	If rs("ViewFlag") Then
		ErrMsg = ErrMsg & "<dt>====" & rs("SystemName") & "======</dt>"
		HtmlSelect("Apage")
		HtmlSelect("ApageSort")
	End If
	set rs = nothing
	set rs = Conn.execute("select * from keyicms_System where DataForm=2")
	If rs("ViewFlag") Then
		ErrMsg = ErrMsg & "<dt>====" & rs("SystemName") & "======</dt>"
		HtmlSelect("News")
		HtmlSelect("NewsSort")
	End If
	set rs = nothing
	set rs = Conn.execute("select * from keyicms_System where DataForm=3")
	If rs("ViewFlag") Then
		ErrMsg = ErrMsg & "<dt>====" & rs("SystemName") & "======</dt>"
		HtmlSelect("Product")
		HtmlSelect("ProductSort")
	End If
	set rs = nothing
	set rs = Conn.execute("select * from keyicms_System where DataForm=4")
	If rs("ViewFlag") Then
		ErrMsg = ErrMsg & "<dt>====" & rs("SystemName") & "======</dt>"
		HtmlSelect("Case")
		HtmlSelect("CaseSort")
	End If
	set rs = nothing
	set rs = Conn.execute("select * from keyicms_System where DataForm=5")
	If rs("ViewFlag") Then
		ErrMsg = ErrMsg & "<dt>====" & rs("SystemName") & "======</dt>"
		HtmlSelect("Video")
		HtmlSelect("VideoSort")
	End If
	set rs = nothing
	set rs = Conn.execute("select * from keyicms_System where DataForm=6")
	If rs("ViewFlag") Then
		ErrMsg = ErrMsg & "<dt>====" & rs("SystemName") & "======</dt>"
		HtmlSelect("Download")
		HtmlSelect("DownSort")
	End If
	set rs = nothing
	set rs = Conn.execute("select * from keyicms_System where DataForm=7")
	If rs("ViewFlag") Then
		ErrMsg = ErrMsg & "<dt>====" & rs("SystemName") & "======</dt>"
		HtmlSelect("Job")
		HtmlSelect("JobSort")
	End If
	set rs = nothing
	set rs = Conn.execute("select * from keyicms_System where DataForm=8")
	If rs("ViewFlag") Then
		ErrMsg = ErrMsg & "<dt>====" & rs("SystemName") & "======</dt>"
		HtmlSelect("Team")
		HtmlSelect("TeamSort")
	End If
	set rs = nothing
Else
	Call HtmlSelect(DataTable)
End If
response.Write ErrMsg

Function HtmlSelect(DataTable)
	Select Case DataTable
		Case "Apage"
			Set rshtml = Conn.Execute("Select * from keyicms_ApageSort")
			If not rshtml.eof Then
				do while not rshtml.eof
				
					Set rsSite = Conn.Execute("Select * from keyicms_Apage where SortID=" & rshtml("ID") & " and " & Flag)
					do while not rsSite.eof
						Call html_To_Apage(rsSite("ID"), Ke01)
						rsSite.movenext
					loop
					set rsSite = nothing

					ErrMsg = ErrMsg & "<dd>" & rshtml("SortName") & "的详细页生成成功</dd>"
					rshtml.movenext
				loop
			End If
			rshtml.close : set rshtml = Nothing

		Case "ApageSort"
			Set rshtml = Conn.Execute("Select * from keyicms_ApageSort")
			If not rshtml.eof Then
				do while not rshtml.eof
					Call html_To_ApageSort(rshtml("ID"), Ke01)
					ErrMsg = ErrMsg & "<dd>" & rshtml("SortName") & "的栏目页生成成功</dd>"
					rshtml.movenext
				loop
			End If
			rshtml.close : set rshtml = Nothing

		Case "Video"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=5", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(RootHost & TemFilePath & "/VideoView.dwt") Then
					Set rs = server.CreateObject("adodb.recordset")
					rs.open "select * from keyicms_VideoSort Where not ViewFlag", Conn, 1, 2
					while not rs.eof
						HideSort = "and not(Instr(SortPath,'" & rs("SortPath") & "')>0) " & HideSort
						rs.movenext
					wend
					rs.close : set rs = nothing

					Set rshtml = Conn.Execute("Select * from keyicms_Video where " & Flag & HideSort)
					do while not rshtml.eof
						Call html_To_Video(rshtml("ID"), Ke01)
						rshtml.movenext
					loop
					rshtml.close : set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的详细页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的VideoView.dwt模板未找到，详细页未生成</font></dd>"
				End If
			End If
			rsSite.close : set rsSite = nothing

		Case "VideoSort"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=5", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(TemFilePath & "/VideoList.dwt") Then
					Set rs = server.CreateObject("adodb.recordset")
					rs.open "select * from keyicms_VideoSort Where not ViewFlag", Conn, 1, 2
					while not rs.eof
						HideSort = "and not(Instr(SortPath,'" & rs("SortPath") & "')>0) " & HideSort
						rs.movenext
					wend
					rs.close : set rs = nothing

					set strDictionary = server.CreateObject("SCRIPTING.DICTIONARY")
					Set regExpObj = New Regexp
					regExpObj.IgnoreCase = True 
					regExpObj.Global = True
					regExpObj.Pattern="{keyicms:List([\s\S]*?)}([\s\S]*?){/keyicms:List}"
					replace_code = ReadFromUTF(RootHost & TemFilePath & "/VideoList.dwt", "utf-8")
					set matches = regExpObj.Execute(replace_code)
					for each match in matches
						labelStr = match.SubMatches(0)
						set labelArr = ParseArr(labelStr)
						lNum = labelArr("Num")
					next
					set matches = nothing
					Set regExpObj = nothing
					set strDictionary = nothing
			
					Set rshtml = Server.CreateObject("ADODB.Recordset")
					sql = "select * from keyicms_VideoSort where ViewFlag"
					rshtml.Open sql, Conn, 1, 1
					Do While Not rshtml.EOF
						Call newVideo(rshtml("ID"))
						rshtml.movenext
					Loop
					rshtml.Close : Set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的列表页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的VideoList.dwt模板未找到，列表页未生成</font></dd>"
				End If

				If not Checkfile(TemFilePath & "/Video.dwt") and not Checkfile(TemFilePath & "/VideoList.dwt") Then
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的Video.dwt和VideoList.dwt模板未找到，栏目页未成功</font></dd>"
				Else
					Call newVideo("")
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的栏目页生成成功<br />"
				End If
			End If
			rsSite.close : set rsSite = nothing

		Case "Team"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=8", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(RootHost & TemFilePath & "/TeamView.dwt") Then
					Set rs = server.CreateObject("adodb.recordset")
					rs.open "select * from keyicms_TeamSort Where not ViewFlag", Conn, 1, 2
					while not rs.eof
						HideSort = "and not(Instr(SortPath,'" & rs("SortPath") & "')>0) " & HideSort
						rs.movenext
					wend
					rs.close : set rs = nothing

					Set rshtml = Conn.Execute("Select * from keyicms_Team where " & Flag & HideSort)
					do while not rshtml.eof
						Call html_To_Team(rshtml("ID"), Ke01)
						rshtml.movenext
					loop
					rshtml.close : set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的详细页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的TeamView.dwt模板未找到，详细页未生成</font></dd>"
				End If
			End If
			rsSite.close : set rsSite = nothing

		Case "TeamSort"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=8", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(TemFilePath & "/TeamList.dwt") Then
					Set rs = server.CreateObject("adodb.recordset")
					rs.open "select * from keyicms_TeamSort Where not ViewFlag", Conn, 1, 2
					while not rs.eof
						HideSort = "and not(Instr(SortPath,'" & rs("SortPath") & "')>0) " & HideSort
						rs.movenext
					wend
					rs.close : set rs = nothing

					set strDictionary = server.CreateObject("SCRIPTING.DICTIONARY")
					Set regExpObj = New Regexp
					regExpObj.IgnoreCase = True 
					regExpObj.Global = True
					regExpObj.Pattern="{keyicms:List([\s\S]*?)}([\s\S]*?){/keyicms:List}"
					replace_code = ReadFromUTF(RootHost & TemFilePath & "/TeamList.dwt", "utf-8")
					set matches = regExpObj.Execute(replace_code)
					for each match in matches
						labelStr = match.SubMatches(0)
						set labelArr = ParseArr(labelStr)
						lNum = labelArr("Num")
					next
					set matches = nothing
					Set regExpObj = nothing
					set strDictionary = nothing
			
					Set rshtml = Server.CreateObject("ADODB.Recordset")
					sql = "select * from keyicms_TeamSort where ViewFlag"
					rshtml.Open sql, Conn, 1, 1
					Do While Not rshtml.EOF
						Call newTeam(rshtml("ID"))
						rshtml.movenext
					Loop
					rshtml.Close : Set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的列表页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的TeamList.dwt模板未找到，列表页未生成</font></dd>"
				End If

				If not Checkfile(TemFilePath & "/Team.dwt") and not Checkfile(TemFilePath & "/TeamList.dwt") Then
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的Team.dwt和TeamList.dwt模板未找到，栏目页未成功</font></dd>"
				Else
					Call newTeam("")
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的栏目页生成成功<br />"
				End If
			End If
			rsSite.close : set rsSite = nothing

		Case "Index"
			If Checkfile(RootHost & TemFilePath & "/Index.dwt") Then
				Call html_To_Index("Index", Ke01)
				ErrMsg = ErrMsg & "<dd>首页生成成功</dd>"
			Else
				ErrMsg = ErrMsg & "<dd><font style='color:#F00'>首页的Index.dwt模板未找到，静态页未生成</font></dd>"
			End If

		Case "News"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=2", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(RootHost & TemFilePath & "/NewsView.dwt") Then
					Set rs = server.CreateObject("adodb.recordset")
					rs.open "select * from keyicms_NewsSort Where not ViewFlag", Conn, 1, 2
					while not rs.eof
						HideSort = "and not(Instr(SortPath,'" & rs("SortPath") & "')>0) " & HideSort
						rs.movenext
					wend
					rs.close : set rs = nothing

					Set rshtml = Conn.Execute("Select * from keyicms_News where " & Flag & HideSort)
					do while not rshtml.eof
						Call html_To_News(rshtml("ID"), Ke01)
						rshtml.movenext
					loop
					rshtml.close : set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的详细页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的NewsView.dwt模板未找到，详细页未生成</font></dd>"
				End If
			End If
			rsSite.close : set rsSite = nothing
		Case "NewsSort"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=2", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(TemFilePath & "/NewsList.dwt") Then
					Set rs = server.CreateObject("adodb.recordset")
					rs.open "select * from keyicms_NewsSort Where not ViewFlag", Conn, 1, 2
					while not rs.eof
						HideSort = "and not(Instr(SortPath,'" & rs("SortPath") & "')>0) " & HideSort
						rs.movenext
					wend
					rs.close : set rs = nothing

					set strDictionary = server.CreateObject("SCRIPTING.DICTIONARY")
					Set regExpObj = New Regexp
					regExpObj.IgnoreCase = True 
					regExpObj.Global = True
					regExpObj.Pattern="{keyicms:List([\s\S]*?)}([\s\S]*?){/keyicms:List}"
					replace_code = ReadFromUTF(RootHost & TemFilePath & "/NewsList.dwt", "utf-8")
					set matches = regExpObj.Execute(replace_code)
					for each match in matches
						labelStr = match.SubMatches(0)
						set labelArr = ParseArr(labelStr)
						lNum = labelArr("Num")
					next
					set matches = nothing
					Set regExpObj = nothing
					set strDictionary = nothing

					Set rshtml = Server.CreateObject("ADODB.Recordset")
					sql = "select * from keyicms_NewsSort where ViewFlag"
					rshtml.Open sql, Conn, 1, 1
					Do While Not rshtml.EOF
						Call newNews(rshtml("ID"))
						rshtml.movenext
					Loop
					rshtml.Close : Set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的列表页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的NewsList.dwt模板未找到，列表页未生成</font></dd>"
				End If

				If not Checkfile(TemFilePath & "/News.dwt") and not Checkfile(TemFilePath & "/NewsList.dwt") Then
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的News.dwt和NewsList.dwt模板未找到，栏目页未成功</font></dd>"
				Else
					Call newNews("")
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的栏目页生成成功<br />"
				End If
			End If
			rsSite.close : set rsSite = nothing

		Case "Product"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=3", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(RootHost & TemFilePath & "/ProductView.dwt") Then
					Set rs = server.CreateObject("adodb.recordset")
					rs.open "select * from keyicms_ProductSort Where not ViewFlag", Conn, 1, 2
					while not rs.eof
						HideSort = "and not(Instr(SortPath,'" & rs("SortPath") & "')>0) " & HideSort
						rs.movenext
					wend
					rs.close : set rs = nothing

					Set rshtml = Conn.Execute("Select * from keyicms_Product where " & Flag & HideSort)
					do while not rshtml.eof
						Call html_To_Product(rshtml("ID"), Ke01)
						rshtml.movenext
					loop
					rshtml.close : set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的详细页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的ProductView.dwt模板未找到，详细页未生成</font></dd>"
				End If
			End If
			rsSite.close : set rsSite = nothing
		Case "ProductSort"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=3", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(TemFilePath & "/ProductList.dwt") Then
					set strDictionary = server.CreateObject("SCRIPTING.DICTIONARY")
					Set regExpObj = New Regexp
					regExpObj.IgnoreCase = True 
					regExpObj.Global = True
					regExpObj.Pattern = "{keyicms:List([\s\S]*?)}([\s\S]*?){/keyicms:List}"
					replace_code = ReadFromUTF(RootHost & TemFilePath & "/ProductList.dwt", "utf-8")
					set matches = regExpObj.Execute(replace_code)
					for each match in matches
						labelStr = match.SubMatches(0)
						set labelArr = ParseArr(labelStr)
						lNum = labelArr("Num")
					next

					set matches = nothing
					Set regExpObj = nothing
					set strDictionary = nothing
			
					Set rshtml = Server.CreateObject("ADODB.Recordset")
					sql = "select * from keyicms_ProductSort where ViewFlag"
					rshtml.Open sql, Conn, 1, 1
					Do While Not rshtml.EOF
						Call newProduct(rshtml("ID"))
						rshtml.movenext
					Loop
					rshtml.Close : Set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的列表页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的ProductList.dwt模板未找到，列表页未生成</font></dd>"
				End If

				If not Checkfile(TemFilePath & "/Product.dwt") and not Checkfile(TemFilePath & "/ProductList.dwt") Then
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的Product.dwt和ProductList.dwt模板未找到，栏目页未成功</font></dd>"
				Else
					Call newProduct("")
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的栏目页生成成功<br />"
				End If
			End If
			rsSite.close : set rsSite = nothing

		Case "Case"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=4", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(RootHost & TemFilePath & "/CaseView.dwt") Then
					Set rs = server.CreateObject("adodb.recordset")
					rs.open "select * from keyicms_CaseSort Where not ViewFlag", Conn, 1, 2
					while not rs.eof
						HideSort = "and not(Instr(SortPath,'" & rs("SortPath") & "')>0) " & HideSort
						rs.movenext
					wend
					rs.close : set rs = nothing

					Set rshtml = Conn.Execute("Select * from keyicms_Case where " & Flag & HideSort & Where)
					do while not rshtml.eof
						Call html_To_Case(rshtml("ID"), Ke01)
						rshtml.movenext
					loop
					rshtml.close : set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的详细页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的CaseView.dwt模板未找到，详细页未生成</font></dd>"
				End If
			End If
			rsSite.close : set rsSite = nothing
		Case "CaseSort"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=4", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(TemFilePath & "/CaseList.dwt") Then
					set strDictionary = server.CreateObject("SCRIPTING.DICTIONARY")
					Set regExpObj = New Regexp
					regExpObj.IgnoreCase = True 
					regExpObj.Global = True
					regExpObj.Pattern = "{keyicms:List([\s\S]*?)}([\s\S]*?){/keyicms:List}"
					replace_code = ReadFromUTF(RootHost & TemFilePath & "/CaseList.dwt", "utf-8")
					set matches = regExpObj.Execute(replace_code)
					for each match in matches
						labelStr = match.SubMatches(0)
						set labelArr = ParseArr(labelStr)
						lNum = labelArr("Num")
					next
					set matches = nothing
					Set regExpObj = nothing
					set strDictionary = nothing
			
					Set rshtml = Server.CreateObject("ADODB.Recordset")
					sql = "select * from keyicms_CaseSort where ViewFlag"
					rshtml.Open sql, Conn, 1, 1
					Do While Not rshtml.EOF
						Call newCase(rshtml("ID"))
						rshtml.movenext
					Loop
					rshtml.Close : Set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的列表页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的CaseList.dwt模板未找到，列表页未生成</font></dd>"
				End If

				If not Checkfile(TemFilePath & "/Case.dwt") and not Checkfile(TemFilePath & "/CaseList.dwt") Then
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的Case.dwt和CaseList.dwt模板未找到，栏目页未成功</font></dd>"
				Else
					Call newCase("")
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的栏目页生成成功<br />"
				End If
			End If
			rsSite.close : set rsSite = nothing

		Case "Download"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=6", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(RootHost & TemFilePath & "/DownView.dwt") Then
					Set rs = server.CreateObject("adodb.recordset")
					rs.open "select * from keyicms_DownSort Where not ViewFlag", Conn, 1, 2
					while not rs.eof
						HideSort = "and not(Instr(SortPath,'" & rs("SortPath") & "')>0) " & HideSort
						rs.movenext
					wend
					rs.close : set rs = nothing

					Set rshtml = Conn.Execute("Select * from keyicms_Download where " & Flag & HideSort)
					do while not rshtml.eof
						Call html_To_Download(rshtml("ID"), Ke01)
						rshtml.movenext
					loop
					rshtml.close : set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的详细页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的DownView.dwt模板未找到，详细页未生成</font></dd>"
				End If
			End If
			rsSite.close : set rsSite = nothing
		Case "DownSort"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=6", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(TemFilePath & "/DownList.dwt") Then
					set strDictionary = server.CreateObject("SCRIPTING.DICTIONARY")
					Set regExpObj = New Regexp
					regExpObj.IgnoreCase = True 
					regExpObj.Global = True
					regExpObj.Pattern = "{keyicms:List([\s\S]*?)}([\s\S]*?){/keyicms:List}"
					replace_code = ReadFromUTF(RootHost & TemFilePath & "/DownList.dwt", "utf-8")
					set matches = regExpObj.Execute(replace_code)
					for each match in matches
						labelStr = match.SubMatches(0)
						set labelArr = ParseArr(labelStr)
						lNum = labelArr("Num")
					next
					set matches = nothing
					Set regExpObj = nothing
					set strDictionary = nothing
			
					Set rshtml = Server.CreateObject("ADODB.Recordset")
					sql = "select * from keyicms_DownSort where ViewFlag"
					rshtml.Open sql, Conn, 1, 1
					Do While Not rshtml.EOF
						Call newDownload(rshtml("ID"))
						rshtml.movenext
					Loop
					rshtml.Close : Set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的列表页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的DownList.dwt模板未找到，列表页未生成</font></dd>"
				End If

				If not Checkfile(TemFilePath & "/Case.dwt") and not Checkfile(TemFilePath & "/DownList.dwt") Then
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的Download.dwt和DownList.dwt模板未找到，栏目页未成功</font></dd>"
				Else
					Call newDownload("")
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的栏目页生成成功<br />"
				End If
			End If
			rsSite.close : set rsSite = nothing

		Case "Job"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=7", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(RootHost & TemFilePath & "/JobView.dwt") Then
					Set rshtml = Conn.Execute("Select * from keyicms_Job where " & Flag)
					do while not rshtml.eof
						Call html_To_Job(rshtml("ID"), Ke01)
						rshtml.movenext
					loop
					rshtml.close : set rshtml = Nothing
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的详细页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的JobView.dwt模板未找到，详细页未生成</font></dd>"
				End If
			End If
			rsSite.close : set rsSite = nothing
		Case "JobSort"
			set rsSite = server.CreateObject("adodb.recordset")
			rsSite.open "select * from keyicms_System where DataForm=7", conn, 1, 2
			If rsSite("ViewFlag") Then
				If Checkfile(TemFilePath & "/JobList.dwt") Then
					set strDictionary = server.CreateObject("SCRIPTING.DICTIONARY")
					Set regExpObj = New Regexp
					regExpObj.IgnoreCase = True 
					regExpObj.Global = True
					regExpObj.Pattern = "{keyicms:List([\s\S]*?)}([\s\S]*?){/keyicms:List}"
					replace_code = ReadFromUTF(RootHost & TemFilePath & "/JobList.dwt", "utf-8")
					set matches = regExpObj.Execute(replace_code)
					for each match in matches
						labelStr = match.SubMatches(0)
						set labelArr = ParseArr(labelStr)
						lNum = labelArr("Num")
					next
					set matches = nothing
					Set regExpObj = nothing
					set strDictionary = nothing

					set rs = server.CreateObject("adodb.recordset")
					rs.open "Select * from keyicms_Job Where " & Flag & datawhere, Conn, 1, 2
					rs.pagesize = lNum
					newTotalPage = rs.pagecount
					rs.close : set rs = nothing
					If newTotalPage = 0 then newTotalPage = newTotalPage + 1
		
					Page = "" : Call html_To_JobSort("Index." & HTMLName, Ke01)
					For n = 1 To newTotalPage
						Page = n : Call html_To_JobSort("Index" & Separated & n & "." & HTMLName, Ke01)
					Next

					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的列表页生成成功</dd>"
				Else
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的JobList.dwt模板未找到，列表页未生成</font></dd>"
				End If

				If not Checkfile(TemFilePath & "/Job.dwt") and not Checkfile(TemFilePath & "/JobList.dwt") Then
					ErrMsg = ErrMsg & "<dd><font style='color:#F00'>" & rsSite("SystemName") & "的Job.dwt和JobList.dwt模板未找到，栏目页未成功</font></dd>"
				Else
					Call html_To_JobSort("Index." & HTMLName, Ke01)
					ErrMsg = ErrMsg & "<dd>" & rsSite("SystemName") & "的栏目页生成成功<br />"
				End If
			End If
			rsSite.close : set rsSite = nothing
	End Select
End Function

Sub newVideo(ID)
	If ID <> "" Then
		SortPath = Conn.execute("Select * from keyicms_VideoSort where ID=" & ID)("SortPath")
		datawhere =  " and instr(SortPath,'" & SortPath & "')>0"
	End If
	
	set rs = server.CreateObject("adodb.recordset")
	rs.open "Select * from keyicms_Video Where " & Flag & datawhere, Conn, 1, 2
	rs.pagesize = lNum
	newTotalPage = rs.pagecount
	rs.close : set rs = nothing
	If newTotalPage = 0 then newTotalPage = newTotalPage + 1
	
	Page = "" : Call html_To_VideoSort(ID, "Index." & HTMLName, Ke01)
	For n = 1 To newTotalPage
		Page = n : Call html_To_VideoSort(ID, "Index" & Separated & n & "." & HTMLName, Ke01)
	Next
End Sub

Sub newTeam(ID)
	If ID <> "" Then
		SortPath = Conn.execute("Select * from keyicms_TeamSort where ID=" & ID)("SortPath")
		datawhere =  " and instr(SortPath,'" & SortPath & "')>0"
	End If
	
	set rs = server.CreateObject("adodb.recordset")
	rs.open "Select * from keyicms_Team Where " & Flag & datawhere, Conn, 1, 2
	rs.pagesize = lNum
	newTotalPage = rs.pagecount
	rs.close : set rs = nothing
	If newTotalPage = 0 then newTotalPage = newTotalPage + 1
	
	Page = "" : Call html_To_TeamSort(ID, "Index." & HTMLName, Ke01)
	For n = 1 To newTotalPage
		Page = n : Call html_To_TeamSort(ID, "Index" & Separated & n & "." & HTMLName, Ke01)
	Next
End Sub

Sub newCase(ID)
	If ID <> "" Then
		SortPath = Conn.execute("Select * from keyicms_CaseSort where ID=" & ID)("SortPath")
		datawhere =  " and instr(SortPath,'" & SortPath & "')>0"
	End If
	
	set rs = server.CreateObject("adodb.recordset")
	rs.open "Select * from keyicms_Case Where " & Flag & datawhere, Conn, 1, 2
	rs.pagesize = lNum
	newTotalPage = rs.pagecount
	rs.close : set rs = nothing
	If newTotalPage = 0 then newTotalPage = newTotalPage + 1
	
	Page = "" : Call html_To_CaseSort(ID, "Index." & HTMLName, Ke01)
	For n = 1 To newTotalPage
		Page = n : Call html_To_CaseSort(ID, "Index" & Separated & n & "." & HTMLName, Ke01)
	Next
End Sub

Sub newDownload(ID)
	If ID <> "" Then
		SortPath = Conn.execute("Select * from keyicms_DownSort where ID=" & ID)("SortPath")
		datawhere =  " and instr(SortPath, '" & SortPath & "')>0"
	End If
	
	set rs = server.CreateObject("adodb.recordset")
	rs.open "Select * from keyicms_Download Where " & Flag & datawhere, Conn, 1, 2
	rs.pagesize = lNum
	newTotalPage = rs.pagecount
	rs.close : set rs = nothing
	If newTotalPage = 0 then newTotalPage = newTotalPage + 1
	
	Page = "" : Call html_To_DownSort(ID, "Index." & HTMLName, Ke01)
	For n = 1 To newTotalPage
		Page = n : Call html_To_DownSort(ID, "Index" & Separated & n & "." & HTMLName, Ke01)
	Next
End Sub

Sub newNews(ID)
	If ID <> "" Then
		SortPath = Conn.execute("Select * from keyicms_NewsSort where ID=" & ID)("SortPath")
		datawhere = " and instr(SortPath, '" & SortPath & "')>0"
	Else
		datawhere = ""
	End If
	set rs = server.CreateObject("adodb.recordset")
	rs.open "Select * from keyicms_News Where " & Flag & datawhere, Conn, 1, 2
	rs.pagesize = lNum
	newTotalPage = rs.pagecount
	rs.close : set rs = nothing
	If newTotalPage = 0 then newTotalPage = newTotalPage + 1
	
	Page = "" : Call html_To_NewsSort(ID, "Index." & HTMLName, Ke01)
	For n = 1 To newTotalPage
		Page = n : Call html_To_NewsSort(ID, "Index" & Separated & n & "." & HTMLName, Ke01)
	Next
End Sub

Sub newProduct(ID)
	If ID <> "" Then
		SortPath = Conn.execute("Select * from keyicms_ProductSort where ID=" & ID)("SortPath")
		datawhere = " and instr(SortPath, '" & SortPath & "')>0"
	End If

	set rs = server.CreateObject("adodb.recordset")
	rs.open "Select * from keyicms_Product Where " & Flag & datawhere, Conn, 1, 2
	rs.pagesize = lNum
	newTotalPage = rs.pagecount
	rs.close : set rs = nothing
	If newTotalPage = 0 then newTotalPage = newTotalPage + 1
	
	Page = "" : Call html_To_ProductSort(ID, "Index." & HTMLName, Ke01)
	For n = 1 To newTotalPage
		Page = n : Call html_To_ProductSort(ID, "Index" & Separated & n & "." & HTMLName, Ke01)
	Next
End Sub

%>