Browse Source

Improve Groups logo display in Post and Group views

pull/238/head
Jaussoin Timothée 9 years ago
parent
commit
c62e68b1eb
  1. 7
      app/models/postn/Postn.php
  2. 15
      app/models/postn/PostnDAO.php
  3. 4
      app/widgets/Groups/_groups_server.tpl
  4. 12
      app/widgets/Post/_post.tpl
  5. 33
      app/widgets/Post/_post_empty.tpl
  6. 1
      locales/locales.ini

7
app/models/postn/Postn.php

@ -36,6 +36,7 @@ class Postn extends Model {
private $youtube;
public $open;
public $logo;
private $openlink;
public function __construct() {
@ -413,6 +414,12 @@ class Postn extends Model {
return (isset($this->lat, $this->lon) && $this->lat != '' && $this->lon != '');
}
public function getLogo()
{
$p = new \Picture;
return $p->get($this->origin.$this->node, 120);
}
public function isMine()
{
$user = new \User();

15
app/models/postn/PostnDAO.php

@ -208,6 +208,9 @@ class PostnDAO extends SQL {
$this->_sql = '
select *, postn.aid from postn
left outer join contact on postn.aid = contact.jid
left outer join item
on postn.origin = item.server
and postn.node = item.node
where ((postn.origin, node) in (select server, node from subscription where jid = :aid))
and postn.origin = :origin
and postn.node = :node
@ -254,6 +257,9 @@ class PostnDAO extends SQL {
$this->_sql = '
select *, postn.aid from postn
left outer join contact on postn.aid = contact.jid
left outer join item
on postn.origin = item.server
and postn.node = item.node
where postn.origin = :origin
and postn.node = :node
order by postn.published desc';
@ -319,6 +325,9 @@ class PostnDAO extends SQL {
$this->_sql = '
select *, postn.aid from postn
left outer join contact on postn.aid = contact.jid
left outer join item
on postn.origin = item.server
and postn.node = item.node
where postn.nodeid = :nodeid';
$this->prepare(
@ -579,12 +588,14 @@ class PostnDAO extends SQL {
{
$this->_sql = '
select * from postn
left outer join item on postn.origin = item.server
and postn.node = item.node
where
node != \'urn:xmpp:microblog:0\'
postn.node != \'urn:xmpp:microblog:0\'
and postn.node not like \'urn:xmpp:microblog:0:comments/%\'
and postn.node not like \'urn:xmpp:inbox\'
and postn.origin not like \'nsfw%\'
and ((postn.origin, node) not in (select server, node from subscription where jid = :origin))
and ((postn.origin, postn.node) not in (select server, node from subscription where jid = :origin))
order by published desc
';

4
app/widgets/Groups/_groups_server.tpl

@ -48,7 +48,9 @@
<img src="{$value->getLogo()}">
</span>
{else}
<span class="primary icon bubble color {$value->node|stringToColor}">{$value->node|firstLetterCapitalize}</span>
<span class="primary icon bubble color {$value->node|stringToColor}">
{$value->node|firstLetterCapitalize}
</span>
{/if}
<p class="line">
{if="$value->name"}

12
app/widgets/Post/_post.tpl

@ -68,9 +68,15 @@
</span>
{/if}
{else}
<span class="icon primary bubble color {$post->node|stringToColor}">
{$post->node|firstLetterCapitalize}
</span>
{if="$post->logo"}
<span class="primary icon bubble">
<img src="{$post->getLogo()}">
</span>
{else}
<span class="primary icon bubble color {$post->node|stringToColor}">
{$post->node|firstLetterCapitalize}
</span>
{/if}
{/if}
<p {if="$post->title != null"}title="{$post->title|strip_tags}"{/if}>
<a {if="$public"}

33
app/widgets/Post/_post_empty.tpl

@ -55,15 +55,19 @@
{if="$picture != null"}
<span class="icon top" style="background-image: url({$picture});"></span>
{else}
{$url = $value->getContact()->getPhoto('l')}
{if="$url"}
<span class="icon top" style="background-image: url({$url});">
</span>
{else}
<span class="icon top color {$value->getContact()->jid|stringToColor}">
<i class="zmdi zmdi-account"></i>
</span>
{/if}
<span class="icon top color {$value->getContact()->jid|stringToColor}">
<i class="zmdi zmdi-account"></i>
</span>
{/if}
{$url = $value->getContact()->getPhoto('l')}
{if="$url"}
<span class="primary icon bubble" style="background-image: url({$url});">
</span>
{else}
<span class="primary icon bubble color {$value->getContact()->jid|stringToColor}">
<i class="zmdi zmdi-account"></i>
</span>
{/if}
<p class="line">
{if="isset($value->title)"}
@ -135,6 +139,15 @@
{$value->node|firstLetterCapitalize}
</span>
{/if}
{if="$value->logo"}
<span class="primary icon bubble">
<img src="{$value->getLogo()}">
</span>
{else}
<span class="primary icon bubble color {$value->node|stringToColor}">{$value->node|firstLetterCapitalize}</span>
{/if}
<p class="line">
{if="isset($value->title)"}
{$value->title}
@ -181,7 +194,7 @@
<p>{$c->__('hello.share_text')}</p>
</li>
<li class="block">
<a class="button" href="javascript:(function(){location.href='{$c->route('share', '\'+escape(encodeURIComponent(location.href));')}})();"><i class="zmdi zmdi-share"></i> {$c->__('hello.share_button')}</a>
<a class="button" href="javascript:(function(){location.href='{$c->route('share', '\'+escape(encodeURIComponent(location.href));')}})();"><i class="zmdi zmdi-share"></i> {$c->__('button.share')}</a>
</li>
</ul>
{/if}

1
locales/locales.ini

@ -68,6 +68,7 @@ refuse = Refuse
next = Next
previous = Previous
search = Search
share = Share
[input]
username = Username

Loading…
Cancel
Save