| | |
| | | $.merge(this.env.compose_commands, ['add-recipient', 'firstpage', 'previouspage', 'nextpage', 'lastpage']); |
| | | |
| | | if (this.env.spellcheck) { |
| | | this.env.spellcheck.spelling_state_observer = function(s){ ref.set_spellcheck_state(s); }; |
| | | this.env.spellcheck.spelling_state_observer = function(s) { ref.spellcheck_state(); }; |
| | | this.env.compose_commands.push('spellcheck') |
| | | this.set_spellcheck_state('ready'); |
| | | if ($("input[name='_is_html']").val() == '1') |
| | | this.display_spellcheck_controls(false); |
| | | this.enable_command('spellcheck', true); |
| | | } |
| | | |
| | | document.onmouseup = function(e){ return p.doc_mouse_up(e); }; |
| | | |
| | | // init message compose form |
| | | this.init_messageform(); |
| | | |
| | | // init address book widget |
| | | if (this.gui_objects.contactslist) { |
| | | this.contact_list = new rcube_list_widget(this.gui_objects.contactslist, |
| | | { multiselect:true, draggable:false, keyboard:false }); |
| | | this.contact_list.addEventListener('select', function(o){ ref.compose_recipeint_select(o); }); |
| | | this.contact_list.addEventListener('dblclick', function(o){ ref.compose_add_recipient('to'); }); |
| | | this.contact_list.init(); |
| | | } |
| | | |
| | | if (this.gui_objects.adressbookslist) { |
| | | this.gui_objects.folderlist = this.gui_objects.adressbookslist; |
| | | this.enable_command('list-adresses', true); |
| | | } |
| | | } |
| | | // show printing dialog |
| | | else if (this.env.action == 'print' && this.env.uid) |
| | |
| | | this.env.unread_counts = {}; |
| | | this.gui_objects.folderlist = this.gui_objects.mailboxlist; |
| | | this.http_request('getunread', ''); |
| | | } |
| | | |
| | | // init address book widget |
| | | if (this.gui_objects.contactslist) { |
| | | this.contact_list = new rcube_list_widget(this.gui_objects.contactslist, |
| | | { multiselect:true, draggable:false, keyboard:false }); |
| | | this.contact_list.addEventListener('select', function(o){ ref.compose_recipient_select(o); }); |
| | | this.contact_list.addEventListener('dblclick', function(o){ ref.compose_add_recipient('to'); }); |
| | | this.contact_list.init(); |
| | | } |
| | | |
| | | if (this.gui_objects.addressbookslist) { |
| | | this.gui_objects.folderlist = this.gui_objects.addressbookslist; |
| | | this.enable_command('list-adresses', true); |
| | | } |
| | | |
| | | // ask user to send MDN |
| | |
| | | // display 'loading' message on form submit, lock submit button |
| | | $('form').submit(function () { |
| | | $('input[type=submit]', this).prop('disabled', true); |
| | | rcmail.clear_messages(); |
| | | rcmail.display_message('', 'loading'); |
| | | }); |
| | | |
| | |
| | | break; |
| | | |
| | | case 'spellcheck': |
| | | if (window.tinyMCE && tinyMCE.get(this.env.composebody)) { |
| | | tinyMCE.execCommand('mceSpellCheck', true); |
| | | if (this.spellcheck_state()) { |
| | | this.stop_spellchecking(); |
| | | } |
| | | else if (this.env.spellcheck && this.env.spellcheck.spellCheck && this.spellcheck_ready) { |
| | | this.env.spellcheck.spellCheck(); |
| | | this.set_spellcheck_state('checking'); |
| | | else { |
| | | if (window.tinyMCE && tinyMCE.get(this.env.composebody)) { |
| | | tinyMCE.execCommand('mceSpellCheck', true); |
| | | } |
| | | else if (this.env.spellcheck && this.env.spellcheck.spellCheck) { |
| | | this.env.spellcheck.spellCheck(); |
| | | } |
| | | } |
| | | this.spellcheck_state(); |
| | | break; |
| | | |
| | | case 'savedraft': |
| | |
| | | div.removeClass('expanded').addClass('collapsed'); |
| | | this.env.collapsed_folders = this.env.collapsed_folders+'&'+urlencode(name)+'&'; |
| | | |
| | | // select parent folder if one of its childs is currently selected |
| | | if (this.env.mailbox.indexOf(name + this.env.delimiter) == 0) |
| | | // select the folder if one of its childs is currently selected |
| | | // don't select if it's virtual (#1488346) |
| | | if (this.env.mailbox.indexOf(name + this.env.delimiter) == 0 && !$(li).hasClass('virtual')) |
| | | this.command('list', name); |
| | | } |
| | | else |
| | |
| | | .attr('autocomplete', 'off'); |
| | | }; |
| | | |
| | | this.compose_recipeint_select = function(list) |
| | | this.compose_recipient_select = function(list) |
| | | { |
| | | this.enable_command('add-recipient', list.selection.length > 0); |
| | | }; |
| | |
| | | |
| | | this.toggle_editor = function(props) |
| | | { |
| | | this.stop_spellchecking(); |
| | | |
| | | if (props.mode == 'html') { |
| | | this.display_spellcheck_controls(false); |
| | | this.plain2html($('#'+props.id).val(), props.id); |
| | | tinyMCE.execCommand('mceAddControl', false, props.id); |
| | | |
| | |
| | | } |
| | | else { |
| | | var thisMCE = tinyMCE.get(props.id), existingHtml; |
| | | if (thisMCE.plugins.spellchecker && thisMCE.plugins.spellchecker.active) |
| | | thisMCE.execCommand('mceSpellCheck', false); |
| | | |
| | | if (existingHtml = thisMCE.getContent()) { |
| | | if (!confirm(this.get_label('editorwarning'))) { |
| | |
| | | this.html2plain(existingHtml, props.id); |
| | | } |
| | | tinyMCE.execCommand('mceRemoveControl', false, props.id); |
| | | this.display_spellcheck_controls(true); |
| | | } |
| | | |
| | | return true; |
| | |
| | | this.stop_spellchecking = function() |
| | | { |
| | | var ed; |
| | | |
| | | if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody))) { |
| | | if (ed.plugins.spellchecker && ed.plugins.spellchecker.active) |
| | | if (ed.plugins && ed.plugins.spellchecker && ed.plugins.spellchecker.active) |
| | | ed.execCommand('mceSpellCheck'); |
| | | } |
| | | else if ((ed = this.env.spellcheck) && !this.spellcheck_ready) { |
| | | $(ed.spell_span).trigger('click'); |
| | | this.set_spellcheck_state('ready'); |
| | | else if (ed = this.env.spellcheck) { |
| | | if (ed.state && ed.state != 'ready' && ed.state != 'no_error_found') |
| | | $(ed.spell_span).trigger('click'); |
| | | } |
| | | |
| | | this.spellcheck_state(); |
| | | }; |
| | | |
| | | this.display_spellcheck_controls = function(vis) |
| | | this.spellcheck_state = function() |
| | | { |
| | | if (this.env.spellcheck) { |
| | | // stop spellchecking process |
| | | if (!vis) |
| | | this.stop_spellchecking(); |
| | | var ed, active; |
| | | |
| | | $(this.env.spellcheck.spell_container)[vis ? 'show' : 'hide'](); |
| | | } |
| | | }; |
| | | if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)) && ed.plugins && ed.plugins.spellchecker) |
| | | active = ed.plugins.spellchecker.active; |
| | | else if ((ed = this.env.spellcheck) && ed.state) |
| | | active = ed.state != 'ready' && ed.state != 'no_error_found'; |
| | | |
| | | this.set_spellcheck_state = function(s) |
| | | { |
| | | this.spellcheck_ready = (s == 'ready' || s == 'no_error_found'); |
| | | this.enable_command('spellcheck', this.spellcheck_ready); |
| | | if (rcmail.buttons.spellcheck) |
| | | $('#'+rcmail.buttons.spellcheck[0].id)[active ? 'addClass' : 'removeClass']('selected'); |
| | | |
| | | return active; |
| | | }; |
| | | |
| | | // get selected language |
| | | this.spellcheck_lang = function() |
| | | { |
| | | var ed; |
| | | if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)) && ed.plugins.spellchecker) { |
| | | |
| | | if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)) && ed.plugins && ed.plugins.spellchecker) |
| | | return ed.plugins.spellchecker.selectedLang; |
| | | } |
| | | else if (this.env.spellcheck) { |
| | | else if (this.env.spellcheck) |
| | | return GOOGIE_CUR_LANG; |
| | | } |
| | | }; |
| | | |
| | | this.spellcheck_lang_set = function(lang) |
| | | { |
| | | var ed; |
| | | |
| | | if (window.tinyMCE && (ed = tinyMCE.get(this.env.composebody)) && ed.plugins) |
| | | ed.plugins.spellchecker.selectedLang = lang; |
| | | else if (this.env.spellcheck) |
| | | this.env.spellcheck.setCurrentLanguage(lang); |
| | | }; |
| | | |
| | | // resume spellchecking, highlight provided mispellings without new ajax request |
| | |
| | | sp.prepare(false, true); |
| | | sp.processData(data); |
| | | } |
| | | |
| | | this.spellcheck_state(); |
| | | } |
| | | |
| | | this.set_draft_id = function(id) |
| | |
| | | } |
| | | }; |
| | | |
| | | // remove all messages immediately |
| | | this.clear_messages = function() |
| | | { |
| | | // pass command to parent window |
| | | if (this.is_framed()) |
| | | return parent.rcmail.clear_messages(); |
| | | |
| | | var k, n, m = this.messages; |
| | | |
| | | for (k in m) |
| | | for (n in m[k].elements) |
| | | if (m[k].obj) |
| | | m[k].obj.hide(); |
| | | |
| | | this.messages = {}; |
| | | }; |
| | | |
| | | // mark a mailbox as selected and set environment variable |
| | | this.select_folder = function(name, prefix, encode) |
| | | { |