<!--#include file="../Include/Channel_Article.asp"-->
<!-- #Include File="../Include/Cls_FileSys.asp" -->
<!-- #Include File="../Include/Cls_PageCute.asp" -->
<!-- #Include File="../Include/Cls_Search.asp" -->
<!-- #Include File="../Include/Inc_Review.asp" -->
<!-- #Include File="../Include/Inc_Emoney.asp" -->
<!-- #Include File="Include/AdminCheck.asp" -->
<link type=text/css href='Images/admin.Css' rel=stylesheet>
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V2.0》，简称“AsaiMHV2”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

Server.ScriptTimeout = 99999
ChannelIDs = Cls.ChkNumeric(Request("ChannelIDs"))
If ChannelIDs = 0 Then ChannelIDs = 8
Dim cSQL,cRs
Dim CF, ShowPage,FilePath,p
Set Cf=New Cls_FileSystem
Call Channel_Load(-1)
Dim FoundErr, ErrMsg
Dim flag
Dim TableTop,TableEnd
TableTop = "<p align=center>"
TableEnd = "</p><p align=center><a href='" & LinkedStr("") & "'><b class=style2>恭喜您！生成HTML完成...总费时<font color=""#FF0000"">" & FormatNumber((timer()-Cls.timer_start), 2,-1) & "</font>秒,完成时间" & Now() & " 请返回进行其它操作</b></a></p>"
Response.Write "<table border=0 align=center cellpadding=3 cellspacing=1 class=table>" & vbNewLine
Response.Write "<tr>" & vbNewLine
Response.Write "	<th colspan=2 class=td>" & Cls.ChannelTit & "HTML管理导航</th>" & vbNewLine
Response.Write "</tr>" & vbNewLine
Response.Write "<tr height=30>" & vbNewLine
Response.Write "	<td colspan=2 class=tablerow1><b>选项：</b>" & vbNewLine
Response.Write "	<a href=" & LinkedStr("") & ">管理首页</a> | " & vbNewLine
Response.Write "	<a href=" & LinkedStr("index") & ">生成首页HTML</a> | " & vbNewLine
Response.Write "	<a href=" & LinkedStr("other") & ">生成其它HTML</a> | " & vbNewLine
Response.Write "	<a href=" & LinkedStr("js") & ">更新分类JS</a> | " & vbNewLine
Response.Write "	</td>" & vbNewLine
Response.Write "</tr>" & vbNewLine
Response.Write "</table><br />" & vbNewLine
Flag = "CreateNews" & ChannelIDs
Action = LCase(Request("action"))
If CInt(Cls.ChannelIsCreatHtml) = 0 Then
	Call Cls.Out_Msg("对不起~！此频道不支持生成HTML功能，如果你要使用生成HTML功能，请在此频道管理中打开HTML生成功能。","")
	Response.End
End If
Select Case Trim(Action)
	Case "index"
	p=3
	'response.Write("<div id=""prompt""><ul>")
	Cls.progress_init
	Cls.progress int(1/p*100),"读取频道首页数据,开始频道首页..."
	HtmlContent = ShowChannelIndex(True)
	FilePath =  Cls.Web_Dir & Cls.ChannelDir & "/Index" & Cls.ChannelHtmlExtName
	Cf.Create_File FilePath,HtmlContent
        If Cls.Web_IsCreatIndex=True then
           Cls.progress int(2/p*100),"生成频道首页（HTML）完成,开始生成频道首页..."
	   ChannelIDs = 0
 	   HtmlContent = HTML.ShowIndex(True)
	   FilePath = "../" & Cls.Web_IndexFile
	   Cf.Create_File FilePath,HtmlContent
	   Cls.progress int(p/p*100),"生成网站首页（HTML）完成."
           Response.Write "<b>恭喜您！频道首页、网站首页（HTML）生成完毕,请返回进行其它操作!</b><br />"
        Else
            Cls.progress int(p/p*100),"生成频道首页（HTML）完成,开始生成频道首页..."
            Response.Write "<b>恭喜您！频道首页生成任务已完毕,请返回进行其它操作!</b><br />"
        End If
	Response.Write EndTime()
	Case "other"
	    dim ototalnumber,jj
		Cls.progress_init
	    Cls.progress 0,"生成 图片文章、焦点文章、推荐文章、热门文章 　正在生成 <font class=red>图片</font> 文章... "
		action="pic"
		tit="图片文章"
		ototalnumber = Cls.Exec("SELECT COUNT(ID) FROM [AsaiMHNews] WHERE hidden=1 and ChannelIDs=" & ChannelIDs & " And ispic=1",1)(0)
		if ototalnumber>100 then ototalnumber=100
		if ototalnumber mod Cls.ChannelListNum <> 0 then
		ototalnumber=Fix(ototalnumber/Cls.ChannelListNum)+1
		else
		ototalnumber=Fix(ototalnumber/Cls.ChannelListNum)+1
		end if
		if ototalnumber=0 then ototalnumber=1
		        For jj=1 to ototalnumber
		                 HtmlContent=ShowChannelList(True,0,jj,"pic")
						 Cf.Make_Dir Cls.Web_Dir & Cls.ChannelDir & "/PicNews/" 
						 Cf.Create_File Cls.Web_Dir & Cls.ChannelDir & "/PicNews/" & "Index_"&jj&Cls.ChannelHtmlExtName,HtmlContent
	            Next
	    Cls.progress 25,"生成 图片文章、焦点文章、推荐文章、热门文章 　正在生成 <font class=red>焦点</font> 文章... "
		action="focus"
		tit="焦点文章"
		ototalnumber = Cls.Exec("SELECT COUNT(ID) FROM [AsaiMHNews] WHERE hidden=1 and ChannelIDs=" & ChannelIDs & " And isfocus=1",1)(0)
		if ototalnumber>100 then ototalnumber=100
		if ototalnumber mod Cls.ChannelListNum <> 0 then
		ototalnumber=Fix(ototalnumber/Cls.ChannelListNum)+1
		else
		ototalnumber=Fix(ototalnumber/Cls.ChannelListNum)
		end if
		if ototalnumber=0 then ototalnumber=1
			    For jj=1 to ototalnumber
		                 HtmlContent=ShowChannelList(True,0,jj,"focus")
						 Cf.Make_Dir Cls.Web_Dir & Cls.ChannelDir & "/FocusNews/" 
						 Cf.Create_File Cls.Web_Dir & Cls.ChannelDir & "/FocusNews/"& "Index_"&jj&Cls.ChannelHtmlExtName,HtmlContent
	            Next
	    Cls.progress 50,"生成 图片文章、焦点文章、推荐文章、热门文章 　正在生成 <font class=red>推荐</font> 文章... "
		action="good"
		tit="推荐文章"
		ototalnumber = Cls.Exec("SELECT COUNT(ID) FROM [AsaiMHNews] WHERE hidden=1 and ChannelIDs=" & ChannelIDs & " And isgood=1",1)(0)
		if ototalnumber>100 then ototalnumber=100
		if ototalnumber mod Cls.ChannelListNum <> 0 then
		ototalnumber=Fix(ototalnumber/Cls.ChannelListNum)+1
		else
		ototalnumber=Fix(ototalnumber/Cls.ChannelListNum)
		end if
		if ototalnumber=0 then ototalnumber=1
		        For jj=1 to ototalnumber
		                 HtmlContent=ShowChannelList(True,0,jj,"good")
						 Cf.Make_Dir Cls.Web_Dir & Cls.ChannelDir & "/GoodNews/" 
						 Cf.Create_File Cls.Web_Dir & Cls.ChannelDir & "/GoodNews/"& "Index_"&jj&Cls.ChannelHtmlExtName,HtmlContent
	            Next				
	    Cls.progress 75,"生成 图片文章、焦点文章、推荐文章、热门文章 　正在生成 <font class=red>热门</font> 文章... "
		action="hot"
		tit="热门文章"
		ototalnumber = Cls.Exec("SELECT COUNT(ID) FROM [AsaiMHNews] WHERE hidden=1 and ChannelIDs=" & ChannelIDs & " And counter>20",1)(0)
		if ototalnumber>100 then ototalnumber=100
		if ototalnumber mod Cls.ChannelListNum <> 0 then
		ototalnumber=Fix(ototalnumber/Cls.ChannelListNum)+1
		else
		ototalnumber=Fix(ototalnumber/Cls.ChannelListNum)
		end if
		if ototalnumber=0 then ototalnumber=1
				For jj=1 to ototalnumber
		                 HtmlContent=ShowChannelList(True,0,jj,"hot")
						 Cf.Make_Dir Cls.Web_Dir & Cls.ChannelDir & "/HotNews/" 
						 Cf.Create_File Cls.Web_Dir & Cls.ChannelDir & "/HotNews/"& "Index_"&jj&Cls.ChannelHtmlExtName,HtmlContent
	            Next
	    Cls.progress 100,"图片文章、焦点文章、推荐文章、热门文章 　全部生成完毕! "		
		Response.Write "<b>恭喜您！图片文章、焦点文章、推荐文章、热门文章 生成完毕,请返回进行其它操作!</b><br />"
		Response.Write EndTime()
	Case "list"
		Call Create_News_List
	Case "cont"
		Call Create_News_Content
	Case "renewall"
		Call RenewAll_News
	Case "special"
		Call Create_News_Special
	Case "js"
	    Call Class_Update()
	Case Else
		Call ShowMain
End Select
If FoundErr = True Then
	Response.write ErrMsg
End If
Call Channel_End(-1)
'Call Web_Clear(1)
Sub Class_Update()
  Dim CF,ClassJs
  Set Cf=New Cls_FileSystem
  ClassJs = Cls.GetClassMenu(ChannelIDs)
  Cf.Create_File Cls.Web_Dir&Cls.ChannelDir&"/Menu.js",ClassJs
  Response.write "成功更新ID为("&ChannelIDs&")的网站分类菜单！<br />地址为："&Cls.Web_Dir&Cls.ChannelDir&"/Menu.js"
End Sub
Function EndTime()
         EndTime = "总费时<font color=""#FF0000"">" & FormatNumber((timer()-Cls.timer_start), 2,-1) & "</font>秒,完成时间" & Now()
End Function
Sub ShowMain()
	Response.Write "<table border=0 align=center cellpadding=3 cellspacing=1 class=table>" & vbNewLine
	Response.Write "<tr>" & vbNewLine
	Response.Write "	<th colspan=2 class=td>批量生成" & Cls.ChannelTit & "HTML页管理</th>" & vbNewLine
	Response.Write "</tr>" & vbNewLine
	Response.Write "<tr>" & vbNewLine
	Response.Write "	<td colspan=2 class=tr1>①、<font color=blue>生成" & Cls.ChannelTit & "分类列表HTML页</font></td>" & vbNewLine
	Response.Write "</tr>" & vbNewLine
	Response.Write "<form name=Createform1 method=post action=?action=list>" & vbNewLine
	Response.Write "<input type=hidden name=ChannelIDs value='" & ChannelIDs & "'>" & vbNewLine
	Response.Write "<tr>" & vbNewLine
	Response.Write " 	<td align=right width='25%' class=tablerow1>生成HTML选项：</td>" & vbNewLine
	Response.Write "   	<td width='75%' class=tablerow1><input type=radio name=Field value='0' onClick=""getclassid.style.display='none'""> 生成全部&nbsp;&nbsp;" & vbNewLine
	Response.Write "	<input type=radio name=Field value='1' onClick=""getclassid.style.display='none'""  checked> 生成已更新&nbsp;&nbsp;" & vbNewLine
	Response.Write "	<input type=radio name=Field value='2' onClick=""getclassid.style.display=''""> 按分类ID生成（请在下面输入分类ID）</td>" & vbNewLine
	Response.Write "</tr>" & vbNewLine
	Response.Write "<tr id=getclassid style=""display:'none';"">"
	Response.Write "	<td align=right class=tablerow1>" & Cls.ChannelTit & "分类ID：</td>" & vbNewLine
	Response.Write "	<td class=tablerow1><input type=text name='classid' size=45 value=''> <b>说明：</b>多个ID请用“,”分开</td>" & vbNewLine
	Response.Write "</tr>" & vbNewLine
	Response.Write "<tr>" & vbNewLine
	Response.Write "	<td align=right class=tablerow1>点击这里开始生成HTML→</td>" & vbNewLine
	Response.Write "	<td class=tablerow1><input class=btn type=submit value=' 开始生成HTML '></td>" & vbNewLine
	Response.Write "</tr>" & vbNewLine
	Response.Write "</form>" & vbNewLine
	Response.Write "<tr>" & vbNewLine
	Response.Write "	<td colspan=2 class=tr1>②、<font color=blue>生成" & Cls.ChannelTit & "内容HTML页</font></td>" & vbNewLine
	Response.Write "</tr>" & vbNewLine
	Response.Write "</tr>" & vbNewLine
	Response.Write " <tr><form name=""Createform2"" method=""post"" action=""?action=cont&type=date"">" & vbNewLine
	Response.Write "<input type=hidden name=ChannelIDs value='" & ChannelIDs & "'>" & vbNewLine
	Response.Write " <td class=tablerow1>按日期生成内容HTML页</td>" & vbNewLine
	Response.Write " <td class=tablerow1>" & vbNewLine
	Response.Write " <select size=""1"" name=""datYear"">" 
	For i = 2001 To Year(Date)
		Response.Write "<option value=""" & i & """"
		If i = Year(Date) Then
			Response.Write " selected"
		End If
		Response.Write ">" & i & "</option>"
	Next
	Response.Write " </select> - "
	Response.Write " <select size=""1"" name=""datMonth"">" 
	For i = 1 To 12
		Response.Write "<option value=""" & i & """"
		If i = Month(Date) Then
			Response.Write " selected"
		End If
		Response.Write ">" & i & "</option>" 
	Next
	Response.Write " </select> - "
	Response.Write " <select size=""1"" name=""datDay"">"
	For i = 1 To 31
		Response.Write "<option value=""" & i & """"
		If i = Day(Date) Then
			Response.Write " selected"
		End If
		Response.Write ">" & i & "</option>"
	Next
	Response.Write " </select>　" & vbNewLine
	Response.Write "<input type=""submit"" class=btn name=""Submit"" value=""生成HTML页""></td>" & vbNewLine
	Response.Write " </tr></form>" & vbNewLine
	Response.Write " <tr><form name=Createform3 method=""post"" action=""?action=cont&type=new"">" & vbNewLine
	Response.Write "<input type=hidden name=ChannelIDs value='" & ChannelIDs & "'>" & vbNewLine
	Response.Write " <td class=tablerow1 height=""22"">按个数生成内容HTML页</td>" & vbNewLine
	Response.Write " <td class=tablerow1><input size=10 name=""newnum"" value=""1"">　<input type=""submit"" name=""Submit"" class=btn value=""生成HTML页""> <b>说明：</b>将按最近更新的顺序生成</td>" & vbNewLine
	Response.Write " </tr></form>" & vbNewLine
	Response.Write " <tr><form name=Createform4 method=""post"" action=""?action=cont&type=seid"">" & vbNewLine
	Response.Write "<input type=hidden name=ChannelIDs value='" & ChannelIDs & "'>" & vbNewLine
	Response.Write " <td class=tablerow1 height=""22"">按ID生成内容HTML页</td>" & vbNewLine
	Response.Write " <td class=tablerow1><input size=45 name=""id"" value=""1""> 　<input type=""submit"" name=""Submit"" class=btn value=""生成HTML页""> <b>说明：</b>多个ID用“,”分开</td>" & vbNewLine
	Response.Write " </tr></form>" & vbNewLine
	Response.Write " <tr><form name=""Createform5"" method=""post"" action=""?action=cont"">" & vbNewLine
	Response.Write "<input type=hidden name=ChannelIDs value='" & ChannelIDs & "'>" & vbNewLine
	Response.Write " <td class=tablerow1 height=""22"">生成全部内容HTML页</td>" & vbNewLine
	Response.Write "　<td class=tablerow1> <input type=radio name=type value=""all""> 生成全部" & vbNewLine
	Response.Write "　<input type=radio name=type value=""renew""  checked> 生成已更新" & vbNewLine
    Response.Write "  <input type=""submit"" class=btn name=""Submit"" value=""生成HTML页""> " & vbNewLine
	Response.Write "</td></form>" & vbNewLine
	Response.Write " </tr>" & vbNewLine
	Response.Write "<tr>" & vbNewLine
	Response.Write "	<td colspan=2 class=tr1>③、<font color=blue>按分类生成" & Cls.ChannelTit & "相关HTML页</font></td>" & vbNewLine
	Response.Write "</tr>" & vbNewLine
	Response.Write "<form name=Createform8 method=post action=AMH_CreateNews.Asp>" & vbNewLine
	Response.Write "<input type=hidden name=action value='list'>" & vbNewLine
	Response.Write "<input type=hidden name=ChannelIDs value='" & ChannelIDs & "'>" & vbNewLine
	Response.Write "<input type=hidden name=field value='2'>" & vbNewLine
	Response.Write "<tr>" & vbNewLine
	Response.Write " <td class=tablerow1>" & vbNewLine
	Response.Write "<select name='classid' size='2' multiple style='height:260px;width:200px;'>" & vbNewLine
	Dim sql3,rs3,n_id,chi,sTmp
		sql3="Select C_ID,ClassName,ClassParent,ClassParentStr,ClassDepth,ClassChild,ClassID from AsaiMHClass Where ChannelIDs="&ChannelIDs&"  Order By ClassID,ClassOrder,ClassDepth"
	Set Rs3=Cls.Exec(sql3,1)
	Do While Not Rs3.Eof
		n_id=Rs3(3)
		If Int(Rs3(2))=0 Then
			sTmp=sTmp&"<option value='"&n_id&"' class=bg_2"
			sTmp=sTmp&">"&rs3(1)&"</option>" & vbNewLine
		Else
			sTmp=sTmp&"<option value='"&n_id&"'"
			sTmp=sTmp&">"
			For chi=1 To Int(rs3(4))-1
				sTmp=sTmp&"│"
			Next
			sTmp=sTmp&"├"&rs3(1)&"</option>" & vbNewLine
		End If
		Rs3.Movenext
	Loop
	Rs3.Close:Set Rs3=Nothing
	Response.Write stmp
	Response.Write "</select>" & vbNewLine
	Response.Write "</td>" & vbNewLine
	Response.Write " <td class=tablerow1 valign=top>" & vbNewLine
	Response.Write "<input class=btn type=submit name=Submit2 value=' 生成分类列表的HTML'><br /><br />" & vbNewLine
	Response.Write "<input class=btn type=submit name=Submit3 value=' 生成新间内容的HTML' onclick=""document.Createform8.action.value='cont';""><br /><br />"
	Response.Write "请按 CTRL 键多选" & vbNewLine
	Response.Write "</td></form>" & vbNewLine
	Response.Write " </tr>" & vbNewLine
	Response.Write "</table>" & vbNewLine
End Sub
Function LinkedStr(str)
	LinkedStr = "AMH_CreateNews.Asp?action=" & str & "&amp;ChannelIDs="& ChannelIDs
End Function
Sub Create_News_List()
	Dim totalnumber,ctotalnumber,HtmlContent,p,jj,kk
	If CInt(Request("field")) = 1 Then
		cSQL =" And isUpdate=1"
	ElseIf CInt(Request("field")) = 2 Then
		If Trim(Request("classid")) = "" Then
			ErrMsg = "<li>请选择分类~！</li>"
			FoundErr = True 
			Exit Sub
		End If
		cSQL = " And C_ID in (" & Trim(Request("classid")) & ")"
	Else
		cSQL = ""
	End If
	totalnumber = Cls.Exec("SELECT COUNT(C_ID) FROM [AsaiMHClass] WHERE ChannelIDs=" & ChannelIDs & cSQL,1)(0)
	Set cRs = Cls.Exec("SELECT C_ID,ClassChild,HtmlFileDir FROM [AsaiMHClass] WHERE ChannelIDs=" & ChannelIDs & cSQL & " ORDER BY  C_id ASC",1)
	If cRs.BOF And cRs.EOF Then
		Response.Write "<meta http-equiv=""refresh"" content=""1;url='AMH_CreateNews.Asp?ChannelIDs=" & ChannelIDs & "&stype=1&D=" & Cls.timer_start & "'"">"
		Set cRs = Nothing
		Exit Sub
	End If
	    p=totalnumber+1
		Cls.progress_init
	    Cls.progress int(0*100),"正在读取数据,开始生成HTML..."
		Call Class_Load()
	cSQL=cRs.GetRows()
	For kk=0 To Ubound(cSQL,2)
		HtmlContent=""
	    If Cint(cSQL(1,kk))<>0 then
		        HtmlContent=ShowChannelLists(True,cSQL(0,kk))
				Cf.CreateHtmlFile Cls.Web_Dir & Cls.ChannelDir, cSQL(2,kk), "Index_1"&Cls.ChannelHtmlExtName,HtmlContent
		        Cls.progress int((kk+1)/p*100),"共有分类  <B><font color=RED>" & totalnumber & "</font></B> 个 　正在生成第 " & kk & " 个 "
	    Else
		        ctotalnumber = Cls.Exec("SELECT COUNT(ID) FROM [AsaiMHNews] WHERE hidden=1 and ChannelIDs=" & ChannelIDs & " And ClassID="&cSQL(0,kk),1)(0)
		        if ctotalnumber mod Cls.ChannelListNum <> 0 then
				   ctotalnumber=Fix(ctotalnumber/Cls.ChannelListNum)+1
				else
				   ctotalnumber=Fix(ctotalnumber/Cls.ChannelListNum)
				end if
				if ctotalnumber=0 then ctotalnumber=1
		        For jj=1 to ctotalnumber
		                 HtmlContent=ShowChannelList(True,cSQL(0,kk),jj,"list")
						 Cf.CreateHtmlFile Cls.Web_Dir & Cls.ChannelDir, cSQL(2,kk), "Index_"&jj&Cls.ChannelHtmlExtName,HtmlContent
		                 Cls.progress int((kk+1)/p*100),"共有分类  <B><font color=RED>" & totalnumber & "</font></B> 个 　正在生成第 " & kk & " 个,(第 " & jj & " 页) "
	            Next
		End If
           Call Cls.Exec("UPDATE AsaiMHClass SET isUpdate=0 WHERE C_ID="& CLng(cSQL(0,kk)),0)
	Next
	Cls.progress int(p/p*100),"共有分类 <B><font color=RED>" & totalnumber & "</font></B> 个 　全部生成完毕! "
	Response.Write "<b>恭喜您！HTML页面生成完毕,请返回进行其它操作!</b><br />"
	Response.Write EndTime()
	cRs.Close:Set cRs = Nothing
End Sub
Sub Create_News_Content()
	Dim strDate,d,strLink,j,newnumber
	Dim CurrentPage,page_count,totalnumber,Pcount,maxperpage
	If Trim(Request("type")) = "date" Then
		strDate = Request("datYear") & "-" & Request("datMonth") & "-" & Request("datDay")
		strLink = "type=date&datYear=" & Request("datYear") & "&datMonth=" & Request("datMonth") & "&datDay=" & Request("datDay")
		If SqlType = 1 Then
			cSQL = "WHERE ChannelIDs=" & ChannelIDs & " And hidden=1 And Datediff(d,Tim,getdate())=" & DateDiff("d", strDate, Now()) & ""
		Else
			cSQL = "WHERE ChannelIDs=" & ChannelIDs & " And hidden=1 And Tim like '%" & strDate & "%'"
		End If
	End If
	If Trim(Request("type")) = "new" Then
	    newnumber = CLng(Request("newnum"))
		If newnumber > 0 Then
			cSQL = "WHERE ChannelIDs=" & ChannelIDs & " And hidden=1 "
		Else
			Response.Write "<meta http-equiv=""refresh"" content=""0;url='" & Request.ServerVariables("HTTP_REFERER") & "'"">"
		End If
	End If
	If Trim(Request("type")) = "all" Then
		strLink = "type=all"
		cSQL = "WHERE ChannelIDs=" & ChannelIDs & " And hidden=1"
	End If
	If Trim(Request("type")) = "renew" Then
		strLink = "type=renew"
		cSQL = "WHERE ChannelIDs=" & ChannelIDs & " And hidden=1 And isUpdate=1"
	End If
	If Trim(Request("type")) = "seid" Then
		strLink = "type=seid&id=" & Request("id")
		cSQL = "WHERE ChannelIDs=" & ChannelIDs & " And hidden=1 And ID in (" & Request("id") & ")"
	End If
	If CInt(Request("field")) = 2 Then
		If Trim(Request("classid")) = "" Then
			ErrMsg = "<li>请选择分类~！</li>"
			FoundErr = True 
			Exit Sub
		End If
		strLink = "field=2&classid=" & Request("classid")
		cSQL = "WHERE ChannelIDs=" & ChannelIDs & " And hidden=1 And ClassID in (" & Request("classid") & ")"
	End If
	totalnumber = Cls.Exec("SELECT COUNT(ID) FROM [AsaiMHNews] "& cSQL &"",1)(0)
	If Trim(Request("type")) = "new" Then
	     if totalnumber>newnumber then totalnumber=newnumber
		cSQL = "SELECT TOP " & newnumber & " ID FROM AsaiMHNews "& cSQL &" ORDER BY ID DESC"
	Else
		cSQL = "SELECT ID FROM AsaiMHNews "& cSQL &" ORDER BY ID DESC"
	End If
	Set cRs = Cls.Exec(cSQL,1)
	If Not (cRs.EOF And cRs.BOF) Then
		cRs.MoveFirst
		cSQL=cRs.GetRows()
		Set cRs = Nothing
		p=totalnumber+1
		Cls.progress_init
	    Cls.progress int(0*100),"正在读取数据,开始生成HTML..."
		For j=0 To Ubound(cSQL,2)
			Call ShowChannelView(CLng(cSQL(0,j)),True)
			Cls.progress int((j+1)/p*100),"共有新间 <B><font color=RED>" & totalnumber & "</font></B> 篇 　正在生成第 " & j & " 篇 "
			Call Cls.Exec ("UPDATE AsaiMHNews SET isUpdate=0 WHERE ID="& CLng(cSQL(0,j)),0)
		Next
		Cls.progress int(p/p*100),"共有新间 <B><font color=RED>" & totalnumber & "</font></B> 篇 　全部生成完毕! "
		Response.Write "<b>恭喜您！HTML页面生成完毕,请返回进行其它操作!</b><br />"
		Response.Write EndTime()
		cSQL=Null
	Else
		Cls.progress_init
		Cls.progress 100,"生成完毕，共生成 <B><font color=RED>0</font></B> 篇"
		Exit Sub
	End If
	If IsObject(cRs) Then Set cRs = Nothing
End Sub

Sub RenewAll_News()
	Call Cls.Exec ("UPDATE AsaiMHNews SET isUpdate=1 WHERE ChannelIDs=" & ChannelIDs,0)
	Response.Redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub
Sub Create_News_Special()
	Set cRs = Cls.Exec("SELECT SpecialID FROM [NC_Special] WHERE ChannelIDs="& ChannelIDs &"  And ChangeLink=0",1)
	If cRs.BOF And cRs.EOF Then
		ErrMsg = "对不起！没有找到相应的专题。"
		FoundErr = True
		Set cRs = Nothing
		Exit Sub
	End If
	cSQL=cRs.GetRows(-1)
	NewCloud.ShowFlush = 1
	Response.Write "<ol>"
	For i=0 To Ubound(cSQL,2)
		If Not Response.IsClientConnected Then ResponseEnd
		NewCloud.CreateNewsSpecial cSQL(0,i),1
		Response.Flush
	Next
	Set cRs = Nothing
	Response.Write "</ol><p align=center><a href='" & LinkedStr("") & "'><b class=style2>恭喜您！生成HTML完成...总费时<font color=""#FF0000"">" & FormatNumber((Timer() - Cls.timer_start), 2,-1) & "</font>秒,完成时间" & Now() & " 请返回进行其它操作</b></a></p>"
End Sub
%>
