From 8148e1d3ee44e2bf65c626ed94b81b3c0e04ebcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaussoin=20Timoth=C3=A9e?= Date: Sun, 12 Apr 2015 11:38:51 +0200 Subject: [PATCH] - Start the implementation of contextual menu - Add gray chevrons on some links - Use EOF to signalise the end of a block in the daemon - Refresh the user feed on login - Fix some CSS --- app/widgets/Contact/_contact.tpl | 2 +- app/widgets/Hello/hello.tpl | 7 ++++--- app/widgets/Help/help.tpl | 35 ++++++++++++++----------------- app/widgets/Menu/_menu_list.tpl | 6 +++++- app/widgets/Menu/locales.ini | 1 + app/widgets/Presence/Presence.php | 10 +++++++++ app/widgets/Presence/presence.js | 1 + linker.php | 16 +++++++------- src/Movim/Daemon/Session.php | 6 +++--- themes/material/css/color.css | 4 ++++ themes/material/css/list.css | 17 +++++++-------- themes/material/css/menu.css | 3 +-- themes/material/css/style.css | 18 +++++++++++----- 13 files changed, 75 insertions(+), 51 deletions(-) diff --git a/app/widgets/Contact/_contact.tpl b/app/widgets/Contact/_contact.tpl index 0c85c6f86..0c071dd80 100644 --- a/app/widgets/Contact/_contact.tpl +++ b/app/widgets/Contact/_contact.tpl @@ -24,7 +24,7 @@ {if="$caps"} -
  • +
  • type == 'handheld' || $caps->type == 'phone'"} diff --git a/app/widgets/Hello/hello.tpl b/app/widgets/Hello/hello.tpl index 7daadf100..6c0a087cc 100644 --- a/app/widgets/Hello/hello.tpl +++ b/app/widgets/Hello/hello.tpl @@ -40,7 +40,8 @@ -

    {$c->__('banner.info1')}

    • - + {$c->__('banner.white')}
    • diff --git a/app/widgets/Menu/_menu_list.tpl b/app/widgets/Menu/_menu_list.tpl index db1a8d720..12886b538 100644 --- a/app/widgets/Menu/_menu_list.tpl +++ b/app/widgets/Menu/_menu_list.tpl @@ -41,8 +41,12 @@ {else} {$c->__('menu.contact_post')} {/if} + {if="$value->privacy"} + + + + {/if} {$value->published|strtotime|prepareDate} -

      {if="current(explode('.', $value->origin)) != 'nsfw'"} {$value->contentcleaned|strip_tags:''} diff --git a/app/widgets/Menu/locales.ini b/app/widgets/Menu/locales.ini index a3aad6013..d20f84f22 100644 --- a/app/widgets/Menu/locales.ini +++ b/app/widgets/Menu/locales.ini @@ -2,3 +2,4 @@ menu.empty_title = 'Hello' menu.contact_post = 'Contact post' menu.empty = 'Welcome on your news feed, here you will see all the posts published in the groups you have subscribed.' menu.refresh = 'Refreshing all the streams' +menu.public = 'This post is public' diff --git a/app/widgets/Presence/Presence.php b/app/widgets/Presence/Presence.php index 451aa6ba4..b4a1e26dc 100755 --- a/app/widgets/Presence/Presence.php +++ b/app/widgets/Presence/Presence.php @@ -23,6 +23,7 @@ use Moxl\Xec\Action\Presence\Away; use Moxl\Xec\Action\Presence\DND; use Moxl\Xec\Action\Presence\XA; use Moxl\Xec\Action\Presence\Unavailable; +use Moxl\Xec\Action\Pubsub\GetItems; use Moxl\Stanza\Stream; use Moxl\Xec\Action\Storage\Get; @@ -145,6 +146,15 @@ class Presence extends WidgetBase } } + // We refresh our personnal feed + function ajaxFeedRefresh() + { + $r = new GetItems; + $r->setTo($this->user->getLogin()) + ->setNode('urn:xmpp:microblog:0') + ->request(); + } + function ajaxOpenDialog() { Dialog::fill($this->preparePresenceList()); diff --git a/app/widgets/Presence/presence.js b/app/widgets/Presence/presence.js index 97944d775..77f725880 100644 --- a/app/widgets/Presence/presence.js +++ b/app/widgets/Presence/presence.js @@ -8,6 +8,7 @@ function postStart() { Presence_ajaxServerCapsGet(); Presence_ajaxBookmarksGet(); Presence_ajaxUserRefresh(); + Presence_ajaxFeedRefresh(); //Menu_ajaxRefresh(); localStorage.postStart = 0; } diff --git a/linker.php b/linker.php index 98463048a..020390643 100755 --- a/linker.php +++ b/linker.php @@ -72,7 +72,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st if(!empty($msg)) { $msg = json_encode($msg); #fwrite(STDERR, colorize($msg, 'yellow')." : ".colorize('sent to browser', 'green')."\n"); - echo base64_encode(gzcompress($msg, 9))."END"; + echo base64_encode(gzcompress($msg, 9)).""; } if(!empty($xml)) { @@ -93,8 +93,8 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st $stdin->removeAllListeners('data'); $stdin->on('data', function ($data) use ($conn, $loop, &$buffer) { // A little bit of signalisation to use properly the buffer - if(substr($data, -3) == "END") { - $messages = explode("END", $buffer . substr($data, 0, -3)); + if(substr($data, -1) == "") { + $messages = explode("", $buffer . substr($data, 0, -1)); $buffer = ''; foreach ($messages as $message) { @@ -127,7 +127,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st if(!empty($msg)) { #fwrite(STDERR, colorize($msg, 'yellow')." : ".colorize('sent to the browser', 'green')."\n"); - echo base64_encode(gzcompress($msg, 9))."END"; + echo base64_encode(gzcompress($msg, 9)).""; } } } else { @@ -139,15 +139,15 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st $obj = new \StdClass; $obj->func = 'registered'; - echo base64_encode(gzcompress(json_encode($obj), 9))."END"; + echo base64_encode(gzcompress(json_encode($obj), 9)).""; }); // Fallback event, when the WebSocket is not enabled, // we still handle browser to Movim requests $stdin->on('data', function ($data) use ($loop) { if(!isset($buffer)) $buffer = ''; - if(substr($data, -3) == "END") { - $messages = explode("END", $buffer . substr($data, 0, -3)); + if(substr($data, -1) == "") { + $messages = explode("", $buffer . substr($data, 0, -1)); $buffer = ''; foreach ($messages as $message) { @@ -173,7 +173,7 @@ $stdin->on('data', function ($data) use ($loop) { if(!empty($msg)) { #fwrite(STDERR, colorize($msg, 'yellow')." : ".colorize('sent to the browser', 'green')."\n"); - echo base64_encode(gzcompress($msg, 9))."END"; + echo base64_encode(gzcompress($msg, 9)).""; } } } else { diff --git a/src/Movim/Daemon/Session.php b/src/Movim/Daemon/Session.php index fac82a747..142d1cf77 100644 --- a/src/Movim/Daemon/Session.php +++ b/src/Movim/Daemon/Session.php @@ -58,8 +58,8 @@ class Session { // Buffering the incoming data and fire it once its complete $this->process->stdout->on('data', function($output) use ($me, &$buffer) { - if(substr($output, -3) == "END") { - $out = $buffer . substr($output, 0, -3); + if(substr($output, -1) == "") { + $out = $buffer . substr($output, 0, -1); $buffer = ''; $me->messageOut($out); } else { @@ -99,7 +99,7 @@ class Session { { $this->timestamp = time(); if(isset($this->process)) { - $this->process->stdin->write($msg."END"); + $this->process->stdin->write($msg.""); } } diff --git a/themes/material/css/color.css b/themes/material/css/color.css index 39754c947..589505477 100644 --- a/themes/material/css/color.css +++ b/themes/material/css/color.css @@ -70,6 +70,7 @@ span.icon.status.away:after, .bubble.color.yellow, .icon.color.yellow { color: white; background-color: #FDD835; border-color: #FDD835 } .bubble.color.brown , .icon.color.brown { color: white; background-color: #795548; border-color: #795548 } .bubble.color.gray , .icon.color.gray { color: white; background-color: #9E9E9E; border-color: #9E9E9E } +.bubble.color.black , .icon.color.black { color: white; background-color: #000; border-color: #000 } label.red , .icon.red , span.user.red { color: #F44336; } label.purple, .icon.purple, span.user.purple { color: #9C27B0; } @@ -79,7 +80,10 @@ label.green , .icon.green , span.user.green { color: #689F38; } label.orange, .icon.orange, span.user.orange { color: #FF9800; } label.yellow, .icon.yellow, span.user.yellow { color: #FFEB3B; } label.brown , .icon.brown , span.user.brown { color: #795548; } +ul li.action > div.action, +ul li.action > form > div.action, label.gray , .icon.gray , span.user.gray { color: #9E9E9E; } +label.black , .icon.black , span.user.black { color: #000; } form input:focus:invalid, form textarea:focus:invalid { diff --git a/themes/material/css/list.css b/themes/material/css/list.css index ff7e36f7d..722ce2e7c 100644 --- a/themes/material/css/list.css +++ b/themes/material/css/list.css @@ -108,7 +108,8 @@ ul.thick li.condensed p { margin-bottom: 0; } -ul li > p { +ul li > p, +ul li > a > p { display: block; font-size: 1.75rem; color: rgba(0, 0, 0, 0.60); @@ -291,17 +292,15 @@ ul.tabs li.active { /* Menu */ -ul.menu { +ul.context_menu { border-radius: 0.25rem; display: inline-block; - height: 5rem; - margin-left: 1rem; overflow: hidden; -} - -ul.menu:hover { - height: auto; background-color: white; - color: black; + color: #333; + position: absolute; + top: 1rem; + right: 1rem; + z-index: 3; box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.26), 0px 2px 10px 0px rgba(0, 0, 0, 0.16); } diff --git a/themes/material/css/menu.css b/themes/material/css/menu.css index 20e97d9dc..06a29a61d 100644 --- a/themes/material/css/menu.css +++ b/themes/material/css/menu.css @@ -1,4 +1,4 @@ -/* Menu */ +/* Menu header */ body > nav > ul span.icon { left: 1rem; @@ -46,4 +46,3 @@ ul.oppose { width: 100%; min-width: 10rem; } - diff --git a/themes/material/css/style.css b/themes/material/css/style.css index b433ce836..9d49d9bb9 100644 --- a/themes/material/css/style.css +++ b/themes/material/css/style.css @@ -222,7 +222,7 @@ nav + main { main > header { position: relative; height: 7rem; - overflow: hidden; + /*overflow: hidden;*/ box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.2); z-index: 2; } @@ -232,7 +232,7 @@ main > header > div { position: relative; width: 30%; display: inline-block; - overflow: hidden; + /*overflow: hidden;*/ box-sizing: border-box; padding-right: 1rem; } @@ -243,12 +243,12 @@ main > header > div > * { overflow: hidden; } -main > header > div > ul.active { +main > header > div > ul.active:not(.context_menu) { float: right; margin-right: -1rem; } -main > header > div > ul.active li { +main > header > div > ul.active:not(.context_menu) > li { float: left; height: 7rem; min-width: 0; @@ -258,10 +258,18 @@ main > header > div > ul.active li { font-size: 4rem; } -main > header > div > ul.active li span.icon { +main > header > div > ul.active:not(.context_menu) > li.thin { + width: 5rem; +} + +main > header > div > ul.active:not(.context_menu) > li span.icon { left: 1rem; } +main > header > div > ul.active:not(.context_menu) > li.thin span.icon { + width: 3rem; +} + main > header > div:first-child:nth-last-child(2) ~ div { width: 70%; position: absolute;