Merge pull request #3597 from annando/1707-acl-separator
In the acl there is now a separation between groups, forums and contacts
This commit is contained in:
commit
152eec4f2f
2 changed files with 32 additions and 12 deletions
|
@ -473,6 +473,7 @@ function acl_lookup(App $a, $out_type = 'json') {
|
||||||
$r = q("SELECT COUNT(*) AS c FROM `contact`
|
$r = q("SELECT COUNT(*) AS c FROM `contact`
|
||||||
WHERE `uid` = %d AND NOT `self`
|
WHERE `uid` = %d AND NOT `self`
|
||||||
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
||||||
|
AND `success_update` >= `failure_update`
|
||||||
AND `notify` != '' $sql_extra2" ,
|
AND `notify` != '' $sql_extra2" ,
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
@ -485,6 +486,7 @@ function acl_lookup(App $a, $out_type = 'json') {
|
||||||
$r = q("SELECT COUNT(*) AS c FROM `contact`
|
$r = q("SELECT COUNT(*) AS c FROM `contact`
|
||||||
WHERE `uid` = %d AND NOT `self`
|
WHERE `uid` = %d AND NOT `self`
|
||||||
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
||||||
|
AND `success_update` >= `failure_update`
|
||||||
AND `network` IN ('%s','%s','%s') $sql_extra2" ,
|
AND `network` IN ('%s','%s','%s') $sql_extra2" ,
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
dbesc(NETWORK_DFRN),
|
dbesc(NETWORK_DFRN),
|
||||||
|
@ -544,22 +546,25 @@ function acl_lookup(App $a, $out_type = 'json') {
|
||||||
"forum" => '0'
|
"forum" => '0'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (count($groups) > 0) {
|
||||||
|
$groups[] = array("separator" => true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == '') {
|
if ($type == '') {
|
||||||
|
|
||||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
|
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv`, (`prv` OR `forum`) AS `frm` FROM `contact`
|
||||||
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
||||||
AND NOT (`network` IN ('%s', '%s'))
|
AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s', '%s'))
|
||||||
$sql_extra2
|
$sql_extra2
|
||||||
ORDER BY `name` ASC ",
|
ORDER BY `frm` DESC, `name` ASC ",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_STATUSNET)
|
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_STATUSNET)
|
||||||
);
|
);
|
||||||
} elseif ($type == 'c') {
|
} elseif ($type == 'c') {
|
||||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
|
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
|
||||||
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
||||||
AND NOT (`network` IN ('%s'))
|
AND `success_update` >= `failure_update` AND NOT (`network` IN ('%s'))
|
||||||
$sql_extra2
|
$sql_extra2
|
||||||
ORDER BY `name` ASC ",
|
ORDER BY `name` ASC ",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
|
@ -569,7 +574,7 @@ function acl_lookup(App $a, $out_type = 'json') {
|
||||||
elseif ($type == 'm') {
|
elseif ($type == 'm') {
|
||||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
|
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
|
||||||
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
||||||
AND `network` IN ('%s','%s','%s')
|
AND `success_update` >= `failure_update` AND `network` IN ('%s','%s','%s')
|
||||||
$sql_extra2
|
$sql_extra2
|
||||||
ORDER BY `name` ASC ",
|
ORDER BY `name` ASC ",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
|
@ -579,7 +584,7 @@ function acl_lookup(App $a, $out_type = 'json') {
|
||||||
);
|
);
|
||||||
} elseif ($type == 'a') {
|
} elseif ($type == 'a') {
|
||||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
|
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr`, `forum`, `prv` FROM `contact`
|
||||||
WHERE `uid` = %d AND `pending` = 0
|
WHERE `uid` = %d AND `pending` = 0 AND `success_update` >= `failure_update`
|
||||||
$sql_extra2
|
$sql_extra2
|
||||||
ORDER BY `name` ASC ",
|
ORDER BY `name` ASC ",
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
|
@ -613,8 +618,9 @@ function acl_lookup(App $a, $out_type = 'json') {
|
||||||
|
|
||||||
|
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
|
$forums = array();
|
||||||
foreach ($r as $g) {
|
foreach ($r as $g) {
|
||||||
$contacts[] = array(
|
$entry = array(
|
||||||
'type' => 'c',
|
'type' => 'c',
|
||||||
'photo' => proxy_url($g['micro'], false, PROXY_SIZE_MICRO),
|
'photo' => proxy_url($g['micro'], false, PROXY_SIZE_MICRO),
|
||||||
'name' => htmlentities($g['name']),
|
'name' => htmlentities($g['name']),
|
||||||
|
@ -625,6 +631,15 @@ function acl_lookup(App $a, $out_type = 'json') {
|
||||||
'addr' => htmlentities(($g['addr']) ? $g['addr'] : $g['url']),
|
'addr' => htmlentities(($g['addr']) ? $g['addr'] : $g['url']),
|
||||||
'forum' => ((x($g, 'forum') || x($g, 'prv')) ? 1 : 0),
|
'forum' => ((x($g, 'forum') || x($g, 'prv')) ? 1 : 0),
|
||||||
);
|
);
|
||||||
|
if ($entry['forum']) {
|
||||||
|
$forums[] = $entry;
|
||||||
|
} else {
|
||||||
|
$contacts[] = $entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($forums) > 0) {
|
||||||
|
$forums[] = array("separator" => true);
|
||||||
|
$contacts = array_merge($forums, $contacts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
js/acl.js
15
js/acl.js
|
@ -286,11 +286,16 @@ ACL.prototype.populate = function(data){
|
||||||
var height = Math.ceil(data.tot / this.nw) * 42;
|
var height = Math.ceil(data.tot / this.nw) * 42;
|
||||||
this.list_content.height(height);
|
this.list_content.height(height);
|
||||||
this.data = {};
|
this.data = {};
|
||||||
$(data.items).each(function(index, item){
|
$(data.items).each(function(index, item) {
|
||||||
html = "<div class='acl-list-item {4} {5} type{2}' title='{6}' id='{2}{3}'>"+this.item_tpl+"</div>";
|
if (item.separator != undefined) {
|
||||||
html = html.format(item.photo, item.name, item.type, item.id, (item.forum=='1'?'forum':''), item.network, item.link);
|
html = "<hr class='clear'>";
|
||||||
if (item.uids!=undefined) this.group_uids[item.id] = item.uids;
|
} else {
|
||||||
|
html = "<div class='acl-list-item {4} {5} type{2}' title='{6}' id='{2}{3}'>"+this.item_tpl+"</div>";
|
||||||
|
html = html.format(item.photo, item.name, item.type, item.id, (item.forum=='1'?'forum':''), item.network, item.link);
|
||||||
|
if (item.uids != undefined) {
|
||||||
|
this.group_uids[item.id] = item.uids;
|
||||||
|
}
|
||||||
|
}
|
||||||
this.list_content.append(html);
|
this.list_content.append(html);
|
||||||
this.data[item.id] = item;
|
this.data[item.id] = item;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
Loading…
Reference in a new issue