| | |
| | | |
| | | // webmail client settings |
| | | this.dblclick_time = 500; |
| | | this.message_time = 3000; |
| | | this.message_time = 1500; |
| | | |
| | | this.identifier_expr = new RegExp('[^0-9a-z\-_]', 'gi'); |
| | | |
| | |
| | | this.enable_command(this.env.message_commands, this.env.uid); |
| | | this.enable_command('reply-list', this.env.list_post); |
| | | |
| | | if (this.env.next_uid) { |
| | | this.enable_command('nextmessage', 'lastmessage', true); |
| | | } |
| | | if (this.env.prev_uid) { |
| | | this.enable_command('previousmessage', 'firstmessage', true); |
| | | if (this.env.action == 'show') { |
| | | this.http_request('pagenav', '_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox), |
| | | this.display_message('', 'loading')); |
| | | } |
| | | |
| | | if (this.env.blockedobjects) { |
| | |
| | | if (!id) |
| | | return; |
| | | |
| | | var add_url = '', |
| | | target = window, |
| | | action = preview ? 'preview': 'show'; |
| | | var target = window, |
| | | action = preview ? 'preview': 'show', |
| | | url = '&_action='+action+'&_uid='+id+'&_mbox='+urlencode(this.env.mailbox); |
| | | |
| | | if (preview && this.env.contentframe && window.frames && window.frames[this.env.contentframe]) { |
| | | target = window.frames[this.env.contentframe]; |
| | | add_url = '&_framed=1'; |
| | | url += '&_framed=1'; |
| | | } |
| | | |
| | | if (safe) |
| | | add_url = '&_safe=1'; |
| | | url += '&_safe=1'; |
| | | |
| | | // also send search request to get the right messages |
| | | if (this.env.search_request) |
| | | add_url += '&_search='+this.env.search_request; |
| | | url += '&_search='+this.env.search_request; |
| | | |
| | | var url = '&_action='+action+'&_uid='+id+'&_mbox='+urlencode(this.env.mailbox)+add_url; |
| | | if (action == 'preview' && String(target.location.href).indexOf(url) >= 0) |
| | | this.show_contentframe(true); |
| | | else { |
| | | if (!this.env.frame_lock) |
| | | this.env.frame_lock = this.set_busy(true, 'loading'); |
| | | if (!this.env.frame_lock) { |
| | | (parent.rcmail ? parent.rcmail : this).env.frame_lock = this.set_busy(true, 'loading'); |
| | | } |
| | | target.location.href = this.env.comm_path+url; |
| | | |
| | | // mark as read and change mbox unread counter |
| | |
| | | ref.set_unread_count(ref.env.mailbox, ref.env.unread_counts[ref.env.mailbox], ref.env.mailbox == 'INBOX'); |
| | | } |
| | | if (ref.env.preview_pane_mark_read > 0) |
| | | ref.http_post('mark', '_uid='+id+'&_flag=read'); |
| | | ref.http_post('mark', '_uid='+id+'&_flag=read&_quiet=1'); |
| | | }, this.env.preview_pane_mark_read * 1000); |
| | | } |
| | | } |
| | |
| | | return; |
| | | |
| | | var a_uids = [], |
| | | lock = this.display_message(this.get_label('copyingmessage'), 'loading'), |
| | | add_url = '&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : ''); |
| | | |
| | | if (this.env.uid) |
| | |
| | | } |
| | | |
| | | // send request to server |
| | | this.http_post('copy', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, false); |
| | | this.http_post('copy', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock); |
| | | }; |
| | | |
| | | // move selected messages to the specified mailbox |
| | |
| | | return false; |
| | | } |
| | | // if there isn't a defined trash mailbox or we are in it |
| | | else if (!this.env.trash_mailbox || this.env.mailbox == this.env.trash_mailbox) |
| | | else if (!this.env.trash_mailbox || this.env.mailbox == this.env.trash_mailbox) |
| | | this.permanently_remove_messages(); |
| | | // if there is a trash mailbox defined and we're not currently in it |
| | | else { |
| | |
| | | // @private |
| | | this._with_selected_messages = function(action, lock, add_url) |
| | | { |
| | | var a_uids = [], count = 0; |
| | | var a_uids = [], count = 0, msg; |
| | | |
| | | if (this.env.uid) |
| | | a_uids[0] = this.env.uid; |
| | |
| | | } |
| | | } |
| | | |
| | | // also send search request to get the right messages |
| | | // also send search request to get the right messages |
| | | if (this.env.search_request) |
| | | add_url += '&_search='+this.env.search_request; |
| | | |
| | |
| | | this.delete_excessive_thread_rows(); |
| | | |
| | | add_url += '&_uid='+this.uids_to_list(a_uids); |
| | | |
| | | if (!lock) { |
| | | msg = action == 'moveto' ? 'movingmessage' : 'deletingmessage'; |
| | | lock = this.display_message(this.get_label(msg), 'loading'); |
| | | } |
| | | |
| | | // send request to server |
| | | this.http_post(action, '_mbox='+urlencode(this.env.mailbox)+add_url, lock); |
| | |
| | | for (var i=0; i<a_uids.length; i++) |
| | | this.set_message(a_uids[i], 'unread', (flag=='unread' ? true : false)); |
| | | |
| | | var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag; |
| | | var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag, |
| | | lock = this.display_message(this.get_label('markingmessage'), 'loading'); |
| | | |
| | | // also send search request to get the right messages |
| | | if (this.env.search_request) |
| | | url += '&_search='+this.env.search_request; |
| | | |
| | | this.http_post('mark', url); |
| | | this.http_post('mark', url, lock); |
| | | |
| | | for (var i=0; i<a_uids.length; i++) |
| | | this.update_thread_root(a_uids[i], flag); |
| | |
| | | for (var i=0; i<a_uids.length; i++) |
| | | this.set_message(a_uids[i], 'flagged', (flag=='flagged' ? true : false)); |
| | | |
| | | var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag; |
| | | var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag, |
| | | lock = this.display_message(this.get_label('markingmessage'), 'loading'); |
| | | |
| | | // also send search request to get the right messages |
| | | if (this.env.search_request) |
| | | url += '&_search='+this.env.search_request; |
| | | |
| | | this.http_post('mark', url); |
| | | this.http_post('mark', url, lock); |
| | | }; |
| | | |
| | | // mark all message rows as deleted/undeleted |
| | |
| | | for (var i=0, len=a_uids.length; i<len; i++) |
| | | this.set_message(a_uids[i], 'deleted', false); |
| | | |
| | | var url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete'; |
| | | var url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete', |
| | | lock = this.display_message(this.get_label('markingmessage'), 'loading'); |
| | | |
| | | // also send search request to get the right messages |
| | | if (this.env.search_request) |
| | | url += '&_search='+this.env.search_request; |
| | | |
| | | this.http_post('mark', url); |
| | | this.http_post('mark', url, lock); |
| | | return true; |
| | | }; |
| | | |
| | |
| | | this.delete_excessive_thread_rows(); |
| | | } |
| | | |
| | | add_url = '&_from='+(this.env.action ? this.env.action : ''); |
| | | add_url = '&_from='+(this.env.action ? this.env.action : ''), |
| | | lock = this.display_message(this.get_label('markingmessage'), 'loading'); |
| | | |
| | | // ?? |
| | | if (r_uids.length) |
| | |
| | | if (this.env.search_request) |
| | | add_url += '&_search='+this.env.search_request; |
| | | |
| | | this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=delete'+add_url); |
| | | return true; |
| | | this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=delete'+add_url, lock); |
| | | return true; |
| | | }; |
| | | |
| | | // flag as read without mark request (called from backend) |
| | |
| | | if (!this.gui_objects.messageform) |
| | | return false; |
| | | |
| | | //this.messageform = this.gui_objects.messageform; |
| | | var input_from = $("[name='_from']"); |
| | | var input_to = $("[name='_to']"); |
| | | var input_subject = $("input[name='_subject']"); |
| | | var input_message = $("[name='_message']").get(0); |
| | | var html_mode = $("input[name='_is_html']").val() == '1'; |
| | | var input_from = $("[name='_from']"), |
| | | input_to = $("[name='_to']"), |
| | | input_subject = $("input[name='_subject']"), |
| | | input_message = $("[name='_message']").get(0), |
| | | html_mode = $("input[name='_is_html']").val() == '1', |
| | | ac_fields = ['cc', 'bcc', 'replyto', 'mailreplyto', 'mailfollowupto']; |
| | | |
| | | // init live search events |
| | | this.init_address_input_events(input_to); |
| | | this.init_address_input_events($("[name='_cc']")); |
| | | this.init_address_input_events($("[name='_bcc']")); |
| | | for (var i in ac_fields) { |
| | | this.init_address_input_events($("[name='_"+ac_fields[i]+"']")); |
| | | } |
| | | |
| | | if (!html_mode) { |
| | | this.set_caret_pos(input_message, this.env.top_posting ? 0 : $(input_message).val().length); |
| | |
| | | return; |
| | | |
| | | // get cursor pos |
| | | var inp_value = this.ksearch_input.value; |
| | | var cpos = this.get_caret_pos(this.ksearch_input); |
| | | var p = inp_value.lastIndexOf(this.ksearch_value, cpos); |
| | | var inp_value = this.ksearch_input.value, |
| | | cpos = this.get_caret_pos(this.ksearch_input), |
| | | p = inp_value.lastIndexOf(this.ksearch_value, cpos), |
| | | insert = '', |
| | | |
| | | // replace search string with full address |
| | | var pre = this.ksearch_input.value.substring(0, p); |
| | | var end = this.ksearch_input.value.substring(p+this.ksearch_value.length, this.ksearch_input.value.length); |
| | | var insert = ''; |
| | | // replace search string with full address |
| | | pre = inp_value.substring(0, p), |
| | | end = inp_value.substring(p+this.ksearch_value.length, inp_value.length); |
| | | |
| | | // insert all members of a group |
| | | if (typeof this.env.contacts[id] == 'object' && this.env.contacts[id].id) { |
| | |
| | | this.ksearch_get_results = function() |
| | | { |
| | | var inp_value = this.ksearch_input ? this.ksearch_input.value : null; |
| | | |
| | | if (inp_value === null) |
| | | return; |
| | | |
| | |
| | | this.ksearch_pane.hide(); |
| | | |
| | | // get string from current cursor pos to last comma |
| | | var cpos = this.get_caret_pos(this.ksearch_input); |
| | | var p = inp_value.lastIndexOf(',', cpos-1); |
| | | var q = inp_value.substring(p+1, cpos); |
| | | var cpos = this.get_caret_pos(this.ksearch_input), |
| | | p = inp_value.lastIndexOf(',', cpos-1), |
| | | q = inp_value.substring(p+1, cpos), |
| | | min = this.env.autocomplete_min_length; |
| | | |
| | | // trim query string |
| | | q = q.replace(/(^\s+|\s+$)/g, ''); |
| | | q = $.trim(q); |
| | | |
| | | // Don't (re-)search if the last results are still active |
| | | if (q == this.ksearch_value) |
| | | return; |
| | | |
| | | if (q.length < min) { |
| | | if (!this.env.acinfo) { |
| | | var label = this.get_label('autocompletechars'); |
| | | label = label.replace('$min', min); |
| | | this.env.acinfo = this.display_message(label); |
| | | } |
| | | return; |
| | | } |
| | | else if (this.env.acinfo && q.length == min) { |
| | | this.hide_message(this.env.acinfo); |
| | | } |
| | | |
| | | var old_value = this.ksearch_value; |
| | | this.ksearch_value = q; |
| | |
| | | this.focus_subscription = function(id) |
| | | { |
| | | var row, folder, |
| | | reg = RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); |
| | | delim = RegExp.escape(this.env.delimiter), |
| | | reg = RegExp('['+delim+']?[^'+delim+']+$'); |
| | | |
| | | if (this.drag_active && this.env.folder && (row = document.getElementById(id))) |
| | | if (this.env.subscriptionrows[id] && |
| | |
| | | $(row).addClass('droptarget'); |
| | | } |
| | | } |
| | | else if (this.env.folder.match(new RegExp(RegExp.escape(this.env.delimiter)))) { |
| | | else if (this.env.folder.match(new RegExp(delim))) { |
| | | this.set_env('dstfolder', this.env.delimiter); |
| | | $(this.subscription_list.frame).addClass('droptarget'); |
| | | } |
| | |
| | | |
| | | this.subscription_move_folder = function(list) |
| | | { |
| | | var reg = RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); |
| | | var delim = RegExp.escape(this.env.delimiter), |
| | | reg = RegExp('['+delim+']?[^'+delim+']+$'); |
| | | |
| | | if (this.env.folder && this.env.dstfolder && (this.env.dstfolder != this.env.folder) && |
| | | (this.env.dstfolder != this.env.folder.replace(reg, ''))) { |
| | | var reg = new RegExp('[^'+RegExp.escape(this.env.delimiter)+']*['+RegExp.escape(this.env.delimiter)+']', 'g'); |
| | | var reg = new RegExp('[^'+delim+']*['+delim+']', 'g'); |
| | | var basename = this.env.folder.replace(reg, ''); |
| | | var newname = this.env.dstfolder==this.env.delimiter ? basename : this.env.dstfolder+this.env.delimiter+basename; |
| | | |
| | |
| | | } |
| | | |
| | | if (id && this.env.subscriptionrows[id] && (row = document.getElementById(id))) { |
| | | var reg = new RegExp('.*['+RegExp.escape(this.env.delimiter)+']'); |
| | | var delim = RegExp.escape(this.env.delimiter), |
| | | reg = new RegExp('.*['+delim+']'); |
| | | |
| | | this.name_input = document.createElement('input'); |
| | | this.name_input.type = 'text'; |
| | | this.name_input.value = this.env.subscriptionrows[id][0].replace(reg, ''); |
| | | |
| | | reg = new RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); |
| | | reg = new RegExp('['+delim+']?[^'+delim+']+$'); |
| | | this.name_input.__parent = this.env.subscriptionrows[id][0].replace(reg, ''); |
| | | this.name_input.onkeydown = function(e){ rcmail.name_input_keydown(e); }; |
| | | |
| | |
| | | var date = new Date(), |
| | | id = type + date.getTime(); |
| | | |
| | | // The same message of type 'loading' is already displayed |
| | | if (type == 'loading' && this.messages[msg]) { |
| | | this.messages[msg].elements.push(id); |
| | | return id; |
| | | if (type == 'loading') { |
| | | if (!msg) |
| | | msg = this.get_label('loading'); |
| | | |
| | | // The same message of type 'loading' is already displayed |
| | | if (this.messages[msg]) { |
| | | this.messages[msg].elements.push(id); |
| | | return id; |
| | | } |
| | | } |
| | | |
| | | var ref = this, |
| | |
| | | return id; |
| | | } |
| | | else { |
| | | obj.appendTo(cont).bind('mousedown', function(){ return ref.hide_message(obj); }); |
| | | window.setTimeout(function(){ ref.hide_message(obj, true); }, this.message_time); |
| | | obj.appendTo(cont).bind('mousedown', function() { return ref.hide_message(obj); }); |
| | | window.setTimeout(function() { ref.hide_message(obj, true); }, |
| | | this.message_time * (type == 'error' ? 2 : 1)); |
| | | return obj; |
| | | } |
| | | }; |