<%@language=vbscript codepage=936%>
<%
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
dim dns
dns="../"
%>
<!--#Include file="../Common/Inc_DatConn.asp"-->
<!--#Include file="Common/Inc_Config.asp"-->
<!--#Include file="Common/Inc_Function.asp"-->
<!--#Include file="fy_admin_check.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/Admin_Style.Css" rel="stylesheet" type="text/css">
<script src="../common/Admin.js" type="text/javascript"></script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%
if fla21<>1 and Session("intUserLevel")<2 then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>错误：操作权限出错，您没有权限操作些功能！</li>"
Call Admin_ShowErr(ErrMsg)
end if
bbaction=changechr(request("bbaction"))
Select case bbaction
  	Case "del"
		call delguestbook
  	Case "view"
		call viewguestbook
	Case else
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="title"> 
    <td height="22" align="center"><strong>网站留言管理</strong></td>
  </tr>
  <tr class="tdbg"> 
    <td height="30" align=right>      <table border="0" width="96%" cellspacing="0" cellpadding="0" align="center">
	    <form method="post" action="?" name="Form1">
	    <tr>
		  <td width="100%" height="25" align="right">留言反馈主题：<input type="text" name="KeyWord" size="20" value="<% = Request("KeyWord")%>" class="face"> <input type="submit" name="submit" value="搜" class="button"></td>
		</form>
		</tr>
	  </table></td>
  </tr>
</table>
<br>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" Class="border">
    <tr class="title"> 
      <td width="60" align="center">编 号</td>
      <td align="center">标 题</td>
      <td width="160" align="center">反馈时间</td>
      <td width="40" align="center">操 作</td>
    </tr>
<%
Dim rdsFeedBack    '/通告的数据库对象及SQL语句/
Dim sqlFeedBack
Dim rdsTotalRec   
Dim strKeyWord    '/关键字/
Dim intPage       '/当前页/
Dim intTotalRec	  '/所有记录/
Dim intFeedBackCot	  '/通告条数/
Dim intFeedBackCount  '/通告条数/
Dim n,p,ii	      '/定义一些临时变量/

strKeyWord = Request("KeyWord")

intPage = Trim(Request("Page"))
if intPage = "" then
	intPage = 1
else
	intPage = Clng(intPage)
end if

intFeedBackCot = 10

set rdsFeedBack = Server.CreateObject("ADODB.Recordset")
if strKeyWord <> "" then
	set rdsTotalRec = Conn.Execute("Select Count(FeedBackKey) From Dat_FeedBack Where Topic like '%"& strKeyWord &"%'")
	intTotalRec = rdsTotalRec(0)
	sqlFeedBack = "Select * From Dat_FeedBack Where Topic like '%"& strKeyWord &"%' Order By FeedBackKey Desc"
else
	set rdsTotalRec = Conn.Execute("Select Count(FeedBackKey) From Dat_FeedBack")
	intTotalRec = rdsTotalRec(0)
	sqlFeedBack = "Select * From Dat_FeedBack Order By FeedBackKey Desc"
end if
rdsFeedBack.Open sqlFeedBack,Conn,1,1
if not rdsFeedBack.EOF then
	if intTotalRec mod intFeedBackCot = 0 then
		n = intTotalRec \ intFeedBackCot
	else
		n = intTotalRec \ intFeedBackCot + 1
	end if
	rdsFeedBack.MoveFirst
	if intPage > n then intPage = n
	if intPage < 1 then intPage = 1
	rdsFeedBack.Move (intPage - 1) * intFeedBackCot
	do while not rdsFeedBack.EOF and intFeedBackCount < Clng(intFeedBackCot)
		intFeedBackCount = intFeedBackCount + 1
			FeedBackKey= rdsFeedBack("FeedBackKey")
%>
    <tr class="tdbg" onMouseOut="this.className='tdbg'" onMouseOver="this.className='tdbg2'"> 
      <td width="60" align="center"><% =FeedBackKey%></td>
      <td><a href="?bbaction=view&id=<% =FeedBackKey%>"><%if rdsFeedBack("State") =0 then%><font color="#FF0000"><% = rdsFeedBack("Topic")%></font><%else%><% = rdsFeedBack("Topic")%><%end if%></a></td>
      <td width="160" align="center"><% = rdsFeedBack("CreateTime")%></td>
      <td width="40" align="center"><a href="?bbaction=del&id=<% =FeedBackKey%>"  onclick="{if(confirm('确定删除吗?')){return true;}return false;}">删除</a></td>
    </tr>
<%
		rdsFeedBack.MoveNext
	loop
else
	Response.Write "<tr><td width=""100%"" height=""25"" colspan=""4"" class=""banma1"">&nbsp;<font color=""#FF0000"">没有留言反馈信息...</font></td></tr>"
end if
rdsFeedBack.Close
set rdsFeedBack = nothing

if intPage - 1 mod 10 = 0 then
	p = (intPage - 1) \ 10
else
	p = (intPage - 1) \ 10
end if	
%>
  </table>
	  <table border="0" width="96%" cellspacing="0" cellpadding="0" align="center">
	    <form method="post" action="?" name="form2">
	    <input type="hidden" name="KeyWord" value="<% = strKeyWord%>">
	    <tr>
		  <td width="30%" height="30" valign="middle">页次：<b><%= intPage %></b>/<b><%= n %></b>页 每页<b><%= intFeedBackCot %></b>条 共<b><%= intTotalRec %></b>条</td>
		  <td width="70%" height="30" valign="middle"><div align="right">分页：
			<%
				if intPage = 1 then
					Response.Write "<font face=webdings>9</font>   "
				else
					Response.Write "<a href='?Page=1&KeyWord="& strKeyWord &"' title=首页><font face=webdings>9</font></a>   "
				end if
				if p * 10 > 0 then Response.Write "<a href='?Page="&Cstr(p*10)&"&KeyWord="& strKeyWord &"' title=上十页><font face=webdings>7</font></a>   "
				Response.Write "<b>"
				for ii = p * 10 + 1 to P * 10 + 10
					   if ii = intPage then
				          Response.Write "<font color=""#FF0000"">"+Cstr(ii)+"</font> "
					   else
					      Response.Write "<a href='?Page="&Cstr(ii)&"&KeyWord="& strKeyWord &"'>"+Cstr(ii)+"</a>   "
					   end if
					if ii = n then exit for
				next
				Response.Write "</b>"
				if ii < n then Response.Write "<a href='?Page="&Cstr(ii)&"&KeyWord="& strKeyWord &"' title=下十页><font face=webdings>8</font></a>   "
				if intPage=n then
					Response.Write "<font face=webdings>:</font>   "
				else
					Response.Write "<a href='?Page="&Cstr(n)&"&KeyWord="& strKeyWord &"' title=尾页><font face=webdings>:</font></a>   "
				end if
			%>
			转到：<input type="text" name="Page" size="2" maxlength="10" value="<%= intPage %>" class="face"> <input type="submit" value="Go" name="submit" class="button">
			</div></td>
		</tr>
		</form>
	  </table>
<%
End Select
sub viewguestbook
%>
<br>
<%
Dim intFeedBackKey
Dim rdsFeedBack
Dim sqlFeedBack
Dim sqlUpdateFeedBack

intFeedBackKey = Request.QueryString("Id")
if intFeedBackKey = "" then intFeedBackKey = 0

set rdsFeedBack = Server.CreateObject("ADODB.Recordset")
sqlFeedBack = "Select * From Dat_FeedBack Where FeedBackKey = "& intFeedBackKey
rdsFeedBack.Open sqlFeedBack,Conn,1,1
if not rdsFeedBack.EOF then
%>
      <table border="0" width="100%" cellspacing="1" cellpadding="0" align="center" class="border">
        <tr class="title">
          <td width="100%" height="30" colspan="2">&nbsp;来自 <font color="#FF0000"><% = rdsFeedBack("ContactMan")%></font> 的留言反馈信息：</td>
        </tr>
        <tr class="tdbg">
          <td width="25%" height="25" align="right">联系人：</td>
          <td width="75%" height="25">&nbsp;<% = rdsFeedBack("ContactMan")%></td>
        </tr>
        <tr class="tdbg">
          <td height="25" align="right">公司名称：</td>
          <td height="25">&nbsp;<% = rdsFeedBack("CompanyName")%></td>
        </tr>
        <tr class="tdbg">
          <td height="25" align="right">地址：</td>
          <td height="25">&nbsp;<% = rdsFeedBack("Add")%></td>
        </tr>
        <tr class="tdbg">
          <td height="25" align="right">电话：</td>
          <td height="25">&nbsp;<% = rdsFeedBack("Tel")%></td>
        </tr>
        <tr class="tdbg">
          <td height="25" align="right">传真：</td>
          <td height="25">&nbsp;<% = rdsFeedBack("Fax")%></td>
        </tr>
        <tr class="tdbg">
          <td height="25" align="right">Homepage：</td>
          <td height="25">&nbsp;<% = rdsFeedBack("Homepage")%></td>
        </tr>
        <tr class="tdbg">
          <td height="25" align="right">E-Mail：</td>
          <td height="25">&nbsp;<% = rdsFeedBack("Email")%></td>
        </tr>
        <tr class="tdbg">
          <td height="25" align="right">主题：</td>
          <td height="25">&nbsp;<% = rdsFeedBack("Topic")%></td>
        </tr>
        <tr class="tdbg">
          <td align="right">内容：</td>
          <td align="center" valign="top">
            <table border="0" width="96%" cellspacing="0" cellpadding="0">
              <tr class="tdbg">
                <td width="100%" height="50" style="line-height:150%;LETTER-SPACING: 1px"><% = Html2Txt(rdsFeedBack("Content"))%></td>
              </tr>
            </table>
          </td>
        </tr>
        <tr class="tdbg">
          <td height="13" align="right">时间：</td>
          <td height="13">&nbsp;<% = rdsFeedBack("CreateTime")%></td>
        </tr>
        <tr class="tdbg">
          <td height="12" align="right"></td>
          <td height="12">
			<b><a href="?bbaction=del&id=<% =intFeedBackKey%>"  onclick="{if(confirm('确定删除吗?')){return true;}return false;}">删除</a>&nbsp; <a href="#" onclick="parent.location.href='Javascript:history.back()'">返回</a></b></td>
        </tr>
	  </table>
<%
end if
rdsFeedBack.Close
set rdsFeedBack = nothing

sqlUpdateFeedBack = "Update Dat_FeedBack Set State = 1 Where FeedBackKey = "& intFeedBackKey
Conn.Execute sqlUpdateFeedBack
end sub

%>