"Add from cloud" for task attachments (T811)

Note: "Save as task" dialog for email does not contain Attachments tab,
      as "Save as event" dialogs. We likely would want attachments handling
      in this dialog too. Currently it works only in Tasks UI.
This commit is contained in:
Aleksander Machniak 2015-10-30 10:37:06 +01:00
parent 905df56bb9
commit 8c9bdc4571
2 changed files with 18 additions and 4 deletions

View file

@ -64,11 +64,17 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function()
kolab_files_init();
}
else if (rcmail.task == 'calendar') {
// add "attach from cloud" button for event/task dialog
// add "attach from cloud" button for event dialog
if (!rcmail.env.action)
kolab_files_from_cloud_widget($('#calendar-attachment-form > div.formbuttons'));
kolab_files_init();
}
else if (rcmail.task == 'tasks') {
// add "attach from cloud" button for task dialog
if (!rcmail.env.action)
kolab_files_from_cloud_widget($('#taskedit-attachment-form > div.formbuttons'));
kolab_files_init();
}
else if (rcmail.task == 'files') {
if (rcmail.gui_objects.filelist) {
rcmail.file_list = new rcube_list_widget(rcmail.gui_objects.filelist, {

View file

@ -91,7 +91,7 @@ class kolab_files_engine
$list_widget = true;
}
else if ($this->rc->task == 'calendar' && !$this->rc->action) {
else if (!$this->rc->action && in_array($this->rc->task, array('calendar', 'tasks'))) {
$list_widget = true;
$templates[] = 'compose_plugin';
}
@ -1143,7 +1143,7 @@ class kolab_files_engine
$this->rc->output->command('display_message', $this->plugin->gettext('attacherror'), 'error');
$this->rc->output->command('remove_from_attachment_list', $uploadid);
}
else if ($this->rc->task == 'calendar') {
else if ($this->rc->task == 'calendar' || $this->rc->task == 'tasks') {
// for uploads in events/tasks we'll use its standard upload handler,
// for this we have to fake $_FILES and some other POST args
foreach ($attachments as $attach) {
@ -1157,7 +1157,15 @@ class kolab_files_engine
$_GET['_uploadid'] = $uploadid;
$_GET['_id'] = $COMPOSE_ID;
libcalendaring::get_instance()->attachment_upload(calendar::SESSION_KEY, 'cal-');
switch ($this->rc->task) {
case 'tasks':
libcalendaring::get_instance()->attachment_upload(tasklist::SESSION_KEY);
break;
case 'calendar':
libcalendaring::get_instance()->attachment_upload(calendar::SESSION_KEY, 'cal-');
break;
}
}
// send html page with JS calls as response