From 858279ad84b3b7981eed05911c6dd41b38c4585d Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 10 Aug 2011 14:24:30 +0000 Subject: [PATCH] * eSync/Addressbook: new preference to force sorting on device, eg. for use with Windows Mobile, which use "own sorting" set in addressbook otherwise --- .../inc/class.addressbook_activesync.inc.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/addressbook/inc/class.addressbook_activesync.inc.php b/addressbook/inc/class.addressbook_activesync.inc.php index 2c67e03dda..ae99da7520 100644 --- a/addressbook/inc/class.addressbook_activesync.inc.php +++ b/addressbook/inc/class.addressbook_activesync.inc.php @@ -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; } }