diff --git a/addressbook/inc/class.addressbook_groupdav.inc.php b/addressbook/inc/class.addressbook_groupdav.inc.php index d7a3257ed3..e15dbc9221 100644 --- a/addressbook/inc/class.addressbook_groupdav.inc.php +++ b/addressbook/inc/class.addressbook_groupdav.inc.php @@ -169,7 +169,7 @@ class addressbook_groupdav extends groupdav_handler unset($filter['address_data']); $files = array(); // we query etag and modified, as LDAP does not have the strong sql etag - if (($contacts =& $this->bo->search(array(),$address_data ? false : array('id','uid','etag','modified'),'contact_id','','',False,'AND',$start,$filter))) + if (($contacts =& $this->bo->search(array(),array('id','uid','etag','modified'),'contact_id','','',False,'AND',$start,$filter))) { foreach($contacts as &$contact) { diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index d8ea9a8a6d..c39235b974 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -1462,6 +1462,7 @@ class calendar_bo function _list_cals_add($id,&$users,&$groups) { $name = $GLOBALS['egw']->common->grab_owner_name($id); + $egw_name = $GLOBALS['egw']->accounts->id2name($id); if (($type = $GLOBALS['egw']->accounts->get_type($id)) == 'g') { $arr = &$groups; @@ -1473,7 +1474,8 @@ class calendar_bo $arr[$name] = Array( 'grantor' => $id, 'value' => ($type == 'g' ? 'g_' : '') . $id, - 'name' => $name + 'name' => $name, + 'sname' => $egw_name ); } @@ -1504,6 +1506,13 @@ class calendar_bo } } } + foreach ($groups as $name => $group) + { + foreach ($users as $user) + { + if ($user['sname'] == $group['sname']) unset($groups[$name]); + } + } uksort($users,'strnatcasecmp'); uksort($groups,'strnatcasecmp'); diff --git a/phpgwapi/inc/class.groupdav.inc.php b/phpgwapi/inc/class.groupdav.inc.php index 047014a20c..950d92fa6a 100644 --- a/phpgwapi/inc/class.groupdav.inc.php +++ b/phpgwapi/inc/class.groupdav.inc.php @@ -242,9 +242,6 @@ class groupdav extends HTTP_WebDAV_Server $account_lid = $GLOBALS['egw_info']['user']['account_lid']; } $account = $this->accounts->read($account_lid); - $displayname = $GLOBALS['egw']->translation->convert($account['account_fullname'], - $GLOBALS['egw']->translation->charset(),'utf-8'); - $files = array('files' => array()); $path = $user_prefix = $this->_slashify($user_prefix); @@ -254,21 +251,30 @@ class groupdav extends HTTP_WebDAV_Server { $user_prefix = '/'; //.$GLOBALS['egw_info']['user']['account_lid'].'/'; } - if ($options['depth']) - { - $displayname = 'EGroupware (Cal|Card|Group)DAV server'; - } + $calendar_user_address_set = array( + self::mkprop('href',$this->base_uri.'/principals/'.$principalType.'/'.$account['account_lid'].'/'), + self::mkprop('href','urn:uuid:'.$account['account_lid'])); if ($user < 0) { $principalType = 'groups'; + $displayname = lang('Group').' '.$account['account_lid']; } else { $principalType = 'users'; + $displayname = $account['account_fullname']; + $calendar_user_address_set[] = self::mkprop('href','MAILTO:'.$account['account_email']); } + if ($options['depth'] && $user_prefix == '/') + { + $displayname = 'EGroupware (Cal|Card|Group)DAV server'; + } + + $displayname = translation::convert($displayname, translation::charset(),'utf-8'); // self url $props = array( self::mkprop('displayname',$displayname), + self::mkprop('owner',array(self::mkprop('href',$this->base_uri.'/principals/'.$principalType.'/'.$account_lid.'/'))), self::mkprop('resourcetype',array(self::mkprop('collection',''))), // adding the calendar extra property (calendar-home-set, etc.) here, allows apple iCal to "autodetect" the URL self::mkprop(groupdav::CALDAV,'calendar-home-set',array( @@ -276,10 +282,7 @@ class groupdav extends HTTP_WebDAV_Server self::mkprop(groupdav::CARDDAV,'addressbook-home-set',array( self::mkprop('href',$this->base_uri.$user_prefix))), self::mkprop('current-user-principal',array(self::mkprop('href',$this->principalURL))), - self::mkprop(groupdav::CALDAV,'calendar-user-address-set',array( - self::mkprop('href','MAILTO:'.$account['account_email']), - self::mkprop('href',$this->base_uri.'/principals/'.$principalType.'/'.$account['account_lid'].'/'), - self::mkprop('href','urn:uuid:'.$account['account_lid']))), + self::mkprop(groupdav::CALDAV,'calendar-user-address-set',$calendar_user_address_set), self::mkprop(groupdav::CALENDARSERVER,'email-address-set',array( self::mkprop(groupdav::CALENDARSERVER,'email-address',$GLOBALS['egw_info']['user']['email']))), //self::mkprop('principal-URL',array(self::mkprop('href',$this->principalURL))), @@ -464,8 +467,9 @@ class groupdav extends HTTP_WebDAV_Server } if (method_exists($app.'_groupdav','extra_properties')) { - $displayname = $GLOBALS['egw']->translation->convert($account['account_fullname'], - $GLOBALS['egw']->translation->charset(),'utf-8'); + $displayname = translation::convert( + $account['account_id'] > 0 ? $account['account_fullname'] : lang('Group').' '.$account['account_lid'], + translation::charset(),'utf-8'); $props = ExecMethod2($app.'_groupdav::extra_properties',$props,$displayname,$this->base_uri); } return $props; @@ -722,6 +726,7 @@ class groupdav extends HTTP_WebDAV_Server $options['content'] .= fread($options['stream'],8192); } } + if ($this->debug) error_log(__METHOD__.'('.array2string($options).')'); if (!$this->_parse_path($options['path'],$id,$app,$user)) diff --git a/phpgwapi/inc/class.groupdav_principals.inc.php b/phpgwapi/inc/class.groupdav_principals.inc.php index 0cf3abbdde..e39f022035 100644 --- a/phpgwapi/inc/class.groupdav_principals.inc.php +++ b/phpgwapi/inc/class.groupdav_principals.inc.php @@ -251,6 +251,38 @@ class groupdav_principals extends groupdav_handler $this->base_uri.'/principals/groups/'.$group); } } + $addressbooks = array(); + $calendars = array(); + if ($account['account_id'] == $GLOBALS['egw_info']['user']['account_id']) + { + $addr_bo = new addressbook_bo(); + foreach ($addr_bo->get_addressbooks() as $id => $label) + { + if ($id && is_numeric($id)) + { + $owner = $GLOBALS['egw']->accounts->id2name($id); + $addressbooks[] = HTTP_WebDAV_Server::mkprop('href', + $this->base_uri.'/'.$owner.'/'); + } + } + $addressbooks[] = HTTP_WebDAV_Server::mkprop('href', + $this->base_uri.'/DAB/'); + $cal_bo = new calendar_bo(); + foreach ($cal_bo->list_cals() as $label => $entry) + { + $id = $entry['grantor']; + $owner = $GLOBALS['egw']->accounts->id2name($id); + $calendars[] = HTTP_WebDAV_Server::mkprop('href', + $this->base_uri.'/'.$owner.'/'); + } + } + else + { + $addressbooks[] = HTTP_WebDAV_Server::mkprop('href', + $this->base_uri.'/'.$account['account_lid'].'/'); + $calendars[] = HTTP_WebDAV_Server::mkprop('href', + $this->base_uri.'/'.$account['account_lid'].'/'); + } $props = array( HTTP_WebDAV_Server::mkprop('displayname',$displayname), HTTP_WebDAV_Server::mkprop('getetag',$this->get_etag($account)), @@ -260,8 +292,7 @@ class groupdav_principals extends groupdav_handler HTTP_WebDAV_Server::mkprop('href','MAILTO:'.$account['account_email']))), HTTP_WebDAV_Server::mkprop('principal-URL',array( HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/principals/users/'.$account['account_lid'].'/'))), - HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-home-set',array( - HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/'.$account['account_lid'].'/'))), + HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-home-set',$calendars), HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-user-address-set',array( HTTP_WebDAV_Server::mkprop('href','MAILTO:'.$account['account_email']), HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/principals/users/'.$account['account_lid'].'/'), @@ -274,8 +305,7 @@ class groupdav_principals extends groupdav_handler HTTP_WebDAV_Server::mkprop(groupdav::CALENDARSERVER,'first-name',$account['account_firstname']), HTTP_WebDAV_Server::mkprop(groupdav::CALENDARSERVER,'record-type','user'), HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-user-type','INDIVIDUAL'), - HTTP_WebDAV_Server::mkprop(groupdav::CARDDAV,'addressbook-home-set',array( - HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/'.$account['account_lid'].'/'))), + HTTP_WebDAV_Server::mkprop(groupdav::CARDDAV,'addressbook-home-set',$addressbooks), HTTP_WebDAV_Server::mkprop('group-member-ship', $memberships), HTTP_WebDAV_Server::mkprop('supported-report-set',array( HTTP_WebDAV_Server::mkprop('supported-report',array(