<!--#include file="../../fy.Function.asp"-->
<!--#include file="../../../fy_inc/cls_pageview.asp"-->
<!--#include file="../../../editor/index.asp"-->
<!doctype html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>digg管理</title>
<link rel="stylesheet" type="text/css" href="../../css/base.css">
<link rel="stylesheet" type="text/css" href="../../css/content.css">
</head>
<body>
<div class="content"> 
	  <%
	If Not fycms.fycms_QXYZ(0,"digg_fy","") Then   Call fycms.Alert("对不起，你没有操作权限！","") 
	With Response
	Dim ShowErr,ModeID,ModeName
	ModeID = ChkNumeric(Request("ModeID"))
	if ModeID=0 or ModeID="" Then ModeID=1
	ModeName= fycms.ACT_C(ModeID,1) 
	Dim strLocalUrl
	strLocalUrl = request.ServerVariables("SCRIPT_NAME")
	Dim intPageNow
	intPageNow = request("page")
	Dim intPageSize, strPageInfo
	intPageSize = 20
	Dim arrinfo, i
	Dim sql, sqlCount,Sqls,pages
	pages = "ModeID="&ModeID&"&page"
	IF Request.QueryString("Action") = "del" Then
	Dim ID:ID = Request("ID")
		IF ID = "" Then
			Call fycms.ActErr("请指定要删除的ID","","1")
			Response.end
		End If
	 Dim digge,Diggs
	ID = Split(ID,",")
	For I = LBound(ID) To UBound(ID)
		Set Digge=fycms.ACTEXE("Select digg,NewsID from Digg_fy where ID="&ID(I)&"")
		If Not Digge.eof Then 
			If digge("digg")="1" Then Diggs="digg" Else diggs="down"
			fycms.ACTEXE("Update "&fycms.ACT_C(ModeID,2)&" set "&Diggs&"="&Diggs&"-1 where ID = "&digge("NewsID")&"")
	    End If 
		fycms.ACTEXE("delete from Digg_fy where ID="&ID(I)&"")
	Next 
		Call fycms.ActErr("删除成功","Sys_fy/Digg/Index.asp","")
 		Response.end
	End IF
	sql = "SELECT [ID], [IP], [NewsID], [DiggTime], [Digg], [users],  [ModeID]" & _
		" FROM [Digg_fy] Where ModeID="&clng(ModeID)&Sqls& _
		" ORDER BY [ID] DESC"
	sqlCount = "SELECT Count([ID])" & _
			" FROM [Digg_fy] Where ModeID="&clng(ModeID)&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
	 %><div class="breadnav">当前位置：<a href="#">后台首页</a> >> 模型管理</div>
    <div class="opers">
    	<a href="?" class="btn">Digg管理</a>
			<%
	Dim MX_Sys,ii
	MX_Sys=fycms.Act_MX_Sys_Arr()
	If IsArray(MX_Sys) Then
		For iI=0 To Ubound(MX_Sys,2)
		echo "<a href=""?ModeID="&MX_Sys(0,Ii)&""" class=""btn"">"&MX_Sys(1,Ii)&"系统</a>  " 
		Next
	End If
	%>
    </div>
 <form name="Article" id="Article" method="post" action="?Action=">
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
      <th>选中</th>
	  <th>ID</th>
	  <th>文章标题</th>
	  <th>DIGG用户</th>
	  <th>Digg时间</th>
	  <th>Digg行为</th>
	  <th>IP</th>
	  </tr>
    </thead>
      <%
		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  ><a target="_blank" href="<%
	 .write  fycms.actsys&"List.asp?C-"&ModeID&"-"&arrinfo(2,i)
	%>"><%
	
	Dim AName
	Set AName=fycms.ACTEXE("Select title from  "&fycms.ACT_C(ModeID,2)&"  where ID = "& arrinfo(2,i))
	If Not Aname.eof Then 
		echo Aname("title")
	Else
		echo "<font color=red>该文章已被删除</font>"
	End If 
 %></a>&nbsp;<%
	  %></td>
      
	  <td >
	  <%
		If Trim(arrinfo(5,i))<>"" Then 
			echo "<font color=green>"&arrinfo(5,i)&"</font>"
		Else
			echo "<font color=red>游客</font>" 
		End If 
%></td>
  
      <td><%= arrinfo(3,i) %></td>
	 
      <td><%If arrinfo(4,i)="1" Then echo "<font color=green>支持</font>" Else echo "<font color=red>反对</font>"%></td>
	   
      <td><%=arrinfo(1,i)%></td>
    </tr>
	<% 
	Next
	End If
	%>
    <tr >
      <td height="30" colspan="11" class="tl">
<input name="ChkAll" type="checkbox" id="ChkAll" onClick="CheckAll(this.form)" value="checkbox">
		<label for="chkAll">&nbsp;选中本页显示的所有文章</label>
	  <input type="button" class="btn btn_primary" name="Submit" value="批量删除"  onClick="delpost()"> 
	  删除的同时会减少文章的相关DIGG记录</td>
    </tr>
    </table></form>
    <div class="pagelist">
    	<%= strPageInfo%>
   </div>

   <script language="javascript">


function CheckAll(form)
		  {  
		 for (var i=0;i<form.elements.length;i++)  
			{  
			   var e = Article.elements[i];  
			   if (e.name != 'ChkAll'&&e.type=="checkbox")  
			   e.checked = Article.ChkAll.checked;  
		   }  
	  }

	
function delpost(){
    document.Article.method="post";
    document.Article.action="Index.asp?ModeID=<%=ModeID%>&Action=del";
{
	if(confirm('确认要删除选中的Digg吗?注意删除并不会删除文章')){
	this.document.Article.submit();
	return true;}return false;
}
	}
</script>


<% End With

CloseConn 
%>
</div>
</body>
</html>
