<!--#include file="QvodCms_Conn.asp"-->
<!--#include file="QvodCms_Check.asp"-->
<%
Dim action,class_id,class_bigid,server_id,shuxin_id,search_type,search_class,search_keyword,pagelink,order,ListUrl,DataUrl
Dim idcount,pagec,sqlid,playpath
sql="":S1="":S2="":S3=""
action=Trim(Request.QueryString("action"))
order=Trim(Request.QueryString("order"))
class_id=qvodcms_clng(Request.QueryString("class_id"))  '分类筛选参数－栏目
server_id=qvodcms_clng(Request.QueryString("server_id"))'分类筛选参数－服务器组
shuxin_id=qvodcms_clng(Request.QueryString("shuxin_id"))'分类筛选参数－电影属性
search_type=qvodcms_clng(Request.QueryString("search_type"))'搜索筛选参数－影片名
search_keyword=Trim(Request.QueryString("search_keyword"))'搜索关键字
playpath=Trim(Request.QueryString("playpath"))'搜索关键字
page=qvodcms_clng(Request.QueryString("page")):If page<=0 or page="" Then page=1'初始化分页参数
Call OpenConn()
Sub Data_sql'作用：处理SQL查询语句   
    If action="fenlei" Then
	     If class_id>0 Then
		     'S1="and (class_id="&class_id&" or class_id in (select class_id from qvodcms_class where class_bigid="&class_id&"))"
			 S1="and (a.class_id="&class_id&" or a.class_bigid="&class_id&")"
			 '一同查询大类下的小类id 
		 End If
	     If server_id>0 Then
		     S2="and server_id like '%"&server_id&"|%'"
		 End If
		 If shuxin_id=1 Then'待审电影
			 S3="and data_status=0"
		 ElseIf	shuxin_id=2 Then'已审电影
			 S3="and data_status=1"
		 ElseIf	shuxin_id=3 Then'推荐电影
			 S3="and data_elite=1"	
		 ElseIf	shuxin_id=4 Then'热门电影
			 S3="and data_hits>="&Clng(AdminId(28))&""	 
		 ElseIf	shuxin_id=5 Then'连载电影
			 S3="and data_vip=1"	 				  
		 End If
		 pagelink=LinkPath(class_id,server_id,shuxin_id)'分页路径
	ElseIf action="search" Then
         If search_type=1 Then
		     If Config(1)="SQL" Then
		     sql="and data_name like '%"&search_keyword&"%'"
			 Else'启用InStr,LCase函数过滤小日本
			 sql="and InStr(1,LCase(data_name),LCase('"&search_keyword&"'),0)<>0"
			 End If
		 ElseIf search_type=2 Then
			 If Config(1)="SQL" Then
		     sql="and data_actor like '%"&search_keyword&"%'"
			 Else'启用InStr,LCase函数过滤小日本
			 sql="and InStr(1,LCase(data_actor),LCase('"&search_keyword&"'),0)<>0"
			 End If	  
		 ElseIf search_type=3 Then
		     sql="and data_Ping like '%"&search_keyword&"%'"	
		 End If
		 pagelink="qvodcms_Data.asp?Action=search&search_type="&search_type&"&search_keyword="&search_keyword&"&" '分页路径
		 
    ElseIf action="playpath" Then
	      sql="and data_playpath like '%"&playpath&"%'"	
		  pagelink="qvodcms_Data.asp?action=playpath&playpath="&playpath&"&" '分页路径
	Else
	    sql=""
	    pagelink=LinkPath(0,0,0)'分页路径 
	End If
	If order="hits" then
	    orderby="data_hits"    
	Elseif order="times" then
	    orderby="data_lastdate"
	Elseif order="id" then
	    orderby="name_id"
	Else
	    orderby="data_lastdate"
	End If
	
	'2.8高效分页调用Satr---------------------------------------------
	'获取记录总数
	
	set krs=server.createobject("adodb.recordset")
	krs.open"select count(B.name_id) as idcount from qvodcms_class a  inner join qvodcms_name b on a.class_id=b.class_id where name_id>0 "&sql&" "&S1&" "&S2&" "&S3&"",conn,1,1
    idcount=krs("idcount")'获取记录总数
	if(idcount>0) then'如果记录总数=0,则不处理
	  if(idcount mod Clng(AdminId(19))=0)then'如果记录总数除以每页条数有余数,则=记录总数/每页条数+1
		pagec=int(idcount/Clng(AdminId(19)))'获取总页数
	  else
		pagec=int(idcount/Clng(AdminId(19))+1)'获取总页数
	  end if
	  krs.Close:Set krs=Nothing
	  '获取本页需要用到的id 读取所有记录的id数值,因为只有id所以速度很快
	  set crs=server.createobject("adodb.recordset")
	  crs.open"select B.name_id  from qvodcms_class a  inner join qvodcms_name b on a.class_id=b.class_id where name_id>0 "&sql&" "&S1&" "&S2&" "&S3&" order by "&orderby&" desc",conn,1,1
	  crs.pagesize = Clng(AdminId(19)) '每页显示记录数
	   if page > pagec then page = pagec
	   if pagec > 0 then crs.absolutepage = page  
	    for i=1 to crs.pagesize
	      if crs.eof then exit for  
		    if(i=1)then
			sqlid=crs("name_id")
		   else
			sqlid=sqlid &","&crs("name_id")
		 end if
	    crs.movenext
	  next:crs.Close:Set crs=Nothing
	'获取本页需要用到的id结束
	end if
	'Response.Write sqlid
	'2.8高效分页调用End----------------------------------------------
	if(idcount>0 and sqlid<>"") then'如果记录总数=0,则不处理
	 Sql = "select name_id,data_name,class_id,data_hits,data_elite,data_color,data_lastdate,data_reurl,data_status,data_vip,data_cu,data_order,data_py from qvodcms_name where name_id in("& sqlid &") order by "&orderby&" desc"
	 Else
     Call qvodcms_err("暂无数据！")
	 Response.End()
	 End if
End Sub

Sub Data_elite'作用：处理显示该影片是否推荐
	If rs("data_elite")=0 then
	    Response.Write("<a href=qvodcms_data_save.asp?action=elite&data_id="&rs("name_id")&"&elite_id=1>设为推荐</a> ")
	Else
	    Response.Write("<a href=qvodcms_data_save.asp?action=elite&data_id="&rs("name_id")&"&elite_id=0><font color=#990000>取消推荐</font></a> ")
	End If
End Sub

Sub dysx()'处理电影属性
	If rs("data_elite")=1 then
	 Response.Write"<img src=""images/icon_01.gif"" border=""0"" style=""cursor: pointer;"" onClick=""setajax('el',"&rs("name_id")&",0)""/>"
	Else
	Response.Write"<img src=""images/icon_02.gif"" border=""0"" style=""cursor: pointer;"" onClick=""setajax('el',"&rs("name_id")&",1)""/>"
	End If
End Sub

Sub dyrm()'处理热门
    If rs("data_hits")>=Clng(AdminId(28)) then
	 Response.Write"<img src=""images/icon_01.gif"" border=""0"" style=""cursor: pointer;"" onClick=""setajax('rm',"&rs("name_id")&","&Clng(AdminId(28))&")""/>"
	Else
	Response.Write"<img src=""images/icon_02.gif"" border=""0"" style=""cursor: pointer;"" onClick=""setajax('rm',"&rs("name_id")&",1)""/>"
	End if
End Sub

Sub dysh()'处理电影属性
	If rs("data_status")=1 then
	 Response.Write"<img src=""images/icon_01.gif"" border=""0"" style=""cursor: pointer;"" onClick=""setajax('sh',"&rs("name_id")&",0)""/>"
	Else
	Response.Write"<img src=""images/icon_02.gif"" border=""0"" style=""cursor: pointer;"" onClick=""setajax('sh',"&rs("name_id")&",1)""/>"
	End If
End Sub

Sub dyvip()'处理电影vip属性
	If rs("data_vip")=1 then
	 Response.Write"<img src=""images/icon_01.gif"" border=""0"" style=""cursor: pointer;"" onClick=""setajax('vip',"&rs("name_id")&",0)""/>"
	Else
	Response.Write"<img src=""images/icon_02.gif"" border=""0"" style=""cursor: pointer;"" onClick=""setajax('vip',"&rs("name_id")&",1)""/>"
	End If
End Sub

Sub dycu()'处理加粗
    If rs("data_cu")=1 then
	 Response.Write("<font color='red'> 粗</font>")
	End If 
End Sub

Sub dyp()'处理排序
    If rs("data_order")=1 then
	 Response.Write("<font color='red'>↑升</font>")  
	End If 
End Sub

Sub httppics()
  Set imgrs = Server.CreateObject("adodb.recordset")
  imgrs.open"Select count(name_id) as imgcount from qvodcms_name where data_status=1 and Left(data_picbig,7)='http://'",conn,1,1
  if not(imgrs.eof and imgrs.bof) Then
	Response.Write "共<font color=red>["&imgrs("imgcount")&"]</font>张远程图片，<a href=""QvodCms_Img.asp"">立即保存"
  end If:set imgrs=nothing
End Sub

Function LinkPath(classid,serverid,shuxinid)
    LinkPath="qvodcms_Data.asp?Action=fenlei&Class_id="&classid&"&Server_id="&serverid&"&shuxin_id="&shuxinid&"&"
End Function

Function Fen_ClassName(TypeID,CompatStr,ID)'递归查询分类
		Dim RSclass,TempStr
		Set RSclass = Conn.Execute("select class_id,class_name,class_dir,class_orderid,class_bigid from qvodcms_class where class_bigid="&TypeID&" order by class_orderid asc" )
		TempStr =CompatStr & "┄"
		Do While Not RSclass.Eof
		if RSclass("class_id")=ID then
				Fen_ClassName = Fen_ClassName & "<option value='"&LinkPath(RSclass("class_id"),server_id,shuxin_id)&"' selected>"
		else
				Fen_ClassName = Fen_ClassName & "<option value='"&LinkPath(RSclass("class_id"),server_id,shuxin_id)&"'>"
		end if
				Fen_ClassName = Fen_ClassName & "├" & TempStr &  RSclass("class_name")
				Fen_ClassName = Fen_ClassName & "</option>" & Chr(13) & Chr(10)
				Fen_ClassName = Fen_ClassName &Fen_ClassName(RSclass("class_id"),TempStr,ID)
		RSclass.MoveNext
		loop
		RSclass.Close
		Set RSclass = Nothing
End Function

%>
<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" />
<script language = "javaScript" src = "qvodcms_All.js" type="text/javascript"></script>
<script type='text/javascript' src='../Js/qvodcms.Ajax.js'></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<th colspan=12><table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="51%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="95" style="color: #990000;width:80px;">分类：</td>
    <td width="154"><select name="select"  style="width:150px" onChange="MM_jumpMenu('parent',this,0)"><option value='<%=LinkPath(0,server_id,shuxin_id)%>'>按数据分类查看</option><%=Fen_ClassName(0,"",class_id)%></select></td>
    <td width="105"><select name="select" onChange="MM_jumpMenu('parent',this,0)"><option value='<%=LinkPath(class_id,server_id,0)%>'>按影片属性</option>
	<option value='<%=LinkPath(class_id,server_id,3)%>' <%If shuxin_id=1 then%>selected='selected'<%end if%>>推荐影片</option>
	<option value='<%=LinkPath(class_id,server_id,4)%>' <%If shuxin_id=2 then%>selected='selected'<%end if%>>热门影片</option>
	</select></td>
    <td width="104"><select name="select" onChange="MM_jumpMenu('parent',this,0)"><option value='qvodcms_data.asp'>排序方式</option>
	<option value='<%=LinkPath(class_id,server_id,shuxin_id)%>order=id' <%If order="id" then%>selected='selected'<%end if%>>影片ID</option>
	<option value='<%=LinkPath(class_id,server_id,shuxin_id)%>order=times' <%If order="times" then%>selected='selected'<%end if%>>按时间</option>
	<option value='<%=LinkPath(class_id,server_id,shuxin_id)%>order=hits' <%If order="hits" then%>selected='selected'<%end if%>>按人气</option></select></td>	
    <td width="164">
    <select id='playfrom' name='playfrom' style="width:120px" onChange="self.location.href='?action=playpath&playpath='+this.options[this.selectedIndex].value">
	 <option value=''>按视频来源查看</option><%Call SvSelect%>
</select>
    </td>
  </tr>
</table></td>
      <td width="49%"><table width="98%" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
	<form method="get" action="qvodcms_data.asp">
	<input type="hidden" name="action" value="search">
    <td width="46" style="color: #990000; text-align:right;">搜索：</td>
    <td width="96"><select name="search_type"><option value="1">电影名称</option><option value="2">影片主演</option>
    </select></td>
    <td width="132"><input name="search_keyword" type="text" style="width:120px; text-align:left" onFocus="if(this.value=='关键字')this.value='';" value="关键字"></td>
	<td width="49"><input type="submit" name="Submit" value="提交" /></td>
	<td width="264"><%httppics%></td>
	</form>
  </tr>
</table></td>
      </tr>
  </table><!-- --></th>
</tr>
<tr style="text-align:center;">
<td width="32" background="Skins/images/tdbg.gif" class="td2"  align="center">选中</td>
<td width="34" background="Skins/images/tdbg.gif" class="td2">ID</td>
<td width="359" background="Skins/images/tdbg.gif" class="td2">影片名称</td>
<td width="110" background="Skins/images/tdbg.gif" class="td2">连载</td>
<td width="83" background="Skins/images/tdbg.gif" class="td2">更新时间</td>
<td width="71" background="Skins/images/tdbg.gif"  class="td2">次 数</td>
<td width="31" background="Skins/images/tdbg.gif"  class="td2">推荐</td>
<td width="31" background="Skins/images/tdbg.gif" class="td2">热门</td>
<td width="31" background="Skins/images/tdbg.gif" class="td2">审核</td>
<td width="31" background="Skins/images/tdbg.gif" class="td2">会员</td>
<td width="84" background="Skins/images/tdbg.gif" class="td2">播放资源</td>
<td width="93" background="Skins/images/tdbg.gif" class="td2">常规操作</td>
</tr>
<form name='myform' method='Post' action=''>
<%
Set rs = Server.CreateObject("adodb.recordset")
Call Data_sql
rs.Open sql, Conn, 1, 1
If not(rs.bof And rs.eof) Then
	rs.pagesize=Clng(AdminId(19))'每页数据
	m=idcount     '总记录
	n=pagec       '总页数
	z=rs.pagesize       '每页数量
	i=0
	Do While Not rs.eof and i<rs.pagesize
	i=i+1
%>
<tr bgcolor="#FFFFFF" onMouseOver="javascript:this.bgColor='#ecf5f8'" onMouseOut="javascript:this.bgColor='#FFFFFF'" style="text-align:center;">
  <td ><input name='data_id' type='checkbox' value='<%=rs("name_id")%>' style="border:none">  </td>
  <td ><%=rs("name_id")%></td>
  <td style="text-align:left;">[<a href="qvodcms_data.asp?action=fenlei&data_type=class&class_id=<%=rs("class_id")%>"><%=GetClassName(rs("class_id"))%></a>] <a href="<%=GetDataLink(rs("class_id"),rs("name_id"),rs("data_py"))%>" target="_blank"><%=GetColor(left(rs("data_name"),12),rs("data_color"))%></a> <%If Config(17)="html" Then%> <a href="#" onClick="ops('QvodCms_CreateHtml.asp?action=otherid&BeginID=<%=rs("name_id")%>&EndID=<%=rs("name_id")%>','150','300');">生成</a><%End If%> <%Call dycu()%> <%Call dyp()%> </td>
  <td><!--<%'=GetReplace(rs("data_reurl"))%>--><span  id="ct<%=rs("name_id")%>"><%If len(rs("data_reurl"))>1 Then%><span style="cursor:pointer" onClick="setday('ct',<%=rs("name_id")%>,0)" title='修改集数状态'><%=trim(rs("data_reurl"))%></span><%Else%><img src="Images/ct_01.gif" title="设置集数状态" style="cursor:pointer;font-size:12px;" onClick="setday('ct',<%=rs("name_id")%>,0)"/><%End If%></span></td>
  <td ><%=formatdatetime(rs("data_lastdate"),2)%></td>
  <td ><%=rs("data_hits")%></td>
  <td  id="el<%=rs("name_id")%>"><%Call dysx%></td>
  <td  id="rm<%=rs("name_id")%>"><%Call dyrm%></td>
  <td  id="sh<%=rs("name_id")%>"><%Call dysh%></td>
  <td  id="vip<%=rs("name_id")%>"><%Call dyvip%></td>
 <td id="playurl<%=rs("name_id")%>"><img src="Images/icon_url.gif" align="absmiddle" title="设置影片播放地址" style="cursor:pointer;font-size:12px;" onClick="setday('playurl',<%=rs("name_id")%>,'<%=rs("data_name")%>')"/></td>
  <td ><a href="qvodcms_data_edit.asp?data_id=<%=rs("name_id")%>">修改</a> <a href="qvodcms_data_save.asp?action=del&data_id=<%=rs("name_id")%>" onClick="return confirm('删除后将不能恢复,确定要删除吗?');">删除</a> <%'Call Data_elite%></td>
  </tr>
<%
	rs.movenext  
	loop 
%>
<tr >
  <td colspan="12" class="td2" style="text-align:left; height:30px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="81" style="padding-left:8px;"><input type="checkbox" name="ChkAll" id="ChkAll" class="checkbox" onClick="checkOthers('input','data_id')"/>全/反选</td>
    <td width="909">
<input name='submit1' class="inputt" type='submit' value='批量生成' onClick="document.myform.action='QvodCms_CreateHtml.asp?action=otherallid';">
<input name='submit1' class="inputt" type='submit' value='批量升序' onClick="document.myform.action='qvodcms_data_all.asp?action=orderby';">
<input name='submit1' class="inputt" type='submit' value='批量降序' onClick="document.myform.action='qvodcms_data_all.asp?action=orderbydel';">
<input name='submit1' class="inputt" type='submit' value='批量推荐' onClick="document.myform.action='qvodcms_data_all.asp?action=tuijian';">&nbsp;<input name='submit1' class="inputt" type='submit' value='取消推荐' onClick="document.myform.action='qvodcms_data_all.asp?action=daijian';">&nbsp;<input name='submit1' class="inputt" type='submit' value='设为热门' onClick="document.myform.action='qvodcms_data_all.asp?action=remen';">&nbsp;<input name='submit1' class="inputt" type='submit' value='取消热门' onClick="document.myform.action='qvodcms_data_all.asp?action=daire';">&nbsp;<input name='submit1' class="inputt" type='submit' value='批量移动' onClick="document.myform.action='qvodcms_data_all.asp?action=yidong';">&nbsp;<input name='submit1'  class="inputt" type='submit' value='批量删除' onClick="document.myform.action='qvodcms_data_all.asp?action=delall';return confirm('删除后将不能恢复,确定批量删除吗?');">&nbsp;<input name='submit1' class="inputt" type='submit' value='批量设置' onClick="document.myform.action='qvodcms_data_all.asp?action=shezhi';"></td>
  </tr>
</table></td>
  </tr>
</form> 
<tr> 
<th colspan=12 style="text-align:center; padding:5px;"><%=ShowPage(pagelink&"order="&order, m, z, page, True, True, "条", False)%></th>
</tr>
</table>
<%
Else
    Call QvodCms_Err("暂无数据！")
End If

rs.Close:Set rs=nothing:Call CloseConn()
Sub SvSelect '作用:处理循环影片的服务器组
   for i=1 to From_Count
	Response.Write "<option value='"&playfrom(i)&"' >"&playfrom(i)&"</option>"
   next	
End Sub


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