rework autocomplete: add class dir and static function

This commit is contained in:
rabuzarus 2016-02-01 18:21:29 +01:00
parent 5f7c5e6ab6
commit aee94b38c1
3 changed files with 42 additions and 48 deletions

View file

@ -659,7 +659,7 @@ function acl_lookup(&$a, $out_type = 'json') {
* @brief Searching for global contacts for autocompletion * @brief Searching for global contacts for autocompletion
* *
* @param App $a * @param App $a
* @return type * @return array
*/ */
function navbar_complete(&$a) { function navbar_complete(&$a) {
@ -682,7 +682,7 @@ function navbar_complete(&$a) {
$search = substr($search,1); $search = substr($search,1);
if($localsearch) { if($localsearch) {
$x = dirsearch_global_by_name($search); $x = dir::global_search_by_name($search);
return $x; return $x;
} }

View file

@ -2,16 +2,21 @@
/** /**
* @file include/dir_fns.php * @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 * @brief Search global contact table by nick or name
* * * *
* @param string $search * @param string $search Name or nick
* @return array * @return array
*/ */
function dirsearch_global_by_name($search) { public static function global_search_by_name($search) {
if($search) { if($search) {
// check supported networks // check supported networks
@ -43,4 +48,5 @@ function dirsearch_global_by_name($search) {
return $results; return $results;
} }
}
} }

View file

@ -2,18 +2,6 @@
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$("#contacts-search").contact_autocomplete(baseurl + '/acl', 'a', true); $("#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> </script>