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') {
$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'));

View file

@ -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])