listBox.jsp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <%@ page contentType="text/html;charset=GBK"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html>
  5. <head>
  6. <Title>收件箱</Title>
  7. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  8. <link href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  9. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  10. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/ligerui.all.js" type="text/javascript">
  11. <link href="${pageContext.request.contextPath}/main.css" rel="stylesheet" type="text/css" />
  12. <script type="text/javascript" src="/shares/js/constant.js"></script>
  13. <script type="text/javascript" src="/shares/js/common.js"></script>
  14. <script type="text/javascript" src="/shares/js/yw/master1_oa/mail/mail.js"></script>
  15. <style type="text/css">
  16. .loading{ font-size:12px;height:16px;line-height:16px;}
  17. .loading img{width:16px;height:16px;margin-right:5px;}
  18. .l-button{margin-left:10px;}
  19. #layout1{width:99.5%;margin:0; padding:0;}
  20. img{vertical-align:middle;}
  21. </style>
  22. <script type="text/javascript">
  23. var grid;
  24. $(function () {
  25. if(haveDefUser("${mailUser.userName}")){
  26. $("#layout1").ligerLayout({
  27. leftWidth : 200,
  28. height : '99%'
  29. });
  30. grid = $("#maingrid4").ligerGrid({
  31. columns: [
  32. { display: '', name: 'state',width:"6%",
  33. render:function(row){
  34. var html = '';
  35. /* var t = row.is_read == "0" ? "0" : "-16px";
  36. html += '<span style="width: 18px;height: 16px;background:url(/shares/images/oa/mail/mail_icon.png) -48px '+t+' no-repeat;"></span>';
  37. t = row.contain_attach == "1" ? "background:url(/shares/images/oa/mail/paperclip.gif) no-repeat;" : "";
  38. html += '<span style="width: 18px;height: 16px;'+t+'"></span>'; */
  39. if(row.is_read == "1"){
  40. html += "<img src='/shares/images/oa/mail/mail_read.png' />";
  41. }else{
  42. html += "<img src='/shares/images/oa/mail/mail_unread.png' />";
  43. }
  44. if(row.contain_attach == "1"){
  45. html += "&nbsp;<img src='/shares/images/oa/mail/paperclip.gif' />";
  46. }
  47. return html;
  48. }
  49. },
  50. { display: '标题', name: 'mail_subject',align:"left", width: "50%",
  51. render:function(row){
  52. var mail_subject = row.mail_subject;
  53. if(mail_subject == null || mail_subject == '' || mail_subject == 'null'){
  54. mail_subject = '(无标题)';
  55. }
  56. var html = '<a href="javascript:void(0);" onclick="show(\''+row.universalid+'\');">'+mail_subject+"</a>";
  57. return html;
  58. }},
  59. { display: '发件人', name: 'mail_sender',align:"left", width: "22%"},
  60. { display: '日期', name: 'mail_send_date', width: "15%",
  61. render:function(row){
  62. // 如果是当天,则只显示时间
  63. var d = row.mail_send_date.substring(0,10);
  64. if(d == getCurentDate()){
  65. return row.mail_send_date.substring(10,16);
  66. }else{
  67. return d;
  68. }
  69. }}
  70. ],
  71. pageSize:20,
  72. url: 'MTMailAction.do?task=listMail&box=${box}&time=' + new Date().getTime(),
  73. pageParmName: 'p', //页索引参数名,(提交给服务器)
  74. pagesizeParmName: 'pSize', //页记录数参数名,(提交给服务器)
  75. width: '99.9%',
  76. height: '99%',
  77. rowAttrRender: function(rowdata,rowid)
  78. {
  79. var style= ''; //'style="cursor: pointer;';
  80. if(rowdata.is_read == '0'){
  81. style += 'style="font-weight: bold;" ';
  82. }
  83. return style; // + '"';
  84. },
  85. checkbox: true,
  86. onAfterShowData:refreshBtn
  87. });
  88. $("#pageloading").hide();
  89. showBoxMailCount();
  90. }
  91. });
  92. function refreshBtn(data){
  93. if(data == undefined || data.Rows.length == 0){
  94. $("#maingrid4").find("div[class*='l-grid-body']:last").html("<div style='padding-top:50px;width:100%;text-align:center'>没有查询到相关信息……</div>");
  95. }
  96. }
  97. /**
  98. * 获取选择的行
  99. */
  100. function getCheckedData()
  101. {
  102. var rows = grid.getCheckedRows();
  103. var str = "";
  104. $(rows).each(function ()
  105. {
  106. if(str != "") str += ",";
  107. str += this.universalid;
  108. });
  109. // alert(str);
  110. return str;
  111. }
  112. /**
  113. * 删除
  114. */
  115. function delMail(){
  116. var str = getCheckedData();
  117. if(str == ""){
  118. $.ligerDialog.warn("请选择您要删除的邮件!");
  119. return;
  120. }
  121. if("${box}" == "delbox"){
  122. // 如果是垃圾箱的邮件,则永久删除
  123. $.ligerDialog.confirm('所选择的邮件将被永久删除,确定要继续吗?', function (yes) {
  124. if(yes){
  125. location.href = "${pageContext.request.contextPath }/MTMailAction.do?task=delMail&ids="+str+"&box=${box}";
  126. }
  127. });
  128. }else{
  129. // 移动到垃圾箱
  130. $.ligerDialog.confirm('确定要删除所选择的邮件吗?', function (yes) {
  131. if(yes){
  132. location.href = "${pageContext.request.contextPath }/MTMailAction.do?task=move&ids="+str+"&newbox=delbox&box=${box}";
  133. }
  134. });
  135. }
  136. }
  137. /**
  138. * 查询
  139. */
  140. function searchByKword(){
  141. grid.set("parms", [{
  142. name : "mail_subject",
  143. value : encodeURI(encodeURI($("#mail_subject").val()))
  144. }
  145. ]);
  146. grid.set("newPage", "1");
  147. grid.loadData(true);
  148. }
  149. /**
  150. * 写邮件
  151. */
  152. function sendMail(){
  153. location.href = '${pageContext.request.contextPath }/MTMailAction.do?task=toSend';
  154. }
  155. /**
  156. * 收件
  157. */
  158. function receive(){
  159. $("#wait").show();
  160. $("#btnReceive").attr("disabled","disabled");
  161. $.ajax({
  162. type:"POST",
  163. url:"${pageContext.request.contextPath }/MTMailAction.do?task=receive",
  164. timeout:600000,
  165. cache:false,
  166. dataType:"json",
  167. success:function(data){
  168. var result = data.result;
  169. if(result != "1"){
  170. $.ligerDialog.warn("对不起,无法连接邮件服务器!请检查网络或个人邮件配置!");
  171. }else{
  172. toMailList('');
  173. }
  174. },
  175. complete:function(data){
  176. $("#wait").hide();
  177. $("#btnReceive").attr("disabled","");
  178. }
  179. });
  180. }
  181. /**
  182. * 显示文件夹的邮件数量
  183. */
  184. function showBoxMailCount(){
  185. $("a[box]").each(function(){
  186. var box = $(this).attr("box");
  187. $.ajax({
  188. type:"POST",
  189. url:"${pageContext.request.contextPath }/MTMailAction.do?task=getMailCount&box="+box,
  190. cache:false,
  191. dataType:"json",
  192. async:false,
  193. success:function(data){
  194. var count = data.count;
  195. if(count > 0){
  196. var obj = $("#mailcount_"+data.box);
  197. obj.text("("+count+")");
  198. obj.show();
  199. if(data.isDelBox == "1"){
  200. obj.next("a").show(); // 显示清空链接
  201. }
  202. }
  203. },
  204. error:function(err){
  205. showAjaxError(err);
  206. }
  207. });
  208. });
  209. }
  210. /**
  211. * 读邮件
  212. */
  213. function show(id){
  214. var parm = '&id='+id+'&box=${box}&userName=${mailUser.userName}&domainName=${mailUser.domainName}';
  215. var task = "show";
  216. if("${box}" == "draftbox"){
  217. task = "toEdit";
  218. }
  219. location.href = '${pageContext.request.contextPath }/MTMailAction.do?task='+task+parm;
  220. }
  221. /**
  222. * 清空文件夹
  223. */
  224. function clearBox(box, boxName){
  225. $.ligerDialog.confirm("确定要清空"+boxName+"吗?", function (yes) {
  226. if(yes){
  227. location.href = '${pageContext.request.contextPath }/MTMailAction.do?task=clearDir&from=listMail&box=${box}&clearBox='+box;
  228. }
  229. });
  230. }
  231. function getCurentDate(){
  232. var now = new Date();
  233. var year = now.getFullYear(); //年
  234. var month = now.getMonth() + 1; //月
  235. var day = now.getDate(); //日
  236. var clock = year + "-";
  237. if(month < 10)
  238. clock += "0";
  239. clock += month + "-";
  240. if(day < 10)
  241. clock += "0";
  242. clock += day;
  243. return(clock);
  244. }
  245. </SCRIPT>
  246. </head>
  247. <Body>
  248. <div class="container-layout">
  249. <div id="layout1">
  250. <div position="left" title="${mailUser.userName}@${mailUser.domainName}" class="user-tree-style" style="height:95%">
  251. <div id="deptBtn">
  252. <input type="button" value="收取" id="btnReceive" style="width: 80px;" class="l-button" onclick="receive()"/>
  253. <input type="button" value="写邮件" style="width: 80px;" class="l-button" onclick="sendMail()"/>
  254. </div>
  255. <table style="width:100%;margin-top: 20px;" id="tabMailUser">
  256. <c:forEach var="item" items="${boxes}">
  257. <tr style="height: 40px;">
  258. <td style="padding-left:20px;font-size: 16px;vertical-align: middle;">
  259. <a href="javascript:void(0);"><img src="/shares/images/oa/mail/${item.code }.gif" border="0" style="vertical-align:middle;" onclick="toMailList('${item.code }')"></a>
  260. <a href="javascript:void(0);" style="margin-right: 20px" onclick="toMailList('${item.code }')">${item.name }</a>
  261. <c:if test="${item.hide_count == '0' }">
  262. <a href="javascript:void(0);" id="mailcount_${item.code }" box="${item.code }" style="font-size: 12px;color: red;display: none;" onclick="toMailList('${item.code }')">(${newMailCount})</a>
  263. </c:if>
  264. <a href="javascript:void(0)" style="font-size: 12px;display: none;" onclick="clearBox('${item.code}', '${item.name }')">[清空]</a>
  265. </td>
  266. </tr>
  267. </c:forEach>
  268. </table>
  269. <div style="position:absolute;height:30px;bottom:10px;padding-left:20px;">
  270. <a href="javascript:void(0)" onclick="mailConf()">
  271. <img src="/shares/images/oa/mail/icon_set.png"/>&nbsp;邮箱配置
  272. </a>&nbsp;&nbsp;
  273. <a href="javascript:void(0)" onclick="showFolder()">
  274. <img src="/shares/images/oa/mail/folder.gif"/>&nbsp;文件夹管理
  275. </a>
  276. </div>
  277. </div>
  278. <div position="center" title="${boxName }" class="user-tree-style">
  279. <div id="deptBtn" style="text-align: left;">
  280. <input type="button" value="删除" class="l-button" onclick="delMail();" />
  281. <c:if test="${box == 'delbox' }">
  282. <input type="button" value="清空" class="l-button" onclick="clearBox('${box}','${boxName }');" />
  283. </c:if>
  284. <span id="wait" class="loading" style="display:none;margin-left: 10px;"><img src="/shares/images/mailloading.gif"/>正在接收邮件, 请稍候...</span>
  285. </div>
  286. <div style="overflow: hidden; clear: both;">
  287. <div id="maingrid4" style="margin: 0; padding: 0"></div>
  288. </div>
  289. </div>
  290. </div>
  291. </div>
  292. <%@ include file="/include/message.jsp"%>
  293. </BODY>
  294. </HTML>