<!--#include file="../fy.Function.asp"-->
<!--#include file="../../fy_inc/fy.Code.asp"-->
<% 		With Response
		Dim ACTCode,ModeID
		Set ACTCode =New ACT_Code
		Dim StartRefreshTime,RefreshFlag
		Dim FsoHtmlList,ItemName
		RefreshFlag = Request("RefreshFlag")
		StartRefreshTime = Request("StartRefreshTime")
 		If StartRefreshTime = "" Then StartRefreshTime = Timer()
	Server.ScriptTimeOut=9999999
	Call MakeFolder
	End With
	 Set ACTCode=Nothing:Set fycms=Nothing
		Sub Main()
		Dim ReturnInfo
		    echo ("<html>")
		  echo ("<head>")
		  echo ("<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">")
		  echo ("<title>系统信息</title>")
		  echo ("</head>")
		  echo ("<body>")
		  If RefreshFlag="ID" Then
              echo "<div style=""display:none"">"
				echo "<br><br><br><table style=""display:none"" id=""BarShowArea"" width=""600"" border=""0"" align=""center"" cellspacing=""1"" cellpadding=""1"">"
		 Else
				echo "<br><br><br><table id=""BarShowArea"" width=""400"" border=""0"" align=""center"" cellspacing=""1"" cellpadding=""1"">"
		 End iF
				echo "<tr> "
				echo "<td bgcolor=000000>"
				echo " <table width=""600"" border=""0"" cellspacing=""0"" cellpadding=""1"">"
				echo "<tr> "
				echo "<td bgcolor=ffffff height=25><img src=""../images/bar9.gif"" width=0 height=25 id=img2 name=img2 align=absmiddle></td></tr></table>"
				echo "</td></tr></table>"
				echo "<table width=""550"" border=""0"" align=""center"" cellspacing=""1"" cellpadding=""1""><tr> "
				echo "<td align=center> <span id=txt2 name=txt2 style=""font-size:9pt"">0</span><span id=txt4 style=""font-size:9pt"">%</span></td></tr> "
				echo "<tr><td align=center><span id=txt3 name=txt3 style=""font-size:9pt"">0</span></td></tr>"
				echo "</table>"
		 echo ("   <div id=""fsohtml"">")
		 echo (FsoHtmlList)
		  echo ("   </div>")
		 echo ("</body>")
		 echo ("</html>")
 		End Sub
		Sub MakeFolder()
 		 Dim ClassID, FolderSql, MaxNum, FolderRS, NewsTotalNum, NewsNo	  
		 If NewsNo = "" Then NewsNo = 0
		  Select Case RefreshFlag
		    Case "IDS"
			   ClassID = RSQL(Trim(Request("CID")))
			    ModeID=fycms.act_l(ClassID,10)
			 	Application(fycmsN&"ModeID")=ModeID
 			    FolderSql = "Select * from Class_fy where  ClassID="& ClassID &"  and  actlink <>2  "
 			Case "Folder"
				ClassID = Trim(Request("CID"))
 				FolderSql = "Select * from Class_fy where  ClassID IN (" & ClassID & ")  and  actlink  <>2    Order By OrderID ASC"
		   Case "All"
				FolderSql = "Select * from Class_fy where  actlink <>2  Order By OrderID ASC"
		   Case Else
			FolderSql = ""
		  End Select
   			Call Main
			If FolderSql <> "" Then
 			Set FolderRS = Server.CreateObject("ADODB.RecordSet")
			FolderRS.Open FolderSql, Conn, 1, 1

				If FolderRS.EOF Then
					echo "<script>img2.width=""0"";" & vbCrLf
					echo "txt2.innerHTML=""没有可生成的" & ItemName & "栏目！<br><br><input name='button1' type='button' onclick=javascript:location.href='fy.Make.asp?ModeID=" & ModeID &"'; class='button' value=' 返 回 '>"";" & vbCrLf
					echo "txt3.innerHTML="""";" & vbCrLf
					echo "txt4.innerHTML="""";" & vbCrLf
					echo "document.all.BarShowArea.style.display='none';" & vbCrLf
					echo "</script>" & vbCrLf
					FolderRS.Close:Set FolderRS = Nothing
					.end 
				Else
				   NewsTotalNum = FolderRS.RecordCount
				   For NewsNo=1 to NewsTotalNum
				
					   ModeID=fycms.act_l(FolderRS("ClassID"),10)
				   	   Application(fycmsN&"ModeID")=ModeID
  						If FolderRS("GroupIDClass")<>""  Or   fycms.ACT_L(FolderRS("ClassID"),28)<>1  Then 
							FsoHtmlList="<div align=center><li>栏目名称为<font color=red>"  & FolderRS("ClassName") & "</font>的没有生成</div>"
						Else
							 FsoHtmlList="<div align=center><li>栏目名称为<font color=red>"  & FolderRS("ClassName")& "</font>已生成</div>"
					 	Call ACTCode.CreateArticleList(ModeID,FolderRS)
					
						End If 
				    If RefreshFlag="ID" Then Call TypeJS(NewsNo,NewsTotalNum,fycms.ACT_C(ModeID,5) & "栏目"):die
					Call TypeJS(NewsNo,NewsTotalNum,fycms.ACT_C(ModeID,5) & "栏目")
					FolderRS.MoveNext
					if Not Response.IsClientConnected then Exit FOR
				  Next
				echo "<script>"
				echo "fsohtml.innerHTML='';" & vbCrLf
				echo "img2.width=600;" & vbCrLf
				echo "txt2.innerHTML=""生成" & ItemName & "栏目结束！100"";" & vbCrLf
				echo "txt3.innerHTML=""总共生成了 <font color=red><b>" & NewsTotalNum & "</b></font> 个" & ItemName & "栏目,总费时:<font color=red>" & Left((Timer() - StartRefreshTime), 4) & "</font> 秒<br><br><input name='button1' type='button' onclick=javascript:location='fy.Make.asp?ModeID=" & ModeID &"'; class='button' value=' 返 回 '>"";" & vbCrLf
				echo "img2.title=""(" & NewsNo & ")"";</script>" & vbCrLf
				
				FolderRS.Close:Set FolderRS = Nothing
			End If
		Else
				echo "<script>img2.width=""0"";" & vbCrLf
				echo "txt2.innerHTML=""没有可生成的栏目！<br><br><input name='button1' type='button' onclick=javascript:location='fy.Make.asp?ModeID=" & ModeID & "'; class='button' value=' 返 回 '>"";" & vbCrLf
				echo "txt3.innerHTML="""";" & vbCrLf
				echo "txt4.innerHTML="""";" & vbCrLf
				echo "document.all.BarShowArea.style.display='none';" & vbCrLf
				echo "</script>" & vbCrLf
		End If
 		End Sub

		Sub TypeJS(NowNum,TotalNum,itemname)
		    echo "<script>"
				echo "fsohtml.innerHTML='" & FsoHtmlList & "';" & vbCrLf
				echo "img2.width=" & Fix((NowNum / TotalNum) * 600) & ";" & vbCrLf
				echo "txt2.innerHTML=""生成进度:" & FormatNumber(NowNum / TotalNum * 100, 2, -1) & """;" & vbCrLf
				echo "txt3.innerHTML=""总共需要生成 <font color=red><b>" & TotalNum & "</b></font> 个栏目,<font color=red><b>在此过程中请勿刷新此页面！！！</b></font> 系统正在生成第 <font color=red><b>" & NowNum & "</b></font>个栏目"";" & vbCrLf
				echo "img2.title=""(" & NowNum & ")"";</script>" & vbCrLf
				response.Flush
 		End Sub
 %>
