1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

update to upstream movim

This commit is contained in:
src386 2016-03-06 20:46:54 +01:00
parent 1f01fc309c
commit 204da42083
21 changed files with 75 additions and 36 deletions

View file

@ -1,7 +1,7 @@
**Changelog**
1.7 2016-?
- Update to movim 0.9 git2016-02-25
- Update to movim 0.9 git2016-03-06
- conf/nginx.conf : disable the Yunohost logo
1.6.1 2016-02-12

View file

@ -5,7 +5,7 @@ Movim is a decentralized social network, written in PHP and HTML5 and based on t
It is recommended to use a "valid" certificate to use Movim, auto-signed is sometimes problematic. You might want to take a look a StartSSL or Let's Encrypt.
Provided Movim version : 0.9 git2016-02-25
Provided Movim version : 0.9 git2016-03-06
Please read CHANGELOG.

View file

@ -112,11 +112,15 @@ var MovimTpl = {
return (selector.scrollHeight - Math.floor(selector.scrollTop) === selector.clientHeight);
}
},
scrollPanel : function() {
scrollPanel : function(time) {
var selector = document.querySelector('main section > div:first-child:nth-last-child(2) ~ div div');
if(typeof time == 'undefined') time = 0;
if(selector != null) {
selector.scrollTop = selector.scrollHeight;
setTimeout(function() {
selector.scrollTop = selector.scrollHeight;
}, time);
}
},
scrollPanelTop : function() {

View file

@ -99,7 +99,7 @@ function prepareString($string, $large = false, $preview = false) {
$string = addUrls($string, $preview);
// We remove all the style attributes
$string = preg_replace_callback(
/*$string = preg_replace_callback(
'/(<[^>]+) style=".*?"/i', function($match) {
return $match[1];
}, $string
@ -136,7 +136,7 @@ function prepareString($string, $large = false, $preview = false) {
'#<[/]?ss[^>]*>#is', function ($match) {
return '';
}, ' ' . $string
);
);*/
// We add some smileys...
$emoji = MovimEmoji::getInstance();

View file

@ -127,7 +127,6 @@ class Message extends Model {
$this->published = gmdate('Y-m-d H:i:s', strtotime($parent->delay->attributes()->stamp));
else
$this->published = gmdate('Y-m-d H:i:s');
$this->delivered = gmdate('Y-m-d H:i:s');
}
}

View file

@ -11,7 +11,7 @@ class MessageDAO extends SQL {
html = :html,
published = :published,
delivered = :delivered,
edited = 1
edited = :edited
where session = :session
and id = :id
@ -25,6 +25,7 @@ class MessageDAO extends SQL {
'id' => $message->id,
'session' => $message->session,
'jidto' => $message->jidto,
'edited' => $message->edited,
'jidfrom' => $message->jidfrom,
'body' => $message->body,
'html' => $message->html,
@ -91,6 +92,25 @@ class MessageDAO extends SQL {
return $this->run('Message');
}
function getId($id)
{
$this->_sql = '
select * from message
where session = :session
and id = :id
limit 1';
$this->prepare(
'Message',
array(
'session' => $this->_user,
'id' => $id
)
);
return $this->run('Message', 'item');
}
function getLastItem($to)
{
$this->_sql = '

View file

@ -49,6 +49,6 @@
<?php $this->widget('Dialog');?>
<?php $this->widget('Notification');?>
<?php $this->content();?>
<script type="text/javascript">movim_onload();</script>
<script type="text/javascript">if(typeof movim_onload == 'function') { movim_onload(); }</script>
</body>
</html>

View file

@ -47,10 +47,11 @@
<span class="primary icon gray">
<i class="zmdi zmdi-pages"></i>
</span>
<span class="control icon">
<span class="control icon active">
<a
href="{$c->route('feed', array($server, $node))}"
target="_blank"
title="Atom"
>
<i class="zmdi zmdi-portable-wifi"></i>
</a>

View file

@ -25,6 +25,7 @@ class Chat extends WidgetBase
$this->addcss('chat.css');
$this->registerEvent('carbons', 'onMessage');
$this->registerEvent('message', 'onMessage');
$this->registerEvent('receipt', 'onMessage');
$this->registerEvent('mamresult', 'onMessageHistory');
$this->registerEvent('composing', 'onComposing');
$this->registerEvent('paused', 'onPaused');
@ -255,7 +256,6 @@ class Chat extends WidgetBase
} else {
$m->id = Uuid::uuid4();
$m->published = gmdate('Y-m-d H:i:s');
$m->delivered = gmdate('Y-m-d H:i:s');
}
$session = \Sessionx::start();
@ -571,7 +571,7 @@ class Chat extends WidgetBase
RPC::call('Chat.setBubbles', $left, $right, $room);
RPC::call('Chat.appendMessages', $messages);
RPC::call('MovimTpl.scrollPanel');
RPC::call('MovimTpl.scrollPanel', 100);
}
function prepareMessage(&$message)

View file

@ -111,9 +111,10 @@
state = 0;
Chat.sendMessage(this.dataset.jid, {if="$muc"}true{else}false{/if});
return false;
} else if(event.keyCode == 38) {
} else if(event.keyCode == 38 && this.value == '') {
Chat_ajaxLast(this.dataset.jid);
} else if(event.keyCode == 40) {
} else if(event.keyCode == 40
&& (this.value == '' || Chat.edit == true)) {
Chat.clearReplace();
} else {
{if="!$muc"}

View file

@ -158,6 +158,10 @@ var Chat = {
info.innerHTML = '<i class="zmdi zmdi-edit"></i> ' + info.innerHTML;
}
if(message.delivered) {
info.innerHTML = '<i class="zmdi zmdi-check"></i> ' + info.innerHTML;
}
if(prepend) {
Chat.date = message.published;
var discussion = document.querySelector('#chat_widget div.contained');
@ -169,7 +173,8 @@ var Chat = {
var scrollDiff = discussion.scrollHeight - Chat.lastScroll;
discussion.scrollTop += scrollDiff;
Chat.lastScroll = discussion.scrollHeight;
} else if(message.edited) {
} else if(message.edited
|| message.delivered) {
var elem = document.getElementById(message.id);
if(elem)
elem.parentElement.replaceChild(bubble, elem);
@ -179,7 +184,7 @@ var Chat = {
movim_append(id, bubble.outerHTML);
}
bubble.querySelector('div.bubble').className = 'bubble';
//bubble.querySelector('div.bubble').className = 'bubble';
if(bubble.className.indexOf('oppose') > -1
&& prepend == null) MovimTpl.scrollPanel();

View file

@ -88,7 +88,8 @@ class Chats extends WidgetBase
$g->setJid(echapJid($jid));
if(!empty($messages)) {
$g->setStart(strtotime($messages[0]->published));
// We add a little delay of 10sec to prevent some sync issues
$g->setStart(strtotime($messages[0]->published)+10);
}
$g->request();

View file

@ -96,7 +96,10 @@ class Groups extends WidgetBase
function ajaxDisco($server)
{
if(!$this->validateServer($server)) return;
if(!$this->validateServer($server)) {
Notification::append(null, $this->__('groups.disco_error'));
return;
}
$r = new Items;
$r->setTo($server)->request();
@ -191,9 +194,8 @@ class Groups extends WidgetBase
*/
private function validateServer($server)
{
$validate_server = Validator::stringType()->noWhitespace()->length(6, 40);
if(!$validate_server->validate($server)) return false;
else return true;
$validate_server = Validator::noWhitespace()->alnum('.')->length(6, 40);
return ($validate_server->validate($server));
}
function display()

View file

@ -32,7 +32,7 @@
</p>
<p class="all">
{if="$value->contentraw"}
{$value->contentraw}
{$value->contentraw|prepareString}
{else}
{$value->title}
{/if}

View file

@ -1,7 +1,7 @@
<section class="scroll">
<h3>{$c->__('chatrooms.users')}</h3>
<br />
<ul class="list middle">
<ul class="list">
{$presence = getPresencesTxt()}
{loop="$list"}
<li class="{if="$value->last > 60"} inactive{/if}"

View file

@ -1,5 +1,5 @@
<section>
<h3>{$c->__('roster.search')}</h3>
<h3>{$c->__('roster.search_pod')}</h3>
<ul class="list">
<li>
<form name="add">

View file

@ -16,3 +16,4 @@ added = Contact added
updated = Contact updated
deleted = Contact deleted
search = Search in your contacts
search_pod = Search a contact

View file

@ -25,7 +25,7 @@ class Stickers extends WidgetBase
list($c, $ext) = explode('@', $cid);
list($sh, $key) = explode('+', $c);
$base64 = base64_encode(file_get_contents(dirname(__FILE__).'/stickers/'.$key.'.png'));
$base64 = base64_encode(file_get_contents(dirname(__FILE__).'/stickers/'.$key.'.png'));
$a = new Answer;
$a->setTo($to)
@ -63,7 +63,6 @@ class Stickers extends WidgetBase
$m->body = 'A Stickers has been sent using Movim';
$m->published = gmdate('Y-m-d H:i:s');
$m->delivered = gmdate('Y-m-d H:i:s');
$session = \Sessionx::start();
@ -122,6 +121,6 @@ class Stickers extends WidgetBase
function display()
{
}
}

View file

@ -99,7 +99,7 @@ $stdin_behaviour = function ($data) use (&$conn, $loop, &$buffer, &$connector, &
if(!empty($xml) && $conn) {
//$timestamp = time();
$conn->write(trim($xml));
fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
#fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
}
}
} else {
@ -148,7 +148,7 @@ $xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$s
$restart = true;
}
fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n");
#fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n");
#fwrite(STDERR, colorize(getenv('sid'), 'yellow')." widgets : ".\sizeToCleanSize(memory_get_usage())."\n");
\Moxl\API::clear();
@ -182,7 +182,7 @@ $xmpp_behaviour = function (React\Stream\Stream $stream) use (&$conn, $loop, &$s
if(!empty($xml)) {
//$timestamp = time();
$conn->write(trim($xml));
fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
#fwrite(STDERR, colorize(trim($xml), 'yellow')." : ".colorize('sent to XMPP', 'green')."\n");
}
\Moxl\API::clear();

View file

@ -81,7 +81,7 @@ class BaseController {
} else {
$built = $content->build($this->name);
$this->page->setContent($built);
echo $this->page->build('page');
echo $this->page->build('page', $this->public);
}
}
}

View file

@ -3,7 +3,7 @@
/**
* @file TplPageBuilder.php
* This file is part of Movim.
*
*
* @brief This class is the templating engine for movim. It also handles themes.
*
* @author Timothée jaussoin
@ -32,7 +32,7 @@ class TplPageBuilder
$cd = new \Modl\ConfigDAO();
$config = $cd->get();
$this->theme = $config->theme;
}
function viewsPath($file)
@ -65,11 +65,11 @@ class TplPageBuilder
. $this->linkFile($file, true) .
"\" type=\"text/css\" />\n";
}
/**
* Actually generates the page from templates.
*/
function build($view)
function build($view, $public = false)
{
$this->_view = $view;
$template = $this->_view.'.tpl';
@ -78,8 +78,14 @@ class TplPageBuilder
require($this->viewsPath($template));
$outp = ob_get_clean();
$scripts = $this->printCss();
if(!$public) {
$scripts .= $this->printScripts();
}
$outp = str_replace('<%scripts%>',
$this->printCss() . $this->printScripts(),
$scripts,
$outp);
return $outp;