From bd0551b22076b82a6d49e9f7a2b2e0c90a1b2326 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Fri, 05 Feb 2016 07:25:27 -0500 Subject: [PATCH] Secure also downloads of addressbook exports, managesieve script exports and Enigma keys exports --- skins/larry/ui.js | 40 ++++++++++++++++++++++++++-------------- 1 files changed, 26 insertions(+), 14 deletions(-) diff --git a/skins/larry/ui.js b/skins/larry/ui.js index 9841851..2377cb4 100644 --- a/skins/larry/ui.js +++ b/skins/larry/ui.js @@ -136,6 +136,7 @@ rcmail.addEventListener('menu-open', menu_toggle) .addEventListener('menu-close', menu_toggle) .addEventListener('menu-save', save_listoptions) + .addEventListener('enable-command', enable_command) .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) }); @@ -146,9 +147,9 @@ } if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') { - rcmail.addEventListener('enable-command', enable_command) - .addEventListener('aftershow-headers', function() { layout_messageview(); }) + rcmail.addEventListener('aftershow-headers', function() { layout_messageview(); }) .addEventListener('afterhide-headers', function() { layout_messageview(); }); + $('#previewheaderstoggle').click(function(e) { toggle_preview_headers(); if (this.blur && !rcube_event.is_keyboard(e)) @@ -159,7 +160,7 @@ // add menu link for each attachment $('#attachment-list > li').each(function() { $(this).append($('<a class="drop" tabindex="0" aria-haspopup="true">Show options</a>') - .bind('click keypress', function(e) { + .on('click keypress', function(e) { if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) { attachmentmenu(this, e); return false; @@ -174,11 +175,15 @@ } else if (rcmail.env.action == 'compose') { rcmail.addEventListener('aftersend-attachment', show_uploadform) - .addEventListener('add-recipient', function(p){ show_header_row(p.field, true); }) - .addEventListener('aftertoggle-editor', function(e){ + .addEventListener('aftertoggle-editor', function(e) { window.setTimeout(function(){ layout_composeview() }, 200); if (e && e.mode) $("select[name='editorSelector']").val(e.mode); + }) + .addEventListener('compose-encrypted', function(e) { + $("select[name='editorSelector']").prop('disabled', e.active); + $('a.button.attach, a.button.responses')[(e.active?'addClass':'removeClass')]('disabled'); + $('#responseslist a.insertresponse')[(e.active?'removeClass':'addClass')]('active'); }); // Show input elements with non-empty value @@ -227,14 +232,13 @@ $('#mailthreadmode').addClass(rcmail.env.threading ? 'selected' : '').click(function(e) { switch_view_mode('thread'); return false; }); mailviewsplit = new rcube_splitter({ id:'mailviewsplitter', p1:'#mailview-top', p2:'#mailview-bottom', - orientation:'h', relative:true, start:310, min:150, size:12, offset:4 }); + orientation:'h', relative:true, start:276, min:150, size:12, offset:4 }); if (previewframe) mailviewsplit.init(); rcmail.init_pagejumper('#pagejumper'); rcmail.addEventListener('setquota', update_quota) - .addEventListener('enable-command', enable_command) .addEventListener('afterimport-messages', show_uploadform); } else if (rcmail.env.action == 'get') { @@ -469,7 +473,7 @@ $('div.leftcol').css('margin-right', '0'); } - var mvlpe = $('#messagebody.mailvelope'); + var mvlpe = $('#messagebody.mailvelope, #messagebody > .mailvelope'); if (mvlpe.length) { var h = $('#messagecontent').length ? $('#messagecontent').height() - 16 : @@ -596,6 +600,10 @@ $('a.button.replyall').attr('title', label); else $('a.button.reply-all').text(label).attr('title', label); + } + else if (p.command == 'compose-encrypted') { + // show the toolbar button for Mailvelope + $('a.button.encrypt').show(); } } @@ -814,11 +822,11 @@ { var id = elem.parentNode.id.replace(/^attach/, ''); - $('#attachmenuopen').unbind('click').attr('onclick', '').click(function(e) { + $('#attachmenuopen').off('click').attr('onclick', '').click(function(e) { return rcmail.command('open-attachment', id, this); }); - $('#attachmenudownload').unbind('click').attr('onclick', '').click(function() { + $('#attachmenudownload').off('click').attr('onclick', '').click(function() { rcmail.command('download-attachment', id, this); }); @@ -839,7 +847,7 @@ 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) { + .on('click keypress', function(e) { if (e.type != 'keypress' || rcube_event.get_keycode(e) == 13) { rcmail.spellcheck_lang_set($(this).data('lang')); rcmail.hide_menu('spellmenu', e); @@ -1023,6 +1031,10 @@ $dialog.dialog('close'); return; } + + // do nothing if mailvelope editor is active + if (rcmail.mailvelope_editor) + return; // add icons to clone file input field if (rcmail.env.action == 'compose' && !$dialog.data('extended')) { @@ -1263,7 +1275,7 @@ .attr('role', 'presentation') .addClass('splitter ' + (this.horizontal ? 'splitter-h' : 'splitter-v')) .appendTo(this.parent) - .bind('mousedown', onDragStart); + .mousedown(onDragStart); if (this.horizontal) { var top = this.p1pos.top + this.p1.outerHeight(); @@ -1344,7 +1356,7 @@ me.drag_active = true; // start listening to mousemove events - $(document).bind('mousemove.'+this.id, onDrag).bind('mouseup.'+this.id, onDragStop); + $(document).on('mousemove.' + this.id, onDrag).on('mouseup.' + this.id, onDragStop); // enable dragging above iframes $('iframe').each(function(i, elem) { @@ -1421,7 +1433,7 @@ document.body.style.webkitUserSelect = 'auto'; // cancel the listening for drag events - $(document).unbind('.'+me.id); + $(document).off('.' + me.id); me.drag_active = false; // remove temp divs -- Gitblit v1.9.1