| | |
| | | // rcmail.addEventListener('aftersend-attachment', 'uploadmenu', rcmail_ui); |
| | | // rcmail.addEventListener('aftertoggle-editor', 'resize_compose_body_ev', rcmail_ui); |
| | | rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); |
| | | $('#mailpreviewtoggle').click(function(e){ toggle_preview_pane(e); return false }); |
| | | $('#mailpreviewtoggle').addClass($('#mailpreviewframe').is(':visible') ? 'enabled' : 'closed').click(function(e){ toggle_preview_pane(e); return false }); |
| | | $('#maillistmode').addClass(rcmail.env.threading ? '' : 'selected').click(function(e){ switch_view_mode('list'); return false }); |
| | | $('#mailthreadmode').addClass(rcmail.env.threading ? 'selected' : '').click(function(e){ switch_view_mode('thread'); return false }); |
| | | |
| | | if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') { |
| | | init_messageview(); |
| | | layout_messageview(); |
| | | } |
| | | } |
| | | else if (rcmail.env.task == 'settings') { |
| | | var tab = '#settingstabpreferences'; |
| | | if (rcmail.env.action) |
| | | tab = '#settingstab' + (rcmail.env.action.indexOf('identity')>0 ? 'identities' : rcmail.env.action.replace(/\./g, '')); |
| | | |
| | | $(tab).addClass('selected') |
| | | .children().first().removeAttr('onclick').click(function() { return false; }); |
| | | } |
| | | |
| | | $(document.body).bind('mouseup', function(e){ |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | $(window).resize(resize); |
| | | } |
| | | |
| | | /** |
| | | * Update UI on window resize |
| | | */ |
| | | function resize() |
| | | { |
| | | if (rcmail.env.task == 'mail' && (rcmail.env.action == 'show' || rcmail.env.action == 'preview')) { |
| | | layout_messageview(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Adjust UI objects of the mail view screen |
| | | */ |
| | | function init_messageview() |
| | | function layout_messageview() |
| | | { |
| | | $('#messagecontent').css('top', ($('#messageheader').outerHeight() + 10) + 'px'); |
| | | $('#message-objects div a').addClass('button'); |
| | | |
| | | if (!$('#attachment-list li').length) { |
| | | $('#messagecontent div.rightcol').hide(); |
| | | $('#messagecontent .leftcol').css('margin-right', '0'); |
| | | $('div.rightcol').hide(); |
| | | $('div.leftcol').css('margin-right', '0'); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | function toggle_preview_pane(e) |
| | | { |
| | | var button = $(e.target); |
| | | var visible = !button.hasClass('enabled'); |
| | | |
| | | var button = $(e.target), |
| | | frame = $('#mailpreviewframe'), |
| | | visible = !frame.is(':visible'), |
| | | splitter = parseInt(bw.get_cookie('mailviewsplitter') || 320), |
| | | topstyles, bottomstyles, uid; |
| | | |
| | | frame.toggle(); |
| | | button.removeClass().addClass(visible ? 'enabled' : 'closed'); |
| | | |
| | | // rcmail.command('save-pref', { name:'preview_pane', value:(visible?1:0) }); |
| | | if (visible) { |
| | | topstyles = { height:(splitter-38)+'px', bottom:'auto' }; |
| | | bottomstyles = { top:(splitter+5)+'px', height:'auto' }; |
| | | rcmail.env.contentframe = 'messagecontframe'; |
| | | if (uid = rcmail.message_list.get_single_selection()) |
| | | rcmail.show_message(uid, false, true); |
| | | } |
| | | else { |
| | | topstyles = { height:'auto', bottom:'28px' }; |
| | | bottomstyles = { top:'auto', height:'26px' }; |
| | | rcmail.env.contentframe = null; |
| | | rcmail.show_contentframe(false); |
| | | } |
| | | |
| | | $('#mailview-top').css(topstyles); |
| | | $('#mailview-bottom').css(bottomstyles); |
| | | |
| | | if (visible && uid && rcmail.message_list) |
| | | rcmail.message_list.scrollto(uid); |
| | | |
| | | rcmail.command('save-pref', { name:'preview_pane', value:(visible?1:0) }); |
| | | } |
| | | |
| | | |
| | | function switch_view_mode(mode) |
| | | { |
| | | if (rcmail.env.threading != (mode == 'thread')) |
| | | rcmail.set_list_options(null, undefined, undefined, mode == 'thread' ? 1 : 0); |
| | | |
| | | $('#maillistmode, #mailthreadmode').removeClass('selected'); |
| | | $('#mail'+mode+'mode').addClass('selected'); |
| | | } |
| | | |
| | | |