<!--#include file="connvod.asp" -->
<%
Response.Buffer = true
Server.ScriptTimeOut=9999999
dim action : action = be("get","action")
headAdminCollect "视频采集入库管理"

select case action
	case "edit" : edit
	case "editsave" : editsave
	case "del" : del
	case "delpl" : delpl
	case "delall" : delAll
	case "delurl" : delurl
	case "IDInflow" : IDInflow
	case "AllInflow" : AllInflow
	case "noInflow" : noInflow
	case "editype" : editype
	case else : main
end select

sub editype
	dim m_typeid : m_typeid = be("post","m_typeid")
	if isN(m_typeid) then alert "请选择分类！"
	dim ids : ids = replace(be("post","m_id")," ","")
	cjdb.DB "update tbl_vod set m_typeid="&m_typeid&" where m_id in (" &ids&")","exe"
	redirect getReferer()
end sub

sub IDInflow
	dim ids,count,sql
	ids=replace(be("post","m_id")," ","")
	if not isN(ids) then
		count = cjdb.DB ("Select count(m_id) from tbl_vod where m_id in ("&ids&") and m_typeid>0","exe")(0)
		sql="select * from tbl_vod where m_id in ("&ids&") and m_typeid>0"
		Call MovieInflow(sql,count)
	else
		alert "请选择入库数据"
	end if
end sub

sub AllInflow()
	dim count,sql
    count=cjdb.DB ("Select count(m_id) from tbl_vod where m_typeid>0","exe")(0)
	sql="select * from tbl_vod where m_typeid>0"
	Call MovieInflow(sql,count)
end sub

sub noInflow()
	dim count,sql
    count=cjdb.DB ("Select count(m_id) from tbl_vod where m_zt=0 and m_typeid>0","exe")(0)
	sql="select * from tbl_vod where m_zt=0 and m_typeid>0"
	Call MovieInflow(sql,count)
end sub

sub del
	cjdb.DB "delete from tbl_vod_url WHERE u_movieid = "&be("all","m_id"),"exe"
	cjdb.DB "delete from tbl_vod WHERE m_id ="&be("all","m_id"),"exe"
	redirect getReferer()
end sub

sub delpl
 dim ids : ids=replace(be("post","m_id")," ","")
 if not isN(ids) then
	 cjdb.DB "delete from tbl_vod_url WHERE u_movieid in( "&be("all","m_id") &")","exe"
	 cjdb.DB "delete from tbl_vod WHERE m_id in("&be("all","m_id") &")","exe"
	 redirect getReferer()
 else
 	alert "请选择相应数据！"
 end if
end sub

sub delall
	cjdb.DB "delete from tbl_vod_url","exe"
	cjdb.DB "delete from tbl_vod","exe"
	redirect getReferer()
end sub

sub delurl
	cjdb.DB "delete from tbl_vod_url WHERE u_id="&be("all","u_id"),"exe"
	redirect getReferer()
end sub

sub editsave
	dim m_id,m_name,m_typeid,m_playfrom,m_starring,m_pic,m_content,m_year,m_zt,m_playserver,m_hits,m_state,m_remarks,m_type,m_area,m_language,m_directed
	dim rs,sql,i
	
	m_id = be("post","m_id") : m_name = be("post","m_name")
	m_typeid = be("post","m_typeid") : m_area = be("post","m_area")
	m_playfrom = be("post","m_playfrom") : m_starring = be("post","m_starring")
	m_pic = be("post","m_pic") : m_content = be("post","m_content")
	m_zt = be("post","m_zt") 
	m_year = be("post","m_year") : m_playserver = be("post","m_playserver")
	m_hits = be("post","m_hits") : m_state = be("post","m_state")
	m_remarks = be("post","m_remarks")
	m_directed = be("post","m_directed")
	
	dim backurl : backurl = be("post","backurl")
	if isN(backurl) then backurl = "collect_vod.asp"
	if not isNum(m_typeid) then alert "影片分类不能为空!"
	if not isNum(m_hits) then m_hits = 0
	if not isNum(m_playserver) then m_playserver=0
	if not isNum(m_zt) then m_zt=0
	if not isNum(m_state) then m_state = 0
	
	sql="select * from tbl_vod where m_id="& m_id
	set rs= cjdb.DB(sql,"rs3")
	rs("m_name")=m_name
	rs("m_type") =m_type
	rs("m_typeid")=m_typeid
	rs("m_area")=m_area
	rs("m_language")=m_language
	rs("m_playfrom")=m_playfrom
	rs("m_starring")=m_starring
	rs("m_directed")=m_directed
	rs("m_pic")=m_pic
	rs("m_content")=m_content
	rs("m_year")=m_year
	rs("m_zt")=m_zt
	rs("m_playserver")=m_playserver
	rs("m_hits")=m_hits
	rs("m_state") = m_state
	rs("m_remarks") = m_remarks
	rs("m_addtime") = now
	rs.Update
	cjdb.c(rs)
		
	sql="select * from tbl_vod_url where u_movieid="& m_id
	set rs=cjdb.db(sql,"rs3")
	do while not rs.eof
		i=i+1
		rs("u_url") = be("post","url"&i)
		rs.update
		rs.movenext
	loop
	cjdb.c(rs)
	
	showmsg "修改影片成功!",backurl
end sub

sub edit
	dim m_id,m_name,m_type,m_typeid,m_area,m_playfrom,m_starring,m_directed,m_pic,m_content,m_year,m_addtime,m_urltest,m_zt,m_playserver,m_hits,m_state,m_language,m_remarks
	dim rs,sql
	m_id = be("get","m_id")
	sql="select * from tbl_vod where m_id="& m_id
	set rs = cjdb.db(sql,"rs1")
	m_name=rs("m_name")  
	m_type=rs("m_type")
	m_typeid=rs("m_typeid")
	m_area=rs("m_area")
	m_language=rs("m_language")
	m_playfrom=rs("m_playfrom")
	m_starring=rs("m_starring")
	m_directed=rs("m_directed")
	m_pic=rs("m_pic")
	m_content=rs("m_content")
	m_year=rs("m_year")
	m_urltest=rs("m_urltest")
	m_zt=rs("m_zt")
	m_playserver = rs("m_playserver")
	m_hits = rs("m_hits")
	m_state = rs("m_state")
	m_remarks = rs("m_remarks")
	cjdb.c(rs)
	dim backurl : backurl = request.ServerVariables("HTTP_REFERER")
%>
<script>
$(document).ready(function(){
	$("#form1").validate({
		rules:{
			m_name:{
				required:true,
				maxlength:255
			},
			m_typeid:{
				required:true
			},
			m_playfrom:{
				required:true
			},
			m_state:{
				number:true
			},
			m_remarks:{
				maxlength:255
			},
			m_starring:{
				maxlength:255
			},
			m_directed:{
				maxlength:255
			},
			m_year:{
				maxlength:32
			},
			m_hits:{
				number:true
			},
			m_area:{
				maxlength:32
			},
			m_language:{
				maxlength:32
			},
			m_typeid:{
				required:true
			}
		}
	});
});
</script>
<form id="form1" name="form1" action="?action=editsave" method="post">
<input type="hidden" id="m_id" name="m_id" value="<%=m_id%>">
<input id="backurl" name="backurl" type="hidden" value="<%=backurl%>">
<table class=tb>
	<tr>
		<td width="70" >名称：</td>
		<td><input id="m_name" name="m_name" type="text" value="<%=m_name%>" size="40">
		&nbsp;分类：<select name="m_typeid" id="m_typeid"  >
        <option value="">请选择数据分类</option>
            <%=makeSelectAll("{pre}vod_type","t_id","t_name","t_pid","t_sort",0,"","&nbsp;|&nbsp;&nbsp;",m_typeid)%>
        </select>
        &nbsp;播放类型：<select name="m_playfrom">
		<option value=''>暂没有数据</option>
		<%=makeSelectPlayer(m_playfrom)%>
		</select> 
		&nbsp;服务器组：
		<select name="m_playserver">
		<option value=''>暂没有数据</option>
		<%=makeSelectServer(m_playserver)%>
		</select>
		</td>
    </tr>
    <tr>
		<td>连载：</td>
		<td><input id="m_state" name="m_state" type="text" value="<%=m_state%>" size="50">
		&nbsp;备注：<input id="m_remarks" name="m_remarks" type="text" value="<%=m_remarks%>" size="50">
		</td>
    </tr>
    <tr>
		<td>演员：</td>
		<td><input id="m_starring" name="m_starring" type="text" value="<%=m_starring%>" size="50">
		&nbsp;导演：<input id="m_directed" name="m_directed" type="text" value="<%=m_directed%>" size="50">
		</td>
    </tr>
    <tr>
		<td>上映：</td>
		<td><input id="m_year" name="m_year" type="text" value="<%=m_year%>" size="50">
		&nbsp;人气：<input id="m_hits" name="m_hits" type="text" value="<%=m_hits%>" size="50"> 
		</td>
    </tr>
    <tr>
		<td>地区：</td>
		<td>
		<input id="m_area" name="m_area" type="text" value="<%=m_area%>" size="50">
		&nbsp;语言：<input id="m_language" name="m_language" type="text" value="<%=m_language%>" size="50">
		</td>
	</tr>
    <tr>
		<td>图片：</td>
		<td><input id="m_pic" name="m_pic" type="text" value="<%=m_pic%>" size="113"> </td>
    </tr>
	<tr>
		<td>入库状态：</td>
		<td>
		<input type="radio" name="m_zt" value="0" <%if m_zt=0 Then writeA"checked"%>> 未入库
		<input type="radio" name="m_zt" value="1" <%if m_zt=1 Then writeA"checked"%>> 已入库      </td>
	</tr>
	<tr>
		<td>播放地址：</td>
		<td>
		<%
		dim i,urls
        sql="Select * from tbl_vod_url where u_movieid="&m_id
        set rs= cjdb.db(sql,"rs1")
        do while not rs.eof
        i=i+1
        writeA"<input type=""text"" name=""Url"&i&""" size=120 value="""&rs("u_url")&""">&nbsp;第"&i&"集&nbsp;&nbsp;&nbsp;<a href=""?action=delurl&u_id="&rs("u_id")&"""><font color=""#FF0000"">删除</font></a><br>" &vbcrlf
        rs.movenext
        loop
        cjdb.c(rs)
        %>
        </td>
	</tr>
	<tr>
		<td>介绍：</td>
		<td>
		<textarea id="m_content" name="m_content" style="width:750px;height:150px;"><%=m_content%></textarea>      </td>
    </tr>
 	<tr>
		<td colspan="2" >
		<input type="submit" class="btn" name="Submit" value="修 改">
		<input type="button" class="btn" name="button" value="返 回" onClick="window.location.href='javascript:history.go(-1)'">      </td>
	</tr>
</table>
</form>
<%
end sub

sub main
	Dim pagenum : pagenum = be("all","page")
	if isN(pagenum) or not isNum(pagenum) then pagenum = 1
	if pagenum < 1 then pagenum = 1
	pagenum = clng(pagenum)
	dim keyword : keyword = be("all","keyword")
	dim project : project = be("all","project")
	
	dim sql,rs,zt,rsproject
	zt = be("all","zt") 
	
	Sql="Select a.*,b.p_name as p_name from tbl_vod a,tbl_vod_project b where a.m_pid=b.p_id "
	if zt <> "" then
		sql = sql & " and m_zt = " & zt 
	end if
	if keyword <> "" then
		if keyword = "[" then keyword = "[[]"
		if instr(keyword,"[") > 0 and instr(keyword,"]") <= 0 then keyword = replace(keyword,"[","[[]")
		sql = sql & " and m_name like '%" & keyword & "%' "
	end if
	if project<> "" then
		sql = sql & " and a.m_pid = " & project
	end if
	sql = sql & " order by m_zt asc ,m_addtime desc" 
	
	set rs = cjdb.db(sql,"rs1")
%>
<script language="javascript">
$(document).ready(function(){
	$("#btnDel").click(function(){
		if(confirm('确定要删除吗')){
			$("#form1").attr("action","?action=delpl");
			$("#form1").submit();
		}
	});
	$("#btnDelall").click(function(){
		if(confirm('确定要删除吗')){
			$("#form1").attr("action","?action=delall");
			$("#form1").submit();
		}
	});
	$("#btnSelin").click(function(){
		if(confirm('确定入库您所选择的数据吗')){
			$("#form1").attr("action","?action=IDInflow");
			$("#form1").submit();
		}
	});
	$("#btnAllin").click(function(){
		if(confirm('全部入库你所采集的数据吗')){
			$("#form1").attr("action","?action=AllInflow");
			$("#form1").submit();
		}
	});
	$("#btnNoin").click(function(){
		if(confirm('确定入库所有未入库的数据吗')){
			$("#form1").attr("action","?action=noInflow");
			$("#form1").submit();
		}
	});
	 $("#btnType").click(function(){
		if(confirm('确定更新所选数据的分类吗')){
			$("#form1").attr("action","?action=editype");
			$("#form1").submit();
		}
	});
});
</script>
<table width="96%" border=0 align=center cellpadding=0 cellSpacing=0 class=tbtitle >
  <TBODY>
    <tr>
      <td>
		<form action="collect_vod.asp" method="get"> 
          <strong>搜索影片：</strong>
          <input id=KeyWord size=40 name=keyword>
		  <INPUT class=inputbut type=submit value=搜索 name=Submit>
         &nbsp; 按项目查看：
        <select onchange=javascript:window.location.href=this.options[this.selectedIndex].value>
        <option value="collect_vod.asp">全部采集项目</option>
          <%
           sql = "select p_id,p_name from tbl_vod_project"
			set rsproject=cjdb.db(sql,"rs1")
		  	do while not rsproject.eof
		  %>
		 <option value="collect_vod.asp?project=<%=rsproject("p_id")%>" <%if trim(project)=trim(rsproject("p_id")) then %>selected<%end if%>><%=rsproject("p_name")%></option>
          <%
			rsproject.movenext
			loop
			cjdb.c(rsproject)
		  %>
		  </select>	
          <font color="#FF0000">(没有对应栏目,不能入库)</font>
          &nbsp;☆  <A href="?zt=1">已入库数据</A>　☆　<A href="?zt=0">未入库数据</A>　☆　<A href="collect_vod.asp">所有采集数据</A>
		</form>
        </td>
    </tr>
  </TBODY>
</TABLE>
<form action="" method="post" name="form1" id="form1">
<table class=tb >
	<tr>
	  <td width="4%" >&nbsp;</td>
      <td>影片名称</td>
      <td width="7%" >状态</td>
      <td width="7%">播放器</td>
      <td width="10%">栏目分类</td>
      <td width="10%">地区</td>
      <td width="15%">所属采集项目</td> 
      <td width="13%">更新时间</td>
      <td width="8%">操作</td>
    </tr>
	<%
		if rs.eof then
	 %>
    <tr><td align="center" colspan="9" >没有任何记录!</td></tr>
    <%
		else
		Dim i,typearr
		rs.PageSize = app_pagenum
	    rs.AbsolutePage = pagenum
	  	for i = 1 to rs.PageSize
	  	if rs.eof then exit for
	%>
    <tr>
	  <td><input name="m_id" type="checkbox" id="m_id" value="<%=rs("m_id")%>" /></td>
      <td><%=rs("m_name")%>  
      <% if rs("m_state")>0 then writeA "<font color=red>["&rs("m_state")&"]</fonr>" %>
      </td>
      <td><%IF rs("m_zt")=1 Then writeA"<font color=red>已入库</font>" else writeA"未入库"%></td>
      <td><%=rs("m_playfrom")%></td>
      <td>
	<%
		if rs("m_typeid") =0 then
	%>
		<font color=red>未知</font>
	<%
	  	else
	  		typearr = getValueByArray(cachevodtype, rs("m_typeid"))
	  		if isarray(typearr) then
	  			writeA typearr(1)
	  		end if
		end if
	  %>
      </td>
      <td><%=rs("m_area") %></td>
      <td><%=rs("p_name")%></td>
      <td><%=getColorDay(rs("m_addtime"))%></td>
      <td><A href="?action=edit&m_id=<%=rs("m_id")%>">修改</A>｜<A href="?action=del&m_id=<%=rs("m_id")%>">删除</A></td>
    </tr>
	<%
	rs.MoveNext
	next 
	end if
	%>
<tr>
	<td  colspan="9">
	全选<input name="chkall" type="checkbox" id="chkall" value="1" onClick="checkAll(this.checked,'m_id');"/>&nbsp;
    &nbsp;<input type="button" id="btnDel" value="批量删除" class="btn"  />
	&nbsp;<input type="button" id="btnDelall" value="删除所有" class="btn"  />
	&nbsp;<input type="button" id="btnSelin" class="btn" name="Submit" value="入库所选" >
	&nbsp;<input type="button" id="btnAllin" class="btn" name="Submit" value="全部入库" >
    &nbsp;<input type="button" id="btnNoin" class="btn" name="Submit" value="入库未入库" > 
	&nbsp; <select name="m_typeid" id="m_typeid"  >
        <option value="">请选择数据分类</option>
        <%=makeSelectAll("{pre}vod_type","t_id","t_name","t_pid","t_sort",0,"","&nbsp;|&nbsp;&nbsp;","")%>
        </select>
        <input type="button" id="btnType" class="btn" name="Submit" value="批量分类"><font color="#FF0000">&nbsp; </font></td>
</tr>
 <tr>
    <td colspan="9" >入库同名处理:
    <input type="radio" name="CCTV" value="0" checked>自动处理
    <input type="radio" name="CCTV" value="1">始终新增数据
    <input type="radio" name="CCTV" value="2">新增播放器组
    <br />
    强制覆盖数据:
	<input type="checkbox" name="CCTV1" value="1">年份
	<input type="checkbox" name="CCTV2" value="2">地区
	<input type="checkbox" name="CCTV3" value="3">演员
	<input type="checkbox" name="CCTV4" value="4">图片
	<input type="checkbox" name="CCTV5" value="5">简介
	<input type="checkbox" name="CCTV6" value="6">语言
	<input type="checkbox" name="CCTV7" value="7">备注
	<input type="checkbox" name="CCTV8" value="8">导演
    <br />
    <font color="#FF0000">注意 ：自动判断播放来源，如遇到相同来源则判断播放地址的第1条地址是否相同，不相同则增加播放组，相同则更新数据。</font>
	</td>
</tr>
<tr align="center">
	<td colspan="9">
	<%=pagelist_manage(rs.PageCount,pagenum,rs.RecordCount,app_pagenum,"collect_vod.asp?page={p}&project="&project&"&keyword="&keyword)%>
	</td>
</tr>
</table>
</form>
<%
rs.close
set rs=nothing
end sub

sub MovieInflow(Sql_Collect,MovieNumW)
%>
<table class=tb>
	<tr>
		<td  colspan="2" align="center"> 入 库 状 态</td>
		<div id="refreshlentext" style="background:#006600"></div>
		</td>
	</tr>
  	<tr>
		<td  colspan="2" align="center"><span id="storagetext">正 在 入 库...</span></td>
  	</tr>
</table>
<%
	dim iscover,rs_Collect,flag,rs_MOVIE,sql_MOVIE,rs,MovieInflowNum,language
	dim title,sql,rscount,did,dpic,entitle,urls,letter
	dim tmpplayurl,tmpplayfrom,arr1,arr2,k,rc
	
	iscover=request.Form("iscover")
	rscount = 10
 	
	set rs_collect= CJDB.db(sql_collect,"rs1")
	if rs_Collect.recordcount > 10000 then 
		rscount = 1000
	elseif rs_Collect.recordcount > 5000 then 
		rscount = 500
	elseif rs_Collect.recordcount > 1000 then 
		rscount = 100
	else
		rscount = 10
	end if
	
	do while not rs_Collect.eof
		flag=false
		title = rs_Collect("m_name")
		title = replaceStr(title,"'"," ''")
		
		sql_MOVIE = "select * from {pre}vod where d_name = '"&title&"'"
	    set rs_MOVIE = objdb.db(sql_MOVIE,"rs3")
	    
	     '插入新数据开始
		If rs_MOVIE.EOF or rs_MOVIE.EOF or request("CCTV")="1" Then
			rs_MOVIE.addnew
			flag=true
			dpic = rs_Collect("M_Pic")
			if len(dpic) > 128 then dpic = left(dpic,126)
			rs_MOVIE("d_pic") = dpic
			rs_MOVIE("d_addtime")= Now()
			rs_MOVIE("d_time")= Now()
			rs_MOVIE("d_year")=rs_Collect("m_year")
			rs_MOVIE("d_content")=rs_Collect("m_content")
			rs_MOVIE("d_hits")= rs_Collect("m_hits")
			rs_MOVIE("d_remarks")= rs_Collect("m_remarks")
			rs_MOVIE("d_name") = rs_Collect("m_name")
			rs_MOVIE("d_starring") = rs_Collect("m_starring")
			rs_MOVIE("d_directed") = rs_Collect("m_directed")
			rs_MOVIE("d_area") = rs_Collect("m_area")
			rs_MOVIE("d_language") = rs_Collect("m_language")
		end if
		 '插入新数据结束
		
		if rs_Collect("m_typeid") > 0 then 
			rs_MOVIE("d_type") = rs_Collect("m_typeid")
		else
			if not isN(rs_Collect("t_type")) then
				sql = "select * from {pre}vod_type where t_name like '%" & rs_Collect("m_type") &"%'"
				Set rs = objdb.db(sql,"rs1")
				if not rs.eof then rs_MOVIE("d_type") = rs("t_id")
				objdb.c(rs)
			end if
		end if
			
		if request("CCTV2")="2" then rs_MOVIE("d_area") = rs_Collect("m_area")
		if request("CCTV6")="6" then rs_MOVIE("d_language") = rs_Collect("m_language")
		if request("CCTV8")="8"  Then rs_MOVIE("d_directed")=rs_Collect("m_directed")
		if request("CCTV7")="7"  Then rs_MOVIE("d_remarks")=rs_Collect("m_remarks")
		if request("CCTV1")="1"  Then rs_MOVIE("d_year")=rs_Collect("m_year")
		if request("CCTV3")="3" then rs_MOVIE("d_starring")=rs_Collect("m_starring")
		if request("CCTV4")="4" Then rs_MOVIE("d_pic") = rs_Collect("m_pic")
		if request("CCTV5")="5" Then rs_MOVIE("d_content") = rs_Collect("m_content")
		rs_MOVIE("d_state") = rs_Collect("m_state")
		
		rs_MOVIE("d_name")= title
		entitle = hanzi2pinyin(title)
		if len(entitle) > 255 then entitle = left(entitle,255)
		rs_MOVIE("d_enname")= entitle
		if not isN(entitle) then letter = UCase(left(entitle,1))
		rs_MOVIE("d_letter")= letter
		rs_MOVIE("d_time")= Now()
		
		urls = getUrl(rs_Collect("m_id"))
		
		tmpplayurl = rs_MOVIE("d_playurl")
		tmpplayfrom = rs_MOVIE("d_playfrom")
		if isN(tmpplayurl) then tmpplayurl=""
		if isN(tmpplayfrom) then tmpplayfrom=""
		
		if isN(rs_MOVIE("d_playfrom")) then
			rs_MOVIE("d_playfrom") =  rs_Collect("m_playfrom")
			rs_MOVIE("d_playurl") =  urls
			rs_MOVIE("d_playserver") =  rs_Collect("m_playserver")
		elseif instr( "," &rs_MOVIE("d_playfrom"), rs_Collect("m_playfrom") ) >0 then
			if request("CCTV")="2" then
				rs_MOVIE("d_playfrom") = rs_MOVIE("d_playfrom") & "$$$" & rs_Collect("m_playfrom")
				rs_MOVIE("d_playurl") = rs_MOVIE("d_playurl") & "$$$" & urls
				rs_MOVIE("d_playserver") = rs_MOVIE("d_playserver") & "$$$" & rs_Collect("m_playserver")
			else
				arr1 = Split(tmpplayurl, "$$$")
				arr2 = Split(tmpplayfrom, "$$$")
				rc = False
				tmpplayurl = ""
				For k = 0 To UBound(arr2)
					If rc Then tmpplayurl = tmpplayurl & "$$$"
					If arr2(k) = rs_Collect("m_playfrom") Then arr1(k) = urls
					tmpplayurl = tmpplayurl & arr1(k)
					rc = True
				Next
				rs_MOVIE("d_playurl") = tmpplayurl
			end if
		else
			rs_MOVIE("d_playfrom") = rs_MOVIE("d_playfrom") & "$$$" & rs_Collect("m_playfrom")
			rs_MOVIE("d_playurl") = rs_MOVIE("d_playurl") & "$$$" & urls
			rs_MOVIE("d_playserver") = rs_MOVIE("d_playserver") & "$$$" & rs_Collect("m_playserver")
		end if
		rs_MOVIE.Update
		objdb.c(rs_MOVIE)
		
		CJDB.DB "update tbl_vod set m_zt=1 Where m_id ="&rs_Collect("m_id"),"exe"
		MovieInflowNum=MovieInflowNum+1
		if MovieInflowNum >= MovieNumW then
			writeA "<script type=""text/javascript"">"
			writeA "document.getElementById(""refreshlentext"").style.width = ""100%"";"
			writeA "document.getElementById(""refreshlentext"").innerHTML = ""100%"";"
			writeA "document.getElementById(""storagetext"").innerHTML = ""入库完毕 <a href='collect_vod.asp'>返回</a>"";"
			writeA "alert('入库完毕'); location.href='collect_vod.asp';"
			writeF "</script>"
		elseif (MovieInflowNum mod rscount) = 0 then
			writeA "<script type=""text/javascript"">"
			writeA "document.getElementById(""refreshlentext"").style.width = """&(MovieInflowNum/MovieNumW*100)&"%"";"
			writeA "document.getElementById(""refreshlentext"").innerHTML = """&(MovieInflowNum/MovieNumW*100)&"%"";"
			writeA "document.getElementById(""storagetext"").innerHTML = ""正在入库......"";"
			writeF "</script>"
		end if
rs_Collect.movenext
loop
CJDB.c(rs_collect)
end sub


Function getUrl(id)
	dim TempUrl,sql2,sql,title,rs_Collect2,num
	TempUrl=""
	sql2="select * from tbl_vod_url where u_movieid="&id&""
	set rs_collect2= cjdb.db(sql2,"rs1")
	num=1
	do while not rs_Collect2.eof
		If num =1 Then
			TempUrl=TempUrl& trim(rs_Collect2("U_Url"))
		Else
			TempUrl=TempUrl & "#" &trim(rs_Collect2("U_Url"))
		End If
		num=num+1
		rs_Collect2.movenext
	loop
	cjdb.c(rs_collect2)
	getUrl= TempUrl
End Function
%>