<!--#include file="tgzcm_Conn.asp"-->
<!--#include file="tgzcm_Check.asp"-->
<!--#include file="../tgzcm.Include/tgzcm.Lable.All.asp"-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<TITLE>网站生成管理</TITLE>
<style type="text/css">
<!--
body {background-color:#E4EDF9; line-height:20px; font-size:12px; color:#135294; padding:2px;}
-->
</style>
</head>
<body>
<%
Dim Action,CreatePage,NewID,BeginID,EndID,BeginDate,EndDate,ClassID,Pageurl,DataPath
Action=Trim(Request.QueryString("action"))
CreatePage=Clng(request.QueryString ("CreatePage"))
NewID=Clng(Request("TopNew"))
BeginID=Clng(Request("BeginID"))
EndID=Clng(Request("EndID"))
BeginDate=Request("BeginDate")
EndDate=Request("EndDate")
ClassID=clng(Request("ClassID"))
Pageurl="tgzcm_CreateData.asp?Action="&Action&"&TopNew="&NewID&"&BeginID="&BeginID&"&EndID="&EndID&"&BeginDate="&BeginDate&"&EndDate="&EndDate&"&ClassID="&ClassID&""
If CreatePage<=0 Or CreatePage="" Then CreatePage=1'初始化分页参数
tgzcmPath = left(tgzcmpath,instrrev(tgzcmpath, "/")-1)'获取安装目录
tgzcmPath = left(tgzcmpath,instrrev(tgzcmpath, "/"))'获取安装目录
'
If Action="all" Then
    Sql="select name_id,class_id from tgzcm_name order by name_id desc"	
ElseIf Action="id" Then
	Sql="select name_id,class_id from tgzcm_name where name_id between "&BeginID&" and "&EndID&" order by name_id desc"
ElseIf Action="new" Then
    Sql="select top "&NewID&" name_id,class_id from tgzcm_name order by name_id desc"
ElseIf Action="class" Then
    Sql="select name_id,class_id from tgzcm_name where (class_id="&ClassID&" or class_id in (select class_id from tgzcm_class where class_bigid="&ClassID&")) order by name_id desc" 
ElseIf Action="time" Then
    If tgzcm(4)="SQL" Then
	Sql="select name_id,class_id,data_lastdate from tgzcm_name where data_lastdate>='"&BeginDate&"' and data_lastdate<='"&EndDate&"' order by name_id desc"
	Else
    Sql="select name_id,class_id,data_lastdate from tgzcm_name where data_lastdate between #"&BeginDate&"# and #"&EndDate&"# order by name_id desc"
	End If 
End If
Set Crs = Server.CreateObject("adodb.recordset")
'sql = "select name_id from tgzcm_name order by name_id desc"
Crs.Open sql, Conn, 1, 1
If Not (Crs.bof And Crs.eof) Then
	Createi=0
	Crs.pagesize=tgzcmId(10)     '每页数据
	Crs.AbsolutePage=CreatePage
	Createm=Crs.recordcount     '总记录
	Createn=Crs.PageCount       '总页数
	Createz=Crs.pagesize        '每页数量
	Response.Write("总共需要生成 <font color='red'><b>"&Createm&"</b></font> 部电影，每页生成 <font color='red'><b>"&Createz&"</b></font> 部电影，共需要分 <font color='red'><b>"&Createn&"</b></font> 页生成，当前正在生成 <font color='red'><b>"&CreatePage&"</b></font> 页<br>")
	Do while not Crs.eof and Createi<Crs.pagesize
	    name_id=Crs("name_id")
		Call tgzcm_Lable_Head(tgzcm_Lable_Html("../skin/"&tgzcm(12)&"/"&tgzcmId(21)&"tgzcm_Details.html"))
		Call tgzcm_Lable_List(moban)
		Call tgzcm_Lable_Data(moban)
		Call tgzcm_Lable_Product(moban)
		Call tgzcm_Lable_All(moban)
		Call GetLinkPath(Crs("class_id"),Crs("name_id"))'该影片的路径
		If tgzcmPath="/" Then DataPath=".."&DataUrl Else DataPath=Replace(DataUrl,tgzcmPath,"../") End If'转化生成路径的相对目录
		If HtmlId(4)="3" Then DataPath=DataPath&"index."&HtmlId(8)
	    Call MakeHtml(DataPath,moban)
	    Response.Write("<li>成功生成第 <font color='red'><b>"&(CreatePage-1)*Createz+Createi+1&"</b></font> 部电影 生成的ID </b><FONT color='Red'>"&Crs("name_id")&"</FONT> 地址 "&DataPath&"</li><br>")
	    Response.flush
    Createi=Createi+1
    Crs.movenext  
    Loop 
Else
    Response.Write("暂时没有数据无需生成！")	
End If
Crs.Close
Set Crs=nothing
Call CloseConn()
'
If CreatePage>=Createn Then
    Response.Write("<p align='center' style='font-size:14px; color:#FF0000'>已经生成所有页面！</p>")
Else
    Response.Write("<p align='center' style='font-size:14px; color:#FF0000'>"&tgzcmId(11)&"秒后将自动继续生成下一页！</p><meta http-equiv='refresh' content="&tgzcmId(11)&";url='"&Pageurl&"&CreatePage="&CreatePage+1&"'>")
End If
%>
</body>
</html>