message.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:7k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ include file="../inc/nocache.jsp"%>
  3. <%@ page import="java.sql.SQLException"%>
  4. <%@ page import="cn.js.fan.db.*"%>
  5. <%@ page import="cn.js.fan.web.*"%>
  6. <%@ page import="cn.js.fan.util.*"%>
  7. <%@ page import="java.util.*"%>
  8. <%@ page import="com.redmoon.forum.message.*"%>
  9. <%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
  10. <html>
  11. <head>
  12. <title><lt:Label res="res.label.message.message" key="message_center"/></title>
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  14. <LINK href="../common.css" type=text/css rel=stylesheet>
  15. </head>
  16. <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  17. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  18. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  19. <%
  20. if (!privilege.isUserLogin(request))
  21. { %>
  22. <p><BR></p>
  23. <table width="320" border="0" cellspacing="0" cellpadding="0" align="center" class="9black">
  24.   <tr> 
  25.     <td><li><%=SkinUtil.LoadString(request,"res.label.message.message","msg")%></td>
  26.   </tr>
  27. </table>
  28. <% 
  29. return;
  30. }
  31. String name = privilege.getUser(request);
  32. %>
  33. <table width="320" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#99CCFF" class="9black" height="260">
  34.   <tr> 
  35.     <td bgcolor="#CEE7FF" height="23">
  36.       <div align="center"><b><lt:Label res="res.label.message.message" key="message_center"/></b></div>
  37.     </td>
  38.   </tr>
  39.   <tr> 
  40.     <td bgcolor="#FFFFFF" height="50"> 
  41.         <table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
  42.           <tr> 
  43.             <td width="75"> 
  44.               <div align="center"><img src="images/m_inbox.gif" width="40" height="40" border="0" alt="<lt:Label res="res.label.message.message" key="recever_mail"/>"></div>
  45.             </td>
  46.             <td width="75"> 
  47.               <div align="center"><a href="mysend.jsp"><img src="images/m_outbox.gif" alt="<lt:Label res="res.label.message.message" key="send_mail"/>" width="40" height="40" border="0"></a></div>
  48.             </td>
  49.             <td width="75"> 
  50.               <div align="center"><a href="send.jsp"><img src="images/newpm.gif" width="40" height="40" border="0" alt="<lt:Label res="res.label.message.message" key="write_mail"/>"></a></div>
  51.             </td>
  52.             <td width="75"> 
  53.               <div align="center"> 
  54.                 <img border="0" name="imageField" alt="<lt:Label res="res.label.message.message" key="del_mail"/>" src="images/m_delete.gif" width="40" height="40" onClick="form1.submit()" style="cursor:hand">
  55.               </div>
  56.             </td>
  57.           </tr>
  58.         </table>
  59.     </td>
  60.   </tr>
  61.   <tr> 
  62.       <td bgcolor="#FFFFFF" height="152" valign="top">
  63. <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  64.           <tr>
  65.             <td><table width="100%"  border="0">
  66.   <form name="form1" method="post" action="delmsg.jsp">
  67.               <tr>
  68.                 <td>
  69. <%
  70. MessageDb md = new MessageDb();
  71. String sql = "select id from message where receiver="+StrUtil.sqlstr(name)+" order by isreaded asc,rq desc";
  72. int pagesize = 5;
  73. Paginator paginator = new Paginator(request);
  74. int curpage = paginator.getCurPage();
  75. int total = md.getObjectCount(sql);
  76. paginator.init(total, pagesize);
  77. //设置当前页数和总页数
  78. int totalpages = paginator.getTotalPages();
  79. if (totalpages==0)
  80. {
  81. curpage = 1;
  82. totalpages = 1;
  83. }
  84. int id,type;
  85. String title="",sender="",receiver="",rq="";
  86. boolean isreaded = true;
  87. int i = 0;
  88. com.redmoon.forum.person.UserMgr um = new com.redmoon.forum.person.UserMgr();
  89. Iterator ir = md.list(sql, (curpage-1)*pagesize, curpage*pagesize-1).iterator();
  90. while (ir.hasNext()) {
  91.         md = (MessageDb)ir.next(); 
  92.   i++;
  93.   id = md.getId();
  94.   title = md.getTitle();
  95.   sender = md.getSender();
  96.   if (!sender.equals(md.USER_SYSTEM))
  97.    sender = um.getUser(sender).getNick();
  98.   receiver = md.getReceiver();
  99.   rq = DateUtil.format(md.getRq(), "yyyy-MM-dd HH:mm:ss");
  100.   type = md.getType();
  101.   isreaded = md.isReaded();
  102.  %>
  103.                   <table width="310" border="0" cellspacing="1" cellpadding="3" align="center" class="p9">
  104.                     <tr>
  105.                       <td width="24" ><input type="checkbox" name="ids" value="<%=id%>">
  106.                       </td>
  107.                       <td width="210">&nbsp;<a href="showmsg.jsp?id=<%=id%>" class="9black2">
  108.                         <%if (isreaded) {%>
  109.                         <%=StrUtil.getLeft(title, 22)%>
  110.                         <%}else{%>
  111.                         <b><%=StrUtil.getLeft(title, 20)%></b>
  112.                         <%}%>
  113.                         </a> <font color="#666666"> [<%=sender%>]
  114.                         <!-- <%=rq%>]-->
  115.                       </font></td>
  116.                       <td width="54" ><div align="center">
  117.               <%
  118.     switch(type) {
  119.      case 0:
  120.   { out.print(SkinUtil.LoadString(request,"res.label.message.message","message_person"));
  121.     break; }
  122.  case 1:
  123.   { out.print(SkinUtil.LoadString(request,"res.label.message.message","company_center"));
  124.     break; }
  125.  case MessageDb.TYPE_SYSTEM:
  126.   { out.print(SkinUtil.LoadString(request,"res.label.message.message","message"));
  127.     break; }
  128.  case 8:
  129.   { out.print(SkinUtil.LoadString(request,"res.label.message.message","admin"));
  130.                     break;}
  131. }
  132.   %>
  133.                       </div></td>
  134.                     </tr>
  135.                   </table>
  136.                   <%}%></td>
  137.               </tr></form>
  138.             </table>
  139.             </td>
  140.           </tr>
  141.         </table>
  142. <% if(paginator.getTotal()>0){ %>
  143.         <table width="310" border="0" cellspacing="0" cellpadding="0" align="center" class="p9" height="24">
  144.           <tr>
  145.             <td height="24" valign="bottom"> <div align="right"><lt:Label res="res.label.forum.listtopic" key="find_record"/><b><%=paginator.getTotal() %></b> 
  146.                 <lt:Label res="res.label.forum.listtopic" key="tiao"/> <lt:Label res="res.label.forum.listtopic" key="per_page"/><b><%=paginator.getPageSize() %></b> <lt:Label res="res.label.forum.listtopic" key="tiao"/> <b><%=curpage %>/<%=totalpages %></b>
  147.               </div>
  148.               <div align="right">
  149.   <%
  150.   String querystr = "";
  151.     out.print(paginator.getCurPageBlock("message.jsp?"+querystr));
  152.   %>
  153. </div>
  154.             </td>
  155.           </tr>
  156.         </table>
  157. <%}%>
  158.       </td>
  159.   </tr>
  160.   <tr> 
  161.     <td bgcolor="#CEE7FF" height="6"></td>
  162.   </tr>
  163. </table>
  164. </body>
  165. </html>