summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-04-11 00:04:58 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-04-11 00:04:58 +0200
commitdcca5f7bdd224f9fdd773d2a9ff8ac6f3199823a (patch)
tree500ea4b5a57400fd84d0d428da9e8f2a997451fb /core/ajax
parentd229856fc50bf09abb4679fcea3c06c7effd4dde (diff)
parent0b4d87961926d69e5f95b2a6477edb804d726b78 (diff)
downloadnextcloud-server-dcca5f7bdd224f9fdd773d2a9ff8ac6f3199823a.tar.gz
nextcloud-server-dcca5f7bdd224f9fdd773d2a9ff8ac6f3199823a.zip
Merge pull request #5857 from owncloud/type-ahead-share-by-mail-master
introduce auto completion on share email - integrated with the contactsm...
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/share.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index e667d9b5faa..2b41bd8a5da 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -205,6 +205,34 @@ 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) {
+ if (!isset($contact['EMAIL'])) {
+ continue;
+ }
+
+ $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');