<!--#include file="admin_cook.asp"-->
<!--#include file="../conn.asp"-->
<!--#include file="inc/page_class.asp"-->
<!--#include file="inc/Function.asp"-->
<!--#include file="admin_checkes.asp"-->
<HTML>
<HEAD>
<TITLE>留言管理 - 管理页面</TITLE>
<LINK href="images/Style.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2900.5512" name=GENERATOR>
</HEAD>
<BODY bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0>
<BR style="OVERFLOW: hidden; LINE-HEIGHT: 3px">
<script language="javascript">
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; 
  }
}
function CheckOne()
{   
	var   flag=false;   
	var   ID=document.getElementsByName("rz_ID");   
	for(i=0;i<ID.length;i++)
	{   
		if (ID(i).checked)
		{   
			flag=true;   
			break;   
		}   
	}   
	if (!flag)   
	{     
	  alert('请至少选择一条记录！');
	  return false;   
	}      
}   
</script>
<%
action=request("act")
select case action
case "del":
call del()
case "editcat":
call editcat()
case "editokcat": 
call editokcat()
end select
%>
<table width="86%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  <tbody>
    <tr>
      <th width="16%">选择</th>
      <th width="16%">留言编号</th>
      <th colspan="2">留言姓名</th>
      <th colspan="2">留言内容</th>
    </tr>
    <%
'===========================分页设置===========================
Sql = "select * from pinglun where lyid order by rz_hftime desc"
set rs1=Server.CreateObject("ADODB.RecordSet")
rs1.Open sql,conn,1,1
Dim Obj_CreatePage
Set Obj_CreatePage = New Impression_Page
'/*得到数据连接对象*/
Obj_CreatePage.GetConn = conn
'/*得到Sql查询语句*/
Obj_CreatePage.GetSQL = Sql
'/*设置每页显示条数*/
Obj_CreatePage.PageSize = 20
'/*分页导航(1为有数字,2为无数字)*/
Obj_CreatePage.Page_NavType = 2
'/*分页的文件地址,可提前构造好,支持多参数传递!*/
Obj_CreatePage.File_Path = "liuyan.asp?act=manage&"
Set RS1 = Obj_CreatePage.GetRs()
If Not(RS1.Bof and RS1.Eof) Then
For I = 1 to Obj_CreatePage.PageSize
If RS1.Eof Then
	Exit For
End If
%>
  </tbody>
  <form action="?act=del" method="post" name="delform" id="delform">
    <tr>
      <td align="center" class="TableRow2"><input type="checkbox" name="rz_ID" value="<%=rs1("rz_ID")%>" style="border:0px;" /></td>
      <td align="center" class="TableRow2"><%=rs1("rz_id")%></td>
      <td colspan="2" align="center" class="TableRow2"><%=rs1("rz_hfname")%></td>
      <td width="29%" align="left" class="TableRow2">·<%=gotTopic(rs1("rz_hfcontent"),30)%></td>
      <td width="7%" align="left" class="TableRow2"><input class=button onClick="javascript:location.href='?act=editcat&id=<%=rs1("rz_id")%>'" type=button value=回复 name=Submit12></td>
    </tr>
	  <%
'******************上面是你要显示的******************'
RS1.MoveNext
Next
%>
    <tr>
      <td align="center" class="TableRow2">&nbsp;</td>
      <td align="center" class="TableRow2">&nbsp;</td>
      <td width="13%" align="center" class="TableRow2"><input type="checkbox" name="chkall" id="chkall" onClick="CheckAll(this.form);" style="border:0px;" />
全选</td>
      <td width="19%" align="center" class="TableRow2"><input name="image" type="image" style="width:94px; height:20px; border:0px;" onClick="return CheckOne();" src="../image/del_all.jpg" /></td>
      <td colspan="2" align="center" class="TableRow2">&nbsp;</td>
    </tr>
  </form>

  <tr>
    <td colspan="6" align="middle" class="TableRow2"><%Obj_CreatePage.Page_Navigation()%>    </td>
  </tr>
  <%
Set Obj_CreatePage = Nothing
Else
%>
  <tr>
    <td colspan="12" align="middle" class="TableRow2"> 当前还没有添加留言 </td>
  </tr>
  <%End If%>
  <tr>
    <td colspan="2"></TBODY></td>
  </tr>
</table>
 
<%
sub del()
rz_ID=request("rz_ID")

if rz_ID="" then 
	response.Redirect(request.servervariables("HTTP_REFERER"))
	response.End
end if

for each ss in request("rz_ID")
	sql="select * from pinglun Where rz_ID ="&ss
	set rs=createobject("adodb.recordset")
    rs.open sql,conn,3,3
	if not rs.eof then
		rs.delete
		rs.update
	else
	  rs.close
      set rs=nothing
    end if
next
Succeed("<li>删除留言成功</li>")
response.End
end sub
sub editcat()
sql="select * from pinglun where rz_id="&request.QueryString("id")
set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
%>
<TABLE width="100%" border=0 align=center cellPadding=3 cellSpacing=1 class=tableBorder>
  <FORM name="form" action="?act=editokcat&id=<%=rs("rz_id")%>" method=post>
    <TBODY>
      <TR>
        <TH colSpan=2>查看修改留言</TH>
      </TR>
      <TR>
        <TD class=TableRow1 align=right>姓名：</TD>
        <TD align=left class=TableRow1><%=rs("rz_hfname")%></TD>
      </TR>
      <TR>
        <TD class=TableRow1 align=right>电话：</TD>
        <TD align=left class=TableRow1><%=rs("rz_tel")%>;</TD>
      </TR>
      <TR>
        <TD class=TableRow1 align=right>邮箱：</TD>
        <TD align=left class=TableRow1><%=rs("email")%></TD>
      </TR>
      <TR>
        <TD class=TableRow1 align=right>地址：</TD>
        <TD align=left class=TableRow1><%=rs("adder")%></TD>
      </TR>
      <TR>
        <TD class=TableRow1 align=right width="30%">内容：</TD>
        <TD align=left class=TableRow1><label>
          <textarea name="textarea" cols="50" rows="5"><%=rs("rz_hfcontent")%>
          </textarea>
        </label></TD>
      </TR>
      <TR>
        <TD class=TableRow1 align=right>回复内容：</TD>
        <TD align=left class=TableRow1><label>
          <textarea name="adminmsg" cols="50" rows="5"><%=rs("adminmsg")%></textarea>
        </label></TD>
      </TR>
      <TR>
        <TD class=TableRow2 align=middle colSpan=2><div align="center">
          <INPUT class=button type=submit value=" 回 复 " name=Submit5>
          <INPUT class=button type=reset value=" 重 填 " name=Submit25>        
        </div></TD>
      </TR>
  </FORM>
</TBODY>
</TABLE>
<%
set rs=nothing
end sub
sub editokcat()
call EditCat()
rz_id=Request.Form("id")
sql="select * from pinglun where rz_id="&request.QueryString("id")
set rs=server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,3
rs("adminmsg")=Request.Form("adminmsg")
rs.Update
rs.Close
set rs=nothing
conn.Close
set conn=nothing
Succeed("<li>回复成功！</li>")
end sub
%>