diff options
-rw-r--r-- | mod/connections.php | 93 | ||||
-rw-r--r-- | view/js/mod_connections.js | 10 |
2 files changed, 32 insertions, 71 deletions
diff --git a/mod/connections.php b/mod/connections.php index 67a5ee13e..bdf5c06ea 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -20,44 +20,24 @@ function connections_init(&$a) { ); if($r) { $a->data['abook'] = $r[0]; - $abook_id = $r[0]['abook_id']; } - else { - $abook_id = 0; - } - } - - if($abook_id) { - $a->page['aside'] .= vcard_from_xchan($r[0]); } - else - $a->page['aside'] .= follow_widget(); - - $a->page['aside'] .= group_side('contacts','group',false,0,$abook_id); - - $a->page['aside'] .= findpeople_widget(); +} - $base = $a->get_baseurl(); +function connections_aside(&$a) { - $a->page['htmlhead'] .= <<< EOT + if(x($a->data,'abook')) + $a->set_widget('vcard',vcard_from_xchan($a->data['abook'])); + else + $a->set_widget('follow', follow_widget()); -<script>$(document).ready(function() { - var a; - a = $("#contacts-search").autocomplete({ - serviceUrl: '$base/acl', - minChars: 2, - width: 350, - }); - a.setOptions({ params: { type: 'a' }}); + $a->set_widget('collections', group_side('connnections','group',false,0,$abook_id)); + $a->set_widget('fidpeople',findpeople_widget()); -}); +} -</script> -EOT; -} - function connections_post(&$a) { if(! local_user()) @@ -296,22 +276,20 @@ EOT; goaway($a->get_baseurl(true) . '/connections/' . $contact_id); } -// FIXME -// if($cmd === 'drop') { + if($cmd === 'drop') { -// require_once('include/Contact.php'); + require_once('include/Contact.php'); +// FIXME +// terminate_friendship($a->get_channel(),$orig_record[0]); - // terminate_friendship($a->user,$a->contact,$orig_record[0]); + 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'); - // 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']))) { @@ -558,8 +536,6 @@ EOT; $tab_tpl = get_markup_template('common_tabs.tpl'); $t = replace_macros($tab_tpl, array('$tabs'=>$tabs)); - - $searching = false; if($search) { $search_hdr = $search; @@ -570,10 +546,7 @@ EOT; if($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 where abook_channel = %d and not (abook_flags & %d) $sql_extra $sql_extra2 ", intval(local_user()), @@ -598,30 +571,8 @@ EOT; foreach($r as $rr) { - switch($rr['rel']) { - 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" '; - } - else { - $url = $rr['xchan_url']; - $sparkle = ''; - } + $url = "magic/{$rr['abook_id']}"; + $sparkle = ' class="sparkle" '; $contacts[] = array( diff --git a/view/js/mod_connections.js b/view/js/mod_connections.js new file mode 100644 index 000000000..1880222bc --- /dev/null +++ b/view/js/mod_connections.js @@ -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' }}); + +}); |