From f45b06ffa004c6e6920214b64efe18e3cfe2d667 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 6 Dec 2013 21:40:01 -0800 Subject: [PATCH] suggestion widget --- include/contact_widgets.php | 43 ++++++++++++++++++++++++++++++- include/socgraph.php | 4 +++ mod/network.php | 1 + view/theme/redbasic/css/style.css | 3 ++- view/tpl/suggest_friends.tpl | 2 +- view/tpl/suggest_widget.tpl | 10 +++++++ 6 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 view/tpl/suggest_widget.tpl diff --git a/include/contact_widgets.php b/include/contact_widgets.php index af05f8c9f..a6e66eb17 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -1,5 +1,6 @@ channel['channel_id']; @@ -149,4 +150,44 @@ function common_friends_visitor_widget($profile_uid) { '$items' => $r )); -}; \ No newline at end of file +}; + + +function suggest_widget() { + + require_once('include/socgraph.php'); + + $r = suggestion_query(local_user(),get_observer_hash(),0,2); + + if(! $r) { + return; + } + + $arr = array(); + + foreach($r as $rr) { + + $connlnk = z_root() . '/follow/?url=' . $rr['xchan_addr']; + + $arr[] = array( + 'url' => chanlink_url($rr['xchan_url']), + 'name' => $rr['xchan_name'], + 'photo' => $rr['xchan_photo_m'], + 'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'], + 'conntxt' => t('Connect'), + 'connlnk' => $connlnk, + 'ignore' => t('Ignore/Hide') + ); + } + + + $o = replace_macros(get_markup_template('suggest_widget.tpl'),array( + '$title' => t('Suggestions'), + '$more' => t('See more...'), + '$entries' => $arr + )); + + return $o; + +} + diff --git a/include/socgraph.php b/include/socgraph.php index b34d5142c..0e91eba60 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -287,11 +287,13 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) { and not xlink_link in ( select xchan from xign where uid = %d ) and xlink_xchan != '' and not ( xchan_flags & %d ) + and not ( xchan_flags & %d ) group by xchan_hash order by total desc limit %d, %d ", intval($uid), intval($uid), intval($uid), intval(XCHAN_FLAGS_HIDDEN), + intval(XCHAN_FLAGS_DELETED), intval($start), intval($limit) ); @@ -305,10 +307,12 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) { and not xlink_link in ( select abook_xchan from abook where abook_channel = %d ) and not xlink_link in ( select xchan from xign where uid = %d ) and not ( xchan_flags & %d ) + and not ( xchan_flags & %d ) group by xchan_hash order by total desc limit %d, %d ", intval($uid), intval($uid), intval(XCHAN_FLAGS_HIDDEN), + intval(XCHAN_FLAGS_DELETED), intval($start), intval($limit) ); diff --git a/mod/network.php b/mod/network.php index 18173043e..f087149f3 100644 --- a/mod/network.php +++ b/mod/network.php @@ -50,6 +50,7 @@ function network_init(&$a) { $a->page['aside'] .= group_side('network','network',true,$_GET['gid']); $a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false); + $a->page['aside'] .= suggest_widget(); $a->page['aside'] .= saved_searches($search); $a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : '')); diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 0ddbe1b86..2e00fde41 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -932,7 +932,7 @@ tr.mceLast { .contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo { border-radius: $radiuspx; -moz-border-radius: $radiuspx; - box-shadow: 4px 4px 3px 0 #444444; + box-shadow: $shadowpx $shadowpx $shadowpx 0 #444444; } #sidebar-page-list .label { @@ -2979,3 +2979,4 @@ img.mail-list-sender-photo { .comment-edit-text-full { color: black; } +.suggest-widget-more { margin-top: 10px; } \ No newline at end of file diff --git a/view/tpl/suggest_friends.tpl b/view/tpl/suggest_friends.tpl index 80a606912..baece361a 100755 --- a/view/tpl/suggest_friends.tpl +++ b/view/tpl/suggest_friends.tpl @@ -1,5 +1,5 @@
- +