summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax/userautocomplete.php
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-08-09 10:34:00 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-08-09 10:34:00 -0400
commitcdf2dbcd523e99c3c147d29a410c9734020bb5dd (patch)
tree2085cd0beec45aa5e92fe0793c65eae5475b1043 /apps/files_sharing/ajax/userautocomplete.php
parent23c8d7b3fb316daa7c70552ed47e63e9bbcd300f (diff)
downloadnextcloud-server-cdf2dbcd523e99c3c147d29a410c9734020bb5dd.tar.gz
nextcloud-server-cdf2dbcd523e99c3c147d29a410c9734020bb5dd.zip
Use chosen select form for selecting users in sharing drop down
Diffstat (limited to 'apps/files_sharing/ajax/userautocomplete.php')
-rw-r--r--apps/files_sharing/ajax/userautocomplete.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php
index 816e01ba9ee..c6519cc6b50 100644
--- a/apps/files_sharing/ajax/userautocomplete.php
+++ b/apps/files_sharing/ajax/userautocomplete.php
@@ -7,23 +7,22 @@ if (!OC_User::isLoggedIn()) {
echo json_encode(array("status" => "error", "data" => array("message" => "Authentication error")));
exit();
}
-$query = $_GET['term'];
-$length = strlen($query);
-$query = strtolower($query);
$users = array();
$ocusers = OC_User::getUsers();
$self = OC_User::getUser();
$groups = OC_GROUP::getUserGroups($self);
+$users[] = "<optgroup label='Users'>";
foreach ($ocusers as $user) {
- if ($user != $self && substr(strtolower($user), 0, $length) == $query) {
- $users[] = (object)array('id' => $user, 'label' => $user, 'name' => $user);
+ if ($user != $self) {
+ $users[] = "<option value='".$user."'>".$user."</option>";
}
}
+$users[] = "</optgroup>";
+$users[] = "<optgroup label='Groups'>";
foreach ($groups as $group) {
- if (substr(strtolower($group), 0, $length) == $query) {
- $users[] = (object)array('id' => $group, 'label' => $group, 'name' => $group);
- }
+ $users[] = "<option value='".$group."'>".$group."</option>";
}
+$users[] = "</optgroup>";
echo json_encode($users);
?>