Revert back to let the drivers decide which kind of IDs they want.
authorJan Schneider <jan@horde.org>
Wed, 11 Aug 2010 15:14:17 +0000 (17:14 +0200)
committerJan Schneider <jan@horde.org>
Wed, 11 Aug 2010 15:34:56 +0000 (17:34 +0200)
kronolith/lib/Driver.php
kronolith/lib/Driver/Ical.php
kronolith/lib/Driver/Kolab.php
kronolith/lib/Driver/Sql.php

index e65fcfc..2e5334c 100644 (file)
@@ -308,13 +308,6 @@ class Kronolith_Driver
         if ($event->stored || $event->exists()) {
             return $this->_updateEvent($event);
         }
-
-        if (!$event->id) {
-            $event->id = (string)new Horde_Support_Randomid;
-        }
-        if (!$event->uid) {
-            $event->uid = (string)new Horde_Support_Guid;
-        }
         return $this->_addEvent($event);
     }
 
index 30db150..b8c0f47 100644 (file)
@@ -407,6 +407,13 @@ class Kronolith_Driver_Ical extends Kronolith_Driver
      */
     protected function _addEvent($event)
     {
+        if (!$event->uid) {
+            $event->uid = (string)new Horde_Support_Uuid;
+        }
+        if (!$event->id) {
+            $event->id = $event->id . '.ics';
+        }
+
         $response = $this->_saveEvent($event);
         if (!in_array($response->code, array(200, 201, 204))) {
             Horde::logMessage(sprintf('Failed to create event on remote calendar: url = "%s", status = %s',
index e177d89..6d1727c 100644 (file)
@@ -369,6 +369,9 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver
             ? array('action' => 'modify')
             : array('action' => 'add');
 
+        if (!$event->uid) {
+            $event->uid = $this->_store->generateUID();
+        }
         $this->_store->save($event->toKolab(), $edit ? $event->uid : null);
 
         /* Deal with tags */
index 0a81b0a..d39cc1d 100644 (file)
@@ -606,6 +606,13 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
      */
     protected function _addEvent($event)
     {
+        if (!$event->id) {
+            $event->id = (string)new Horde_Support_Randomid;
+        }
+        if (!$event->uid) {
+            $event->uid = (string)new Horde_Support_Guid;
+        }
+
         $query = 'INSERT INTO ' . $this->_params['table'];
         $cols_name = ' (event_id, event_uid,';
         $cols_values = ' VALUES (?, ?,';