Merge pull request #4301 from MrPetovan/bug/3396-frio-fix-contact-autocomplete
[frio] Fix contact autocomplete
This commit is contained in:
commit
9853f552fb
|
@ -125,7 +125,7 @@
|
|||
|
||||
{{* the following part is a nearly a copy of the part above but it is modified for working with js.
|
||||
We use this part to filter the contacts with jquery.textcomplete *}}
|
||||
<div class="javascript-template" rel="contact-template" style="display: none">
|
||||
<template class="javascript-template" rel="contact-template" style="display: none">
|
||||
<div class="contact-wrapper media" id="contact-entry-wrapper-{$id}">
|
||||
|
||||
{{* This is a wrapper for the contact picture *}}
|
||||
|
@ -133,14 +133,14 @@ We use this part to filter the contacts with jquery.textcomplete *}}
|
|||
<div class="contact-entry-photo mframe" id="contact-entry-photo-{$id}">
|
||||
|
||||
<div class="contact-photo-image-wrapper hidden-xs">
|
||||
<img class="contact-photo media-object xl" src="{{$contact.thumb}}" {11} alt="{{$contact.name}}" />
|
||||
<img class="contact-photo media-object xl" src="{$thumb}" {11} alt="{$name}" />
|
||||
</div>
|
||||
|
||||
{{* For very small displays we use a drobdown menu for contact relating actions *}}
|
||||
<button type="button" class="btn btn-link dropdown-toggle visible-xs" id="contact-photo-menu-button{$id}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{* use a smaller picture on very small displays (e.g. mobiles) *}}
|
||||
<div class="contact-photo-image-wrapper visible-xs">
|
||||
<img class="contact-photo-xs media-object" src="{{$contact.thumb}}" {11} alt="{{$contact.name}}" />
|
||||
<img class="contact-photo-xs media-object" src="{$thumb}" {11} alt="{$name}" />
|
||||
|
||||
{{* Overlay background on hover the avatar picture *}}
|
||||
<div class="contact-photo-overlay">
|
||||
|
@ -242,6 +242,5 @@ We use this part to filter the contacts with jquery.textcomplete *}}
|
|||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -292,13 +292,16 @@ function frio_acl_lookup(App $a, &$results)
|
|||
|
||||
// we introduce a new search type, r should do the same query like it's
|
||||
// done in /mod/contacts for connections
|
||||
if ($results["type"] == "r") {
|
||||
if ($results["type"] !== "r") {
|
||||
return;
|
||||
}
|
||||
|
||||
$searching = false;
|
||||
if ($search) {
|
||||
$search_hdr = $search;
|
||||
$search_txt = dbesc(protect_sprintf(preg_quote($search)));
|
||||
if ($results["search"]) {
|
||||
$search_txt = dbesc(protect_sprintf(preg_quote($results["search"])));
|
||||
$searching = true;
|
||||
}
|
||||
|
||||
$sql_extra = '';
|
||||
if ($searching) {
|
||||
$sql_extra .= " AND (`attag` LIKE '%%" . dbesc($search_txt) . "%%' OR `name` LIKE '%%" . dbesc($search_txt) . "%%' OR `nick` LIKE '%%" . dbesc($search_txt) . "%%') ";
|
||||
|
@ -309,16 +312,15 @@ function frio_acl_lookup(App $a, &$results)
|
|||
}
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
||||
WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra ",
|
||||
intval($_SESSION['uid']));
|
||||
WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra ", intval($_SESSION['uid']));
|
||||
if (DBM::is_result($r)) {
|
||||
$total = $r[0]["total"];
|
||||
}
|
||||
|
||||
$sql_extra3 = Widget::unavailableNetworks();
|
||||
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra $sql_extra3 ORDER BY `name` ASC LIMIT 100 ",
|
||||
intval($_SESSION['uid'])
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra $sql_extra3 ORDER BY `name` ASC LIMIT %d, %d ",
|
||||
intval($_SESSION['uid']), intval($results['start']), intval($results['count'])
|
||||
);
|
||||
|
||||
$contacts = [];
|
||||
|
@ -331,7 +333,6 @@ function frio_acl_lookup(App $a, &$results)
|
|||
|
||||
$results["items"] = $contacts;
|
||||
$results["tot"] = $total;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue