Fix errors in tasks export (T1355)

This commit is contained in:
Aleksander Machniak 2016-07-18 09:54:24 -04:00
parent 72f80123cd
commit c639dd817e
2 changed files with 11 additions and 4 deletions

View file

@ -836,7 +836,9 @@ function rcube_tasklist_ui(settings)
$("#task-export-list").val(''); $("#task-export-list").val('');
buttons[rcmail.gettext('export', 'tasklist')] = function() { 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 // "current view" export, use hidden form to POST task IDs
if (source === '') { if (source === '') {
@ -851,7 +853,7 @@ function rcube_tasklist_ui(settings)
}); });
// copy form inputs, there may be controls added by other plugins // 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) if (this.type != 'checkbox' || this.checked)
inputs.push($('<input>').attr({type: 'hidden', name: this.name, value: this.value})); inputs.push($('<input>').attr({type: 'hidden', name: this.name, value: this.value}));
}); });
@ -868,7 +870,12 @@ function rcube_tasklist_ui(settings)
} }
// otherwise we can use simple GET // otherwise we can use simple GET
else { 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"); $dialog.dialog("close");

View file

@ -1639,7 +1639,7 @@ class tasklist extends rcube_plugin
header("Content-Type: text/calendar"); header("Content-Type: text/calendar");
header("Content-Disposition: inline; filename=\"". $plugin['filename'] ."\""); 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); $plugins['attachments'] ? array($this->driver, 'get_attachment_body') : null);
exit; exit;
} }