<!--#include file="admin_conn.asp"-->
<%
chkLogin
dim action : action = be("get","action")

Select case action
	case "audit" : del
	case else : headAdmin "评论管理" : main
End Select
dispseObj()

sub main
	Dim pagenum,VID,rs1
	pagenum = be("all","page")
	if isN(pagenum) or not isNum(pagenum) then pagenum = 1
	if pagenum < 1 then pagenum = 1
	pagenum = clng(pagenum)
	Dim sql : sql = "select c_id,c_type,c_vid,c_rid,c_audit,c_name,c_ip,c_content,c_time from {pre}comment order by c_id desc"
	Dim rs : Set rs = objdb.DB(sql,"rs1")
	%>
<script language="javascript">
$(document).ready(function(){
	$('#form1').form({
		onSubmit:function(){
			if(!$("#form1").valid()) {return false;}
		},
	    success:function(data){
	        $.messager.alert('系统提示', data, 'info',function(){
	        location.href=location.href;
	        });
	    }
	});
	$('#form2').form({
		onSubmit:function(){
			if(!$("#form2").valid()) {return false;}
		},
	    success:function(data){
	        $.messager.alert('系统提示', data, 'info');
	    }
	});
	$("#btnCancel").click(function(){
		location.href= location.href;
	});
	$("#btnDel").click(function(){
		if(confirm('确定要删除吗')){
			$("#form1").attr("action","admin_ajax.asp?action=del&flag=batch&tab={pre}comment");
			$("#form1").submit();
		}
		else{return false}
	});
	$("#btnAudit").click(function(){
		$("#form1").attr("action","admin_comment.asp?action=audit");
		$("#form1").submit();
	});
});

</script>
<form action="" method="post" name="form1" id="form1">
<table class="tb">
	<tr>
	<td width="5%">&nbsp;</td>
	<td width="15%">用户</td>
	<td >内容</td>
	<td width="20%">来源</td>
	<td width="15%">时间</td>
	<td width="10%">IP地址</td>
	</tr>
	<%
		if rs.eof then
	%>
    <tr><td align="center" colspan="7">没有任何记录!</td></tr>
    <%
		else
			Dim i,c_content
			rs.PageSize = app_pagenum
	    	rs.AbsolutePage = pagenum
	  		for i = 1 to rs.PageSize
	  			if rs.eof then exit for
	  				c_content = rs("c_content")
	  				c_content = regReplace(c_content, "\[em:(\d{1,})?\]", "<img src=""../images/face/$1.gif"" border=0/>")
	  %>
	  <tr>
	  <td><input name="c_id" type="checkbox" id="c_id" value="<%=rs("c_id")%>" /></td>
      <td><%=rs("c_name")%></td>
      <td><%=c_content%></td>
      <td>
      <%
      		vid = rs("c_vid")
		 	if rs("c_type") =2 then
			 	set rs1 = objdb.DB("select a_id,a_title,a_type from {pre}art where a_id="&vid,"rs1")
				if rs1.eof and rs1.bof then 
					writeA "该数据已经被删除"
				else
					writeA rs1("a_title")
				end if
			else
				set rs1 = objdb.DB("select d_id,d_name,d_type from {pre}vod where d_id="&VID,"rs1")
				if rs1.eof and rs1.bof then 
					writeA "该数据已经被删除"
				else
					writeA rs1("d_name")
				end if
			end if
      %>
      </td>
      <td><%=rs("c_time")%></td>
      <td><%=rs("c_ip")%></td>
      </tr>
      <%
      	rs.MoveNext
	  	next
	  	end if
	%>
	<tr>
	<td colspan="7">全选<input type="checkbox" name="chkall" id="chkall" class="checkbox" onClick="checkAll(this.checked,'c_id')" />
	&nbsp;<input type="button" id="btnDel" value="批量删除" class="input" />
	</td></tr>
    <tr align="center">
      <td colspan="7">
	   <%=pagelist_manage(rs.PageCount,pagenum,rs.RecordCount,app_pagenum,"admin_comment.asp?page={p}")%>
       </td>
    </tr>
	<%
	objdb.c(rs1)
	objdb.c(rs)
end sub
%>