2010-10-20 01:30:16 +02:00
|
|
|
<?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
|
2010-10-31 08:57:25 +01:00
|
|
|
*
|
2010-10-20 01:30:16 +02:00
|
|
|
* @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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-31 08:57:25 +01:00
|
|
|
|
2010-10-20 01:30:16 +02:00
|
|
|
/**
|
|
|
|
* 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;
|
2010-10-31 08:57:25 +01:00
|
|
|
|
2010-10-20 01:30:16 +02:00
|
|
|
// rewriting owner=0 to 'U', as 0 get's always selected by prefs
|
|
|
|
if (!isset($addressbooks[0]))
|
|
|
|
{
|
|
|
|
unset($addressbooks['U']);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
unset($addressbooks[0]);
|
|
|
|
}
|
|
|
|
|
2010-10-31 08:57:25 +01:00
|
|
|
$settings['addressbook-home-set'] = array(
|
2010-10-20 01:30:16 +02:00
|
|
|
'type' => 'multiselect',
|
|
|
|
'label' => 'Addressbooks to sync with Apple clients',
|
|
|
|
'name' => 'addressbook-home-set',
|
* CardDAV pref which addressbooks to sync and many fixes for iPhone OS 4.0, 4.1, 4.2beta and Mac iCal and contact app
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
2010-10-21 13:17:46 +02:00
|
|
|
'help' => 'Addressbooks for CardDAV attribute "addressbook-home-set".',
|
2010-10-20 01:30:16 +02:00
|
|
|
'values' => $addressbooks,
|
|
|
|
'xmlrpc' => True,
|
|
|
|
'admin' => False,
|
|
|
|
'default' => 'P',
|
|
|
|
);
|
2010-10-31 08:57:25 +01:00
|
|
|
|
|
|
|
$settings['debug_level'] = array(
|
|
|
|
'type' => 'select',
|
|
|
|
'label' => 'Debug level for Apache/PHP error-log',
|
|
|
|
'name' => 'debug_level',
|
|
|
|
'help' => 'Enables debug-messages to Apache/PHP error-log, allowing to diagnose problems on a per user basis.',
|
|
|
|
'values' => array(
|
|
|
|
'0' => '0 - off',
|
|
|
|
'1' => '1 - function calls',
|
|
|
|
'2' => '2 - more info',
|
|
|
|
'3' => '3 - complete $_SERVER array',
|
|
|
|
),
|
|
|
|
'xmlrpc' => true,
|
|
|
|
'admin' => false,
|
|
|
|
'default' => '0',
|
|
|
|
);
|
2010-10-20 01:30:16 +02:00
|
|
|
return $settings;
|
|
|
|
}
|
|
|
|
}
|