rework autocomplete: add class dir and static function
This commit is contained in:
parent
12479fb478
commit
341a22800d
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
|
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
@ -44,3 +49,4 @@ function dirsearch_global_by_name($search) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue