Add delivery queue display in frio and vier

- Add new $item.owner_self and $item.delivery keys for display
- Add new sub/delivery_count.tpl template
This commit is contained in:
Hypolite Petovan 2018-12-07 00:54:40 -05:00
parent 1696ad962e
commit 6538a8eaca
6 changed files with 64 additions and 6 deletions

View File

@ -394,6 +394,7 @@ class Post extends BaseObject
'location' => $location_e,
'indent' => $indent,
'shiny' => $shiny,
'owner_self' => $item['author-link'] == defaults($_SESSION, 'my_url', null),
'owner_url' => $this->getOwnerUrl(),
'owner_photo' => $a->removeBaseURL(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
'owner_name' => $owner_name_e,
@ -421,6 +422,14 @@ class Post extends BaseObject
'commented' => $item['commented'],
'created_date' => $item['created'],
'return' => ($a->cmd) ? bin2hex($a->cmd) : '',
'delivery' => [
'queue_count' => $item['delivery_queue_count'],
'queue_done' => $item['delivery_queue_done'],
'notifier_pending' => L10n::t('Notifier task is pending'),
'delivery_pending' => L10n::t('Delivery to remote servers is pending'),
'delivery_underway' => L10n::t('Delivery to remote servers is underway'),
'delivery_almost' => L10n::t('Delivery to remote servers is mostly done'),
],
];
$arr = ['item' => $item, 'output' => $tmp_item];

View File

@ -0,0 +1,13 @@
{{*
Please don't use this template as is, this is a placeholder that needs to be
overriden with specific icons to avoid taking too much visual space
*}}
{{if $delivery.queue_count == 0}}
{{$delivery.notifier_pending|escape}}
{{elseif $delivery.queue_done == 0}}
{{$delivery.delivery_pending|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}
{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}}
{{$delivery.delivery_underway|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}
{{else}}
{{$delivery.delivery_almost|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}
{{/if}}

View File

@ -0,0 +1,13 @@
{{if $delivery.queue_count == 0}}
<i class="fa fa-hourglass-o" aria-hidden="true" title="{{$delivery.notifier_pending|escape}}"></i>
<span class="sr-only">{{$delivery.notifier_pending|escape}}</span>
{{elseif $delivery.queue_done == 0}}
<i class="fa fa-hourglass" aria-hidden="true" title="{{$delivery.delivery_pending|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>
<span class="sr-only">{{$delivery.delivery_pending|escape}}</span>
{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}}
<i class="fa fa-paper-plane-o" aria-hidden="true" title="{{$delivery.delivery_underway|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>
<span class="sr-only">{{$delivery.delivery_underway|escape}}</span>
{{else}}
<i class="fa fa-paper-plane" aria-hidden="true" title="{{$delivery.delivery_almost|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>
<span class="sr-only">{{$delivery.delivery_almost|escape}}</span>
{{/if}}

View File

@ -12,8 +12,8 @@ The div get's closed if thread_level = 2 and the value of $top_child_nr is the s
as the value of $top_child_total (this is done at the end of this file)
*}}
{{if $item.thread_level==1}}
{{assign var="top_child_total" count($item.children)}}
{{assign var="top_child_nr" 0}}
{{assign var="top_child_total" value=count($item.children)}}
{{assign var="top_child_nr" value=0}}
{{/if}}
{{if $item.thread_level==2}}
{{assign var="top_child_nr" value=$top_child_nr+1 scope=parent}}
@ -55,15 +55,14 @@ as the value of $top_child_total (this is done at the end of this file)
{{/if}}
{{/if}}
<!-- TODO => Unknow block -->
{{* TODO => Unknown block *}}
<div class="wall-item-decor" style="display:none;">
{{if $item.star}}
<span class="icon s22 star {{$item.isstarred}}" id="starred-{{$item.id}}" title="{{$item.star.starred}}">{{$item.star.starred}}</span>
{{/if}}
{{if $item.lock}}<span class="navicon lock fakelink" onclick="lockview(event,{{$item.id}});" title="{{$item.lock}}"></span><span class="fa fa-lock"></span>{{/if}}
</div>
<!-- ./TODO => Unknow block -->
{{* /TODO => Unknown block *}}
{{* Use a different div container in dependence max thread-level = 7 *}}
@ -220,7 +219,14 @@ as the value of $top_child_total (this is done at the end of this file)
<h5 class="media-heading">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo"><span>{{$item.name}}</span></a>
<p class="text-muted">
<small><a class="time" href="{{$item.plink.orig}}"><span class="wall-item-ago">{{$item.ago}}</span></a> {{if $item.location}}&nbsp;&mdash;&nbsp;({{$item.location nofilter}}){{/if}}</small>
<small>
<a class="time" href="{{$item.plink.orig}}"><span class="wall-item-ago">{{$item.ago}}</span></a>
{{if $item.location}}&nbsp;&mdash;&nbsp;({{$item.location nofilter}}){{/if}}
{{if $item.owner_self}}
&bullet;
{{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
{{/if}}
</small>
</p>
</h5>
</div>

View File

@ -0,0 +1,13 @@
{{if $delivery.queue_count == 0}}
<i class="icon-spinner" aria-hidden="true" title="{{$delivery.notifier_pending|escape}}"></i>
<span class="sr-only">{{$delivery.notifier_pending|escape}}</span>
{{elseif $delivery.queue_done == 0}}
<i class="icon-spinner" aria-hidden="true" title="{{$delivery.delivery_pending|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>
<span class="sr-only">{{$delivery.delivery_pending|escape}}</span>
{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}}
<i class="icon-plane" aria-hidden="true" title="{{$delivery.delivery_underway|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>
<span class="sr-only">{{$delivery.delivery_underway|escape}}</span>
{{else}}
<i class="icon-plane" aria-hidden="true" title="{{$delivery.delivery_almost|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>
<span class="sr-only">{{$delivery.delivery_almost|escape}}</span>
{{/if}}

View File

@ -56,6 +56,10 @@
{{if $item.owner_url}}{{$item.via}} <a href="{{$item.owner_url}}" target="redir" title="{{$item.olinktitle}}" class="wall-item-name-link"><span class="wall-item-name{{$item.osparkle}}" id="wall-item-ownername-{{$item.id}}">{{$item.owner_name}}</span></a>{{/if}}
<span class="wall-item-ago">
{{if $item.plink}}<a title="{{$item.plink.title}}" href="{{$item.plink.href}}" class="u-url" style="color: #999"><time class="dt-published" datetime="{{$item.localtime}}">{{$item.created}}</time></a>{{else}} <time class="dt-published" datetime="{{$item.localtime}}">{{$item.created}}</time> {{/if}}
{{if $item.owner_self}}
&bullet;
{{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
{{/if}}
</span>
{{if $item.lock}}<span class="icon s10 lock fakelink" onclick="lockview(event,{{$item.id}});" title="{{$item.lock}}">{{$item.lock}}</span>{{/if}}
<span class="wall-item-network" title="{{$item.app}}">