From: Gunnar Wrobel
Date: Thu, 11 Mar 2010 18:49:14 +0000 (+0100) Subject: Basic fixes to get kronolith working with the Kolab backend. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=02fa3640d8cc9c8454e9c6f0054988dbb31e2821;p=horde.git Basic fixes to get kronolith working with the Kolab backend. --- diff --git a/kronolith/lib/Driver/Kolab.php b/kronolith/lib/Driver/Kolab.php index f49902a73..df6a6ab2a 100644 --- a/kronolith/lib/Driver/Kolab.php +++ b/kronolith/lib/Driver/Kolab.php @@ -15,6 +15,13 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver { /** + * The session handler. + * + * @var Horde_Kolab_Session + */ + private $_session; + + /** * Our Kolab server connection. * * @var Kolab @@ -43,11 +50,38 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver private $_store; /** + * Set the session handler. + * + * @param Horde_Kolab_Session $session The session handler. + * + * @return NULL + */ + public function setSession(Horde_Kolab_Session $session) + { + $this->_session = $session; + } + + /** + * Retrieve a connected kolab session. + * + * @return Horde_Kolab_Session The connected session. + * + * @throws Horde_Kolab_Session_Exception + */ + public function getSession() + { + if (!isset($this->_session)) { + $this->_session = Horde_Kolab_Session_Singleton::singleton(); + } + return $this->_session; + } + + /** * Attempts to open a Kolab Groupware folder. */ public function initialize() { - $this->_kolab = new Kolab(); + $this->_kolab = $this->getSession()->getStorage(); $this->reset(); } @@ -101,11 +135,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver } // Connect to the Kolab backend - $result = $this->_kolab->open($this->calendar, 1); - if ($result instanceof PEAR_Error) { - throw new Kronolith_Exception($result); - } - $this->_store = $this->_kolab->_storage; + $this->_store = $this->_kolab->getShareData($this->calendar, 'event'); // build internal event cache $this->_events_cache = array(); @@ -125,7 +155,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver $allevents = $this->listEvents($date, null, false, true); $events = array(); - foreach ($allevents as $eventId) { + foreach ($allevents as $eventId => $data) { $event = $this->getEvent($eventId); if (!$event->recurs()) { $start = new Horde_Date($event->start); @@ -381,7 +411,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver $this->synchronize(true); if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { - Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($event->calendar)); + //Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($event->calendar)); } return $event->uid; @@ -412,8 +442,8 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver } if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { - Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($this->calendar)); - Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($newCalendar)); + //Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($this->calendar)); + //Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($newCalendar)); } return $event; @@ -433,7 +463,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver $result = $this->_store->deleteAll($calendar); if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { - Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($calendar)); + //Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($calendar)); } } @@ -466,7 +496,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver $history->log('kronolith:' . $event->calendar . ':' . $event->uid, array('action' => 'delete'), true); if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { - Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($event->calendar)); + //Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($event->calendar)); } unset($this->_events_cache[$eventId]); diff --git a/kronolith/lib/Event/Kolab.php b/kronolith/lib/Event/Kolab.php index 3b2f522f9..e05f1b5a1 100644 --- a/kronolith/lib/Event/Kolab.php +++ b/kronolith/lib/Event/Kolab.php @@ -167,7 +167,7 @@ class Kronolith_Event_Kolab extends Kronolith_Event $event['sensitivity'] = $this->private ? 'private' : 'public'; // Only set organizer if this is a new event - if ($this->getID() == null) { + if ($this->_id == null) { $organizer = array( 'display-name' => Kronolith::getUserName($this->creator), 'smtp-address' => Kronolith::getUserEmail($this->creator)