<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!--#include file="Ex_Cls/Ex_SkinCls.asp"-->
<!--#include file="Ex_Cls/Ex_SplitPageCls.asp"-->
<!--#include file="Ex_Cls/Ex_RefreshCls.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css"> 
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor">
<script language="JavaScript">
function unselectall()
{
    if(document.myform.chkAll.checked){
	document.myform.chkAll.checked = document.myform.chkAll.checked&0;
    } 	
}

function checkAll(form)
{
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
}
</script>
<%
Dim ExComm,ExFso,ExSkin
Set ExComm=new Ex_CommonCls
	ExComm.IsAdLogin 
	ExComm.IsIpAllow
Set ExFso=new Ex_FsoCls
Set ExSkin=new Ex_SkinCls
Dim action 
 action=request.querystring("action")
 Select Case action
 case  "show"
 Call show()
 case "del"
 Call del()
 Case "delmore"
 Call delmore()
 case "comment"
 call comment()
 Case Else
 Call show()
 End select%>
 <%
 '*****************************
'及时生成日志信息静态页
'参数:日志id
'****************************
Function CreateLOG(id)
	ExComm.ClearCaches(sn)
	Dim ExSkin
	Set ExSkin=new Ex_SkinCls
	ExSkin.RefreshSkinCache
	Set ExSkin=Nothing 
End Function
 Sub show()
  Dim ExPages,page,Rs,IsShow
  Set ExPages=new Ex_SplitPageCls
  Expages.letConn=Conn
  Expages.letColumns="select id,cmttitle,username,addip,addtime,parentid,isshow"
  ExPages.letDataFrom="from Ex_comment"
  ExPages.letOrder="order by addtime desc"
  Set rs=server.CreateObject("adodb.recordset")
  Expages.letPageSize="15"
  If ExComm.G(request("page"))="" Then
	page=1
  Else
	page=ExComm.G(request("page"))
  End if
  ExPages.letPage=CInt(page)
  ExPages.letStrPage=""
  ExPages.Execute()
  %>
  <FORM METHOD=POST ACTION="?action=delmore">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr>
      <th class="topbg" colspan="7">日志评论管理</th>
    </tr>
	<tr>
	  <td width="9%" class="tdbg">选中</td>
      <td width="23%" class="tdbg">标题</td>
      <td width="12%" class="tdbg">作者</td>
      <td width="19%" class="tdbg">ip地址</td>
      <td width="19%" class="tdbg">添加时间</td>
      <td width="9%" class="tdbg"><div align="center">是否审核</div></td>
      <td width="9%" class="tdbg">操作</td>
    </tr>
    <%
	Set Rs=ExPages.getRs()
    If ExPages.getRsCount<>0 Then
       Do While Not rs.eof
		IsShow=Rs("IsShow")
	%>
    <tr>
	<td class="tdbg"><INPUT TYPE="checkbox" NAME="comment" value="<%=rs("id")%>|<%=IsShow%>"></td>
      <td class="tdbg"><a href="blogview.asp?id=<%=rs("parentid")%>&cmtid=<%=rs("id")%>" target=_blank title=<%=rs("cmttitle")%>><%=Left(rs("cmttitle"),10)%></a></td>
      <td class="tdbg" title=<%=rs("username")%>><%=Left(rs("username"),5)%></td>
      <td class="tdbg"><%=rs("addip")%></td>
      <td class="tdbg"><%=rs("addtime")%></td>
      <td class="tdbg"><%=IsShow%></td>
      <td class="tdbg"><a href="Admin_Reply.asp?mc=1&id=<%=rs("id")%>">回复</a> | <a href="?action=del&id=<%=rs("id")%>" onClick="return confirm('是否删除?')">删除</a></td><!--添加回复功能连接 modify by Hotlion at 08-03-31-->
    <%rs.movenext
  Loop%>
  <tr>
      <td class="tdbg"><INPUT TYPE="checkbox" NAME="chkAll" onclick=checkAll(this.form)></td>
      <td class="tdbg">全部选择</td>
      <td class="tdbg">操作：&nbsp;</td>
      <td class="tdbg">删除<INPUT NAME="dotype" TYPE="radio" value="del">
      审核
      <input type="radio" name="dotype" value="check"></td>
      <td colspan="2" class="tdbg"><INPUT TYPE="submit" value="执行"></td>
      <td class="tdbg">&nbsp;&nbsp;</td>
   </tr>
  <tr>
    <td colspan="7" class="tdbg" align="center"><%=ExPages.Show%></td>
    </tr>
  <%
  End if
  %>
  </table>
  </FORM>
  <%End Sub %>
<%Sub del()
Dim id,strsql,parentid
id=request.querystring("id")
parentid=Conn.execute("select parentid from Ex_comment where id="&id)(0)
Conn.execute("update Ex_log set cmt=cmt-1 where id="&parentid)
strsql="delete from Ex_comment where id="&id
Conn.execute(strsql)
Application.lock
Application(sn&"cmttotal")=Application(sn&"cmttotal")-1
Application.unlock
CreateLOG parentid
ExComm.ShowMsg "删除成功",request.servervariables("http_referer")
End sub

Sub delmore()
	Dim id,strsql,parentid,i,tid
	id=request("comment")
	id=Split(id,",")
	if Request.Form("dotype")="del" then 
		For i=0 To UBound(id)
			tid=Replace(id(i),"|是","")
			Tid=Replace(Tid,"|否","")
			Set parentid=Conn.execute("select parentid from Ex_comment where id="&Tid) 'Modify by Hotlion at 2009-2-5
			Conn.execute("update Ex_log set cmt=cmt-1 where id="&parentid(0))
			strsql="delete from Ex_comment where id="&Tid 'Modify by Hotlion at 2009-2-5
			CreateLOG parentid(0)
			Conn.execute(strsql)
		Next
		
		'更新缓存
		Application.lock
		Application(sn&"cmttotal")=Application(sn&"cmttotal")-1-UBound(id)
		Application.unlock
		ExComm.ShowMsg "删除成功",request.servervariables("http_referer")
	else 
		For i=0 To UBound(id)
			If InStr(id(i),"否")<>0 Then 
				Set parentid=Conn.execute("select parentid from Ex_comment where id="&Replace(id(i),"|否",""))
				Conn.execute("update Ex_log set cmt=cmt+1 where id="&parentid(0))
				strsql="update Ex_comment set isshow='是' where isshow='否' and id="&Replace(id(i),"|否","")
				CreateLOG parentid(0)
				Conn.execute(strsql)
			End If 
		Next
		ExComm.ShowMsg "审核成功",request.servervariables("http_referer")
	end if 
  End sub%>
</body>
</html>
