mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
moved global address list search to addressbook plugin, made all other searches interfaces too, thought no pluging yet implements them
This commit is contained in:
parent
c1f326206a
commit
517a99ce27
@ -15,7 +15,7 @@
|
|||||||
/**
|
/**
|
||||||
* Addressbook activesync plugin
|
* Addressbook activesync plugin
|
||||||
*/
|
*/
|
||||||
class addressbook_activesync implements activesync_plugin_write
|
class addressbook_activesync implements activesync_plugin_write, activesync_plugin_search_gal
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var BackendEGW
|
* @var BackendEGW
|
||||||
@ -29,15 +29,20 @@ class addressbook_activesync implements activesync_plugin_write
|
|||||||
*/
|
*/
|
||||||
private $addressbook;
|
private $addressbook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapping of ActiveSync SyncContact attributes to EGroupware contact array-keys
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
static public $mapping = array(
|
static public $mapping = array(
|
||||||
'anniversary' => '',
|
//'anniversary' => '',
|
||||||
'assistantname' => 'assistent',
|
'assistantname' => 'assistent',
|
||||||
'assistnamephonenumber' => 'tel_assistent',
|
'assistnamephonenumber' => 'tel_assistent',
|
||||||
'birthday' => 'bday',
|
'birthday' => 'bday',
|
||||||
'body' => 'note',
|
'body' => 'note',
|
||||||
'bodysize' => '',
|
//'bodysize' => '',
|
||||||
'bodytruncated' => '',
|
//'bodytruncated' => '',
|
||||||
'business2phonenumber' => '',
|
//'business2phonenumber' => '',
|
||||||
'businesscity' => 'adr_one_locality',
|
'businesscity' => 'adr_one_locality',
|
||||||
'businesscountry' => 'adr_one_countryname',
|
'businesscountry' => 'adr_one_countryname',
|
||||||
'businesspostalcode' => 'adr_one_postalcode',
|
'businesspostalcode' => 'adr_one_postalcode',
|
||||||
@ -47,15 +52,15 @@ class addressbook_activesync implements activesync_plugin_write
|
|||||||
'businessphonenumber' => 'tel_work',
|
'businessphonenumber' => 'tel_work',
|
||||||
'carphonenumber' => 'tel_car',
|
'carphonenumber' => 'tel_car',
|
||||||
'categories' => 'cat_id',
|
'categories' => 'cat_id',
|
||||||
'children' => '',
|
//'children' => '',
|
||||||
'companyname' => 'org_name',
|
'companyname' => 'org_name',
|
||||||
'department' => 'org_unit',
|
'department' => 'org_unit',
|
||||||
'email1address' => 'email',
|
'email1address' => 'email',
|
||||||
'email2address' => 'email_home',
|
'email2address' => 'email_home',
|
||||||
'email3address' => '',
|
//'email3address' => '',
|
||||||
'fileas' => 'n_fileas',
|
'fileas' => 'n_fileas',
|
||||||
'firstname' => 'n_given',
|
'firstname' => 'n_given',
|
||||||
'home2phonenumber' => '',
|
//'home2phonenumber' => '',
|
||||||
'homecity' => 'adr_two_locality',
|
'homecity' => 'adr_two_locality',
|
||||||
'homecountry' => 'adr_two_countryname',
|
'homecountry' => 'adr_two_countryname',
|
||||||
'homepostalcode' => 'adr_two_postalcode',
|
'homepostalcode' => 'adr_two_postalcode',
|
||||||
@ -68,24 +73,24 @@ class addressbook_activesync implements activesync_plugin_write
|
|||||||
'middlename' => 'n_middle',
|
'middlename' => 'n_middle',
|
||||||
'mobilephonenumber' => 'tel_cell',
|
'mobilephonenumber' => 'tel_cell',
|
||||||
'officelocation' => 'room',
|
'officelocation' => 'room',
|
||||||
'othercity' => '',
|
//'othercity' => '',
|
||||||
'othercountry' => '',
|
//'othercountry' => '',
|
||||||
'otherpostalcode' => '',
|
//'otherpostalcode' => '',
|
||||||
'otherstate' => '',
|
//'otherstate' => '',
|
||||||
'otherstreet' => '',
|
//'otherstreet' => '',
|
||||||
'pagernumber' => 'tel_pager',
|
'pagernumber' => 'tel_pager',
|
||||||
'radiophonenumber' => '',
|
//'radiophonenumber' => '',
|
||||||
'spouse' => '',
|
//'spouse' => '',
|
||||||
'suffix' => 'n_suffix',
|
'suffix' => 'n_suffix',
|
||||||
'title' => 'title', // @TODO: check if n_prefix
|
'title' => 'title', // @TODO: check if n_prefix
|
||||||
'webpage' => 'url',
|
'webpage' => 'url',
|
||||||
'yomicompanyname' => '',
|
//'yomicompanyname' => '',
|
||||||
'yomifirstname' => '',
|
//'yomifirstname' => '',
|
||||||
'yomilastname' => '',
|
//'yomilastname' => '',
|
||||||
'rtf' => '',
|
//'rtf' => '',
|
||||||
'picture' => 'jpegphoto',
|
'picture' => 'jpegphoto',
|
||||||
'nickname' => '',
|
//'nickname' => '',
|
||||||
'airsyncbasebody' => '',
|
//'airsyncbasebody' => '',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,6 +146,7 @@ class addressbook_activesync implements activesync_plugin_write
|
|||||||
'parent'=> '0',
|
'parent'=> '0',
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
debugLog(__METHOD__."() returning ".array2string($folderlist));
|
||||||
//error_log(__METHOD__."() returning ".array2string($folderlist));
|
//error_log(__METHOD__."() returning ".array2string($folderlist));
|
||||||
return $folderlist;
|
return $folderlist;
|
||||||
}
|
}
|
||||||
@ -187,7 +193,6 @@ class addressbook_activesync implements activesync_plugin_write
|
|||||||
*/
|
*/
|
||||||
public function StatFolder($id)
|
public function StatFolder($id)
|
||||||
{
|
{
|
||||||
$folder = $this->GetFolder($id);
|
|
||||||
$this->backend->splitID($id, $type, $owner);
|
$this->backend->splitID($id, $type, $owner);
|
||||||
|
|
||||||
$stat = array(
|
$stat = array(
|
||||||
@ -196,6 +201,7 @@ class addressbook_activesync implements activesync_plugin_write
|
|||||||
'parent' => '0',
|
'parent' => '0',
|
||||||
);
|
);
|
||||||
//error_log(__METHOD__."('$id') returning ".array2string($stat));
|
//error_log(__METHOD__."('$id') returning ".array2string($stat));
|
||||||
|
debugLog(__METHOD__."('$id') returning ".array2string($stat));
|
||||||
return $stat;
|
return $stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +228,7 @@ class addressbook_activesync implements activesync_plugin_write
|
|||||||
$filter = array('owner' => $user);
|
$filter = array('owner' => $user);
|
||||||
|
|
||||||
$messagelist = array();
|
$messagelist = array();
|
||||||
if (($contacts =& $this->addressbook->search($criteria,$only_keys=false,$order_by='',$extra_cols='',$wildcard='',
|
if (($contacts =& $this->addressbook->search($criteria,'contact_id,contact_etag',$order_by='',$extra_cols='',$wildcard='',
|
||||||
$empty=false,$op='AND',$start=false,$filter)))
|
$empty=false,$op='AND',$start=false,$filter)))
|
||||||
{
|
{
|
||||||
foreach($contacts as $contact)
|
foreach($contacts as $contact)
|
||||||
@ -530,4 +536,41 @@ class addressbook_activesync implements activesync_plugin_write
|
|||||||
//error_log(__METHOD__."('$folderid','$syncstate_was') syncstate='$syncstate' returning ".array2string($changes));
|
//error_log(__METHOD__."('$folderid','$syncstate_was') syncstate='$syncstate' returning ".array2string($changes));
|
||||||
return $changes;
|
return $changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search global address list for a given pattern
|
||||||
|
*
|
||||||
|
* @param string $searchquery
|
||||||
|
* @return array with just rows (no values for keys rows, status or global_search_status!)
|
||||||
|
* @todo search range not verified, limits might be a good idea
|
||||||
|
*/
|
||||||
|
function getSearchResultsGAL($searchquery)
|
||||||
|
{
|
||||||
|
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
|
||||||
|
|
||||||
|
$items = array();
|
||||||
|
if (($contacts =& $this->addressbook->search($searchquery, false, false, '', '%', false, 'OR')))
|
||||||
|
{
|
||||||
|
foreach($contacts as $contact)
|
||||||
|
{
|
||||||
|
$item['username'] = $contact['n_family'];
|
||||||
|
$item['fullname'] = $contact['n_fn'];
|
||||||
|
if (!trim($item['fullname'])) $item['fullname'] = $item['username'];
|
||||||
|
$item['emailaddress'] = $contact['email'] ? $contact['email'] : (string)$contact['email_private'] ;
|
||||||
|
$item['nameid'] = $searchquery;
|
||||||
|
$item['phone'] = (string)$contact['tel_work'];
|
||||||
|
$item['homephone'] = (string)$contact['tel_home'];
|
||||||
|
$item['mobilephone'] = (string)$contact['tel_cell'];
|
||||||
|
$item['company'] = (string)$contact['org_name'];
|
||||||
|
$item['office'] = $contact['room'];
|
||||||
|
$item['title'] = $contact['title'];
|
||||||
|
|
||||||
|
//do not return users without email
|
||||||
|
if (!trim($item['emailaddress'])) continue;
|
||||||
|
|
||||||
|
$items[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1329,7 +1329,7 @@ class addressbook_bo extends addressbook_so
|
|||||||
}
|
}
|
||||||
$filter = (array)$options['filter'];
|
$filter = (array)$options['filter'];
|
||||||
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) $filter['account_id'] = null;
|
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) $filter['account_id'] = null;
|
||||||
if (($contacts = parent::search($criteria,false,'org_name,n_family,n_given,cat_id,contact_email','','%',false,'OR', $limit, $filter)))
|
if (($contacts =& parent::search($criteria,false,'org_name,n_family,n_given,cat_id,contact_email','','%',false,'OR', $limit, $filter)))
|
||||||
{
|
{
|
||||||
foreach($contacts as $contact)
|
foreach($contacts as $contact)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user