<!--#include file="../fy.Function.asp"-->
<!--#include file="../../fy_inc/cls_pageview.asp"-->
<!--#include file="../include/fy.F.asp"-->
<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>评论管理</title>
<link rel="stylesheet" type="text/css" href="../css/base.css">
<link rel="stylesheet" type="text/css" href="../css/content.css">
</head>
<body>
<% 
		Dim ShowErr,ID,ModeID
	 ModeID = ChkNumeric(Request("ModeID"))
	 if ModeID=0   Then ModeID=1
		If Not fycms.fycms_QXYZ(ModeID,"","") Then   Call fycms.Alert("对不起，您没有"&fycms.ACT_C(ModeID,1)&"系该项操作权限！","")

	ID = ChkNumeric(Request.QueryString("ID"))
		IF Request.QueryString("Action") = "UnLock" Then'置顶
			Conn.execute("Update Comment_fy set Locked=0 where ID ="&ID&"")
			set conn=nothing
			Response.Redirect("?")
		End IF
		
		IF Request.QueryString("Action") = "Lock" Then'置顶
			Conn.execute("Update Comment_fy set Locked=1 where ID ="&ID&"")
			set conn=nothing
			Response.Redirect("?")
		End IF
		IF Request.QueryString("Action") = "del" Then'置顶
			dim Sqlbook,rs
			Set rs=fycms.actexe("select acticleID,ModeID from Comment_fy Where ID=" & ID)
			If Not rs.eof Then 
				fycms.ACTEXE("Update "&fycms.ACT_C(rs("ModeID"),2)&"  Set commentscount=commentscount-1 Where ID=" & rs("acticleID") & "")
				Conn.Execute ("Delete from Comment_fy Where ID=" & ID)		
				set conn=Nothing
			End If 
  			 Call fycms.ActErr("评论已经删除！","fy_Mode/fy.Book.asp","")
		End IF
	


		IF Request.QueryString("Action") = "alldel" Then'单一删除
			ID = Request.Form("ID")
			IF ID = "" Then
				ShowErr = "请先选定评论！"
				Call fycms.ActErr(ShowErr,"","1")
				Response.End
			End IF		
			ID = Split(ID,",")
			 For I = LBound(ID) To UBound(ID)
				Conn.execute("Delete from Comment_fy  Where ID=" & ID(I) & "")
			Next
				set conn=nothing	
				ShowErr = "评论已经删除！"
  				 Call fycms.ActErr(ShowErr,"fy_Mode/fy.Book.asp","")
	  End IF

	Dim strLocalUrl
	strLocalUrl = request.ServerVariables("SCRIPT_NAME")
	
	Dim intPageNow
	intPageNow = request.QueryString("page")
	
	Dim intPageSize, strPageInfo
	intPageSize = 20
	
	Dim arrinfo, i
	Dim sql, sqlCount,Sqls,pages
	pages = "Type="&Request("Type")&"&ModeID="&ModeID&"&page"
	Select Case Request.QueryString("Type")
		Case "Lock"
			Sqls = " Where ModeID = "&ModeID&" And Locked = 1 "
		Case "UnLock"
			Sqls = " Where ModeID = "&ModeID&" And Locked = 0 "
		Case Else
			Sqls = " Where ModeID = "&ModeID&" "
	End Select
	sql = "SELECT [ID], [ModeID], [Content], [AddDate],[Locked],[UserIP],[ClassID],[acticleID]" & _
		" FROM [Comment_fy]" &Sqls& _
		"ORDER BY [ID] DESC"
  	sqlCount = "SELECT Count([ID])" & _
			" FROM [Comment_fy]  " &Sqls

		Dim clsRecordInfo
		Set clsRecordInfo = New Cls_PageView
			clsRecordInfo.intRecordCount = 2816
			clsRecordInfo.strSqlCount = sqlCount
			clsRecordInfo.strSql = sql
			clsRecordInfo.intPageSize = intPageSize
			clsRecordInfo.intPageNow = intPageNow
			clsRecordInfo.strPageUrl = strLocalUrl
			clsRecordInfo.strPageVar = pages
		clsRecordInfo.objConn = Conn		
		arrinfo = clsRecordInfo.arrinfo
		strPageInfo = clsRecordInfo.strPageInfo
		Set clsRecordInfo = nothing
	 %><form name="Article" method="post" action="?Action="><div class="content"> 
	<div class="breadnav">当前位置：<a href="#">后台首页</a> >> 模型管理</div>
    <div class="opers">
    	选择模型:<select name='ModeID' style='width:110px' onChange="location=this.value;">
  <%=AF.ACT_URL_Mode(ModeID,"")%>
  </select>

  评论选项：<a href="?">所有评论</a>   
  <a href="?Type=Lock" class="btn<%If Request("Type")="Lock" Then echo " btn_primary" %>">已审核</a>  
  <a href="?Type=UnLock"class="btn<%If Request("Type")="UnLock" Then echo " btn_primary" %>">未审核</a>
    </div>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
      <th>选中</th><th>ID</th><th>评论内容</th><th>发表时间</th><th>IP</th><th>审核与否</th><th>常规管理操作</th>
	  </tr>
    </thead>
	 <%
		Dim bgColor
		If IsArray(arrinfo) Then
			For i = 0 to UBound(arrinfo, 2)
	%>
    <tr >
      <td>
	  <input type="checkbox" name="ID" value="<%= arrinfo(0,i) %>">	  </td>
      <td><%= arrinfo(0,i) %></td>
      <td class="td_bg" ><a target="_blank" href="<%=fycms.Domain&"plus/Comment/index.asp?ModeID="&arrinfo(1,i)&"&ClassID="&arrinfo(6,i)&"&ID="&arrinfo(7,i)%>"><%=arrinfo(2,i)%></a></td>
      <td class="td_bg" ><%= arrinfo(3,i) %></td>
      <td>
	  <a  href="http://www.fycms.com/ip.asp?ip=<%= arrinfo(0,i) %>"  target="_blank"><%= arrinfo(5,i) %></a>
	</td>
      <td>
	 	<% IF arrinfo(4,i) = 1 Then echo "<font color=red>&nbsp;&nbsp;已审核&nbsp;&nbsp;</font>" Else echo "<font color=#0000FF>&nbsp;&nbsp;未审核&nbsp;&nbsp;</font>"%>	  </td>
      <td>
	  <a href="?Action=del&id=<%= arrinfo(0,i) %>" onClick="return confirm('确认删除此评论吗?')">删除</a>
	┆<% if arrinfo(4,i) = 0 Then %>
	  <a href="?Action=Lock&id=<%= arrinfo(0,i) %>">通过审核</a> 
   <% ELse
   	%> <a title="解除置顶" href="?Action=UnLock&id=<%= arrinfo(0,i) %>">取消审核</a> 
	<%
	 end if%>	  </td>
    </tr>
	<% 
	Next
	End If
	%>



	   <tr >
      <td colspan="8" class="tl">
	 <label for=chk>
		<input id="chk" type="checkbox" name="chkall" value="checkbox" onClick="CheckAll(this.form)">选择全部评论</label>
	&nbsp;&nbsp;&nbsp;  <input type="button" Class="btn btn_primary" name="yd" value="批量删除" onClick="delpost()"></td>
    </tr>



	</table>
    <div class="pagelist">
<%= strPageInfo%>
   </div>
   </form>
</div>
<script type="text/javascript">
<!--
	function delpost(){
    document.Article.method="post";
    document.Article.action="?Action=alldel";
{
	if(confirm('确认要删除选中的评论吗?')){
	this.document.Article.submit();
	return true;}return false;
}
	}
function CheckAll(form)  
  {  
 for (var i=0;i<form.elements.length;i++)  
    {  
    var e = Article.elements[i];  
   if (e.name != 'chkall')  
      e.checked = Article.chkall.checked;  
   }  
  }
//-->
</script>
</body>
</html>
