aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2019-11-22 14:59:45 +0100
committerMario <mario@mariovavti.com>2019-11-22 14:59:45 +0100
commit23c47f78eada85c1f897bbf348a4f802db9ef2f9 (patch)
treeb5202776942979f9b56a9be0e84b13cfcf65a0c6
parent4a4c43bb2c336622181ccdd006642efc7b9f1ee5 (diff)
downloadvolse-hubzilla-23c47f78eada85c1f897bbf348a4f802db9ef2f9.tar.gz
volse-hubzilla-23c47f78eada85c1f897bbf348a4f802db9ef2f9.tar.bz2
volse-hubzilla-23c47f78eada85c1f897bbf348a4f802db9ef2f9.zip
More descriptive connection status icons
-rw-r--r--Zotlabs/Module/Connections.php23
-rw-r--r--Zotlabs/Module/Viewconnections.php24
-rw-r--r--include/text.php22
-rwxr-xr-xview/tpl/connection_template.tpl4
-rw-r--r--view/tpl/connstatus.tpl1
-rwxr-xr-xview/tpl/contact_template.tpl4
-rw-r--r--view/tpl/micropro_card.tpl2
-rwxr-xr-xview/tpl/micropro_img.tpl2
8 files changed, 72 insertions, 10 deletions
diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php
index f6133d5f8..f9d9c7135 100644
--- a/Zotlabs/Module/Connections.php
+++ b/Zotlabs/Module/Connections.php
@@ -283,6 +283,28 @@ class Connections extends \Zotlabs\Web\Controller {
if(! intval(get_abconfig(local_channel(),$rr['xchan_hash'],'their_perms','post_comments'))) {
$oneway = true;
}
+
+ $perminfo['connpermcount']=0;
+ $perminfo['connperms']=t('Accepts').': ';
+ if(intval(get_abconfig(local_channel(),$rr['xchan_hash'],'their_perms','post_comments'))) {
+ $perminfo['connpermcount']++;
+ $perminfo['connperms'] .= t('Comments');
+ }
+ if(intval(get_abconfig(local_channel(),$rr['xchan_hash'],'their_perms','send_stream'))) {
+ $perminfo['connpermcount']++;
+ $perminfo['connperms'] = ($perminfo['connperms']) ? $perminfo['connperms'] . ',' : $perminfo['connperms'] ;
+ $perminfo['connperms'] .= t('Stream items');
+ }
+ if(intval(get_abconfig(local_channel(),$rr['xchan_hash'],'their_perms','post_wall'))) {
+ $perminfo['connpermcount']++;
+ $perminfo['connperms'] = ($perminfo['connperms']) ? $perminfo['connperms'] . ',' : $perminfo['connperms'] ;
+ $perminfo['connperms'] .= t('Wall posts');
+ }
+
+ if ($perminfo['connpermcount'] == 0) {
+ $perminfo['connperms'] .= t('Nothing');
+ }
+
foreach($status as $str) {
if(!$str)
@@ -323,6 +345,7 @@ class Connections extends \Zotlabs\Web\Controller {
'recent_label' => t('Recent activity'),
'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']) . '&name=' . $rr['xchan_name'],
'oneway' => $oneway,
+ 'perminfo' => $perminfo,
'connect' => (intval($rr['abook_not_here']) ? t('Connect') : ''),
'follow' => z_root() . '/follow/?f=&url=' . urlencode($rr['xchan_hash']) . '&interactive=0',
'connect_hover' => t('Connect at this location')
diff --git a/Zotlabs/Module/Viewconnections.php b/Zotlabs/Module/Viewconnections.php
index 30df0b9e4..18a52c247 100644
--- a/Zotlabs/Module/Viewconnections.php
+++ b/Zotlabs/Module/Viewconnections.php
@@ -74,6 +74,29 @@ class Viewconnections extends \Zotlabs\Web\Controller {
if(! intval(get_abconfig(\App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_comments'))) {
$oneway = true;
}
+
+ $perminfo=[];
+ $perminfo['connpermcount']=0;
+ $perminfo['connperms']=t('Accepts').': ';
+ if(intval(get_abconfig(\App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_comments'))) {
+ $perminfo['connpermcount']++;
+ $perminfo['connperms'] .= t('Comments');
+ }
+ if(intval(get_abconfig(\App::$profile['uid'],$rr['xchan_hash'],'their_perms','send_stream'))) {
+ $perminfo['connpermcount']++;
+ $perminfo['connperms'] = ($perminfo['connperms']) ? $perminfo['connperms'] . ',' : $perminfo['connperms'] ;
+ $perminfo['connperms'] .= t('Stream items');
+ }
+ if(intval(get_abconfig(\App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_wall'))) {
+ $perminfo['connpermcount']++;
+ $perminfo['connperms'] = ($perminfo['connperms']) ? $perminfo['connperms'] . ',' : $perminfo['connperms'] ;
+ $perminfo['connperms'] .= t('Wall posts');
+ }
+
+ if ($perminfo['connpermcount'] == 0) {
+ $perminfo['connperms'] .= t('Nothing');
+ }
+
$url = chanlink_hash($rr['xchan_hash']);
if($url) {
@@ -88,6 +111,7 @@ class Viewconnections extends \Zotlabs\Web\Controller {
'sparkle' => '',
'itemurl' => $rr['url'],
'network' => '',
+ 'perminfo' => $perminfo,
'oneway' => $oneway
);
}
diff --git a/include/text.php b/include/text.php
index 44af40810..d19f4b782 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1016,10 +1016,27 @@ function contact_block() {
// There is no setting to discover if you are bi-directionally connected
// Use the ability to post comments as an indication that this relationship is more
// than wishful thinking; even though soapbox channels and feeds will disable it.
+ $rr['perminfo']['connpermcount']=0;
+ $rr['perminfo']['connperms']=t('Accepts').': ';
+ if(intval(get_abconfig(App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_comments'))) {
+ $rr['perminfo']['connpermcount']++;
+ $rr['perminfo']['connperms'] .= t('Comments');
+ }
+ if(intval(get_abconfig(App::$profile['uid'],$rr['xchan_hash'],'their_perms','send_stream'))) {
+ $rr['perminfo']['connpermcount']++;
+ $rr['perminfo']['connperms'] = ($rr['perminfo']['connperms']) ? $rr['perminfo']['connperms'] . ',' : $rr['perminfo']['connperms'] ;
+ $rr['perminfo']['connperms'] .= t('Stream items');
+ }
+ if(intval(get_abconfig(App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_wall'))) {
+ $rr['perminfo']['connpermcount']++;
+ $rr['perminfo']['connperms'] = ($rr['perminfo']['connperms']) ? $rr['perminfo']['connperms'] . ',' : $rr['perminfo']['connperms'] ;
+ $rr['perminfo']['connperms'] .= t('Wall posts');
+ }
- if(! intval(get_abconfig(App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_comments'))) {
- $rr['oneway'] = true;
+ if ($rr['perminfo']['connpermcount'] == 0) {
+ $rr['perminfo']['connperms'] .= t('nothing');
}
+
$micropro[] = micropro($rr,true,'mpfriend');
}
}
@@ -1086,6 +1103,7 @@ function micropro($contact, $redirect = false, $class = '', $mode = false) {
'$click' => (($contact['click']) ? $contact['click'] : ''),
'$class' => $class . (($contact['archived']) ? ' archived' : ''),
'$oneway' => (($contact['oneway']) ? true : false),
+ '$perminfo' => $contact['perminfo'],
'$url' => $url,
'$photo' => $contact['xchan_photo_s'],
'$name' => $contact['xchan_name'],
diff --git a/view/tpl/connection_template.tpl b/view/tpl/connection_template.tpl
index de22bcdbb..f9b46b41e 100755
--- a/view/tpl/connection_template.tpl
+++ b/view/tpl/connection_template.tpl
@@ -24,9 +24,7 @@
<a href="{{$contact.url}}" title="{{$contact.img_hover}}" >
<img class="directory-photo-img {{if $contact.classes}}{{$contact.classes}}{{/if}}" src="{{$contact.thumb}}" alt="{{$contact.name}}" />
</a>
- {{if $contact.oneway}}
- <i class="fa fa-fw fa-minus-circle oneway-overlay text-danger"></i>
- {{/if}}
+ {{include "connstatus.tpl" perminfo=$contact.perminfo}}
</div>
<div class="contact-info">
{{if $contact.status}}
diff --git a/view/tpl/connstatus.tpl b/view/tpl/connstatus.tpl
new file mode 100644
index 000000000..667775f3a
--- /dev/null
+++ b/view/tpl/connstatus.tpl
@@ -0,0 +1 @@
+<i class="fa fa-fw fa-comments oneway-overlay text-{{if $perminfo.connpermcount == 3}}success{{elseif $perminfo.connpermcount > 0}}warning{{else}}danger{{/if}}" title="{{$perminfo.connperms}}"></i>
diff --git a/view/tpl/contact_template.tpl b/view/tpl/contact_template.tpl
index 2a2f996f4..40495b789 100755
--- a/view/tpl/contact_template.tpl
+++ b/view/tpl/contact_template.tpl
@@ -1,9 +1,7 @@
<div class="contact-entry-wrapper" id="contact-entry-wrapper-{{$contact.id}}" >
<div class="contact-entry-photo-wrapper" >
<a href="{{$contact.link}}" title="{{$contact.img_hover}}" ><img class="contact-block-img" src="{{$contact.thumb}}" alt="{{$contact.name}}" /></a>
- {{if $contact.oneway}}
- <i class="fa fa-fw fa-minus-circle oneway-overlay text-danger"></i>
- {{/if}}
+ {{include "connstatus.tpl" perminfo=$contact.perminfo}}
</div>
<div class="contact-entry-photo-end" ></div>
<div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div>
diff --git a/view/tpl/micropro_card.tpl b/view/tpl/micropro_card.tpl
index a3c693dbd..1bdf92da1 100644
--- a/view/tpl/micropro_card.tpl
+++ b/view/tpl/micropro_card.tpl
@@ -1,5 +1,5 @@
<a class="list-group-item{{if $class}} {{$class}}{{/if}} fakelink" href="{{if $click}}#{{else}}{{$url}}{{/if}}" {{if $click}}onclick="{{$click}}"{{/if}}>
- <img class="menu-img-3" src="{{$photo}}" title="{{$title}}" alt="" />{{if $oneway}}<i class="fa fa-fw fa-minus-circle oneway-overlay text-danger"></i>{{/if}}
+ <img class="menu-img-3" src="{{$photo}}" title="{{$title}}" alt="" />{{include "connstatus.tpl"}}
<span class="contactname">{{$name}}</span>
<span class="dropdown-sub-text">{{$addr}}<br>{{$network}}</span>
</a>
diff --git a/view/tpl/micropro_img.tpl b/view/tpl/micropro_img.tpl
index 7464430b5..f6b12d53f 100755
--- a/view/tpl/micropro_img.tpl
+++ b/view/tpl/micropro_img.tpl
@@ -1 +1 @@
-<div class="contact-block-div{{if $class}} {{$class}}{{/if}}"><a class="contact-block-link{{if $class}} {{$class}}{{/if}}{{if $click}} fakelink{{/if}}" href="{{if $click}}#{{else}}{{$url}}{{/if}}" {{if $click}}onclick="{{$click}}"{{/if}}><img class="contact-block-img{{if $class}} {{$class}}{{/if}}" src="{{$photo}}" title="{{$title}}" alt="" />{{if $oneway}}<i class="fa fa-fw fa-minus-circle oneway-overlay text-danger"></i>{{/if}}</a></div>
+<div class="contact-block-div{{if $class}} {{$class}}{{/if}}"><a class="contact-block-link{{if $class}} {{$class}}{{/if}}{{if $click}} fakelink{{/if}}" href="{{if $click}}#{{else}}{{$url}}{{/if}}" {{if $click}}onclick="{{$click}}"{{/if}}><img class="contact-block-img{{if $class}} {{$class}}{{/if}}" src="{{$photo}}" title="{{$title}}" alt="" />{{include "connstatus.tpl"}}