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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ include file="../inc/nocache.jsp"%>
  3. <%@ page import="cn.js.fan.db.*"%>
  4. <%@ page import="java.util.*"%>
  5. <%@ page import="com.redmoon.oa.message.*"%>
  6. <html>
  7. <head>
  8. <title>消息中心</title>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  10. <LINK href="../common.css" type=text/css rel=stylesheet>
  11. <script>
  12. function selAllCheckBox(checkboxname){
  13. var checkboxboxs = document.all.item(checkboxname);
  14. if (checkboxboxs!=null)
  15. {
  16. // 如果只有一个元素
  17. if (checkboxboxs.length==null) {
  18. checkboxboxs.checked = true;
  19. }
  20. for (i=0; i<checkboxboxs.length; i++)
  21. {
  22. checkboxboxs[i].checked = true;
  23. }
  24. }
  25. }
  26. </script>
  27. </head>
  28. <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  29. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  30. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  31. <%
  32. if (!privilege.isUserLogin(request)) {
  33. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  34. return;
  35. }
  36. String name = privilege.getUser(request);
  37. %>
  38. <table width="320" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#99CCFF" class="9black" height="260">
  39.   <tr> 
  40.     <td bgcolor="#CEE7FF" height="23">
  41.       <div align="center"><b>消 息 中 心</b></div>
  42.     </td>
  43.   </tr>
  44.   <tr> 
  45.     <td bgcolor="#FFFFFF" height="50"> 
  46.         <table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
  47.           <tr> 
  48.             <td width="75"> 
  49.               <div align="center"><img src="images/inboxpm.gif" width="40" height="40" border="0"></div>
  50.             </td>
  51.             <td width="75"> 
  52.               <div align="center"><a href="listdraft.jsp"><img src="images/m_draftbox.gif" width="40" height="40" border="0"></a></div>
  53.             </td>
  54.             <td width="75"> 
  55.               <div align="center"><a href="send.jsp"><img src="images/newpm.gif" width="40" height="40" border="0"></a></div>
  56.             </td>
  57.             <td width="75"> 
  58.               <div align="center"> 
  59.                 <img border="0" name="imageField" src="images/m_delete.gif" width="40" height="40" onClick="form1.submit()" style="cursor:hand">
  60.               </div>
  61.             </td>
  62.           </tr>
  63.         </table>
  64.     </td>
  65.   </tr>
  66.   <tr> 
  67.       <td bgcolor="#FFFFFF" height="152" valign="top">
  68. <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  69.           <tr>
  70.             <td><table width="100%"  border="0">
  71.   <form name="form1" method="post" action="delmsg.jsp">
  72.               <tr>
  73.                 <td>
  74. <%
  75. MessageDb md = new MessageDb();
  76. String sql = "select id from oa_message where receiver="+StrUtil.sqlstr(name)+" and isDraft=0 order by isreaded asc,rq desc";
  77. int pagesize = 5;
  78. Paginator paginator = new Paginator(request);
  79. int curpage = paginator.getCurPage();
  80. int total = md.getObjectCount(sql);
  81. paginator.init(total, pagesize);
  82. //设置当前页数和总页数
  83. int totalpages = paginator.getTotalPages();
  84. if (totalpages==0)
  85. {
  86. curpage = 1;
  87. totalpages = 1;
  88. }
  89. int id,type;
  90. String title="",sender="",receiver="",rq="";
  91. boolean isreaded = true;
  92. int i = 0;
  93. Iterator ir = md.list(sql, (curpage-1)*pagesize, curpage*pagesize-1).iterator();
  94. while (ir.hasNext()) {
  95.         md = (MessageDb)ir.next(); 
  96.   i++;
  97.   id = md.getId();
  98.   title = md.getTitle();
  99.   sender = md.getSender();
  100.   receiver = md.getReceiver();
  101.   rq = md.getRq();
  102.   type = md.getType();
  103.   isreaded = md.isReaded();
  104.  %>
  105.                   <table width="310" border="0" cellspacing="1" cellpadding="3" align="center" class="p9">
  106.                     <tr>
  107.                       <td width="24" ><input type="checkbox" name="ids" value="<%=id%>">
  108.                       </td>
  109.                       <td width="210">&nbsp;<a href="showmsg.jsp?id=<%=id%>" class="9black2">
  110.                         <%if (isreaded) {%>
  111.                         <%=StrUtil.getLeft(title, 22)%>
  112.                         <%}else{%>
  113.                         <b><%=StrUtil.getLeft(title, 20)%></b>
  114.                         <%}%>
  115.                         </a> <font color="#666666"> [<%=sender%>]
  116.                         <!-- <%=rq%>]-->
  117.                       </font></td>
  118.                       <td width="54" ><div align="center">
  119.               <%
  120.     switch(type) {
  121.      case 0:
  122.   { out.print("个人消息");
  123.     break; }
  124.  case 1:
  125.   { out.print("公司消息");
  126.     break; }
  127.  case MessageDb.TYPE_SYSTEM:
  128.   { out.print("公共消息");
  129.     break; }
  130.  case 8:
  131.   { out.print("管 理 员");
  132.                     break;}
  133. }
  134.   %>
  135.                       </div></td>
  136.                     </tr>
  137.                   </table>
  138.                   <%}%></td>
  139.               </tr></form>
  140.             </table>
  141.             </td>
  142.           </tr>
  143.         </table>
  144. <% if(paginator.getTotal()>0){ %>
  145.         <table width="310" border="0" cellspacing="0" cellpadding="0" align="center" class="p9" height="24">
  146.           <tr>
  147.             <td height="24" valign="bottom"> <table width="100%" border="0" cellpadding="0" cellspacing="0">
  148.   <tr>
  149.     <td width="20%">&nbsp;&nbsp;&nbsp;<a href="javascript:selAllCheckBox('ids')">全选</a></td>
  150.     <td width="80%"><div align="right">共 <b><%=paginator.getTotal() %></b> 条 每页<b><%=paginator.getPageSize() %></b> 条 <b><%=curpage %>/<%=totalpages %></b> </div></td>
  151.   </tr>
  152. </table>
  153.               <div align="right">
  154.   <%
  155.   String querystr = "";
  156.     out.print(paginator.getCurPageBlock("message.jsp?"+querystr));
  157.   %>
  158. </div>
  159.             </td>
  160.           </tr>
  161.         </table>
  162. <%}%>
  163.       </td>
  164.   </tr>
  165.   <tr> 
  166.     <td bgcolor="#CEE7FF" height="6"></td>
  167.   </tr>
  168. </table>
  169. </body>
  170. </html>