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.
This commit is contained in:
Aleksander Machniak (Kolab Systems) 2011-07-19 15:18:05 +02:00
parent 084501f53a
commit 6b5c895ffc
2 changed files with 13 additions and 12 deletions

View file

@ -91,11 +91,13 @@ class calendar extends rcube_plugin
} }
if ($this->rc->task == 'calendar' && $this->rc->action != 'save-pref') { if ($this->rc->task == 'calendar' && $this->rc->action != 'save-pref') {
$this->load_driver(); if ($this->rc->action != 'upload') {
$this->load_driver();
// load iCalendar functions // load iCalendar functions
require($this->home . '/lib/calendar_ical.php'); require($this->home . '/lib/calendar_ical.php');
$this->ical = new calendar_ical($this->rc, $this->driver); $this->ical = new calendar_ical($this->rc, $this->driver);
}
// register calendar actions // register calendar actions
$this->register_action('index', array($this, 'calendar_view')); $this->register_action('index', array($this, 'calendar_view'));

View file

@ -256,7 +256,7 @@ function rcube_calendar_ui(settings)
} }
} }
else if (calendar.attachments) { 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 // list event attendees
@ -474,7 +474,7 @@ function rcube_calendar_ui(settings)
} }
else { else {
$('#edit-attachments > ul').empty(); $('#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: '', recurrence: '',
alarms: '', alarms: '',
attendees: event_attendees, attendees: event_attendees,
deleted_attachments: rcmail.env.deleted_attachments deleted_attachments: rcmail.env.deleted_attachments,
attachments: []
}; };
// serialize alarm settings // serialize alarm settings
@ -522,11 +523,9 @@ function rcube_calendar_ui(settings)
} }
// uploaded attachments list // uploaded attachments list
var attachments = [];
for (var i in rcmail.env.attachments) for (var i in rcmail.env.attachments)
if (i.match(/^rcmfile([0-9a-z]+)/)) if (i.match(/^rcmfile(.+)/))
attachments.push(RegExp.$1); data.attachments.push(RegExp.$1);
data.attachments = attachments;
// read attendee roles // read attendee roles
$('select.edit-attendee-role').each(function(i, elem){ $('select.edit-attendee-role').each(function(i, elem){