Moving the notification logic from driver to the calendar.

This commit is contained in:
Bogomil Shopov 2011-06-14 15:40:47 +03:00
parent feae471289
commit e574f572be
2 changed files with 6 additions and 5 deletions

View file

@ -418,7 +418,7 @@ class calendar extends rcube_plugin
$reload = true; $reload = true;
break; break;
case "remove": case "remove":
$success = $this->driver->remove_event($event); $removed = $this->driver->remove_event($event);
$reload = true; $reload = true;
break; break;
case "dismiss": case "dismiss":
@ -429,11 +429,13 @@ class calendar extends rcube_plugin
if ($success) if ($success)
$this->rc->output->show_message('successfullysaved', 'confirmation'); $this->rc->output->show_message('successfullysaved', 'confirmation');
else if ($removed)
$this->rc->output->show_message('calendar.successremoval', 'confirmation');
else else
$this->rc->output->show_message('calendar.errorsaving', 'error'); $this->rc->output->show_message('calendar.errorsaving', 'error');
// FIXME: update a single event object on the client instead of reloading the entire source // FIXME: update a single event object on the client instead of reloading the entire source
if ($success && $reload) if ($success && $reload or ($removed && $reload))
$this->rc->output->command('plugin.reload_calendar', array('source' => $event['calendar'])); $this->rc->output->command('plugin.reload_calendar', array('source' => $event['calendar']));
} }

View file

@ -209,9 +209,8 @@ class kolab_driver extends calendar_driver
public function remove_event($event) public function remove_event($event)
{ {
if (($storage = $this->_get_storage($event['calendar'])) && ($ev = $storage->get_event($event['id']))) if (($storage = $this->_get_storage($event['calendar'])) && ($ev = $storage->get_event($event['id'])))
$rt = $storage->delete_event($event + $ev); return $storage->delete_event($event);
if($rt==true)
$this->rc->output->show_message('calendar.successremoval', 'success'); return $rt;
return false; return false;
} }