<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.util.Vector"%>
<%@ page import="chatweb.msg"%>
<jsp:useBean id="db" scope="page" class="chatweb.conn" />
<jsp:useBean id="mesg" scope="page" class="chatweb.msg"/>
<html>
<head>
<title>
message
</title>
<link href="../chat.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body bgcolor="#FFF7DD">
<script language="JavaScript" type="text/JavaScript">
function fopen(theURL){
	location.href=theURL;
}
</script>
<%
Vector msglist=db.getMsg((session.getAttribute("username")).toString());
%>
<table width="95%" height="0" align="center" cellspacing="1" class="mytable" style='word-break:break-all;'>
  <tr bgcolor="#D8D7C0"> 
    <td height="20" colspan="3" nowrap><font size="4">你有<%=msglist.size()%>条短消息：</font>
      <div align="right"> <a href="write.jsp">写短消息</a>&nbsp; &nbsp;</div></td>
  </tr>
<%for(int i=0;i<=msglist.size()-1;i++){
mesg=(msg)msglist.elementAt(msglist.size()-i-1);
if(i%2==0){
%>
  <tr bgcolor="#E7E6D3"> 
    <td nowrap class="shadow">标题：</td>
    <td width="100%" bgcolor="#E7E6D3"> 
      <div align="left"><%=mesg.getTitle()%> 
        <%if(mesg.isIsnew()){%>
        <span class="new"> <strong><font color="#FF0000"><em>(New)</em></font></strong></span> 
        <%}%>
      </div></td>
    <td nowrap> 
      <div align="right">
        <input type="button" name="Submit3" value="回复" onClick="fopen('write.jsp?writeto=<%=mesg.getFromUser()%>&title=<%=mesg.getTitle()%>')">
        <input type="button" name="Submit" value="删除" onClick="fopen('delete.jsp?<%=mesg.getId()%>')">
      </div></td>
  </tr>
  <tr bgcolor="#FFF7DD"> 
    <td>来自：</td>
    <td colspan="2"><%=mesg.getFromUser()%></td>
  </tr>
  <tr bgcolor="#FFF7DD"> 
    <td width="0" nowrap>内容：</td>
    <td width="100%" colspan="2"><%=mesg.getContent()%></td>
  </tr>
  <tr bgcolor="#FFF7DD"> 
    <td nowrap>接收时间：</td>
    <td colspan="2"><%=(mesg.getSendDate()+" "+mesg.getSendTime())%></td>
  </tr>
<%}else{%>
  <tr bgcolor="#E7E6D3"> 
    <td nowrap class="shadow">标题： </td>
    <td> 
      <div align="left" class="title"><%=mesg.getTitle()%> 
        <%if(mesg.isIsnew()){%>
        <span class="newmessage"> <em><strong><font color="#FF0000">(New)</font></strong></em></span> 
        <%}%>
      </div></td>
    <td nowrap> 
      <div align="right"> 
        <input type="button" name="Submit4" value="回复" onClick="fopen('write.jsp?writeto=<%=mesg.getFromUser()%>&title=<%=mesg.getTitle()%>')">
        <input type="button" name="Submit2" value="删除" onClick="fopen('delete.jsp?<%=mesg.getId()%>')">
      </div></td>
  </tr>
  <tr bgcolor="#FFF7DD"> 
    <td>来自：</td>
    <td colspan="2"><%=mesg.getFromUser()%></td>
  </tr>
  <tr bgcolor="#FFF7DD"> 
    <td>内容：</td>
    <td width="100%" colspan="2"><%=mesg.getContent()%></td>
  </tr>
  <tr bgcolor="#FFF7DD"> 
    <td nowrap>接收时间：</td>
    <td colspan="2"><%=(mesg.getSendDate()+" "+mesg.getSendTime())%></td>
  </tr>
<%}
}%>
</table>
<script language="JavaScript" type="text/JavaScript">
window.opener.location.href="../welcome.jsp";
</script>
</body>
</html>
