sendbox.jsp
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:17k
源码类别:

WEB邮件程序

开发平台:

Java

  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <%@page import="com.softeem.page.ActionBean"%>
  3. <%@page import="com.softeem.page.MyPage"%>
  4. <%@page import="com.softeem.webmail.beans.receive.User"%>
  5. <%@page import="com.softeem.webmail.sendbox.SelectMail"%>
  6. <%@page import="com.softeem.webmail.sendbox.SendboxBean"%>
  7. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  8. <%! 
  9.   public List mypage(List list,String changepage){
  10. MyPage page = new MyPage();
  11. List list1 = new ArrayList();
  12. List list2 = new ArrayList();
  13. ActionBean ab = null;
  14. if(list==null){
  15.     list2 = null;
  16.     ab = new ActionBean(1,0,10);
  17. }else{
  18.   if (changepage == null) {
  19. list2 = page.thlist(list);
  20.  ab =new ActionBean(1,list.size(),10);
  21.   } else {
  22. list2 = page.anlist(Integer.parseInt(changepage),list);
  23.  ab =new ActionBean(Integer.parseInt(changepage),list.size(),10);
  24.  }
  25. }
  26. list1.add(list2);
  27. list1.add(ab);
  28. return list1;
  29.   }
  30. %>
  31. <html>
  32. <head>
  33. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  34. <title>收件箱</title>
  35. <script src="js/public.js" type="text/JavaScript"></script>
  36. <script language="JavaScript" src="include/CheckDataFunction.js" type="text/JavaScript"></script>
  37. <SCRIPT LANGUAGE=javascript>
  38.   <!--
  39.     var EmailID=0;
  40.     function aaaa(){
  41.      alert("---------");
  42.     }
  43. function selectRow(id)
  44. {
  45. ListForm.cid.value=id;
  46. }
  47. function selectAll(obj,value)
  48. {
  49. if(obj.length==undefined)
  50. {
  51. obj.checked=value;
  52. }
  53. for(var i=0;i<obj.length;i++)
  54. obj[i].checked=value;
  55. }
  56. function doDel()
  57. {
  58. alert("-------");
  59. var ids="";
  60. var obj=ListForm.cids;
  61. for(var i=0;i<obj.length;i++)
  62. if(obj[i].checked)ids+=obj[i].value+",";
  63. if((ids==""))ids=ListForm.cid.value+",";
  64. ListForm.mulitCid.value=ids;
  65. alert(ids);
  66. if(ids==",")
  67. {
  68. alert("请选择要删除的内容!");
  69. return false;
  70. }
  71. if(confirm('邮件将不可恢复,是否真的要永久删除此邮件?')){
  72. ListForm.easyJWebCommand.value="del";
  73. ListForm.cid.value=ids;
  74. alert(ListForm.cid.value);
  75. ListForm.submit();
  76. }
  77. }
  78. function doMove()
  79. {
  80. var ids="";
  81. var obj=ListForm.cids;
  82. for(var i=0;i<obj.length;i++)
  83. if(obj[i].checked)ids+=obj[i].value+",";
  84. if(ids=="")ids=ListForm.cid.value+",";
  85. ListForm.mulitCid.value=ids;
  86. if(ids==",")
  87. {
  88. alert("请选择要移动的邮件!");
  89. return false;
  90. }
  91. ListForm.easyJWebCommand.value="move";
  92. ListForm.cid.value=ids;
  93. ListForm.submit();
  94. }
  95. function doReply()
  96. {
  97.     if(ListForm.cid.value==""){
  98. alert("请选择要回复的邮件!");
  99. return ;
  100. }
  101. //alert(ListForm.cid.value);
  102.     ListForm.easyJWebCommand.value="reply";
  103. ListForm.submit();
  104. }
  105. function doEdit()
  106. {
  107.     if(ListForm.cid.value==""){
  108. alert("请选择要修改的邮件!");
  109. return ;
  110. }
  111. //alert(ListForm.cid.value);
  112.     ListForm.easyJWebCommand.value="edit";
  113. ListForm.submit();
  114. }
  115. function doForward()
  116. {
  117.     if(ListForm.cid.value==""){
  118. alert("请选择转发的邮件!");
  119. return ;
  120. }
  121. //alert(ListForm.cid.value);
  122.     ListForm.easyJWebCommand.value="forward";
  123. ListForm.submit();
  124. }
  125. function doReplyAll(id)
  126. {
  127.  if(ListForm.cid.value==""){
  128. alert("请选择要回复的邮件!");
  129. return ;
  130. }
  131.     ListForm.easyJWebCommand.value="replyAll";
  132. //ListForm.cid.value=id;
  133. ListForm.submit();
  134. }
  135. function doMoveToDel()
  136. {
  137. if(confirm('邮件删除操作将把邮件移到垃圾箱,是否执行该操作?')){
  138. ListForm.newBox.value="laji";
  139. doMove();
  140. }
  141. }
  142. function show(id)
  143. {
  144. ListForm.cid.value=id;
  145. ListForm.easyJWebCommand.value="show";
  146. //ListForm.target="_blank";
  147. ListForm.submit();
  148. //ListForm.target="_self";
  149. }
  150. function gotoPage(n)
  151. {
  152. ListForm.page.value=n;
  153. ListForm.submit();
  154. }
  155. function ChangeNoEx()
  156. {
  157.     if(!CheckPositiveInt(form1.txtPageNo,"请输入一个正整数!",false))
  158.     return false;    
  159.     ChangePageNo(form1.txtPageNo.value);
  160. }
  161. //=================
  162. function setMailID(id)
  163. {
  164.   if(event.ctrlKey)
  165.   {
  166.     EmailID=id;
  167.     if(form1.msgID.value !='')
  168.       form1.msgID.value+=','+id;
  169.     else
  170.       form1.msgID.value=id;
  171.   }
  172.   else
  173.   {
  174.     EmailID=id;
  175.     form1.msgID.value=id;
  176.   }
  177. }
  178. //================
  179. //排序
  180. function doSort(fld)
  181. {
  182. if(ListForm.field.value==fld){
  183. if(ListForm.orderType.value=='asc')
  184. ListForm.orderType.value='desc';
  185. else
  186. ListForm.orderType.value='asc';
  187. }
  188. ListForm.field.value=fld;
  189. ListForm.method="post";
  190.     ListForm.submit();
  191. }
  192. //document.onselectstart =function () {return false;}
  193. function Exec_Click(n){
  194.   var SelectedId = '';
  195.   var arrUsers = temp;
  196.   var i = 0 ;
  197.    if(form1.delid.value=='')// &&SelectedId == '')
  198. {
  199. alert('请先选择邮件!') ;
  200. return ;
  201. }
  202. SelectedId = form1.delid.value;
  203. if(SelectedId.indexOf(",")==0)
  204. SelectedId = SelectedId.substring(1);
  205. form1.delid.value = "";
  206. //alert(SelectedId)
  207. //  }
  208.   switch(n){
  209.     case 0://移动到垃圾箱
  210.       //form1.Actions.value=0;
  211.       form1.msgID.value=SelectedId;
  212.       form1.action='del1.jsp';
  213.       form1.submit();
  214.       break;
  215.     case 1://彻底删除
  216.       if(confirm('邮件将不可恢复,是否真的要永久删除此邮件?')){
  217.         //form1.Actions.value=1;
  218.         form1.msgID.value=SelectedId;
  219.         form1.action='del.jsp';
  220.         form1.submit();
  221.       }
  222.       break;   
  223.     case 2://查看邮件内容
  224.     case 3://回复邮件
  225.     case 4://转发邮件
  226.       if(SelectedId.indexOf(',') == -1){
  227.         switch(n){
  228.           case 2://查看邮件内容
  229.             var urls='ShowMail.jsp?id='+SelectedId+'&uls=0';
  230.             OpenWin(urls,'ShowMail',700,450);
  231.             break;
  232.           case 3://回复邮件
  233.             self.location='replyForm.jsp?actions=RE&id='+SelectedId+"&uri=inbox";
  234.             break;
  235.           case 4://转发邮件
  236.             self.location='replyForm.jsp?actions=FWD&id='+SelectedId+"&uri=inbox";
  237.             break;
  238.         }
  239.       }
  240.       else{
  241.         alert('一次只能选择一个邮件!') ;
  242.         return ;
  243.       }
  244.       break;
  245.       case 5://移动邮件
  246.   form1.Tombx.value=document.all('lstFolderList').value;
  247.   form1.msgID.value=SelectedId;
  248.   form1.action='MoveToMailBox.jsp';
  249.   form1.method='post';
  250.   form1.submit();
  251.   break;   
  252. }
  253. }
  254. function check(obj)
  255. {
  256. var slt = form1.delid.value;
  257. if(obj.checked==true)
  258. {
  259. if(slt.indexOf(obj.value+",")<0)slt = slt+","+obj.value;
  260. }
  261. else
  262. {
  263. if(slt.indexOf(","+obj.value)>=0)slt = slt.replace(","+obj.value,"");
  264. }
  265. form1.delid.value = slt;
  266. //alert(form1.delid.value);
  267. }
  268. function checkAll(obj,value)
  269. {
  270. for(var i=0;i<obj.length;i++)
  271. {
  272. if(value=="1")
  273. {
  274. if(obj[i].checked==false)obj[i].click();
  275. }
  276. else
  277. {
  278. if(obj[i].checked==true)obj[i].click();
  279. }
  280. }
  281. }
  282. function ck(obj)
  283. {
  284. if(obj==undefined)return;
  285. if(form1.delall.checked)
  286. {
  287. form1.delall.value = "1";
  288. checkAll(obj,'1');
  289. //alert(form1.delid.value);
  290. }
  291. else
  292. {
  293. form1.delall.value = "0";
  294. checkAll(obj,'0');
  295. //alert(form1.delid.value);
  296. }
  297. }
  298. function doMoveToDel(theForm)
  299. {
  300. if(confirm('确认要删除邮件吗?')){
  301.     var _array = new Array();
  302.     var boxselect = document.getElementsByName("cids");
  303.     var count = 0;
  304.     for(var i=0;i<boxselect.length;i++){
  305.         if(boxselect[i].checked){
  306.             var value1 = boxselect[i].value;
  307.             _array[count] = value1;
  308.             count = count + 1;
  309.         }
  310.     }
  311.     //var x = _array[0];
  312.     var ss="";
  313.      if(_array.length == ""){
  314.         alert("请选择要永久删除的邮件");
  315.         return;
  316.     }
  317.     for(var j = 0;j < _array.length;j++){
  318.      ss = ss + _array[j] + "/";
  319.     }
  320.     window.location.href="MoveToServlet?id="+ss;
  321. //theForm.toBoxName.value='delbox';
  322. //doMove(theForm);
  323. }
  324. }
  325. function select2(){
  326. var _array = new Array();
  327.     var boxselect = document.getElementsByName("cids");
  328.     var count = 0;
  329.     for(var i=0;i<boxselect.length;i++){
  330.         if(boxselect[i].checked){
  331.             var value1 = boxselect[i].value;
  332.             _array[count] = value1;
  333.             count = count + 1;
  334.         }
  335.     }
  336.     //var x = _array[0];
  337.     var ss="";
  338.     if(_array.length == ""){
  339.         alert("请选择要永久删除的邮件");
  340.         return;
  341.     }
  342.     for(var j = 0;j < _array.length;j++){
  343.      ss = ss + _array[j] + "/";
  344.     }
  345.     window.location.href="SendboxServlet?id="+ss;
  346. }
  347. function mailshow(id){
  348.  window.location.href="write0.jsp?id="+id;
  349. }
  350. //-->
  351. </SCRIPT>
  352. <link href="css/css.css" rel="stylesheet" type="text/css">
  353. </head>
  354. <body bgcolor="#F2F1F2" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" scroll="no" background="images/login_bg.gif">
  355. <table width="100%" height="5%"  border="0" cellpadding="0" cellspacing="0">
  356.   <tr>
  357.     <td width="11" height="11"></td>
  358.     <td ></td>
  359.   </tr>
  360. </table>
  361. <table width="100%" height="95%"  border="0" cellpadding="0" cellspacing="0" bgcolor="ECF4F5">
  362.   <FORM id='ListForm' name="ListForm" METHOD='POST' ACTION='SendboxServlet'>
  363. <input type="hidden" name="box" value="sendbox">
  364. <input type="hidden" name="easyJWebCommand" value="list">
  365. <input type="hidden" name="subCommand" value="">
  366. <input type="hidden" name="cid"   value="">
  367. <input type="hidden" name="mulitCid"   value="">
  368. <input type="hidden" name="page"   value="1">
  369. <input name="field" type="hidden" value="">
  370.        <input name="orderType" type="hidden" value="">
  371. <tr>
  372.           <td height="20" align="center"><table height="20">
  373.               <tr>               
  374.                 <td nowrap class='coolbutton' onClick='doReply()' style="cursor:hand"><img src='images/replytogroup.gif' width='20' height='18' border='0' align='absmiddle'>回复</td>
  375.                 <td nowrap class='coolbutton' onClick='doForward()' style="cursor:hand"><img src='images/forward.gif' width='20' height='18' border='0' align='absmiddle'>转发</td>
  376.                 <td align="center" nowrap class='coolbutton' onClick="doEdit()" style="cursor:hand"><img src='images/pm.gif' width='20' height='18' border='0' align='absmiddle'> 修改 </td>                  <td align="center" nowrap class='coolbutton' onClick='doMove();' style="cursor:hand">转移到
  377. <img src='images/right.gif' width='9' height='13' border='0' align='absmiddle'>
  378. </td>
  379. <td nowrap>
  380. <select name='newBox' id='newBox'>
  381. <option value='recbox'>收件箱</option>
  382. <option value='drafts'>草稿箱</option>
  383. <option value='sendbox'>发件箱</option>
  384. <option value='laji'>垃圾箱</option>
  385. </select>  
  386. </td>
  387.                  <td align="center" nowrap class='coolbutton' onClick='doDel();' style="cursor:hand"><img src='images/delete2.gif' width='20' height='18' border='0' align='absmiddle'> 永久删除 </td>
  388.                 <td nowrap class='coolbutton' onClick='doMoveToDel()' style="cursor:hand"><img src='images/delete2.gif' width='20' height='18' border='0' align='absmiddle'>删除</td>
  389.                 <td align="center" style="cursor:hand">选中全部
  390.                     <input type="checkbox" name="delall"  value="0" onClick="selectAll(cids,this.checked);"></td>
  391.               </tr>
  392.       </table></td>
  393.     </tr>
  394.        
  395.    <tr height="100%">
  396. <td valign="top" height="100%">
  397. <div style="overflow: auto;height:95%;width:100%;">
  398.           <TABLE WIDTH='99%' height="100%" BORDER='1' bordercolor="C7D0D2" align='center' CELLPADDING='4' CELLSPACING='0' style="border-collapse: collapse" class="table1" background="images/table_headbg.gif">
  399.             <thead>
  400.               <TR align="center" valign="middle"> 
  401.                 <Td height="20" nowrap><div style="height:20;width:100%;" align="center" >选择</div></td>
  402.                 <TD height="20" nowrap > <div style="height:20;width:100%;cursor:hand"  title="点击按是否已读排序" onClick="doSort('isRead')" align="center" >状态</div></TD>
  403.                 <TD height="20" nowrap ><div style="height:20;width:100%;" align="center" >附件</div></TD>
  404.                 <TD height="20" nowrap> <div style="height:20;width:100%;cursor:hand"  title="点击按发件人排序" onClick="doSort('sendCID')" align="center">发件人</div></TD>
  405.                 <TD height="20" nowrap> <div style="height:20;width:100%;cursor:hand"  title="点击按主题排序" onClick="doSort('subject')" align="center">主题 
  406.                   </div></TD>
  407.                 <TD height="20" nowrap> <div style="height:20;width:100%;cursor:hand"  title="点击按日期排序" onClick="doSort('sendTime')" align="center">日期</div></TD>
  408.                 <TD height="20" nowrap> <div style="height:20;width:100%;cursor:hand"  title="点击按大小排序" onClick="doSort('emailSize')" align="center">大小</div></TD>
  409.               </TR>
  410.             </thead>
  411.             <% 
  412.               User user = (User)session.getAttribute("user");
  413.               SelectMail sm = new SelectMail();
  414.               List list = sm.select(user.getUsername());
  415.               session.setAttribute("list",list);
  416.               String changepage = (String)request.getParameter("page");
  417.               List list1 = mypage(list,changepage);
  418.               List list2 = (List)list1.get(0);
  419.               ActionBean ab = (ActionBean)list1.get(1);
  420.               pageContext.setAttribute("pc",ab);
  421.               if(list!=null){
  422.               Iterator item = list2.iterator();
  423.               while(item.hasNext()){ 
  424.               SendboxBean pb = (SendboxBean)item.next();
  425.               pageContext.setAttribute("pb",pb);
  426.             %>
  427.                    <TR bgcolor='F1F6F8'  id='2009092471128239143.eml' > 
  428.               <td height="26" align="center"> <input type="checkbox"   name="cids"  value = "${pb.id }" onClick="if(this.checked)selectRow(this.value);"> 
  429.               </td>
  430.               <TD height="40" align="center">
  431.               <c:if test="${pb.stat == 1}"><img src='images/new2.gif'/>
  432.               </c:if>
  433.               <c:if test="${pb.stat !=1}"></c:if>
  434.                </TD>
  435.               <TD height="26" align="center" style='word-break:break-all'>
  436.               <c:if test="${pb.adds!=null}"><img src='images/paperclip.gif'/>
  437.               </c:if>
  438.               <c:if test="${pb.adds==null}"></c:if>
  439.                </TD>
  440.               <TD ><span style="word-break:break-all">${pb.mail_to }</span></TD>
  441.               <!-- onclick="show('2009092471128239143.eml');return false;" -->
  442.               <TD  ><font color="#0000FF"><a href="#" target="_self"  onclick="mailshow(${pb.id });"><span style="word-break:break-all">${pb.subject }</span></a></font></TD>
  443.               <TD align='center'><span style="word-break:break-all">${pb.date }</span></TD>
  444.               <TD align='center'><span style="word-break:break-all">${pb.size }KB</span></TD>
  445.             </TR>
  446.             
  447. <% 
  448.            }
  449.            }
  450. %>            
  451.             <TR bgcolor='F1F6F8'  id=2005102816402618 > 
  452.               <td colspan="7" align="center"></td>
  453.             </TR>
  454.           </TABLE>
  455. </div>
  456.  </td>
  457. </tr>
  458.    
  459.    
  460.         <tr>
  461.           <td height="40" class="TableTitle" valign='top'><table bgcolor="#C1F9FD" class='cooltbl-b' width='100%' cellspacing='0' id='table_bar'>
  462.               <tr bgcolor="#C1F9FD">
  463.                
  464.                     <td height="28" colspan="5" align="right">[记录总数:<%= ab.getAll_message()%>条]
  465.                 <c:if test ="${pc.current_page==1}">
  466. [首页]
  467. </c:if>
  468. <c:if test ="${pc.current_page!=1}">
  469. <a href="sendbox.jsp?page=1">[首页]</a>
  470. </c:if>
  471. <c:if test ="${pc.upone_page == true}">
  472. <a href="sendbox.jsp?page=${pc.current_page - 1}">[上一页]</a>
  473. </c:if>
  474. <c:if test ="${pc.upone_page == false}">
  475. [上一页]
  476. </c:if>
  477. <c:if test = "${pc.next_page == true}">
  478. <a href="sendbox.jsp?page=${pc.current_page + 1}">[下一页]</a>
  479. </c:if>
  480. <c:if test = "${pc.next_page ==false}">
  481. [下一页]
  482. </c:if>
  483. <c:if test = "${pc.current_page != last_page}">
  484. <a href="sendbox.jsp?page=<%= ab.getLast_page()%>">[尾页]</a>
  485. </c:if>
  486. <c:if test = "${pc.current_page == last_page}">
  487. [尾页]
  488. </c:if> <td height="100%" align='left' bgcolor="#FFFFFF"><table bgcolor="#FFFFFF" id='table_page' width="100%">
  489.                     <tr>
  490.                       <td nowrap><b>收件箱: 3 封邮件</b></td>
  491.                       <td nowrap>&nbsp;</td>
  492.                       <td nowrap><b> 封邮件未读</b></td>
  493.                       <td align='left' nowrap>
  494.                         <table align="right" >
  495.                         
  496.                         </table></td>
  497.                     </tr>
  498.                 </table></td>
  499.               </tr>
  500.           </table></td>                    
  501.         </tr>
  502. </table>
  503. </body>
  504. </html>