Browse Source

- Rewrite the UI to make it more natural

- Clean a lot of sourcecode
- Move the status from Profile to Presence + new Presence widget in the to right corner
pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
e2e763830a
  1. 10
      app/assets/js/movim_websocket.js
  2. 2
      app/views/explore.tpl
  3. 2
      app/views/media.tpl
  4. 2
      app/views/page.tpl
  5. 48
      app/widgets/Bookmark/_bookmark_list.tpl
  6. 4
      app/widgets/Bookmark/bookmark.css
  7. 6
      app/widgets/Bookmark/bookmark.tpl
  8. 2
      app/widgets/Chat/chat.css
  9. 2
      app/widgets/ContactAction/ContactAction.php
  10. 32
      app/widgets/ContactManage/ContactManage.php
  11. 2
      app/widgets/ContactManage/_contact_manage_form.tpl
  12. 14
      app/widgets/ContactSummary/contactsummary.css
  13. 18
      app/widgets/Login/Login.php
  14. 7
      app/widgets/Login/login.css
  15. 20
      app/widgets/Media/media.css
  16. 78
      app/widgets/Presence/Presence.php
  17. 45
      app/widgets/Presence/_presence_list.tpl
  18. 1
      app/widgets/Presence/locales.ini
  19. 161
      app/widgets/Presence/presence.css
  20. 20
      app/widgets/Presence/presence.js
  21. 2
      app/widgets/Presence/presence.tpl
  22. 95
      app/widgets/Profile/Profile.php
  23. 19
      app/widgets/Profile/_profile_vcard.tpl
  24. 5
      app/widgets/Profile/locales.ini
  25. 54
      app/widgets/Profile/profile.css
  26. 65
      app/widgets/Roster/roster.css
  27. 22
      app/widgets/Tabs/tabs.css
  28. 36
      bootstrap.php
  29. 9
      src/Movim/Daemon/Behaviour.php
  30. 74
      system/RPC.php
  31. 3
      system/Sessionx.php
  32. 29
      system/controllers/BaseController.php
  33. 62
      themes/movim/css/nav.css
  34. 3
      themes/movim/css/posts.css
  35. 39
      themes/movim/css/style.css

10
app/assets/js/movim_websocket.js

@ -4,11 +4,13 @@
* This file define the websocket behaviour and handle its connection
*/
WebSocket.prototype.link = function(body) {
this.send(JSON.stringify({'func' : 'link'}));
};
WebSocket.prototype.register = function() {
this.send(JSON.stringify({'func' : 'register', 'sid' : localStorage.movimSession}));
this.send(JSON.stringify(
{
'func' : 'register',
'sid' : localStorage.movimSession,
'baseuri' : BASE_URI
}));
};
WebSocket.prototype.unregister = function() {
this.send(JSON.stringify({'func' : 'unregister'}));

2
app/views/explore.tpl

@ -7,8 +7,8 @@
<div id="main">
<div id="left">
<?php $this->widget('Profile');?>
<?php $this->widget('Bookmark');?>
<?php $this->widget('Notifs');?>
<?php $this->widget('Bookmark');?>
</div>
<div id="center">
<div class="protect black" title="<?php echo getFlagTitle("black"); ?>"></div>

2
app/views/media.tpl

@ -7,8 +7,8 @@
<div id="main">
<div id="left">
<?php $this->widget('Profile');?>
<?php $this->widget('Bookmark');?>
<?php $this->widget('Notifs');?>
<?php $this->widget('Bookmark');?>
</div>
<div id="center">

2
app/views/page.tpl

@ -42,7 +42,7 @@
if(isset($color)) {
echo '
<style type="text/css">
body, nav {
nav {
background-color: #'.$color.';
animation: none;
-webkit-animation: none;

48
app/widgets/Bookmark/_bookmark_list.tpl

@ -1,35 +1,41 @@
<h2><i class="fa fa-users"></i> {$c->__('title.conferences')}</h2>
<ul>
<li><h2><i class="fa fa-users"></i> {$c->__('title.conferences')}</h2></li>
{loop="$conferences"}
<li>
<a href="#" onclick="{$c->getMucRemove($value)}" class="button oppose color transparent alone"><i class="fa fa-times oppose"></i></a>
<!--<a href="#" onclick="{$c->getMucRemove($value)}" class="button oppose color transparent alone"><i class="fa fa-times oppose"></i></a>-->
<a href="#" onclick="{$c->getMucJoin($value)}">{$value->name}</a>
</li>
{/loop}
<br />
<a class="button black oppose"
<li>
<a class="button color gray oppose"
title="{$c->t('Add a new Chat Room')}"
onclick="movim_toggle_display('#bookmarkmucadd')">
<i class="fa fa-plus"></i> {$c->__('button.add')}
</a>
<br />
</li>
</ul>
<h2><i class="fa fa-bookmark-o"></i> {$c->__('title.groups')}</h2>
{loop="$subscriptions"}
{if="$c->checkNewServer($value)"}
<a href="{$c->route('server', $value->server)}">
<h3><i class="fa fa-sitemap"></i> {$value->server}</h3>
</a>
{/if}
<li>
<a href="{$c->route('node', array($value->server, $value->node))}">
{if="$value->name"}
{$value->name}
{else}
{$value->node}
<div class="clear"></div>
<ul>
<li><h2><i class="fa fa-bookmark-o"></i> {$c->__('title.groups')}</h2></li>
{loop="$subscriptions"}
{if="$c->checkNewServer($value)"}
<li>
<a href="{$c->route('server', $value->server)}">
<h3><i class="fa fa-sitemap"></i> {$value->server}</h3>
</a>
</li>
{/if}
</a>
</li>
{/loop}
<li>
<a href="{$c->route('node', array($value->server, $value->node))}">
{if="$value->name"}
{$value->name}
{else}
{$value->node}
{/if}
</a>
</li>
{/loop}
</ul>

4
app/widgets/Bookmark/bookmark.css

@ -1,7 +1,7 @@
#bookmarks li {
line-height: 2em;
padding: 0 1em;
white-space: nowrap;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
line-height: 2em;
}

6
app/widgets/Bookmark/bookmark.tpl

@ -6,12 +6,12 @@
<!--<h2>{$c->t('Bookmarks')}</h2>-->
<div id="bookmarks" class="paddedtop">
<div id="bookmarks">
{$preparebookmark}
</div>
<div class="padded">
<a class="button black alone"
<a class="button color orange alone"
href="{$subscriptionconfig}"
title="{$c->t('Configure')}">
<i class="fa fa-gear"></i>
@ -21,7 +21,7 @@
style="float: right;"
title="{$c->t('Add a new URL')}"
onclick="movim_toggle_display('#bookmarkurladd')"></a>-->
<a class="button black alone oppose"
<a class="button color blue alone oppose"
title="{$c->t('Refresh')}"
onclick="{$getbookmark}">
<i class="fa fa-refresh"></i>

2
app/widgets/Chat/chat.css

@ -27,6 +27,7 @@
margin-left: 0.5em;
pointer-events: auto;
box-shadow: 0 0 0.5em rgba(0, 0, 0, 0.4);
border-radius: 0.2em 0.2em 0 0;
}
#chats .chat .panel {
@ -129,6 +130,7 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-decoration: none;
}
#chats .chat .panel .head:hover {

2
app/widgets/ContactAction/ContactAction.php

@ -91,7 +91,7 @@ class ContactAction extends WidgetCommon
$html .='
<a
class="button black"
class="button color black"
id="friendremoveask"
onclick="
document.querySelector(\'#friendremoveyes\').style.display = \'block\';

32
app/widgets/ContactManage/ContactManage.php

@ -67,38 +67,6 @@ class ContactManage extends WidgetCommon
$form->assign('rl', $rl);
$form->assign('groups', $groups);
$html = $form->draw('_contact_manage_form', true);
/*
$submit = ;
$html .= '<h2>'.t('Manage').'</h2>';
$html .= '
<form name="manage">';
$ghtml = '';
if(is_array($groups)) {
foreach($groups as $g)
$ghtml .= '<option value="'.$g.'"/>';
}
$html .= '
<input type="hidden" name="jid" value="'.$jid.'"/>
<div class="element large mini">
<input name="alias" id="alias" class="tiny" placeholder="'.t('Alias').'" value="'.$rl->rostername.'"/>
</div>
<div class="element large mini">
<datalist id="group" style="display: none;">
'.$ghtml.'
</datalist>
<input name="group" list="group" id="alias" class="tiny" placeholder="'.t('Group').'" value="'.$rl->groupname.'"/>
</div>
<a name="submit" class="button black icon yes" onclick="'.$submit.' this.style.display = \'none\';">'.t('Save').'</a>';
$html .= '
</form>';*/
}
return $html;

2
app/widgets/ContactManage/_contact_manage_form.tpl

@ -28,7 +28,7 @@
<a
name="submit"
class="button black"
class="button color green"
onclick="{$submit} this.style.display = 'none';">
<i class="fa fa-check"></i> {$c->__('button.save')}
</a>

14
app/widgets/ContactSummary/contactsummary.css

@ -1,20 +1,26 @@
#contactsummary {
background-color: rgba(20, 20, 20, 0.5);
/* background-color: rgba(20, 20, 20, 0.5);*/
line-height: 1.5em;
padding-bottom: 1rem;
}
#contactsummary h1 {
color: white;
/*color: white;*/
text-align: center;
color: #333;
margin-bottom: 0.5em;
line-height: 1.5em;
}
#contactsummary a.avatar {
width: 100%;
padding-bottom: 100%;
width: 92%;
padding-bottom: 92%;
box-shadow: 0 0.1em 0.2em rgba(0, 0, 0, 0.25), 0 0.1em 0.5em rgba(0, 0, 0, 0.20);
display: block;
margin: 4%;
background-size: 100%;
border-radius: 0.5em;
}
#contactsummary a.url {

18
app/widgets/Login/Login.php

@ -90,6 +90,10 @@ class Login extends WidgetBase
} else{
$this->view->assign('whitelist_display', false);
}
$user = new User();
$color = $user->getConfig('color');
$this->view->assign('color', $color);
}
function onMoxlError($error) {
@ -103,19 +107,27 @@ class Login extends WidgetBase
function onSASLFailure($packet)
{
$title = $this->__('error.fail_auth');
switch($packet->content) {
case 'not-authorized':
$title = $this->__('error.fail_auth');
$warning = $this->__('error.wrong_account');
break;
case 'invalid-mechanism':
$title = $this->__('error.fail_auth');
$warning = $this->__('error.mechanism');
break;
case 'malformed-request':
$title = $this->__('error.fail_auth');
$warning = $this->__('error.mechanism');
break;
case 'bad-protocol':
$warning = $this->__('error.fail_auth');
break;
case 'bad-auth':
$warning = $this->__('error.wrong_account');
break;
default :
$warning = $this->__('error.fail_auth');
break;
}
RPC::call('websocket.unregister');

7
app/widgets/Login/login.css

@ -2,7 +2,12 @@ body {
width: 100%;
margin: 0 auto;
max-width: 28em;
padding-right: 0px;
padding-right: 0;
animation: 200s infinite colorful;
-webkit-animation: 200s infinite colorful;
background-color: #32434D;
}
#content {

20
app/widgets/Media/media.css

@ -1,7 +1,3 @@
#main {
}
#center {
position: relative;
}
@ -11,14 +7,22 @@
color: white;
}
#navtabs,
#navtabs li.on a {
border-color: #333;
}
#navtabs li.on {
background-color: #111;
}
#navtabs li.on a {
color: white;
}
#navtabs li:hover a {
border-color: #353535;
}
#media .breadcrumb {
background-color: transparent;
}
@ -59,11 +63,7 @@
color: #DDD;
}
#navtabs li:hover {
background-color: #111;
}
#main, #center {
#center {
background-color: #222;
color: white;
}

78
app/widgets/Presence/Presence.php

@ -39,7 +39,8 @@ class Presence extends WidgetBase
function onMyPresence()
{
$html = $this->preparePresence();
RPC::call('movim_fill', 'logout', $html);
RPC::call('movim_fill', 'presence_widget', $html);
RPC::call('setPresenceActions');
RPC::commit();
}
@ -48,17 +49,25 @@ class Presence extends WidgetBase
RPC::call('movim_reload',
BASE_URI."index.php?q=disconnect");
}
function ajaxSetStatus($show)
private function setPresence($show = false, $status = false)
{
// We update the cache with our status and presence
$presence = Cache::c('presence');
if($show == "boot") $show = $presence['show'];
if($show == false) $show = $presence['show'];
if($status == false) $status = $presence['status'];
if(!isset($presence['show']) || $presence['show'] == '')
$presence = 'chat';
if(!isset($presence['status']) || $presence['status'] == '')
$presence = 'Online with Movim';
Cache::c(
'presence',
array(
'status' => $presence['status'],
'status' => $status,
'show' => $show
)
);
@ -66,23 +75,33 @@ class Presence extends WidgetBase
switch($show) {
case 'chat':
$p = new Chat;
$p->setStatus($presence['status'])->request();
break;
case 'away':
$p = new Away;
$p->setStatus($presence['status'])->request();
break;
case 'dnd':
$p = new DND;
$p->setStatus($presence['status'])->request();
break;
case 'xa':
$p = new XA;
$p->setStatus($presence['status'])->request();
$p->setStatus($status)->request();
break;
case 'away':
$p = new Away;
$p->setStatus($status)->request();
break;
case 'dnd':
$p = new DND;
$p->setStatus($status)->request();
break;
case 'xa':
$p = new XA;
$p->setStatus($status)->request();
break;
}
}
function ajaxSetPresence($show = false)
{
$this->setPresence($show, false);
}
function ajaxSetStatus($status)
{
$this->setPresence(false, $status);
}
function ajaxLogout()
{
$session = \Sessionx::start();
@ -93,9 +112,6 @@ class Presence extends WidgetBase
->request();
Stream::end();
//RPC::call('movim_redirect', Route::urlize('disconnect'));
//RPC::commit();
}
function ajaxConfigGet() {
@ -131,20 +147,32 @@ class Presence extends WidgetBase
$pd = new \Modl\PresenceDAO();
$p = $pd->getPresence($this->user->getLogin(), $session->ressource);
$cd = new \Modl\ContactDAO();
$contact = $cd->get($this->user->getLogin());
if($contact == null) {
$contact = new \Modl\Contact;
}
$presencetpl = $this->tpl();
$presencetpl->assign('contact', $contact);
$presencetpl->assign('p', $p);
$presencetpl->assign('txt', $txt);
$presencetpl->assign('txts', $txts);
$presencetpl->assign('callchat', $this->genCallAjax('ajaxSetStatus', "'chat'"));
$presencetpl->assign('callaway', $this->genCallAjax('ajaxSetStatus', "'away'"));
$presencetpl->assign('calldnd', $this->genCallAjax('ajaxSetStatus', "'dnd'"));
$presencetpl->assign('callxa', $this->genCallAjax('ajaxSetStatus', "'xa'"));
$presencetpl->assign('callchat', $this->genCallAjax('ajaxSetPresence', "'chat'"));
$presencetpl->assign('callaway', $this->genCallAjax('ajaxSetPresence', "'away'"));
$presencetpl->assign('calldnd', $this->genCallAjax('ajaxSetPresence', "'dnd'"));
$presencetpl->assign('callxa', $this->genCallAjax('ajaxSetPresence', "'xa'"));
$presencetpl->assign('calllogout', $this->genCallAjax('ajaxLogout'));
$html = $presencetpl->draw('_presence_list', true);
return $html;
}
function display()
{
}
}
?>

45
app/widgets/Presence/_presence_list.tpl

@ -1,23 +1,40 @@
{if="isset($p)"}
<div
id="logouttab"
class="{$txts[$p->value]}"
onclick="movim_toggle_class('#logoutlist', 'show');">
{$txt[$p->value]}
id="tab"
class="{$txts[$p->value]}">
<img class="avatar" src="{$contact->getPhoto('s')}"/>
<span class="bubble"></span>
<span class="arrow"><i class="fa fa-caret-down"></i></span>
<span class="name">{$contact->getTrueName()}</span>
<span class="status">{$p->status}</span>
</div>
{else}
<div
id="logouttab"
class="{$txts[1]}"
onclick="movim_toggle_class('#logoutlist', 'show');">
{$txt[1]}
id="tab"
class="{$txts[1]}">
<img class="avatar" src="{$contact->getPhoto('s')}"/>
<span class="arrow"><i class="fa fa-caret-down"></i></span>
<span class="name">{$contact->getTrueName()}</span>
</div>
{/if}
<div id="logoutlist">
<a onclick="{$callchat} movim_toggle_class('#logoutlist', 'show');" class="online">{$txt[1]}</a>
<a onclick="{$callaway} movim_toggle_class('#logoutlist', 'show');" class="away">{$txt[2]}</a>
<a onclick="{$calldnd} movim_toggle_class('#logoutlist', 'show');" class="dnd">{$txt[3]}</a>
<a onclick="{$callxa} movim_toggle_class('#logoutlist', 'show');" class="xa">{$txt[4]}</a>
<a onclick="{$calllogout} movim_toggle_class('#logoutlist', 'show');" class="disconnect">{$c->__('disconnect')}</a>
<div id="list">
<div class="tab">
<img class="avatar" src="{$contact->getPhoto('s')}"/>
<span class="arrow"><i class="fa fa-caret-up"></i></span>
<span class="name">{$contact->getTrueName()}</span>
</div>
<textarea
class="status"
spellcheck="false"
placeholder="{$c->__('status.here')}"
onload="movim_textarea_autoheight(this);"
onkeyup="movim_textarea_autoheight(this);">{$p->status}</textarea>
<a onclick="{$callchat} movim_toggle_class('#logoutlist', 'show');" class="online"><span class="bubble"></span>{$txt[1]}</a>
<a onclick="{$callaway} movim_toggle_class('#logoutlist', 'show');" class="away"><span class="bubble"></span>{$txt[2]}</a>
<a onclick="{$calldnd} movim_toggle_class('#logoutlist', 'show');" class="dnd"><span class="bubble"></span>{$txt[3]}</a>
<a onclick="{$callxa} movim_toggle_class('#logoutlist', 'show');" class="xa"><span class="bubble"></span>{$txt[4]}</a>
<a onclick="{$calllogout} movim_toggle_class('#logoutlist', 'show');" class="disconnect"><i class="fa fa-sign-out"></i>{$c->__('disconnect')}</a>
</div>

1
app/widgets/Presence/locales.ini

@ -1 +1,2 @@
disconnect = 'Disconnect'
status.here = 'Your status here !'

161
app/widgets/Presence/presence.css

@ -1,72 +1,125 @@
#logout {
font-size: 1em;
color: #ccc;
#presence_widget {
color: white;
font-weight: bold;
width: 15rem;
position: fixed;
top: 0;
right: 0;
z-index: 5;
}
#logout .online { background-image: url(img/online.svg); }
#logout .away { background-image: url(img/away.svg); }
#logout .dnd { background-image: url(img/dnd.svg); }
#logout .xa { background-image: url(img/xa.svg); }
#logout .disconnect { background-image: url(img/exit.svg); text-decoration: none;}
#logouttab {
top: 0px;
cursor: pointer;
z-index: 5;
line-height: 3em;
background-repeat: no-repeat;
background-position: 1em center;
color: white;
width: 7em;
#presence_widget img.avatar {
width: 2em;
float: left;
border-radius: 3em;
position: relative;
margin-right: 1em;
}
transition: background 1s;
border-left: 1px solid rgba(0, 0, 0, 0.1);
#presence_widget span.bubble {
left: 1.7em;
top: 1.7em;
width: 0.9em;
height: 0.9em;
box-shadow: 0 0 2px rgba(0, 0, 0, 1);
border-radius: 2em;
display: inline-block;
position: absolute;
}
#logouttab, #logoutlist {
position: fixed;
right: 15rem;
overflow: hidden;
text-overflow: ellipsis;
#presence_widget .online span.bubble { background-color: #6FCC43; }
#presence_widget .away span.bubble { background-color: #FFE433; }
#presence_widget .dnd span.bubble { background-color: #D92727; }
#presence_widget .xa span.bubble { background-color: #442178; }
#presence_widget span.name,
#presence_widget span.status {
line-height: 1em;
display: inline-block;
white-space: nowrap;
padding-left: 3em;
padding-right: 1em;
background-size: 16px 16px;
text-overflow: ellipsis;
}
#presence_widget span.status {
font-weight: normal;
font-size: 0.8em;
color: #DDD;
}
#presence_widget span.arrow {
float: right;
padding: 0.5em;
}
#presence_widget textarea.status {
margin: 0.5em 0;
padding: 0.5em;
box-sizing: border-box;
border: 0;
width: 100%;
border-bottom: 1px solid #D4D4D4;
height: 2.7em;
resize: none;
}
#presence_widget #tab {
padding: 0.3em;
margin: 0.2em;
}
#presence_widget #tab:hover {
cursor: pointer;
border-radius: 0.05em;
background-color: rgba(255, 255, 255, 0.2);
}
#logouttab:hover {
background-color: rgba(0, 0, 0, 0.3);
#presence_widget #list {
background-color: white;
padding: 0.3em;
margin: 0.2em;
color: #333;
position: relative;
display: none;
top: -2.8em;
border-radius: 0.05em;
box-shadow: 0 0 0.3em rgba(0, 0, 0, 0.4);
}
#logoutlist {
top: -100%;
transition: top 0.5s ease;
z-index: 1;
background-color: rgba(20, 20, 20, 0.9);
width: 10em;
#presence_widget #list .tab:hover {
cursor: pointer;
}
#logoutlist.show {
top: 3em;
#presence_widget #list span.name {
line-height: 2em;
padding-bottom: 0.5em;
}
#logoutlist a {
#presence_widget #list a {
position: relative;
clear: both;
display: block;
line-height: 3em;
background-repeat: no-repeat;
background-position: 1em center;
background-size: 16px 16px;
padding-left: 3em;
padding-right: 1em;
margin-left: -3em;
margin-right: -1em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: white;
font-weight: normal;
line-height: 2.8em;
padding: 0 1em;
margin: -0.3em;
}
#presence_widget #list a:hover {
cursor: pointer;
background-color: rgba(0, 0, 0, 0.05);
}
#presence_widget #list a i {
float: right;
line-height: 2.8em;
margin: 0;
}
#logoutlist a:hover {
cursor: pointer;
background-color: rgba(0, 0, 0, 0.1);
#presence_widget #list span.bubble {
box-shadow: none;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.1);
display: inline-block;
float: right;
margin-top: 1.1em;
position: initial;
}

20
app/widgets/Presence/presence.js

@ -1,14 +1,32 @@
function postStart() {
if(localStorage.postStart == 1) {
Presence_ajaxSetStatus('boot');
Presence_ajaxConfigGet();
Presence_ajaxServerCapsGet();
Presence_ajaxBookmarksGet();
Presence_ajaxSetPresence();
localStorage.postStart = 0;
}
}
function setPresenceActions() {
document.querySelector('#presence_widget textarea.status').onkeypress = function(event) {
if(event.keyCode == 13) {
Presence_ajaxSetStatus(this.value);
this.blur();
}
};
document.querySelector('#presence_widget #tab').onclick = function(event) {
movim_toggle_display('#presence_widget #list');
};
document.querySelector('#presence_widget #list .tab').onclick = function(event) {
movim_toggle_display('#presence_widget #list');
};
}
movim_add_onload(function()
{
setPresenceActions();
postStart();
});

2
app/widgets/Presence/presence.tpl

@ -1,3 +1,3 @@
<div id="logout">
<div id="presence_widget">
{$c->preparePresence()}
</div>

95
app/widgets/Profile/Profile.php

@ -40,100 +40,15 @@ class Profile extends WidgetCommon
$html = $this->prepareVcard($vcard);
RPC::call('movim_fill', 'profile', $html);
}
function onMyPresence()
{
RPC::call('movim_fill', 'statussaved', '✔ '.$this->__('status.saved'));
Notification::appendNotification($this->__('status.updated'), 'success');
}
function ajaxSetStatus($status)
{
$status = htmlspecialchars(rawurldecode($status));
// We update the cache with our status and presence
$presence = Cache::c('presence');
Cache::c(
'presence',
array(
'status' => $status,
'show' => $presence['show'],
)
);
switch($presence['show']) {
case 'chat':
$p = new Chat;
$p->setStatus($status)->request();
break;
case 'away':
$p = new Away;
$p->setStatus($status)->request();
break;
case 'dnd':
$p = new DND;
$p->setStatus($status)->request();
break;
case 'xa':
$p = new XA;
$p->setStatus($status)->request();
break;
default :
$p = new Chat;
$p->setStatus($status)->request();
break;
}
}
function prepareVcard($vcard = false)
{
$cd = new modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$contact = $cd->get($this->user->getLogin());
$presence = Cache::c('presence');
$html = '';
if(isset($contact)) {
$me = $contact;
// My avatar
$html .= '
<a
class="avatar"
style="background-image: url('.$me->getPhoto('l').');"
href="'.Route::urlize('friend',$this->user->getLogin()).'">
</a>';
// Contact general infos
$html .= '
<h1 class="padded" style="text-decoration: none;">'.$me->getTrueName().'</h1>';
$html .= '
<div class="textbubble">
<textarea
id="status"
spellcheck="false"
placeholder="'.$this->__('status.here').'"
onfocus="this.style.fontStyle=\'italic\'; this.parentNode.querySelector(\'#statussaved\').innerHTML = \'\'"
onblur="this.style.fontStyle=\'normal\';"
onkeypress="if(event.keyCode == 13) {'.$this->genCallAjax('ajaxSetStatus', 'encodeURIComponent(this.value)').'; this.blur(); return false;}"
onload="movim_textarea_autoheight(this);"
onkeyup="movim_textarea_autoheight(this);">'.$presence['status'].'</textarea>
<div id="statussaved" style="text-align: right;"></div>
</div>
';
} else {
$html .= '
<div class="not_yet">
'.t('No profile yet ?').'<br /><br />
<a
class="button color green icon add"
style="color: white;"
href="'.Route::urlize('profile').'">'.t("Create my vCard").'</a>
</div>';
$vcardview = $this->tpl();
$vcardview->assign('contact', $contact);
}
return $html;
return $vcardview->draw('_profile_vcard', true);
}
}

19
app/widgets/Profile/_profile_vcard.tpl

@ -0,0 +1,19 @@
{if="isset($contact)"}
<div class="card">
<a href="{$c->route('friend', $contact->jid)}">
<img src="{$contact->getPhoto('l')}"/>
<h1 style="text-decoration: none;">{$contact->getTrueName()}</h1>
</a>
<a href="{$c->route('profile')}">
<i class="fa fa-pencil"></i>
</a>
</div>
{else}
<div class="not_yet">
{$c->__('profile.not_yet')}<br /><br />
<a
class="button color green icon add"
style="color: white;"
href="{$c->route('profile')}">{$c->__('profile.create')}</a>
</div>
{/if}

5
app/widgets/Profile/locales.ini

@ -1,3 +1,2 @@
status.updated = 'Status updated'
status.saved = 'Saved'
status.here = 'Your status here !'
profile.not_yet = 'No profile yet?'
profile.create = 'Create my profile'

54
app/widgets/Profile/profile.css

@ -1,47 +1,41 @@
#profile_widget {
background-color: rgba(20, 20, 20, 0.5);
line-height: 1.5em;
position: relative;
width: 100%;
border-bottom: 1px solid #D4D4D4;
}
#profile_widget h1 {
color: white;
line-height: 1.5em;
#profile_widget .card {
padding: 1em 0.5em;
box-sizing: border-box;
}
#profile_widget a.avatar {
width: 100%;
padding-bottom: 100%;
display: block;
background-size: 100%;
#profile_widget .card img {
width: 3em;
border-radius: 2em;
float: left;
margin-right: 0.75em;
}
#profile_widget .textbubble {
margin-top: 1em;
background-color: rgba(20, 20, 20, 0.7);
padding: 1em;
}
#profile_widget .textbubble textarea {
background-color: transparent;
border: 1px solid transparent;
border-bottom: 1px solid #333;
font-size: 0.9em;
width: 100%;
resize: none;
color: white;
text-align: center;
padding: 0px;
#profile_widget .card h1 {
line-height: 1.5em;
color: #242424;
margin-top: -0.2em;
font-size: 1.2em;
}
#profile_widget .textbubble textarea:hover {
border-color: white;
#profile_widget .card i {
float: right;
font-size: 1.2em;
margin-top: -1.2em;
opacity: 0.5;
}
#profile_widget textarea#status {
overflow: hidden;
#profile_widget .card i:hover {
opacity: 1;
}
#profile_widget .not_yet {
padding: 1em;
text-align: center;
}

65
app/widgets/Roster/roster.css

@ -33,9 +33,15 @@
#roster input[name=search] {
background-image: url(img/search.png);
background-repeat: no-repeat;
padding-left: 3em;
background-position: 1em center;
background-color: white;
padding-left: 2em;
color: white;
background-position: 0.5em center;
/*background-color: white;*/
background-color: #454545;
height: 2em;
width: calc(100% - 1em);
margin: 0.5em;
border-radius: 0.2em;
}
#rostermenu input[name=searchjid]:invalid {
@ -63,6 +69,7 @@
#roster ul#rosterlist div ul.contact li {
display: none;
position: relative;
}
#roster ul#rosterlist > div {
@ -107,34 +114,34 @@
/* The list */
#roster ul#rosterlist h1 {
padding: 1em;
color: #777;
margin-top: 0.5em;
padding: 0.75em;
text-indent: 0.25em;
color: #BBB;
line-height: 1em;
font-size: 1em;
text-shadow: 0px -0.1em 0px rgba(0, 0, 0, 0.5);
text-transform: uppercase;
font-weight: bold;
opacity: 0.5;
}
#roster ul#rosterlist h1:before {
#roster ul#rosterlist h1:hover {
cursor: pointer;
content: "+";
width: 20px;
padding-right: 5px;
display: inline-block;
text-align: center;
}
#roster ul#rosterlist div.groupshown h1:before {
content: "-";
#roster ul#rosterlist div.groupshown h1 {
opacity: 1;
}
#roster ul#rosterlist ul.contact li img {
max-height: 3em;
float: left;
width: 3em;
height: 3em;
margin-right: 0.5em;
margin-top: -0.5em;
width: 2.5em;
height: 2.5em;
margin: 0 0.75em;
position: relative;
top: -0.2em;
border-radius: 2em;
}
#roster ul#rosterlist ul.contact li a {
@ -160,17 +167,25 @@
/* Chat button */
#roster ul#rosterlist ul.contact li .chat {
width: 0.5em;
height: 3em;
float: right;
width: 0.9em;
height: 0.9em;
left: 2.4em;
box-shadow: 0 0 2px rgba(0, 0, 0, 1);
top: 2em;
position: absolute;
z-index: 2;
border-radius: 2em;
background-color: #DDD;
transition: width 0.5s ease;
transition: width 0.5s ease, height 0.5s ease, top 0.5s ease, left 0.5s ease;
}
#roster ul#rosterlist ul.contact li:hover .chat {
width: 3em;
width: 2.5em;
height: 2.5em;
top: 0.3em;
left: 0.75em;
background-image: url(img/bubbles.svg);
background-size: 1.3em 1.3em;
background-size: 1.4em;
background-repeat: no-repeat;
background-position: center center;
}

22
app/widgets/Tabs/tabs.css

@ -3,35 +3,37 @@
margin: 0px;
padding: 0px;
text-align: center;
border-bottom: 1px solid #DCDCDC;
overflow: hidden;
background-color: white;
}
#navtabs li {
display: inline-block;
cursor: pointer;
padding: 0em 2em;
white-space: nowrap;
font-weight: bold;
padding: 0em 1em;
transition: background 0.5s;
}
#navtabs li a{
#navtabs li a {
display: block;
line-height: 3em;
padding: 0em 1em;
width:100%;
color: white;
text-decoration: none;
color: #888;
}
#navtabs li:hover {
background-color: rgba(0, 0, 0, 0.3);
}
#navtabs li.on {
background-color: white;
#navtabs li:hover a {
border-bottom: 2px solid #EEE;
}
#navtabs li.on a {
color: #445157;
border-bottom: 2px solid #DCDCDC;
}
.tabelem{

36
bootstrap.php

@ -47,6 +47,7 @@ class Bootstrap {
if($loadmodlsuccess) {
$this->startingSession();
$this->loadLanguage();
} else {
throw new Exception('Error loading Modl');
}
@ -149,8 +150,13 @@ class Bootstrap {
$uri = str_replace('jajax.php', '', $uri);
return 'http://localhost/0.9/';
//return $uri;
if(getenv('baseuri') != null
&& filter_var(getenv('baseuri'), FILTER_VALIDATE_URL)
&& sizeof(getenv('baseuri')) < 32) {
return getenv('baseuri');
} else {
return $uri;
}
}
private function loadSystem() {
@ -202,6 +208,32 @@ class Bootstrap {
require_once(APP_PATH . "widgets/WidgetCommon/WidgetCommon.php");
require_once(APP_PATH . "widgets/Notification/Notification.php");
}
/**
* Loads up the language, either from the User or default.
*/
function loadLanguage() {
$user = new User();
$cd = new \Modl\ConfigDAO();
$config = $cd->get();
if($user->isLogged()) {
$lang = $user->getConfig('language');
if(isset($lang)) {
loadLanguage($lang);
} else {
// Load default language.
loadLanguage($config->locale);
}
}
else if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
loadLanguageAuto();
}
else {
loadLanguage($config->locale);
}
}
private function setLogs() {
/*$cd = new \Modl\ConfigDAO();

9
src/Movim/Daemon/Behaviour.php

@ -48,7 +48,14 @@ class Behaviour implements MessageComponentInterface {
$from->send(json_encode('session linked'));
$loop = \React\EventLoop\Factory::create();
$this->process = new \React\ChildProcess\Process('php linker.php', null, array('sid' => $from->sid));
$this->process = new \React\ChildProcess\Process(
'php linker.php',
null,
array(
'sid' => $from->sid,
'baseuri' => $msg->baseuri
)
);
$this->process->start($loop);
}

74
system/RPC.php

@ -1,17 +1,14 @@
<?php
if (!defined('DOCUMENT_ROOT')) die('Access denied');
/**
* @file RPC.php
* This file is part of PROJECT.
* This file is part of Movim
*
* @brief Description
* @brief Handle incoming requests and call the widgets
*
* @author Etenil <etenil@etenilsrealm.nl>
* @author Jaussoin Timothée
*
* @version 1.0
* @date 20 February 2011
*
* Copyright (C)2011 Etenil
* @date 28 october 2014
*
* All rights reserved.
*/
@ -69,17 +66,6 @@ class RPC
*/
public static function commit()
{
// Cleaning rubbish.
//ob_clean();
//ob_start();
// Just in case (warning)
if(!is_array(self::$funcalls)) {
self::$funcalls = array('ping');
}
//header('Content-Type: application/json');
//printf('%s', json_encode(self::$funcalls));
return self::$funcalls;
}
@ -91,40 +77,30 @@ class RPC
/**
* Handles incoming requests.
*/
public function handle_json($content = false)
{
if($content && $content != '') {
$json = $content;
} else {
$json = file_get_contents('php://input');
}
public function handle_json($json)
{
$request = json_decode($json);
if(isset($_GET['do']) && $_GET['do'] == 'poll') {
\Moxl\API::ping();
} /*elseif((string)$request->widget == 'lazy') {
$l = new Lazy($request->params[0], $request->params[1]);
}*/ else {
// Loading the widget.
$widget_name = (string)$request->widget;
// Preparing the parameters and calling the function.
$params = (array)$request->params;
$result = array();
foreach($params as $p) {
if(is_object($p) && isset($p->container))
array_push($result, (array)$p->container);
else
array_push($result, $p);
}
$widgets = WidgetWrapper::getInstance(false);
$widgets->runWidget($widget_name, (string)$request->func, $result);
// Loading the widget.
$widget_name = (string)$request->widget;
// Preparing the parameters and calling the function.
$params = (array)$request->params;
$result = array();
$bc = new Bootstrap;
$bc->loadLanguage();
foreach($params as $p) {
if(is_object($p) && isset($p->container))
array_push($result, (array)$p->container);
else
array_push($result, $p);
}
$widgets = WidgetWrapper::getInstance(false);
$widgets->runWidget($widget_name, (string)$request->func, $result);
}
}

3
system/Sessionx.php

@ -147,8 +147,7 @@ class Sessionx {
'user',
'config',
'password',
'start',
'ressource')
'start')
)
) {
$key = '_'.$key;

29
system/controllers/BaseController.php

@ -7,7 +7,7 @@ class BaseController {
protected $page;
function __construct() {
$this->loadLanguage();
//this->loadLanguage();
$this->page = new TplPageBuilder();
$this->page->addScript('movim_hash.js');
$this->page->addScript('movim_utils.js');
@ -17,33 +17,6 @@ class BaseController {
$this->page->addScript('movim_websocket.js');
}
/**
* Loads up the language, either from the User or default.
*/
function loadLanguage() {
$user = new User();
$cd = new \Modl\ConfigDAO();
$config = $cd->get();
if($user->isLogged()) {
$lang = $user->getConfig('language');
if(isset($lang)) {
loadLanguage($lang);
} else {
// Load default language.
loadLanguage($config->locale);
}
}
else if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
loadLanguageAuto();
}
else {
loadLanguage($config->locale);
}
}
/**
* Returns the value of a $_GET variable. Mainly used to avoid getting
* notices from PHP when attempting to fetch an empty variable.

62
themes/movim/css/nav.css

@ -18,16 +18,11 @@ nav {
-webkit-animation: 200s infinite colorful;
}
nav .wrapper {
background-color: rgba(255, 255, 255, 0.1);
}
.menu {
width: 100%;
margin: 0px auto;
list-style-type: none;
height: 3em;
overflow: hidden;
margin: 0 auto;
list-style-type: none;
}
.menu li {
@ -35,6 +30,33 @@ nav .wrapper {
float: left;
}
.menu li a, .menu li label {
padding: 1em;
line-height: 1em;
color: white;
text-decoration: none;
font-weight: bold;
opacity: 0.5;
transition: opacity 0.3s;
}
.menu li a.root {
width: 12rem;
color: transparent;
background: url(../img/logo.svg) no-repeat center center;
height: 3em;
padding: 0;
display: block;
}
.menu li a:not(.active):hover, .menu li label:hover {
cursor: pointer;
opacity: 0.9;
}
.menu li a.active {
opacity: 1;
}
.menu li a, .menu li label {
display: inline-block;
line-height: 0;
@ -48,30 +70,7 @@ nav .wrapper {
background-repeat: no-repeat;
background-size: 16px 16px;
background-position: 1em center;
}
.menu li a.root, .menu li a.root.active {
width: 12rem;
color: transparent;
background-image: url(../img/logo.svg);
background-size: auto auto;
background-position: center center;
padding-left: 0;
padding-right: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
border-right: 1px solid rgba(0, 0, 0, 0.1);
}
.menu li a:hover, .menu li label:hover {
background-color: rgba(0, 0, 0, 0.2);
cursor: pointer;
}
.menu li a.active {
background-color: rgba(0, 0, 0, 0.3);
opacity: 0.5;
}
.menu li .discover,
@ -140,3 +139,4 @@ ul li input[type=checkbox]:checked ~ .tabbed {
z-index: 3;
}
}

3
themes/movim/css/posts.css

@ -19,6 +19,7 @@ article header img {
float: left;
width: 4em;
margin-right: 1em;
border-radius: 0.2em;
}
article header span {
@ -55,7 +56,7 @@ article footer {
border-left: 1px solid #F1F1F1;
border-right: 1px solid #EEE;
border-top: 1px solid #F2F2F2;
background-color: #F5F7FA;
background-color: #F2F2F2;
}
article footer .comments {

39
themes/movim/css/style.css

@ -48,14 +48,11 @@ body {
line-height: 1em;
color: #4E4E4E;
animation: 200s infinite colorful;
-webkit-animation: 200s infinite colorful;
margin: 0 auto;
width: 100%;
padding-right: 15rem;
background-color: #32434D;
background-color: white;
box-sizing: border-box;
-webkit-box-sizing: border-box;
@ -142,7 +139,7 @@ h2.post-title {
}
h3 {
color: #BBB;
color: #555;
line-height: 2em;
}
@ -216,11 +213,7 @@ ul.clean li {
}
#main {
/*background-color: #383735;*/
background-color: rgba(20, 20, 20, 0.7);
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: rgba(0, 0, 0, 0.05);
}
#main:after {
@ -235,16 +228,26 @@ ul.clean li {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
position: relative;
float: left;
width: 12rem;
color: white;
top: 0;
overflow: hidden;
}
#left:before {
background-image: linear-gradient(to left, rgba(0, 0, 0, 0.05), transparent);
pointer-events:none;
content: "";
display: block;
position: absolute;
top: 0;
right: 0;
width: 1em;
height: 100%;
}
#left a:not(.button):link,
#left a:not(.button):visited {
color: #94A6B0;
text-decoration: none;
}
@ -252,10 +255,6 @@ ul.clean li {
list-style-type: none;
}
#left h2 {
margin-top: 1em;
}
#center
{
background-color: white;
@ -270,7 +269,7 @@ ul.clean li {
display: block;
width: 15rem;
position: fixed;
top: 0;
top: 3em;
right: 0;
padding-top: 0em;
height: 100%;
@ -280,14 +279,14 @@ ul.clean li {
}
#right:after {
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.3), transparent);
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.4), transparent);
pointer-events:none;
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
width: 0.7em;
width: 1em;
height: 100%;
}

Loading…
Cancel
Save