| | |
| | | |
| | | // webmail client settings |
| | | this.dblclick_time = 500; |
| | | this.message_time = 5000; |
| | | this.message_time = 3000; |
| | | |
| | | this.identifier_expr = new RegExp('[^0-9a-z\-_]', 'gi'); |
| | | |
| | |
| | | var uid = row.uid; |
| | | if (uid && this.env.messages[uid]) |
| | | { |
| | | row.deleted = this.env.messages[uid].deleted; |
| | | row.unread = this.env.messages[uid].unread; |
| | | row.replied = this.env.messages[uid].replied; |
| | | row.deleted = this.env.messages[uid].deleted ? true : false; |
| | | row.unread = this.env.messages[uid].unread ? true : false; |
| | | row.replied = this.env.messages[uid].replied ? true : false; |
| | | } |
| | | |
| | | // set eventhandler to message icon |
| | |
| | | break; |
| | | |
| | | case 'logout': |
| | | this.goto_url('logout'); |
| | | this.goto_url('logout', true); |
| | | break; |
| | | |
| | | // commands to switch task |
| | |
| | | } |
| | | } |
| | | |
| | | this.goto_url('get', qstring+'&_download=1'); |
| | | this.goto_url('get', qstring+'&_download=1', false); |
| | | break; |
| | | |
| | | case 'select-all': |
| | |
| | | |
| | | this.display_message(msg, 'loading', true); |
| | | } |
| | | else if (!a && this.busy) |
| | | else if (!a) |
| | | this.hide_message(); |
| | | |
| | | this.busy = a; |
| | |
| | | this.unfocus_folder(id); |
| | | this.command('moveto', id); |
| | | } |
| | | |
| | | |
| | | // Hide message command buttons until a message is selected |
| | | this.enable_command('reply', 'reply-all', 'forward', 'delete', 'print', false); |
| | | return false; |
| | | }; |
| | | |
| | |
| | | clearTimeout(this.preview_timer); |
| | | |
| | | var selected = list.selection.length==1; |
| | | |
| | | // Hide certain command buttons when Drafts folder is selected |
| | | if (this.env.mailbox == this.env.drafts_mailbox) |
| | | { |
| | | this.enable_command('show', selected); |
| | | this.enable_command('delete', 'moveto', list.selection.length>0 ? true : false); |
| | | this.enable_command('reply', 'reply-all', 'forward', false); |
| | | this.enable_command('show', 'delete', 'moveto', selected); |
| | | } |
| | | else |
| | | { |
| | | this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected); |
| | | this.enable_command('delete', 'moveto', list.selection.length>0 ? true : false); |
| | | this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', 'delete', 'moveto', selected); |
| | | } |
| | | |
| | | // start timer for message preview (wait for double click) |
| | |
| | | if (!page && mbox != this.env.mailbox) |
| | | { |
| | | page = 1; |
| | | add_url += '&_refresh=1'; |
| | | this.env.current_page = page; |
| | | if (this.message_list) |
| | | this.message_list.clear_selection(); |
| | | this.show_contentframe(false); |
| | | } |
| | | |
| | | if (mbox != this.env.mailbox || (mbox == this.env.mailbox && !page && !sort)) |
| | | add_url += '&_refresh=1'; |
| | | |
| | | this.select_folder(mbox, this.env.mailbox); |
| | | this.env.mailbox = mbox; |
| | |
| | | |
| | | // send request to server |
| | | var url = '_mbox='+urlencode(mbox); |
| | | this.http_request('expunge', url+add_url, lock); |
| | | this.http_post('expunge', url+add_url, lock); |
| | | }; |
| | | |
| | | |
| | |
| | | |
| | | // send request to server |
| | | var url = '_mbox='+urlencode(mbox); |
| | | this.http_request('purge', url+add_url, lock); |
| | | this.http_post('purge', url+add_url, lock); |
| | | return true; |
| | | }; |
| | | |
| | |
| | | add_url += '&_search='+this.env.search_request; |
| | | |
| | | // send request to server |
| | | this.http_request(action, '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock); |
| | | this.http_post(action, '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock); |
| | | }; |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | this.http_request('mark', '_uid='+a_uids.join(',')+'&_flag='+flag); |
| | | this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag='+flag); |
| | | }; |
| | | |
| | | // mark all message rows as deleted/undeleted |
| | |
| | | } |
| | | } |
| | | |
| | | this.http_request('mark', '_uid='+a_uids.join(',')+'&_flag=undelete'); |
| | | this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag=undelete'); |
| | | return true; |
| | | }; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | this.http_request('mark', '_uid='+a_uids.join(',')+'&_flag=delete'); |
| | | this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag=delete'); |
| | | return true; |
| | | }; |
| | | |
| | |
| | | } |
| | | |
| | | // check for empty body |
| | | if ((input_message.value=='')&&(tinyMCE.getContent()=='')) |
| | | if ((input_message.value == '' || (window.tinyMCE && tinyMCE.getContent() == '')) && !confirm(this.get_label('nobodywarning'))) |
| | | { |
| | | if (!confirm(this.get_label('nobodywarning'))) |
| | | { |
| | | input_message.focus(); |
| | | return false; |
| | | } |
| | | input_message.focus(); |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | |
| | | { |
| | | if (this.env.draft_autosave) |
| | | this.save_timer = self.setTimeout(function(){ ref.command("savedraft"); }, this.env.draft_autosave * 1000); |
| | | |
| | | // Unlock interface now that saving is complete |
| | | this.busy = false; |
| | | }; |
| | | |
| | | |
| | |
| | | this.remove_attachment = function(name) |
| | | { |
| | | if (name) |
| | | this.http_request('remove-attachment', '_file='+urlencode(name)); |
| | | this.http_post('remove-attachment', '_file='+urlencode(name)); |
| | | |
| | | return true; |
| | | }; |
| | |
| | | } |
| | | |
| | | // send request to server |
| | | this.http_request('delete', '_cid='+urlencode(a_cids.join(','))+'&_from='+(this.env.action ? this.env.action : '')); |
| | | this.http_post('delete', '_cid='+urlencode(a_cids.join(','))+'&_from='+(this.env.action ? this.env.action : '')); |
| | | return true; |
| | | }; |
| | | |
| | |
| | | name = form.elements['_folder_name'].value; |
| | | |
| | | if (name) |
| | | this.http_request('create-folder', '_name='+urlencode(name), true); |
| | | this.http_post('create-folder', '_name='+urlencode(name), true); |
| | | else if (form.elements['_folder_name']) |
| | | form.elements['_folder_name'].focus(); |
| | | }; |
| | |
| | | } |
| | | |
| | | if (oldname && newname) |
| | | this.http_request('rename-folder', '_folder_oldname='+urlencode(oldname)+'&_folder_newname='+urlencode(newname)); |
| | | this.http_post('rename-folder', '_folder_oldname='+urlencode(oldname)+'&_folder_newname='+urlencode(newname)); |
| | | }; |
| | | |
| | | |
| | |
| | | { |
| | | var newname = this.name_input ? this.name_input.value : null; |
| | | if (this.edit_folder && newname) |
| | | this.http_request('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname)); |
| | | this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname)); |
| | | } |
| | | // escape |
| | | else if (key==27) |
| | |
| | | this.reset_folder_rename(); |
| | | |
| | | if (folder) |
| | | this.http_request('delete-folder', '_mboxes='+urlencode(folder)); |
| | | this.http_post('delete-folder', '_mboxes='+urlencode(folder)); |
| | | }; |
| | | |
| | | |
| | |
| | | if ((form = this.gui_objects.editform) && form.elements['_unsubscribed']) |
| | | this.change_subscription('_unsubscribed', '_subscribed', 'subscribe'); |
| | | else if (folder) |
| | | this.http_request('subscribe', '_mboxes='+urlencode(folder)); |
| | | this.http_post('subscribe', '_mboxes='+urlencode(folder)); |
| | | }; |
| | | |
| | | |
| | |
| | | if ((form = this.gui_objects.editform) && form.elements['_subscribed']) |
| | | this.change_subscription('_subscribed', '_unsubscribed', 'unsubscribe'); |
| | | else if (folder) |
| | | this.http_request('unsubscribe', '_mboxes='+urlencode(folder)); |
| | | this.http_post('unsubscribe', '_mboxes='+urlencode(folder)); |
| | | }; |
| | | |
| | | |
| | |
| | | list_to[index] = new Option(a_folders[n]); |
| | | } |
| | | |
| | | this.http_request(action, '_mboxes='+urlencode(a_folders.join(','))); |
| | | this.http_post(action, '_mboxes='+urlencode(a_folders.join(','))); |
| | | } |
| | | } |
| | | |
| | |
| | | // display a system message |
| | | this.display_message = function(msg, type, hold) |
| | | { |
| | | // pass command to parent window |
| | | if (this.env.framed && parent.rcmail ) |
| | | return parent.rcmail.display_message(msg, type, hold); |
| | | |
| | | this.set_busy(false); |
| | | if (!this.loaded) // save message in order to display after page loaded |
| | | { |
| | | this.pending_message = new Array(msg, type); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | // pass command to parent window |
| | | if (this.env.framed && parent.rcmail) |
| | | return parent.rcmail.display_message(msg, type, hold); |
| | | |
| | | if (!this.gui_objects.message) |
| | | return false; |
| | | |
| | |
| | | if (type) |
| | | cont = '<div class="'+type+'">'+cont+'</div>'; |
| | | |
| | | this.gui_objects.message._rcube = this; |
| | | var _rcube = this; |
| | | this.gui_objects.message.innerHTML = cont; |
| | | this.gui_objects.message.style.display = 'block'; |
| | | |
| | | |
| | | if (type!='loading') |
| | | this.gui_objects.message.onmousedown = function(){ this._rcube.hide_message(); return true; }; |
| | | this.gui_objects.message.onmousedown = function(){ _rcube.hide_message(); return true; }; |
| | | |
| | | if (!hold) |
| | | this.message_timer = setTimeout(function(){ ref.hide_message(); }, this.message_time); |
| | |
| | | /********* remote request methods *********/ |
| | | /********************************************************/ |
| | | |
| | | this.redirect = function(url) |
| | | this.redirect = function(url, lock) |
| | | { |
| | | this.set_busy(true); |
| | | if (lock || lock === null) |
| | | this.set_busy(true); |
| | | |
| | | if (this.env.framed && window.parent) |
| | | parent.location.href = url; |
| | | else |
| | |
| | | |
| | | this.goto_url = function(action, query, lock) |
| | | { |
| | | if (lock) |
| | | this.set_busy(true); |
| | | |
| | | var querystring = query ? '&'+query : ''; |
| | | this.redirect(this.env.comm_path+'&_action='+action+querystring); |
| | | this.redirect(this.env.comm_path+'&_action='+action+querystring, lock); |
| | | }; |
| | | |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | var ref = this; |
| | | var _ref = this; |
| | | this.url = url; |
| | | this.busy = true; |
| | | |
| | | this.xmlhttp.onreadystatechange = function(){ ref.xmlhttp_onreadystatechange(); }; |
| | | this.xmlhttp.onreadystatechange = function(){ _ref.xmlhttp_onreadystatechange(); }; |
| | | this.xmlhttp.open('GET', url); |
| | | this.xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('sessid')); |
| | | this.xmlhttp.send(null); |
| | | }; |
| | | |
| | |
| | | this.xmlhttp.onreadystatechange = function() { ref.xmlhttp_onreadystatechange(); }; |
| | | this.xmlhttp.open('POST', url, true); |
| | | this.xmlhttp.setRequestHeader('Content-Type', contentType); |
| | | this.xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('sessid')); |
| | | this.xmlhttp.send(req_body); |
| | | }; |
| | | |