| | |
| | | {multiselect:true, multiexpand:true, draggable:true, keyboard:true, dblclick_time:this.dblclick_time}); |
| | | this.message_list.row_init = function(o){ p.init_message_row(o); }; |
| | | this.message_list.addEventListener('dblclick', function(o){ p.msglist_dbl_click(o); }); |
| | | this.message_list.addEventListener('click', function(o){ p.msglist_click(o); }); |
| | | this.message_list.addEventListener('keypress', function(o){ p.msglist_keypress(o); }); |
| | | this.message_list.addEventListener('select', function(o){ p.msglist_select(o); }); |
| | | this.message_list.addEventListener('dragstart', function(o){ p.drag_start(o); }); |
| | |
| | | var selected = list.get_single_selection() != null; |
| | | |
| | | // Hide certain command buttons when Drafts folder is selected |
| | | if (this.env.mailbox == this.env.drafts_mailbox) |
| | | { |
| | | if (this.env.mailbox == this.env.drafts_mailbox) { |
| | | this.enable_command('reply', 'reply-all', 'forward', false); |
| | | this.enable_command('show', 'print', 'open', 'edit', 'download', 'viewsource', selected); |
| | | this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false)); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', 'edit', 'open', 'download', 'viewsource', selected); |
| | | this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false)); |
| | | } |
| | |
| | | this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, 200); |
| | | else if (this.env.contentframe) |
| | | this.show_contentframe(false); |
| | | }; |
| | | |
| | | // This allow as to re-select selected message and display it in preview frame |
| | | this.msglist_click = function(list) |
| | | { |
| | | if (list.multi_selecting || !this.env.contentframe) |
| | | return; |
| | | |
| | | if (list.get_single_selection() && window.frames && window.frames[this.env.contentframe]) { |
| | | if (window.frames[this.env.contentframe].location.href.indexOf(this.env.blankpage)>=0) { |
| | | this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, 200); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | this.msglist_dbl_click = function(list) |
| | |
| | | |
| | | this.env.sort_col = sort_col; |
| | | this.env.sort_order = sort_order; |
| | | } |
| | | }; |
| | | |
| | | this.set_list_options = function(cols, sort_col, sort_order, threads) |
| | | { |
| | |
| | | |
| | | if (update) |
| | | this.list_mailbox('', '', sort_col+'_'+sort_order, add_url); |
| | | } |
| | | }; |
| | | |
| | | // when user doble-clicks on a row |
| | | this.show_message = function(id, safe, preview) |
| | |
| | | var action = preview ? 'preview': 'show'; |
| | | var target = window; |
| | | |
| | | if (preview && this.env.contentframe && window.frames && window.frames[this.env.contentframe]) |
| | | { |
| | | if (preview && this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { |
| | | target = window.frames[this.env.contentframe]; |
| | | add_url = '&_framed=1'; |
| | | } |
| | |
| | | this.show_contentframe = function(show) |
| | | { |
| | | var frm; |
| | | if (this.env.contentframe && (frm = $('#'+this.env.contentframe)) && frm.length) |
| | | { |
| | | if (!show && window.frames[this.env.contentframe]) |
| | | { |
| | | if (this.env.contentframe && (frm = $('#'+this.env.contentframe)) && frm.length) { |
| | | if (!show && window.frames[this.env.contentframe]) { |
| | | if (window.frames[this.env.contentframe].location.href.indexOf(this.env.blankpage)<0) |
| | | window.frames[this.env.contentframe].location.href = this.env.blankpage; |
| | | } |
| | |
| | | if (page=='first' && this.env.current_page>1) |
| | | page = 1; |
| | | |
| | | if (page > 0 && page <= this.env.pagecount) |
| | | { |
| | | if (page > 0 && page <= this.env.pagecount) { |
| | | this.env.current_page = page; |
| | | |
| | | if (this.task=='mail') |
| | |
| | | this.http_request('search', '_filter='+filter |
| | | + (search ? '&_q='+urlencode(search) : '') |
| | | + (this.env.mailbox ? '&_mbox='+urlencode(this.env.mailbox) : ''), true); |
| | | } |
| | | }; |
| | | |
| | | // list messages of a specific mailbox |
| | | this.list_mailbox = function(mbox, page, sort, add_url) |
| | |
| | | url += '&_search='+this.env.search_request; |
| | | |
| | | // set page=1 if changeing to another mailbox |
| | | if (!page && this.env.mailbox != mbox) |
| | | { |
| | | if (!page && this.env.mailbox != mbox) { |
| | | page = 1; |
| | | this.env.current_page = page; |
| | | this.show_contentframe(false); |
| | |
| | | this.env.mailbox = mbox; |
| | | |
| | | // load message list remotely |
| | | if (this.gui_objects.messagelist) |
| | | { |
| | | if (this.gui_objects.messagelist) { |
| | | this.list_mailbox_remote(mbox, page, url); |
| | | return; |
| | | } |
| | | |
| | | if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) |
| | | { |
| | | if (this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { |
| | | target = window.frames[this.env.contentframe]; |
| | | url += '&_framed=1'; |
| | | } |
| | | |
| | | // load message list to target frame/window |
| | | if (mbox) |
| | | { |
| | | if (mbox) { |
| | | this.set_busy(true, 'loading'); |
| | | target.location.href = this.env.comm_path+'&_mbox='+urlencode(mbox)+(page ? '&_page='+page : '')+url; |
| | | } |
| | |
| | | else { |
| | | if (r.depth == depth) |
| | | r.parent_uid = parent; |
| | | if (r.unread && roots.length) { |
| | | if (r.unread && roots.length) |
| | | roots[roots.length-1].unread_children++; |
| | | } |
| | | } |
| | | } |
| | | row = row.nextSibling; |
| | |
| | | } |
| | | row = row.nextSibling; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // set message icon |
| | | this.set_message_icon = function(uid) |
| | |
| | | } |
| | | else if (rows[uid].deleted && this.env.deletedicon) |
| | | icn_src = this.env.deletedicon; |
| | | else if (rows[uid].replied && this.env.repliedicon) |
| | | { |
| | | else if (rows[uid].replied && this.env.repliedicon) { |
| | | if (rows[uid].forwarded && this.env.forwardedrepliedicon) |
| | | icn_src = this.env.forwardedrepliedicon; |
| | | else |
| | |
| | | icn_src = this.env.unflaggedicon; |
| | | if (rows[uid].flagged_icon && icn_src) |
| | | rows[uid].flagged_icon.src = icn_src; |
| | | } |
| | | }; |
| | | |
| | | // set message status |
| | | this.set_message_status = function(uid, flag, status) |
| | |
| | | rows[uid].flagged = status; |
| | | |
| | | // this.env.messages[uid] = rows[uid]; |
| | | } |
| | | }; |
| | | |
| | | // set message row status, class and icon |
| | | this.set_message = function(uid, flag, status) |
| | |
| | | |
| | | if (this.env.uid) |
| | | a_uids[0] = this.env.uid; |
| | | else |
| | | { |
| | | else { |
| | | var selection = this.message_list.get_selection(); |
| | | var id; |
| | | for (var n=0; n<selection.length; n++) { |
| | |
| | | var add_url = '&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : ''); |
| | | |
| | | // show wait message |
| | | if (this.env.action=='show') |
| | | { |
| | | if (this.env.action=='show') { |
| | | lock = true; |
| | | this.set_busy(true, 'movingmessage'); |
| | | } |
| | |
| | | |
| | | if (this.env.uid) |
| | | a_uids[0] = this.env.uid; |
| | | else |
| | | { |
| | | else { |
| | | var selection = this.message_list.get_selection(); |
| | | var id; |
| | | for (var n=0; n<selection.length; n++) { |
| | |
| | | a_uids[0] = uid; |
| | | else if (this.env.uid) |
| | | a_uids[0] = this.env.uid; |
| | | else if (this.message_list) |
| | | { |
| | | for (var n=0; n<selection.length; n++) |
| | | { |
| | | else if (this.message_list) { |
| | | for (var n=0; n<selection.length; n++) { |
| | | a_uids[a_uids.length] = selection[n]; |
| | | } |
| | | } |
| | |
| | | if (!this.message_list) |
| | | r_uids = a_uids; |
| | | else |
| | | for (var id, n=0; n<a_uids.length; n++) |
| | | { |
| | | for (var id, n=0; n<a_uids.length; n++) { |
| | | id = a_uids[n]; |
| | | if ((flag=='read' && this.message_list.rows[id].unread) |
| | | || (flag=='unread' && !this.message_list.rows[id].unread) |
| | |
| | | if (!r_uids.length && !this.select_all_mode) |
| | | return; |
| | | |
| | | switch (flag) |
| | | { |
| | | switch (flag) { |
| | | case 'read': |
| | | case 'unread': |
| | | this.toggle_read_status(flag, r_uids); |
| | |
| | | // move cursor before the signature |
| | | this.set_caret_pos(input_message.get(0), cursor_pos); |
| | | } |
| | | else if (is_html && show_sig && this.env.signatures) { // html |
| | | else if (show_sig && this.env.signatures) { // html |
| | | var editor = tinyMCE.get(this.env.composebody); |
| | | var sigElem = editor.dom.get('_rc_sig'); |
| | | |