| | |
| | | |
| | | // enable mail commands |
| | | this.enable_command('list', 'checkmail', 'compose', 'add-contact', 'search', 'reset-search', true); |
| | | |
| | | if (this.env.search_text != null && document.getElementById('quicksearchbox') != null) |
| | | document.getElementById('quicksearchbox').value = this.env.search_text; |
| | | |
| | | if (this.env.action=='show' || this.env.action=='preview') |
| | | { |
| | |
| | | { |
| | | this.gui_objects.folderlist = this.gui_objects.mailboxlist; |
| | | this.http_request('getunread', ''); |
| | | } |
| | | |
| | | // ask user to send MDN |
| | | if (this.env.mdn_request && this.env.uid) |
| | | { |
| | | var mdnurl = '_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox); |
| | | if (confirm(this.get_label('mdnrequest'))) |
| | | this.http_post('sendmdn', mdnurl); |
| | | else |
| | | this.http_post('mark', mdnurl+'&_flag=mdnsent'); |
| | | } |
| | | |
| | | break; |
| | |
| | | case 'list': |
| | | if (this.task=='mail') |
| | | { |
| | | if (this.env.search_request<0 || (this.env.search_request && props != this.env.mailbox)) |
| | | if (this.env.search_request<0 || (props != '' && (this.env.search_request && props != this.env.mailbox))) |
| | | this.reset_qsearch(); |
| | | |
| | | this.list_mailbox(props); |
| | |
| | | |
| | | if (!this.check_compose_input()) |
| | | break; |
| | | |
| | | |
| | | // Reset the auto-save timer |
| | | self.clearTimeout(this.save_timer); |
| | | |
| | |
| | | this.command('show'); |
| | | else if (list.key_pressed == list.DELETE_KEY) |
| | | this.command('delete'); |
| | | else |
| | | list.shiftkey = false; |
| | | }; |
| | | |
| | | |
| | |
| | | |
| | | if (safe) |
| | | add_url = '&_safe=1'; |
| | | |
| | | // also send search request to get the right messages |
| | | if (this.env.search_request) |
| | | add_url += '&_search='+this.env.search_request; |
| | | |
| | | if (id) |
| | | { |
| | |
| | | var input_message = rcube_find_object('_message'); |
| | | |
| | | // check for empty recipient |
| | | if (input_to && !rcube_check_email(input_to.value, true)) |
| | | if (input_to && !rcube_check_email(input_to.value.replace(/^\s+/, '').replace(/[\s,;]+$/, ''), true)) |
| | | { |
| | | alert(this.get_label('norecipientwarning')); |
| | | input_to.focus(); |
| | |
| | | // upload attachment file |
| | | this.upload_file = function(form) |
| | | { |
| | | |
| | | if (!form) |
| | | return false; |
| | | |
| | |
| | | { |
| | | var anchors = row.obj.getElementsByTagName('A'); |
| | | if (anchors[0]) |
| | | anchors[0].onclick = function() { p.rename_folder(row.id); }; |
| | | anchors[0].onclick = function() { p.rename_folder(row.id); return false; }; |
| | | if (anchors[1]) |
| | | anchors[1].onclick = function() { p.delete_folder(row.id); }; |
| | | anchors[1].onclick = function() { p.delete_folder(row.id); return false; }; |
| | | row.obj.onmouseover = function() { p.focus_subscription(row.id); }; |
| | | row.obj.onmouseout = function() { p.unfocus_subscription(row.id); }; |
| | | } |
| | |
| | | { |
| | | var row, folder; |
| | | var reg = RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); |
| | | if (this.env.subscriptionrows[id] && |
| | | (folder = this.env.subscriptionrows[id][0]) && |
| | | this.drag_active && this.check_droptarget(folder) && |
| | | (folder != this.env.folder.replace(reg, '')) && |
| | | (!folder.match(new RegExp('^'+RegExp.escape(this.env.folder+this.env.delimiter)))) && |
| | | (row = document.getElementById(id))) |
| | | if (find_in_array(this.env.defaultfolders, folder)>=0) |
| | | |
| | | if (this.drag_active && (row = document.getElementById(id))) |
| | | if (this.env.subscriptionrows[id] && |
| | | (folder = this.env.subscriptionrows[id][0])) |
| | | { |
| | | if (this.env.folder.replace(reg, '')!='') |
| | | if (this.check_droptarget(folder) && |
| | | (folder != this.env.folder.replace(reg, '')) && |
| | | (!folder.match(new RegExp('^'+RegExp.escape(this.env.folder+this.env.delimiter))))) |
| | | { |
| | | this.set_env('dstfolder', this.env.delimiter); |
| | | this.set_classname(this.subscription_list.frame, 'droptarget', true); |
| | | this.set_env('dstfolder', folder); |
| | | this.set_classname(row, 'droptarget', true); |
| | | } |
| | | } |
| | | else |
| | | else if (this.env.folder.match(new RegExp(RegExp.escape(this.env.delimiter)))) |
| | | { |
| | | this.set_env('dstfolder', folder); |
| | | this.set_classname(row, 'droptarget', true); |
| | | this.set_env('dstfolder', this.env.delimiter); |
| | | this.set_classname(this.subscription_list.frame, 'droptarget', true); |
| | | } |
| | | } |
| | | |
| | | |
| | | this.unfocus_subscription = function(id) |
| | | { |
| | | var row, folder; |
| | | if (this.env.subscriptionrows[id] && |
| | | (folder = this.env.subscriptionrows[id][0]) && |
| | | (row = document.getElementById(id))) |
| | | { |
| | | var row; |
| | | this.set_env('dstfolder', null); |
| | | if (find_in_array(this.env.defaultfolders, folder)>=0) |
| | | this.set_classname(this.subscription_list.frame, 'droptarget', false); |
| | | else |
| | | if (this.env.subscriptionrows[id] && |
| | | (row = document.getElementById(id))) |
| | | this.set_classname(row, 'droptarget', false); |
| | | } |
| | | else |
| | | this.set_classname(this.subscription_list.frame, 'droptarget', false); |
| | | } |
| | | |
| | | |
| | |
| | | this.rename_folder = function(id) |
| | | { |
| | | var temp, row, form; |
| | | var folder = this.env.subscriptionrows[id][0]; |
| | | |
| | | // reset current renaming |
| | | if (temp = this.edit_folder) |
| | |
| | | return; |
| | | } |
| | | |
| | | if (id && (row = document.getElementById(id))) |
| | | if (id && this.env.subscriptionrows[id] && (row = document.getElementById(id))) |
| | | { |
| | | var reg = new RegExp('.*['+RegExp.escape(this.env.delimiter)+']'); |
| | | this.name_input = document.createElement('INPUT'); |
| | | this.name_input.value = folder.replace(reg, ''); |
| | | this.name_input.value = this.env.subscriptionrows[id][1].replace(reg, ''); |
| | | this.name_input.style.width = '100%'; |
| | | |
| | | reg = new RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); |
| | | this.name_input.setAttribute('parent', folder.replace(reg, '')); |
| | | this.name_input.__parent = this.env.subscriptionrows[id][0].replace(reg, ''); |
| | | this.name_input.onkeypress = function(e){ rcmail.name_input_keypress(e); }; |
| | | |
| | | row.cells[0].replaceChild(this.name_input, row.cells[0].firstChild); |
| | |
| | | var newname = this.name_input ? this.name_input.value : null; |
| | | if (this.edit_folder && newname) |
| | | { |
| | | if (this.name_input.getAttribute('parent') && this.name_input.getAttribute('parent')!='') |
| | | newname = this.name_input.getAttribute('parent')+this.env.delimiter+newname; |
| | | this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname)); |
| | | if (this.name_input.__parent) |
| | | newname = this.name_input.__parent + this.env.delimiter + newname; |
| | | this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname)); |
| | | } |
| | | } |
| | | // escape |
| | |
| | | this.check_for_recent = function() |
| | | { |
| | | if (this.busy) |
| | | { |
| | | this.send_keep_alive(); |
| | | return; |
| | | } |
| | | |
| | | this.set_busy(true, 'checkingmail'); |
| | | this.http_request('check-recent', '_t='+(new Date().getTime()), true); |
| | | this.http_request('check-recent', (this.env.search_request ? '_search='+this.env.search_request+'&' : '') + '_t='+(new Date().getTime()), true); |
| | | }; |
| | | |
| | | |