Browse Source

- Remove a lot of old code

- Fix some CSS
- Fix the post links + pictures in the UI
- Add some filters in the events
- Change some UI strings
- Reimplement properly the comments (read-only)
pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
f4d2c89664
  1. 8
      app/assets/js/movim_tpl.js
  2. 5
      app/controllers/AboutController.php
  3. 3
      app/controllers/AccountController.php
  4. 3
      app/controllers/AccountnextController.php
  5. 3
      app/controllers/AdminController.php
  6. 4
      app/controllers/AdminloginController.php
  7. 7
      app/controllers/BlogController.php
  8. 18
      app/controllers/DiscoverController.php
  9. 21
      app/controllers/ExploreController.php
  10. 11
      app/controllers/FeedController.php
  11. 32
      app/controllers/FriendController.php
  12. 5
      app/controllers/LoginController.php
  13. 8
      app/controllers/MediaController.php
  14. 23
      app/controllers/NodeController.php
  15. 23
      app/controllers/NodeconfigController.php
  16. 2
      app/controllers/NotfoundController.php
  17. 4
      app/controllers/PodsController.php
  18. 19
      app/controllers/ProfileController.php
  19. 23
      app/controllers/ServerController.php
  20. 4
      app/models/postn/PostnDAO.php
  21. 12
      app/views/discover.tpl
  22. 24
      app/views/explore.tpl
  23. 1
      app/views/feed.tpl
  24. 21
      app/views/node.tpl
  25. 28
      app/views/nodeconfig.tpl
  26. 2
      app/views/page.tpl
  27. 27
      app/views/profile.tpl
  28. 25
      app/views/server.tpl
  29. 75
      app/widgets/Chat/Chat.php
  30. 13
      app/widgets/Chat/_chat_config_room.tpl
  31. 3
      app/widgets/Chat/_chat_header_room.tpl
  32. 4
      app/widgets/Chat/locales.ini
  33. 2
      app/widgets/Chats/_chats_item.tpl
  34. 37
      app/widgets/Contact/Contact.php
  35. 12
      app/widgets/Contact/_contact_header.tpl
  36. 15
      app/widgets/Discover/Discover.php
  37. 25
      app/widgets/Discover/discover.tpl
  38. 1
      app/widgets/Discover/locales.ini
  39. 52
      app/widgets/Explore/Explore.php
  40. 9
      app/widgets/Explore/_explore_chatrooms.tpl
  41. 9
      app/widgets/Explore/_explore_groups.tpl
  42. 36
      app/widgets/Explore/explore.tpl
  43. 5
      app/widgets/Explore/locales.ini
  44. 149
      app/widgets/Feed/Feed.php
  45. 4
      app/widgets/Feed/_feed_empty.tpl
  46. 3
      app/widgets/Feed/feed.css
  47. 31
      app/widgets/Feed/feed.tpl
  48. 4
      app/widgets/Feed/locales.ini
  49. 7
      app/widgets/Group/Group.php
  50. 4
      app/widgets/Group/_group_header.tpl
  51. 2
      app/widgets/Group/_group_posts.tpl
  52. 3
      app/widgets/Group/locales.ini
  53. 20
      app/widgets/Hot/Hot.php
  54. 25
      app/widgets/Hot/hot.tpl
  55. 1
      app/widgets/Hot/locales.ini
  56. 2
      app/widgets/Menu/Menu.php
  57. 2
      app/widgets/Menu/_menu_list.tpl
  58. 274
      app/widgets/Node/Node.php
  59. 105
      app/widgets/Node/_node_content.tpl
  60. 4
      app/widgets/Node/_node_empty.tpl
  61. 14
      app/widgets/Node/_node_metadata.tpl
  62. 7
      app/widgets/Node/locales.ini
  63. 34
      app/widgets/Node/node.tpl
  64. 121
      app/widgets/NodeConfig/NodeConfig.php
  65. 5
      app/widgets/NodeConfig/locales.ini
  66. 29
      app/widgets/NodeConfig/nodeconfig.tpl
  67. 2
      app/widgets/Notifs/_notifs_from.tpl
  68. 11
      app/widgets/Pods/pods.tpl
  69. 51
      app/widgets/Post/Post.php
  70. 28
      app/widgets/Post/_post.tpl
  71. 23
      app/widgets/Post/_post_comments.tpl
  72. 6
      app/widgets/Post/_post_header_create.tpl
  73. 2
      app/widgets/Post/locales.ini
  74. 53
      app/widgets/Profile/Profile.php
  75. 22
      app/widgets/Profile/_profile_vcard.tpl
  76. 2
      app/widgets/Profile/locales.ini
  77. 41
      app/widgets/Profile/profile.css
  78. 13
      app/widgets/Profile/profile.js
  79. 4
      app/widgets/Profile/profile.tpl
  80. 32
      app/widgets/Rooms/Rooms.php
  81. 5
      app/widgets/Rooms/_rooms_list.tpl
  82. 4
      app/widgets/Roster/Roster.php
  83. 1
      app/widgets/Roster/roster.js
  84. 5
      app/widgets/Roster/roster.tpl
  85. 165
      app/widgets/ServerNodes/ServerNodes.php
  86. 4
      app/widgets/ServerNodes/locales.ini
  87. 24
      app/widgets/ServerNodes/servernodes.tpl
  88. 118
      app/widgets/Wall/Wall.php
  89. 40
      app/widgets/Wall/_wall_head.tpl
  90. 2
      app/widgets/Wall/locales.ini
  91. 10
      app/widgets/Wall/wall.js
  92. 17
      app/widgets/Wall/wall.tpl
  93. 54
      lib/XMPPtoForm.php
  94. 6
      linker.php
  95. 2
      locales/locales.ini
  96. 31
      system/Route.php
  97. 1
      system/controllers/BaseController.php
  98. 65
      system/template/TplPageBuilder.php
  99. 5
      themes/material/css/article.css
  100. 22
      themes/material/css/style.css

8
app/assets/js/movim_tpl.js

@ -120,8 +120,12 @@ var MovimTpl = {
movim_remove_class('body > nav', 'active');
},
back : function() {
// If a dialog box is shown
if(Dialog.filled()) {
// If the contect menu is show
if(document.querySelector('ul.context_menu').className.contains('shown')) {
MovimTpl.toggleContextMenu(document);
}
// If a dialog box is show
else if(Dialog.filled()) {
Dialog.clear();
// If the menu is shown
} else if(movim_has_class('body > nav', 'active')) {

5
app/controllers/AboutController.php

@ -7,10 +7,5 @@ class AboutController extends BaseController {
function dispatch() {
$this->page->setTitle(__('title.about', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.discover'), 'discover');
$this->page->menuAddLink(__('page.pods'), 'pods');
$this->page->menuAddLink(__('page.about'), 'about', true);
}
}

3
app/controllers/AccountController.php

@ -7,8 +7,5 @@ class AccountController extends BaseController {
function dispatch() {
$this->page->setTitle(__('title.account', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.account_creation'), 'account', true);
}
}

3
app/controllers/AccountnextController.php

@ -7,8 +7,5 @@ class AccountnextController extends BaseController {
function dispatch() {
$this->page->setTitle(__('title.account', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.account_creation'), 'account', true);
}
}

3
app/controllers/AdminController.php

@ -10,9 +10,6 @@ class AdminController extends BaseController {
if(isset($_SESSION['admin']) && $_SESSION['admin'] == true) {
$this->page->setTitle(__('title.administration', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.administration'), 'admin', true);
} else {
$this->name = 'adminlogin';
}

4
app/controllers/AdminloginController.php

@ -10,10 +10,6 @@ class AdminloginController extends BaseController
function dispatch()
{
$this->page->setTitle(__('title.administration', APP_TITLE));
/*$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.administration'), 'admin', true);*/
$this->page->setColor('red');
$cd = new \Modl\ConfigDAO();
$config = $cd->get();

7
app/controllers/BlogController.php

@ -7,12 +7,5 @@ class BlogController extends BaseController {
function dispatch() {
$this->page->setTitle(__('title.blog', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.blog'), 'blog', true);
/*if(!\Modl\Privacy::get($_GET['f'])) {
$this->redirect('root');
}*/
}
}

18
app/controllers/DiscoverController.php

@ -1,18 +0,0 @@
<?php
/**
* Discover the XMPP network from the internet
*/
class DiscoverController extends BaseController {
function load() {
$this->session_only = false;
}
function dispatch() {
$this->page->setTitle(__('title.discover', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.discover'), 'discover', true);
$this->page->menuAddLink(__('page.pods'), 'pods');
$this->page->menuAddLink(__('page.about'), 'about');
}
}

21
app/controllers/ExploreController.php

@ -1,21 +0,0 @@
<?php
/**
* Explore the XMPP network
*/
class ExploreController extends BaseController {
function load() {
$this->session_only = true;
}
function dispatch() {
$this->page->setTitle(__('title.explore', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.news'), 'news');
$this->page->menuAddLink(__('page.explore'), 'explore', true);
$this->page->menuAddLink(__('page.profile'), 'profile');
$this->page->menuAddLink(__('page.media'), 'media');
$this->page->menuAddLink(__('page.configuration'), 'conf', false, true);
$this->page->menuAddLink(__('page.help'), 'help', false, true);
}
}

11
app/controllers/FeedController.php

@ -1,11 +0,0 @@
<?php
class FeedController extends BaseController {
function load() {
$this->session_only = false;
$this->raw = true;
}
function dispatch() {
}
}

32
app/controllers/FriendController.php

@ -1,32 +0,0 @@
<?php
class FriendController extends BaseController {
function load() {
$this->session_only = true;
}
function dispatch() {
if(isset($_GET['f']) && $_GET['f'] != "" ) {
$user = new User();
$cd = new \modl\ContactDAO();
$contact = $cd->get($_GET['f']);
if(isset($contact))
$name = $contact->getTrueName();
else
$name = $_GET['f'];
$this->page->setTitle(APP_TITLE.' - '.$name);
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.news'), 'news');
$this->page->menuAddLink(__('page.explore'), 'explore');
$this->page->menuAddLink(__('page.profile'), 'profile');
$this->page->menuAddLink(__('page.media'), 'media');
$this->page->menuAddLink(__('page.configuration'), 'conf', false, true);
$this->page->menuAddLink(__('page.help'), 'help', false, true);
} else {
$this->name = 'main';
}
}
}

5
app/controllers/LoginController.php

@ -7,11 +7,6 @@ class LoginController extends BaseController {
function dispatch() {
$this->page->setTitle(__('title.login', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root', true);
$this->page->menuAddLink(__('page.discover'), 'discover');
$this->page->menuAddLink(__('page.pods'), 'pods');
$this->page->menuAddLink(__('page.about'), 'about');
$user = new User();
if($user->isLogged()) {

8
app/controllers/MediaController.php

@ -7,13 +7,5 @@ class MediaController extends BaseController {
function dispatch() {
$this->page->setTitle(__('title.media', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.news'), 'news');
$this->page->menuAddLink(__('page.explore'), 'explore');
$this->page->menuAddLink(__('page.profile'), 'profile');
$this->page->menuAddLink(__('page.media'), 'media', true);
$this->page->menuAddLink(__('page.configuration'), 'conf', false, true);
$this->page->menuAddLink(__('page.help'), 'help', false, true);
}
}

23
app/controllers/NodeController.php

@ -1,23 +0,0 @@
<?php
class NodeController extends BaseController {
function load() {
$this->session_only = true;
}
function dispatch() {
if(isset($_GET['s']) && $_GET['s'] != "" ) {
$this->page->setTitle(__('title.node', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.news'), 'news');
$this->page->menuAddLink(__('page.explore'), 'explore');
$this->page->menuAddLink(__('page.profile'), 'profile');
$this->page->menuAddLink(__('page.media'), 'media');
$this->page->menuAddLink(__('page.configuration'), 'conf', false, true);
$this->page->menuAddLink(__('page.help'), 'help', false, true);
} else {
$this->name = 'main';
}
}
}

23
app/controllers/NodeconfigController.php

@ -1,23 +0,0 @@
<?php
class NodeconfigController extends BaseController {
function load() {
$this->session_only = true;
}
function dispatch() {
if(isset($_GET['s']) && $_GET['s'] != "" ) {
$this->page->setTitle(__('title.node_configuration', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.news'), 'news');
$this->page->menuAddLink(__('page.explore'), 'explore');
$this->page->menuAddLink(__('page.profile'), 'profile');
$this->page->menuAddLink(__('page.media'), 'media');
$this->page->menuAddLink(__('page.configuration'), 'conf', false, true);
$this->page->menuAddLink(__('page.help'), 'help', false, true);
} else {
$this->name = 'main';
}
}
}

2
app/controllers/NotfoundController.php

@ -7,7 +7,5 @@ class NotfoundController extends BaseController {
function dispatch() {
$this->page->setTitle(__('title.not_found', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
}
}

4
app/controllers/PodsController.php

@ -8,8 +8,6 @@ class PodsController extends BaseController {
}
function dispatch() {
$this->page->setTitle(__('title.discover', APP_TITLE));
$this->page->setColor('indigo');
$this->page->setTitle(__('title.discover', APP_TITLE));
}
}

19
app/controllers/ProfileController.php

@ -1,19 +0,0 @@
<?php
class ProfileController extends BaseController {
function load() {
$this->session_only = true;
}
function dispatch() {
$this->page->setTitle(__('title.profile', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.news'), 'news');
$this->page->menuAddLink(__('page.explore'), 'explore');
$this->page->menuAddLink(__('page.profile'), 'profile', true);
$this->page->menuAddLink(__('page.media'), 'media');
$this->page->menuAddLink(__('page.configuration'), 'conf', false, true);
$this->page->menuAddLink(__('page.help'), 'help', false, true);
}
}

23
app/controllers/ServerController.php

@ -1,23 +0,0 @@
<?php
class ServerController extends BaseController {
function load() {
$this->session_only = true;
}
function dispatch() {
if(isset($_GET['s']) && $_GET['s'] != "" ) {
$this->page->setTitle(__('title.server', APP_TITLE));
$this->page->menuAddLink(__('page.home'), 'root');
$this->page->menuAddLink(__('page.news'), 'news');
$this->page->menuAddLink(__('page.explore'), 'explore');
$this->page->menuAddLink(__('page.profile'), 'profile');
$this->page->menuAddLink(__('page.media'), 'media');
$this->page->menuAddLink(__('page.configuration'), 'conf', false, true);
$this->page->menuAddLink(__('page.help'), 'help', false, true);
} else {
$this->name = 'main';
}
}
}

4
app/models/postn/PostnDAO.php

@ -403,14 +403,12 @@ class PostnDAO extends SQL {
$this->_sql = '
select *, postn.aid as jid from postn
left outer join contact on postn.aid = contact.jid
where postn.session = :session
and postn.node in ('.$commentsid.')
where postn.node in ('.$commentsid.')
order by postn.published';
$this->prepare(
'Postn',
array(
'session' => $this->_user
)
);

12
app/views/discover.tpl

@ -1,12 +0,0 @@
<?php /* -*- mode: html -*- */
?>
<div id="main">
<div id="left">
</div>
<div id="center">
<?php $this->widget('Discover');?>
<div class="spacetop clear"></div>
</div>
</div>

24
app/views/explore.tpl

@ -1,24 +0,0 @@
<?php /* -*- mode: html -*- */
?>
<?php $this->widget('Presence');?>
<?php $this->widget('Chat');?>
<?php $this->widget('VisioExt');?>
<div id="main">
<div id="left">
<?php $this->widget('Profile');?>
<?php $this->widget('Notifs');?>
<?php $this->widget('Bookmark');?>
</div>
<div id="center">
<div class="protect black" title="<?php echo getFlagTitle("black"); ?>"></div>
<h1 class="paddedtopbottom"><i class="fa fa-globe"></i> <?php echo __('page.explore'); ?></h1>
<?php $this->widget('Hot');?>
<div class="clear"></div>
<?php $this->widget('Explore');?>
</div>
</div>
<div id="right">
<?php $this->widget('Roster');?>
</div>

1
app/views/feed.tpl

@ -1 +0,0 @@
<?php $this->widget('Syndication');?>

21
app/views/node.tpl

@ -1,21 +0,0 @@
<?php /* -*- mode: html -*- */
?>
<?php $this->widget('Presence');?>
<?php $this->widget('Chat');?>
<?php $this->widget('VisioExt');?>
<div id="main">
<div id="left">
<?php $this->widget('Profile');?>
<?php $this->widget('Notifs');?>
<?php $this->widget('Bookmark');?>
</div>
<div id="center">
<?php $this->widget('Node');?>
</div>
</div>
<div id="right">
<?php $this->widget('Roster');?>
</div>

28
app/views/nodeconfig.tpl

@ -1,28 +0,0 @@
<?php /* -*- mode: html -*- */
?>
<?php $this->widget('Presence');?>
<?php $this->widget('Chat');?>
<?php $this->widget('VisioExt');?>
<div id="head">
</div>
<div id="main">
<div id="left">
<?php $this->widget('Profile');?>
<?php $this->widget('Notifs');?>
<?php $this->widget('Bookmark');?>
</div>
<?php $this->widget('Tabs');?>
<div id="center">
<?php $this->widget('NodeConfig');?>
<?php $this->widget('NodeAffiliations');?>
<?php $this->widget('NodeSubscriptions');?>
</div>
</div>
<div id="right">
<?php $this->widget('Roster');?>
</div>

2
app/views/page.tpl

@ -40,7 +40,7 @@
$this->scripts();
?>
</head>
<body class="<?php //$this->color();?>">
<body>
<noscript>
<style type="text/css">
nav {display:none;} #content {display: none;}

27
app/views/profile.tpl

@ -1,27 +0,0 @@
<?php /* -*- mode: html -*- */
?>
<?php $this->widget('Presence');?>
<?php $this->widget('Chat');?>
<?php $this->widget('VisioExt');?>
<div id="head">
</div>
<div id="main">
<div id="left">
<?php $this->widget('Profile');?>
<?php $this->widget('Notifs');?>
<?php $this->widget('Bookmark');?>
</div>
<?php $this->widget('Tabs');?>
<div id="center">
<?php $this->widget('Vcard4');?>
<?php $this->widget('Avatar');?>
<?php $this->widget('Location');?>
</div>
</div>
<div id="right">
<?php $this->widget('Roster');?>
</div>

25
app/views/server.tpl

@ -1,25 +0,0 @@
<?php /* -*- mode: html -*- */
?>
<?php $this->widget('Presence');?>
<?php $this->widget('Chat');?>
<?php $this->widget('VisioExt');?>
<div id="head">
</div>
<div id="main">
<div id="left">
<?php $this->widget('Profile');?>
<?php $this->widget('Notifs');?>
<?php $this->widget('Bookmark');?>
</div>
<?php $this->widget('Tabs');?>
<div id="center">
<?php $this->widget('ServerNodes');?>
</div>
</div>
<div id="right">
<?php $this->widget('Roster');?>
</div>

75
app/widgets/Chat/Chat.php

@ -3,6 +3,10 @@
use Moxl\Xec\Action\Message\Composing;
use Moxl\Xec\Action\Message\Paused;
use Moxl\Xec\Action\Message\Publish;
use Moxl\Xec\Action\Muc\GetConfig;
use Moxl\Xec\Action\Muc\SetConfig;
use Respect\Validation\Validator;
class Chat extends WidgetCommon
@ -18,6 +22,8 @@ class Chat extends WidgetCommon
$this->registerEvent('paused', 'onPaused');
$this->registerEvent('gone', 'onGone');
$this->registerEvent('conference_subject', 'onConferenceSubject');
$this->registerEvent('muc_getconfig_handle', 'onRoomConfig');
$this->registerEvent('muc_setconfig_handle', 'onRoomConfigSaved');
//$this->registerEvent('presence', 'onPresence');
}
@ -104,6 +110,26 @@ class Chat extends WidgetCommon
Header::fill($header);
}
function onRoomConfig($packet)
{
list($config, $room) = array_values($packet->content);
$view = $this->tpl();
$xml = new \XMPPtoForm();
$form = $xml->getHTML($config->x->asXML());
$view->assign('form', $form);
$view->assign('room', $room);
Dialog::fill($view->draw('_chat_config_room', true), true);
}
function onRoomConfigSaved($packet)
{
Notification::append(false, $this->__('chatroom.config_saved'));
}
private function setState($array, $message)
{
list($from, $to) = $array;
@ -167,6 +193,8 @@ class Chat extends WidgetCommon
*/
function ajaxGetRoom($room)
{
if(!$this->validateJid($room)) return;
$html = $this->prepareChat($room, true);
$header = $this->prepareHeaderRoom($room);
@ -243,6 +271,8 @@ class Chat extends WidgetCommon
* @return void
*/
function ajaxSendComposing($to) {
if(!$this->validateJid($to)) return;
$mc = new Composing;
$mc->setTo($to)->request();
}
@ -254,10 +284,41 @@ class Chat extends WidgetCommon
* @return void
*/
function ajaxSendPaused($to) {
if(!$this->validateJid($to)) return;
$mp = new Paused;
$mp->setTo($to)->request();
}
/**
* @brief Configure a room
*
* @param string $room
*/
function ajaxGetRoomConfig($room)
{
if(!$this->validateJid($room)) return;
$gc = new GetConfig;
$gc->setTo($room)
->request();
}
/**
* @brief Save the room configuration
*
* @param string $room
*/
function ajaxSetRoomConfig($data, $room)
{
if(!$this->validateJid($room)) return;
$sc = new SetConfig;
$sc->setTo($room)
->setData($data)
->request();
}
/**
* @brief Prepare the contact header
*
@ -325,6 +386,8 @@ class Chat extends WidgetCommon
function prepareMessages($jid)
{
if(!$this->validateJid($jid)) return;
$md = new \Modl\MessageDAO();
$messages = $md->getContact(echapJid($jid), 0, 30);
@ -381,6 +444,18 @@ class Chat extends WidgetCommon
return $view->draw('_chat_empty', true);
}
/**
* @brief Validate the jid
*
* @param string $jid
*/
private function validateJid($jid)
{
$validate_jid = Validator::email()->noWhitespace()->length(6, 60);
if(!$validate_jid->validate($jid)) return false;
else return true;
}
function display()
{
$validate_jid = Validator::email()->length(6, 40);

13
app/widgets/Chat/_chat_config_room.tpl

@ -0,0 +1,13 @@
<section class="scroll">
<form name="config">
{$form}
</form>
</section>
<div>
<a onclick="Dialog.clear()" class="button flat">
{$c->__('button.close')}
</a>
<a onclick="Chat_ajaxSetRoomConfig(movim_parse_form('config'), '{$room}'); Dialog.clear();" class="button flat">
{$c->__('button.save')}
</a>
</div>

3
app/widgets/Chat/_chat_header_room.tpl

@ -40,5 +40,8 @@
<li onclick="Rooms_ajaxRemoveConfirm('{$room}')">
<span>{$c->__('button.delete')}</span>
</li>
<li onclick="Chat_ajaxGetRoomConfig('{$room}')">
<span>{$c->__('chatroom.config')}</span>
</li>
</ul>
</div>

4
app/widgets/Chat/locales.ini

@ -12,6 +12,8 @@ chat.smileys = 'Smileys'
chat.empty_title = 'Chat'
chat.empty_text = 'Discuss with your contacts'
chatroom.members = 'Chatroom members'
chatroom.members = 'Members'
chatroom.connected = 'Connected to the chatroom'
chatroom.disconnected = 'Disconnected from the chatroom'
chatroom.config = 'Configuration'
chatroom.config_saved = 'Configuration saved'

2
app/widgets/Chats/_chats_item.tpl

@ -23,7 +23,7 @@
{if="preg_match('#^\?OTR#', $message->body)"}
<p><i class="md md-lock"></i> {$c->__('message.encrypted')}</p>
{else}
<p>{$message->body|prepareString}</p>
<p>{$message->body|prepareString|strip_tags}</p>
{/if}
{/if}
</li>

37
app/widgets/Contact/Contact.php

@ -3,6 +3,7 @@
use Moxl\Xec\Action\Roster\UpdateItem;
use Moxl\Xec\Action\Vcard\Get;
use Respect\Validation\Validator;
use Moxl\Xec\Action\Pubsub\GetItems;
class Contact extends WidgetCommon
{
@ -31,6 +32,8 @@ class Contact extends WidgetCommon
function ajaxGetContact($jid)
{
if(!$this->validateJid($jid)) return;
$html = $this->prepareContact($jid);
$header = $this->prepareHeader($jid);
@ -49,14 +52,28 @@ class Contact extends WidgetCommon
->request();
}
function ajaxRefreshFeed($jid)
{
if(!$this->validateJid($jid)) return;
$r = new GetItems;
$r->setTo($jid)
->setNode('urn:xmpp:microblog:0')
->request();
}
function ajaxRefreshVcard($jid)
{
if(!$this->validateJid($jid)) return;
$r = new Get;
$r->setTo(echapJid($jid))->request();
}
function ajaxEditContact($jid)
{
if(!$this->validateJid($jid)) return;
$rd = new \Modl\RosterLinkDAO();
$groups = $rd->getGroups();
$rl = $rd->get($jid);
@ -77,6 +94,8 @@ class Contact extends WidgetCommon
function ajaxChat($jid)
{
if(!$this->validateJid($jid)) return;
$c = new Chats;
$c->ajaxOpen($jid);
@ -85,6 +104,8 @@ class Contact extends WidgetCommon
function ajaxDeleteContact($jid)
{
if(!$this->validateJid($jid)) return;
$view = $this->tpl();
$view->assign('jid', $jid);
@ -94,6 +115,8 @@ class Contact extends WidgetCommon
function prepareHeader($jid)
{
if(!$this->validateJid($jid)) return;
$cd = new \Modl\ContactDAO;
$cr = $cd->getRosterItem($jid);
@ -145,6 +168,8 @@ class Contact extends WidgetCommon
function prepareContact($jid)
{
if(!$this->validateJid($jid)) return;
$cd = new \Modl\ContactDAO;
$c = $cd->get($jid, true);
@ -233,6 +258,18 @@ class Contact extends WidgetCommon
return array($img, $url);
}
/**
* @brief Validate the jid
*
* @param string $jid
*/
private function validateJid($jid)
{
$validate_jid = Validator::email()->noWhitespace()->length(6, 60);
if(!$validate_jid->validate($jid)) return false;
else return true;
}
function display()
{
$validate_jid = Validator::email()->length(6, 40);

12
app/widgets/Contact/_contact_header.tpl

@ -29,10 +29,10 @@
</span>
</li>
</ul>
<h2 class="active r2" onclick="MovimTpl.hidePanel(); Contact_ajaxClear();">
<div class="return active r2" onclick="MovimTpl.hidePanel(); Contact_ajaxClear();">
<span id="back" class="icon" ><i class="md md-arrow-back"></i></span>
{$contact->getTrueName()}
</h2>
<h2>{$contact->getTrueName()}</h2>
</div>
{else}
<ul class="active">
<li onclick="Roster_ajaxDisplaySearch('{$jid}')">
@ -41,10 +41,10 @@
</span>
</li>
</ul>
<h2 class="active r2" onclick="MovimTpl.hidePanel(); Contact_ajaxClear();">
<div class="return active r2" onclick="MovimTpl.hidePanel(); Contact_ajaxClear();">
<span id="back" class="icon" ><i class="md md-arrow-back"></i></span>
{$jid}
</h2>
<h2>{$jid}</h2>
</div>
{/if}
{/if}
</div>

15
app/widgets/Discover/Discover.php

@ -1,15 +0,0 @@
<?php
class Discover extends WidgetCommon {
function load()
{
}
function display()
{
$cd = new \modl\ContactDAO();
$users = $cd->getAllPublic();
$this->view->assign('users', array_reverse($users));
}
}

25
app/widgets/Discover/discover.tpl

@ -1,25 +0,0 @@
<div id="discover">
<h1 class="paddedtopbottom">{$c->__('last')}</h1>
<ul class="list paddedtop">
{loop="$users"}
<li class="block">
<img class="avatar" src="{$value->getPhoto('xs')}"/>
<a href="{$c->route('blog', array($value->jid, 'urn:xmpp:microblog:0'))}">
{if="$value->getAge()"}
<span class="tag blue on_desktop">{$value->getAge()}</span>
{/if}
{if="$value->getGender()"}
<span class="tag green on_desktop">{$value->getGender()}</span>
{/if}
{if="$value->getMarital()"}
<span class="tag yellow on_desktop">{$value->getMarital()}</span>
{/if}
<span class="content">{$value->getTrueName()}</span>
<span class="desc on_desktop">{$value->description|strip_tags}</span>
</a>
</li>
{/loop}
</ul>
</div>

1
app/widgets/Discover/locales.ini

@ -1 +0,0 @@
last = 'Last registered'

52
app/widgets/Explore/Explore.php

@ -1,52 +0,0 @@
<?php
class Explore extends WidgetCommon {
function load() {
}
function display() {
$this->view->assign('servers', $this->prepareServers());
$jid = $this->user->getLogin();
$server = explode('@', $jid);
$this->view->assign('myserver', Route::urlize('server', $server[1]));
$cd = new \modl\ContactDAO();
$users = $cd->getAllPublic();
$this->view->assign('users', array_reverse($users));
}
// A little filter
private function cleanServers($servers) {
$i = 0;
foreach($servers as $c) {
if(filter_var($c->server, FILTER_VALIDATE_EMAIL)) {
unset($servers[$i]);
} elseif(count(explode('.', $c->server))<3) {
unset($servers[$i]);
}
$i++;
}
return $servers;
}
function prepareServers() {
$nd = new \modl\ItemDAO();
$groups = $this->cleanServers($nd->getGroupServers());
$chatrooms = $this->cleanServers($nd->getConferenceServers());
$html = '';
$groupsview = $this->tpl();
$groupsview->assign('groups', $groups);
$html .= $groupsview->draw('_explore_groups', true);
//$chatroomsview = $this->tpl();
//$chatroomsview->assign('chatrooms', $chatrooms);
//$html .= $chatroomsview->draw('_explore_chatrooms', true);
return $html;
}
}

9
app/widgets/Explore/_explore_chatrooms.tpl

@ -1,9 +0,0 @@
{loop="$chatrooms"}
<li class="block">
<a href="{$c->route('server', $value->server)}">
<span class="tag green">{$c->__('chatrooms')}</span>
{$value->server}
<span class="tag">{$value->number}</span>
</a>
</li>
{/loop}

9
app/widgets/Explore/_explore_groups.tpl

@ -1,9 +0,0 @@
{loop="$groups"}
<li class="block">
<a href="{$c->route('server', $value->server)}">
<span class="tag orange on_desktop">{$c->__('groups')}</span>
<span class="tag">{$value->number}</span>
<span class="content"><i class="fa fa-sitemap"></i>{$value->server}</span>
</a>
</li>
{/loop}

36
app/widgets/Explore/explore.tpl

@ -1,36 +0,0 @@
<div id="serverresult" class="padded">
<a class="button color purple oppose icon search" href="{$myserver}">{$c->__('discover_my_server')}</a>
<h2><i class="fa fa-comments-o"></i> {$c->__('discussion_servers')}</h2>
<ul class="list">
{$servers}
</ul>
</div>
<div class="clear"></div>
<div class="padded">
<h2><i class="fa fa-clock-o"></i> {$c->__('last_registered')}</h2>
<ul class="list">
{loop="$users"}
<li class="block">
<img class="avatar" src="{$value->getPhoto('xs')}"/>
<a href="{$c->route('friend', $value->jid)}">
{if="$value->getAge()"}
<span class="tag blue on_desktop">{$value->getAge()}</span>
{/if}
{if="$value->getGender()"}
<span class="tag green on_desktop">{$value->getGender()}</span>
{/if}
{if="$value->getMarital()"}
<span class="tag yellow on_desktop">{$value->getMarital()}</span>
{/if}
<span class="content">{$value->getTrueName()}</span>
<span class="desc on_desktop">{$value->description|strip_tags}</span>
</a>
</li>
{/loop}
</ul>
<div class="clear"></div>
</div>

5
app/widgets/Explore/locales.ini

@ -1,5 +0,0 @@
discover_my_server = 'Discover my server'
discussion_servers = 'Discussion Servers'
last_registered = 'Last registered'
groups = 'Groups'
chatrooms = 'Chatrooms'

149
app/widgets/Feed/Feed.php

@ -1,149 +0,0 @@
<?php
use Moxl\Xec\Action\Storage\Set;
use Moxl\Xec\Action\Microblog\CommentCreateNode;
use Moxl\Xec\Action\Microblog\CreateNode;
class Feed extends WidgetCommon {
private $_feedsize = 10;
function load()
{
$this->addcss('feed.css');
$this->registerEvent('postmicroblog', 'onStream');
$this->registerEvent('postdeleted', 'onPostDelete');
$this->registerEvent('postdeleteerror', 'onPostDeleteError');
$this->registerEvent('comment', 'onComment');
$this->registerEvent('nocomment', 'onNoComment');
$this->registerEvent('nocommentstream', 'onNoCommentStream');
$this->registerEvent('commentpublisherror', 'onCommentPublishError');
$this->registerEvent('stream', 'onStream');
$this->registerEvent('postpublished', 'onPostPublished');
$this->registerEvent('postpublisherror', 'onPostPublishError');
$this->registerEvent('config', 'onConfig');
}
function display()
{
$this->view->assign('blog_url', Route::urlize('blog', array($this->user->getLogin(), 'urn:xmpp:microblog:0')));
$this->view->assign('feed_url', Route::urlize('feed',array($this->user->getLogin(), 'urn:xmpp:microblog:0')));
$this->view->assign('friend_url', Route::urlize('friend',$this->user->getLogin()));
$this->view->assign('feeds', $this->prepareFeed(-1));
}
function onConfig(array $data)
{
$this->user->setConfig($data);
RPC::call('movim_fill', 'feedhead', $this->prepareHead());
}
function onCommentPublishError() {
$html =
'<div class="message error">'.
__('post.comment_error').'
</div>';
RPC::call('movim_fill', 'feednotifs', $html);
}
function onPostPublished($post) {
$html = $this->prepareFeeds();
RPC::call('createCommentNode', $post->nodeid);
RPC::call('movim_fill', 'feedcontent', $html);
RPC::call('createTabs');
}
function ajaxCreateCommentNode($parentid) {
$n = new CommentCreateNode;
$n->setTo($this->user->getLogin())
->setParentId($parentid)
->request();
}
function onPostPublishError($error) {
Notification::append(null, $this->__('feed.error').$error);
}
function prepareHead() {
$session = \Sessionx::start();
$cd = new Modl\CapsDAO;
$caps = $cd->get($session->host);
if(isset($caps) && in_array('http://jabber.org/protocol/pubsub#config-node', unserialize($caps->features))) {
$html = '
<script type="text/javascript">
function createCommentNode(parentid) {'.
$this->call('ajaxCreateCommentNode', 'parentid[0]').
' }
</script>
'.$this->prepareSubmitForm($this->user->getLogin(), 'urn:xmpp:microblog:0').'
<div id="feednotifs"></div>';
} else {
$html = '';
}
return $html;
}
function prepareNext($start, $html = '', $posts, $function = 'ajaxGetFeed') {
// We ask for the HTML of all the posts
$next = $start + $this->_feedsize;
$nexthtml = '';
if(sizeof($posts) > $this->_feedsize-1 && $html != '') {
$nexthtml = '
<div class="block large">
<div
class="older"
onclick="'.$this->call($function, "'".$next."'").'; this.parentNode.style.display = \'none\'">
<i class="fa fa-history"></i> '. __('post.older').'
</div>
</div>';
} else {
return '';
}
return $nexthtml;
}
function prepareFeed($start) {
$pd = new \Modl\PostnDAO();
$pl = $pd->getFeed($start+1, $this->_feedsize);
if(isset($pl)) {
$html = $this->preparePosts($pl);
$html .= $this->prepareNext($start, $html, $pl, 'ajaxGetFeed');
} else {
$view = $this->tpl();
$html = $view->draw('_feed_empty', true);
}
return $html;
}
function ajaxGetFeed($start) {
$html = $this->prepareFeed($start);
RPC::call('movim_append', 'feedposts', $html);
RPC::commit();
}
function onStream($payload) {
$html = $this->prepareFeed(-1);
if($html == '')
$html = '
<div class="message info" style="margin: 1.5em; margin-top: 0em;">'.
__("post.no_load").'
</div>';
RPC::call('movim_fill', 'feedcontent', $html);
RPC::commit();
}
}

4
app/widgets/Feed/_feed_empty.tpl

@ -1,4 +0,0 @@
<div class="placeholder icon">
<h1>{$c->__('feed.empty_title')}</h1>
<p>{$c->__('feed.empty')}</p>
</div>

3
app/widgets/Feed/feed.css

@ -1,3 +0,0 @@
#feedhead .message {
margin: 0 1em;
}

31
app/widgets/Feed/feed.tpl

@ -1,31 +0,0 @@
<div id="feed" class="spacetop tabelem" title="{$c->__('page.feed')}">
<div id="feedhead">
{$c->prepareHead()}
</div>
<div class="posthead paddedbottom">
<a
class="button color merged left"
href="{$blog_url}"
target="_blank">
<i class="fa fa-pencil"></i> {$c->__('page.blog')}
</a><a
class="button color orange merged right"
href="{$feed_url}"
target="_blank">
<i class="fa fa-rss"></i> {$c->__('page.feed')} (Atom)
</a>
<a
class="button color purple oppose"
href="{$friend_url}">
<i class="fa fa-user"></i> {$c->__('my_posts')}
</a>
</div>
<div id="feedcontent">
<div id="feedposts">
{$feeds}
</div>
</div>
</div>

4
app/widgets/Feed/locales.ini

@ -1,4 +0,0 @@
my_posts = 'My Posts'
feed.error = 'An error occured : '
feed.empty_title = 'Hi!'
feed.empty = 'This is your newsfeed, here you will see the posts published by you and your contacts.'

7
app/widgets/Group/Group.php

@ -196,13 +196,6 @@ class Group extends WidgetCommon
$r = new GetItemsId;
$r->setTo($server)
->setNode($node);
/*$pd = new \Modl\PostnDAO();
$posts = $pd->getNodeUnfiltered($server, $node, 0, 1);
if(isset($posts[0])) {
$r->setSince($posts[0]->updated);
}*/
$r->request();

4
app/widgets/Group/_group_header.tpl

@ -52,10 +52,10 @@
{if="$role == 'owner'"}
<ul class="simple context_menu active">
<li onclick="Group_ajaxGetConfig('{$item->server}', '{$item->node}')">
<span>{$c->__('group.get_config')}</span>
<span>{$c->__('group.configuration')}</span>
</li>
<li onclick="Group_ajaxGetSubscriptions('{$item->server}', '{$item->node}')">
<span>{$c->__('group.get_subscriptions')}</span>
<span>{$c->__('group.subscriptions')}</span>
</li>
</ul>
{/if}

2
app/widgets/Group/_group_posts.tpl

@ -62,7 +62,7 @@
{if="isset($value->getAttachements().pictures)"}
<ul class="flex middle">
{loop="$value->getAttachements().pictures"}
<li class="block">
<li class="block pic">
<span class="icon small gray">
<i class="md md-image"></i>
</span>

3
app/widgets/Group/locales.ini

@ -11,6 +11,5 @@ group.empty_text = 'Discover, follow and share'
group.empty = 'Something bad happened to this group'
group.config_saved = 'Group configuration saved'
group.get_config = 'Configure your group'
group.get_subscriptions = 'Get the subscriptions'
group.configuration = 'Configuration'
group.subscriptions = 'Subscriptions'

20
app/widgets/Hot/Hot.php

@ -1,20 +0,0 @@
<?php
class Hot extends WidgetCommon
{
function load()
{
}
function display()
{
$nd = new \modl\ItemDAO();
$this->view->assign('nodes', $nd->getUpdatedItems(0, 10));
}
function getAvatar($server, $node) {
$user = new \modl\Contact;
$user->jid = $server.$node;
return $user->getPhoto('m');
}
}

25
app/widgets/Hot/hot.tpl

@ -1,25 +0,0 @@
<div class="paddedtop">
<h2><i class="fa fa-paper-plane-o"></i> {$c->__('explore.hot')}</h2>
<ul class="list">
{loop="$nodes"}
{if="!filter_var($value->server, FILTER_VALIDATE_EMAIL)"}
<li class="block">
<a href="{$c->route('node', array($value->server, $value->node))}">
<span class="tag gray on_desktop">{$c->__('post.updated')} {$value->num|strtotime|prepareDate}</span>
<span class="content">
{if="isset($value->name)"}
{$value->name}
{else}
{$value->node}
{/if}
- {$value->server}
</span>
<span class="desc on_desktop">{$value->description}</span>
</a>
</li>
{/if}
{/loop}
</ul>
</div>

1
app/widgets/Hot/locales.ini

@ -1 +0,0 @@
explore.hot = "What's Hot"

2
app/widgets/Menu/Menu.php

@ -8,7 +8,7 @@ class Menu extends WidgetCommon
function load()
{
$this->registerEvent('post', 'onPost', 'news');
$this->registerEvent('post', 'onPost');
$this->addjs('menu.js');
}

2
app/widgets/Menu/_menu_list.tpl

@ -39,7 +39,7 @@
{if="$value->title != null"}
<span>{$value->title}</span>
{else}
<span>{$c->__('menu.contact_post')}</span>
<span>{$value->getContact()->getTrueName()} - {$c->__('menu.contact_post')}</span>
{/if}
{if="$value->privacy"}
<span class="info" title="{$c->__('menu.public')}">

274
app/widgets/Node/Node.php

@ -1,274 +0,0 @@
<?php
/**
* @package Widgets
*
* @file Node.php
* This file is part of MOVIM.
*
* @brief The items of a node
*
* @author Timothée Jaussoin <edhelas_at_gmail_dot_com>
*
* @version 1.0
* @date 20 October 2010
*
* Copyright (C)2010 MOVIM project
*
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Pubsub\GetItems;
use Moxl\Xec\Action\Pubsub\Subscribe;
use Moxl\Xec\Action\Pubsub\Unsubscribe;
use Moxl\Xec\Action\Pubsub\GetAffiliations;
use Moxl\Xec\Action\Pubsub\GetMetadata;
use Moxl\Xec\Action\Pubsub\GetSubscriptions;
class Node extends WidgetCommon
{
private $role;
private $_feedsize = 10;
function load()
{
/*$this->registerEvent('post', 'onStream');
$this->registerEvent('stream', 'onStream');
$this->registerEvent('nostream', 'onStream');*/
$this->registerEvent('pubsubaffiliations', 'onPubsubAffiliations');
$this->registerEvent('pubsubsubscribed', 'onPubsubSubscribed');
$this->registerEvent('pubsubmetadata', 'onPubsubMetadata');
$this->registerEvent('pubsubsubscribederror', 'onPubsubSubscribedError');
$this->registerEvent('pubsubunsubscribed', 'onPubsubUnsubscribed');
}
function display()
{
if(isset($_GET['s']) && isset($_GET['n'])) {
$this->view->assign('server', $_GET['s']);
$this->view->assign('node', $_GET['n']);
$this->view->assign('refresh', $this->call('ajaxGetItems', "'".$_GET['s']."'", "'".$_GET['n']."'"));
$this->view->assign('getaffiliations', $this->call('ajaxGetAffiliations', "'".$_GET['s']."'", "'".$_GET['n']."'"));
$this->view->assign('getmetadata', $this->call('ajaxGetMetadata', "'".$_GET['s']."'", "'".$_GET['n']."'"));
$this->view->assign('hash', md5($_GET['s'].$_GET['n']));
$this->view->assign('items', $this->prepareNode($_GET['s'], $_GET['n']));
$this->view->assign('metadata', $this->prepareMetadata($_GET['s'], $_GET['n']));
$nd = new modl\ItemDAO();
$node = $nd->getItem($_GET['s'], $_GET['n']);
if($node != null)
$title = $node->getName();
else
$title = $groupid;
$this->view->assign('title', $title);
$this->view->assign('formpublish', $this->prepareSubmitForm($_GET['s'], $_GET['n']));
}
}
function onPubsubSubscribed($params)
{
$html = $this->prepareNode($params[0], $params[1]);
RPC::call('setBookmark');
RPC::call('movim_fill', 'node', $html);
RPC::call('movim_reload_this');
}
function onPubsubSubscribedError($params)
{
$this->onPubsubSubscribed($params);
}
function onPubsubUnsubscribed($params)
{
$this->onPubsubSubscribed($params);
}
function onPubsubAffiliations($params) {
foreach($params[0] as $r) {
if($r[0] == $this->user->getLogin())
$this->role = (string)$r[1];
}
if($this->searchSubscription($params[1], $params[2])
&& ($this->role == 'owner' || $this->role == 'publisher')) {
RPC::call('movim_toggle_display', '#formpublish');
RPC::call('movim_toggle_display', '#configbutton');
}
}
function onPubsubMetadata($params) {
$html = $this->prepareMetadata($params[0], $params[1]);
RPC::call('movim_fill', 'metadata', $html);
}
/*function onStream($payload) {
$html = $this->prepareNode($payload['from'], $payload['node']);
if($html == '')
$html = __('post.no_load');
RPC::call('movim_fill', md5($payload['from'].$payload['node']), $html);
}*/
function ajaxGetItems($server, $node)
{
$pd = new \Modl\PostnDAO();
$pd->deleteNode($server, $node);
$r = new GetItems;
$r->setTo($server)
->setNode($node)
->request();
}
function ajaxSubscribe($data, $server, $node)
{
$g = new Subscribe;
$g->setTo($server)
->setNode($node)
->setFrom($this->user->getLogin())
//->setData($data)
->request();
}
function ajaxUnsubscribe($server, $node)
{
$sd = new \Modl\SubscriptionDAO();
foreach($sd->get($server, $node) as $s) {
$g = new Unsubscribe;
$g->setTo($server)
->setNode($node)
->setSubid($s->subid)
->setFrom($this->user->getLogin())
->request();
}
}
function ajaxGetSubscriptions($server, $node)
{
$r = new GetSubscriptions;
$r->setTo($server)
->setNode($node)
->setSync()
->request();
}
function ajaxGetAffiliations($server, $node){
$r = new GetAffiliations;
$r->setTo($server)->setNode($node)
->request();
}
function ajaxGetMetadata($server, $node){
$r = new GetMetadata;
$r->setTo($server)->setNode($node)
->request();
}
function prepareNode($serverid, $groupid) {
$nodeview = $this->tpl();
$nodeview->assign('serverid', $serverid);
$nodeview->assign('groupid', $groupid);
$nodeview->assign('subscribed', $this->searchSubscription($serverid, $groupid));
$nodeview->assign('role', $this->role);
$nodeview->assign('refresh', $this->call('ajaxGetItems', "'".$serverid."'", "'".$groupid."'"));
$nodeview->assign('getsubscription',$this->call('ajaxGetSubscriptions', "'".$serverid."'", "'".$groupid."'"));
$nodeview->assign('subscribe', $this->call('ajaxSubscribe', "movim_parse_form('groupsubscribe')", "'".$serverid."'", "'".$groupid."'"));
$nodeview->assign('unsubscribe', $this->call('ajaxUnsubscribe', "'".$serverid."'", "'".$groupid."'"));
$nodeview->assign('submitform', '');
$nodeview->assign('posts', $this->preparePostsNode($serverid, $groupid, -1));
$html = $nodeview->draw('_node_content', true);
return $html;
}
function prepareNext($start, $html = '', $posts, $function = 'ajaxGetPostsNode', $serverid, $groupid) {
$next = $start + $this->_feedsize;
$nexthtml = '';
if(sizeof($posts) > $this->_feedsize-1 && $html != '') {
$nexthtml = '
<div class="block large">
<div
class="older"
onclick="'.$this->call($function, "'".$serverid."'", "'".$groupid."'", "'".$next."'").'; this.parentNode.style.display = \'none\'">
<i class="fa fa-history"></i> '. __('post.older') .'
</div>
</div>';
}
return $nexthtml;
}
function prepareMetadata($server, $node) {
$nd = new modl\ItemDAO();
$node = $nd->getItem($server, $node);
$metadataview = $this->tpl();
if(isset($node->name))
$metadataview->assign('title', $node->name);
else
$metadataview->assign('title', $node->node);
$metadataview->assign('description', $node->description);
$metadataview->assign('creation', prepareDate(strtotime($node->created)));
$metadataview->assign('creator', $node->creator);
return $metadataview->draw('_node_metadata', true);
}
function preparePostsNode($serverid, $groupid, $start) {
$pd = new \Modl\PostnDAO();
$pl = $pd->getNode($serverid, $groupid, $start+1, $this->_feedsize);
if(isset($pl)) {
$html = $this->preparePosts($pl);
} else {
$view = $this->tpl();
$html = $view->draw('_node_empty', true);
}
$html .= $this->prepareNext($start, $html, $pl, 'ajaxGetPostsNode', $serverid, $groupid);
return $html;
}
function ajaxGetPostsNode($serverid, $groupid, $start) {
$html = $this->preparePostsNode($serverid, $groupid, $start);
RPC::call('movim_append', md5($serverid.$groupid), $html);
RPC::commit();
}
function searchSubscribed($server, $node) {
$c = Cache::c('bookmark');
foreach($c as $bookmark) {
if(
$bookmark['type'] == 'subscription' &&
$bookmark['server'] == $server &&
$bookmark['node'] == $node) {
return true;
}
}
return false;
}
function searchSubscription($server, $node) {
$sd = new \Modl\SubscriptionDAO();
$subs = $sd->get($server, $node);
if($subs != null)
foreach($subs as $s) {
if($s->subscription == 'subscribed')
return true;
}
return false;
}
}

105
app/widgets/Node/_node_content.tpl

@ -1,105 +0,0 @@
<div class="posthead paddedtopbottom">
{if="$subscribed == true"}
<a
href="#"
class="button color"
onclick="movim_toggle_display('#groupunsubscribe')">
<i class="fa fa-arrow-left"></i> {$c->__('node.unsubscribe')}
</a>
{else}
<a
href="#"
class="button color green"
onclick="movim_toggle_display('#groupsubscribe')">
<i class="fa fa-arrow-right"></i> {$c->__('node.subscribe')}
</a>
{/if}
<a
class="button color merged left"
href="{$c->route('blog',array($serverid,$groupid))}"
target="_blank"
>
<i class="fa fa-pencil"></i> {$c->__('page.blog')}
</a><a
class="button color orange alone merged right"
href="{$c->route('feed',array($serverid,$groupid))}"
target="_blank"
><i class="fa fa-rss"></i></a>
<a
href="#"
onclick="{$refresh}
this.className='button color alone orange'; this.onclick=null;"
class="button color blue alone">
<i class="fa fa-refresh"></i>
</a>
<!--
<a
class="button color icon yes"
onclick="{$getsubscription}"
>{$c->t('Get Subscription')}</a>
-->
<a
class="button color oppose"
style="display: none;"
id="configbutton"
href="{$c->route('nodeconfig', array($serverid,$groupid))}"
><i class="fa fa-user"></i> {$c->__('page.configuration')}</a>
</div>
<div class="popup" id="groupsubscribe">
<form name="groupsubscribe">
<fieldset>
<legend>{$c->__('node.subscribe')}</legend>
<div class="element">
<label>{$c->__('node.share_label')}</label>
<div class="checkbox">
<input type="checkbox" name="listgroup" id="listgroup"/>
<label for="listgroup"></label>
</div>
</div>
<div class="element">
<label for="grouptitle">{$c->__('node.nickname_label')}</label>
<input type="text" name="title" value="{$groupid}" id="grouptitle"/>
</div>
</fieldset>
<div class="menu">
<a
class="button tiny icon yes black merged left"
onclick="
{$subscribe}
this.onclick=null;"
>{$c->__('node.subscribe')}</a><a
class="button tiny icon no black merged right"
onclick="
movim_toggle_display('#groupsubscribe');"
>{$c->__('button.close')}</a>
</div>
</form>
</div>
<div class="popup" id="groupunsubscribe">
<form name="groupunsubscribe">
<fieldset>
<legend>{$c->__('node.unsubscribe')}</legend>
<div class="element">
<label>{$c->__('node.sure')}</label>
</div>
</fieldset>
<div class="menu">
<a
class="button tiny icon yes black merged left"
onclick="
{$unsubscribe}
this.onclick=null;"
>{$c->__('node.unsubscribe')}</a><a
class="button tiny icon no black merged right"
onclick="
movim_toggle_display('#groupunsubscribe');"
>{$c->__('button.close')}</a>
</div>
</form>
</div>
{$submitform}
{$posts}

4
app/widgets/Node/_node_empty.tpl

@ -1,4 +0,0 @@
<div class="placeholder padded">
<h1>{$c->__('node.empty_title')}</h1>
<p>{$c->__('node.empty')}</p>
</div>

14
app/widgets/Node/_node_metadata.tpl

@ -1,14 +0,0 @@
<h1>{$title}</h1>
{if="isset($creation)"}
<span class="key"><i class="fa fa-clock-o"></i> </span>
<span>{$creation}</span>
{/if}
{if="isset($creator)"}
<span class="key"><i class="fa fa-user"></i> </span>
<span>{$creator}</span>
{/if}
{if="isset($description)"}
<p>{$description}</p>
{/if}

7
app/widgets/Node/locales.ini

@ -1,7 +0,0 @@
node.subscribe = 'Subscribe'
node.unsubscribe = 'Unsubscribe'
node.share_label = 'Make your membership to this group public to your friends'
node.nickname_label = 'Give a nickname to this group if you want'
node.sure = 'Are you sure ?'
node.empty_title = 'Oops!'
node.empty = 'I cannot find any posts here. Try to push the refresh button.'

34
app/widgets/Node/node.tpl

@ -1,34 +0,0 @@
<div class="tabelem protect red" id="node" title="{$c->__('page.posts')}">
<div class="breadcrumb">
<a href="{$c->route('explore')}">
<i class="fa fa-globe"></i> {$c->__('page.explore')}
</a>
<a href="{$c->route('server', $server)}">
<i class="fa fa-sitemap"></i> {$server}
</a>
<a href="{$c->route('node', array($server, $node))}">
{$title}
</a>
<a>{$c->__('page.posts')}</a>
</div>
<div class="clear"></div>
<div class="metadata paddedtopbottom" id="metadata">
{$metadata}
</div>
<br />
<div id="formpublish" style="padding-bottom: 1em; display: none;">
{$formpublish}
</div>
<div id="{$hash}">
{$items}
</div>
</div>
<script type="text/javascript">
MovimWebsocket.attach(function()
{
{$refresh}
{$getaffiliations}
{$getmetadata}
});
</script>

121
app/widgets/NodeConfig/NodeConfig.php

@ -1,121 +0,0 @@
<?php
/**
* @package Widgets
*
* @file GroupConfig.php
* This file is part of MOVIM.
*
* @brief The Group configuration widget
*
* @author Ho Christine <nodpounod@gmail.com>
*
* @version 1.0
* @date 12 March 2013
*
* Copyright (C)2010 MOVIM project
*
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Pubsub\GetConfig;
use Moxl\Xec\Action\Pubsub\SetConfig;
use Moxl\Xec\Action\Group\Delete;
class NodeConfig extends WidgetBase
{
function load()
{
$this->registerEvent('pubsubconfig', 'onConfigForm');
$this->registerEvent('pubsubconfigsubmited', 'onGroupConfig');
$this->registerEvent('deletionsuccess', 'onGroupDeleted');
}
function display()
{
if(isset($_GET['s']) && isset($_GET['n'])) {
$nd = new modl\ItemDAO();
$node = $nd->getItem($_GET['s'], $_GET['n']);
if($node != null)
$title = $node->getName();
else
$title = $groupid;
$this->view->assign('server', $_GET['s']);
$this->view->assign('node', $_GET['n']);
$this->view->assign('name', $title);
$this->view->assign('group_config', $this->call('ajaxGroupConfig', "'".$_GET['s']."'", "'".$_GET['n']."'"));
$this->view->assign('group_delete', $this->call('ajaxGroupDelete', "'".$_GET['s']."'", "'".$_GET['n']."'"));
}
}
function onGroupDeleted($server) {
$html = '
<a href="'.Route::urlize('server', $server).'">
'.$this->__('group.delete_return', $server).'
</a><br /><br />';
Notification::append(null, $this->__('group.deleted'));
RPC::call('movim_fill', 'handlingmessages', $html);
RPC::commit();
}
function onGroupConfig($stanza) {
Notification::append(null, $this->__('group.config_saved'));
RPC::commit();
}
function onConfigForm($form) {
$submit = $this->call('ajaxSubmitConfig', "movim_parse_form('config')", "'".$form[1]."'", "'".$form[2]."'");
$html = '
<form name="config">'.
$form[0].
'
<hr /><br />
<a
class="button color green oppose"
onclick="
'.$submit.'
this.onclick=null;
this.style.display = \'none\'
"
>
<i class="fa fa-check"></i> '.__('button.validate').'
</a>
<br />
<br />
</form>';
RPC::call('movim_fill', 'groupconfiguration', $html);
RPC::commit();
}
function ajaxGroupConfig($server, $node){
$r = new GetConfig;
$r->setTo($server)
->setNode($node)
->request();
}
function ajaxGroupDelete($server, $node){
$nd = new \Modl\ItemDAO();
$nd->deleteItem($server, $node);
$r = new Delete;
$r->setTo($server)
->setNode($node)
->request();
}
function ajaxSubmitConfig($data, $server, $node){
$r = new SetConfig;
$r->setTo($server)
->setNode($node)
->setData($data)
->request();
}
}
?>

5
app/widgets/NodeConfig/locales.ini

@ -1,5 +0,0 @@
group.config = 'Configure your group'
group.config_saved = 'Group configuration saved'
group.delete = 'Delete this group'
group.deleted = 'Group deleted'
group.delete_return = "Return to %s's list of groups"

29
app/widgets/NodeConfig/nodeconfig.tpl

@ -1,29 +0,0 @@
<div class="breadcrumb">
<a href="{$c->route('explore')}">
<i class="fa fa-globe"></i> {$c->__('page.explore')}
</a>
<a href="{$c->route('server', $server)}">
<i class="fa fa-sitemap"></i> {$server}
</a>
<a href="{$c->route('node', array($server, $node))}">
{$name}
</a>
<a>{$c->__('page.configuration')}</a>
</div>
<div class="tabelem" title="{$c->__('page.configuration')}" id="groupconfig">
<h1 class="paddedtopbottom"><i class="fa fa-sliders"></i> {$c->__('page.configuration')}</h1>
<div id="groupconfiguration" class="paddedtop">
<div id="handlingmessages"></div>
<a
class="button color green"
onclick="{$group_config} this.style.display = 'none'">
<i class="fa fa-sliders"></i> {$c->__('group.config')}
</a>
<a
class="button color red"
onclick="{$group_delete} this.style.display = 'none'">
<i class="fa fa-times"></i> {$c->__('group.delete')}
</a>
</div>
</div>

2
app/widgets/Notifs/_notifs_from.tpl

@ -23,7 +23,7 @@
<i class="md md-person"></i>
</span>
{/if}
<span href="{$c->route('friend', $value->jid)}">
<span href="{$c->route('contact', $value->jid)}">
{$value->getTrueName()}
</span>
</li>

11
app/widgets/Pods/pods.tpl

@ -29,7 +29,12 @@
{/loop}
</ul>
{else}
<div class="padded">
<div class="message error">{$c->__('api.error')}</div>
</div>
<ul class="thick">
<li>
<span class="icon bubble color gray">
<i class="md md-cloud-off"></i>
</span>
<span>{$c->__('api.error')}</span>
</li>
</ul>
{/if}

51
app/widgets/Post/Post.php

@ -21,6 +21,7 @@
use Moxl\Xec\Action\Pubsub\PostPublish;
use Moxl\Xec\Action\Pubsub\PostDelete;
use Moxl\Xec\Action\Microblog\CommentsGet;
use Moxl\Xec\Action\Microblog\CommentCreateNode;
use \Michelf\Markdown;
use Respect\Validation\Validator;
@ -30,12 +31,20 @@ class Post extends WidgetCommon
{
$this->addcss('post.css');
$this->registerEvent('microblog_commentsget_handle', 'onComments');
$this->registerEvent('microblog_commentsget_error', 'onCommentsError');
$this->registerEvent('pubsub_postpublish_handle', 'onPublish');
$this->registerEvent('pubsub_postdelete_handle', 'onDelete');
}
function onPublish()
function onPublish($packet)
{
list($to, $node, $id) = array_values($packet->content);
$cn = new CommentCreateNode;
$cn->setTo($to)
->setParentId($id)
->request();
Notification::append(false, $this->__('post.published'));
$this->ajaxClear();
RPC::call('MovimTpl.hidePanel');
@ -49,6 +58,29 @@ class Post extends WidgetCommon
RPC::call('Menu_ajaxGetAll');
}
function onComments($packet)
{
$nodeid = $packet->content;
$p = new \Modl\ContactPostn();
$p->nodeid = $nodeid;
$pd = new \Modl\PostnDAO();
$comments = $pd->getComments($p);
$view = $this->tpl();
$view->assign('comments', $comments);
$html = $view->draw('_post_comments', true);
RPC::call('movim_fill', 'comments', $html);
}
function onCommentsError($packet)
{
$view = $this->tpl();
$html = $view->draw('_post_comments_error', true);
RPC::call('movim_fill', 'comments', $html);
}
function ajaxClear()
{
RPC::call('movim_fill', 'post_widget', $this->prepareEmpty());
@ -172,23 +204,6 @@ class Post extends WidgetCommon
RPC::call('movim_fill', 'preview', $html);
}
function onComments($packet)
{
$nodeid = $packet->content;
$p = new \Modl\ContactPostn();
$p->nodeid = $nodeid;
$pd = new \Modl\PostnDAO();
$comments = $pd->getComments($p);
$view = $this->tpl();
$view->assign('comments', $comments);
$html = $view->draw('_post_comments', true);
//$html = $this->prepareComments($comments);
RPC::call('movim_fill', 'comments', $html);
}
function prepareGallery($embed)
{
$view = $this->tpl();

28
app/widgets/Post/_post.tpl

@ -24,9 +24,7 @@
{/if}
</a>
{else}
<!--<a href="{$c->route('node', array($post->jid, $post->node))}">-->
<span class="icon bubble color {$post->node|stringToColor}">{$post->node|firstLetterCapitalize}</span>
<!--</a>-->
<span class="icon bubble color {$post->node|stringToColor}">{$post->node|firstLetterCapitalize}</span>
{/if}
<span {if="$post->title != null"}title="{$post->title|strip_tags}"{/if}>
{if="$post->title != null"}
@ -54,7 +52,9 @@
{if="isset($attachements.links)"}
{loop="$attachements.links"}
<li>
<span class="icon small"><img src="http://icons.duckduckgo.com/ip2/{$value.url.host}.ico"/></span>
<span class="icon">
<img src="http://icons.duckduckgo.com/ip2/{$value.url.host}.ico"/>
</span>
<a href="{$value.href}" class="alternate" target="_blank">
<span>{$value.href|urldecode}</span>
</a>
@ -69,7 +69,7 @@
class="enclosure"
type="{$value.type}"
target="_blank">
<span class="icon small gray">
<span class="icon gray">
<span class="md md-attach-file"></span>
</span>
<span>{$value.href|urldecode}</span>
@ -78,8 +78,22 @@
{/loop}
{/if}
</ul>
{if="isset($attachements.pictures)"}
<ul class="flex middle">
{loop="$attachements.pictures"}
<li class="block pic">
<span class="icon gray">
<i class="md md-image"></i>
</span>
<a href="{$value.href}" class="alternate" target="_blank">
<img type="{$value.type}" src="{$value.href|urldecode}"/>
</a>
</li>
{/loop}
</ul>
{/if}
{if="$post->isMine()"}
<ul class="thick">
<ul class="middle">
<li class="action">
<form>
<div class="action">
@ -96,7 +110,7 @@
</div>
</div>
</form>
<span class="icon bubble color red">
<span class="icon gray">
<i class="md md-public"></i>
</span>
<span>

23
app/widgets/Post/_post_comments.tpl

@ -1,12 +1,25 @@
<ul class="divided middle">
<ul class="divided spaced middle">
<li class="subheader">{$c->__('post.comments')}</li>
{loop="$comments"}
<li class="condensed">
<span class="icon bubble">
<img src="{$value->getContact()->getPhoto('xs', $value->aid)}"/>
</span>
<a href="{$c->route('contact', $value->getContact()->jid)}">
{$url = $value->getContact()->getPhoto('s')}
{if="$url"}
<span class="icon bubble">
<img src="{$url}">
</span>
{else}
<span class="icon bubble color {$value->getContact()->jid|stringToColor}">
<i class="md md-person"></i>
</span>
{/if}
</a>
<span class="info">{$value->published|strtotime|prepareDate}</span>
<span>{$value->getContact()->getTrueName()}</span>
<span>
<a href="{$c->route('contact', $value->getContact()->jid)}">
{$value->getContact()->getTrueName()}
</a>
</span>
<p>
{$value->content}
</p>

6
app/widgets/Post/_post_header_create.tpl

@ -3,10 +3,10 @@
<h2>{$c->__('page.news')}</h2>
</div>
<div>
<h2 class="active r3" onclick="MovimTpl.hidePanel(); Post_ajaxClear();">
<div class="return active r3" onclick="MovimTpl.hidePanel(); Post_ajaxClear();">
<span id="back" class="icon" ><i class="md md-arrow-back"></i></span>
New Post
</h2>
<h2>{$c->__('post.new')}</h2>
</div>
<ul class="active">
<li onclick="Post_ajaxHelp()">
<span class="icon">

2
app/widgets/Post/locales.ini

@ -1,5 +1,6 @@
post.news_feed = 'News Feed'
post.comments = 'Comments'
post.no_comments = 'Comments disabled'
post.placeholder = 'Discover and register to the groups you are interested in'
post.preview = 'Preview'
post.help = 'Help'
@ -16,6 +17,7 @@ post.published = 'Post published'
post.deleted = 'Post deleted'
post.gallery = 'This picture will be added to your gallery'
post.hot = "What's Hot"
post.new = 'New post'
post.embed_tip = 'You can also use services like <a href="http://imgur.com/">Imgur</a> or <a href="https://www.flickr.com/">Flickr</a> to host your picture and paste the link here.'
[manage]

53
app/widgets/Profile/Profile.php

@ -1,53 +0,0 @@
<?php
/**
* @package Widgets
*
* @file Profile.php
* This file is part of MOVIM.
*
* @brief The Profile widget
*
* @author Timothée Jaussoin <edhelas_at_gmail_dot_com>
*
* @version 1.0
* @date 20 October 2010
*
* Copyright (C)2010 MOVIM project
*
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Presence\Chat;
use Moxl\Xec\Action\Presence\Away;
use Moxl\Xec\Action\Presence\DND;
use Moxl\Xec\Action\Presence\XA;
class Profile extends WidgetCommon
{
private static $status;
function load()
{
$this->addcss('profile.css');
$this->addjs('profile.js');
$this->registerEvent('myvcard', 'onMyVcardReceived');
}
function onMyVcardReceived($vcard = false)
{
$html = $this->prepareVcard($vcard);
RPC::call('movim_fill', 'profile', $html);
}
function prepareVcard($vcard = false)
{
$cd = new \Modl\ContactDAO();
$contact = $cd->get($this->user->getLogin());
$vcardview = $this->tpl();
$vcardview->assign('contact', $contact);
return $vcardview->draw('_profile_vcard', true);
}
}

22
app/widgets/Profile/_profile_vcard.tpl

@ -1,22 +0,0 @@
{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 class="clear"></div>
</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')}">
<i class="fa fa-user"></i> {$c->__('profile.create')}
</a>
</div>
{/if}

2
app/widgets/Profile/locales.ini

@ -1,2 +0,0 @@
profile.not_yet = 'No profile yet?'
profile.create = 'Create my profile'

41
app/widgets/Profile/profile.css

@ -1,41 +0,0 @@
#profile_widget {
position: relative;
width: 100%;
border-bottom: 1px solid #D4D4D4;
}
#profile_widget .card {
padding: 1em 0.5em;
box-sizing: border-box;
}
#profile_widget .card img {
width: 3em;
border-radius: 2em;
float: left;
margin-right: 0.75em;
}
#profile_widget .card h1 {
line-height: 1.5em;
color: #242424;
margin-top: -0.2em;
font-size: 1.2em;
}
#profile_widget .card i {
float: right;
font-size: 1.2em;
margin-top: -1.2em;
opacity: 0.5;
}
#profile_widget .card i:hover {
opacity: 1;
}
#profile_widget .not_yet {
padding: 1em;
text-align: center;
}

13
app/widgets/Profile/profile.js

@ -1,13 +0,0 @@
function showPresence(n)
{
n.style.display = 'none';
buttons = document.querySelectorAll('.presence_button.merged');
for(i = 0; i < buttons.length; i++) {
buttons[i].style.display = 'inline';
}
}
movim_add_onload(function()
{
movim_textarea_autoheight(document.querySelector('#profile #status'));
});

4
app/widgets/Profile/profile.tpl

@ -1,4 +0,0 @@
<div id="profile_widget">
{$c->prepareVcard()}
</div>

32
app/widgets/Rooms/Rooms.php

@ -5,6 +5,8 @@ use Moxl\Xec\Action\Bookmark\Get;
use Moxl\Xec\Action\Bookmark\Set;
use Moxl\Xec\Action\Presence\Unavailable;
use Respect\Validation\Validator;
class Rooms extends WidgetCommon
{
function load()
@ -59,6 +61,8 @@ class Rooms extends WidgetCommon
*/
function ajaxRemoveConfirm($room)
{
if(!$this->validateRoom($room)) return;
$view = $this->tpl();
$view->assign('room', $room);
@ -67,10 +71,12 @@ class Rooms extends WidgetCommon
}
/**
* @brief Display the remove list
* @brief Display the room list
*/
function ajaxList($room)
{
if(!$this->validateRoom($room)) return;
$view = $this->tpl();
$cd = new \Modl\ContactDAO;
@ -84,6 +90,8 @@ class Rooms extends WidgetCommon
*/
function ajaxRemove($room)
{
if(!$this->validateRoom($room)) return;
$cd = new \modl\ConferenceDAO();
$cd->deleteNode($room);
@ -93,10 +101,12 @@ class Rooms extends WidgetCommon
/**
* @brief Join a chatroom
*/
function ajaxJoin($jid, $nickname = false)
function ajaxJoin($room, $nickname = false)
{
if(!$this->validateRoom($room)) return;
$p = new Muc;
$p->setTo($jid);
$p->setTo($room);
if($nickname != false) $p->setNickname($nickname);
@ -110,6 +120,8 @@ class Rooms extends WidgetCommon
*/
function ajaxExit($room)
{
if(!$this->validateRoom($room)) return;
$session = \Sessionx::start();
$pu = new Unavailable;
@ -180,6 +192,8 @@ class Rooms extends WidgetCommon
function checkConnected($room, $resource = false)
{
if(!$this->validateRoom($room)) return;
$pd = new \modl\PresenceDAO();
if($resource == false) {
@ -205,6 +219,18 @@ class Rooms extends WidgetCommon
return $view->draw('_rooms', true);
}
/**
* @brief Validate the room
*
* @param string $room
*/
private function validateRoom($room)
{
$validate_server = Validator::email()->noWhitespace()->length(6, 40);
if(!$validate_server->validate($room)) return false;
else return true;
}
function display()
{
$this->view->assign('list', $this->prepareRooms());

5
app/widgets/Rooms/_rooms_list.tpl

@ -4,7 +4,7 @@
<ul>
{$presence = getPresencesTxt()}
{loop="$list"}
<li class="action" title="{$value->resource}">
<li class="action {if="$value->status"}condensed{/if}" title="{$value->resource}">
{$url = $value->getPhoto('s')}
{if="$url"}
<span class="icon bubble status {$presence[$value->value]}">
@ -21,6 +21,9 @@
</div>
{/if}
<span>{$value->resource}</span>
{if="$value->status"}
<p class="wrap">{$value->status}</p>
{/if}
</li>
{/loop}
</ul>

4
app/widgets/Roster/Roster.php

@ -162,7 +162,7 @@ class Roster extends WidgetBase
function ajaxSearchContact($jid)
{
if(filter_var($jid, FILTER_VALIDATE_EMAIL)) {
RPC::call('movim_redirect', Route::urlize('friend', $jid));
RPC::call('movim_redirect', Route::urlize('contact', $jid));
RPC::commit();
} else
Notification::append(null, $this->__('roster.jid_error'));
@ -286,7 +286,7 @@ class Roster extends WidgetBase
$c['rosterview']['avatar'] = $oc->getPhoto('s');
$c['rosterview']['color'] = stringToColor($oc->jid);
$c['rosterview']['name'] = $oc->getTrueName();
$c['rosterview']['friendpage'] = $this->route('friend', $oc->jid);
$c['rosterview']['friendpage'] = $this->route('contact', $oc->jid);
// Some data relative to the presence
if($oc->last != null && $oc->last > 60)

1
app/widgets/Roster/roster.js

@ -319,6 +319,7 @@ var Roster = {
clickOnContact : function(e) {
Contact_ajaxGetContact(e.id);
Contact_ajaxRefreshFeed(e.id);
/*recalculated at each click*/
var it = document.querySelectorAll('#rosterlist div > li:not(.subheader)');
Roster.reset(it);

5
app/widgets/Roster/roster.tpl

@ -2,11 +2,6 @@
<ul id="rosterlist" class="{if="isset($conf) && $conf.roster == 'show'"}offlineshown{/if} active all">
<span ng-if="contacts == null" class="nocontacts">
{$c->__('roster.no_contacts')}
<br />
<br />
<a class="button color green" href="{$c->route('explore')}">
<i class="fa fa-compass"></i> {$c->__('page.explore')}
</a>
</span>
<li class="subheader search">{$c->__('roster.results')}</li>

165
app/widgets/ServerNodes/ServerNodes.php

@ -1,165 +0,0 @@
<?php
/**
* @package Widgets
*
* @file ServerNodes.php
* This file is part of MOVIM.
*
* @brief The Profile widget
*
* @author Timothée Jaussoin <edhelas_at_gmail_dot_com>
*
* @version 1.0
* @date 20 October 2010
*
* Copyright (C)2010 MOVIM project
*
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Pubsub\DiscoItems;
use Moxl\Xec\Action\Group\Create;
class ServerNodes extends WidgetCommon
{
function load()
{
$this->registerEvent('discoitems', 'onDiscoItems');
$this->registerEvent('discoerror', 'onDiscoError');
$this->registerEvent('creationsuccess', 'onCreationSuccess');
$this->registerEvent('creationerror', 'onCreationError');
}
function display()
{
if($_GET['s'] != null) {
$this->view->assign('server', $this->prepareServer($_GET['s']));
$this->view->assign('get_nodes', $this->call('ajaxGetNodes', "'".$_GET['s']."'"));
}
}
function onDiscoError($error)
{
RPC::call('movim_fill', 'servernodeshead', '');
}
function onCreationSuccess($items)
{
RPC::call('movim_redirect', Route::urlize('node', array($items[0], $items[1])));
}
function onCreationError($error) {
RPC::call('movim_fill', 'servernodes', '');
RPC::commit();
}
function ajaxGetNodes($server)
{
$nd = new \Modl\ItemDAO();
$nd->deleteItems($server);
$r = new DiscoItems;
$r->setTo($server)->request();
}
function ajaxCreateGroup($data)
{
//make a uri of the title
$uri = stringToUri($data['title']);
$r = new Create;
$r->setTo($data['server'])->setNode($uri)->setData($data['title'])
->request();
}
function onDiscoItems($server) {
$submit = $this->call('ajaxCreateGroup', "movim_parse_form('groupCreation')");
list($type) = explode('.', $server);
if(!in_array($type, array('conference', 'muc', 'discussion', 'chat'))) {
$head = '
<a
class="button color green"
onclick="movim_toggle_display(\'#groupCreation\')">
<i class="fa fa-plus"></i> '.t("Create a new group").'
</a>';
$html = '
<div class="popup" id="groupCreation">
<form name="groupCreation">
<fieldset>
<legend>'.$this->__('friendly.label').'</legend>
<div class="element large mini">
<input name="title" placeholder="'.$this->__('friendly.example').'"/>
</div>
<input type="hidden" name="server" value="'.$server.'"/>
</fieldset>
<div class="menu">
<a
class="button color icon yes blue merged left"
onclick="'.$submit.'"
>'.
__('button.add').'
</a><a
class="button icon no black merged right"
onclick="movim_toggle_display(\'#groupCreation\')"
>'.
__('button.close').'
</a>
</div>
</form>
</div>';
} else
$head = '';
$html .= $this->prepareServer($server);
RPC::call('movim_fill', 'servernodeshead', $head);
RPC::call('movim_fill', 'servernodeslist', $html);
RPC::commit();
}
function prepareServer($server) {
$nd = new \Modl\ItemDAO();
$items = $nd->getItems($server);
if($items == null)
return '';
$html = '<ul class="list">';
foreach($items as $i) {
if(substr($i->node, 0, 20) != 'urn:xmpp:microblog:0') {
$tags = '';
if($i->num != null)
$tags .= '<span class="tag">'.$i->num.'</span>';
if($i->subscription == 'subscribed')
$tags .= '<span class="tag green">'.$this->__('subscribed').'</span>';
$url = '';
if($i->node != null) {
$url = 'href="'.Route::urlize('node', array($i->server, $i->node)).'"';
} elseif($i->jid != null && !filter_var($i->jid, FILTER_VALIDATE_EMAIL)) {
$url = 'href="'.Route::urlize('server', array($i->jid)).'"';
} else {
$tags .= '<span class="tag">'.$i->jid.'</span>';
}
$html .= '
<li class="block">
<a '.$url.'>'.
'<span class="content">'.$i->getName().'</span>'.
$tags.'
</a>
</li>';
}
}
$html .= '</ul>';
return $html;
}
}

4
app/widgets/ServerNodes/locales.ini

@ -1,4 +0,0 @@
friendly.label = 'Give a friendly name to your group'
friendly.example = 'My Little Pony - Fan Club'
subscribed = 'Subscribed'
topics = 'Topics'

24
app/widgets/ServerNodes/servernodes.tpl

@ -1,24 +0,0 @@
<div class="breadcrumb protect red ">
<a href="{$c->route('explore')}">
<i class="fa fa-globe"></i> {$c->__('page.explore')}
</a>
<a href="{$c->route('server', $_GET['s'])}">
<i class="fa fa-sitemap"></i> {$_GET['s']}
</a>
<a>{$c->__('topics')}</a>
</div>
<div class="posthead paddedtopbottom" id="servernodeshead">
<a
href="#"
onclick="{$get_nodes};
this.className='button icon loading color orange'; this.onclick=null;"
class="button color">
<i class="fa fa-refresh"></i> {$c->__('button.refresh')}
</a>
</div>
<div id="servernodes" class="tabelem paddedtop" title="{$c->__('page.server')}">
<div id="newGroupForm"></div>
<div id="servernodeslist">
{$server}
</div>
</div>

118
app/widgets/Wall/Wall.php

@ -1,118 +0,0 @@
<?php
/**
* @package Widgets
*
* @file Wall.php
* This file is part of MOVIM.
*
* @brief The contact feed
*
* @author Jaussoin Timothée <edhelas_at_gmail_dot_com>
*
* @version 1.0
* @date 30 september 2011
*
* Copyright (C)2010 MOVIM project
*
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Pubsub\GetItems;
class Wall extends WidgetCommon
{
function load()
{
$this->addjs('wall.js');
$this->registerEvent('postmicroblog', 'onStream');
$this->registerEvent('stream', 'onStream');
$this->registerEvent('comment', 'onComment');
$this->registerEvent('nocomment', 'onNoComment');
$this->registerEvent('nocommentstream', 'onNoCommentStream');
$this->registerEvent('nostream', 'onNoStream');
$this->registerEvent('nostreamautorized', 'onNoStreamAutorized');
}
function display() {
$this->view->assign('refresh', $this->call('ajaxWall', '"'.$_GET['f'].'"'));
}
function onNoStream() {
$html = '<div style="padding: 1.5em; text-align: center;">Ain\'t Nobody Here But Us Chickens...</div>';
RPC::call('movim_fill', 'wall', $html);
RPC::call('hideWall');
RPC::commit();
}
function onNoStreamAutorized() {
$html = '<div style="padding: 1.5em; text-align: center;">I\'m sorry, Dave. I\'m afraid I can\'t do that.</div>';
RPC::call('movim_fill', 'wall', $html);
RPC::commit();
}
function onStream($payload) {
$html = $this->prepareFeed(-1, $payload['from']);
if($html != '') {
RPC::call('movim_fill', stringToUri($payload['from'].$payload['node']), $html);
RPC::call('MovimMap.init');
RPC::call('MovimMap.refresh');
}
RPC::commit();
}
function prepareFeed($start, $from = false) {
if(!$from && isset($_GET['f'])) {
$from = $_GET['f'];
} elseif(!$from) {
return '';
}
$pd = new \Modl\PostnDAO();
$pl = $pd->getNode($from, 'urn:xmpp:microblog:0', $start+1, 10);
$cd = new \Modl\ContactDAO();
$c = $cd->getRosterItem($from);
// We ask for the HTML of all the posts
$htmlmessages = $this->preparePosts($pl);
$next = $start + 10;
$html = '';
if(count($pl) > 0 && $htmlmessages != false) {
$wallhead = $this->tpl();
$wallhead->assign('start', $start);
$wallhead->assign('from', $from);
$wallhead->assign('posts', $htmlmessages);
$wallhead->assign('pl', $pl);
$wallhead->assign('refresh', $this->call('ajaxWall', "'".$from."'"));
$wallhead->assign('older', $this->call('ajaxGetFeed', "'".$next."'", "'".$from."'"));
$html = $wallhead->draw('_wall_head', true);
}
return $html;
}
function ajaxGetFeed($start, $from) {
RPC::call('movim_append', 'wall', $this->prepareFeed($start, $from));
RPC::call('MovimMap.refresh');
RPC::commit();
}
function ajaxWall($jid) {
$r = new GetItems;
$r->setTo($jid)
->setNode('urn:xmpp:microblog:0')
->request();
}
function ajaxSubscribe($jid) {
$this->xmpp->subscribeNode($jid);
}
}
?>

40
app/widgets/Wall/_wall_head.tpl

@ -1,40 +0,0 @@
{if="$start == -1"}
<div style="height: 13em;" id="postsmap"></div>
<div class="posthead paddedbottom">
<a
class="button color merged left"
href="{$c->route('blog',array($from, 'urn:xmpp:microblog:0'))}"
target="_blank"
>
<i class="fa fa-pencil"></i> {$c->__('blog.title')}
</a><a
class="button color orange merged right"
href="{$c->route('feed',array($from, 'urn:xmpp:microblog:0'))}"
target="_blank"
>
<i class="fa fa-rss"></i> {$c->__('feed.title')} (Atom)
</a>
<a
class="button color blue alone"
href="#"
onclick="{$refresh}
this.className= 'button color orange alone';
this.onclick = 'return false;'";
>
<i class="fa fa-refresh"></i>
</a>
</div>
{/if}
{$posts}
{if="count($pl) > 9"}
<div class="block large">
<div
class="older"
onclick="{$older} this.parentNode.style.display = 'none'">
<i class="fa fa-history"></i> {$c->__('post.older')}
</div>
</div>
{/if}

2
app/widgets/Wall/locales.ini

@ -1,2 +0,0 @@
feed.title = 'Feed'
blog.title = 'Blog'

10
app/widgets/Wall/wall.js

@ -1,10 +0,0 @@
function hideWall() {
wall = document.querySelector("#wall");
wall.parentNode.removeChild(wall);
createTabs();
}
movim_add_onload(function() {
MovimMap.init();
MovimMap.refresh();
});

17
app/widgets/Wall/wall.tpl

@ -1,17 +0,0 @@
<div class="tabelem" id="wall" title="{$c->__('feed.title')}" >
<div class="protect orange" title="{function="getFlagTitle("orange")"}"></div>
<div id="{function="stringToUri($_GET['f'].'urn:xmpp:microblog:0')"}">
{$wall = $c->prepareFeed(-1, $_GET['f'])}
{if="$wall"}
{$wall}
{else}
<div style="padding: 1.5em; text-align: center;">Ain't Nobody Here But Us Chickens...</div>
<script type="text/javascript">
MovimWebsocket.attach(function() {
{$refresh}
});
</script>
{/if}
<div class="spacetop clear"></div>
</div>
</div>

54
lib/XMPPtoForm.php

@ -134,36 +134,29 @@ class XMPPtoForm{
private function outCheckbox($s){
$this->html .= '
<ul class="simple">
<li class="action">
<span>';
if($s['label']==null){
$this->html .= $s['var'];
}
else{
$this->html .= $s['label'];
}
$this->html .= '
</span>';
$this->html .= '
<div class="action">
<div class="checkbox">
<input
id="'.$s['var'].'"
name="'.$s['var'].'"
type="checkbox"
label="'.$s['label'].'"
type="checkbox" '.$s->required;
if($s->value == "true" || $s->value == "1")
$this->html .= ' checked';
$this->html .= '/>';
<div class="select">
<select
type="'.$s['type'].'"
label="'.$s['label'].'"
id="'.$s["var"].'"
name="'.$s['var'].'" '.$multiple.' '.$s->required.'>';
$this->html .= '
<option value="true"';
if(isset($s->value) || $s->value == "true" || $s->value == "1")
$this->html .= ' selected="selected"';
$this->html .= '>'.__('button.yes').'</option>';
$this->html .= '
<label for="'.$s['var'].'"></label>
</div>
</div>
</li>
</ul>';
$this->html .= '
<option value="false"';
if(!isset($s->value) || $s->value == "false" || $s->value == "0")
$this->html .= ' selected="selected"';
$this->html .= '>'.__('button.no').'</option>';
$this->html .= '
</select>
</div>
<label for="'.$s["var"].'">'.$s["label"].'</label>';
}
private function outTextarea($s){
@ -293,6 +286,9 @@ class FormtoXMPP{
case "command":
$node = $this->stream->x;
break;
default:
$node = $this->stream->x;
break;
}
foreach($this->inputs as $key => $value) {
if($value === '' && $this->stream->getName() == "stream") {

6
linker.php

@ -45,7 +45,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st
$conn->on('message', function($message) use ($conn, $loop) {
if($message != '') {
#fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n");
fwrite(STDERR, colorize($message, 'yellow')." : ".colorize('received', 'green')."\n");
if($message == '</stream:stream>') {
$conn->close();
@ -76,7 +76,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st
}
if(!empty($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");
$conn->send(trim($xml));
}
}
@ -118,7 +118,7 @@ $connector($config->websocketurl, array('xmpp'))->then(function($conn) use (&$st
\Moxl\API::clear();
if(!empty($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");
$conn->send(trim($xml));
}

2
locales/locales.ini

@ -281,4 +281,4 @@ post.content_not_found = 'Content not found'
post.default_title = 'Contact publication'
[api]
api.error = 'The API is not reachable, try again later'
api.error = 'The API is not reachable, try again later'

31
system/Route.php

@ -5,33 +5,26 @@ class Route extends \BaseController {
public function __construct() {
$this->_routes = array(
'about' => array('x'),
'account' => false,
'accountnext' => array('s', 'err'),
'visio' => false,
'main' => false,
'news' => array('n'),
'loading' => false,
'admin' => false,
'explore' => false,
'discover' => false,
'profile' => false,
'contact' => array('f'),
'group' => array('g'),
'blog' => array('f'),
'chat' => array('f'),
'infos' => false,
'media' => array('f'),
'conf' => false,
'contact' => array('f'),
'disconnect' => array('err'),
'feed' => array('f'),
'group' => array('g'),
'help' => false,
'about' => array('x'),
'infos' => false,
'login' => array('err'),
'main' => false,
'media' => array('f'),
'news' => array('n'),
'pods' => false,
'disconnect' => array('err'),
'friend' => array('f'),
'blog' => array('f'),
'feed' => array('f'),
'nodeconfig' => array('s', 'n'),
'node' => array('s', 'n'),
'server' => array('s'),
'profile' => false,
'visio' => false
);
}

1
system/controllers/BaseController.php

@ -7,7 +7,6 @@ class BaseController {
protected $page;
function __construct() {
//this->loadLanguage();
$this->page = new TplPageBuilder();
$this->page->addScript('movim_hash.js');
$this->page->addScript('movim_utils.js');

65
system/template/TplPageBuilder.php

@ -101,70 +101,6 @@ class TplPageBuilder
{
echo $this->title;
}
/**
* Sets the page's color.
*/
function setColor($color)
{
$this->_color = $color;
}
/**
* Displays the current color.
*/
function color()
{
echo $this->_color;
}
/**
* Adds a link to the menu with the displayed label.
*/
function menuAddLink($label, $href, $active = false, $mobile = false)
{
$this->menu[] = array(
'type' => 'link',
'label' => $label,
'href' => $href,
'active' => $active,
'mobile' => $mobile
);
}
function menuAddVerbatim($html)
{
$this->menu[] = array(
'type' => 'verbatim',
'html' => $html,
);
}
/** shows up the menu. */
function menu()
{
echo '<ul class="menu">' . "\n";
foreach($this->menu as $link) {
if($link['type'] == 'link') {
echo "\t\t".'<li><a
href="'.Route::urlize($link['href']).'"
title="'.$link['label'].'"
class="'.$link['href'].'' ;
if($link['active'] == true) {
echo ' active ';
}
// If we display only the link on desktop
if($link['mobile'] == true) {
echo ' on_desktop ';
}
echo '"';
echo "><span class=\"on_desktop\">".$link['label'] . "</span></a></li>\n";
} else {
echo $link['html'];
}
}
echo "\t</ul>\n";
}
function addScript($script)
{
@ -238,4 +174,3 @@ class TplPageBuilder
//\system\Logs\Logger::displayFooterDebug();
}
}

5
themes/material/css/article.css

@ -110,3 +110,8 @@ article section content q li img {
max-height: 40rem;
max-width: 100%;
}
article ul li.pic img {
max-width: 30rem;
max-height: 30rem;
}

22
themes/material/css/style.css

@ -287,10 +287,10 @@ main > header > div > span.icon {
}
main > header > div > .return {
padding-left: 9rem;
padding-left: 8rem;
margin-left: -9rem;
display: inline-block;
padding-right: 1rem;
padding-right: 2rem;
max-width: calc(100% + 10rem);
height: 7rem;
box-sizing: border-box;
@ -300,7 +300,7 @@ main > header > div > .return {
main > header > div > .return.condensed > h2 {
line-height: 3.5rem;
font-size: 2.75rem;
margin-top: 0.6rem;
margin-top: 0.7rem;
margin-bottom: -0.5rem;
}
@ -433,7 +433,8 @@ span.icon {
}
span.icon img {
width: 100%;
max-width: 100%;
max-height: 100%;
}
li.oppose span.icon {
@ -544,8 +545,8 @@ header.big p {
background-color: white;
height: initial;
max-height: 90%;
width: 45rem;
margin-left: -22.5rem;
width: 50rem;
margin-left: -25rem;
overflow: hidden;
@ -590,13 +591,13 @@ header.big p {
@media screen and (max-width: 600px) {
.dialog {
width: 90%;
height: 80%;
height: 90%;
min-height: 0;
min-width: 0;
max-height: 80%;
max-height: 90%;
margin-left: -45%;
margin-top: 0;
top: 10%;
top: 5%;
}
}
@ -837,6 +838,9 @@ dl dd {
.spinner.on:before,
.spinner.on:after {
top: 3rem;
}
.spinner.on:before {
animation: spinner 1s linear infinite;
-webkit-animation: spinner 1s linear infinite;
}

Loading…
Cancel
Save