<%@language=vbscript codepage=936 %>
<%
response.buffer=true	
Const PurviewLevel=2
%>
<!--#include file="inc/conn1.asp"-->
<!--#include file="inc/Conn_User.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="Admin_ChkPurview.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/ubbcode.asp"-->

<%
dim Action
Action=Trim(request("Action"))
const ChannelID=3
Const ShowRunTime="Yes"
SkinID=0
MaxPerPage=12
dim UserID
CommentID=trim(request("CommentID"))
userID=trim(request("userid"))
if CommentID="" then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>请指定CommentID</li>"
	call WriteErrMsgs()
	response.end
else
	CommentID=Clng(CommentID)
end if

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language=JavaScript>

function check(thisform)
{
   if(thisform.ReplyContent.value==""){
		alert("回复内容不能为空！")
		 thisform.ReplyContent.focus()
		  return(false) 
	  }
}
</script>
<link href="new/css.CSS" rel="stylesheet" type="text/css">
<style type="text/css">
BODY {
	margin-left: 8px;
	margin-top: 0px;
	margin-right: 8px;
	margin-bottom: 8px;
}
</style></head>


<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1" bgcolor="#D6D5D9"></td>
    <td height="34" align=left bgcolor="#F8F8F9"><table width="100%">
      <tr>
        <td width="80"><strong>&nbsp;&nbsp;管理导航：</strong></td>
        <td><a href="admin_guest.asp">留言管理</a></td>
      </tr>
    </table></td>
    <td width="1" bgcolor="#D6D5D9"></td>
  </tr>
  <tr>
    <td width="1" bgcolor="#F8F8F9"></td>
    <td height="1" bgcolor="#D6D5D9" ></td>
    <td width="1" bgcolor="#F8F8F9"></td>
  </tr>
</table>
<table width="100%" height="8" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<%
if Action="Modify" then
	call Modify()
elseif Action="SaveModify" then
	call SaveModify()
elseif Action="Del" then
	call DelComment()
elseif Action="Del2" then
	call DelComment2()
elseif Action="Reply" then
	call Reply()
elseif Action="SaveReply" then
	call SaveReply()
else
	call main()
end if

%>
<%
dim CommentID
dim rsComment,sqlComment
sqlComment="select * from usercomment where CommentID=" & CommentID & " "
Set rsComment= Server.CreateObject("ADODB.Recordset")
rsComment.open sqlComment,conn,1,1
%>
<% if FoundErr=false then%>

  <table width="100%" height="25" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="f2f2f2" class=3>
    <tr>
      <td height="25" align="left"><div align="center"><font class=en><b>-- 回复留言 -- </b></font></div></td>
    </tr>
  </table>
  <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC"  >
  <form action="admin_UserGbookH.asp?userid=<%=userid%>" method="post" name="form" id="form" onSubmit="return check(form)">
    <tr>
      <td width="70" align="right" bgcolor="#FFFFFF" class="tdbg">留言用户：</td>
      <td bgcolor="#FFFFFF" class="tdbg"><%=rsComment("UserName")%></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#FFFFFF" class="tdbg">留言内容：</td>
      <td bgcolor="#FFFFFF" class="tdbg"><%=ubbcode(dvHTMLEncode(rsComment("Content")))%></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#FFFFFF" class="tdbg">回复内容：</td>
      <td bgcolor="#FFFFFF" class="tdbg"><textarea name="ReplyContent" cols="44" rows="6" id="ReplyContent"><%=rsComment("ReplyContent")%></textarea></td>
    </tr>
    <tr align="center">
      <td height="30" colspan="2" bgcolor="#FFFFFF" class="tdbg">          <input name="Action" type="hidden" id="Action" value="SaveReply" />
          <input name="CommentID" type="hidden" id="CommentID" value="<%=rsComment("CommentID")%>" />
          <input  type="submit" name="Submit" value=" 回 复 " />      </td>
    </tr></form>
  </table>

<%else 
end if%>
</body>
</html>

<%
sub SaveReply()
	dim CommentID,ReplyName,ReplyContent,ReplyTime,userid
	CommentID=trim(Request("CommentID"))
	userid=request("userid")
	ReplyContent=trim(request("ReplyContent"))
	if CommentID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>请指定评论ID</li>"
		Exit sub
	else
		CommentID=Clng(CommentID)
	end if
	if ReplyContent="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>请输入回复内容</li>"
	end if
	
	if FoundErr=True then
		exit sub
	end if
	
	sqlComment="select * from usercomment where CommentID=" & CommentID & " "
	Set rsComment=Server.CreateObject("Adodb.RecordSet")
	rsComment.Open sqlComment,conn,1,3
	if rsComment.Bof or rsComment.EOF then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>找不到指定的评论！</li>"
	else
		
		rsComment("ReplyTime")=now()
     	rsComment("ReplyContent")=dvhtmlencode(ReplyContent)
     	rsComment.update
		response.Redirect "admin_guest.asp"
		
	
	end if
	rsComment.Close
   	set rs=Nothing
	
	
end sub

%>