affinity tool -> friend zoom; alter xchan_query to return results in hubloc_primary desc order; as hublocs have been seen in the wild with no primary

This commit is contained in:
zotlabs 2019-07-29 19:33:36 -07:00
parent c741420bb8
commit 4e87935fda
7 changed files with 20 additions and 20 deletions

View file

@ -313,7 +313,7 @@ class Apps {
static public function translate_system_apps(&$arr) {
$apps = array(
'Apps' => t('Apps'),
'Affinity Tool' => t('Affinity Tool'),
'Friend Zoom' => t('Friend Zoom'),
'Articles' => t('Articles'),
'Cards' => t('Cards'),
'Calendar' => t('Calendar'),

View file

@ -9,7 +9,7 @@ class Affinity extends \Zotlabs\Web\Controller {
function post() {
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Affinity Tool'))) {
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Friend Zoom'))) {
return;
}
@ -23,7 +23,7 @@ class Affinity extends \Zotlabs\Web\Controller {
set_pconfig(local_channel(),'affinity','cmin',0);
set_pconfig(local_channel(),'affinity','cmax',$cmax);
info( t('Affinity Tool settings updated.') . EOL);
info( t('Friend Zoom settings updated.') . EOL);
}
@ -34,11 +34,11 @@ class Affinity extends \Zotlabs\Web\Controller {
function get() {
$desc = t('This app (when installed) presents a slider control in your connection editor and also on your network page. The slider represents your degree of friendship or <em>affinity</em> with each connection. It allows you to zoom in or out and display conversations from only your closest friends or everybody in your stream.');
$desc = t('This app (when installed) presents a slider control in your connection editor and also on your network page. The slider represents your degree of friendship with each connection. It allows you to zoom in or out and display conversations from only your closest friends or everybody in your stream.');
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Affinity Tool'))) {
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Friend Zoom'))) {
return $text;
}
@ -52,7 +52,7 @@ class Affinity extends \Zotlabs\Web\Controller {
// '$field' => array('affinity_cmax', t('Default maximum affinity level'), $cmax, t('0-99 default 99'))
// ));
if(Apps::system_app_installed(local_channel(),'Affinity Tool')) {
if(Apps::system_app_installed(local_channel(),'Friend Zoom')) {
$labels = array(
0 => t('Me'),
@ -80,7 +80,7 @@ class Affinity extends \Zotlabs\Web\Controller {
}
$s .= replace_macros(get_markup_template('generic_app_settings.tpl'), array(
'$addon' => array('affinity', '' . t('Affinity Tool Settings'), '', t('Submit')),
'$addon' => array('affinity', '' . t('Friend Zoom Settings'), '', t('Submit')),
'$content' => $setting_fields
));

View file

@ -637,13 +637,13 @@ class Connedit extends Controller {
$tpl = get_markup_template("abook_edit.tpl");
if(Apps::system_app_installed(local_channel(),'Affinity Tool')) {
if(Apps::system_app_installed(local_channel(),'Friend Zoom')) {
$sections['affinity'] = [
'label' => t('Affinity'),
'label' => t('Friend Zoom'),
'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/?f=&section=affinity',
'sel' => '',
'title' => t('Open Set Affinity section by default'),
'title' => t('Open Friend Zoom section by default'),
];
$labels = [
@ -714,13 +714,13 @@ class Connedit extends Controller {
$multiprofs = ((feature_enabled(local_channel(),'multi_profiles')) ? true : false);
if($slide && !$multiprofs)
$affinity = t('Set Affinity');
$affinity = t('Set Friend Zoom');
if(!$slide && $multiprofs)
$affinity = t('Set Profile');
if($slide && $multiprofs)
$affinity = t('Set Affinity & Profile');
$affinity = t('Set Friend Zoom & Profile');
$theirs = get_abconfig(local_channel(),$contact['abook_xchan'],'system','their_perms',EMPTY_STR);

View file

@ -122,8 +122,8 @@ class Network extends Controller {
$def_acl = [ 'allow_gid' => '<' . $r[0]['hash'] . '>' ];
}
$default_cmin = ((Apps::system_app_installed(local_channel(),'Affinity Tool')) ? get_pconfig(local_channel(),'affinity','cmin',0) : (-1));
$default_cmax = ((Apps::system_app_installed(local_channel(),'Affinity Tool')) ? get_pconfig(local_channel(),'affinity','cmax',99) : (-1));
$default_cmin = ((Apps::system_app_installed(local_channel(),'Friend Zoom')) ? get_pconfig(local_channel(),'affinity','cmin',0) : (-1));
$default_cmax = ((Apps::system_app_installed(local_channel(),'Friend Zoom')) ? get_pconfig(local_channel(),'affinity','cmax',99) : (-1));
$cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
$star = ((x($_GET,'star')) ? intval($_GET['star']) : 0);

View file

@ -11,14 +11,14 @@ class Affinity {
if(! local_channel())
return '';
$default_cmin = ((Apps::system_app_installed(local_channel(),'Affinity Tool')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0);
$default_cmax = ((Apps::system_app_installed(local_channel(),'Affinity Tool')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99);
$default_cmin = ((Apps::system_app_installed(local_channel(),'Friend Zoom')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0);
$default_cmax = ((Apps::system_app_installed(local_channel(),'Friend Zoom')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99);
$cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : $default_cmin);
$cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : $default_cmax);
if(Apps::system_app_installed(local_channel(),'Affinity Tool')) {
if(Apps::system_app_installed(local_channel(),'Friend Zoom')) {
$labels = array(
0 => t('Me'),

View file

@ -1,6 +1,6 @@
version: 1
url: $baseurl/affinity
requires: local_channel
name: Affinity Tool
name: Friend Zoom
photo: icon:arrows-h
categories: Networking

View file

@ -2120,13 +2120,13 @@ function xchan_query(&$items, $abook = true, $effective_uid = 0) {
if(count($arr)) {
if($abook) {
$chans = q("select * from xchan left join hubloc on hubloc_hash = xchan_hash left join abook on abook_xchan = xchan_hash and abook_channel = %d
where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_primary = 1",
where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") order by hubloc_primary desc",
intval($item['uid'])
);
}
else {
$chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash
where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_primary = 1");
where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") order by hubloc_primary desc");
}
$xchans = q("select * from xchan where xchan_hash in (" . protect_sprintf(implode(',',$arr)) . ") and xchan_network in ('rss','unknown', 'anon')");
if(! $chans)