From 225763a8227b0dd0e0f775d82f838340bcf3fa2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaussoin=20Timoth=C3=A9e?=
Date: Sun, 8 Mar 2015 13:18:43 +0100
Subject: [PATCH] - Respect the carriage return in the Chat messages - Fix the
embeded images during post publication - Fix blog route - Add a preview of
the post in the Menu - Re-enable "What's Hot" in the News page - Fix the
avatar - Improve the Home page top contact list
---
app/models/contact/ContactDAO.php | 3 ++-
app/models/postn/PostnDAO.php | 22 ++++++++++++++++
app/widgets/Chat/_chat_message.tpl | 6 +----
app/widgets/Hello/Hello.php | 2 ++
app/widgets/Hello/hello.tpl | 29 ++++++++++++++++++---
app/widgets/Menu/Menu.php | 2 +-
app/widgets/Menu/_menu_list.tpl | 25 +++++++++---------
app/widgets/Menu/menu.js | 3 ++-
app/widgets/Post/Post.php | 7 +++++
app/widgets/Post/_post_embed.tpl | 6 ++---
app/widgets/Post/_post_empty.tpl | 41 ++++++++++++++++++++++++++++--
app/widgets/Post/locales.ini | 1 +
system/Route.php | 2 +-
themes/material/css/list.css | 35 +++++++++++++++++++++++--
themes/material/css/style.css | 5 ++++
15 files changed, 157 insertions(+), 32 deletions(-)
diff --git a/app/models/contact/ContactDAO.php b/app/models/contact/ContactDAO.php
index 6ec1cfb33..d47415e7e 100755
--- a/app/models/contact/ContactDAO.php
+++ b/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',
diff --git a/app/models/postn/PostnDAO.php b/app/models/postn/PostnDAO.php
index 6b0650f3b..529387afe 100755
--- a/app/models/postn/PostnDAO.php
+++ b/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
diff --git a/app/widgets/Chat/_chat_message.tpl b/app/widgets/Chat/_chat_message.tpl
index 5c7f218c5..8452070be 100644
--- a/app/widgets/Chat/_chat_message.tpl
+++ b/app/widgets/Chat/_chat_message.tpl
@@ -32,11 +32,7 @@
{if="preg_match('#^\?OTR#', $message->body)"}
{$c->__('message.encrypted')}
{else}
- {if="isset($message->html)"}
- {$message->html|prepareString}
- {else}
- {$message->body|htmlentities:ENT_COMPAT,'UTF-8'|prepareString}
- {/if}
+ {if="isset($message->html)"}{$message->html|prepareString}{else}{$message->body|htmlentities:ENT_COMPAT,'UTF-8'|prepareString}{/if}
{/if}
{$message->delivered|strtotime|prepareDate}
{if="$message->type == 'groupchat'"}
diff --git a/app/widgets/Hello/Hello.php b/app/widgets/Hello/Hello.php
index 832b310e8..d1db334f4 100644
--- a/app/widgets/Hello/Hello.php
+++ b/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());
}
}
diff --git a/app/widgets/Hello/hello.tpl b/app/widgets/Hello/hello.tpl
index f33277f3e..dc8210177 100644
--- a/app/widgets/Hello/hello.tpl
+++ b/app/widgets/Hello/hello.tpl
@@ -53,10 +53,17 @@
{elseif="$value->node == 'urn:xmpp:microblog:0'"}
-
-
-
-
+ {$url = $value->getContact()->getPhoto('s')}
+ {if="$url"}
+
+
+
+ {else}
+
+
+
+ {/if}
{else}
{$value->node|firstLetterCapitalize}
{/if}
@@ -89,4 +96,18 @@
{/if}
+
diff --git a/app/widgets/Menu/Menu.php b/app/widgets/Menu/Menu.php
index c80bf1f47..d8b5db773 100644
--- a/app/widgets/Menu/Menu.php
+++ b/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;
}
diff --git a/app/widgets/Menu/_menu_list.tpl b/app/widgets/Menu/_menu_list.tpl
index e36002e2f..0c62d3f04 100644
--- a/app/widgets/Menu/_menu_list.tpl
+++ b/app/widgets/Menu/_menu_list.tpl
@@ -6,8 +6,11 @@
{loop="$items"}
title != null"}
title="{$value->title|strip_tags}"
{else}
@@ -15,8 +18,8 @@
{/if}
>
{if="current(explode('.', $value->origin)) == 'nsfw'"}
-
-
+
+ +18
{elseif="$value->node == 'urn:xmpp:microblog:0'"}
{$url = $value->getContact()->getPhoto('s')}
@@ -38,14 +41,13 @@
{else}
{$c->__('menu.contact_post')}
{/if}
-
{$value->published|strtotime|prepareDate}
-
- {if="$value->node == 'urn:xmpp:microblog:0'"}
- {$value->getContact()->getTrueName()}
- {else}
- {$value->node}
- {/if}
+
+
+ {if="current(explode('.', $value->origin)) != 'nsfw'"}
+ {$value->contentcleaned|strip_tags:'![]()
'}
+ {/if}
+
{/loop}
{if="count($items) == 15"}
@@ -58,7 +60,6 @@
{if="$page == 0"}
{/if}
-
{elseif="$page == 0"}
diff --git a/app/widgets/Menu/menu.js b/app/widgets/Menu/menu.js
index 28cca35ec..0d791dd8a 100644
--- a/app/widgets/Menu/menu.js
+++ b/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');
}
diff --git a/app/widgets/Post/Post.php b/app/widgets/Post/Post.php
index 5927ae608..ae8a59fa4 100644
--- a/app/widgets/Post/Post.php
+++ b/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);
}
diff --git a/app/widgets/Post/_post_embed.tpl b/app/widgets/Post/_post_embed.tpl
index 565624930..b4a1afd31 100644
--- a/app/widgets/Post/_post_embed.tpl
+++ b/app/widgets/Post/_post_embed.tpl
@@ -9,10 +9,10 @@
{$embed->providerName}
- {if="key($embed->images) != null"}
+ {if="$embed->images != null"}
-
-
+
+
{/if}
diff --git a/app/widgets/Post/_post_empty.tpl b/app/widgets/Post/_post_empty.tpl
index 884043a64..51f20cfb6 100644
--- a/app/widgets/Post/_post_empty.tpl
+++ b/app/widgets/Post/_post_empty.tpl
@@ -1,4 +1,41 @@
-
+
+
+
{$c->__('post.hot')}
+
+
diff --git a/app/widgets/Post/locales.ini b/app/widgets/Post/locales.ini
index b67d2a556..5bd801c65 100644
--- a/app/widgets/Post/locales.ini
+++ b/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?'
diff --git a/system/Route.php b/system/Route.php
index cf443c706..8e970d168 100755
--- a/system/Route.php
+++ b/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'),
diff --git a/themes/material/css/list.css b/themes/material/css/list.css
index e76bfdd62..5cd1bd135 100644
--- a/themes/material/css/list.css
+++ b/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;
}
diff --git a/themes/material/css/style.css b/themes/material/css/style.css
index 965eebd8e..0cce80948 100644
--- a/themes/material/css/style.css
+++ b/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;