Merge pull request #4301 from MrPetovan/bug/3396-frio-fix-contact-autocomplete
[frio] Fix contact autocomplete
This commit is contained in:
commit
9853f552fb
2 changed files with 148 additions and 148 deletions
|
@ -125,7 +125,7 @@
|
||||||
|
|
||||||
{{* the following part is a nearly a copy of the part above but it is modified for working with js.
|
{{* 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 *}}
|
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}">
|
<div class="contact-wrapper media" id="contact-entry-wrapper-{$id}">
|
||||||
|
|
||||||
{{* This is a wrapper for the contact picture *}}
|
{{* 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-entry-photo mframe" id="contact-entry-photo-{$id}">
|
||||||
|
|
||||||
<div class="contact-photo-image-wrapper hidden-xs">
|
<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>
|
</div>
|
||||||
|
|
||||||
{{* For very small displays we use a drobdown menu for contact relating actions *}}
|
{{* 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">
|
<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) *}}
|
{{* use a smaller picture on very small displays (e.g. mobiles) *}}
|
||||||
<div class="contact-photo-image-wrapper visible-xs">
|
<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 *}}
|
{{* Overlay background on hover the avatar picture *}}
|
||||||
<div class="contact-photo-overlay">
|
<div class="contact-photo-overlay">
|
||||||
|
@ -242,6 +242,5 @@ We use this part to filter the contacts with jquery.textcomplete *}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</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
|
// we introduce a new search type, r should do the same query like it's
|
||||||
// done in /mod/contacts for connections
|
// done in /mod/contacts for connections
|
||||||
if ($results["type"] == "r") {
|
if ($results["type"] !== "r") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$searching = false;
|
$searching = false;
|
||||||
if ($search) {
|
if ($results["search"]) {
|
||||||
$search_hdr = $search;
|
$search_txt = dbesc(protect_sprintf(preg_quote($results["search"])));
|
||||||
$search_txt = dbesc(protect_sprintf(preg_quote($search)));
|
|
||||||
$searching = true;
|
$searching = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_extra = '';
|
$sql_extra = '';
|
||||||
if ($searching) {
|
if ($searching) {
|
||||||
$sql_extra .= " AND (`attag` LIKE '%%" . dbesc($search_txt) . "%%' OR `name` LIKE '%%" . dbesc($search_txt) . "%%' OR `nick` LIKE '%%" . dbesc($search_txt) . "%%') ";
|
$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`
|
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
||||||
WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra ",
|
WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra ", intval($_SESSION['uid']));
|
||||||
intval($_SESSION['uid']));
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$total = $r[0]["total"];
|
$total = $r[0]["total"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_extra3 = Widget::unavailableNetworks();
|
$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 ",
|
$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($_SESSION['uid']), intval($results['start']), intval($results['count'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$contacts = [];
|
$contacts = [];
|
||||||
|
@ -331,7 +333,6 @@ function frio_acl_lookup(App $a, &$results)
|
||||||
|
|
||||||
$results["items"] = $contacts;
|
$results["items"] = $contacts;
|
||||||
$results["tot"] = $total;
|
$results["tot"] = $total;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue