mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 08:55:12 +00:00
some cleanup of mod-connections to bring it in line with the new architecture
This commit is contained in:
parent
b1042da76c
commit
d9917dc8f8
2 changed files with 34 additions and 73 deletions
|
@ -20,44 +20,24 @@ function connections_init(&$a) {
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$a->data['abook'] = $r[0];
|
$a->data['abook'] = $r[0];
|
||||||
$abook_id = $r[0]['abook_id'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$abook_id = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if($abook_id) {
|
function connections_aside(&$a) {
|
||||||
$a->page['aside'] .= vcard_from_xchan($r[0]);
|
|
||||||
}
|
if(x($a->data,'abook'))
|
||||||
|
$a->set_widget('vcard',vcard_from_xchan($a->data['abook']));
|
||||||
else
|
else
|
||||||
$a->page['aside'] .= follow_widget();
|
$a->set_widget('follow', follow_widget());
|
||||||
|
|
||||||
$a->page['aside'] .= group_side('contacts','group',false,0,$abook_id);
|
|
||||||
|
|
||||||
$a->page['aside'] .= findpeople_widget();
|
|
||||||
|
|
||||||
$base = $a->get_baseurl();
|
|
||||||
|
|
||||||
$a->page['htmlhead'] .= <<< EOT
|
|
||||||
|
|
||||||
<script>$(document).ready(function() {
|
|
||||||
var a;
|
|
||||||
a = $("#contacts-search").autocomplete({
|
|
||||||
serviceUrl: '$base/acl',
|
|
||||||
minChars: 2,
|
|
||||||
width: 350,
|
|
||||||
});
|
|
||||||
a.setOptions({ params: { type: 'a' }});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
EOT;
|
|
||||||
|
|
||||||
|
$a->set_widget('collections', group_side('connnections','group',false,0,$abook_id));
|
||||||
|
$a->set_widget('fidpeople',findpeople_widget());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function connections_post(&$a) {
|
function connections_post(&$a) {
|
||||||
|
|
||||||
if(! local_user())
|
if(! local_user())
|
||||||
|
@ -296,22 +276,20 @@ EOT;
|
||||||
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
|
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($cmd === 'drop') {
|
||||||
|
|
||||||
|
require_once('include/Contact.php');
|
||||||
// FIXME
|
// FIXME
|
||||||
|
// terminate_friendship($a->get_channel(),$orig_record[0]);
|
||||||
|
|
||||||
// if($cmd === 'drop') {
|
contact_remove($orig_record[0]['abook_id']);
|
||||||
|
info( t('Contact has been removed.') . EOL );
|
||||||
|
if(x($_SESSION,'return_url'))
|
||||||
|
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
|
||||||
|
goaway($a->get_baseurl(true) . '/contacts');
|
||||||
|
|
||||||
// require_once('include/Contact.php');
|
}
|
||||||
|
|
||||||
// terminate_friendship($a->user,$a->contact,$orig_record[0]);
|
|
||||||
|
|
||||||
// contact_remove($orig_record[0]['id']);
|
|
||||||
//info( t('Contact has been removed.') . EOL );
|
|
||||||
// if(x($_SESSION,'return_url'))
|
|
||||||
// goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
|
|
||||||
// else
|
|
||||||
// goaway($a->get_baseurl(true) . '/contacts');
|
|
||||||
// return; // NOTREACHED
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if((x($a->data,'abook')) && (is_array($a->data['abook']))) {
|
if((x($a->data,'abook')) && (is_array($a->data['abook']))) {
|
||||||
|
@ -558,8 +536,6 @@ EOT;
|
||||||
$tab_tpl = get_markup_template('common_tabs.tpl');
|
$tab_tpl = get_markup_template('common_tabs.tpl');
|
||||||
$t = replace_macros($tab_tpl, array('$tabs'=>$tabs));
|
$t = replace_macros($tab_tpl, array('$tabs'=>$tabs));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$searching = false;
|
$searching = false;
|
||||||
if($search) {
|
if($search) {
|
||||||
$search_hdr = $search;
|
$search_hdr = $search;
|
||||||
|
@ -571,9 +547,6 @@ EOT;
|
||||||
if($nets)
|
if($nets)
|
||||||
$sql_extra .= sprintf(" AND xchan_network = '%s' ", dbesc($nets));
|
$sql_extra .= sprintf(" AND xchan_network = '%s' ", dbesc($nets));
|
||||||
|
|
||||||
// $sql_extra2 = ((($sort_type > 0) && ($sort_type <= CONTACT_IS_FRIEND)) ? sprintf(" AND `rel` = %d ",intval($sort_type)) : '');
|
|
||||||
|
|
||||||
|
|
||||||
$r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash
|
$r = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash
|
||||||
where abook_channel = %d and not (abook_flags & %d) $sql_extra $sql_extra2 ",
|
where abook_channel = %d and not (abook_flags & %d) $sql_extra $sql_extra2 ",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
|
@ -598,30 +571,8 @@ EOT;
|
||||||
|
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
|
|
||||||
switch($rr['rel']) {
|
$url = "magic/{$rr['abook_id']}";
|
||||||
case CONTACT_IS_FRIEND:
|
|
||||||
$dir_icon = 'images/lrarrow.gif';
|
|
||||||
$alt_text = t('Mutual Friendship');
|
|
||||||
break;
|
|
||||||
case CONTACT_IS_FOLLOWER;
|
|
||||||
$dir_icon = 'images/larrow.gif';
|
|
||||||
$alt_text = t('is a fan of yours');
|
|
||||||
break;
|
|
||||||
case CONTACT_IS_SHARING;
|
|
||||||
$dir_icon = 'images/rarrow.gif';
|
|
||||||
$alt_text = t('you are a fan of');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(($rr['network'] === 'dfrn') && ($rr['rel'])) {
|
|
||||||
$url = "redir/{$rr['abook_id']}";
|
|
||||||
$sparkle = ' class="sparkle" ';
|
$sparkle = ' class="sparkle" ';
|
||||||
}
|
|
||||||
else {
|
|
||||||
$url = $rr['xchan_url'];
|
|
||||||
$sparkle = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$contacts[] = array(
|
$contacts[] = array(
|
||||||
|
|
10
view/js/mod_connections.js
Normal file
10
view/js/mod_connections.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
$(document).ready(function() {
|
||||||
|
var a;
|
||||||
|
a = $("#contacts-search").autocomplete({
|
||||||
|
serviceUrl: baseurl + '/acl',
|
||||||
|
minChars: 2,
|
||||||
|
width: 350,
|
||||||
|
});
|
||||||
|
a.setOptions({ params: { type: 'a' }});
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in a new issue