Update history in base class.
authorJan Schneider <jan@horde.org>
Tue, 9 Feb 2010 11:27:36 +0000 (12:27 +0100)
committerJan Schneider <jan@horde.org>
Wed, 10 Feb 2010 16:31:44 +0000 (17:31 +0100)
kronolith/lib/Driver.php
kronolith/lib/Driver/Kolab.php
kronolith/lib/Driver/Sql.php

index b465251..67a2938 100644 (file)
@@ -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');
     }
 
index 0826b3d..0185672 100644 (file)
@@ -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;
     }
 
     /**
index bff89c0..ecfe970 100644 (file)
@@ -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;
     }
 
     /**