rework autocomplete: add class dir and static function
This commit is contained in:
parent
5f7c5e6ab6
commit
aee94b38c1
3 changed files with 42 additions and 48 deletions
|
@ -659,7 +659,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
|||
* @brief Searching for global contacts for autocompletion
|
||||
*
|
||||
* @param App $a
|
||||
* @return type
|
||||
* @return array
|
||||
*/
|
||||
function navbar_complete(&$a) {
|
||||
|
||||
|
@ -682,7 +682,7 @@ function navbar_complete(&$a) {
|
|||
$search = substr($search,1);
|
||||
|
||||
if($localsearch) {
|
||||
$x = dirsearch_global_by_name($search);
|
||||
$x = dir::global_search_by_name($search);
|
||||
return $x;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,16 +2,21 @@
|
|||
|
||||
/**
|
||||
* @file include/dir_fns.php
|
||||
* @brief Functions for directory
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief This class handels directory related functions
|
||||
*/
|
||||
class dir {
|
||||
|
||||
/**
|
||||
* @brief Search global contact table by nick or name
|
||||
* *
|
||||
* @param string $search
|
||||
* @param string $search Name or nick
|
||||
* @return array
|
||||
*/
|
||||
function dirsearch_global_by_name($search) {
|
||||
public static function global_search_by_name($search) {
|
||||
|
||||
if($search) {
|
||||
// check supported networks
|
||||
|
@ -44,3 +49,4 @@ function dirsearch_global_by_name($search) {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,18 +2,6 @@
|
|||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#contacts-search").contact_autocomplete(baseurl + '/acl', 'a', true);
|
||||
|
||||
|
||||
$("#contacts-search").keyup(function(event){
|
||||
if(event.keyCode == 13){
|
||||
$("#contacts-search").click();
|
||||
}
|
||||
});
|
||||
$(".autocomplete-w1 .selected").keyup(function(event){
|
||||
if(event.keyCode == 13){
|
||||
$("#contacts-search").click();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue