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;
break;
case "remove":
$success = $this->driver->remove_event($event);
$removed = $this->driver->remove_event($event);
$reload = true;
break;
case "dismiss":
@ -429,11 +429,13 @@ class calendar extends rcube_plugin
if ($success)
$this->rc->output->show_message('successfullysaved', 'confirmation');
else if ($removed)
$this->rc->output->show_message('calendar.successremoval', 'confirmation');
else
$this->rc->output->show_message('calendar.errorsaving', 'error');
// 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']));
}

View file

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