Browse Source

- Merge with edhelas

pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
67d7ca2d11
  1. 3
      app/models/contact/ContactDAO.php
  2. 22
      app/models/postn/PostnDAO.php
  3. 6
      app/widgets/Chat/_chat_message.tpl
  4. 2
      app/widgets/Hello/Hello.php
  5. 29
      app/widgets/Hello/hello.tpl
  6. 2
      app/widgets/Hello/locales.ini
  7. 2
      app/widgets/Menu/Menu.php
  8. 25
      app/widgets/Menu/_menu_list.tpl
  9. 3
      app/widgets/Menu/menu.js
  10. 7
      app/widgets/Post/Post.php
  11. 6
      app/widgets/Post/_post_embed.tpl
  12. 41
      app/widgets/Post/_post_empty.tpl
  13. 1
      app/widgets/Post/locales.ini
  14. 2
      system/Route.php
  15. 35
      themes/material/css/list.css
  16. 5
      themes/material/css/style.css

3
app/models/contact/ContactDAO.php

@ -602,7 +602,8 @@ class ContactDAO extends SQL {
select *
from rosterlink
where session = :jid
) as rosterlink on jidfrom = rosterlink.jid';
) as rosterlink on jidfrom = rosterlink.jid
order by value';
$this->prepare(
'Contact',

22
app/models/postn/PostnDAO.php

@ -476,6 +476,28 @@ class PostnDAO extends SQL {
return $arr[0]['published'];
}
function getLastPublished($limitf = false, $limitr = false)
{
$this->_sql = '
select * from postn
where
node != \'urn:xmpp:microblog:0\'
and postn.node not like \'urn:xmpp:microblog:0:comments/%\'
and postn.node not like \'urn:xmpp:inbox\'
order by published desc
';
if($limitr)
$this->_sql = $this->_sql.' limit '.$limitr.' offset '.$limitf;
$this->prepare(
'Postn',
array()
);
return $this->run('Postn');
}
function exist($id) {
$this->_sql = '
select count(*) from postn

6
app/widgets/Chat/_chat_message.tpl

@ -32,11 +32,7 @@
{if="preg_match('#^\?OTR#', $message->body)"}
<i class="md md-lock"></i> {$c->__('message.encrypted')}
{else}
{if="isset($message->html)"}
{$message->html|prepareString}
{else}
{$message->body|htmlentities:ENT_COMPAT,'UTF-8'|prepareString}
{/if}
<div>{if="isset($message->html)"}{$message->html|prepareString}{else}{$message->body|htmlentities:ENT_COMPAT,'UTF-8'|prepareString}{/if}</div>
{/if}
<span class="info">{$message->delivered|strtotime|prepareDate}</span>
{if="$message->type == 'groupchat'"}

2
app/widgets/Hello/Hello.php

@ -23,6 +23,8 @@ class Hello extends WidgetCommon
$pd = new \Modl\PostnDAO;
$this->view->assign('news', $pd->getAllPosts(false, 0, 4));
$this->view->assign('jid', $this->user->getLogin());
$this->view->assign('presencestxt', getPresencesTxt());
}
}

29
app/widgets/Hello/hello.tpl

@ -53,10 +53,17 @@
<i class="md md-warning"></i>
</span>
{elseif="$value->node == 'urn:xmpp:microblog:0'"}
<span class="icon bubble">
<!--<i class="md md-create"></i>-->
<img src="{$value->getContact()->getPhoto('s')}">
</span>
{$url = $value->getContact()->getPhoto('s')}
{if="$url"}
<span class="icon bubble">
<img src="{$url}">
</span>
{else}
<span
class="icon bubble color {$value->getContact()->jid|stringToColor}">
<i class="md md-person"></i>
</span>
{/if}
{else}
<span class="icon bubble color {$value->node|stringToColor}">{$value->node|firstLetterCapitalize}</span>
{/if}
@ -89,4 +96,18 @@
</ul>
</div>
{/if}
<ul class="active">
<a href="{$c->route('blog', array($jid))}" target="_blank">
<li class="condensed action">
<div class="action">
<i class="md md-chevron-right"></i>
</div>
<span class="icon">
<i class="md md-wifi-tethering"></i>
</span>
<span>{$c->__('hello.blog_title')}</span>
<p>{$c->__('hello.blog_text')}</p>
</li>
</a>
</ul>
</div>

2
app/widgets/Hello/locales.ini

@ -1,2 +1,4 @@
hello.chat = 'Go on the Chat page'
hello.news = 'Read all theses articles on the News page'
hello.blog_title= 'Visit your public blog'
hello.blog_text = 'See your public posts and share them with all your contacts'

2
app/widgets/Menu/Menu.php

@ -123,7 +123,7 @@ class Menu extends WidgetCommon
$items = $pd->getFeed($page * $this->_paging + $count, $this->_paging);
break;
case 'node' :
$view->assign('history', $this->call('ajaxGetNode', '"'.$server.'"', '"'.$node.'"', $next));
$view->assign('history', $this->call('ajaxGetNode', '"'.$server.'"', '"'.$node.'"', '"'.$next.'"'));
$items = $pd->getNode($server, $node, $page * $this->_paging + $count, $this->_paging);
break;
}

25
app/widgets/Menu/_menu_list.tpl

@ -6,8 +6,11 @@
{loop="$items"}
<li
tabindex="{$key+1}"
class="condensed" data-id="{$value->nodeid}"
tabindex="{$page*15+$key+1}"
class="condensed"
data-id="{$value->nodeid}"
data-server="{$value->origin}"
data-node="{$value->node}"
{if="$value->title != null"}
title="{$value->title|strip_tags}"
{else}
@ -15,8 +18,8 @@
{/if}
>
{if="current(explode('.', $value->origin)) == 'nsfw'"}
<span class="icon bubble color red">
<i class="md md-warning"></i>
<span class="icon bubble color red tiny">
+18
</span>
{elseif="$value->node == 'urn:xmpp:microblog:0'"}
{$url = $value->getContact()->getPhoto('s')}
@ -38,14 +41,13 @@
{else}
<span>{$c->__('menu.contact_post')}</span>
{/if}
<span class="info">{$value->published|strtotime|prepareDate}</span>
{if="$value->node == 'urn:xmpp:microblog:0'"}
<p class="wrap">{$value->getContact()->getTrueName()}</p>
{else}
<p class="wrap">{$value->node}</p>
{/if}
<p class="more">
{if="current(explode('.', $value->origin)) != 'nsfw'"}
{$value->contentcleaned|strip_tags:'<img><img/>'}
{/if}
</p>
</li>
{/loop}
{if="count($items) == 15"}
@ -58,7 +60,6 @@
{if="$page == 0"}
</ul>
{/if}
{elseif="$page == 0"}
<div id="menu_refresh"></div>
<br/>

3
app/widgets/Menu/menu.js

@ -1,6 +1,6 @@
var Menu = {
refresh: function() {
var items = document.querySelectorAll('#menu_widget ul li');
var items = document.querySelectorAll('#menu_widget ul li, #post_widget ul.card li');
var i = 0;
while(i < items.length)
@ -9,6 +9,7 @@ var Menu = {
items[i].onclick = function(e) {
MovimTpl.showPanel();
Post_ajaxGetPost(this.dataset.id);
//Menu_ajaxGetNode(this.dataset.server, this.dataset.node);
Menu.reset(items);
movim_add_class(this, 'active');
}

7
app/widgets/Post/Post.php

@ -41,6 +41,8 @@ class Post extends WidgetCommon
function ajaxClear()
{
RPC::call('movim_fill', 'post_widget', $this->prepareEmpty());
RPC::call('Menu.refresh');
//RPC::call('Menu_ajaxGetAll');
}
function ajaxGetPost($id)
@ -174,6 +176,11 @@ class Post extends WidgetCommon
function prepareEmpty()
{
$view = $this->tpl();
$nd = new \modl\PostnDAO();
$view = $this->tpl();
$view->assign('posts', $nd->getLastPublished(0, 10));
return $view->draw('_post_empty', true);
}

6
app/widgets/Post/_post_embed.tpl

@ -9,10 +9,10 @@
<a href="{$embed->providerUrl|htmlspecialchars}" target="_blank">{$embed->providerName}</a>
</p>
</li>
{if="key($embed->images) != null"}
{if="$embed->images != null"}
<li>
<a href="{$embed->images|key|htmlspecialchars}" target="_blank">
<img src="{$embed->images|key|htmlspecialchars}"/>
<a href="{$embed->images[0]['value']|htmlspecialchars}" target="_blank">
<img src="{$embed->images[0]['value']|htmlspecialchars}"/>
</a>
</li>
{/if}

41
app/widgets/Post/_post_empty.tpl

@ -1,4 +1,41 @@
<div class="placeholder icon newspaper">
<!--<div class="placeholder icon newspaper">
<h1>{$c->__('post.news_feed')}</h1>
<h4>{$c->__('post.placeholder')}</h4>
</div>
</div>-->
<br/>
<h2 class="padded">{$c->__('post.hot')}</h2>
<ul class="flex card thick active">
{loop="$posts"}
{if="!filter_var($value->origin, FILTER_VALIDATE_EMAIL)"}
<li
class="block condensed"
data-id="{$value->nodeid}"
data-server="{$value->origin}"
data-node="{$value->node}">
{if="current(explode('.', $value->origin)) == 'nsfw'"}
<span class="icon bubble color red tiny">
+18
</span>
{else}
<span class="icon bubble color {$value->node|stringToColor}">
{$value->node|firstLetterCapitalize}
</span>
{/if}
<span>
{if="isset($value->title)"}
{$value->title}
{else}
{$value->node}
{/if}
</span>
<!--<span class="info">{$value->published|strtotime|prepareDate}</span>-->
<p class="more">
{if="current(explode('.', $value->origin)) != 'nsfw'"}
{$value->contentcleaned|strip_tags:'<img><img/>'}
{/if}
</p>
</li>
{/if}
{/loop}
</ul>

1
app/widgets/Post/locales.ini

@ -14,6 +14,7 @@ post.no_content_preview = 'No content to preview'
post.no_content = 'No content'
post.published = 'Post published'
post.gallery = 'This picture will be added to your gallery'
post.hot = "What's Hot"
[manage]
post.public = 'Publish this post on your public feed?'

2
system/Route.php

@ -26,7 +26,7 @@ class Route extends \BaseController {
'pods' => false,
'disconnect' => array('err'),
'friend' => array('f'),
'blog' => array('f', 'n'),
'blog' => array('f'),
'feed' => array('f', 'n'),
'nodeconfig' => array('s', 'n'),
'node' => array('s', 'n'),

35
themes/material/css/list.css

@ -69,7 +69,12 @@ ul.active.all li:hover,
ul.active li.active:not(.subheader) {
background-color: rgba(0, 0, 0, 0.03);
cursor: pointer;
transition: background-color .2s ease-in-out;
}
ul.active li:hover:not(.subheader) > p.more:after,
ul.active.all li:hover > p.more:after,
ul.active li.active:not(.subheader) > p.more:after {
background-image: linear-gradient(to bottom, transparent, rgba(247, 247, 247, 1));
}
ul.active li:focus:not(.subheader),
@ -78,6 +83,12 @@ ul.active li.active:not(.subheader) {
background-color: rgba(0, 0, 0, 0.07);
}
ul.active li:focus:not(.subheader) > p.more:after,
ul.active.all li:focus > p.more:after,
ul.active li.active:not(.subheader) > p.more:after {
background-image: linear-gradient(to bottom, transparent, rgba(237, 237, 237, 1));
}
.dark ul.active li:hover:not(.subheader),
.dark ul.active.all li:hover,
.dark ul.active li.active:not(.subheader) {
@ -105,6 +116,17 @@ ul li > p {
text-overflow: ellipsis;
max-height: 8rem;
line-height: 2.5rem;
position: relative;
}
ul li > p.more:after {
display: block;
width: 100%;
height: 3rem;
background-image: linear-gradient(to bottom, transparent, white);
content: "";
position: absolute;
bottom: 0;
}
ul li > p.all {
@ -123,6 +145,11 @@ ul li img {
max-width: 100%;
}
ul li > p.more img:not(.emoji) {
margin: 1rem auto;
display: block;
}
ul li.action {
padding-right: 7rem;
}
@ -180,10 +207,14 @@ ul li div.bubble {
max-width: 100%;
min-width: 50%;
float: left;
/*word-break: break-all;*/
}
ul li div.bubble div {
white-space: pre;
display: inline;
}
ul li div.bubble.quote {
font-style: italic;
}

5
themes/material/css/style.css

@ -439,6 +439,11 @@ span.icon.small {
margin-top: -1.5rem;
}
span.icon.tiny {
font-size: 1.8rem;
font-weight: 600;
}
span.icon.large {
width: 7rem;
height: 7rem;

Loading…
Cancel
Save