<!-- #include file="../conn.asp" -->
<!-- #include file="../cls_main.asp" -->
<!-- #include file="../cls_ishion_showPage.asp" -->
<% MyDbPath = "../"
dim obj
set obj = New admin_down_comment
	obj.AspInit()
set obj = nothing

Class admin_down_comment
	
	Private ID, sRs, ishion
	Private Sub Class_Initialize()
		Set ishion = New Cls_Main
	End Sub
	Private Sub Class_Terminate()
		Set ishion = Nothing
	End Sub
	Public Sub AspInit()
		Response.Write "<HTML><HEAD><TITLE>下载评论管理</TITLE>" & vbCrLf
		Response.Write "<META http-equiv=Content-Type content=""text/html; charset=gb2312"">" & vbCrLf
		Response.Write "<LINK href=""admin.css"" type=text/css rel=stylesheet>" & vbCrLf
		Response.Write "</HEAD>" & vbCrLf
		Response.Write "<BODY leftmargin=""3"" topmargin=""0"">" & vbCrLf

		ID = CLng(Request("ID"))
		Call ishion.LoadSetting
			
			If ishion.adminName = "" Then
				ishion.strMsg = "<li>非法操作：登录超时或你没有以管理员身份登录系统，<a href=""../admin_login.asp"" target=_top>点此进入管理员登录界面</a>。"
				Call ishion.SystemMsg
			ElseIf myPermission() = False Then
				ishion.strMsg = "<li>非法操作：你没有权限进行此项操作，请联系管理员！"
				Call ishion.SystemMsg
			Else
				Call Main
			End If
		Response.Write "</BODY></HTML>" & vbCrLf
	
	End Sub
	Private Function myPermission()
		myPermission = False
		If ishion.checkPermission(ishion.adminName, "11") Then myPermission = True: Exit Function
		If ishion.checkPermission(ishion.adminName, "12") Then myPermission = True: Exit Function
		'If ishion.checkPermission(ishion.adminName,"10") Then myPermission = False
	End Function
	Private Sub Main()
	
			If Trim(Request("action")) = "isBatchDel" Then
				Call isBatchDel
			Else
				Call show_comment
			End If
	End Sub
	Private Sub isBatchDel()
		Dim BatchID
		BatchID = Request.Form("commentid")
		If BatchID <> "" Then
			ishion.Execute ("delete from ishion_Down_Comment where ID in (" & BatchID & ")")
			ishion.strMsg = "<li>“批量删除”操作成功！</li>"
		Else
			ishion.strMsg = "<li>没有选择任何评论，本次操作被取消！</li>"
		End If
		Call ishion.SystemMsg
	End Sub
	Private Sub show_comment()
		Dim Rs, showPageRs, sql, i, sColumn, currentPage, q, strSQL
		
		If Request("keyword") <> "" Then
			q = "&keyword=" & ishion.checkStr(Trim(Request("keyword")))
			strSQL = "Content like '%" & ishion.checkStr(Trim(Request("keyword"))) & "%'"
		End If
		Response.Write "<table width=""100%"" border=""0"" cellpadding=""3"" cellspacing=""0"">"
		Response.Write "<form action=""admin_down_comment.asp"" method=""post"" name=""sForm""> "
		Response.Write " <tr>"
		Response.Write " <td height=""3""></td>"
		Response.Write " </tr>"
		Response.Write " <tr class=""tdbg2"">"
		Response.Write " <td><input name=""action"" type=""hidden"" id=""action"" value=""s"">"
		Response.Write " 评论搜索："
		Response.Write " <input name=""keyword"" type=""text"" value="""
		Response.Write ishion.checkStr(Request("keyword"))
		Response.Write """ size=""25"" maxlength=""100"">"
		Response.Write " <input type=""submit"" name=""Submit"" value=""搜索""></td>"
		Response.Write " </tr></form>"
		Response.Write "</table>"
		
		
		sColumn = "ID,ResourceID,ReTopic,Content,UserName,Email,SendMaster,isRead,dateandtime,Graded,IP"
		If Trim(Request.QueryString("Page")) = "" Then
			currentPage = 1
		Else
			currentPage = Trim(Request.QueryString("Page"))
		End If
		Set showPageRs =New Cls_ishion_showPage
		With showPageRs
			'.Conn=ConnStr      '得到数据库连接对象
			If IsSqlDataBase = 1 Then
			.DbType = "MSSQL"
			Else
			.DbType = "AC"
			End If
			'数据库类型,AC为access,MSSQL为sqlserver2000,MSSQL_SP为存储过程版,MYSQL为mysql,PGSQL为PostgreSql
			.RecType = 0
			'取记录总数方法(0执行count,1自写sql语句取,2固定值)
			.RecSql = 0
			'如果RecType＝1则=取记录sql语句，如果是2=数值，等于0=""
			.RecTerm = 1
			'取从记录条件是否有变化(0无变化,1有变化,2不设置cookies也就是及时统计，适用于搜索时候)
			.CookieName = "comment_down" & ID '如果RecTerm＝2,cookiesname="",否则写cookiesname
			.Order = 1              '排序(0顺序1降序),注意要和下面sql里面主键ID的排序对应
			.PageSize = Int(ishion.Setting(83))  '每页记录条数
			.currentPage = currentPage
			.sql = sColumn & "$ishion_Down_Comment$" & strSQL & "$SendMaster Desc,ID Desc$ID" '字段,表,条件(不需要where),排序(不需要需要ORDER BY),主键ID
		End With
		
		Dim iRecCount, sqlRs, no
		iRecCount = showPageRs.RecCount '记录总数
		If iRecCount < 1 Then
			Response.Write "Sorry！没有找到任何记录。"
		Else
			Set sqlRs = showPageRs.ResultSet   '返回ResultSet
				Rs = sqlRs.GetRows(Int(ishion.Setting(83)))
				'sColumn = "ID,ResourceID,ReTopic,Content,UserName,Email,SendMaster,isRead,dateandtime,Graded,IP"
			Response.Write "<form name=""form1"" method=""post"" action="""">" & vbCrLf
			Response.Write "<SCRIPT language = ""JavaScript"">" & vbCrLf
			Response.Write "//parent.frame.cols=""0,*"";" & vbCrLf
			Response.Write "function SelectAll() {" & vbCrLf
			Response.Write "    for (var i=0;i<document.myform.ID.length;i++) {" & vbCrLf
			Response.Write "        var e=document.myform.ID[i];" & vbCrLf
			Response.Write "        e.checked=!e.checked;" & vbCrLf
			Response.Write "    }" & vbCrLf
			Response.Write "}" & vbCrLf
			Response.Write "<!--" & vbCrLf
			Response.Write "function CheckAll(form)  {" & vbCrLf
			Response.Write "  for (var i=0;i<form.elements.length;i++)    {" & vbCrLf
			Response.Write "    var e = form.elements[i];" & vbCrLf
			Response.Write "    if (e.name != 'chkall')       e.checked = form.chkall.checked; " & vbCrLf
			Response.Write "   }" & vbCrLf
			Response.Write "  }" & vbCrLf
			Response.Write "//-->" & vbCrLf
			Response.Write "</script>" & vbCrLf
	
				For i = 0 To UBound(Rs, 2)
			Response.Write "<table width=""100%""  border=""0"" align=""center"" cellpadding=""3"" cellspacing=""0"">" & vbCrLf
			Response.Write "  <tr>" & vbCrLf
			Response.Write "    <td bgcolor=""#CCCCCC""></td>" & vbCrLf
			Response.Write "    <td height=""2"" bgcolor=""#CCCCCC""></td>" & vbCrLf
			Response.Write "  </tr>" & vbCrLf
			Response.Write "  <tr>" & vbCrLf
			Response.Write "    <td width=""28"" align=""center"" class=""tdbg1"">" & vbCrLf
			Response.Write "      <input type=""checkbox"" name=""commentid"" value=""" & Rs(0, i) & """></td>" & vbCrLf
			Response.Write "    <td class=""tdbg2"">" & Rs(8, i) & " 网友：" & Rs(4, i) & " 就 <a href=""" & Replace(ishion.Setting(77), "{$id}", Rs(1, i)) & """ target=""_blank"">" & Rs(2, i) & "</a> 发表评论　IP:" & Rs(10, i) & ""
			If Rs(8, i) = 1 Then Response.Write "　<font color=red>必读</font>"
			Response.Write "</td>" & vbCrLf
			Response.Write "  </tr>" & vbCrLf
			Response.Write "  <tr>" & vbCrLf
			Response.Write "    <td width=""28"" background=""../images/bg_dot.gif""></td>" & vbCrLf
			Response.Write "    <td height=""1"" background=""../images/bg_dot.gif""></td>" & vbCrLf
			Response.Write "  </tr>" & vbCrLf
			Response.Write "  <tr>" & vbCrLf
			Response.Write "    <td height=""3"" colspan=""2""></td>" & vbCrLf
			Response.Write "  </tr>" & vbCrLf
			Response.Write "  <tr>" & vbCrLf
			Response.Write "    <td width=""28"">&nbsp;</td>" & vbCrLf
			Response.Write "    <td>" & ishion.HTMLEncode1(Rs(3, i)) & "</td>" & vbCrLf
			Response.Write "  </tr>" & vbCrLf
			Response.Write "  <tr>" & vbCrLf
			Response.Write "    <td width=""28""></td>" & vbCrLf
			Response.Write "    <td><table width=98% border=0 align=""center"" cellpadding=0 cellspacing=0>" & vbCrLf
			Response.Write "      <tr>" & vbCrLf
			Response.Write "        <td width=748 height=""5""></td>" & vbCrLf
			Response.Write "      </tr>" & vbCrLf
			Response.Write "    </table></td>" & vbCrLf
			Response.Write "  </tr>" & vbCrLf
			Response.Write "</table>" & vbCrLf
				Next
			Response.Write "<table width=""100%"" border=""0"" cellpadding=""3"" cellspacing=""1"">"
			Response.Write " <tr class=""tdbg2"">"
			Response.Write " <td><input type=checkbox name=chkall value=on onclick=""CheckAll(this.form)"" id=""chkall""><label for=""chkall"">全选</label>"
			Response.Write " <input type=""radio"" name=""action"" value=""isBatchDel"" checked>批量<font color=red>删除</font>"
			Response.Write " <input type=""submit"" name=""Submit"" value=""执行操作"" onclick=""{if(confirm('您确定执行的操作吗?')){this.document.myform.submit();return true;}return false;}""></td>"
			Response.Write " </tr>"
			Response.Write "</table>"
			Response.Write "</form>" & vbCrLf
				Rs = Null
			Set sqlRs = Nothing
			
			Response.Write showPageRs.showPage("?Page={$pages}" & q)
		
		End If	
		Set showPageRs = Nothing		
	End Sub
	
	Public Sub OnEndPage()
		Response.Write ishion.CopyRight
	End Sub ' OnEndPage

End Class %>

