Mercurial > hg > rc2
comparison skins/larry/ui.js @ 8:bf99236cc5cd
try to recover from upgrade fail
author | Charlie Root |
---|---|
date | Sat, 29 Dec 2018 07:07:34 -0500 |
parents | 4681f974d28b |
children |
comparison
equal
deleted
inserted
replaced
7:65fd7d441cf1 | 8:bf99236cc5cd |
---|---|
26 'folder-selector': { iconized:1 } | 26 'folder-selector': { iconized:1 } |
27 }; | 27 }; |
28 | 28 |
29 var me = this; | 29 var me = this; |
30 var mailviewsplit; | 30 var mailviewsplit; |
31 var mailviewsplit2; | |
31 var compose_headers = {}; | 32 var compose_headers = {}; |
32 var prefs; | 33 var prefs; |
33 | 34 |
34 // export public methods | 35 // export public methods |
35 this.set = setenv; | 36 this.set = setenv; |
58 } | 59 } |
59 | 60 |
60 if (bw.tablet) { | 61 if (bw.tablet) { |
61 $('#viewport').attr('content', "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"); | 62 $('#viewport').attr('content', "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"); |
62 } | 63 } |
64 | |
65 $(document).ready(function() { me.init(); }); | |
63 } | 66 } |
64 | 67 |
65 | 68 |
66 /** | 69 /** |
67 * | 70 * |
134 /*** mail task ***/ | 137 /*** mail task ***/ |
135 if (rcmail.env.task == 'mail') { | 138 if (rcmail.env.task == 'mail') { |
136 rcmail.addEventListener('menu-open', menu_toggle) | 139 rcmail.addEventListener('menu-open', menu_toggle) |
137 .addEventListener('menu-close', menu_toggle) | 140 .addEventListener('menu-close', menu_toggle) |
138 .addEventListener('menu-save', save_listoptions) | 141 .addEventListener('menu-save', save_listoptions) |
142 .addEventListener('enable-command', enable_command) | |
139 .addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) }) | 143 .addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) }) |
140 .addEventListener('responseaftersearch', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) }); | 144 .addEventListener('responseaftersearch', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) }); |
141 | 145 |
142 var dragmenu = $('#dragmessagemenu'); | 146 var dragmenu = $('#dragmessagemenu'); |
143 if (dragmenu.length) { | 147 if (dragmenu.length) { |
144 rcmail.gui_object('dragmenu', 'dragmessagemenu'); | 148 rcmail.gui_object('dragmenu', 'dragmessagemenu'); |
145 popups.dragmenu = dragmenu; | 149 popups.dragmenu = dragmenu; |
146 } | 150 } |
147 | 151 |
148 if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') { | 152 if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') { |
149 rcmail.addEventListener('enable-command', enable_command) | 153 rcmail.addEventListener('aftershow-headers', function() { layout_messageview(); }) |
150 .addEventListener('aftershow-headers', function() { layout_messageview(); }) | |
151 .addEventListener('afterhide-headers', function() { layout_messageview(); }); | 154 .addEventListener('afterhide-headers', function() { layout_messageview(); }); |
155 | |
152 $('#previewheaderstoggle').click(function(e) { | 156 $('#previewheaderstoggle').click(function(e) { |
153 toggle_preview_headers(); | 157 toggle_preview_headers(); |
154 if (this.blur && !rcube_event.is_keyboard(e)) | 158 if (this.blur && !rcube_event.is_keyboard(e)) |
155 this.blur(); | 159 this.blur(); |
156 return false; | 160 return false; |
157 }); | 161 }); |
158 | 162 |
159 // add menu link for each attachment | 163 // add menu link for each attachment |
160 $('#attachment-list > li').each(function() { | 164 $('#attachment-list > li').each(function() { |
161 $(this).append($('<a class="drop" tabindex="0" aria-haspopup="true">Show options</a>') | 165 attachmentmenu_append(this); |
162 .bind('click keypress', function(e) { | |
163 if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) { | |
164 attachmentmenu(this, e); | |
165 return false; | |
166 } | |
167 }) | |
168 ); | |
169 }); | 166 }); |
170 | 167 |
171 if (get_pref('previewheaders') == '1') { | 168 if (get_pref('previewheaders') == '1') { |
172 toggle_preview_headers(); | 169 toggle_preview_headers(); |
173 } | 170 } |
171 | |
172 if (rcmail.env.action == 'show') { | |
173 $('#messagecontent').focus(); | |
174 } | |
174 } | 175 } |
175 else if (rcmail.env.action == 'compose') { | 176 else if (rcmail.env.action == 'compose') { |
176 rcmail.addEventListener('aftersend-attachment', show_uploadform) | 177 rcmail.addEventListener('aftersend-attachment', show_uploadform) |
177 .addEventListener('aftertoggle-editor', function(e){ | 178 .addEventListener('fileappended', function(e) { if (e.attachment.complete) attachmentmenu_append(e.item); }) |
178 window.setTimeout(function(){ layout_composeview() }, 200); | 179 .addEventListener('aftertoggle-editor', function(e) { |
180 window.setTimeout(function() { layout_composeview() }, 200); | |
179 if (e && e.mode) | 181 if (e && e.mode) |
180 $("select[name='editorSelector']").val(e.mode); | 182 $("select[name='editorSelector']").val(e.mode); |
183 }) | |
184 .addEventListener('compose-encrypted', function(e) { | |
185 $("select[name='editorSelector']").prop('disabled', e.active); | |
186 $('a.button.attach, a.button.responses')[(e.active?'addClass':'removeClass')]('disabled'); | |
187 $('#responseslist a.insertresponse')[(e.active?'removeClass':'addClass')]('active'); | |
181 }); | 188 }); |
182 | 189 |
183 // Show input elements with non-empty value | 190 // Show input elements with non-empty value |
184 var f, v, field, fields = ['cc', 'bcc', 'replyto', 'followupto']; | 191 var f, v, field, fields = ['cc', 'bcc', 'replyto', 'followupto']; |
185 for (f=0; f < fields.length; f++) { | 192 for (f=0; f < fields.length; f++) { |
214 if (opener_rc && opener_rc.env.action == 'compose' && $('#composeoptionstoggle', opener.document).hasClass('remove')) | 221 if (opener_rc && opener_rc.env.action == 'compose' && $('#composeoptionstoggle', opener.document).hasClass('remove')) |
215 $('#composeoptionstoggle').click(); | 222 $('#composeoptionstoggle').click(); |
216 | 223 |
217 new rcube_splitter({ id:'composesplitterv', p1:'#composeview-left', p2:'#composeview-right', | 224 new rcube_splitter({ id:'composesplitterv', p1:'#composeview-left', p2:'#composeview-right', |
218 orientation:'v', relative:true, start:206, min:170, size:12, render:layout_composeview }).init(); | 225 orientation:'v', relative:true, start:206, min:170, size:12, render:layout_composeview }).init(); |
226 | |
227 // add menu link for each attachment | |
228 $('#attachment-list > li').each(function() { | |
229 attachmentmenu_append(this); | |
230 }); | |
219 } | 231 } |
220 else if (rcmail.env.action == 'list' || !rcmail.env.action) { | 232 else if (rcmail.env.action == 'list' || !rcmail.env.action) { |
221 var previewframe = $('#mailpreviewframe').is(':visible'); | 233 mail_layout(); |
222 | 234 |
223 $('#mailpreviewtoggle').addClass(previewframe ? 'enabled' : 'closed').attr('aria-expanded', previewframe ? 'true' : 'false') | |
224 .click(function(e) { toggle_preview_pane(e); return false; }); | |
225 $('#maillistmode').addClass(rcmail.env.threading ? '' : 'selected').click(function(e) { switch_view_mode('list'); return false; }); | 235 $('#maillistmode').addClass(rcmail.env.threading ? '' : 'selected').click(function(e) { switch_view_mode('list'); return false; }); |
226 $('#mailthreadmode').addClass(rcmail.env.threading ? 'selected' : '').click(function(e) { switch_view_mode('thread'); return false; }); | 236 $('#mailthreadmode').addClass(rcmail.env.threading ? 'selected' : '').click(function(e) { switch_view_mode('thread'); return false; }); |
227 | 237 |
228 mailviewsplit = new rcube_splitter({ id:'mailviewsplitter', p1:'#mailview-top', p2:'#mailview-bottom', | 238 rcmail.init_pagejumper('#pagejumper'); |
229 orientation:'h', relative:true, start:310, min:150, size:12, offset:4 }); | |
230 if (previewframe) | |
231 mailviewsplit.init(); | |
232 | 239 |
233 rcmail.addEventListener('setquota', update_quota) | 240 rcmail.addEventListener('setquota', update_quota) |
234 .addEventListener('enable-command', enable_command) | 241 .addEventListener('layout-change', mail_layout) |
235 .addEventListener('afterimport-messages', show_uploadform); | 242 .addEventListener('afterimport-messages', show_uploadform); |
236 } | 243 } |
237 else if (rcmail.env.action == 'get') { | 244 else if (rcmail.env.action == 'get') { |
238 new rcube_splitter({ id:'mailpartsplitterv', p1:'#messagepartheader', p2:'#messagepartcontainer', | 245 new rcube_splitter({ id:'mailpartsplitterv', p1:'#messagepartheader', p2:'#messagepartcontainer', |
239 orientation:'v', relative:true, start:226, min:150, size:12}).init(); | 246 orientation:'v', relative:true, start:226, min:150, size:12}).init(); |
276 orientation:'v', relative:true, start:266, min:180, size:12 }).init(); | 283 orientation:'v', relative:true, start:266, min:180, size:12 }).init(); |
277 } | 284 } |
278 else if (rcmail.env.action == 'edit-prefs') { | 285 else if (rcmail.env.action == 'edit-prefs') { |
279 var legend = $('#preferences-details fieldset.advanced legend'), | 286 var legend = $('#preferences-details fieldset.advanced legend'), |
280 toggle = $('<a href="#toggle"></a>') | 287 toggle = $('<a href="#toggle"></a>') |
281 .text(env.toggleoptions) | 288 .text(rcmail.gettext('toggleadvancedoptions')) |
282 .attr('title', env.toggleoptions) | 289 .attr('title', rcmail.gettext('toggleadvancedoptions')) |
283 .addClass('advanced-toggle'); | 290 .addClass('advanced-toggle'); |
284 | 291 |
285 legend.click(function(e) { | 292 legend.click(function(e) { |
286 toggle.html($(this).hasClass('collapsed') ? '▲' : '▼'); | 293 toggle.html($(this).hasClass('collapsed') ? '▲' : '▼'); |
287 | 294 |
296 } | 303 } |
297 /*** addressbook task ***/ | 304 /*** addressbook task ***/ |
298 else if (rcmail.env.task == 'addressbook') { | 305 else if (rcmail.env.task == 'addressbook') { |
299 rcmail.addEventListener('afterupload-photo', show_uploadform) | 306 rcmail.addEventListener('afterupload-photo', show_uploadform) |
300 .addEventListener('beforepushgroup', push_contactgroup) | 307 .addEventListener('beforepushgroup', push_contactgroup) |
301 .addEventListener('beforepopgroup', pop_contactgroup); | 308 .addEventListener('beforepopgroup', pop_contactgroup) |
309 .addEventListener('menu-open', menu_toggle) | |
310 .addEventListener('menu-close', menu_toggle); | |
302 | 311 |
303 if (rcmail.env.action == '') { | 312 if (rcmail.env.action == '') { |
304 new rcube_splitter({ id:'addressviewsplitterd', p1:'#addressview-left', p2:'#addressview-right', | 313 new rcube_splitter({ id:'addressviewsplitterd', p1:'#addressview-left', p2:'#addressview-right', |
305 orientation:'v', relative:true, start:206, min:150, size:12, render:resize_leftcol }).init(); | 314 orientation:'v', relative:true, start:206, min:150, size:12, render:resize_leftcol }).init(); |
306 new rcube_splitter({ id:'addressviewsplitter', p1:'#addresslist', p2:'#contacts-box', | 315 new rcube_splitter({ id:'addressviewsplitter', p1:'#addresslist', p2:'#contacts-box', |
434 | 443 |
435 me.messagedialog.html(msg) | 444 me.messagedialog.html(msg) |
436 .dialog({ | 445 .dialog({ |
437 resizable: false, | 446 resizable: false, |
438 closeOnEscape: true, | 447 closeOnEscape: true, |
439 dialogClass: 'popupmessage ' + p.type, | 448 dialogClass: p.type, |
440 title: env.errortitle, | 449 title: rcmail.gettext('errortitle'), |
441 close: dialog_close, | 450 close: dialog_close, |
442 position: ['center', 'center'], | |
443 hide: {effect: 'fadeOut'}, | 451 hide: {effect: 'fadeOut'}, |
444 width: 420, | 452 width: 420, |
445 minHeight: 90 | 453 minHeight: 90 |
446 }).show(); | 454 }).show(); |
447 | 455 |
450 if (p.timeout > 0) | 458 if (p.timeout > 0) |
451 me.message_timer = window.setTimeout(dialog_close, p.timeout); | 459 me.message_timer = window.setTimeout(dialog_close, p.timeout); |
452 } | 460 } |
453 } | 461 } |
454 | 462 |
463 // Mail view layout initialization and change handler | |
464 function mail_layout(p) | |
465 { | |
466 var layout = p ? p.new_layout : rcmail.env.layout, | |
467 top = $('#mailview-top'), | |
468 bottom = $('#mailview-bottom'); | |
469 | |
470 if (p) | |
471 $('#mainscreencontent').removeClass().addClass(layout); | |
472 | |
473 $('#mailviewsplitter')[layout == 'desktop' ? 'show' : 'hide'](); | |
474 $('#mailviewsplitter2')[layout == 'widescreen' ? 'show' : 'hide'](); | |
475 $('#mailpreviewframe')[layout != 'list' ? 'show' : 'hide'](); | |
476 rcmail.env.contentframe = layout == 'list' ? null : 'messagecontframe'; | |
477 | |
478 if (layout == 'widescreen') { | |
479 $('#countcontrols').detach().appendTo($('#messagelistheader')); | |
480 top.css({height: 'auto', width: 394}); | |
481 bottom.css({top: 0, left: 406, height: 'auto'}).show(); | |
482 if (!mailviewsplit2) { | |
483 mailviewsplit2 = new rcube_splitter({ id:'mailviewsplitter2', p1:'#mailview-top', p2:'#mailview-bottom', | |
484 orientation:'v', relative:true, start:416, min:400, size:12}); | |
485 mailviewsplit2.init(); | |
486 } | |
487 else | |
488 mailviewsplit2.resize(); | |
489 } | |
490 else if (layout == 'desktop') { | |
491 top.css({height: 270, width: 'auto'}); | |
492 bottom.css({left: 0, top: 284, height: 'auto'}).show(); | |
493 if (!mailviewsplit) { | |
494 mailviewsplit = new rcube_splitter({ id:'mailviewsplitter', p1:'#mailview-top', p2:'#mailview-bottom', | |
495 orientation:'h', relative:true, start:276, min:150, size:12, offset:4 }); | |
496 mailviewsplit.init(); | |
497 } | |
498 else | |
499 mailviewsplit.resize(); | |
500 } | |
501 else { // layout == 'list' | |
502 top.css({height: 'auto', width: 'auto'}); | |
503 bottom.hide(); | |
504 } | |
505 | |
506 if (p && p.old_layout == 'widescreen') { | |
507 $('#countcontrols').detach().appendTo($('#messagelistfooter')); | |
508 } | |
509 } | |
455 | 510 |
456 /** | 511 /** |
457 * Adjust UI objects of the mail view screen | 512 * Adjust UI objects of the mail view screen |
458 */ | 513 */ |
459 function layout_messageview() | 514 function layout_messageview() |
462 $('#message-objects div a').addClass('button'); | 517 $('#message-objects div a').addClass('button'); |
463 | 518 |
464 if (!$('#attachment-list li').length) { | 519 if (!$('#attachment-list li').length) { |
465 $('div.rightcol').hide().attr('aria-hidden', 'true'); | 520 $('div.rightcol').hide().attr('aria-hidden', 'true'); |
466 $('div.leftcol').css('margin-right', '0'); | 521 $('div.leftcol').css('margin-right', '0'); |
522 } | |
523 | |
524 var mvlpe = $('#messagebody.mailvelope, #messagebody > .mailvelope'); | |
525 if (mvlpe.length) { | |
526 var h = $('#messagecontent').length ? | |
527 $('#messagecontent').height() - 16 : | |
528 $(window).height() - mvlpe.offset().top - 2; | |
529 mvlpe.height(h); | |
467 } | 530 } |
468 } | 531 } |
469 | 532 |
470 | 533 |
471 function render_mailboxlist(splitter) | 534 function render_mailboxlist(splitter) |
529 // never show full-circle if quota is close to 100% but below. | 592 // never show full-circle if quota is close to 100% but below. |
530 if (p.total && y == step * step_count && p.percent < 100) | 593 if (p.total && y == step * step_count && p.percent < 100) |
531 y -= step; | 594 y -= step; |
532 | 595 |
533 element.css('background-position', '0 -' + y + 'px'); | 596 element.css('background-position', '0 -' + y + 'px'); |
597 element.attr('class', 'countdisplay p' + (Math.round(p.percent / 10) * 10)); | |
534 | 598 |
535 if (p.table) { | 599 if (p.table) { |
536 if (!menu.length) | 600 if (!menu.length) |
537 menu = $('<div id="quotamenu" class="popupmenu">').appendTo($('body')); | 601 menu = $('<div id="quotamenu" class="popupmenu">').appendTo($('body')); |
538 | 602 |
583 if (rcmail.env.action == 'preview') | 647 if (rcmail.env.action == 'preview') |
584 $('a.button.replyall').attr('title', label); | 648 $('a.button.replyall').attr('title', label); |
585 else | 649 else |
586 $('a.button.reply-all').text(label).attr('title', label); | 650 $('a.button.reply-all').text(label).attr('title', label); |
587 } | 651 } |
652 else if (p.command == 'compose-encrypted') { | |
653 // show the toolbar button for Mailvelope | |
654 $('a.button.encrypt').show(); | |
655 } | |
588 } | 656 } |
589 | 657 |
590 | 658 |
591 /** | 659 /** |
592 * Register a popup menu | 660 * Register a popup menu |
631 return rcmail.command('menu-open', | 699 return rcmail.command('menu-open', |
632 { menu:popup, show:show }, | 700 { menu:popup, show:show }, |
633 ref.get(0), | 701 ref.get(0), |
634 $.Event('click', { target:ref.get(0), pageX:pos.left, pageY:pos.top, clientX:pos.left, clientY:pos.top })); | 702 $.Event('click', { target:ref.get(0), pageX:pos.left, pageY:pos.top, clientX:pos.left, clientY:pos.top })); |
635 } | 703 } |
636 | |
637 | |
638 /** | |
639 * Show/hide the preview pane | |
640 */ | |
641 function toggle_preview_pane(e) | |
642 { | |
643 var button = $(e.target), | |
644 frame = $('#mailpreviewframe'), | |
645 visible = !frame.is(':visible'), | |
646 splitter = mailviewsplit.pos || parseInt(get_pref('mailviewsplitter') || 320), | |
647 topstyles, bottomstyles, uid; | |
648 | |
649 frame.toggle(); | |
650 button.toggleClass('enabled closed').attr('aria-expanded', visible ? 'true' : 'false'); | |
651 | |
652 if (visible) { | |
653 $('#mailview-top').removeClass('fullheight').css({ bottom:'auto' }); | |
654 $('#mailview-bottom').css({ height:'auto' }).show(); | |
655 | |
656 rcmail.env.contentframe = 'messagecontframe'; | |
657 if (uid = rcmail.message_list.get_single_selection()) | |
658 rcmail.show_message(uid, false, true); | |
659 | |
660 // let the splitter set the correct size and position | |
661 if (mailviewsplit.handle) { | |
662 mailviewsplit.handle.show(); | |
663 mailviewsplit.resize(); | |
664 } | |
665 else | |
666 mailviewsplit.init(); | |
667 } | |
668 else { | |
669 rcmail.env.contentframe = null; | |
670 rcmail.show_contentframe(false); | |
671 | |
672 $('#mailview-top').addClass('fullheight').css({ height:'auto', bottom:'0px' }); | |
673 $('#mailview-bottom').css({ top:'auto', height:'0px' }).hide(); | |
674 | |
675 if (mailviewsplit.handle) | |
676 mailviewsplit.handle.hide(); | |
677 } | |
678 | |
679 if (rcmail.message_list) { | |
680 if (visible && uid) | |
681 rcmail.message_list.scrollto(uid); | |
682 rcmail.message_list.resize(); | |
683 } | |
684 | |
685 rcmail.command('save-pref', { name:'preview_pane', value:(visible?1:0) }); | |
686 } | |
687 | |
688 | 704 |
689 /** | 705 /** |
690 * Switch between short and full headers display in message preview | 706 * Switch between short and full headers display in message preview |
691 */ | 707 */ |
692 function toggle_preview_headers() | 708 function toggle_preview_headers() |
800 | 816 |
801 function attachmentmenu(elem, event) | 817 function attachmentmenu(elem, event) |
802 { | 818 { |
803 var id = elem.parentNode.id.replace(/^attach/, ''); | 819 var id = elem.parentNode.id.replace(/^attach/, ''); |
804 | 820 |
805 $('#attachmenuopen').unbind('click').attr('onclick', '').click(function(e) { | 821 $.each(['open', 'download', 'rename'], function() { |
806 return rcmail.command('open-attachment', id, this); | 822 var action = this; |
807 }); | 823 $('#attachmenu' + action).off('click').attr('onclick', '').click(function(e) { |
808 | 824 return rcmail.command(action + '-attachment', id, this); |
809 $('#attachmenudownload').unbind('click').attr('onclick', '').click(function() { | 825 }); |
810 rcmail.command('download-attachment', id, this); | |
811 }); | 826 }); |
812 | 827 |
813 popupconfig.attachmentmenu.link = elem; | 828 popupconfig.attachmentmenu.link = elem; |
814 rcmail.command('menu-open', {menu: 'attachmentmenu', id: id}, elem, event); | 829 rcmail.command('menu-open', {menu: 'attachmentmenu', id: id}, elem, event); |
815 } | 830 } |
825 | 840 |
826 for (k in rcmail.env.spell_langs) { | 841 for (k in rcmail.env.spell_langs) { |
827 li = $('<li role="menuitem">'); | 842 li = $('<li role="menuitem">'); |
828 link = $('<a href="#'+k+'" tabindex="0"></a>').text(rcmail.env.spell_langs[k]) | 843 link = $('<a href="#'+k+'" tabindex="0"></a>').text(rcmail.env.spell_langs[k]) |
829 .addClass('active').data('lang', k) | 844 .addClass('active').data('lang', k) |
830 .bind('click keypress', function(e) { | 845 .on('click keypress', function(e) { |
831 if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) { | 846 if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) { |
832 rcmail.spellcheck_lang_set($(this).data('lang')); | 847 rcmail.spellcheck_lang_set($(this).data('lang')); |
833 rcmail.hide_menu('spellmenu', e); | 848 rcmail.hide_menu('spellmenu', e); |
834 return false; | 849 return false; |
835 } | 850 } |
850 else if (el.hasClass('selected')) | 865 else if (el.hasClass('selected')) |
851 el.removeClass('selected').removeAttr('aria-selected'); | 866 el.removeClass('selected').removeAttr('aria-selected'); |
852 }); | 867 }); |
853 } | 868 } |
854 | 869 |
870 // append drop-icon to attachments list item (to invoke attachment menu) | |
871 function attachmentmenu_append(item) | |
872 { | |
873 item = $(item); | |
874 | |
875 if (!item.children('.drop').length) | |
876 item.append($('<a class="drop skip-content" tabindex="0" aria-haspopup="true">Show options</a>') | |
877 .on('click keypress', function(e) { | |
878 if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) { | |
879 attachmentmenu(this, e); | |
880 return false; | |
881 } | |
882 })); | |
883 } | |
855 | 884 |
856 /** | 885 /** |
857 * | 886 * |
858 */ | 887 */ |
859 function show_listoptions(p) | 888 function show_listoptions(p) |
868 | 897 |
869 // set form values | 898 // set form values |
870 $('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').prop('checked', true); | 899 $('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').prop('checked', true); |
871 $('input[name="sort_ord"][value="DESC"]').prop('checked', rcmail.env.sort_order == 'DESC'); | 900 $('input[name="sort_ord"][value="DESC"]').prop('checked', rcmail.env.sort_order == 'DESC'); |
872 $('input[name="sort_ord"][value="ASC"]').prop('checked', rcmail.env.sort_order != 'DESC'); | 901 $('input[name="sort_ord"][value="ASC"]').prop('checked', rcmail.env.sort_order != 'DESC'); |
902 | |
903 $.each(['widescreen', 'desktop', 'list'], function() { | |
904 $('input[name="layout"][value="' + this + '"]').prop('checked', rcmail.env.layout == this); | |
905 }); | |
906 $('#listoptions-columns', $dialog)[rcmail.env.layout == 'widescreen' ? 'hide' : 'show'](); | |
873 | 907 |
874 // set checkboxes | 908 // set checkboxes |
875 $('input[name="list_col[]"]').each(function() { | 909 $('input[name="list_col[]"]').each(function() { |
876 $(this).prop('checked', $.inArray(this.value, rcmail.env.listcols) != -1); | 910 $(this).prop('checked', $.inArray(this.value, rcmail.env.listcols) != -1); |
877 }); | 911 }); |
905 if (rcube_event.is_keyboard(p.originalEvent)) | 939 if (rcube_event.is_keyboard(p.originalEvent)) |
906 $('#listmenulink').focus(); | 940 $('#listmenulink').focus(); |
907 | 941 |
908 var sort = $('input[name="sort_col"]:checked').val(), | 942 var sort = $('input[name="sort_col"]:checked').val(), |
909 ord = $('input[name="sort_ord"]:checked').val(), | 943 ord = $('input[name="sort_ord"]:checked').val(), |
944 layout = $('input[name="layout"]:checked').val(), | |
910 cols = $('input[name="list_col[]"]:checked') | 945 cols = $('input[name="list_col[]"]:checked') |
911 .map(function(){ return this.value; }).get(); | 946 .map(function(){ return this.value; }).get(); |
912 | 947 |
913 rcmail.set_list_options(cols, sort, ord, rcmail.env.threading); | 948 rcmail.set_list_options(cols, sort, ord, rcmail.env.threading, layout); |
914 } | 949 } |
915 | 950 |
916 | 951 |
917 /** | 952 /** |
918 * | 953 * |
1009 // close the dialog | 1044 // close the dialog |
1010 if ($dialog.is(':visible')) { | 1045 if ($dialog.is(':visible')) { |
1011 $dialog.dialog('close'); | 1046 $dialog.dialog('close'); |
1012 return; | 1047 return; |
1013 } | 1048 } |
1049 | |
1050 // do nothing if mailvelope editor is active | |
1051 if (rcmail.mailvelope_editor) | |
1052 return; | |
1014 | 1053 |
1015 // add icons to clone file input field | 1054 // add icons to clone file input field |
1016 if (rcmail.env.action == 'compose' && !$dialog.data('extended')) { | 1055 if (rcmail.env.action == 'compose' && !$dialog.data('extended')) { |
1017 $('<a>') | 1056 $('<a>') |
1018 .addClass('iconlink add') | 1057 .addClass('iconlink add') |
1249 .attr('id', this.id) | 1288 .attr('id', this.id) |
1250 .attr('unselectable', 'on') | 1289 .attr('unselectable', 'on') |
1251 .attr('role', 'presentation') | 1290 .attr('role', 'presentation') |
1252 .addClass('splitter ' + (this.horizontal ? 'splitter-h' : 'splitter-v')) | 1291 .addClass('splitter ' + (this.horizontal ? 'splitter-h' : 'splitter-v')) |
1253 .appendTo(this.parent) | 1292 .appendTo(this.parent) |
1254 .bind('mousedown', onDragStart); | 1293 .mousedown(onDragStart); |
1255 | 1294 |
1256 if (this.horizontal) { | 1295 if (this.horizontal) { |
1257 var top = this.p1pos.top + this.p1.outerHeight(); | 1296 var top = this.p1pos.top + this.p1.outerHeight(); |
1258 this.handle.css({ left:'0px', top:top+'px' }); | 1297 this.handle.css({ left:'0px', top:top+'px' }); |
1259 } | 1298 } |
1287 if (this.horizontal) { | 1326 if (this.horizontal) { |
1288 this.p1.css('height', Math.floor(this.pos - this.p1pos.top - Math.floor(this.halfsize)) + 'px'); | 1327 this.p1.css('height', Math.floor(this.pos - this.p1pos.top - Math.floor(this.halfsize)) + 'px'); |
1289 this.p2.css('top', Math.ceil(this.pos + Math.ceil(this.halfsize) + 2) + 'px'); | 1328 this.p2.css('top', Math.ceil(this.pos + Math.ceil(this.halfsize) + 2) + 'px'); |
1290 this.handle.css('top', Math.round(this.pos - this.halfsize + this.offset)+'px'); | 1329 this.handle.css('top', Math.round(this.pos - this.halfsize + this.offset)+'px'); |
1291 if (bw.ie) { | 1330 if (bw.ie) { |
1292 var new_height = parseInt(this.parent.outerHeight(), 10) - parseInt(this.p2.css('top'), 10) - (bw.ie8 ? 2 : 0); | 1331 var new_height = parseInt(this.parent.outerHeight(), 10) - parseInt(this.p2.css('top'), 10); |
1293 this.p2.css('height', (new_height > 0 ? new_height : 0) + 'px'); | 1332 this.p2.css('height', (new_height > 0 ? new_height : 0) + 'px'); |
1294 } | 1333 } |
1295 } | 1334 } |
1296 else { | 1335 else { |
1297 this.p1.css('width', Math.floor(this.pos - this.p1pos.left - Math.floor(this.halfsize)) + 'px'); | 1336 this.p1.css('width', Math.floor(this.pos - this.p1pos.left - Math.floor(this.halfsize)) + 'px'); |
1330 me.p1pos = me.relative ? me.p1.position() : me.p1.offset(); | 1369 me.p1pos = me.relative ? me.p1.position() : me.p1.offset(); |
1331 me.p2pos = me.relative ? me.p2.position() : me.p2.offset(); | 1370 me.p2pos = me.relative ? me.p2.position() : me.p2.offset(); |
1332 me.drag_active = true; | 1371 me.drag_active = true; |
1333 | 1372 |
1334 // start listening to mousemove events | 1373 // start listening to mousemove events |
1335 $(document).bind('mousemove.'+this.id, onDrag).bind('mouseup.'+this.id, onDragStop); | 1374 $(document).on('mousemove.' + this.id, onDrag).on('mouseup.' + this.id, onDragStop); |
1375 | |
1376 // hack messages list so it will propagate the mouseup event over the list | |
1377 if (rcmail.message_list) | |
1378 rcmail.message_list.drag_active = true; | |
1336 | 1379 |
1337 // enable dragging above iframes | 1380 // enable dragging above iframes |
1338 $('iframe').each(function(i, elem) { | 1381 $('iframe').each(function(i, elem) { |
1339 $('<div>') | 1382 $('<div>') |
1340 .attr('id', 'iframe-splitter-fix-'+i) | 1383 .attr('id', 'iframe-splitter-fix-'+i) |
1407 // resume the ability to highlight text | 1450 // resume the ability to highlight text |
1408 if (bw.konq || bw.chrome || bw.safari) | 1451 if (bw.konq || bw.chrome || bw.safari) |
1409 document.body.style.webkitUserSelect = 'auto'; | 1452 document.body.style.webkitUserSelect = 'auto'; |
1410 | 1453 |
1411 // cancel the listening for drag events | 1454 // cancel the listening for drag events |
1412 $(document).unbind('.'+me.id); | 1455 $(document).off('.' + me.id); |
1413 me.drag_active = false; | 1456 me.drag_active = false; |
1457 | |
1458 if (rcmail.message_list) | |
1459 rcmail.message_list.drag_active = false; | |
1414 | 1460 |
1415 // remove temp divs | 1461 // remove temp divs |
1416 $('div.iframe-splitter-fix').remove(); | 1462 $('div.iframe-splitter-fix').remove(); |
1417 | 1463 |
1418 me.set_cookie(); | 1464 me.set_cookie(); |
1427 * Handler for window resize events | 1473 * Handler for window resize events |
1428 */ | 1474 */ |
1429 function onResize(e) | 1475 function onResize(e) |
1430 { | 1476 { |
1431 if (me.horizontal) { | 1477 if (me.horizontal) { |
1432 var new_height = parseInt(me.parent.outerHeight(), 10) - parseInt(me.p2[0].style.top, 10) - (bw.ie8 ? 2 : 0); | 1478 var new_height = parseInt(me.parent.outerHeight(), 10) - parseInt(me.p2[0].style.top, 10); |
1433 me.p2.css('height', (new_height > 0 ? new_height : 0) +'px'); | 1479 me.p2.css('height', (new_height > 0 ? new_height : 0) +'px'); |
1434 } | 1480 } |
1435 else { | 1481 else { |
1436 var new_width = parseInt(me.parent.outerWidth(), 10) - parseInt(me.p2[0].style.left, 10); | 1482 var new_width = parseInt(me.parent.outerWidth(), 10) - parseInt(me.p2[0].style.left, 10); |
1437 me.p2.css('width', (new_width > 0 ? new_width : 0) + 'px'); | 1483 me.p2.css('width', (new_width > 0 ? new_width : 0) + 'px'); |