<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>消息管理</title>
<link href="style/nav.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--#include file="../conn.asp"-->
<!--#include file="../Function/Function.asp"-->
<!--#include file="../function/Page.asp" -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
     <tr>
       <td width="100%" valign="top"><table width="690" border="0" align="center" cellpadding="0" cellspacing="0">
         <tr>
           <td height="43" background="images/user_top.gif"><table width="100%" border="0" cellpadding="0" cellspacing="0">
             <tr>
               <td width="6%">&nbsp;</td>
               <td width="94%">消息管理</td>
             </tr>
           </table></td>
         </tr>
       </table><br />
<table width="90%" border="0" align="center" cellpadding="5" cellspacing="0">
         <tr>
           <td bgcolor="#f7f7f7"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="login">
             <tr>
               <td><br />
                   <%Action=Trim(request("Action"))
				   	IF Request.Cookies("YWNTUserCookie")("UserName")="" Then Action="UsersLogin"
					Select Case Action
					Case "UsersLogin"
					call UsersLogin()
					Case "Del"
					call Del()
					Case "MsgContent"
					call MsgContent()
					Case else
					call List()
					End Select
					sub Del()
					conn.execute "delete from YWNT_TMS_UsersMsg WHERE ID ="&NoSqlHack(Request.QueryString("ID"))&""
					Response.Write("<script>alert('消息成功删除!');location.href = '"&Request.ServerVariables("HTTP_REFERER")&"';</script>")
					End sub
					sub List()%>
                   <div align="center">用户：<%=Request.Cookies("YWNTUserCookie")("UserName")%></div>
                   <table cellspacing="3" cellpadding="1" width="100%" border="0">
                     <tbody>
                       <tr align="middle">
                         <td height="25" align="left" bgcolor="#E3E3E3"><div align="center">消息主题</div></td>
                         <td width="20%" align="left" bgcolor="#E3E3E3"><div align="center">状态</div></td>
                         <td width="20%" align="left" bgcolor="#E3E3E3"><div align="center">发送日期</div></td>
                         <td width="10%" align="left" bgcolor="#E3E3E3"><div align="center">删除</div></td>
                       </tr>
                       <% 	Dim int_RPP
	int_RPP=20 '设置每页显示数目  
	Set Rs = server.CreateObject(YWNT_TMS_RS)
		sql="Select * from YWNT_TMS_UsersMsg Where UsersName='"&Request.Cookies("YWNTUserCookie")("UserName")&"' Order by ID desc"
		Rs.open sql,Conn,1,1
	if Rs.eof then
	   Response.Write"<TR><TD colspan=""4"" bgcolor=""#F7F7F7"" height=""40"">没有记录。</TD></TR>"
	else
		Rs.PageSize=int_RPP
		cPageNo=NoSqlHack(Request.QueryString("Page"))
		If cPageNo="" Then cPageNo = 1
		If not isnumeric(cPageNo) Then cPageNo = 1
		cPageNo = Clng(cPageNo)
		If cPageNo>Rs.PageCount Then cPageNo=Rs.PageCount 
		If cPageNo<=0 Then cPageNo=1
		Rs.AbsolutePage=cPageNo 
	for i=1 to int_RPP
	 if Rs.eof Then exit For 
	 Set Rs_Msg = server.CreateObject(YWNT_TMS_RS)
	 Str_Sql = "Select ID,MsgName,MsgDate from YWNT_TMS_Msg where ID="&RS("MsgID")&" order by id desc"
	 Set Rs_Msg = Conn.Execute(Str_Sql)
	 ID=Rs_Msg("ID")
	 MsgName=Rs_Msg("MsgName")
	 MsgDate=Rs_Msg("MsgDate")
	 Rs_Msg.close
	 Set RS_Msg = Nothing%>
                       <tr>
                         <td height="25" bgcolor="#F7F7F7"><img src="images/voice.gif" width="16" height="16" align="absbottom" />
                             <a href="Users_Msg.asp?Action=MsgContent&ID=<%=ID%>"><%=MsgName%></a></td>
                         <td align="center" bgcolor="#F7F7F7"><%=MsgDate%></td>
                         <td align="center" bgcolor="#F7F7F7"><%if RS("UsersLook")=0 then Response.Write"新消息" else Response.Write"已观看" end if%></td>
                         <td align="center" bgcolor="#F7F7F7"><a href="Users_Msg.asp?Action=Del&ID=<%=RS("ID")%>">删除</a></td>
                       </tr>
    <%Rs.MoveNext
	next 
	end if%>
                       <tr align="right">
                         <td height="40" colspan="4" bgcolor="#F7F7F7"><% response.Write fPageCount(Rs,cPageNo) %></td>
                       </tr>
                     </tbody>
                   </table>
                   <%
RS.Close
Set RS = Nothing
End sub
sub MsgContent()
Set Rs_Msg = server.CreateObject(YWNT_TMS_RS)
Str_Sql = "Select ID,MsgName,MsgContent,MsgDate from YWNT_TMS_Msg where ID="&NoSqlHack(Request.QueryString("ID"))&" order by id desc"
Set Rs_Msg = Conn.Execute(Str_Sql)
ID=Rs_Msg("ID")
MsgName=Rs_Msg("MsgName")
Content=Rs_Msg("MsgContent")
MsgDate=Rs_Msg("MsgDate")
Rs_Msg.close
Set RS_Msg = Nothing%>
<table cellspacing="3" cellpadding="1" width="100%" border="0">
                     <tbody>
                       <tr align="middle">
                         <td height="25" align="center" bgcolor="#E3E3E3"><strong><%=MsgName%></strong></td>
                       </tr>
                       <tr align="middle">
                         <td bgcolor="#F7F7F7" style="word-break:break-all;"><%=Content%></td>
                       </tr>
                       <tr align="right">
                         <td height="25" bgcolor="#F7F7F7">日期：<%=MsgDate%></td>
                       </tr>
					    <tr align="center">
                         <td height="25" bgcolor="#F7F7F7"><a href="Users_Msg.asp"><strong>返回</strong></a></td>
                       </tr>
                     </tbody>
                   </table>
<%Conn.execute("Update YWNT_TMS_UsersMsg set UsersLook=1 where MsgID="&ID&"")
end sub%>
                 <br>
				</td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
   </table>
<%call connclose()%>
</body>
</html>
