From: Jan Schneider Date: Tue, 9 Feb 2010 11:27:36 +0000 (+0100) Subject: Update history in base class. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=58ed42a226dd81cee9bc905d1cc8493cf238bd3e;p=horde.git Update history in base class. --- diff --git a/kronolith/lib/Driver.php b/kronolith/lib/Driver.php index b46525185..67a2938cc 100644 --- a/kronolith/lib/Driver.php +++ b/kronolith/lib/Driver.php @@ -303,10 +303,29 @@ class Kronolith_Driver } /** - * Stub to be overridden in the child class. + * Moves an event to a new calendar. + * + * @param string $eventId The event to move. + * @param string $newCalendar The new calendar. */ public function move($eventId, $newCalendar) { + $event = $this->_move($eventId, $newCalendar); + + /* Log the moving of this item in the history log. */ + $uid = $event->uid; + if ($uid) { + $history = Horde_History::singleton(); + $history->log('kronolith:' . $event->calendar . ':' . $uid, array('action' => 'delete'), true); + $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true); + } + } + + /** + * Stub to be overridden in the child class. + */ + protected function _move($eventId, $newCalendar) + { return PEAR::raiseError('Not supported'); } diff --git a/kronolith/lib/Driver/Kolab.php b/kronolith/lib/Driver/Kolab.php index 0826b3d09..0185672f1 100644 --- a/kronolith/lib/Driver/Kolab.php +++ b/kronolith/lib/Driver/Kolab.php @@ -396,12 +396,14 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver } /** - * Move an event to a new calendar. + * Moves an event to a new calendar. * * @param string $eventId The event to move. * @param string $newCalendar The new calendar. + * + * @return Kronolith_Event The old event. */ - public function move($eventId, $newCalendar) + protected function _move($eventId, $newCalendar) { $event = $this->getEvent($eventId); @@ -424,13 +426,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($newCalendar)); } - /* Log the moving of this item in the history log. */ - $uid = $event->uid; - $history = Horde_History::singleton(); - $history->log('kronolith:' . $event->calendar . ':' . $uid, array('action' => 'delete'), true); - $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true); - - return $result; + return $event; } /** diff --git a/kronolith/lib/Driver/Sql.php b/kronolith/lib/Driver/Sql.php index bff89c038..ecfe97020 100644 --- a/kronolith/lib/Driver/Sql.php +++ b/kronolith/lib/Driver/Sql.php @@ -670,12 +670,14 @@ class Kronolith_Driver_Sql extends Kronolith_Driver } /** - * Move an event to a new calendar. + * Moves an event to a new calendar. * * @param string $eventId The event to move. * @param string $newCalendar The new calendar. + * + * @return Kronolith_Event The old event. */ - public function move($eventId, $newCalendar) + protected function _move($eventId, $newCalendar) { /* Fetch the event for later use. */ $event = $this->getEvent($eventId); @@ -698,15 +700,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver return $result; } - /* Log the moving of this item in the history log. */ - $uid = $event->uid; - if ($uid) { - $history = Horde_History::singleton(); - $history->log('kronolith:' . $this->calendar . ':' . $uid, array('action' => 'delete'), true); - $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true); - } - - return true; + return $event; } /**