aboutsummaryrefslogtreecommitdiffstats
path: root/mod/connections.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/connections.php')
-rw-r--r--mod/connections.php56
1 files changed, 40 insertions, 16 deletions
diff --git a/mod/connections.php b/mod/connections.php
index 1875ed908..0dfcfebf1 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -337,6 +337,9 @@ function connections_content(&$a) {
}
$sql_extra .= (($searching) ? protect_sprintf(" AND xchan_name like '%$search_txt%' ") : "");
+ if($_REQUEST['gid']) {
+ $sql_extra .= " and xchan_hash in ( select xchan from group_member where gid = " . intval($_REQUEST['gid']) . " and uid = " . intval(local_user()) . " ) ";
+ }
$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) and not (xchan_flags & %d ) $sql_extra $sql_extra2 ",
@@ -366,7 +369,7 @@ function connections_content(&$a) {
if($rr['xchan_url']) {
$contacts[] = array(
'img_hover' => sprintf( t('%1$s [%2$s]'),$rr['xchan_name'],$rr['xchan_url']),
- 'edit_hover' => t('Edit contact'),
+ 'edit_hover' => t('Edit connection'),
'id' => $rr['abook_id'],
'alt_text' => $alt_text,
'dir_icon' => $dir_icon,
@@ -375,6 +378,7 @@ function connections_content(&$a) {
'username' => $rr['xchan_name'],
'classes' => (($rr['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? 'archived' : ''),
'link' => z_root() . '/connedit/' . $rr['abook_id'],
+ 'edit' => t('Edit'),
'url' => chanlink_url($rr['xchan_url']),
'network' => network_to_name($rr['network']),
);
@@ -382,20 +386,40 @@ function connections_content(&$a) {
}
}
- $o .= replace_macros(get_markup_template('connections.tpl'),array(
- '$header' => t('Connections') . (($head) ? ' - ' . $head : ''),
- '$tabs' => $t,
- '$total' => $total,
- '$search' => $search_hdr,
- '$desc' => t('Search your connections'),
- '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""),
- '$submit' => t('Find'),
- '$edit' => t('Edit'),
- '$cmd' => $a->cmd,
- '$contacts' => $contacts,
- '$paginate' => paginate($a),
-
- ));
-
+
+ if($_REQUEST['aj']) {
+ if($contacts) {
+ $o = replace_macros(get_markup_template('contactsajax.tpl'),array(
+ '$contacts' => $contacts,
+ '$edit' => t('Edit'),
+ ));
+ }
+ else {
+ $o = '<div id="content-complete"></div>';
+ }
+ echo $o;
+ killme();
+ }
+ else {
+ $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
+ $o .= replace_macros(get_markup_template('connections.tpl'),array(
+ '$header' => t('Connections') . (($head) ? ' - ' . $head : ''),
+ '$tabs' => $t,
+ '$total' => $total,
+ '$search' => $search_hdr,
+ '$desc' => t('Search your connections'),
+ '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""),
+ '$submit' => t('Find'),
+ '$edit' => t('Edit'),
+ '$cmd' => $a->cmd,
+ '$contacts' => $contacts,
+ '$paginate' => paginate($a),
+
+ ));
+ }
+
+ if(! $contacts)
+ $o .= '<div id="content-complete"></div>';
+
return $o;
}