diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-11-14 09:38:55 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-11-14 09:38:55 +0100 |
commit | d4c0ac779034a47d4fc8a56e0a96a7d84170e03c (patch) | |
tree | 1dff93f90fa3264f02c6f15934b469afc6b79533 /core/ajax | |
parent | 8d0d0836bae968d3abff5f5ff9db230d449397a6 (diff) | |
download | nextcloud-server-d4c0ac779034a47d4fc8a56e0a96a7d84170e03c.tar.gz nextcloud-server-d4c0ac779034a47d4fc8a56e0a96a7d84170e03c.zip |
introduce auto completion on share email - integrated with the contactsmanager api
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/share.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index be02c056357..6bac2867c48 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -261,6 +261,30 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo OC_JSON::success(array('data' => array('reshare' => $reshare, 'shares' => $shares))); } break; + case 'getShareWithEmail': + $result = array(); + if (isset($_GET['search'])) { + $cm = OC::$server->getContactsManager(); + if (!is_null($cm) && $cm->isEnabled()) { + $contacts = $cm->search($_GET['search'], array('FN', 'EMAIL')); + foreach ($contacts as $contact) { + $emails = $contact['EMAIL']; + if (!is_array($emails)) { + $emails = array($emails); + } + + foreach($emails as $email) { + $result[] = array( + 'id' => $contact['ID'], + 'email' => $email, + 'displayname' => $contact['FN'], + ); + } + } + } + } + OC_JSON::success(array('data' => $result)); + break; case 'getShareWith': if (isset($_GET['search'])) { $sharePolicy = OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global'); |