| | |
| | | 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); }); |
| | | this.message_list.addEventListener('dragmove', function(o, e){ p.drag_move(e); }); |
| | | this.message_list.addEventListener('dragend', function(o, e){ p.drag_end(e); }); |
| | | this.message_list.addEventListener('dragmove', function(e){ p.drag_move(e); }); |
| | | this.message_list.addEventListener('dragend', function(e){ p.drag_end(e); }); |
| | | document.onmouseup = function(e){ return p.doc_mouse_up(e); }; |
| | | |
| | | this.message_list.init(); |
| | |
| | | this.contact_list.addEventListener('keypress', function(o){ p.contactlist_keypress(o); }); |
| | | this.contact_list.addEventListener('select', function(o){ p.contactlist_select(o); }); |
| | | this.contact_list.addEventListener('dragstart', function(o){ p.drag_start(o); }); |
| | | this.contact_list.addEventListener('dragmove', function(o, e){ p.drag_move(e); }); |
| | | this.contact_list.addEventListener('dragend', function(o, e){ p.drag_end(e); }); |
| | | this.contact_list.addEventListener('dragmove', function(e){ p.drag_move(e); }); |
| | | this.contact_list.addEventListener('dragend', function(e){ p.drag_end(e); }); |
| | | this.contact_list.init(); |
| | | |
| | | if (this.env.cid) |
| | |
| | | this.env.folder_coords = new Array(); |
| | | for (var k in model) { |
| | | if (li = this.get_folder_li(k)) { |
| | | pos = $(li.firstChild).offset(); |
| | | // only visible folders |
| | | if (height = li.firstChild.offsetHeight) |
| | | this.env.folder_coords[k] = { x1:pos.left, y1:pos.top, x2:pos.left + li.firstChild.offsetWidth, y2:pos.top + height }; |
| | | // only visible folders |
| | | if (height = li.firstChild.offsetHeight) { |
| | | pos = $(li.firstChild).offset(); |
| | | this.env.folder_coords[k] = { x1:pos.left, y1:pos.top, |
| | | x2:pos.left + li.firstChild.offsetWidth, y2:pos.top + height, on:0 }; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | this.drag_end = function(e) |
| | | { |
| | | this.drag_active = false; |
| | | this.env.last_folder_target = null; |
| | | |
| | | // over the folders |
| | | if (this.gui_objects.folderlist && this.env.folder_coords) { |
| | | for (var k in this.env.folder_coords) { |
| | | if (k == this.env.last_folder_target) { |
| | | if (this.env.folder_coords[k].on) |
| | | $(this.get_folder_li(k)).removeClass('droptarget'); |
| | | this.env.last_folder_target = null; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | |
| | | var li, pos, mouse; |
| | | mouse = rcube_event.get_mouse_pos(e); |
| | | pos = this.env.folderlist_coords; |
| | | |
| | | mouse.y += toffset; |
| | | |
| | | // if mouse pointer is outside of folderlist |
| | | if (mouse.x < pos.x1 || mouse.x >= pos.x2 || mouse.y < pos.y1 || mouse.y >= pos.y2) { |
| | | if (this.env.last_folder_target) { |
| | | if (this.env.last_folder_target) { |
| | | $(this.get_folder_li(this.env.last_folder_target)).removeClass('droptarget'); |
| | | this.env.last_folder_target = null; |
| | | } |
| | | this.env.folder_coords[this.env.last_folder_target].on = 0; |
| | | this.env.last_folder_target = null; |
| | | } |
| | | return; |
| | | } |
| | | |
| | | |
| | | // over the folders |
| | | for (var k in this.env.folder_coords) { |
| | | pos = this.env.folder_coords[k]; |
| | | if (this.check_droptarget(k) && ((mouse.x >= pos.x1) && (mouse.x < pos.x2) |
| | | && (mouse.y >= pos.y1) && (mouse.y < pos.y2))) { |
| | | if (mouse.x >= pos.x1 && mouse.x < pos.x2 && mouse.y >= pos.y1 && mouse.y < pos.y2 |
| | | && this.check_droptarget(k)) { |
| | | $(this.get_folder_li(k)).addClass('droptarget'); |
| | | this.env.last_folder_target = k; |
| | | } |
| | | else { |
| | | $(this.get_folder_li(k)).removeClass('droptarget'); |
| | | if (k == this.env.last_folder_target) |
| | | this.env.last_folder_target = null; |
| | | } |
| | | this.env.folder_coords[k].on = 1; |
| | | } |
| | | else if (pos.on) { |
| | | $(this.get_folder_li(k)).removeClass('droptarget'); |
| | | this.env.folder_coords[k].on = 0; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | this.collapse_folder = function(id) |
| | | { |
| | | var div; |
| | |
| | | lock = true; |
| | | this.set_busy(true, 'movingmessage'); |
| | | } |
| | | else if (!this.env.flag_for_deletion) |
| | | else |
| | | this.show_contentframe(false); |
| | | |
| | | // Hide message command buttons until a message is selected |
| | | this.enable_command('reply', 'reply-all', 'forward', 'delete', 'mark', 'print', 'open', 'viewsource', 'download', false); |
| | | |
| | | this._with_selected_messages('moveto', lock, add_url, (this.env.flag_for_deletion ? false : true)); |
| | | this._with_selected_messages('moveto', lock, add_url); |
| | | }; |
| | | |
| | | // delete selected messages from the current mailbox |
| | |
| | | if (!this.env.uid && !selection.length) |
| | | return; |
| | | |
| | | // if there is a trash mailbox defined and we're not currently in it: |
| | | if (this.env.trash_mailbox && String(this.env.mailbox).toLowerCase() != String(this.env.trash_mailbox).toLowerCase()) |
| | | { |
| | | // if config is set to flag for deletion |
| | | if (this.env.flag_for_deletion) |
| | | this.mark_message('delete'); |
| | | // if there isn't a defined trash mailbox or we are in it |
| | | else if (!this.env.trash_mailbox || String(this.env.mailbox).toLowerCase() == String(this.env.trash_mailbox).toLowerCase()) |
| | | this.permanently_remove_messages(); |
| | | // if there is a trash mailbox defined and we're not currently in it |
| | | else { |
| | | // if shift was pressed delete it immediately |
| | | if (this.message_list && this.message_list.shiftkey) |
| | | { |
| | |
| | | else |
| | | this.move_messages(this.env.trash_mailbox); |
| | | } |
| | | // if there is a trash mailbox defined but we *are* in it: |
| | | else if (this.env.trash_mailbox && String(this.env.mailbox).toLowerCase() == String(this.env.trash_mailbox).toLowerCase()) |
| | | this.permanently_remove_messages(); |
| | | // if there isn't a defined trash mailbox and the config is set to flag for deletion |
| | | else if (!this.env.trash_mailbox && this.env.flag_for_deletion) |
| | | { |
| | | this.mark_message('delete'); |
| | | if (this.env.action == 'show') |
| | | this.command('nextmessage', '', this); |
| | | else if (selection.length == 1) |
| | | this.message_list.select_next(); |
| | | } |
| | | // if there isn't a defined trash mailbox and the config is set NOT to flag for deletion |
| | | else if (!this.env.trash_mailbox) |
| | | this.permanently_remove_messages(); |
| | | }; |
| | | |
| | | // delete the selected messages permanently |
| | |
| | | return; |
| | | |
| | | this.show_contentframe(false); |
| | | this._with_selected_messages('delete', false, '&_from='+(this.env.action ? this.env.action : ''), true); |
| | | this._with_selected_messages('delete', false, '&_from='+(this.env.action ? this.env.action : '')); |
| | | }; |
| | | |
| | | // Send a specifc request with UIDs of all selected messages |
| | |
| | | { |
| | | id = selection[n]; |
| | | a_uids[a_uids.length] = id; |
| | | |
| | | if (remove) |
| | | this.message_list.remove_row(id, (n == selection.length-1)); |
| | | else |
| | | { |
| | | this.set_message_status(id, 'deleted', true); |
| | | if (this.env.read_when_deleted) |
| | | this.set_message_status(id, 'unread', false); |
| | | this.set_message(id); |
| | | } |
| | | this.message_list.remove_row(id, (n == selection.length-1)); |
| | | } |
| | | } |
| | | |
| | |
| | | uid = a_uids[i]; |
| | | if (rows[uid]) |
| | | { |
| | | this.set_message(uid, 'deleted', true); |
| | | if (rows[uid].unread) |
| | | r_uids[r_uids.length] = uid; |
| | | |
| | | if (this.env.skip_deleted) |
| | | this.message_list.remove_row(uid, (i == this.message_list.selection.length-1)); |
| | | else |
| | | this.set_message(uid, 'deleted', true); |
| | | } |
| | | } |
| | | |
| | | add_url = '&_from='+(this.env.action ? this.env.action : ''); |
| | | |
| | | if (r_uids.length) |
| | | add_url = '&_ruid='+r_uids.join(','); |
| | | add_url += '&_ruid='+r_uids.join(','); |
| | | |
| | | if (this.env.skip_deleted) { |
| | | // also send search request to get the right messages |
| | | if (this.env.search_request) |
| | | add_url += '&_search='+this.env.search_request; |
| | | if (this.env.next_uid) |
| | | add_url += '&_next_uid='+this.env.next_uid; |
| | | } |
| | | |
| | | this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag=delete'+add_url); |
| | | return true; |
| | | }; |