From c639dd817ea08a298d43897c95369fe2d20678b0 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 18 Jul 2016 09:54:24 -0400 Subject: [PATCH] Fix errors in tasks export (T1355) --- plugins/tasklist/tasklist.js | 13 ++++++++++--- plugins/tasklist/tasklist.php | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js index 868172b0..4032d6c6 100644 --- a/plugins/tasklist/tasklist.js +++ b/plugins/tasklist/tasklist.js @@ -836,7 +836,9 @@ function rcube_tasklist_ui(settings) $("#task-export-list").val(''); buttons[rcmail.gettext('export', 'tasklist')] = function() { - var source = $('#task-export-list option:selected').val(); + var data = {}, + source = $('#task-export-list option:selected').val(), + form_elements = $('select, input', form); // "current view" export, use hidden form to POST task IDs if (source === '') { @@ -851,7 +853,7 @@ function rcube_tasklist_ui(settings) }); // copy form inputs, there may be controls added by other plugins - $('#tasksexport select, #tasksexport input').each(function() { + form_elements.each(function() { if (this.type != 'checkbox' || this.checked) inputs.push($('').attr({type: 'hidden', name: this.name, value: this.value})); }); @@ -868,7 +870,12 @@ function rcube_tasklist_ui(settings) } // otherwise we can use simple GET else { - rcmail.goto_url('export', {source: source, attachments: attach}); + form_elements.each(function() { + if (this.type != 'checkbox' || this.checked) + data[this.name] = $(this).val(); + }); + + rcmail.goto_url('export', data); } $dialog.dialog("close"); diff --git a/plugins/tasklist/tasklist.php b/plugins/tasklist/tasklist.php index d34b9e7c..7c3f21d2 100644 --- a/plugins/tasklist/tasklist.php +++ b/plugins/tasklist/tasklist.php @@ -1639,7 +1639,7 @@ class tasklist extends rcube_plugin header("Content-Type: text/calendar"); header("Content-Disposition: inline; filename=\"". $plugin['filename'] ."\""); - $this->get_ical()->export($plugin['tasks'], '', true, + $this->get_ical()->export($plugin['result'], '', true, $plugins['attachments'] ? array($this->driver, 'get_attachment_body') : null); exit; }