rework autocomplete: some styling if contact is forum
This commit is contained in:
parent
aff775e55c
commit
ad5be2901e
|
@ -509,7 +509,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
||||||
|
|
||||||
if ($type==''){
|
if ($type==''){
|
||||||
|
|
||||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum` FROM `contact`
|
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum`, `prv` FROM `contact`
|
||||||
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
|
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
|
||||||
AND NOT (`network` IN ('%s', '%s'))
|
AND NOT (`network` IN ('%s', '%s'))
|
||||||
$sql_extra2
|
$sql_extra2
|
||||||
|
@ -520,7 +520,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
||||||
}
|
}
|
||||||
elseif ($type=='c'){
|
elseif ($type=='c'){
|
||||||
|
|
||||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum` FROM `contact`
|
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum`, `prv` FROM `contact`
|
||||||
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
|
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != ''
|
||||||
AND NOT (`network` IN ('%s'))
|
AND NOT (`network` IN ('%s'))
|
||||||
$sql_extra2
|
$sql_extra2
|
||||||
|
@ -542,7 +542,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
elseif($type == 'a') {
|
elseif($type == 'a') {
|
||||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
|
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum`, `prv` FROM `contact`
|
||||||
WHERE `uid` = %d AND `pending` = 0
|
WHERE `uid` = %d AND `pending` = 0
|
||||||
$sql_extra2
|
$sql_extra2
|
||||||
ORDER BY `name` ASC ",
|
ORDER BY `name` ASC ",
|
||||||
|
@ -559,6 +559,9 @@ function acl_lookup(&$a, $out_type = 'json') {
|
||||||
"photo" => $g['photo'],
|
"photo" => $g['photo'],
|
||||||
"name" => $g['name'],
|
"name" => $g['name'],
|
||||||
"nick" => (x($g['addr']) ? $g['addr'] : $g['url']),
|
"nick" => (x($g['addr']) ? $g['addr'] : $g['url']),
|
||||||
|
"network" => $g['network'],
|
||||||
|
"link" => $g['url'],
|
||||||
|
"forum" => (x($g['community']) ? 1 : 0),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,7 +587,7 @@ function acl_lookup(&$a, $out_type = 'json') {
|
||||||
"network" => $g['network'],
|
"network" => $g['network'],
|
||||||
"link" => $g['url'],
|
"link" => $g['url'],
|
||||||
"nick" => htmlentities(($g['attag']) ? $g['attag'] : $g['nick']),
|
"nick" => htmlentities(($g['attag']) ? $g['attag'] : $g['nick']),
|
||||||
"forum" => $g['forum']
|
"forum" => ((x($g['forum']) || x($g['prv'])) ? 1 : 0),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class dir {
|
||||||
$extra_sql = "";
|
$extra_sql = "";
|
||||||
|
|
||||||
$results = q("SELECT `contact`.`id` AS `cid`, `gcontact`.`url`, `gcontact`.`name`, `gcontact`.`nick`, `gcontact`.`photo`,
|
$results = q("SELECT `contact`.`id` AS `cid`, `gcontact`.`url`, `gcontact`.`name`, `gcontact`.`nick`, `gcontact`.`photo`,
|
||||||
`gcontact`.`network`, `gcontact`.`keywords`, `gcontact`.`addr`
|
`gcontact`.`network`, `gcontact`.`keywords`, `gcontact`.`addr`, `gcontact`.`community`
|
||||||
FROM `gcontact`
|
FROM `gcontact`
|
||||||
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
|
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl`
|
||||||
AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
|
AND `contact`.`uid` = %d AND NOT `contact`.`blocked`
|
||||||
|
|
|
@ -24,7 +24,7 @@ function contact_search(term, callback, backend_url, type, mode) {
|
||||||
if(lterm.indexOf(t) >= 0) { // A more broad search has been performed already, so use those results
|
if(lterm.indexOf(t) >= 0) { // A more broad search has been performed already, so use those results
|
||||||
// Filter old results locally
|
// Filter old results locally
|
||||||
var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because groups don't have one
|
var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because groups don't have one
|
||||||
matching.unshift({taggable:false, text: term, replace: term});
|
matching.unshift({forum:false, text: term, replace: term});
|
||||||
setTimeout(function() { callback(matching); } , 1); // Use "pseudo-thread" to avoid some problems
|
setTimeout(function() { callback(matching); } , 1); // Use "pseudo-thread" to avoid some problems
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -68,9 +68,10 @@ function contact_format(item) {
|
||||||
// Show contact information if not explicitly told to show something else
|
// Show contact information if not explicitly told to show something else
|
||||||
if(typeof item.text === 'undefined') {
|
if(typeof item.text === 'undefined') {
|
||||||
var desc = ((item.label) ? item.nick + ' ' + item.label : item.nick);
|
var desc = ((item.label) ? item.nick + ' ' + item.label : item.nick);
|
||||||
|
var forum = ((item.forum) ? 'forum' : '');
|
||||||
if(typeof desc === 'undefined') desc = '';
|
if(typeof desc === 'undefined') desc = '';
|
||||||
if(desc) desc = ' ('+desc+')';
|
if(desc) desc = ' ('+desc+')';
|
||||||
return "<div class='{0}' title='{4}'><img class='acpopup-img' src='{1}'><span class='acpopup-contactname'>{2}</span><span class='acpopup-sub-text'>{3}</span><div class='clear'></div></div>".format(item.taggable, item.photo, item.name, desc, item.link);
|
return "<div class='{0}' title='{4}'><img class='acpopup-img' src='{1}'><span class='acpopup-contactname'>{2}</span><span class='acpopup-sub-text'>{3}</span><div class='clear'></div></div>".format(forum, item.photo, item.name, desc, item.link);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return "<div>" + item.text + "</div>";
|
return "<div>" + item.text + "</div>";
|
||||||
|
|
|
@ -935,8 +935,19 @@ nav .acpopup {
|
||||||
color: #737373;
|
color: #737373;
|
||||||
}
|
}
|
||||||
.textcomplete-item a:hover {
|
.textcomplete-item a:hover {
|
||||||
|
color: #000;
|
||||||
padding: 3px 20px;
|
padding: 3px 20px;
|
||||||
}
|
}
|
||||||
|
.textcomplete-item a .forum, .forum .acpopup-sub-text {
|
||||||
|
color: #36C;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
.textcomplete-item a .forum:hover {
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
img.acpopup-img {
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
#nav-notifications-menu {
|
#nav-notifications-menu {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user