<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p07")
'''''''''''''''''''''''''''''''''''''''''''''''
const recpage=10
dim i,ischeck,isrem
if not isempty(request("page")) then 
currentpage=Clng(request("page"))
else currentpage=1
end if
if not isempty(request.queryString("ischeck")) then 
ischeck=Cint(request.queryString("ischeck"))
else ischeck=0
end if
if not isempty(request.queryString("isrem")) then 
isrem=Cint(request.queryString("isrem"))
else isrem=-1
end if
%>
<html>
<head>
<title>查看评论</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
}
.red{ font-size:12px; color:#F00;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="?ischeck=<%=ischeck%>&isrem=<%=isrem%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href(gourl);
}</script>
<script language="JavaScript" type="text/JavaScript">

function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
</script>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>

<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<div align="left">·<a href="?ischeck=1&isrem=-1">已审核</a>　·<a href="?ischeck=0&isrem=-1">未审核</a>·<a href="?ischeck=-1&isrem=1">推荐评论</a></div>
<form action="commen_do.asp" method="post" style="margin:0px;">
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="6"><div align="center" class="style1">◆ 评论管理 ◆</div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="7%" height="22" bgcolor="#EEEEEE"><div align="center">id</div></td>
    <td width="49%" bgcolor="#EEEEEE"><div align="center">文章标题</div></td>
    <td width="18%" bgcolor="#EEEEEE"><div align="center">用户IP</div></td>
    <td width="9%" bgcolor="#EEEEEE"><div align="center">用户名</div></td>
    <td width="10%" bgcolor="#EEEEEE"><div align="center">时间</div></td>
    <td width="7%" bgcolor="#EEEEEE"><div align="center">删除</div></td>
  </tr>
  <!-- 开始按行循环----------------------->
  <%
  	sql="select count(*) AS co from commen AS cm,news where cm.articleid=news.id"
		if(ischeck>=0) then
			sql=sql&" and cm.ischeck="&ischeck
		end if
		if(isrem>=0) then
			sql=sql&" and cm.isrem="&isrem
		end if
		set rs=server.createobject("adodb.recordset")
  	rs.open sql,conn,3,1
		allrec=rs("co")
		totalpage=int((allrec+recpage-1)/recpage)
		rs.close
		set rs=nothing
		set rs=server.createobject("adodb.recordset")
		sql="select top "&recpage&" cm.id AS cmid,cm.username AS cmusername,cm.userip,cm.content AS cmcontent,cm.moditime AS cmmoditime,cm.classid AS cmclassid,news.title,news.linkurl,cm.isrem from commen AS cm,news where cm.id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from commen where 1=1"
		if(ischeck>=0) then
			sql=sql&" and cm.ischeck="&ischeck
		end if
		if(isrem>=0) then
			sql=sql&" and cm.isrem="&isrem
		end if
		sql=sql&" order by commen.id desc) as t) and cm.articleid=news.id "
		if(ischeck>=0) then
			sql=sql&" and cm.ischeck="&ischeck
		end if
		if(isrem>=0) then
			sql=sql&" and cm.isrem="&isrem
		end if
		sql=sql&" order by cm.id desc "		
		rs.open sql,conn,3,1		
		do while not rs.eof
		'classname=conn.execute("select title from catalogs where id="&rs("classid"))(0)
	%>
  <tr>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=rs("cmid")%>
      <input type="checkbox" name="commenid" value=<%=rs("cmid")%>>
    </div></td>
    <td bgcolor="#FFFFFF"><div align="left"><a href="../<%=rs("linkurl")%>" target="_blank"><%=rs("title")%></a><%if(rs("isrem")=1) then response.Write(" <span class=""red"">[推荐]</span>") end if%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=rs("userip")%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=rs("cmusername")%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=rs("cmmoditime")%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="dele.asp?id=<%=rs("cmid")%>&table=commen" onClick="return ConfirmDel()">删除</a></div></td>
  </tr>
  <tr>
    <td height="22" colspan="6" bgcolor="#FFFFFF">评论内容:<%=rs("cmcontent")%></td>
  </tr>
  <%
    rs.movenext
	  i=i+1
	   if i>=recpage then 
		exit do
	   end if
	  loop
	 ' end sub
	  rs.close
	  set rs=nothing
  %>
  
  <tr>
    <td height="22" colspan="6" bgcolor="#FFFFFF"><div align="center">
      <input class=Button type="button" name="chkall" value="全选" onClick="CheckAll(this.form)">&nbsp;&nbsp;
      <input class=Button type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">&nbsp;&nbsp;
	  	<select name="acttype" id="acttype">
        <option value="del">删除</option>
        <option value="check">批量审核</option>
        <option value="uncheck">取消审核</option>
        <option value="rem">批量推荐</option>
        <option value="unrem">取消推荐</option>
      </select>
      <input class=Button type="submit" name="Submit2" value="执行==>" onClick="return confirm('您确定执行该操作吗?')">
    </div></td>
  </tr>
  <!--按行循环结束------------------------>
</table>
</form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div align="center">
      <form name="form1" method="post" action="" style="margin:0 0 0 0">
        <%n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='comm_man.asp?ischeck="&ischeck&"&isrem="&isrem&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='comm_man.asp?ischeck="&ischeck&"&isrem="&isrem&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
        <input type="hidden" name="hid" value="<%=totalpage%>">
        &nbsp;&nbsp;跳至
        <input name="page" type="text" size="5" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
        页
        <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
      </form>
    </div></td>
  </tr>
</table>
<script language="javascript">
function CheckAll(form) {  
	for (var i=0;i<form.elements.length;i++)  {  
		var e = form.elements[i];  
		if (e.name != 'chkall')  
		e.checked = true // form.chkall.checked;  
	}  
} 
 
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name != 'chkall')
		e.checked=!e.checked;
	}
}
</script>
</body>
</html>
<%
call connclose()
%>
