<!--#include file="Inc/Consts.inc" -->
<!--#include file="Inc/NoSQL.Asp" -->
<!--#include file="Inc/common.Asp" -->
<!--#include file="Inc/strfunc.Asp" -->
<!--#include file="Inc/sharefunc.Asp" -->
<!--#include file="Inc/profunc.Asp" -->
<!--#include file="Inc/aboutfunc.Asp" -->
<!--#include file="Inc/newsfunc.Asp" -->
<%
' 文件名称:MessageList.asp 2012
' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com
Call SiteInfo()
Dim templateurl :templateurl=SysRootDir&templatepath
Dim HeaderString,LeftString,MessageListString,FooterString
HeaderString=FileSetTemplate("Head.html")
HeaderString=Replace(HeaderString,"$SiteLogo$",SiteLogo,1,1)
HeaderString=Replace(HeaderString,"$bannerpic$",bannerpic(3),1,1)
HeaderString=Replace(HeaderString,"$MainMenu$",MainMenu(6),1,1)
HeaderString=Replace(HeaderString,"$ProMenu$",ProMenu(0),1,1)
HeaderString=Replace(HeaderString,"$aboutlist$",aboutlist(),1,1)
HeaderString=Replace(HeaderString,"$NewsMenu$",NewsMenu(0),1,1)
LeftString=FileSetTemplate("Left.html")
LeftString=Replace(LeftString,"$searcher$",searcher,1,1)
LeftString=Replace(LeftString,"$leftcontact$",replace(replace(leftcontact,"$Address$",Address),"$Email$",Email))
MessageListString=FileSetTemplate("MessageList.html")
MessageListString=Replace(MessageListString,"$SeoTitle$",SeoTitle)
MessageListString=Replace(MessageListString,"$SiteTitle$",SiteTitle)
MessageListString=Replace(MessageListString,"$Keywords$",Keywords)
MessageListString=Replace(MessageListString,"$Descriptions$",Descriptions)
MessageListString=Replace(MessageListString,"$copyright$",copyright)
MessageListString=Replace(MessageListString,"$Header$",HeaderString)
MessageListString=Replace(MessageListString,"$Left$",LeftString)
MessageListString=Replace(MessageListString,"$WebContent$",WebContentMessageList())

MessageListString=Replace(MessageListString,"$HTMLName$",HTMLName)
MessageListString=Replace(MessageListString,"$templateurl$",templateurl)
Call PrintText(MessageListString)
Function WebMenu()
Dim StringText
StringText=""
StringText=StringText&" <li><a href=""MessageWrite.Asp"">签写留言</a></li>"&vbCrLf
StringText=StringText&" <li><a href=""MessageList.Asp"">所有留言</a></li>"&vbCrLf
StringText=StringText&" <li><a href=""MemberMessage.Asp"">我的留言</a></li>"&vbCrLf
WebMenu=StringText
End Function
Function WebLocation()
    WebLocation = "<a href=""MessageList.Asp"">留言反馈</a> - 查看留言"&vbCrLf
End Function
Function MessageContent(MemID, SecretFlag, Content)
    If SecretFlag Then
        Dim rs, sql
        Set rs = server.CreateObject("adodb.recordset")
        sql = "select * from "&Datapre&"_Members where ID="&MemID
        rs.Open sql, conn, 1, 1
        If rs("MemName") = session("MemName") And session("MemLogin") = "Succeed" Then
            MessageContent = Content
        Else
            MessageContent = "隐秘内容"
        End If
        rs.Close
        Set rs = Nothing
    Else
        MessageContent = Content
    End If
End Function

Function MessageReply(MemID, MesName, SecretFlag, ReplyContent)
    If ReplyContent<>"" Then
        If SecretFlag Then
            Dim rs, sql
            Set rs = server.CreateObject("adodb.recordset")
            sql = "select * from "&Datapre&"_Members where ID="&MemID
            rs.Open sql, conn, 1, 1
            If rs("MemName") = session("MemName") And session("MemLogin") = "Succeed" Then
                MessageReply = MessageReply&HtmlStrReplace(ReplyContent)
            Else
                MessageReply = MessageReply&"<font color=""#CC0000"">回复已隐藏，请登录后查看。</font>"
            End If
            rs.Close
            Set rs = Nothing
        Else
            MessageReply = MessageReply&HtmlStrReplace(ReplyContent)
        End If
    End If
End Function
' 文件名称:MessageList.asp 2012
' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com

Function WebContentMessageList()
    Dim idCount,StringText
	StringText=""
    Dim pages
    pages = MessageInfo
    Dim pagec
    Dim page
    page = CLng(request("Page"))
    Dim pagenc
    pagenc = 5
    Dim pagenmax
    Dim pagenmin
    Dim pageprevious
    Dim pagenext
    Dim datafrom
    datafrom = ""&Datapre&"_Message "
    Dim datawhere
    datawhere = "where ViewFlag "
    Dim sqlid
    Dim Myself, PATH_INFO, QUERY_STRING
    PATH_INFO = request.servervariables("PATH_INFO")
    QUERY_STRING = request.ServerVariables("QUERY_STRING")'
    If QUERY_STRING = "" Then
        Myself = PATH_INFO & "?"
    ElseIf InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") = 0 Then
        Myself = PATH_INFO & "?" & QUERY_STRING & "&"
    Else
        Myself = Left(PATH_INFO & "?" & QUERY_STRING, InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") -1)
    End If
    Dim taxis
    taxis = "order by id desc "
    Dim i
    Dim rs, sql
    
    sql = "select count(ID) as idCount from ["& datafrom &"]" & datawhere
    Set rs = db(sql,4)
    idCount = rs("idCount")
    If(idcount>0) Then
    If(idcount Mod pages = 0)Then
    pagec = Int(idcount / pages)
Else
    pagec = Int(idcount / pages) + 1
End If
sql = "select id from ["& datafrom &"] " & datawhere & taxis
Set rs = db(sql,2)
rs.pagesize = pages
If page < 1 Then page = 1
If page > pagec Then page = pagec
If pagec > 0 Then rs.absolutepage = page
For i = 1 To rs.pagesize
    If rs.EOF Then Exit For
    If(i = 1)Then
    sqlid = rs("id")
Else
    sqlid = sqlid &","&rs("id")
End If
rs.movenext
Next
End If
If(idcount>0 And sqlid<>"") Then
sql = "select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
Set rs = db(sql,4)
While Not rs.EOF
      StringText=StringText&" <table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbCrLf
      StringText=StringText&"   <tr>"&vbCrLf
      StringText=StringText&"    <td width=""5%"" height=""25"" bgcolor=""#820000"" align=""center""><font color=""#FFFFFF""><b>"&rs("ID")&"</b></font></td>"&vbCrLf
      StringText=StringText&"    <td width=""50%"" height=""25"" bgcolor=""#EDEEEF"" align=""left"" style=""padding-left: 8px""><font color=""#333333""><b>"&rs("Company")&"</b></font>("&rs("Linkman")&""&rs("Sex")&")</td>"&vbCrLf
      StringText=StringText&"   <td width=""45%"" height=""25"" bgcolor=""#EDEEEF"" align=""right"" style=""padding-right: 8px""><font color=""#808080"">留言时间：</font>"&rs("Addtime")&"</td>"&vbCrLf
      StringText=StringText&"   </tr>"&vbCrLf
      StringText=StringText&" </table>"&vbCrLf
      StringText=StringText&" <table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""1"">"&vbCrLf
      StringText=StringText&"  <tr align=""left"">"&vbCrLf
      StringText=StringText&"   <td width=""15%"" height=""20"" align=""right"" style=""padding-right: 8px"">咨询主题：</td>"&vbCrLf
      StringText=StringText&"    <td><b>"&rs("MesName")&"</b></td>"&vbCrLf
      StringText=StringText&"  </tr>"&vbCrLf
      StringText=StringText&"   <tr align=""left"">"&vbCrLf
      StringText=StringText&"   <td height=""20"" align=""right"" style=""padding-right: 8px"">咨询内容：</td>"&vbCrLf
      StringText=StringText&"    <td style=""padding-right: 5px"">"&HtmlStrReplace(rs("Content"))&"</td>"&vbCrLf
      StringText=StringText&"  </tr>"&vbCrLf
    If rs("ReplyContent") <> "" Then
      StringText=StringText&"  <tr>"&vbCrLf
      StringText=StringText&"    <td>&nbsp;</td>"&vbCrLf
      StringText=StringText&"   <td bgcolor=""#F7F7F7"" style=""line-height: 200%""><font color=""#333333""><b>管理员回复：</b></font><br />"&rs("ReplyContent")&"</td>"&vbCrLf
      StringText=StringText&"  </tr>"&vbCrLf
    End If
      StringText=StringText&"   <tr>"&vbCrLf
      StringText=StringText&"     <td colspan=""2"" height=""5""></td>"&vbCrLf
      StringText=StringText&"  </tr>"&vbCrLf
      StringText=StringText&" </table>"&vbCrLf
    rs.movenext
Wend
Else
      StringText=StringText&" <center>暂无相关信息</center>"
    Exit Function
End If
      StringText=StringText&" <table width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbCrLf
      StringText=StringText&"  <tr height=""35"">"&vbCrLf
      StringText=StringText&"    <td align=""center"">"&vbCrLf
      StringText=StringText&" 共<strong style=""color:red"">"&idcount&"</strong>条记录 页次：<strong style=""color:red"">"&page&"</strong>/"&pagec&" 每页：<strong style=""color:red"">"&pages&"</strong>条记录" & vbCrLf
pagenmin = page - pagenc
pagenmax = page+pagenc
If(pagenmin<1) Then pagenmin = 1
If(page>1) Then       StringText=StringText&" <a href="""& myself &"Page=1"" title=""回到第一页""><font face=""webdings"" color=""#000000"">9</font></a> "&vbCrLf
If page - (pagenc * 2 + 1)<= 0 Then
    pageprevious = 1
Else
    pageprevious = page - (pagenc * 2 + 1)
End If
If(pagenmin>1) Then       StringText=StringText&" <a href="""& myself &"Page="& pageprevious &""" title=""第"& pageprevious &"页""><font face=""webdings"" color=""#000000"">3</font></a>"&vbCrLf
If(pagenmax>pagec) Then pagenmax = pagec
For i = pagenmin To pagenmax
    If(i = page) Then
         StringText=StringText&" &nbsp;<strong style=""color:red"">"& i &"</strong>&nbsp;"&vbCrLf
Else
         StringText=StringText&" [<a href="""& myself &"Page="& i &""">"& i &"</a>]"&vbCrLf
End If
Next
If page+(pagenc * 2 + 1)>= pagec Then
    pagenext = pagec
Else
    pagenext = page+(pagenc * 2 + 1)
End If
If(pagenmax<pagec) Then StringText=StringText&" <a href="""& myself &"Page="& pagenext &""" title=""跳转到第"&pagenext&"页""><font face=""webdings"" color=""#999999"">:</font></a> "&vbCrLf
If(page<pagec) Then  StringText=StringText&"  <a href="""& myself &"Page="& pagec &""" title=""跳转到第"&pagec&"页""><font face=""webdings"" color=""#000000"">:</font></a>"&vbCrLf
StringText=StringText&"   </td>"&vbCrLf
StringText=StringText&"  </tr>"&vbCrLf
StringText=StringText&" </table>"&vbCrLf
rs.Close
Set rs = Nothing
WebContentMessageList=StringText
End Function
%>