From e81f37dda791539d3c5c8644262a8804a3e5696c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Sun, 13 Feb 2011 21:08:49 +0000 Subject: [PATCH] * CalDAV: Apply other users' calendar color, too --- calendar/inc/class.calendar_groupdav.inc.php | 10 ---------- phpgwapi/inc/class.groupdav.inc.php | 21 +++++++++++++++++++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/calendar/inc/class.calendar_groupdav.inc.php b/calendar/inc/class.calendar_groupdav.inc.php index 1ae03f63c1..8919152f79 100644 --- a/calendar/inc/class.calendar_groupdav.inc.php +++ b/calendar/inc/class.calendar_groupdav.inc.php @@ -920,15 +920,6 @@ error_log(__METHOD__."($path,,".array2string($start).") filter=".array2string($f */ static function extra_properties(array $props=array(), $displayname, $base_uri=null) { - if (strlen($GLOBALS['egw_info']['user']['preferences']['calendar']['display_color']) == 9 && - $GLOBALS['egw_info']['user']['preferences']['calendar']['display_color'][0] == '#') - { - $display_color = $GLOBALS['egw_info']['user']['preferences']['calendar']['display_color']; - } - else - { - $display_color = '#0040A0FF'; - } // calendar description $props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-description',$displayname); /* @@ -965,7 +956,6 @@ error_log(__METHOD__."($path,,".array2string($start).") filter=".array2string($f $props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'supported-calendar-data',array( HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data', array('content-type' => 'text/calendar', 'version'=> '2.0')), HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data', array('content-type' => 'text/x-calendar', 'version'=> '1.0')))); - $props[] = HTTP_WebDAV_Server::mkprop(groupdav::ICAL,'calendar-color',$display_color); //$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALENDARSERVER,'publish-url',array( // HTTP_WebDAV_Server::mkprop('href',$base_uri.'/calendar/'))); diff --git a/phpgwapi/inc/class.groupdav.inc.php b/phpgwapi/inc/class.groupdav.inc.php index 4b2b966d38..c620fc29d4 100644 --- a/phpgwapi/inc/class.groupdav.inc.php +++ b/phpgwapi/inc/class.groupdav.inc.php @@ -385,18 +385,36 @@ class groupdav extends HTTP_WebDAV_Server function _properties($app,$no_extra_types=false,$user=null,$path='/') { if ($this->debug) error_log(__METHOD__."(app='$app', no_extra_types=$no_extra_types, user='$user', path='$path')"); + $user_preferences = $GLOBALS['egw_info']['user']['preferences']; if ($user) { $account_lid = $this->accounts->id2name($user); + if ($user >= 0 && $GLOBALS['egw']->preferences->account_id != $user) + { + $GLOBALS['egw']->preferences->__construct($user); + $user_preferences = $GLOBALS['egw']->preferences->read_repository(); + $GLOBALS['egw']->preferences->__construct($GLOBALS['egw_info']['user']['account_lid']); + } } else { $account_lid = $GLOBALS['egw_info']['user']['account_lid']; } + + if (strlen($user_preferences['calendar']['display_color']) == 9 && + $user_preferences['calendar']['display_color'][0] == '#') + { + $display_color = $user_preferences['calendar']['display_color']; + } + else + { + $display_color = '#0040A0FF'; + } + $account = $this->accounts->read($account_lid); $displayname = $GLOBALS['egw']->translation->convert($account['account_fullname'], $GLOBALS['egw']->translation->charset(),'utf-8'); - + if ($user < 0) { $principalType = 'groups'; @@ -433,6 +451,7 @@ class groupdav extends HTTP_WebDAV_Server // OUTBOX URLs of the current user $props[] = self::mkprop(groupdav::CALDAV,'schedule-outbox-URL', array(self::mkprop(groupdav::DAV,'href',$this->base_uri.'/calendar/'))); + $props[] = self::mkprop(groupdav::ICAL,'calendar-color',$display_color); break; case 'infolog': $props[] = self::mkprop(groupdav::CALDAV,'calendar-home-set',array(