Add support for user autocomplete
This commit is contained in:
parent
17b5bcb24f
commit
4282a42b3f
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
$RUNTIME_NOAPPS = true;
|
||||||
|
|
||||||
|
require_once('../../../lib/base.php');
|
||||||
|
|
||||||
|
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();
|
||||||
|
foreach ($ocusers as $user) {
|
||||||
|
if ($user != $self && substr(strtolower($user), 0, $length) == $query) {
|
||||||
|
$users[] = (object)array('id' => $user, 'label' => $user, 'name' => $user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo json_encode($users);
|
||||||
|
|
||||||
|
?>
|
|
@ -3,6 +3,10 @@ $(document).ready(function() {
|
||||||
source: "../../files/ajax/autocomplete.php",
|
source: "../../files/ajax/autocomplete.php",
|
||||||
minLength: 1
|
minLength: 1
|
||||||
});
|
});
|
||||||
|
$( "#uid_shared_with" ).autocomplete({
|
||||||
|
source: "ajax/userautocomplete.php",
|
||||||
|
minLength: 1
|
||||||
|
});
|
||||||
$("button.delete").live('click', function( event ) {
|
$("button.delete").live('click', function( event ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
// var row=$(this);
|
// var row=$(this);
|
||||||
|
|
Loading…
Reference in New Issue