| | |
| | | | Copyright (C) 2005, RoundCube Dev, - Switzerland | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | Modified: 2005/11/13 (roundcube) | |
| | | | Modified: 2005/12/14 (roundcube) | |
| | | | | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | |
| | | this.enable_command('logout', true); |
| | | |
| | | // disable browser's contextmenus |
| | | //document.oncontextmenu = function(){ return false; } |
| | | // document.oncontextmenu = function(){ return false; } |
| | | |
| | | // flag object as complete |
| | | this.loaded = true; |
| | |
| | | return false; |
| | | |
| | | //this.messageform = this.gui_objects.messageform; |
| | | var input_from = rcube_find_object('_from'); |
| | | var input_to = rcube_find_object('_to'); |
| | | var input_cc = rcube_find_object('_cc'); |
| | | var input_bcc = rcube_find_object('_bcc'); |
| | |
| | | this.init_address_input_events(input_cc); |
| | | if (input_bcc) |
| | | this.init_address_input_events(input_bcc); |
| | | |
| | | // add signature according to selected identity |
| | | if (input_from && input_from.type=='select-one') |
| | | this.change_identity(input_from); |
| | | |
| | | if (input_to && input_to.value=='') |
| | | input_to.focus(); |
| | |
| | | // get the type of sorting |
| | | var a_sort = props.split('_'); |
| | | var sort_col = a_sort[0]; |
| | | var sort_order = a_sort[1].toUpperCase(); |
| | | var sort_order = a_sort[1] ? a_sort[1].toUpperCase() : null; |
| | | var header; |
| | | |
| | | // no sort order specified: toggle |
| | | if (sort_order==null) |
| | | { |
| | | if (this.env.sort_col==sort_col) |
| | | sort_order = this.env.sort_order=='ASC' ? 'DESC' : 'ASC'; |
| | | else |
| | | sort_order = this.env.sort_order; |
| | | } |
| | | |
| | | if (this.env.sort_col==sort_col && this.env.sort_order==sort_order) |
| | | break; |
| | |
| | | this.env.sort_order = sort_order; |
| | | |
| | | // reload message list |
| | | this.list_mailbox('', '', props); |
| | | this.list_mailbox('', '', sort_col+'_'+sort_order); |
| | | break; |
| | | |
| | | case 'nextpage': |
| | |
| | | break; |
| | | |
| | | case 'delete-folder': |
| | | if (confirm('Do you really want to delete this folder?')) |
| | | if (confirm(this.get_label('deletefolderconfirm'))) |
| | | this.delete_folder(props); |
| | | break; |
| | | |
| | |
| | | |
| | | if (!this.in_selection_before) |
| | | { |
| | | var shift = this.check_shiftkey(e); |
| | | this.select(id, shift); |
| | | var ctrl = this.check_ctrlkey(e); |
| | | this.select(id, ctrl); |
| | | } |
| | | |
| | | if (this.selection.length) |
| | |
| | | // onmouseup-handler of message list row |
| | | this.click_row = function(e, id) |
| | | { |
| | | var shift = this.check_shiftkey(e); |
| | | var ctrl = this.check_ctrlkey(e); |
| | | |
| | | // don't do anything (another action processed before) |
| | | if (this.dont_select) |
| | |
| | | } |
| | | |
| | | if (!this.drag_active && this.in_selection_before==id) |
| | | this.select(id, (shift && this.task!='settings')); |
| | | this.select(id, (ctrl && this.task!='settings')); |
| | | |
| | | this.drag_start = false; |
| | | this.in_selection_before = false; |
| | | |
| | | // row was double clicked |
| | | if (this.task=='mail' && this.list_rows && this.list_rows[id].clicked && !shift) |
| | | if (this.task=='mail' && this.list_rows && this.list_rows[id].clicked && !ctrl) |
| | | { |
| | | this.show_message(id); |
| | | return false; |
| | |
| | | /*********************************************************/ |
| | | /********* message compose methods *********/ |
| | | /*********************************************************/ |
| | | |
| | | |
| | | this.change_identity = function(obj) |
| | | { |
| | | if (!obj || !obj.options) |
| | | return false; |
| | | |
| | | var id = obj.options[obj.selectedIndex].value; |
| | | var input_message = rcube_find_object('_message'); |
| | | var message = input_message ? input_message.value : ''; |
| | | var sig, p; |
| | | |
| | | // remove the 'old' signature |
| | | if (this.env.identity && this.env.signatures && this.env.signatures[this.env.identity]) |
| | | { |
| | | sig = this.env.signatures[this.env.identity]; |
| | | if (sig.indexOf('-- ')!=0) |
| | | sig = '-- \n'+sig; |
| | | |
| | | p = message.lastIndexOf(sig); |
| | | if (p>=0) |
| | | message = message.substring(0, p-1) + message.substring(p+sig.length, message.length); |
| | | } |
| | | |
| | | // add the new signature string |
| | | if (this.env.signatures && this.env.signatures[id]) |
| | | { |
| | | sig = this.env.signatures[id]; |
| | | if (sig.indexOf('-- ')!=0) |
| | | sig = '-- \n'+sig; |
| | | message += '\n'+sig; |
| | | } |
| | | |
| | | if (input_message) |
| | | input_message.value = message; |
| | | |
| | | this.env.identity = id; |
| | | }; |
| | | |
| | | |
| | | this.show_attachment_form = function(a) |
| | |
| | | { |
| | | if (folder) |
| | | { |
| | | for (var id in this.env.subscriptionrows) |
| | | if (this.env.subscriptionrows[id]==folder) |
| | | break; |
| | | |
| | | var row; |
| | | if (id && (row = document.getElementById(id))) |
| | | row.style.display = 'none'; |
| | | |
| | | this.http_request('delete-folder', '_mboxes='+escape(folder)); |
| | | } |
| | | }; |
| | | |
| | | |
| | | this.remove_folder_row = function(folder) |
| | | { |
| | | for (var id in this.env.subscriptionrows) |
| | | if (this.env.subscriptionrows[id]==folder) |
| | | break; |
| | | |
| | | var row; |
| | | if (id && (row = document.getElementById(id))) |
| | | row.style.display = 'none'; |
| | | }; |
| | | |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | // check if Shift-key is pressed on event |
| | | this.check_ctrlkey = function(e) |
| | | { |
| | | if(!e && window.event) |
| | | e = window.event; |
| | | |
| | | if(bw.linux && bw.ns4 && e.modifiers) |
| | | return true; |
| | | else if (bw.mac) |
| | | return this.check_shiftkey(e); |
| | | else if((bw.ns4 && e.modifiers & Event.CTRL_MASK) || (e && e.ctrlKey)) |
| | | return true; |
| | | else |
| | | return false; |
| | | } |
| | | |
| | | this.get_mouse_pos = function(e) |
| | | { |