| | |
| | | // default environment vars |
| | | this.env.keep_alive = 60; // seconds |
| | | this.env.request_timeout = 180; // seconds |
| | | this.env.draft_autosave = 300; // seconds |
| | | this.env.draft_autosave = 0; // seconds |
| | | |
| | | |
| | | // set environment variable |
| | |
| | | if (this.gui_objects.remoteobjectsmsg) |
| | | this.gui_objects.remoteobjectsmsg.style.display = 'block'; |
| | | this.enable_command('load-images', true); |
| | | } |
| | | } |
| | | |
| | | if (this.env.action=='compose') |
| | | { |
| | | this.enable_command('add-attachment', 'send-attachment', 'remove-attachment', 'send', true); |
| | | if (this.env.spellcheck) |
| | | this.enable_command('spellcheck', true); |
| | | { |
| | | this.env.spellcheck.spelling_state_observer = function(s){ rcube_webmail_client.set_spellcheck_state(s); }; |
| | | this.set_spellcheck_state('ready'); |
| | | } |
| | | if (this.env.drafts_mailbox) |
| | | this.enable_command('savedraft', true); |
| | | } |
| | | |
| | | |
| | | if (this.env.messagecount) |
| | | this.enable_command('select-all', 'select-none', 'sort', 'expunge', true); |
| | | |
| | |
| | | // show printing dialog |
| | | if (this.env.action=='print') |
| | | window.print(); |
| | | |
| | | |
| | | // get unread count for each mailbox |
| | | if (this.gui_objects.mailboxlist) |
| | | this.http_request('getunread', ''); |
| | |
| | | var input_replyto = rcube_find_object('_replyto'); |
| | | var input_subject = rcube_find_object('_subject'); |
| | | var input_message = rcube_find_object('_message'); |
| | | |
| | | |
| | | // init live search events |
| | | if (input_to) |
| | | this.init_address_input_events(input_to); |
| | |
| | | input_subject.focus(); |
| | | else if (input_message) |
| | | this.set_caret2start(input_message); // input_message.focus(); |
| | | |
| | | |
| | | // get summary of all field values |
| | | this.cmp_hash = this.compose_field_hash(); |
| | | |
| | |
| | | break; |
| | | |
| | | case 'spellcheck': |
| | | if (this.env.spellcheck && this.env.spellcheck.spellCheck) |
| | | if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) |
| | | { |
| | | this.env.spellcheck.spellCheck(this.env.spellcheck.check_link); |
| | | this.set_spellcheck_state('checking'); |
| | | } |
| | | break; |
| | | |
| | | case 'savedraft': |
| | |
| | | break; |
| | | |
| | | // if saving Drafts is disabled in main.inc.php |
| | | if (!this.env.drafts_mailbox) |
| | | // or if compose form did not change |
| | | if (!this.env.drafts_mailbox || this.cmp_hash == this.compose_field_hash()) |
| | | break; |
| | | |
| | | this.set_busy(true, 'savingmessage'); |
| | |
| | | } |
| | | |
| | | // check for empty body |
| | | if (input_message.value=='') |
| | | if ((input_message.value=='')&&(tinyMCE.getContent()=='')) |
| | | { |
| | | if (!confirm(this.get_label('nobodywarning'))) |
| | | { |
| | |
| | | |
| | | return true; |
| | | }; |
| | | |
| | | |
| | | this.set_spellcheck_state = function(s) |
| | | { |
| | | this.spellcheck_ready = (s=='check_spelling' || s=='ready'); |
| | | this.enable_command('spellcheck', this.spellcheck_ready); |
| | | }; |
| | | |
| | | |
| | | this.auto_save_start = function() |
| | |
| | | var id = obj.options[obj.selectedIndex].value; |
| | | var input_message = rcube_find_object('_message'); |
| | | var message = input_message ? input_message.value : ''; |
| | | var is_html = (rcube_find_object('_is_html').value == '1'); |
| | | var sig, p; |
| | | |
| | | if (!this.env.identity) |
| | | this.env.identity = id |
| | | |
| | | // remove the 'old' signature |
| | | if (this.env.identity && this.env.signatures && this.env.signatures[this.env.identity]) |
| | | |
| | | if (!is_html) |
| | | { |
| | | 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); |
| | | // remove the 'old' signature |
| | | if (this.env.identity && this.env.signatures && this.env.signatures[this.env.identity]) |
| | | { |
| | | sig = this.env.signatures[this.env.identity]['text']; |
| | | 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]['text']; |
| | | if (sig.indexOf('--')!=0) |
| | | sig = '--\n'+sig; |
| | | message += '\n'+sig; |
| | | } |
| | | } |
| | | |
| | | // add the new signature string |
| | | if (this.env.signatures && this.env.signatures[id]) |
| | | else |
| | | { |
| | | sig = this.env.signatures[id]; |
| | | if (sig.indexOf('--')!=0) |
| | | sig = '--\n'+sig; |
| | | message += '\n'+sig; |
| | | var eid = tinyMCE.getEditorId('_message'); |
| | | // editor is a TinyMCE_Control object |
| | | var editor = tinyMCE.getInstanceById(eid); |
| | | var msgDoc = editor.getDoc(); |
| | | var msgBody = msgDoc.body; |
| | | |
| | | if (this.env.signatures && this.env.signatures[id]) |
| | | { |
| | | // Append the signature as a span within the body |
| | | var sigElem = msgDoc.getElementById("_rc_sig"); |
| | | if (!sigElem) |
| | | { |
| | | sigElem = msgDoc.createElement("span"); |
| | | sigElem.setAttribute("id", "_rc_sig"); |
| | | msgBody.appendChild(sigElem); |
| | | } |
| | | if (this.env.signatures[id]['is_html']) |
| | | { |
| | | sigElem.innerHTML = this.env.signatures[id]['text']; |
| | | } |
| | | else |
| | | { |
| | | sigElem.innerHTML = '<pre>' + this.env.signatures[id]['text'] + '</pre>'; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (input_message) |
| | | input_message.value = message; |
| | | |
| | | |
| | | this.env.identity = id; |
| | | return true; |
| | | }; |
| | |
| | | { |
| | | if (!this.gui_objects.attachmentlist) |
| | | return false; |
| | | |
| | | alert(content); |
| | | |
| | | var li = document.createElement('LI'); |
| | | li.id = name; |
| | |
| | | this.reset_folder_rename = function() |
| | | { |
| | | var cell = this.name_input ? this.name_input.parentNode : null; |
| | | if (cell && this.edit_folder) |
| | | if (cell && this.edit_folder && this.env.subscriptionrows[this.edit_folder]) |
| | | cell.innerHTML = this.env.subscriptionrows[this.edit_folder][1]; |
| | | |
| | | this.edit_folder = null; |
| | |
| | | }; |
| | | |
| | | |
| | | this.toggle_editor = function(checkbox, textElementName) |
| | | { |
| | | var ischecked = checkbox.checked; |
| | | if (ischecked) |
| | | { |
| | | tinyMCE.execCommand('mceAddControl', true, textElementName); |
| | | } |
| | | else |
| | | { |
| | | tinyMCE.execCommand('mceRemoveControl', true, textElementName); |
| | | } |
| | | } |
| | | |
| | | /********************************************************/ |
| | | /********* drag & drop methods *********/ |
| | |
| | | |
| | | case 'expunge': |
| | | this.enable_command('select-all', 'select-none', 'expunge', this.env.messagecount ? true : false); |
| | | break; |
| | | break; |
| | | } |
| | | |
| | | request_obj.reset(); |
| | |
| | | } |
| | | } |
| | | |
| | | // sedn GET request |
| | | // send GET request |
| | | this.GET = function(url) |
| | | { |
| | | this.build(); |
| | |
| | | }; |
| | | |
| | | |
| | | this.POST = function(url, a_param) |
| | | this.POST = function(url, body, contentType) |
| | | { |
| | | // not implemented yet |
| | | // default value for contentType if not provided |
| | | contentType = typeof(contentType) != 'undefined' ? |
| | | contentType : 'application/x-www-form-urlencoded'; |
| | | |
| | | this.build(); |
| | | |
| | | if (!this.xmlhttp) |
| | | { |
| | | this.onerror(this); |
| | | return false; |
| | | } |
| | | |
| | | var ref=this; |
| | | this.url = url; |
| | | this.busy = true; |
| | | |
| | | this.xmlhttp.onreadystatechange = function() { ref.xmlhttp_onreadystatechange(); }; |
| | | this.xmlhttp.open('POST', url, true); |
| | | this.xmlhttp.setRequestHeader('Content-Type', contentType); |
| | | this.xmlhttp.send(body); |
| | | }; |
| | | |
| | | |
| | |
| | | } // end class rcube_http_request |
| | | |
| | | |
| | | // helper function to call the init method with a delay |
| | | function call_init(o) |
| | | { |
| | | if (window[o] && window[o].init) |
| | | setTimeout(o+'.init()', 200); |
| | | } |
| | | |
| | | function console(str) |
| | | { |
| | |
| | | document.debugform.console.value += str+'\n--------------------------------------\n'; |
| | | } |
| | | |
| | | |
| | | // set onload handler |
| | | window.onload = function(e) |
| | | { |
| | | if (window.rcube_webmail_client) |
| | | rcube_webmail_client.init(); |
| | | }; |