<!--#include file="QvodCms_Conn.asp"-->
<!--#include file="QvodCms_Check.asp"-->
<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" type="text/javascript">
<!--
d=escape(document.URL);
function CheckOthers(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
//		if (e.name != 'chkall')
			if (e.checked==false)
			{
				e.checked = true;// form.chkall.checked;
			}
			else
			{
				e.checked = false;
			}
	}
}
function ErrAll()
{
var con;
con=confirm('将删除所有信息是否确定？');
if (con==true) window.location='qvodcms_cm.asp?action=delall';
}
//-->
</script>
<style type="text/css">
<!--
.tdbg{ background-color:#CCCCCC}
.tdbgmouseover{ background-color: #666666}
-->
</style></head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th colspan=7 style="text-align:right;"><table width="370" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
	<form method="post" action="qvodcms_Cm.asp">
	<input type="hidden" name="action" value="search">
    <td width="80" style="color: #990000; text-align:right;">评论搜索：</td>
    <td width="80">
	<select name="cm_t">
	<option value="1" selected>电影名称</option>
	<option value="2">用户IP</option>
	<option value="3">评论人</option>
	</select>	</td>
    <td width="100"><input name="cm_k" type="text" style="width:150px; text-align:left" onFocus="if(this.value=='关键字')this.value='';" value="关键字"></td>
	<td width="50"><input type="submit" name="Submit" value="提交" /></td>
	</form>
  </tr>
</table></th>
  </tr>
 <!--主页面 -->

<%
Call OpenConn()
Dim Action,cm_t,cm_k
Action=Trim(Request("action"))
cm_t=Cint(Request("cm_t"))
cm_k=Trim(Request("cm_k"))
Page=QvodCms_CLng(request.QueryString ("page"))
If page<=0 or page="" then page=1'初始化分页参数
If action="del" then
    Call Cm_del()	
Elseif action="delall" Then
    Call Cm_delall()		
Else 
    Call Cm_main()
End If
%> 
<%
Sub Cm_main()
Set rs = Server.CreateObject("adodb.recordset")
If action="search" Then
    If cm_t=1 Then
	sql = "Select qvodcms_name.name_id,data_name,qvodcms_cm.data_id,cm_id,cm_username,cm_content,cm_date,cm_ip from qvodcms_Name,qvodcms_cm where data_name like '%"&cm_k&"%' and qvodcms_Name.name_id=qvodcms_cm.data_id order by cm_id asc"
	ElseIf cm_t=2 Then'ip
	sql = "Select * from qvodcms_cm where cm_ip='"&cm_k&"' order by Cm_id desc"
	Else
	sql = "Select * from qvodcms_cm where cm_username='"&cm_k&"' order by Cm_id desc"
	End If
	'Response.Write(sql)
	'response.end
Else
    sql = "select * from qvodcms_cm order by Cm_id desc"
End If
rs.Open sql, Conn, 1, 1
If Not (rs.bof And rs.eof) Then
	i=0
	rs.pagesize=QvodCms_CLng(AdminId(16))'每页数据
	rs.AbsolutePage=page
	m=rs.recordcount     '总记录
	n=rs.PageCount       '总页数
	z=rs.pagesize        '每页数量
%>
<form method='post' action='?action=del' onSubmit='javascript:return CheckForm()'> 
  <tr style="text-align:center;"> 　
    <td width="31" class="td2">选中</td>
    <td width="434" class="td2">评论内容</td>
    <td width="130" class="td2">点评影片</td>
    <td width="110" class="td2">评论人</td>
    <td width="116" class="td2">用户IP</td>
    <td width="59" class="td2">操作</td>
	<td width="110" class="td2">评论时间</td>	
  </tr>
<%
Do while not rs.eof  and i<rs.pagesize 
%>
  <tr bgcolor="#FFFFFF" onMouseOver="javascript:this.bgColor='#ecf5f8'" onMouseOut="javascript:this.bgColor='#FFFFFF'" style="text-align:center;">
    <td ><input type='checkbox' name='e' value='<%=rs("Cm_id")%>' style="border: none"/></td>
    <td style="text-align:left;"><a href="#" title="<%=rs("cm_content")%>"><%=GetSubStr(rs("cm_content"), 50, True)%></a></td>
    <td ><%Call Cm_DataName(rs("data_id"))%></td>
    <td ><%=rs("cm_username")%></td>	
    <td ><%=rs("cm_ip")%></td>
    <td ><a href="?e=<%=rs("Cm_id")%>&action=del">删除</a></td>
    <td ><%=Replace(rs("cm_date"),left(rs("cm_date"),5),"")%></td>
	</tr>
  <%
    i=i+1
    rs.movenext  
    Loop
  %>
  <tr style="text-align:left;">
    <td colspan="2" class="td2"><input type='button' value='全/反选' onClick=CheckOthers(this.form) /> <input type='submit' value='删除所选评论'/> <input type='button' value='删除所有评论' onClick='Javascript:ErrAll()' /></td>
    <td colspan="5" class="td2"><%=ShowPage("qvodcms_cm.asp?action="&Action&"&cm_t="&cm_t&"&cm_k="&cm_k&"", m, z, page, True, False, "条", False)%></td>
    </tr>  
<%
Else
    Response.Write("<tr><td>暂时没有评论信息！</td></tr>") 
End If
rs.Close
set rs=nothing
Call CloseConn()'关闭数据库连接
%>
<%End Sub%>
</form>  
</table>
<div style="text-align:center; margin-top:5px; color: #FF0000">页面执行时间：<%=GetRunTime()%>秒</div>
</body>
</html>
<%
Sub Cm_del
    dim e_id
    e_id=Trim(request("e"))
	e_id=replace(e_id,", ",",")
	If e_id="" Then
	    Call Qvodcms_err("参数不能为空!")		
		response.end
	End If
	Conn.Execute(" delete from qvodcms_cm where cm_id in ("&e_id&") ")'删除地址
	
	Response.redirect("qvodcms_cm.asp?page="&page&"")	
	'Call qvodcms_err("删除成功!")	
End Sub

Sub Cm_delall
	Conn.Execute(" delete from qvodcms_cm ")'删除地址
	Response.redirect("qvodcms_cm.asp")		
End Sub

Sub Cm_DataName(str)
	Set rd=Conn.execute("select Name_id,class_id,data_name,data_py from qvodcms_Name where Name_id="&str&" ")
	If not(rd.bof and rd.eof) Then
	Response.Write "<a href='"&GetDataLink(rd("class_id"),rd("Name_id"),rd("data_py"))&"' title='"&rd("data_name")&"' target='_blank'>"&GetSubStr(rd("data_name"), 14, True)&"</a>"
	End If
	Set rd=nothing
End Sub
%>