| | |
| | | |
| | | /*** mail task ***/ |
| | | if (rcmail.env.task == 'mail') { |
| | | rcmail.addEventListener('menu-open', menu_open) |
| | | .addEventListener('menu-save', menu_save) |
| | | rcmail.addEventListener('menu-open', menu_toggle) |
| | | .addEventListener('menu-close', menu_toggle) |
| | | .addEventListener('menu-save', save_listoptions) |
| | | .addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) }) |
| | | .addEventListener('responseaftersearch', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) }); |
| | | |
| | |
| | | |
| | | // add menu link for each attachment |
| | | $('#attachment-list > li').each(function() { |
| | | $(this).append($('<a class="drop"></a>').click(function() { attachmentmenu(this); })); |
| | | $(this).append($('<a class="drop" tabindex="0" aria-haspopup="true">Show options</a>') |
| | | .bind('click keypress', function(e) { |
| | | if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) { |
| | | attachmentmenu(this, e); |
| | | return false; |
| | | } |
| | | }) |
| | | ); |
| | | }); |
| | | |
| | | if (get_pref('previewheaders') == '1') { |
| | |
| | | } |
| | | } |
| | | |
| | | $('#composeoptionstoggle').click(function(){ |
| | | $('#composeoptionstoggle').click(function(e){ |
| | | $('#composeoptionstoggle').toggleClass('remove'); |
| | | $('#composeoptions').toggle(); |
| | | layout_composeview(); |
| | | save_pref('composeoptions', $('#composeoptions').is(':visible') ? '1' : '0'); |
| | | if (!rcube_event.is_keyboard(e)) |
| | | this.blur(); |
| | | return false; |
| | | }).css('cursor', 'pointer'); |
| | | |
| | |
| | | $('#message-objects div a').addClass('button'); |
| | | |
| | | if (!$('#attachment-list li').length) { |
| | | $('div.rightcol').hide(); |
| | | $('div.rightcol').hide().attr('aria-hidden', 'true'); |
| | | $('div.leftcol').css('margin-right', '0'); |
| | | } |
| | | } |
| | |
| | | ref.focus(); |
| | | } |
| | | |
| | | obj[show?'show':'hide'](); |
| | | obj[show?'show':'hide']().attr('aria-hidden', show?'false':'true'); |
| | | |
| | | popup_keyboard_active = show && keyboard; |
| | | if (popup_keyboard_active) { |
| | | focused_popup = popup; |
| | | obj.find('a,input').not('[aria-disabled=true]').first().focus(); |
| | | obj.find('a,input:not(:disabled)').not('[aria-disabled=true]').first().focus(); |
| | | } |
| | | else { |
| | | focused_popup = null; |
| | |
| | | |
| | | /**** popup callbacks ****/ |
| | | |
| | | function menu_open(p) |
| | | function menu_toggle(p) |
| | | { |
| | | if (p && p.props && p.props.menu == 'attachmentmenu') |
| | | show_popupmenu('attachmentmenu'); |
| | | show_popupmenu('attachmentmenu', undefined, rcube_event.is_keyboard(p.originalEvent)); |
| | | else |
| | | show_listoptions(); |
| | | } |
| | | |
| | | function menu_save(prop) |
| | | { |
| | | save_listoptions(); |
| | | show_listoptions(p); |
| | | } |
| | | |
| | | function searchmenu(show) |
| | |
| | | } |
| | | } |
| | | |
| | | function attachmentmenu(elem) |
| | | function attachmentmenu(elem, event) |
| | | { |
| | | var id = elem.parentNode.id.replace(/^attach/, ''); |
| | | |
| | |
| | | }); |
| | | |
| | | popupconfig.attachmentmenu.link = elem; |
| | | rcmail.command('menu-open', {menu: 'attachmentmenu', id: id}); |
| | | rcmail.command('menu-open', {menu: 'attachmentmenu', id: id}, elem, event); |
| | | } |
| | | |
| | | function spellmenu(show) |
| | | { |
| | | var link, li, |
| | | var k, link, li, |
| | | lang = rcmail.spellcheck_lang(), |
| | | menu = popups.spellmenu, |
| | | ul = $('ul', menu); |
| | | |
| | | if (!ul.length) { |
| | | ul = $('<ul class="toolbarmenu selectable">'); |
| | | ul = $('<ul class="toolbarmenu selectable" role="menu">'); |
| | | |
| | | for (i in rcmail.env.spell_langs) { |
| | | li = $('<li>'); |
| | | link = $('<a href="#"></a>').text(rcmail.env.spell_langs[i]) |
| | | .addClass('active').data('lang', i) |
| | | .click(function() { |
| | | rcmail.spellcheck_lang_set($(this).data('lang')); |
| | | for (k in rcmail.env.spell_langs) { |
| | | li = $('<li role="menuitem">'); |
| | | link = $('<a href="#'+k+'" tabindex="0"></a>').text(rcmail.env.spell_langs[k]) |
| | | .addClass('active').data('lang', k) |
| | | .bind('click keypress', function(e) { |
| | | if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) { |
| | | rcmail.spellcheck_lang_set($(this).data('lang')); |
| | | show_popupmenu('spellmenu', false, rcube_event.is_keyboard(e)) |
| | | return false; |
| | | } |
| | | }); |
| | | |
| | | link.appendTo(li); |
| | |
| | | $('li', ul).each(function() { |
| | | var el = $('a', this); |
| | | if (el.data('lang') == lang) |
| | | el.addClass('selected'); |
| | | el.addClass('selected').attr('aria-selected', 'true'); |
| | | else if (el.hasClass('selected')) |
| | | el.removeClass('selected'); |
| | | el.removeClass('selected').removeAttr('aria-selected'); |
| | | }); |
| | | } |
| | | |
| | |
| | | /** |
| | | * |
| | | */ |
| | | function show_listoptions() |
| | | function show_listoptions(p) |
| | | { |
| | | var $dialog = $('#listoptions'); |
| | | |
| | | // close the dialog |
| | | if ($dialog.is(':visible')) { |
| | | $dialog.dialog('close'); |
| | | $dialog.dialog('close', p.originalEvent); |
| | | return; |
| | | } |
| | | |
| | |
| | | resizable: false, |
| | | closeOnEscape: true, |
| | | title: null, |
| | | close: function() { |
| | | open: function(e) { |
| | | setTimeout(function(){ $dialog.find('a, input:not(:disabled)').not('[aria-disabled=true]').first().focus(); }, 100); |
| | | }, |
| | | close: function(e) { |
| | | $dialog.dialog('destroy').hide(); |
| | | if (e.originalEvent && rcube_event.is_keyboard(e.originalEvent)) |
| | | $('#listmenulink').focus(); |
| | | }, |
| | | minWidth: 500, |
| | | width: $dialog.width()+25 |
| | |
| | | /** |
| | | * |
| | | */ |
| | | function save_listoptions() |
| | | function save_listoptions(p) |
| | | { |
| | | $('#listoptions').dialog('close'); |
| | | |
| | | if (rcube_event.is_keyboard(p.originalEvent)) |
| | | $('#listmenulink').focus(); |
| | | |
| | | var sort = $('input[name="sort_col"]:checked').val(), |
| | | ord = $('input[name="sort_ord"]:checked').val(), |
| | |
| | | }); |
| | | } |
| | | |
| | | function show_uploadform() |
| | | function show_uploadform(e) |
| | | { |
| | | var $dialog = $('#upload-dialog'); |
| | | |
| | |
| | | resizable: false, |
| | | closeOnEscape: true, |
| | | title: $dialog.attr('title'), |
| | | open: function(e) { |
| | | if (!document.all) |
| | | $('input[type=file]', $dialog).first().click(); |
| | | }, |
| | | close: function() { |
| | | try { $('#upload-dialog form').get(0).reset(); } |
| | | catch(e){ } // ignore errors |
| | |
| | | }, |
| | | width: 480 |
| | | }).show(); |
| | | |
| | | if (!document.all) |
| | | $('input[type=file]', $dialog).first().click(); |
| | | } |
| | | |
| | | function add_uploadfile(e) |