diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php index af9d6fa9..fed7aed5 100644 --- a/plugins/calendar/drivers/kolab/kolab_driver.php +++ b/plugins/calendar/drivers/kolab/kolab_driver.php @@ -92,7 +92,7 @@ class kolab_driver extends calendar_driver $this->calendars = array(); foreach ($folders as $folder) { if ($folder instanceof kolab_storage_folder_user) { - $calendar = new kolab_user_calendar($folder->name, $this->cal); + $calendar = new kolab_user_calendar($folder, $this->cal); $calendar->subscriptions = count($folder->children) > 0; } else { diff --git a/plugins/calendar/drivers/kolab/kolab_invitation_calendar.php b/plugins/calendar/drivers/kolab/kolab_invitation_calendar.php index 4a440747..5e81377b 100644 --- a/plugins/calendar/drivers/kolab/kolab_invitation_calendar.php +++ b/plugins/calendar/drivers/kolab/kolab_invitation_calendar.php @@ -34,6 +34,7 @@ class kolab_invitation_calendar public $categories = array(); public $name = 'Invitations'; + /** * Default constructor */ @@ -62,7 +63,6 @@ class kolab_invitation_calendar $this->alarms = $prefs[$this->id]['showalarms']; } - /** * Getter for a nice and human readable name for this calendar * @@ -73,7 +73,6 @@ class kolab_invitation_calendar return $this->name; } - /** * Getter for the IMAP folder owner * @@ -84,7 +83,6 @@ class kolab_invitation_calendar return $this->cal->rc->get_user_name(); } - /** * */ @@ -93,7 +91,6 @@ class kolab_invitation_calendar return $this->get_name(); } - /** * Getter for the name of the namespace to which the IMAP folder belongs * @@ -104,7 +101,6 @@ class kolab_invitation_calendar return 'x-special'; } - /** * Getter for the top-end calendar folder name (not the entire path) * @@ -171,7 +167,6 @@ class kolab_invitation_calendar return $prop['id']; } - /** * Getter for a single event object */ @@ -216,7 +211,6 @@ class kolab_invitation_calendar return false; } - /** * @param integer Event's new start (unix timestamp) * @param integer Event's new end (unix timestamp) @@ -318,7 +312,6 @@ class kolab_invitation_calendar return $event; } - /** * Create a new event record * @@ -337,7 +330,6 @@ class kolab_invitation_calendar * @see calendar_driver::new_event() * @return boolean True on success, False on error */ - public function update_event($event, $exception_id = null) { // forward call to the actual storage folder @@ -372,6 +364,4 @@ class kolab_invitation_calendar { return false; } - - } diff --git a/plugins/calendar/drivers/kolab/kolab_user_calendar.php b/plugins/calendar/drivers/kolab/kolab_user_calendar.php index 00f1dfc4..84f159bf 100644 --- a/plugins/calendar/drivers/kolab/kolab_user_calendar.php +++ b/plugins/calendar/drivers/kolab/kolab_user_calendar.php @@ -5,7 +5,7 @@ * * @author Thomas Bruederli * - * Copyright (C) 2014-2015, Kolab Systems AG + * Copyright (C) 2014-2016, Kolab Systems AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -45,8 +45,12 @@ class kolab_user_calendar extends kolab_calendar $this->userdata = $user_or_folder; $this->storage = new kolab_storage_folder_user($this->userdata['kolabtargetfolder'], '', $this->userdata); } + else if ($user_or_folder instanceof kolab_storage_folder_user) { + $this->storage = $user_or_folder; + $this->userdata = $this->storage->ldaprec; + } else { // get user record from LDAP - $this->storage = new kolab_storage_folder_user($user_or_folder); + $this->storage = new kolab_storage_folder_user($user_or_folder); $this->userdata = $this->storage->ldaprec; } @@ -57,7 +61,7 @@ class kolab_user_calendar extends kolab_calendar // ID is derrived from the user's kolabtargetfolder attribute $this->id = kolab_storage::folder_id($this->userdata['kolabtargetfolder'], true); $this->imap_folder = $this->userdata['kolabtargetfolder']; - $this->name = $this->storage->get_name(); + $this->name = $this->storage->name; $this->parent = ''; // user calendars are top level // user-specific alarms settings win @@ -67,7 +71,6 @@ class kolab_user_calendar extends kolab_calendar } } - /** * Getter for a nice and human readable name for this calendar * @@ -78,7 +81,6 @@ class kolab_user_calendar extends kolab_calendar return $this->userdata['displayname'] ?: ($this->userdata['name'] ?: $this->userdata['mail']); } - /** * Getter for the IMAP folder owner * @@ -89,7 +91,6 @@ class kolab_user_calendar extends kolab_calendar return $this->userdata['mail']; } - /** * */ @@ -98,7 +99,6 @@ class kolab_user_calendar extends kolab_calendar return trim($this->userdata['displayname'] . '; ' . $this->userdata['mail'], '; '); } - /** * Getter for the name of the namespace to which the IMAP folder belongs * @@ -109,7 +109,6 @@ class kolab_user_calendar extends kolab_calendar return 'other user'; } - /** * Getter for the top-end calendar folder name (not the entire path) * @@ -164,7 +163,6 @@ class kolab_user_calendar extends kolab_calendar return $prop['id']; } - /** * Getter for a single event object */ @@ -370,7 +368,6 @@ class kolab_user_calendar extends kolab_calendar return sprintf('%s/%s', $event['start']->format('U'), is_object($event['end']->format('U')) ?: '0'); } - /** * Create a new event record * @@ -389,7 +386,6 @@ class kolab_user_calendar extends kolab_calendar * @see calendar_driver::new_event() * @return boolean True on success, False on error */ - public function update_event($event, $exception_id = null) { return false; @@ -417,7 +413,6 @@ class kolab_user_calendar extends kolab_calendar return false; } - /** * Convert from Kolab_Format to internal representation */ @@ -428,5 +423,4 @@ class kolab_user_calendar extends kolab_calendar return kolab_driver::to_rcube_event($record); } - } diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php index a3087e9b..532cb524 100644 --- a/plugins/libkolab/lib/kolab_storage.php +++ b/plugins/libkolab/lib/kolab_storage.php @@ -613,6 +613,7 @@ class kolab_storage } } } + if (!$found && !empty($namespace['other'])) { foreach ($namespace['other'] as $ns) { if (strlen($ns[0]) && strpos($folder, $ns[0]) === 0) { @@ -636,6 +637,7 @@ class kolab_storage } } } + if (!$found && !empty($namespace['personal'])) { foreach ($namespace['personal'] as $ns) { if (strlen($ns[0]) && strpos($folder, $ns[0]) === 0) { @@ -973,7 +975,7 @@ class kolab_storage $nsnames = array('personal' => array(), 'shared' => array(), 'other' => array()); foreach ($folders as $folder) { - $folders[$folder->name] = $folder; + $_folders[$folder->name] = $folder; $ns = $folder->get_namespace(); $nsnames[$ns][$folder->name] = strtolower(html_entity_decode($folder->get_name(), ENT_COMPAT, RCUBE_CHARSET)) . $pad; // decode » } @@ -982,7 +984,7 @@ class kolab_storage foreach (array_keys($nsnames) as $ns) { asort($nsnames[$ns], SORT_LOCALE_STRING); foreach (array_keys($nsnames[$ns]) as $utf7name) { - $out[] = $folders[$utf7name]; + $out[] = $_folders[$utf7name]; } } @@ -1023,6 +1025,7 @@ class kolab_storage while (count($path) >= $depth && ($parent = join($delim, $path))) { array_pop($path); $parent_parent = join($delim, $path); + if (!$refs[$parent]) { if ($folder->type && self::folder_type($parent) == $folder->type) { $refs[$parent] = new kolab_storage_folder($parent, $folder->type, $folder->type); diff --git a/plugins/libkolab/lib/kolab_storage_folder_user.php b/plugins/libkolab/lib/kolab_storage_folder_user.php index 0ff0bcaa..7e435002 100644 --- a/plugins/libkolab/lib/kolab_storage_folder_user.php +++ b/plugins/libkolab/lib/kolab_storage_folder_user.php @@ -33,7 +33,7 @@ class kolab_storage_folder_user extends kolab_storage_folder_virtual */ public function __construct($name, $parent = '', $ldaprec = null) { - parent::__construct($name, $name, 'other', $parent); + parent::__construct($name, kolab_storage::object_prettyname($name), 'other', $parent); if (!empty($ldaprec)) { self::$ldapcache[$name] = $this->ldaprec = $ldaprec;