From 6b5c895ffc68ab0c0edd54fe4916e4557b988e30 Mon Sep 17 00:00:00 2001 From: "Aleksander Machniak (Kolab Systems)" Date: Tue, 19 Jul 2011 15:18:05 +0200 Subject: [PATCH] Attachments upload handling: - Fixed regexp for attachment names which can be more complicated when using database_attachments plugin - Don't load driver in 'upload' action to prevent from possible session race-conditions when calling upload progress action and for better performance. --- plugins/calendar/calendar.php | 10 ++++++---- plugins/calendar/calendar_ui.js | 15 +++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index 76cb88d6..a8c3e8f4 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -91,11 +91,13 @@ class calendar extends rcube_plugin } if ($this->rc->task == 'calendar' && $this->rc->action != 'save-pref') { - $this->load_driver(); + if ($this->rc->action != 'upload') { + $this->load_driver(); - // load iCalendar functions - require($this->home . '/lib/calendar_ical.php'); - $this->ical = new calendar_ical($this->rc, $this->driver); + // load iCalendar functions + require($this->home . '/lib/calendar_ical.php'); + $this->ical = new calendar_ical($this->rc, $this->driver); + } // register calendar actions $this->register_action('index', array($this, 'calendar_view')); diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js index b5425777..14146322 100644 --- a/plugins/calendar/calendar_ui.js +++ b/plugins/calendar/calendar_ui.js @@ -256,7 +256,7 @@ function rcube_calendar_ui(settings) } } else if (calendar.attachments) { - // fetch attachments, some drivers doesn't set 'attachments' popr of the event + // fetch attachments, some drivers doesn't set 'attachments' prop of the event? } // list event attendees @@ -474,7 +474,7 @@ function rcube_calendar_ui(settings) } else { $('#edit-attachments > ul').empty(); - // fetch attachments, some drivers doesn't set 'attachments' array for event + // fetch attachments, some drivers doesn't set 'attachments' array for event? } } @@ -507,7 +507,8 @@ function rcube_calendar_ui(settings) recurrence: '', alarms: '', attendees: event_attendees, - deleted_attachments: rcmail.env.deleted_attachments + deleted_attachments: rcmail.env.deleted_attachments, + attachments: [] }; // serialize alarm settings @@ -522,12 +523,10 @@ function rcube_calendar_ui(settings) } // uploaded attachments list - var attachments = []; for (var i in rcmail.env.attachments) - if (i.match(/^rcmfile([0-9a-z]+)/)) - attachments.push(RegExp.$1); - data.attachments = attachments; - + if (i.match(/^rcmfile(.+)/)) + data.attachments.push(RegExp.$1); + // read attendee roles $('select.edit-attendee-role').each(function(i, elem){ if (data.attendees[i])