mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 08:53:37 +01:00
567e952fba
Merge of following commits from Trunk: r32609: * GroupDAV preference for addressbook-home-set (requires to register hooks) r32610: missing groupdav hooks r32611: fixed missing "users" of principal url in calendar-user-address-set r32615: as the pricipal of current user is influenced by GroupDAV prefs, we have to include them in the etag r32619: loop over existing addressbooks, to make sure each ab is only once in addressbook-home-set, even when selected multiple times in the prefs because of symbolic ab like "primary group" r32620: urlencode and decode account_lid in url to cope with group-names with space in it, which stall iPhone OS 4.2 devices r32621: fixed bug: GroupDAV/CardDAV PUT request to /addressbook/ changes owner, also checking now required ACL for moving contacts between addressbooks r32622: returning "403 Forbidden" if addressbook_bo->save() fails, happens when writing new entries in ABs without ADD rights r32623: * iCal on iPhone detects URL now correct reverted calendar-home-set to report only users calendar, as reporting multiple break propfind r32624: we need a real redirect, not just a proxy r32631: fixed working in GroupDAV prefs and translation
97 lines
2.3 KiB
PHP
97 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* EGroupware: GroupDAV hooks: eg. preferences
|
|
*
|
|
* @link http://www.egroupware.org
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
* @package api
|
|
* @subpackage groupdav
|
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
|
* @copyright (c) 2010 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
|
* @version $Id$
|
|
*/
|
|
|
|
/**
|
|
* GroupDAV hooks: eg. preferences
|
|
*/
|
|
class groupdav_hooks
|
|
{
|
|
/**
|
|
* Show GroupDAV preferences link in preferences
|
|
*
|
|
* @param string|array $args
|
|
*/
|
|
public static function menus($args)
|
|
{
|
|
$appname = 'groupdav';
|
|
$location = is_array($args) ? $args['location'] : $args;
|
|
|
|
if ($location == 'preferences')
|
|
{
|
|
$file = array(
|
|
'Preferences' => egw::link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname),
|
|
);
|
|
if ($location == 'preferences')
|
|
{
|
|
display_section($appname,$file);
|
|
}
|
|
else
|
|
{
|
|
display_sidebox($appname,lang('Preferences'),$file);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* populates $settings for the preferences
|
|
*
|
|
* @param array|string $hook_data
|
|
* @return array
|
|
*/
|
|
static function settings($hook_data)
|
|
{
|
|
$settings = array();
|
|
|
|
if ($hook_data['setup'])
|
|
{
|
|
$addressbooks = array();
|
|
}
|
|
else
|
|
{
|
|
$user = $GLOBALS['egw_info']['user']['account_id'];
|
|
$addressbook_bo = new addressbook_bo();
|
|
$addressbooks = $addressbook_bo->get_addressbooks(EGW_ACL_READ);
|
|
unset($addressbooks[$user]); // Use P for personal addressbook
|
|
unset($addressbooks[$user.'p']);// ignore (optional) private addressbook for now
|
|
}
|
|
$addressbooks = array(
|
|
'P' => lang('Personal'),
|
|
'G' => lang('Primary Group'),
|
|
//'U' => lang('Accounts'), // not yet working
|
|
'O' => lang('All in one'),
|
|
'A' => lang('All'),
|
|
) + $addressbooks;
|
|
|
|
// rewriting owner=0 to 'U', as 0 get's always selected by prefs
|
|
if (!isset($addressbooks[0]))
|
|
{
|
|
unset($addressbooks['U']);
|
|
}
|
|
else
|
|
{
|
|
unset($addressbooks[0]);
|
|
}
|
|
|
|
$settings['add_default'] = array(
|
|
'type' => 'multiselect',
|
|
'label' => 'Addressbooks to sync with Apple clients',
|
|
'name' => 'addressbook-home-set',
|
|
'help' => 'Addressbooks for CardDAV attribute "addressbook-home-set".',
|
|
'values' => $addressbooks,
|
|
'xmlrpc' => True,
|
|
'admin' => False,
|
|
'default' => 'P',
|
|
);
|
|
return $settings;
|
|
}
|
|
} |