<%@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
Set ExComm=new Ex_CommonCls
	ExComm.IsAdLogin 
	ExComm.IsIpAllow
Dim ExFso
Set ExFso=new Ex_FsoCls
dim action
action=request.querystring("action")
select case action
case "del"
call del()
case "delmore"
call delmore()
case "show"
call show()
Case Else
Call show()
end select
 '***********************************
'生成最新留言内容js
'参数:无
'***********************************
sub RefreshMsg
	ExComm.ClearCaches(sn)
	Dim ExSkin
	Set ExSkin=new Ex_SkinCls
	ExSkin.RefreshSkinCache
	Set ExSkin=Nothing 
End Sub 
  sub del()
  dim id,strsql
  id=request.querystring("id")
  strsql="delete from Ex_message where id="&id
  Conn.execute(strsql)
  strsql="delete from Ex_message where parentid="&id
  Conn.execute(strsql)
  RefreshMsg
  Application.Lock
  Application(sn&"msgtotal")=Application(sn&"msgtotal")-1
  Application.Unlock
  ExComm.ClearCache(sn)
  ExComm.ShowMsg "留言删除成功！",request.servervariables("http_referer")
  end Sub
 Sub delmore()
  	Dim id,strsql,i
	id=request("message")
	id=Split(id,",")
	if Request.Form("dotype")="del" then 
		For i=0 To UBound(id)
  			strsql="delete from Ex_message where id="&id(i)
  			Conn.execute(strsql)
  			strsql="delete from Ex_message where parentid="&id(i)
  			Conn.execute(strsql)
		Next
		RefreshMsg
  		Application.Lock
  		Application(sn&"msgtotal")=Application(sn&"msgtotal")-1-ubound(id)
  		Application.Unlock
		ExComm.ClearCache(sn)
		ExComm.ShowMsg "留言删除成功！",request.servervariables("http_referer")
	else 
		For i=0 To UBound(id)
  			strsql="update Ex_message set isshow='是' where id="&id(i)
  			Conn.execute(strsql)
		Next
		ExComm.ClearCache(sn)
		ExComm.ShowMsg "审核成功！",request.servervariables("http_referer")
	end if 
  End sub
  sub show()
  Dim ExPages,page,Rs
  Set ExPages=new Ex_SplitPageCls
  Expages.letConn=Conn
  Expages.letColumns="select id,title,bits,submittime,reply,isshow"
  ExPages.letDataFrom="from Ex_message"
  ExPages.letWhere="where parentid=0"
  ExPages.letOrder="order by submittime desc"
  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()
 set rs=server.CreateObject("adodb.recordset")
 %>
 <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="4%" height="17" align="center" class="tdbg">选中</td>
    <td class="tdbg" width="36%" align="center">标题</td>
    <td class="tdbg" width="10%" align="center">点击次数</td>
    <td class="tdbg" width="17%" align="center">留言时间</td>
    <td class="tdbg" width="12%" align="center">是否审核</td>
    <td class="tdbg" width="10%" align="center">回复次数</td>
    <td class="tdbg" width="11%" align="center">操作</a></td>
  </tr>
  <%
  Set Rs=ExPages.GetRs
  If ExPages.GetRsCount<>0 Then
	Do While Not rs.eof
   %>
  <tr>
     <td class="tdbg" align="center"><INPUT TYPE="checkbox" NAME="message" value=<%=rs("id")%>></td>
    <td class="tdbg" width="36%" align="center"><a href="msgpost.asp?id=<%=rs("id")%>" target=_blank title="<%=Trim(rs("title"))%>"><%=Left(Trim(rs("title")),20)%></a></td>
    <td class="tdbg" width="10%" align="center"><%=rs("bits")%></td>
    <td width="17%" align="center" class="tdbg"><%=rs("submittime")%></td>
    <td width="12%" align="center" class="tdbg"><%=Rs("isshow")%></td>
    <td class="tdbg" width="10%" align="center"><%=rs("reply")%></td>
    <td class="tdbg" width="11%" align="center"><a href="Admin_Reply.asp?mc=2&id=<%=rs("id")%>">回复</a> | <a href="?action=del&id=<%=rs("id")%>" onClick="return confirm('确定删除?')">删除</a></td>
  </tr>
  <%rs.movenext
   loop%>
   <tr>
    <td class="tdbg" align="center"><INPUT TYPE="checkbox" NAME="chkAll" onclick=checkAll(this.form)></td>
    <td class="tdbg" width="36%" align="center">全部选取</td>
    <td class="tdbg" width="10%" align="center">操作：&nbsp;&nbsp;</td>
    <td colspan="2" align="center" class="tdbg">删除<INPUT NAME="dotype" TYPE="radio" value="del">
    审核
      <INPUT NAME="dotype" TYPE="radio" value="check"></td>
    <td class="tdbg" width="10%" align="center"><INPUT TYPE="submit" value="执行"></td>
    <td class="tdbg" width="11%" align="center">&nbsp;&nbsp;</td>
  </tr>
   <tr>
     <td colspan="7" align="center" class="tdbg"><%=ExPages.Show%></td>
    </tr>
</table>
</FORM>
  <%End if

end sub
  %>
</body>
</html>
