Browse Source

- Merge with edhelas and nodpounod

pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
17a31cb6d5
  1. 2
      app/views/main.tpl
  2. 2
      app/widgets/AccountNext/AccountNext.php
  3. 2
      app/widgets/AccountNext/_accountnext_registered.tpl
  4. 3
      app/widgets/Chat/_chat.tpl
  5. 11
      app/widgets/Init/init.js
  6. 1
      app/widgets/Login/Login.php
  7. 10
      app/widgets/Login/_login_sessions.tpl
  8. 54
      app/widgets/Login/login.js
  9. 2
      app/widgets/Login/login.tpl
  10. 33
      app/widgets/Menu/Menu.php
  11. 2
      app/widgets/Presence/presence.js
  12. 1
      themes/material/css/list.css

2
app/views/main.tpl

@ -1,3 +1,5 @@
<?php $this->widget('Init');?>
<nav class="color dark">
<?php $this->widget('Navigation');?>
<?php $this->widget('Presence');?>

2
app/widgets/AccountNext/AccountNext.php

@ -71,7 +71,7 @@ class AccountNext extends WidgetBase {
RPC::call('movim_fill', 'subscription_form', $html);
RPC::call('setUsername', $data->username->value);
RPC::call('remoteUnregister');
//RPC::call('remoteUnregister');
}
function onRegisterError($package)

2
app/widgets/AccountNext/_accountnext_registered.tpl

@ -3,7 +3,7 @@
<h2 id="username">username@server.com</h2>
<a class="button color" href="{$c->route('login')}">
<a class="button color" onclick="remoteUnregister(); MovimWebsocket.attach(function() {movim_redirect('{$c->route('login')}')});" href="#">
{$c->__('page.login')}
</a>
</div>

3
app/widgets/Chat/_chat.tpl

@ -12,9 +12,6 @@
<div class="action" onclick="{$send}">
<i class="md md-send"></i>
</div>
<!--<div class="control" onclick="{$smiley}">
<i class="md md-mood"></i>
</div>-->
<form>
<div>
<textarea

11
app/widgets/Init/init.js

@ -1,6 +1,9 @@
var Init = {
checkNode : function() {
if(localStorage.initialized != 'true') {
// TODO : very ugly, need to refactor this
var jid = localStorage.getItem("username").replace("@", "at");
var init = localStorage.getObject(jid + "_Init") || {};
if(init.initialized != 'true') {
Init_ajaxCreatePersistentStorage('storage:bookmarks');
Init_ajaxCreatePersistentStorage('urn:xmpp:vcard4');
Init_ajaxCreatePersistentStorage('urn:xmpp:avatar:data');
@ -10,7 +13,11 @@ var Init = {
}
},
setNode : function(node) {
localStorage.initialized = 'true';
// TODO : need to refactor this too
var jid = localStorage.getItem("username").replace("@", "at");
var init = localStorage.getObject(jid + "_Init") || {};
init.initialized = 'true';
localStorage.setObject(jid + "_Init", init);
}
}

1
app/widgets/Login/Login.php

@ -341,6 +341,7 @@ class Login extends WidgetBase
$sessionshtml->assign('empty', new \Modl\Contact);
RPC::call('movim_fill', 'sessions', $sessionshtml->draw('_login_sessions', true));
RPC::call('Login.refresh');
RPC::commit();
}
}

10
app/widgets/Login/_login_sessions.tpl

@ -3,14 +3,14 @@
<br />
<ul class="active">
{loop="$sessions"}
<li class="action">
<li id="{$value->jid}" class="action">
<div class="action">
<i onclick="Login.removeSession('{$value->jid}')" class="fa fa-times"></i>
<i class="fa fa-times"></i>
</div>
<span onclick="Login.choose('{$value->jid}')" class="icon bubble">
<span class="icon bubble">
<img src="{$value->getPhoto('s')}"/>
</span>
<span onclick="Login.choose('{$value->jid}')">{$value->getTrueName()}</span>
<span>{$value->getTrueName()}</span>
</li>
{/loop}
</ul>
@ -19,5 +19,5 @@
<a class="button flat" href="{$c->route('admin')}">
<i class="md md-pages"></i>
</a>
<span class="button flat" onclick="Login.choose('')">{$c->__('form.another_account')}</span>
<span class="button flat" onclick="Login.toForm()">{$c->__('form.another_account')}</span>
</div>

54
app/widgets/Login/login.js

@ -25,6 +25,18 @@ var Login = {
setTimeout("MovimWebsocket.unregister()", 7000);
}
},
refresh: function(){
/*Add onclick listeners*/
var sessions = document.querySelectorAll('#sessions section ul > li');
var i = 0;
while(i < sessions.length)
{
sessions[i].onclick = function(e){Login.choose(e.target);};
i++;
}
},
/**
* @brief Save a jid in the local storage
@ -46,15 +58,26 @@ var Login = {
* @brief Choose a session to connect and show the login form
* @param The jid to choose
*/
choose : function(jid) {
movim_remove_class('#login_widget', 'choose');
document.querySelector('#login').value = jid;
document.querySelector('#pass').value = "";
choose : function(element) {
var tn = element.tagName;
while(element.tagName != "LI")
element = element.parentNode;
var jid = element.id;
if(jid != '') {
document.querySelector('#pass').focus();
} else {
document.querySelector('#login').focus();
if(tn == "I" || tn == "DIV"){
Login.removeSession(jid);
}
else{
Login.toForm();
document.querySelector('#login').value = jid;
document.querySelector('#pass').value = "";
if(jid != '') {
document.querySelector('#pass').focus();
} else {
document.querySelector('#login').focus();
}
}
},
@ -68,7 +91,7 @@ var Login = {
if(s.length == 0) {
localStorage.removeItem('previousSessions');
movim_remove_class('#login_widget', 'choose');
Login.toForm();
} else {
localStorage.setObject('previousSessions', s);
}
@ -79,10 +102,19 @@ var Login = {
/**
* @brief Back to the choosing panel
*/
backToChoose : function() {
toChoose : function() {
movim_add_class('#login_widget', 'choose');
},
/**
* @brief Back to the choosing panel
*/
toForm : function() {
movim_remove_class('#login_widget', 'choose');
// Empty login field
document.querySelector('#login').value = "";
},
/**
* @brief Post login requests
*/
@ -119,7 +151,7 @@ MovimWebsocket.attach(function()
Login_ajaxGetRememberedSession(localStorage.getItem('previousSessions'));
if(localStorage.getItem('previousSessions') != null) {
movim_add_class('#login_widget', 'choose');
Login.toChoose();
}
});

2
app/widgets/Login/login.tpl

@ -34,7 +34,7 @@
value="{$c->__('button.come_in')}"
class="button flat"/>
</div>
<a id="return_sessions" class="button flat" href="#" onclick="Login.backToChoose()">
<a id="return_sessions" class="button flat" href="#" onclick="Login.toChoose()">
{$c->__('account.title')}
</a>
</li>

33
app/widgets/Menu/Menu.php

@ -97,30 +97,49 @@ class Menu extends WidgetCommon
}
function prepareList($type = 'all', $server = null, $node = null, $page = 0) {
movim_log(__METHOD__);
$view = $this->tpl();
$pd = new \Modl\PostnDAO;
Cache::c('since', date(DATE_ISO8601, strtotime($pd->getLastDate())));
$count = $pd->getCountSince(Cache::c('since'));
// getting newer, not older
movim_log($page);
movim_log($page == "");
if($page == 0 || $page == ""){
$count = 0;
Cache::c('since', date(DATE_ISO8601, strtotime($pd->getLastDate())));
}
$next = $page + 1;
switch($type) {
case 'all' :
$view->assign('history', $this->call('ajaxGetAll', $next));
$items = $pd->getAllPosts(false, $page*$this->_paging, $this->_paging);
$items = $pd->getAllPosts(false, $page * $this->_paging + $count, $this->_paging);
movim_log(__LINE__);
movim_log(" ALL ");
movim_log($page * $this->_paging + $count);
break;
case 'news' :
$view->assign('history', $this->call('ajaxGetNews', $next));
$items = $pd->getNews($page*$this->_paging, $this->_paging);
$items = $pd->getNews($page * $this->_paging + $count, $this->_paging);
movim_log(__LINE__);
movim_log(" NEWS ");
movim_log($page * $this->_paging + $count);
break;
case 'feed' :
$view->assign('history', $this->call('ajaxGetFeed', $next));
$items = $pd->getFeed($page*$this->_paging, $this->_paging);
$items = $pd->getFeed($page * $this->_paging + $count, $this->_paging);
movim_log(__LINE__);
movim_log(" FEED ");
movim_log($page * $this->_paging + $count);
break;
case 'node' :
$view->assign('history', $this->call('ajaxGetNode', '"'.$server.'"', '"'.$node.'"', $next));
$items = $pd->getNode($server, $node, $page*$this->_paging, $this->_paging);
$items = $pd->getNode($server, $node, $page * $this->_paging + $count, $this->_paging);
movim_log(__LINE__);
movim_log(" NODE ");
movim_log($page * $this->_paging + $count);
break;
}

2
app/widgets/Presence/presence.js

@ -49,7 +49,7 @@ var Presence = {
};
}
var presences = document.querySelectorAll('form ul li');
var presences = document.querySelectorAll('#dialog form ul li');
var i = 0;
while(i < presences.length)

1
themes/material/css/list.css

@ -91,6 +91,7 @@ ul li > p {
overflow: hidden;
text-overflow: ellipsis;
max-height: 8rem;
line-height: 2.5rem;
}
ul li p.wrap {

Loading…
Cancel
Save