diff options
-rw-r--r-- | Zotlabs/Daemon/Notifier.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Channel.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Connedit.php | 4 | ||||
-rw-r--r-- | Zotlabs/Widget/Common_friends.php | 19 | ||||
-rw-r--r-- | include/contact_widgets.php | 19 | ||||
-rw-r--r-- | view/pdl/mod_channel.pdl | 3 | ||||
-rwxr-xr-x | view/tpl/common_friends.tpl | 2 | ||||
-rwxr-xr-x | view/tpl/remote_friends_common.tpl | 39 |
8 files changed, 62 insertions, 28 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 54d609ad1..5f8490b06 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -161,7 +161,7 @@ class Notifier { $packet_type = 'keychange'; $normal_mode = false; } - elseif($cmd == 'permission_update' || $cmd == 'permission_reject' || $cmd == 'permission_accept' || $cmd == 'permission_create') { + elseif(in_array($cmd, [ 'permission_update', 'permission_reject', 'permission_accept', 'permission_create' ])) { // Get the (single) recipient $r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_self = 0", intval($item_id) diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 4ffc9ffc6..8550c69cd 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -123,7 +123,7 @@ class Channel extends \Zotlabs\Web\Controller { //$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']); - $o .= common_friends_visitor_widget(\App::$profile['profile_uid']); + // $o .= common_friends_visitor_widget(\App::$profile['profile_uid']); if($channel && $is_owner) { $channel_acl = array( diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 0f18b432d..23c5282e3 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -248,6 +248,10 @@ class Connedit extends \Zotlabs\Web\Controller { notice( t('Failed to update connection record.') . EOL); if(! intval(\App::$poi['abook_self'])) { + if($new_friend) { + \Zotlabs\Daemon\Master::Summon( [ 'Notifier', 'permission_accept', $contact_id ] ); + } + \Zotlabs\Daemon\Master::Summon( [ 'Notifier', (($new_friend) ? 'permission_create' : 'permission_update'), diff --git a/Zotlabs/Widget/Common_friends.php b/Zotlabs/Widget/Common_friends.php new file mode 100644 index 000000000..a67b9312c --- /dev/null +++ b/Zotlabs/Widget/Common_friends.php @@ -0,0 +1,19 @@ +<?php + +namespace Zotlabs\Widget; + +require_once('include/contact_widgets.php'); + +class Common_friends { + + function widget($arr) { + + if((! \App::$profile['profile_uid']) + || (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),'view_contacts'))) { + return ''; + } + + return common_friends_visitor_widget(\App::$profile['profile_uid']); + + } +} diff --git a/include/contact_widgets.php b/include/contact_widgets.php index aac756a46..e5bb696f8 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -143,7 +143,7 @@ function cardcategories_widget($baseurl,$selected = '') { -function common_friends_visitor_widget($profile_uid) { +function common_friends_visitor_widget($profile_uid,$cnt = 10) { if(local_channel() == $profile_uid) return; @@ -156,19 +156,20 @@ function common_friends_visitor_widget($profile_uid) { require_once('include/socgraph.php'); $t = count_common_friends($profile_uid,$observer_hash); + if(! $t) return; - $r = common_friends($profile_uid,$observer_hash,0,5,true); + $r = common_friends($profile_uid,$observer_hash,0,$cnt,true); return replace_macros(get_markup_template('remote_friends_common.tpl'), array( - '$desc' => sprintf( tt("%d connection in common", "%d connections in common", $t), $t), - '$base' => z_root(), - '$uid' => $profile_uid, - '$cid' => $observer, - '$linkmore' => (($t > 5) ? 'true' : ''), - '$more' => t('show more'), - '$items' => $r + '$desc' => sprintf( t('Common connections: %d'), $t), + '$base' => z_root(), + '$uid' => $profile_uid, + '$cid' => $observer, + '$linkmore' => (($t > $cnt) ? 'true' : ''), + '$more' => t('show more'), + '$items' => $r )); }; diff --git a/view/pdl/mod_channel.pdl b/view/pdl/mod_channel.pdl index 98dc71915..54c2fb489 100644 --- a/view/pdl/mod_channel.pdl +++ b/view/pdl/mod_channel.pdl @@ -7,4 +7,7 @@ [widget=categories][/widget] [widget=tagcloud_wall][var=limit]24[/var][/widget] [/region] +[region=content] +[widget=common_friends][/widget] +[/region] diff --git a/view/tpl/common_friends.tpl b/view/tpl/common_friends.tpl index 489717e78..fa2cf5a13 100755 --- a/view/tpl/common_friends.tpl +++ b/view/tpl/common_friends.tpl @@ -1,4 +1,4 @@ -<div class="profile-match-wrapper"> +<div class="generic-content-wrapper"> <div class="profile-match-photo"> <a href="{{$url}}"> <img src="{{$photo}}" alt="{{$name}}" width="80" height="80" title="{{$name}} [{{$url}}]" /> diff --git a/view/tpl/remote_friends_common.tpl b/view/tpl/remote_friends_common.tpl index d6d2fd211..7ec1a2e6b 100755 --- a/view/tpl/remote_friends_common.tpl +++ b/view/tpl/remote_friends_common.tpl @@ -1,21 +1,28 @@ -<div id="remote-friends-in-common" class="bigwidget"> - <div id="rfic-desc">{{$desc}} {{if $linkmore}}<a href="{{$base}}/common/{{$uid}}">{{$more}}</a>{{/if}}</div> - {{if $items}} - {{foreach $items as $item}} - <div class="profile-match-wrapper"> - <div class="profile-match-photo"> - <a href="{{$base}}/chanview?f=&url={{$item.xchan_url}}"> - <img src="{{$item.xchan_photo_m}}" width="80" height="80" alt="{{$item.xchan_name}}" title="{{$item.xchan_name}}" /> - </a> +<div class="widget"> + <div class="panel"> + <div class="section-subtitle-wrapper" role="tab" id="common-friends-visitor"> + <h3><a data-toggle="collapse" href="#common-friends-collapse">{{$desc}}</a></h3> </div> - <div class="profile-match-break"></div> - <div class="profile-match-name"> - <a href="{{$base}}/chanview?f=&url={{$item.xchan_url}}" title="{{$item.xchan_name}}">{{$item.xchan_name}}</a> + <div id="common-friends-collapse" class="collapse" role="tabpanel" aria-labelledby="common-friends-visitor"> + {{if $items}} + {{foreach $items as $item}} + <div class="profile-match-wrapper"> + <div class="profile-match-photo"> + <a href="{{$base}}/chanview?f=&url={{$item.xchan_url}}"> + <img src="{{$item.xchan_photo_m}}" width="80" height="80" alt="{{$item.xchan_name}}" title="{{$item.xchan_name}}" /> + </a> + </div> + <div class="profile-match-break"></div> + <div class="profile-match-name"> + <a href="{{$base}}/chanview?f=&url={{$item.xchan_url}}" title="{{$item.xchan_name}}">{{$item.xchan_name}}</a> + </div> + <div class="profile-match-end"></div> + </div> + {{/foreach}} + {{/if}} + <div id="rfic-end" class="clear"></div> + {{if $linkmore}}<button class="btn btn-default"><a href="{{$base}}/common/{{$uid}}">{{$more}}</a></button>{{/if}} </div> - <div class="profile-match-end"></div> </div> - {{/foreach}} - {{/if}} - <div id="rfic-end" class="clear"></div> </div> |