]> git.mxchange.org Git - friendica.git/commitdiff
Add delivery queue display in frio and vier
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 7 Dec 2018 05:54:40 +0000 (00:54 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Jan 2019 14:39:13 +0000 (09:39 -0500)
- Add new $item.owner_self and $item.delivery keys for display
- Add new sub/delivery_count.tpl template

src/Object/Post.php
view/templates/sub/delivery_count.tpl [new file with mode: 0644]
view/theme/frio/templates/sub/delivery_count.tpl [new file with mode: 0644]
view/theme/frio/templates/wall_thread.tpl
view/theme/vier/templates/sub/delivery_count.tpl [new file with mode: 0644]
view/theme/vier/templates/wall_thread.tpl

index 2bad9a6262110fad7b72ff216327c5e52c918667..8aae024ffbc7863b786383388102d50e22a730c6 100644 (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];
diff --git a/view/templates/sub/delivery_count.tpl b/view/templates/sub/delivery_count.tpl
new file mode 100644 (file)
index 0000000..d10eda6
--- /dev/null
@@ -0,0 +1,13 @@
+{{*\r
+       Please don't use this template as is, this is a placeholder that needs to be\r
+       overriden with specific icons to avoid taking too much visual space\r
+*}}\r
+{{if $delivery.queue_count == 0}}\r
+       {{$delivery.notifier_pending|escape}}\r
+{{elseif $delivery.queue_done == 0}}\r
+       {{$delivery.delivery_pending|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}\r
+{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}}\r
+       {{$delivery.delivery_underway|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}\r
+{{else}}\r
+       {{$delivery.delivery_almost|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}\r
+{{/if}}\r
diff --git a/view/theme/frio/templates/sub/delivery_count.tpl b/view/theme/frio/templates/sub/delivery_count.tpl
new file mode 100644 (file)
index 0000000..05d1d17
--- /dev/null
@@ -0,0 +1,13 @@
+{{if $delivery.queue_count == 0}}\r
+       <i class="fa fa-hourglass-o" aria-hidden="true" title="{{$delivery.notifier_pending|escape}}"></i>\r
+       <span class="sr-only">{{$delivery.notifier_pending|escape}}</span>\r
+{{elseif $delivery.queue_done == 0}}\r
+       <i class="fa fa-hourglass" aria-hidden="true" title="{{$delivery.delivery_pending|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>\r
+       <span class="sr-only">{{$delivery.delivery_pending|escape}}</span>\r
+{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}}\r
+       <i class="fa fa-paper-plane-o" aria-hidden="true" title="{{$delivery.delivery_underway|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>\r
+       <span class="sr-only">{{$delivery.delivery_underway|escape}}</span>\r
+{{else}}\r
+       <i class="fa fa-paper-plane" aria-hidden="true" title="{{$delivery.delivery_almost|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>\r
+       <span class="sr-only">{{$delivery.delivery_almost|escape}}</span>\r
+{{/if}}\r
index af3e27228b3e9f4d563dcc285c58fdddc5b24da8..8d357960fe262f06ed2ce7a97cbd479cc951860d 100644 (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>
diff --git a/view/theme/vier/templates/sub/delivery_count.tpl b/view/theme/vier/templates/sub/delivery_count.tpl
new file mode 100644 (file)
index 0000000..594ce38
--- /dev/null
@@ -0,0 +1,13 @@
+{{if $delivery.queue_count == 0}}\r
+       <i class="icon-spinner" aria-hidden="true" title="{{$delivery.notifier_pending|escape}}"></i>\r
+       <span class="sr-only">{{$delivery.notifier_pending|escape}}</span>\r
+{{elseif $delivery.queue_done == 0}}\r
+       <i class="icon-spinner" aria-hidden="true" title="{{$delivery.delivery_pending|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>\r
+       <span class="sr-only">{{$delivery.delivery_pending|escape}}</span>\r
+{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}}\r
+       <i class="icon-plane" aria-hidden="true" title="{{$delivery.delivery_underway|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>\r
+       <span class="sr-only">{{$delivery.delivery_underway|escape}}</span>\r
+{{else}}\r
+       <i class="icon-plane" aria-hidden="true" title="{{$delivery.delivery_almost|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}}"></i>\r
+       <span class="sr-only">{{$delivery.delivery_almost|escape}}</span>\r
+{{/if}}\r
index 8a857bcb7d6fe84214a9e5bbe6000a25a43ebb84..607a789e564314356fa201bc036133d6fc1dee19 100644 (file)
                        {{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}}">