* eSync/Addressbook: new preference to force sorting on device, eg. for use with Windows Mobile, which use "own sorting" set in addressbook otherwise

This commit is contained in:
Ralf Becker 2011-08-10 14:25:23 +00:00
parent 71b4cf4e35
commit 5add35eb94

View File

@ -381,6 +381,13 @@ class addressbook_activesync implements activesync_plugin_write, activesync_plug
$message->$key = ('"'.$emailname.'"'." <$contact[$attr]>");
}
break;
case 'n_fileas':
if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-force-fileas'])
{
$message->$key = $this->addressbook->fileas($contact,$GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-force-fileas']);
break;
}
// fall through
default:
if (!empty($contact[$attr])) $message->$key = $contact[$attr];
}
@ -533,6 +540,12 @@ class addressbook_activesync implements activesync_plugin_write, activesync_plug
$contact[$attr] = $message->$key;
}
break;
case 'n_fileas': // only change fileas, if not forced on the client
if (!$GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-force-fileas'])
{
$contact[$attr] = $message->$key;
}
break;
case 'title': // as ol jobtitle mapping changed in egw from role to title, do NOT overwrite title with value of role
if ($id && $message->$key == $contact['role']) break;
// fall throught
@ -740,6 +753,8 @@ class addressbook_activesync implements activesync_plugin_write, activesync_plug
$addressbooks = $addressbook_bo->get_addressbooks(EGW_ACL_READ);
unset($addressbooks[$user]); // personal addressbook is allways synced
unset($addressbooks[$user.'p']);// private addressbook uses ID self::PRIVATE_AB
$fileas_options = array('0' => lang('use addressbooks "own sorting" attribute'))+$addressbook_bo->fileas_options();
}
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['private_addressbook'])
{
@ -785,6 +800,17 @@ class addressbook_activesync implements activesync_plugin_write, activesync_plug
'admin' => false,
'default' => '0',
);
$settings['addressbook-force-fileas'] = array(
'type' => 'select',
'label' => 'Force sorting on device to',
'name' => 'addressbook-force-fileas',
'help' => 'Some devices (eg. Windows Mobil, but not iOS) sort by addressbooks "own sorting" attribute, which might not be what you want on the device. With this setting you can force the device to use a different sorting for all contacts, without changing it in addressbook.',
'values' => $fileas_options,
'xmlrpc' => true,
'admin' => false,
'default' => '0',
);
return $settings;
}
}