From 6538a8eaca3224ce563b4f242dab6cda971e72d3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 7 Dec 2018 00:54:40 -0500 Subject: [PATCH] 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 --- src/Object/Post.php | 9 +++++++++ view/templates/sub/delivery_count.tpl | 13 +++++++++++++ .../frio/templates/sub/delivery_count.tpl | 13 +++++++++++++ view/theme/frio/templates/wall_thread.tpl | 18 ++++++++++++------ .../vier/templates/sub/delivery_count.tpl | 13 +++++++++++++ view/theme/vier/templates/wall_thread.tpl | 4 ++++ 6 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 view/templates/sub/delivery_count.tpl create mode 100644 view/theme/frio/templates/sub/delivery_count.tpl create mode 100644 view/theme/vier/templates/sub/delivery_count.tpl diff --git a/src/Object/Post.php b/src/Object/Post.php index 2bad9a626..8aae024ff 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -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]; diff --git a/view/templates/sub/delivery_count.tpl b/view/templates/sub/delivery_count.tpl new file mode 100644 index 000000000..d10eda639 --- /dev/null +++ b/view/templates/sub/delivery_count.tpl @@ -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}} diff --git a/view/theme/frio/templates/sub/delivery_count.tpl b/view/theme/frio/templates/sub/delivery_count.tpl new file mode 100644 index 000000000..05d1d171c --- /dev/null +++ b/view/theme/frio/templates/sub/delivery_count.tpl @@ -0,0 +1,13 @@ +{{if $delivery.queue_count == 0}} + + {{$delivery.notifier_pending|escape}} +{{elseif $delivery.queue_done == 0}} + + {{$delivery.delivery_pending|escape}} +{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}} + + {{$delivery.delivery_underway|escape}} +{{else}} + + {{$delivery.delivery_almost|escape}} +{{/if}} diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index af3e27228..8d357960f 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -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 => Unknown 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)
{{$item.name}}

- {{$item.ago}} {{if $item.location}} — ({{$item.location nofilter}}){{/if}} + + {{$item.ago}} + {{if $item.location}} — ({{$item.location nofilter}}){{/if}} + {{if $item.owner_self}} + • + {{include file="sub/delivery_count.tpl" delivery=$item.delivery}} + {{/if}} +

diff --git a/view/theme/vier/templates/sub/delivery_count.tpl b/view/theme/vier/templates/sub/delivery_count.tpl new file mode 100644 index 000000000..594ce38c5 --- /dev/null +++ b/view/theme/vier/templates/sub/delivery_count.tpl @@ -0,0 +1,13 @@ +{{if $delivery.queue_count == 0}} + + {{$delivery.notifier_pending|escape}} +{{elseif $delivery.queue_done == 0}} + + {{$delivery.delivery_pending|escape}} +{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}} + + {{$delivery.delivery_underway|escape}} +{{else}} + + {{$delivery.delivery_almost|escape}} +{{/if}} diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl index 8a857bcb7..607a789e5 100644 --- a/view/theme/vier/templates/wall_thread.tpl +++ b/view/theme/vier/templates/wall_thread.tpl @@ -56,6 +56,10 @@ {{if $item.owner_url}}{{$item.via}} {{$item.owner_name}}{{/if}} {{if $item.plink}}{{else}} {{/if}} + {{if $item.owner_self}} + • + {{include file="sub/delivery_count.tpl" delivery=$item.delivery}} + {{/if}} {{if $item.lock}}{{$item.lock}}{{/if}}