aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/ThreadItem.php2
-rw-r--r--include/conversation.php166
-rwxr-xr-xview/tpl/conv_item.tpl17
-rwxr-xr-xview/tpl/search_item.tpl13
4 files changed, 190 insertions, 8 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index a1666e148..e636e5614 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -335,6 +335,8 @@ class ThreadItem {
'wall' => t('Wall-to-Wall'),
'vwall' => t('via Wall-To-Wall:'),
'profile_url' => $profile_link,
+ 'thread_action_menu' => thread_action_menu($item,$conv->get_mode()),
+ 'thread_author_menu' => thread_author_menu($item,$conv->get_mode()),
'item_photo_menu' => item_photo_menu($item),
'dreport' => $dreport,
'name' => $profile_name,
diff --git a/include/conversation.php b/include/conversation.php
index d367c27a6..af64fbb90 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -689,7 +689,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
'id' => (($preview) ? 'P0' : $item['item_id']),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_url),
'profile_url' => $profile_link,
- 'item_photo_menu' => item_photo_menu($item),
+ 'thread_action_menu' => thread_action_menu($item,$mode),
+ 'thread_author_menu' => thread_author_menu($item,$mode),
'name' => $profile_name,
'sparkle' => $sparkle,
'lock' => $lock,
@@ -960,6 +961,169 @@ function item_photo_menu($item){
return $o;
}
+
+function thread_action_menu($item,$mode = '') {
+
+ $menu = [];
+
+ if((local_channel()) && local_channel() == $item['uid']) {
+ $menu[] = [
+ 'menu' => 'view_source',
+ 'title' => t('View Source'),
+ 'icon' => 'eye',
+ 'action' => 'viewsrc(' . $item['id'] . '); return false;',
+ 'href' => '#'
+ ];
+
+ if(! in_array($mode, [ 'network-new', 'search', 'community'])) {
+ if($item['parent'] == $item['id'] && (get_observer_hash() != $item['author_xchan'])) {
+ $menu[] = [
+ 'menu' => 'follow_thread',
+ 'title' => t('Follow Thread'),
+ 'icon' => 'plus',
+ 'action' => 'dosubthread(' . $item['id'] . '); return false;',
+ 'href' => '#'
+ ];
+ }
+
+ $menu[] = [
+ 'menu' => 'unfollow_thread',
+ 'title' => t('Unfollow Thread'),
+ 'icon' => 'minus',
+ 'action' => 'dounsubthread(' . $item['id'] . '); return false;',
+ 'href' => '#'
+ ];
+ }
+
+ }
+
+
+
+
+ $args = [ 'item' => $item, 'mode' => $mode, 'menu' => $menu ];
+ call_hooks('thread_action_menu', $args);
+
+ return $args['menu'];
+
+}
+
+function thread_author_menu($item, $mode = '') {
+
+ $menu = [];
+
+ $local_channel = local_channel();
+
+ if($local_channel) {
+ if(! count(App::$contacts))
+ load_contact_links($local_channel);
+ $channel = App::get_channel();
+ $channel_hash = (($channel) ? $channel['channel_hash'] : '');
+ }
+
+ $profile_link = chanlink_hash($item['author_xchan']);
+ if($item['uid'] > 0)
+ $pm_url = z_root() . '/mail/new/?f=&hash=' . $item['author_xchan'];
+
+ if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts))
+ $contact = App::$contacts[$item['author_xchan']];
+ else
+ if($local_channel && $item['author']['xchan_addr'])
+ $follow_url = z_root() . '/follow/?f=&url=' . $item['author']['xchan_addr'];
+
+ if($contact) {
+ $poke_link = z_root() . '/poke/?f=&c=' . $contact['abook_id'];
+ if (! intval($contact['abook_self']))
+ $contact_url = z_root() . '/connedit/' . $contact['abook_id'];
+ $posts_link = z_root() . '/network/?cid=' . $contact['abook_id'];
+
+ $clean_url = normalise_link($item['author-link']);
+ }
+
+ $rating_enabled = get_config('system','rating_enabled');
+
+ $ratings_url = (($rating_enabled) ? z_root() . '/ratings/' . urlencode($item['author_xchan']) : '');
+
+ if($profile_link) {
+ $menu[] = [
+ 'menu' => 'view_profile',
+ 'title' => t('View Profile'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $profile_link
+ ];
+ }
+
+ if($posts_link) {
+ $menu[] = [
+ 'menu' => 'view_posts',
+ 'title' => t('Activity/Posts'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $posts_link
+ ];
+ }
+
+ if($follow_url) {
+ $menu[] = [
+ 'menu' => 'follow',
+ 'title' => t('Connect'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $follow_url
+ ];
+ }
+
+ if($contact_url) {
+ $menu[] = [
+ 'menu' => 'connedit',
+ 'title' => t('Edit Connection'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $contact_url
+ ];
+ }
+
+ if($pm_url) {
+ $menu[] = [
+ 'menu' => 'prv_message',
+ 'title' => t('Message'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $pm_url
+ ];
+ }
+
+ if($ratings_url) {
+ $menu[] = [
+ 'menu' => 'ratings',
+ 'title' => t('Ratings'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $ratings_url
+ ];
+ }
+
+ if($poke_link) {
+ $menu[] = [
+ 'menu' => 'poke',
+ 'title' => t('Poke'),
+ 'icon' => 'fw',
+ 'action' => '',
+ 'href' => $poke_link
+ ];
+ }
+
+ $args = [ 'item' => $item, 'mode' => $mode, 'menu' => $menu ];
+ call_hooks('thread_author_menu', $args);
+
+ return $args['menu'];
+
+}
+
+
+
+
+
/**
* @brief Checks item to see if it is one of the builtin activities (like/dislike, event attendance, consensus items, etc.)
*
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index 35c3d18e7..b5ff475b2 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -166,18 +166,27 @@
{{if $item.star}}
<li role="presentation"><a role="menuitem" href="#" onclick="dostar({{$item.id}}); return false;"><i id="starred-{{$item.id}}" class="fa fa-star {{$item.star.isstarred}}" title="{{$item.star.toggle}}"></i> {{$item.star.toggle}}</a></li>
{{/if}}
+
+ {{if $item.thread_action_menu}}
+ {{foreach $item.thread_action_menu as $mitem}}
+ <li role="presentation"><a role="menuitem" {{if $mitem.href}}href="{{$mitem.href}}"{{/if}} {{if $mitem.action}}onclick="{{$mitem.action}}"{{/if}} {{if $mitem.title}}title="{{$mitem.title}}"{{/if}} ><i class="fa fa-{{$mitem.icon}}"></i> {{$mitem.title}}</a></li>
+ {{/foreach}}
+ {{/if}}
+
{{if $item.drop.dropping}}
<li role="presentation"><a role="menuitem" href="#" onclick="dropItem('item/drop/{{$item.id}}', '#thread-wrapper-{{$item.id}}'); return false;" title="{{$item.drop.delete}}" ><i class="fa fa-trash-o"></i> {{$item.drop.delete}}</a></li>
{{/if}}
- {{if $item.item_photo_menu}}
+
+ {{if $item.thread_author_menu}}
<li role="presentation" class="divider"></li>
- {{$item.item_photo_menu}}
+ {{foreach $item.thread_author_menu as $mitem}}
+ <li role="presentation"><a role="menuitem" {{if $mitem.href}}href="{{$mitem.href}}"{{/if}} {{if $mitem.action}}onclick="{{$mitem.action}}"{{/if}} {{if $mitem.title}}title="{{$mitem.title}}"{{/if}} >{{$mitem.title}}</a></li>
+ {{/foreach}}
+ {{/if}}
{{if $item.edpost && $item.dreport}}
<li role="presentation"><a role="menuitem" href="dreport/{{$item.mid}}">{{$item.dreport}}</a></li>
{{/if}}
-
- {{/if}}
</ul>
</div>
</div>
diff --git a/view/tpl/search_item.tpl b/view/tpl/search_item.tpl
index 51fa8b8dc..a490cb473 100755
--- a/view/tpl/search_item.tpl
+++ b/view/tpl/search_item.tpl
@@ -74,13 +74,20 @@
<i class="fa fa-caret-down"></i>
</button>
<ul class="dropdown-menu">
- {{if $item.item_photo_menu}}
- {{$item.item_photo_menu}}
+ {{if $item.thread_action_menu}}
+ {{foreach $item.thread_action_menu as $mitem}}
+ <li role="presentation"><a role="menuitem" {{if $mitem.href}}href="{{$mitem.href}}"{{/if}} {{if $mitem.action}}onclick="{{$mitem.action}}"{{/if}} {{if $mitem.title}}title="{{$mitem.title}}"{{/if}} ><i class="fa fa-{{$mitem.icon}}"></i> {{$mitem.title}}</a></li>
+ {{/foreach}}
{{/if}}
{{if $item.drop.dropping}}
- <li role="presentation" class="divider"></li>
<li><a href="item/drop/{{$item.id}}" onclick="return confirmDelete();" title="{{$item.drop.delete}}" ><i class="fa fa-trash-o"></i> {{$item.drop.delete}}</a></li>
{{/if}}
+ {{if $item.thread_author_menu}}
+ <li role="presentation" class="divider"></li>
+ {{foreach $item.thread_author_menu as $mitem}}
+ <li role="presentation"><a role="menuitem" {{if $mitem.href}}href="{{$mitem.href}}"{{/if}} {{if $mitem.action}}onclick="{{$mitem.action}}"{{/if}} {{if $mitem.title}}title="{{$mitem.title}}"{{/if}} >{{$mitem.title}}</a></li>
+ {{/foreach}}
+ {{/if}}
</ul>
</div>
{{if $item.attachments}}