From bb3b7fec0ee3b57a1ba690b113aff398e2c6d55f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 3 Nov 2017 12:24:18 +0100 Subject: [PATCH 1/4] Make itip links optional and disabled by default This feature has ever had many limitations and inconsistent behaviour depending if the user is logged in or not. Also in meantime, PHP's mail() support has been removed from Roundcube Framework. Now to enable the feature you have to set calendar_itip_smtp_server option. --- plugins/calendar/config.inc.php.dist | 3 ++- .../lib/libcalendaring_itip.php | 20 ++++--------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/plugins/calendar/config.inc.php.dist b/plugins/calendar/config.inc.php.dist index 99da1edc..22705b86 100644 --- a/plugins/calendar/config.inc.php.dist +++ b/plugins/calendar/config.inc.php.dist @@ -138,8 +138,9 @@ $config['calendar_freebusy_trigger'] = false; $config['calendar_include_freebusy_data'] = 1; // SMTP server host used to send (anonymous) itip messages. -// Set to '' in order to use PHP's mail() function for email delivery. // To override the SMTP port or connection method, provide a full URL like 'tls://somehost:587' +// This will add a link to invitation messages to allow users from outside +// to reply when their mail clients do not support iTip format. $config['calendar_itip_smtp_server'] = null; // SMTP username used to send (anonymous) itip messages diff --git a/plugins/libcalendaring/lib/libcalendaring_itip.php b/plugins/libcalendaring/lib/libcalendaring_itip.php index b960e9a4..4a4e88d5 100644 --- a/plugins/libcalendaring/lib/libcalendaring_itip.php +++ b/plugins/libcalendaring/lib/libcalendaring_itip.php @@ -44,7 +44,6 @@ class libcalendaring_itip array('identity' => $this->rc->user->list_emails(true))); $this->sender = $hook['identity']; - $this->plugin->add_hook('message_before_send', array($this, 'before_send_hook')); $this->plugin->add_hook('smtp_connect', array($this, 'smtp_connect_hook')); } @@ -152,7 +151,10 @@ class libcalendaring_itip // } // append links for direct invitation replies - if ($method == 'REQUEST' && $rsvp && ($token = $this->store_invitation($event, $recipient['email']))) { + if ($method == 'REQUEST' && $rsvp + && $this->rc->config->get('calendar_itip_smtp_server') + && ($token = $this->store_invitation($event, $recipient['email'])) + ) { $mailbody .= "\n\n" . $this->gettext(array( 'name' => 'invitationattendlinks', 'vars' => array('url' => $this->plugin->get_url(array('action' => 'attend', 't' => $token))), @@ -177,20 +179,6 @@ class libcalendaring_itip return $sent; } - /** - * Plugin hook triggered by rcube::deliver_message() before delivering a message. - * Here we can set the 'smtp_server' config option to '' in order to use - * PHP's mail() function for unauthenticated email sending. - */ - public function before_send_hook($p) - { - if ($this->itip_send && !$this->rc->user->ID && $this->rc->config->get('calendar_itip_smtp_server', null) === '') { - $this->rc->config->set('smtp_server', ''); - } - - return $p; - } - /** * Plugin hook to alter SMTP authentication. * This is used if iTip messages are to be sent from an unauthenticated session From d5d0248a58dd3832e81ed41daaeeb80a01af0bb6 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 9 Nov 2017 11:29:48 +0100 Subject: [PATCH 2/4] Support predefined values for "Add Storage" dialog forms (Bifrost#T55341) --- plugins/kolab_files/kolab_files.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index 5941d942..47817f4b 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -552,13 +552,21 @@ function kolab_files_folder_mount_dialog() rcmail.drivers_list_initialized = true; $('td.source', dialog).each(function() { - $(this).click(function() { + var td = $(this), + id = td.attr('id').replace('source-', ''), + meta = rcmail.env.external_sources[id]; + + $.each(meta.form_values || [], function(i, v) { + td.find('#source-' + id + '-' + i).val(v); + }); + + td.click(function() { $('td.selected', dialog).removeClass('selected'); dialog.find('.driverform').hide(); $(this).addClass('selected').find('.driverform').show(); $('input[type="radio"]', this).prop('checked', true); - }); - }); + }); + }); } args.button_classes = ['mainaction']; From 65726f421799aa1c7e537a44a770dd6cea250fdd Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 9 Nov 2017 12:41:48 +0100 Subject: [PATCH 3/4] Fix Overwrite/Skip buttons in copy/move dialog (Bifrost#T57654) --- plugins/kolab_files/kolab_files.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index 47817f4b..cfa46084 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -890,9 +890,9 @@ function kolab_dialog_submit_handler() }; // Hides dialog -function kolab_dialog_close(dialog) +function kolab_dialog_close(dialog, destroy) { - (rcmail.is_framed() ? window.parent : window).$(dialog).dialog('close'); + (rcmail.is_framed() ? window.parent : window).$(dialog).dialog(destroy ? 'destroy' : 'close'); }; // smart upload button @@ -3147,7 +3147,7 @@ function kolab_files_ui() this.file_move_ask_user = function(list, move) { var file = list[0], buttons = {}, - text = rcmail.gettext('kolab_files.filemoveconfirm').replace('$file', file.dst) + text = rcmail.gettext('kolab_files.filemoveconfirm').replace('$file', file.dst), dialog = $('
'); buttons[rcmail.gettext('kolab_files.fileoverwrite')] = function() { @@ -3157,7 +3157,8 @@ function kolab_files_ui() f[file.src] = file.dst; file_api.file_move_ask_list = list; file_api.file_move_ask_mode = move; - dialog.dialog('destroy').remove(); + kolab_dialog_close(this, true); + file_api.req = file_api.set_busy(true, move ? 'kolab_files.filemoving' : 'kolab_files.filecopying'); file_api.request(action, {file: f, overwrite: 1}, 'file_move_ask_user_response'); }; @@ -3167,14 +3168,15 @@ function kolab_files_ui() var f = {}, action = move ? 'file_move' : 'file_copy'; $.each(list, function() { f[this.src] = this.dst; }); - dialog.dialog('destroy').remove(); + kolab_dialog_close(this, true); + file_api.req = file_api.set_busy(true, move ? 'kolab_files.filemoving' : 'kolab_files.filecopying'); file_api.request(action, {file: f, overwrite: 1}, action + '_response'); }; var skip_func = function() { list.shift(); - dialog.dialog('destroy').remove(); + kolab_dialog_close(this, true); if (list.length) file_api.file_move_ask_user(list, move); @@ -3186,7 +3188,7 @@ function kolab_files_ui() if (list.length > 1) buttons[rcmail.gettext('kolab_files.fileskipall')] = function() { - dialog.dialog('destroy').remove(); + kolab_dialog_close(this, true); if (move) file_api.file_list(); }; @@ -3195,6 +3197,7 @@ function kolab_files_ui() kolab_dialog_show(dialog.html(text), { close: skip_func, buttons: buttons, + height: 50, minWidth: 400, width: 400 }); From 0b90768a3dc782d638b8f2d4bc211d9fd4416925 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 22 Nov 2017 09:26:18 +0100 Subject: [PATCH 4/4] Fix bug where any action after moving a file (with drag'n'drop) would cause file move (Bifrost#T59850) Also fix endless "Loading..." message on file download with Roundcube 1.4. --- plugins/kolab_files/kolab_files.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index cfa46084..6a625b62 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -1144,6 +1144,7 @@ function kolab_files_drag_end(e) } rcmail.command('files-move', rcmail.env.drag_target); + rcmail.env.drag_target = null; } } }; @@ -3026,7 +3027,7 @@ function kolab_files_ui() params.token = this.env.token; params.file = file; - rcmail.redirect(this.env.url + this.url('file_get', params)); + rcmail.redirect(this.env.url + this.url('file_get', params), false); }; // file(s) delete request