<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<TITLE>网站生成管理</TITLE>
<link href="skins/css/jaja_main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
h1{font-size:14px; color:#FF0000;}
td{text-align:left}
form{padding:0;margin:0}
</style>
</head>
<body> 
<!--#include file="../Include/QvodCms.Lable.asp"-->
<%
Dim PlayJD,PlaySv,PlaySvs,name_id,action,BeginDate,EndDate
PlayJD=Request.QueryString("PlayJD")
PlaySv=Request.QueryString("PlaySv")
PlaySvs=Request.QueryString("PlaySvs")
BeginDate=Request("BeginDate")
EndDate=Request("EndDate")
Action=Trim(Request.QueryString("action"))
List_Id=QvodCms_CLng(Request("ClassId"))
CurrentPage=QvodCms_CLng(Request.QueryString("Page")) : If CurrentPage<1 Then CurrentPage=1
Call CheckHtml
   If action="class" then
		 Sql="select data_name,name_id,class_id,data_lastdate,data_py,data_playurl,data_playpath from qvodcms_name where class_id="&List_Id&" order by data_lastdate desc"
   Elseif action="othertime" Then
      If Config(1)="SQL" Then
	     Sql="select data_name,name_id,class_id,data_lastdate,data_py,data_playurl,data_playpath from qvodcms_name where data_lastdate>='"&BeginDate&"' and data_lastdate<='"&EndDate&"' order by data_lastdate desc"
	  Else
		Sql="select data_name,name_id,class_id,data_lastdate,data_py,data_playurl,data_playpath from qvodcms_name where data_lastdate between #"&BeginDate&"# and #"&EndDate&"# order by data_lastdate desc"
	  End If  
   Elseif action="otherid" Then
        BeginID=QvodCms_CLng(Request("BeginID"))
		EndID=QvodCms_CLng(Request("EndID"))
		Sql="select data_name,name_id,class_id,data_lastdate,data_py,data_playurl,data_playpath from qvodcms_name where name_id between "&BeginID&" and "&EndID&" order by name_id desc"		   
   Else
        If Config(1)="SQL" Then
        Sql="select data_name,name_id,class_id,data_lastdate,data_py,data_playurl,data_playpath from qvodcms_name where datediff(d,data_lastdate,getdate())=0 order by data_lastdate desc"	
		Else
		Sql="select data_name,name_id,class_id,data_lastdate,data_py,data_playurl,data_playpath from qvodcms_name where datediff('d',data_lastdate,now())=0 order by data_lastdate desc"	
		End If
   End If	
   pagestr="?ClassId="&List_Id&"&action="&Action&"&BeginID="&BeginID&"&EndID="&EndID&"&BeginDate="&BeginDate&"&EndDate="&EndDate&""
   Call OpenConn()
	Set rh = Server.CreateObject("adodb.recordset")
    rh.Open sql, Conn, 1, 1
    If Not(rh.bof And rh.eof) Then
        datai=0
		rh.pagesize=1'每页数据
		If CurrentPage>rh.PageCount Then CurrentPage=rh.PageCount
		rh.AbsolutePage=CurrentPage
		Response.Write("总共需要生成 <font color='red'><b>"&rh.recordcount&"</b></font> 部电影播放页，正在生成 <font color='red'><b>"&rh("data_name")&"</b></font> 的播放页，当前正在生成 <font color='red'><b>"&CurrentPage&"</b></font>部<br>")
		Do while not rh.eof and datai<rh.pagesize	
		List_Id=rh("class_id"):name_id=rh("name_id"):data_py=rh("data_py")
		  List_Id=rh("class_id"):Data_Id=rh("name_id"):data_py=rh("data_py")
		  data_playpath=rh("data_playpath"):data_playurl=rh("data_playurl")
		  Response.Write PlaymakeShow(data_playpath,data_playurl,Data_Id,data_py,List_Id)
		datai=datai+1:rh.movenext 
		Loop 
		Call AllPageGo(CurrentPage,rh.PageCount,pagestr,"allok")
		rh.close:Set rh=nothing:Call ClearObj
	Else
	    DivWrite "暂无数据不需要生成"
	End If

Sub AllPageGo(Pagei,Pages,PageUrl,PageNextType)
	If Pagei>=Pages Then
	    If PageNextType="alldataok" Then
	        Response.Write("<script language='javascript'>self.location='?action=allclass&allclassday=cmsday&PageType=alldataok';</script>")
		Else
		    Response.Write("<p style='font-size:14px;font-weight:bold;color:#009900'>恭喜您!!所有操作已经执行完成！</p>")
		End If
	Else
	    Response.Write("<br>暂停"&AdminId(21)&"秒后继续生成 <meta http-equiv='refresh' content="&AdminId(21)&";url='"&PageUrl&"&Page="&Pagei+1&"&PageType="&PageNextType&"&allclassday="&allclassday&"'>")
	End If	
End Sub

Sub CheckHtml
	If Config(17)<>"html" or Config(30)<>"html" Then  DivWrite "<h1 style='margin-top:50px;height:200px;'>网站或播放页运行模式为动态，不允许生成</h1>":response.end
End Sub

Sub DivWrite(str)
	response.write(str)
	response.Flush()
End Sub

Sub ClearObj
	Set CacheObj = Nothing
	Set LableObj = Nothing
End Sub

Call CloseConn()
%>
<div style="text-align:center; margin-top:5px; color: #FF0000">页面执行时间：<%=GetRunTime()%>秒</div>
</body>
</html>