| | |
| | | */ |
| | | function init() |
| | | { |
| | | rcmail.addEventListener('message', message_displayed); |
| | | |
| | | if (rcmail.env.task == 'mail') { |
| | | rcmail.addEventListener('menu-open', show_listoptions); |
| | | rcmail.addEventListener('menu-save', save_listoptions); |
| | | rcmail.addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list') }); |
| | | |
| | | var dragmenu = $('#dragmessagemenu'); |
| | | if (dragmenu.length) { |
| | |
| | | if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') { |
| | | layout_messageview(); |
| | | $("#all-headers").resizable({ handles: 's', minHeight: 50 }); |
| | | $('#previewheaderstoggle').click(function(e){ toggle_preview_headers(this); return false }); |
| | | } |
| | | else if (rcmail.env.action == 'compose') { |
| | | rcmail.addEventListener('aftertoggle-editor', function(){ window.setTimeout(function(){ layout_composeview() }, 100); }); |
| | | rcmail.addEventListener('aftersend-attachment', show_uploadform); |
| | | rcmail.addEventListener('add-recipient', function(p){ show_header_row(p.field, true); }); |
| | | layout_composeview(); |
| | | |
| | | $('#composeoptionstoggle').parent().click(function(){ |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | $(window).resize(resize); |
| | | |
| | | $(window).resize(function(e) { |
| | | // check target due to bugs in jquery |
| | | // http://bugs.jqueryui.com/ticket/7514 |
| | | // http://bugs.jquery.com/ticket/9841 |
| | | if (e.target == window) resize(); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | layout_composeview(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Triggered when a new user message is displayed |
| | | */ |
| | | function message_displayed(p) |
| | | { |
| | | // show a popup dialog on errors |
| | | if (p.type == 'error') { |
| | | if (!me.messagedialog) { |
| | | me.messagedialog = $('<div>').addClass('popupdialog'); |
| | | } |
| | | |
| | | var pos = $(p.object).offset(); |
| | | me.messagedialog.dialog('close'); |
| | | me.messagedialog.html(p.message) |
| | | .dialog({ |
| | | resizable: false, |
| | | closeOnEscape: true, |
| | | dialogClass: 'popupmessage ' + p.type, |
| | | title: null, |
| | | close: function() { |
| | | me.messagedialog.dialog('destroy').hide(); |
| | | }, |
| | | position: ['center', pos.top - 160], |
| | | hide: { effect:'drop', direction:'down' }, |
| | | width: 420, |
| | | minHeight: 90 |
| | | }).show(); |
| | | |
| | | window.setTimeout(function(){ me.messagedialog.dialog('close'); }, Math.max(2000, p.timeout / 2)); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Adjust UI objects of the mail view screen |
| | |
| | | |
| | | function render_mailboxlist(splitter) |
| | | { |
| | | // TODO: implement smart shortening of long folder names |
| | | } |
| | | |
| | | |
| | |
| | | rcmail.message_list.scrollto(uid); |
| | | |
| | | rcmail.command('save-pref', { name:'preview_pane', value:(visible?1:0) }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Switch between short and full headers display in message preview |
| | | */ |
| | | function toggle_preview_headers(button) |
| | | { |
| | | $('#preview-shortheaders').toggle(); |
| | | var full = $('#preview-allheaders').toggle(); |
| | | |
| | | // add toggle button to full headers table |
| | | if (!full.data('mod')) { |
| | | $('<a>').attr('href', '#hide') |
| | | .addClass('iconlink remove') |
| | | .html('Hide') |
| | | .appendTo($('<td>').appendTo($('tr:first', full))) |
| | | .click(function(){ toggle_preview_headers(this);return false }); |
| | | full.data('mod', true); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * |
| | | */ |
| | | function show_header_row(which) |
| | | function show_header_row(which, updated) |
| | | { |
| | | if (compose_headers[which]) |
| | | var row = $('#compose-' + which); |
| | | if (row.is(':visible')) |
| | | return; // nothing to be done here |
| | | |
| | | if (compose_headers[which] && !updated) |
| | | $('#_' + which).val(compose_headers[which]); |
| | | $('#compose-' + which).show(); |
| | | |
| | | row.show(); |
| | | $('#' + which + '-link').hide(); |
| | | layout_composeview(); |
| | | return false; |