<!--#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
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 News_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.news_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 status=0"
		 ElseIf	shuxin_id=2 Then'已审电影
			 S3="and status=1"
		 ElseIf	shuxin_id=3 Then'推荐电影
			 S3="and elite=1"	
		 ElseIf	shuxin_id=4 Then'图片电影
			 S3="and hot=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 Title like '%"&search_keyword&"%'"
			 Else'启用InStr,LCase函数过滤小日本
			 sql="and InStr(1,LCase(Title),LCase('"&search_keyword&"'),0)<>0"
			 End If
		 ElseIf search_type=2 Then
			 If Config(1)="SQL" Then
		     sql="and Author like '%"&search_keyword&"%'"
			 Else'启用InStr,LCase函数过滤小日本
			 sql="and InStr(1,LCase(Author),LCase('"&search_keyword&"'),0)<>0"
			 End If	  
		 End If
		 pagelink="qvodcms_news.asp?Action=search&search_type="&search_type&"&search_keyword="&search_keyword&"&" '分页路径
	Else
	    sql=""
	    pagelink=LinkPath(0,0,0)'分页路径 
	End If
	If order="hits" then
	    orderby="Hits"    
	Elseif order="times" then
	    orderby="datetimes"
	Elseif order="id" then
	    orderby="id"
	Else
	    orderby="datetimes"
	End If
	'2.8高效分页调用Satr---------------------------------------------
	'获取记录总数
	
	set krs=server.createobject("adodb.recordset")
	krs.open"select count(B.id) as idcount from qvodcms_news_class a  inner join qvodcms_news b on a.news_class_id=b.class_id where 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.id  from qvodcms_news_class a inner join qvodcms_news b on a.news_class_id=b.class_id where 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("id")
		   else
			sqlid=sqlid &","&crs("id")
		 end if
	    crs.movenext
	  next:crs.Close:Set crs=Nothing
	'获取本页需要用到的id结束
	end if
     '高效分页调用End----------------------------------------------
	if(idcount>0 and sqlid<>"") then'如果记录总数=0,则不处理
	 Sql = "select id,class_id,Title,Color,Hot,Elite,Hits,status,datetimes from qvodcms_news where id in("& sqlid &") order by "&orderby&" desc"
	 Else
     Call qvodcms_err("暂无数据！")
	 Response.End()
	 End if
End Sub

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

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

Sub dytu()'处理电影属性
	If rs("Hot")=1 then
	 Response.Write"<font color=red>图</font>"
	End If
End Sub

Function LinkPath(classid,serverid,shuxinid)
    LinkPath="qvodcms_news.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 news_class_id,class_name,class_dir,class_orderid,class_bigid from qvodcms_news_class where class_bigid="&TypeID&" order by class_orderid asc" )
		TempStr =CompatStr & "┄"
		Do While Not RSclass.Eof
		if RSclass("news_class_id")=ID then
				Fen_ClassName = Fen_ClassName & "<option value='"&LinkPath(RSclass("news_class_id"),server_id,shuxin_id)&"' selected>"
		else
				Fen_ClassName = Fen_ClassName & "<option value='"&LinkPath(RSclass("news_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("news_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=8 style="text-align:center;"><table width="100%" border="0">
    <tr>
      <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="34%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="124" style="color: #990000;">分类：</td>
                <td width="124"><select name="select"  style="width:120px" onChange="MM_jumpMenu('parent',this,0)">
                  <option value='<%=LinkPath(0,server_id,shuxin_id)%>'>按数据分类查看</option>
                  <%=Fen_ClassName(0,"",class_id)%>
                </select></td>
                <td width="101"><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="88"><select name="select" onChange="MM_jumpMenu('parent',this,0)">
                  <option value='qvodcms_news.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>
                </tr>
          </table></td>
          <td width="66%"><table width="594" border="0" align="left" cellpadding="0" cellspacing="0">
              <tr>
                <form method="get" action="qvodcms_news.asp">
                  <input type="hidden" name="action" value="search">
                  <td width="40" style="color: #990000; text-align:right;">搜索：</td>
                  <td width="92"><select name="search_type">
                    <option value="1">新闻标题</option>
                    <option value="2">新闻作者</option>
                  </select></td>
                  <td width="332"><input name="search_keyword" type="text" style="width:320px; text-align:left" onFocus="if(this.value=='关键字')this.value='';" value="关键字"></td>
                  <td width="130"><input type="submit" name="Submit" value="提交" /></td>
                </form>
              </tr>
          </table></td>
        </tr>
      </table></td>
      </tr>
  </table>
<!-- --></th>
</tr>
<tr style="text-align:center;">
<td width="37" class="td2">选中</td>
<td width="46" class="td2">ID</td>
<td width="750" class="td2">新闻标题</td>
<td width="39" class="td2">推荐</td>
<td width="49" class="td2">审核</td>
<td width="105" class="td2">更新时间</td>
<td width="80"  class="td2">次 数</td>
<td width="125" class="td2">常规操作</td>
</tr>
<form name='myform' method='Post' action=''>
<%
Set rs = Server.CreateObject("adodb.recordset")
Call News_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("id")%>' style="border:none">  </td>
  <td ><%=rs("id")%></td>
  <td style="text-align:left;">[<a href="qvodcms_news.asp?action=fenlei&data_type=class&class_id=<%=rs("class_id")%>"><%=GetClassNameNews(rs("class_id"))%></a>]<a href="<%=GetDataLinkNews(rs("class_id"),rs("id"),rs("datetimes"),1)%>" target="_blank"><%=GetColor(left(rs("Title"),50),rs("color"))%><%Call dytu%></a> <%If Config(17)="html" Then%> <a href="#" onClick="ops('QvodCms_CreateHtml.asp?action=newsotherid&BeginID=<%=rs("id")%>&EndID=<%=rs("id")%>','150','300');">生成</a><%End If%></td>
  <td  id="newel<%=rs("id")%>"><%Call dysx%></td>
  <td  id="newsh<%=rs("id")%>"><%Call dyst%></td>
  <td ><%=formatdatetime(rs("datetimes"),2)%></td>
  <td ><%=rs("hits")%></td>
  <td ><a href="qvodcms_News_edit.asp?id=<%=rs("id")%>">修改</a> <a href="qvodcms_news_save.asp?action=del&id=<%=rs("id")%>" onClick="return confirm('删除后将不能恢复,确定要删除吗?');">删除</a></td>
  </tr>
<%
	rs.movenext  
	loop 
%>
<tr >
  <td colspan="8" class="td2" style="text-align:left; height:30px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox' style="border:none">
      全选
        <input name='submit1' class="inputt" type='submit' value='批量生成' onClick="document.myform.action='QvodCms_CreateHtml.asp?action=newsotherallid';">
        <input name='submit1' class="inputt" type='submit' value='批量推荐' onClick="document.myform.action='QvodCms_News_All.asp?action=tuijian';">&nbsp;<input name='submit1' class="inputt" type='submit' value='取消推荐' onClick="document.myform.action='QvodCms_News_All.asp?action=daijian';">
        <input name='submit1' class="inputt" type='submit' value='批量移动' onClick="document.myform.action='QvodCms_News_All.asp?action=yidong';">&nbsp;<input name='submit1' type='submit' value='批量删除' onClick="document.myform.action='QvodCms_News_All.asp?action=delall';return confirm('删除后将不能恢复,确定批量删除吗?');">&nbsp;<input name='submit1' class="inputt" type='submit' value='批量设置' onClick="document.myform.action='QvodCms_News_All.asp?action=shezhi';">&nbsp;</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()
%>
<div style="text-align:center; margin-top:5px; color: #FF0000">页面执行时间：<%=GetRunTime()%>秒</div>
</body>
</html>