Browse Source

- Refactor Movim to load and use properly the new Moxl release

pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
53960d1c7f
  1. 2
      app/models/contact/Contact.php
  2. 4
      app/widgets/Ack/Ack.php
  3. 7
      app/widgets/Avatar/Avatar.php
  4. 10
      app/widgets/Bookmark/Bookmark.php
  5. 45
      app/widgets/Chat/Chat.php
  6. 4
      app/widgets/Chat/_chat_contact.tpl
  7. 7
      app/widgets/Config/Config.php
  8. 13
      app/widgets/ContactAction/ContactAction.php
  9. 2
      app/widgets/ContactCard/ContactCard.php
  10. 4
      app/widgets/ContactInfo/ContactInfo.php
  11. 6
      app/widgets/ContactManage/ContactManage.php
  12. 4
      app/widgets/ContactPubsubSubscription/ContactPubsubSubscription.php
  13. 13
      app/widgets/ContactSummary/ContactSummary.php
  14. 14
      app/widgets/Feed/Feed.php
  15. 6
      app/widgets/Location/Location.php
  16. 1
      app/widgets/Login/Login.php
  17. 3
      app/widgets/News/News.php
  18. 27
      app/widgets/Node/Node.php
  19. 8
      app/widgets/NodeAffiliations/NodeAffiliations.php
  20. 11
      app/widgets/NodeConfig/NodeConfig.php
  21. 7
      app/widgets/NodeSubscriptions/NodeSubscriptions.php
  22. 2
      app/widgets/Poller/Poller.php
  23. 18
      app/widgets/Presence/Presence.php
  24. 27
      app/widgets/Profile/Profile.php
  25. 12
      app/widgets/PubsubSubscriptionConfig/PubsubSubscriptionConfig.php
  26. 168
      app/widgets/Roster/Roster.php
  27. 11
      app/widgets/ServerNodes/ServerNodes.php
  28. 23
      app/widgets/Vcard/Vcard.php
  29. 17
      app/widgets/Vcard4/Vcard4.php
  30. 2
      app/widgets/Visio/Visio.php
  31. 11
      app/widgets/VisioExt/VisioExt.php
  32. 8
      app/widgets/Wall/Wall.php
  33. 29
      app/widgets/WidgetCommon/WidgetCommon.php

2
app/models/contact/Contact.php

@ -154,6 +154,8 @@ class Contact extends Model {
$this->date = (string)$vcard->vCard->BDAY;
else
$this->date = null;
$this->date = date(DATE_ISO8601, strtotime($this->date));
$this->name = (string)$vcard->vCard->NICKNAME;
$this->fn = (string)$vcard->vCard->FN;

4
app/widgets/Ack/Ack.php

@ -16,6 +16,8 @@
*
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Ack\Send;
class Ack extends WidgetBase {
function load()
@ -35,7 +37,7 @@ class Ack extends WidgetBase {
}
function ajaxAckRequest($to, $id) {
$ack = new \moxl\AckSend();
$ack = new Send;
$ack->setTo($to)
->setId($id)
->request();

7
app/widgets/Avatar/Avatar.php

@ -15,6 +15,9 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Avatar\Get;
use Moxl\Xec\Action\Avatar\Set;
class Avatar extends WidgetBase
{
function load()
@ -80,7 +83,7 @@ class Avatar extends WidgetBase
}
function ajaxGetAvatar() {
$r = new moxl\AvatarGet();
$r = new Get;
$r->setTo($this->user->getLogin())
->setMe()
->request();
@ -92,7 +95,7 @@ class Avatar extends WidgetBase
$p->fromBase((string)$avatar->photobin->value);
$p->set($this->user->getLogin());
$r = new moxl\AvatarSet();
$r = new Set;
$r->setData($avatar->photobin->value)->request();
}
}

10
app/widgets/Bookmark/Bookmark.php

@ -18,6 +18,10 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Bookmark\Get;
use Moxl\Xec\Action\Bookmark\Set;
use Moxl\Xec\Action\Presence\Muc;
class Bookmark extends WidgetBase
{
private $_list_server;
@ -137,7 +141,7 @@ class Bookmark extends WidgetBase
function ajaxGetBookmark()
{
$b = new moxl\BookmarkGet();
$b = new Get;
$b->setTo($this->user->getLogin())
->request();
}
@ -175,7 +179,7 @@ class Bookmark extends WidgetBase
}
$b = new moxl\BookmarkSet();
$b = new Set;
$b->setArr($arr)
->setTo($this->user->getLogin())
->request();
@ -216,7 +220,7 @@ class Bookmark extends WidgetBase
// Join a MUC
function ajaxBookmarkMucJoin($jid, $nickname)
{
$p = new moxl\PresenceMuc();
$p = new Muc;
$p->setTo($jid)
->setNickname($nickname)
->request();

45
app/widgets/Chat/Chat.php

@ -17,6 +17,11 @@
*
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Message\Composing;
use Moxl\Xec\Action\Message\Paused;
use Moxl\Xec\Action\Message\Publish;
use Moxl\Xec\Action\Presence\Unavaiable;
class Chat extends WidgetBase {
function load() {
@ -112,7 +117,7 @@ class Chat extends WidgetBase {
// Muc case
elseif($message->ressource != '') {
$html=$this->prepareMessage($message, true);
$html = $this->prepareMessage($message, true);
RPC::call('movim_append', 'messages' . $message->jidfrom, $html);
RPC::call('scrollTalk', 'messages' . $message->jidfrom);
}
@ -124,7 +129,7 @@ class Chat extends WidgetBase {
}
function onComposing($jid) {
$rd=new \modl\RosterLinkDAO();
$rd = new \Modl\RosterLinkDAO();
$contact = $rd->get(echapJid($jid));
@ -135,7 +140,7 @@ class Chat extends WidgetBase {
}
function onPaused($jid) {
$rd=new \modl\RosterLinkDAO();
$rd=new \Modl\RosterLinkDAO();
$contact=$rd->get(echapJid($jid));
@ -146,9 +151,9 @@ class Chat extends WidgetBase {
}
function onAttention($jid) {
$rc=new \modl\ContactDAO();
$contact=$rc->getRosterItem(echapJid($jid));
$html='
$rc = new \Modl\ContactDAO();
$contact = $rc->getRosterItem(echapJid($jid));
$html = '
<div style="font-weight: bold; color: black;" class="message" >
<span class="date">' . date('G:i', time()) . '</span>' . t('%s needs your attention', $contact->getTrueName()) . '
</div>';
@ -162,12 +167,12 @@ class Chat extends WidgetBase {
* @return void
*/
function ajaxOpenTalk($jid) {
$rc = new \modl\ContactDAO();
$rc = new \Modl\ContactDAO();
$contact = $rc->getRosterItem(echapJid($jid));
if(isset($contact) && $contact->chaton == 0&& !in_array($contact->presence, array(5, 6))) {
if(isset($contact) && $contact->chaton == 0 && !in_array($contact->presence, array(5, 6))) {
$contact->chaton = 2;
$rd = new \modl\RosterLinkDAO();
$rd = new \Modl\RosterLinkDAO();
$rd->setChat(echapJid($jid), 2);
RPC::call('movim_prepend', 'chats', $this->prepareChat($contact));
RPC::call('scrollAllTalks');
@ -192,7 +197,7 @@ class Chat extends WidgetBase {
* @return void
*/
function ajaxSendMessage($to, $message, $muc=false, $ressource=false, $encrypted=false) {
$m=new \modl\Message();
$m=new \Modl\Message();
$m->session = $this->user->getLogin();
$m->jidto = echapJid($to);
$m->jidfrom = $this->user->getLogin();
@ -212,7 +217,7 @@ class Chat extends WidgetBase {
$m->published = date('Y-m-d H:i:s');
$m->delivered = date('Y-m-d H:i:s');
$md=new \modl\MessageDAO();
$md=new \Modl\MessageDAO();
$md->set($m);
$evt=new Event();
@ -223,7 +228,7 @@ class Chat extends WidgetBase {
}
// We decode URL codes to send the correct message to the XMPP server
$m = new \moxl\MessagePublish();
$m = new Publish;
$m->setTo($to);
$m->setContent(htmlspecialchars(rawurldecode($message)));
@ -241,7 +246,7 @@ class Chat extends WidgetBase {
* @return void
*/
function ajaxSendComposing($to) {
$mc=new \moxl\MessageComposing();
$mc = new Composing;
$mc->setTo($to)->request();
}
/**
@ -251,7 +256,7 @@ class Chat extends WidgetBase {
* @return void
*/
function ajaxSendPaused($to) {
$mp=new \moxl\MessagePaused();
$mp=new Paused;
$mp->setTo($to)->request();
}
/**
@ -261,7 +266,7 @@ class Chat extends WidgetBase {
* @return void
*/
function ajaxCloseTalk($jid) {
$rd=new \modl\RosterLinkDAO();
$rd = new \Modl\RosterLinkDAO();
$contact = $rd->get(echapJid($jid));
$contact->chaton = 0;
$rd->setNow($contact);
@ -270,7 +275,7 @@ class Chat extends WidgetBase {
}
function ajaxHideTalk($jid) {
$rd = new \modl\RosterLinkDAO();
$rd = new \Modl\RosterLinkDAO();
$contact = $rd->get(echapJid($jid));
if($contact->chaton == 1) {
@ -289,7 +294,7 @@ class Chat extends WidgetBase {
* @return void
*/
function ajaxExitMuc($jid, $ressource) {
$pu = new \moxl\ PresenceUnavaiable();
$pu = new Unavaiable;
$pu->setTo($jid)->setRessource($ressource)->request();
}
@ -361,7 +366,7 @@ class Chat extends WidgetBase {
}
// And we show the subscribed conferences
$cd = new \modl\ConferenceDAO();
$cd = new \Modl\ConferenceDAO();
$cs = $cd->getConnected();
if($cs) {
@ -376,7 +381,7 @@ class Chat extends WidgetBase {
// Prepare Chat
function prepareChat($contact) {
$md = new \modl\MessageDAO();
$md = new \Modl\MessageDAO();
$messages = $md->getContact(echapJid($contact->jid), 0, 10);
$messageshtml = '';
if($messages != null) {
@ -428,7 +433,7 @@ class Chat extends WidgetBase {
$jid = $conference->conference;
// Zeu messages
$md = new \modl\MessageDAO();
$md = new \Modl\MessageDAO();
$messages = $md->getContact($jid, 0, 10);
$messageshtml = '';

4
app/widgets/Chat/_chat_contact.tpl

@ -11,8 +11,8 @@
</div>
<div class="messages" id="messages{$contact->jid}">
{$messageshtml}
<div style="display: none;" class="message composing" id="composing{$contact->jid}">{$c->t('Composing...')}</div>
<div style="display: none;" class="message composing" id="paused{$contact->jid}">{$c->t('Paused...')}</div>
<div style="display: none;" class="message composing" id="composing{$contact->jid}">{$c->t('Composing')}</div>
<div style="display: none;" class="message composing" id="paused{$contact->jid}">{$c->t('Paused')}</div>
</div>
<div class="text">

7
app/widgets/Config/Config.php

@ -18,6 +18,9 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Storage\Get;
use Moxl\Xec\Action\Storage\Set;
class Config extends WidgetBase
{
function load()
@ -59,14 +62,14 @@ class Config extends WidgetBase
if(isset($config))
$data = array_merge($config, $data);
$s = new moxl\StorageSet();
$s = new Set;
$s->setXmlns('movim:prefs')
->setData(serialize($data))
->request();
}
function ajaxGet() {
$s = new moxl\StorageGet();
$s = new Get;
$s->setXmlns('movim:prefs')
->request();
}

13
app/widgets/ContactAction/ContactAction.php

@ -15,6 +15,11 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Roster\AddItem;
use Moxl\Xec\Action\Roster\RemoveItem;
use Moxl\Xec\Action\Presence\Subscribe;
use Moxl\Xec\Action\Presence\Unsubscribe;
class ContactAction extends WidgetCommon
{
/**
@ -24,27 +29,27 @@ class ContactAction extends WidgetCommon
* @returns
*/
function ajaxAddContact($jid) {
$r = new moxl\RosterAddItem();
$r = new AddItem;
$r->setTo($jid)
->setFrom($this->user->getLogin())
->request();
}
function ajaxSubscribeContact($jid) {
$p = new moxl\PresenceSubscribe();
$p = new Subscribe;
$p->setTo($jid)
->request();
}
function ajaxRemoveContact($jid) {
$r = new moxl\RosterRemoveItem();
$r = new RemoveItem;
$r->setTo($jid)
->request();
}
function ajaxUnsubscribeContact($jid) {
$p = new moxl\PresenceUnsubscribe();
$p = new Unsubscribe;
$p->setTo($jid)
->request();
}

2
app/widgets/ContactCard/ContactCard.php

@ -145,7 +145,7 @@ class ContactCard extends WidgetCommon
function build()
{
$cd = new modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$contact = $cd->get($_GET['f']);
?>
<div class="tabelem paddedtop" title="<?php echo t('Profile'); ?>" id="contactcard">

4
app/widgets/ContactInfo/ContactInfo.php

@ -30,7 +30,7 @@ class ContactInfo extends WidgetCommon
function prepareContactInfo($from = false)
{
$cd = new \modl\ContactDAO();
$cd = new \Modl\ContactDAO();
if($from != $this->user->getLogin())
$c = $cd->getRosterItem($from);
else
@ -105,7 +105,7 @@ class ContactInfo extends WidgetCommon
&& $c->ver) {
$node = $c->node.'#'.$c->ver;
$cad = new \modl\CapsDAO();
$cad = new \Modl\CapsDAO();
$caps = $cad->get($node);
$clienttype =

6
app/widgets/ContactManage/ContactManage.php

@ -18,6 +18,8 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Roster\UpdateItem;
class ContactManage extends WidgetCommon
{
function load() {
@ -32,7 +34,7 @@ class ContactManage extends WidgetCommon
}
public function ajaxContactManage($form) {
$rd = new \moxl\RosterUpdateItem();
$rd = new UpdateItem;
$rd->setTo(echapJid($form['jid']))
->setFrom($this->user->getLogin())
->setName(htmlspecialchars($form['alias']))
@ -41,7 +43,7 @@ class ContactManage extends WidgetCommon
}
private function prepareContactManage($jid) {
$rd = new \modl\RosterLinkDAO();
$rd = new \Modl\RosterLinkDAO();
$groups = $rd->getGroups();
$rl = $rd->get($jid);

4
app/widgets/ContactPubsubSubscription/ContactPubsubSubscription.php

@ -18,6 +18,8 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\PubsubSubscription\ListGetFriends;
class ContactPubsubSubscription extends WidgetBase
{
@ -55,7 +57,7 @@ class ContactPubsubSubscription extends WidgetBase
}
function ajaxGetGroupSubscribedList($to){
$r = new moxl\PubsubSubscriptionListGetFriends();
$r = new ListGetFriends;
$r->setTo($to)->request();
}

13
app/widgets/ContactSummary/ContactSummary.php

@ -18,9 +18,10 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Vcard\Get;
class ContactSummary extends WidgetCommon
{
function load()
{
$this->addcss('contactsummary.css');
@ -35,7 +36,7 @@ class ContactSummary extends WidgetCommon
function ajaxRefreshVcard($jid)
{
$r = new moxl\VcardGet();
$r = new Get;
$r->setTo($jid)->request();
}
@ -74,18 +75,14 @@ class ContactSummary extends WidgetCommon
function build()
{
$cd = new modl\ContactDAO();
$cd = new \Modl\ContactDAO();
if($_GET['f'] == $this->user->getLogin()) {
$contact = $cd->get($this->user->getLogin());
} /*else {
$contact = $cd->getRosterItem($_GET['f']);
$refresh = true;
}*/
}
if(!isset($contact)) {
$contact = $cd->get($_GET['f']);
//$refresh = false;
}
?>
<div id="contactsummary">

14
app/widgets/Feed/Feed.php

@ -1,5 +1,9 @@
<?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;
@ -45,7 +49,7 @@ class Feed extends WidgetCommon {
$config = $this->user->getConfig();
$config['feed'] = 'created';
$s = new moxl\StorageSet();
$s = new Set;
$s->setXmlns('movim:prefs')
->setData(serialize($config))
->request();
@ -55,7 +59,7 @@ class Feed extends WidgetCommon {
$config = $this->user->getConfig();
$config['feed'] = 'error';
$s = new moxl\StorageSet();
$s = new Set;
$s->setXmlns('movim:prefs')
->setData(serialize($config))
->request();
@ -82,7 +86,7 @@ class Feed extends WidgetCommon {
}
function ajaxCreateCommentNode($parentid) {
$n = new moxl\MicroblogCommentCreateNode();
$n = new CommentCreateNode;
$n->setTo($this->user->getLogin())
->setParentId($parentid)
->request();
@ -149,7 +153,7 @@ class Feed extends WidgetCommon {
}
function prepareFeed($start) {
$pd = new \modl\PostnDAO();
$pd = new \Modl\PostnDAO();
$pl = $pd->getFeed($start+1, $this->_feedsize);
$html = $this->preparePosts($pl);
@ -180,7 +184,7 @@ class Feed extends WidgetCommon {
function ajaxCreateNode()
{
$p = new moxl\MicroblogCreateNode();
$p = new CreateNode;
$p->setTo($this->user->getLogin())
->request();
}

6
app/widgets/Location/Location.php

@ -18,6 +18,8 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Location\Publish;
class Location extends WidgetBase
{
function load()
@ -46,7 +48,7 @@ class Location extends WidgetBase
'uri' => ''//'http://www.openstreetmap.org/'.urlencode('?lat='.(string)$pos->lat.'&lon='.(string)$pos->lon.'&zoom=10')
);
$p = new moxl\LocationPublish();
$p = new Publish;
$p->setTo($this->user->getLogin())
->setGeo($geo)
->request();
@ -77,7 +79,7 @@ class Location extends WidgetBase
{
$submit = $this->genCallAjax('ajaxLocationPublish', "getMyPositionData()");
$cd = new modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$c = $cd->get($this->user->getLogin());
if($c->loctimestamp) {

1
app/widgets/Login/Login.php

@ -1,5 +1,4 @@
<?php
if (!defined('DOCUMENT_ROOT')) die('Access denied');
/**
* @package Widgets
*

3
app/widgets/News/News.php

@ -1,5 +1,4 @@
<?php
if (!defined('DOCUMENT_ROOT')) die('Access denied');
class News extends WidgetCommon {
private $_feedsize = 20;
@ -40,7 +39,7 @@ class News extends WidgetCommon {
}
function prepareNews($start) {
$pd = new \modl\PostnDAO();
$pd = new \Modl\PostnDAO();
$pl = $pd->getNews($start+1, $this->_feedsize);
$html = $this->preparePosts($pl);

27
app/widgets/Node/Node.php

@ -18,6 +18,13 @@
* 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;
@ -111,10 +118,10 @@ class Node extends WidgetCommon
function ajaxGetItems($server, $node)
{
$pd = new modl\PostnDAO();
$pd = new \Modl\PostnDAO();
$pd->deleteNode($server, $node);
$r = new moxl\PubsubGetItems();
$r = new GetItems;
$r->setTo($server)
->setNode($node)
->request();
@ -122,7 +129,7 @@ class Node extends WidgetCommon
function ajaxSubscribe($data, $server, $node)
{
$g = new moxl\PusubSubscribe();
$g = new Subscribe;
$g->setTo($server)
->setNode($node)
->setFrom($this->user->getLogin())
@ -132,10 +139,10 @@ class Node extends WidgetCommon
function ajaxUnsubscribe($server, $node)
{
$sd = new \modl\SubscriptionDAO();
$sd = new \Modl\SubscriptionDAO();
foreach($sd->get($server, $node) as $s) {
$g = new moxl\PubsubUnsubscribe();
$g = new Unsubscribe;
$g->setTo($server)
->setNode($node)
->setSubid($s->subid)
@ -146,7 +153,7 @@ class Node extends WidgetCommon
function ajaxGetSubscriptions($server, $node)
{
$r = new moxl\PubsubGetSubscriptions();
$r = new GetSubscriptions;
$r->setTo($server)
->setNode($node)
->setSync()
@ -154,13 +161,13 @@ class Node extends WidgetCommon
}
function ajaxGetAffiliations($server, $node){
$r = new moxl\PubsubGetAffiliations();
$r = new GetAffiliations;
$r->setTo($server)->setNode($node)
->request();
}
function ajaxGetMetadata($server, $node){
$r = new moxl\PubsubGetMetadata();
$r = new GetMetadata;
$r->setTo($server)->setNode($node)
->request();
}
@ -207,7 +214,7 @@ class Node extends WidgetCommon
}
function preparePostsNode($serverid, $groupid, $start) {
$pd = new \modl\PostnDAO();
$pd = new \Modl\PostnDAO();
$pl = $pd->getNode($serverid, $groupid, $start+1, $this->_feedsize);
$html = $this->preparePosts($pl);
@ -237,7 +244,7 @@ class Node extends WidgetCommon
}
function searchSubscription($server, $node) {
$sd = new \modl\SubscriptionDAO();
$sd = new \Modl\SubscriptionDAO();
$subs = $sd->get($server, $node);
if($subs != null)

8
app/widgets/NodeAffiliations/NodeAffiliations.php

@ -18,9 +18,11 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Pubsub\GetAffiliations;
use Moxl\Xec\Action\Pubsub\SetAffiliations;
class NodeAffiliations extends WidgetBase
{
function load()
{
$this->registerEvent('pubsubaffiliations', 'onGroupMemberList');
@ -71,13 +73,13 @@ class NodeAffiliations extends WidgetBase
}
function ajaxChangeAffiliation($server, $node, $data){
$r = new moxl\PubsubSetAffiliations();
$r = new SetAffiliations;
$r->setNode($node)->setTo($server)->setData($data)
->request();
}
function ajaxGetGroupMemberList($server, $node){
$r = new moxl\PubsubGetAffiliations();
$r = new GetAffiliations;
$r->setTo($server)->setNode($node)
->request();
}

11
app/widgets/NodeConfig/NodeConfig.php

@ -18,6 +18,9 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Pubsub\GetConfig;
use Moxl\Xec\Action\Pubsub\SetConfig;
class NodeConfig extends WidgetBase
{
@ -90,24 +93,24 @@ class NodeConfig extends WidgetBase
}
function ajaxGroupConfig($server, $node){
$r = new moxl\PubsubGetConfig();
$r = new GetConfig;
$r->setTo($server)
->setNode($node)
->request();
}
function ajaxGroupDelete($server, $node){
$nd = new modl\ItemDAO();
$nd = new \Modl\ItemDAO();
$nd->deleteItem($server, $node);
$r = new moxl\GroupDelete();
$r = new \Moxl\GroupDelete();
$r->setTo($server)
->setNode($node)
->request();
}
function ajaxSubmitConfig($data, $server, $node){
$r = new moxl\PubsubSetConfig();
$r = new SetConfig;
$r->setTo($server)
->setNode($node)
->setData($data)

7
app/widgets/NodeSubscriptions/NodeSubscriptions.php

@ -18,6 +18,9 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Pubsub\GetSubscriptions;
use Moxl\Xec\Action\Pubsub\SetSubscriptions;
class NodeSubscriptions extends WidgetBase
{
@ -73,7 +76,7 @@ class NodeSubscriptions extends WidgetBase
}
function ajaxChangeSubscriptions($server, $node, $data){
$r = new moxl\PubsubSetSubscriptions();
$r = new SetSubscriptions;
$r->setNode($node)
->setTo($server)
->setData($data)
@ -81,7 +84,7 @@ class NodeSubscriptions extends WidgetBase
}
function ajaxGetSubscriptions($server, $node){
$r = new moxl\PubsubGetSubscriptions();
$r = new GetSubscriptions;
$r->setTo($server)
->setNode($node)
->request();

2
app/widgets/Poller/Poller.php

@ -24,7 +24,7 @@ class Poller extends WidgetBase
{
// We add the javascript that does the job.
$this->addjs('poller.js');
// And that's it!
// And that's it!
}
function build()

18
app/widgets/Presence/Presence.php

@ -18,6 +18,12 @@
* 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;
use Moxl\Xec\Action\Presence\Unavaiable;
class Presence extends WidgetBase
{
@ -56,19 +62,19 @@ class Presence extends WidgetBase
switch($show) {
case 'chat':
$p = new moxl\PresenceChat();
$p = new Chat;
$p->setStatus($presence['status'])->request();
break;
case 'away':
$p = new moxl\PresenceAway();
$p = new Away;
$p->setStatus($presence['status'])->request();
break;
case 'dnd':
$p = new moxl\PresenceDND();
$p = new DND;
$p->setStatus($presence['status'])->request();
break;
case 'xa':
$p = new moxl\PresenceXA();
$p = new XA;
$p->setStatus($presence['status'])->request();
break;
}
@ -76,7 +82,7 @@ class Presence extends WidgetBase
function ajaxLogout()
{
$p = new moxl\PresenceUnavaiable();
$p = new Unavaiable;
$p->setType('terminate')
->request();
@ -91,7 +97,7 @@ class Presence extends WidgetBase
$session = \Sessionx::start();
$pd = new \modl\PresenceDAO();
$pd = new \Modl\PresenceDAO();
$p = $pd->getPresence($this->user->getLogin(), $session->ressource);
if($p)

27
app/widgets/Profile/Profile.php

@ -18,9 +18,13 @@
* 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()
@ -58,23 +62,23 @@ class Profile extends WidgetCommon
switch($presence['show']) {
case 'chat':
$p = new moxl\PresenceChat();
$p = new Chat;
$p->setStatus($status)->request();
break;
case 'away':
$p = new moxl\PresenceAway();
$p = new Away;
$p->setStatus($status)->request();
break;
case 'dnd':
$p = new moxl\PresenceDND();
$p = new DND;
$p->setStatus($status)->request();
break;
case 'xa':
$p = new moxl\PresenceXA();
$p = new XA;
$p->setStatus($status)->request();
break;
default :
$p = new moxl\PresenceChat();
$p = new Chat;
$p->setStatus($status)->request();
break;
}
@ -101,15 +105,7 @@ class Profile extends WidgetCommon
// Contact general infos
$html .= '
<h1 style="text-decoration: none;">'.$me->getTrueName().'</h1>';
/*if($this->testIsSet($me->name))
$html .= $me->name.' ';
else
$html .= $me->getTrueName().' ';
if($this->testIsSet($me->url))
$html .= '<br /><a target="_blank" href="'.$me->url.'">'.$me->url.'</a>';
*/
$html .= '
<div class="textbubble">
<textarea
@ -139,7 +135,6 @@ class Profile extends WidgetCommon
function build()
{
?>
<div id="profile">
<?php
echo $this->prepareVcard();

12
app/widgets/PubsubSubscriptionConfig/PubsubSubscriptionConfig.php

@ -18,6 +18,10 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\PubsubSubscription\ListGet;
use Moxl\Xec\Action\PubsubSubscription\ListAdd;
use Moxl\Xec\Action\PubsubSubscription\ListRemove;
class PubsubSubscriptionConfig extends WidgetBase
{
@ -43,7 +47,7 @@ class PubsubSubscriptionConfig extends WidgetBase
function prepareList($list) {
$configlist = $this->tpl();
$sd = new \modl\SubscriptionDAO();
$sd = new \Modl\SubscriptionDAO();
$listhtml = '';
@ -105,14 +109,14 @@ class PubsubSubscriptionConfig extends WidgetBase
$data = array('title' => $name);
if($state) {
$r = new moxl\PubsubSubscriptionListAdd();
$r = new ListAdd;
$r->setNode($node)
->setTo($server)
->setFrom($this->user->getLogin())
->setData($data)
->request();
} else {
$r = new moxl\PubsubSubscriptionListRemove();
$r = new ListRemove;
$r->setNode($node)
->setTo($server)
->setFrom($this->user->getLogin())
@ -121,7 +125,7 @@ class PubsubSubscriptionConfig extends WidgetBase
}
function ajaxGetGroupSubscribedList(){
$r = new moxl\PubsubSubscriptionListGet();
$r = new ListGet;
$r->request();
}

168
app/widgets/Roster/Roster.php

@ -18,6 +18,8 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Roster\GetList;
class Roster extends WidgetBase
{
private $grouphtml;
@ -57,7 +59,7 @@ class Roster extends WidgetBase
{
$arr = $presence->getPresence();
$cd = new \modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$c = $cd->getRosterItem($arr['jid'], true);
if($c != null) {
@ -91,7 +93,7 @@ class Roster extends WidgetBase
*/
function ajaxRefreshRoster()
{
$r = new moxl\RosterGetList();
$r = new GetList;
$r->request();
}
@ -184,165 +186,8 @@ class Roster extends WidgetBase
return $contactview->draw('_roster_contact', true);
}
/**
* @brief Generate the HTML for a roster contact
* @param $contact
* @param $inner
* @returns
*/
/*
function prepareRosterElement($contact, $caps = false)
{
$type = '';
$jingle = $jingle_audio = $jingle_video = $jingle_ice = false;
if($caps && isset($caps[$contact->node.'#'.$contact->ver])) {
$cap = $caps[$contact->node.'#'.$contact->ver];
$type = $cap->type;
$client = $cap->name;
$client = explode(' ',$client);
$client = reset($client);
$features = $cap->features;
$features = unserialize($features);
if(array_search('urn:xmpp:jingle:1', $features) !== null) {
$jingle = true;
if(array_search('urn:xmpp:jingle:apps:rtp:audio', $features) !== null) {
$jingle_audio = true;
}
if(array_search('urn:xmpp:jingle:apps:rtp:video', $features) !== null) {
$jingle_video = true;
}
if(array_search('urn:xmpp:jingle:transports:ice-udp:0', $features)
|| array_search('urn:xmpp:jingle:transports:ice-udp:1', $features)) {
$jingle_ice = true;
}
}
}
$html = '';
$html .= '<li
class="';
if(isset($_GET['f']) && $contact->jid == $_GET['f'])
$html .= 'active ';
if($contact->last != null && $contact->last > 60)
$html .= 'inactive ';
if($contact->value && $contact->value < 5) {
$presencestxt = getPresencesTxt();
$html.= $presencestxt[$contact->value];
if(isset($client))
$html .= ' client '.strtolower($client);
} elseif($contact->value == 6)
$html .= 'server_error';
else
$html .= 'offline';
$html .= '"';
$html .= '
id="roster'.$contact->jid.$contact->ressource.'"
data-jid="'.$contact->jid.'"
data-priority="'.$contact->value.'"
>';
$html .= '<div class="chat on" onclick="'.$this->genCallWidget("Chat","ajaxOpenTalk", "'".$contact->jid."'").'"></div>';
if($type == 'handheld')
$html .= '<div class="infoicon mobile"></div>';
if($type == 'web')
$html .= '<div class="infoicon web"></div>';
if($type == 'bot')
$html .= '<div class="infoicon bot"></div>';
if($jingle_video && $jingle_ice && $jingle_audio)
$html .= '<div class="infoicon jingle" onclick="Popup.open(\''.$contact->jid.'/'.$contact->ressource.'\')"></div>';
if(($contact->tuneartist != null && $contact->tuneartist != '') ||
($contact->tunetitle != null && $contact->tunetitle != ''))
$html .= '<div class="infoicon tune"></div>';
$html .= '<a
title="'.$contact->jid;
if($contact->status != '')
$html .= ' - '.htmlentities($contact->status, ENT_QUOTES, 'UTF-8');
if($contact->ressource != '')
$html .= ' ('.$contact->ressource.')';
$html .= '"';
$html .= ' href="'.Route::urlize('friend', $contact->jid).'"
>
<img
class="avatar"
src="'.$contact->getPhoto('s').'"
/>'.
$contact->getTrueName();
$html .= '<br /><span class="ressource">';
if($contact->status != '')
$html .= htmlentities($contact->status, ENT_QUOTES, 'UTF-8') . ' - ';
if($contact->rosterask == 'subscribe')
$html .= " #";
if($contact->ressource != '')
$html .= ' '.$contact->ressource.'';
$html .= '</span>
</a>';
$html .= '</li>';
return $html;
}
*/
/**
* @brief Create the HTML for a roster group and add the title
* @param $contacts
* @param $i
* @returns html
*/
/*
private function prepareRosterGroup($contacts, &$i, $caps)
{
$j = $i;
// We get the current name of the group
$currentgroup = $contacts[$i]->groupname;
// We grab all the contacts of the group
$grouphtml = '';
while(isset($contacts[$i]) && $contacts[$i]->groupname == $currentgroup) {
$grouphtml .= $this->prepareRosterElement($contacts[$i], $caps);
$i++;
}
// And we add the title at the head of the group
if($currentgroup == '')
$currentgroup = t('Ungrouped');
$groupshown = '';
// get the current showing state of the group and the offline contacts
$groupState = Cache::c('group'.$currentgroup);
if($groupState == false)
$groupshown = 'groupshown';
$count = $i-$j;
$grouphtml = '
<div id="group'.$currentgroup.'" class="'.$groupshown.'">
<h1 onclick="'.$this->genCallAjax('ajaxToggleCache', "'group".$currentgroup."'").'">'.
$currentgroup.' - '.$count.'
</h1>'.$grouphtml.'
</div>';
return $grouphtml;
}*/
private function getCaps() {
$capsdao = new modl\CapsDAO();
$capsdao = new \Modl\CapsDAO();
$caps = $capsdao->getAll();
$capsarr = array();
@ -357,12 +202,11 @@ class Roster extends WidgetBase
* @brief Here we generate the roster
* @returns
*
*
*/
function prepareRoster()
{
$contactdao = new \modl\ContactDAO();
$contactdao = new \Modl\ContactDAO();
$contacts = $contactdao->getRoster();
$capsarr = $this->getCaps();

11
app/widgets/ServerNodes/ServerNodes.php

@ -18,6 +18,9 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Pubsub\DiscoItems;
use Moxl\Xec\Action\Group\Create;
class ServerNodes extends WidgetCommon
{
function load()
@ -90,7 +93,7 @@ class ServerNodes extends WidgetCommon
}
function prepareServer($server) {
$nd = new \modl\ItemDAO();
$nd = new \Modl\ItemDAO();
$items = $nd->getItems($server);
if($items == null)
@ -148,10 +151,10 @@ class ServerNodes extends WidgetCommon
function ajaxGetNodes($server)
{
$nd = new modl\ItemDAO();
$nd = new \Modl\ItemDAO();
$nd->deleteItems($server);
$r = new moxl\PubsubDiscoItems();
$r = new DiscoItems;
$r->setTo($server)->request();
}
@ -160,7 +163,7 @@ class ServerNodes extends WidgetCommon
//make a uri of the title
$uri = stringToUri($data['title']);
$r = new moxl\GroupCreate();
$r = new Create;
$r->setTo($data['server'])->setNode($uri)->setData($data['title'])
->request();
}

23
app/widgets/Vcard/Vcard.php

@ -18,6 +18,9 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Vcard\Get;
use Moxl\Xec\Action\Vcard\Set;
class Vcard extends WidgetBase
{
function load()
@ -86,22 +89,22 @@ class Vcard extends WidgetBase
$c->description = trim($vcard->desc->value);
if($vcard->privacy->value == true)
\modl\Privacy::set($c->jid, 1);
\Modl\Privacy::set($c->jid, 1);
else
\modl\Privacy::set($c->jid, 0);
\Modl\Privacy::set($c->jid, 0);
$cd = new modl\ContactDAO();
$cd->set($c);
$c->createThumbnails();
$r = new moxl\VcardSet();
$r = new Set;
$r->setData($vcard)->request();
}
function prepareInfos($error = false) {
$cd = new \modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$me = $cd->get($this->user->getLogin());
@ -123,16 +126,6 @@ class Vcard extends WidgetBase
$html .= '
<script type="text/javascript">setTimeout(\''.$this->genCallAjax('ajaxGetVcard').'\', 500);</script>';
}
/*if($error == 'vcardfeaturenotimpl') {
$html .= '
<div class="message error">'.t("Profile not updated : Your server does not support the vCard feature").'</div>';
}
if($error == 'vcardbadrequest') {
$html .= '
<div class="message error">'.t("Profile not updated : Request error").'</div>';
}*/
if($me->privacy == '1')
$color = 'black';
@ -358,7 +351,7 @@ class Vcard extends WidgetBase
function ajaxGetVcard()
{
$r = new moxl\VcardGet();
$r = new Get;
$r->setTo($this->user->getLogin())
->setMe()
->request();

17
app/widgets/Vcard4/Vcard4.php

@ -15,6 +15,9 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Vcard4\Get;
use Moxl\Xec\Action\Vcard4\Set;
class Vcard4 extends WidgetBase
{
function load()
@ -26,7 +29,7 @@ class Vcard4 extends WidgetBase
function display()
{
$cd = new \modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$me = $cd->get($this->user->getLogin());
if($me == null) {
@ -109,7 +112,7 @@ class Vcard4 extends WidgetBase
}
function ajaxGetVcard() {
$r = new moxl\Vcard4Get();
$r = new Get;
$r->setTo($this->user->getLogin())
->setMe()
->request();
@ -129,11 +132,11 @@ class Vcard4 extends WidgetBase
unset($vcard->month->value);
unset($vcard->day->value);
$cd = new \modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$c = $cd->get($this->user->getLogin());
if($c == null)
$c = new modl\Contact();
$c = new \Modl\Contact();
$c->jid = $this->user->getLogin();
@ -159,13 +162,13 @@ class Vcard4 extends WidgetBase
$c->description = trim($vcard->desc->value);
$cd = new modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$cd->set($c);
$r = new moxl\Vcard4Set();
$r = new Set;
$r->setData($c)->request();
$r = new moxl\VcardSet();
$r = new Moxl\Xec\Action\Vcard\Set;
$r->setData($vcard)->request();
}

2
app/widgets/Visio/Visio.php

@ -35,7 +35,7 @@ class Visio extends WidgetBase
//var_dump($json);
$this->view->assign('turn_list' , $json);
$cd = new modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$contact = $cd->get($jid);
if(!$contact)

11
app/widgets/VisioExt/VisioExt.php

@ -18,6 +18,9 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Jingle\SessionInitiate;
use Moxl\Xec\Action\Jingle\SessionTerminate;
class VisioExt extends WidgetBase
{
function load() {
@ -113,7 +116,7 @@ class VisioExt extends WidgetBase
$p->jid.'/'.$p->ressource,
'session-initiate');
$r = new moxl\JingleSessionInitiate();
$r = new SessionInitiate;
$r->setTo($p->jid.'/'.$p->ressource)
->setOffer($stj->generate())
->request();
@ -134,7 +137,7 @@ class VisioExt extends WidgetBase
$p->jid.'/'.$p->ressource,
'session-accept');
$r = new moxl\JingleSessionInitiate();
$r = new SessionInitiate;
$r->setTo($p->jid.'/'.$p->ressource)
->setOffer($stj->generate())
->request();
@ -144,7 +147,7 @@ class VisioExt extends WidgetBase
$s = Session::start('movim');
$jingleSid = $s->get("jingleSid");
$r = new moxl\JingleSessionTerminate();
$r = new SessionTerminate;
$r->setTo($jid.'/'.$ressource);
$r->setJingleSid($jingleSid);
@ -168,7 +171,7 @@ class VisioExt extends WidgetBase
$p->jid.'/'.$p->ressource,
'transport-info');
$r = new moxl\JingleSessionInitiate();
$r = new SessionInitiate;
$r->setTo($p->jid.'/'.$p->ressource)
->setOffer($stj->generate())
->request();

8
app/widgets/Wall/Wall.php

@ -18,6 +18,8 @@
* See COPYING for licensing information.
*/
use Moxl\Xec\Action\Pubsub\GetItems;
class Wall extends WidgetCommon
{
@ -57,10 +59,10 @@ class Wall extends WidgetCommon
if(!$from)
$from = $_GET['f'];
$pd = new \modl\PostnDAO();
$pd = new \Modl\PostnDAO();
$pl = $pd->getNode($from, 'urn:xmpp:microblog:0', $start+1, 10);
$cd = new \modl\ContactDAO();
$cd = new \Modl\ContactDAO();
$c = $cd->getRosterItem($from);
// We ask for the HTML of all the posts
@ -121,7 +123,7 @@ class Wall extends WidgetCommon
}
function ajaxWall($jid) {
$r = new moxl\PubsubGetItems();
$r = new GetItems;
$r->setTo($jid)
->setNode('urn:xmpp:microblog:0')
->request();

29
app/widgets/WidgetCommon/WidgetCommon.php

@ -16,9 +16,14 @@
*
*/
use Rain\Tpl;
use \Rain\Tpl;
use \Michelf\Markdown;
use Moxl\Xec\Action\Pubsub\PostPublish;
use Moxl\Xec\Action\Pubsub\PostDelete;
use Moxl\Xec\Action\Microblog\CommentPublish;
use Moxl\Xec\Action\Microblog\CommentsGet;
class WidgetCommon extends WidgetBase {
private function loadTemplate() {
$config = array(
@ -423,7 +428,7 @@ class WidgetCommon extends WidgetBase {
} else {
$html = '';
$pd = new \modl\PostnDAO();
$pd = new \Modl\PostnDAO();
$comments = $pd->getComments($posts);
foreach($posts as $post) {
@ -577,8 +582,6 @@ class WidgetCommon extends WidgetBase {
function ajaxPublishItem($server, $node, $form)
{
\movim_log($form);
$content = $form['content'];
$title = $form['title'];
@ -606,7 +609,7 @@ class WidgetCommon extends WidgetBase {
if($content != '') {
$content = Markdown::defaultTransform($content);
$p = new moxl\PubsubPostPublish();
$p = new PostPublish;
$p->setFrom($this->user->getLogin())
->setTo($server)
->setNode($node)
@ -620,10 +623,10 @@ class WidgetCommon extends WidgetBase {
}
function onComment($parent) {
$p = new \modl\ContactPostn();
$p = new \Modl\ContactPostn();
$p->nodeid = $parent;
$pd = new \modl\PostnDAO();
$pd = new \Modl\PostnDAO();
$comments = $pd->getComments($p);
$html = $this->prepareComments($comments);
@ -653,7 +656,7 @@ class WidgetCommon extends WidgetBase {
}
function ajaxGetComments($jid, $id) {
$c = new moxl\MicroblogCommentsGet();
$c = new CommentsGet;
$c->setTo($jid)
->setId($id)
->request();
@ -661,7 +664,7 @@ class WidgetCommon extends WidgetBase {
function ajaxPublishComment($to, $id, $content) {
if($content != '') {
$p = new moxl\MicroblogCommentPublish();
$p = new CommentPublish;
$p->setTo($to)
->setFrom($this->user->getLogin())
->setParentId($id)
@ -671,7 +674,7 @@ class WidgetCommon extends WidgetBase {
}
function ajaxDeletePost($to, $node, $id) {
$p = new moxl\PubsubPostDelete();
$p = new PostDelete;
$p->setTo($to)
->setNode($node)
->setId($id)
@ -679,14 +682,14 @@ class WidgetCommon extends WidgetBase {
}
function ajaxPrivacyPost($nodeid, $privacy) {
$pd = new \modl\PrivacyDAO();
$pd = new \Modl\PrivacyDAO();
$p = $pd->get($nodeid);
if($privacy == 'orange') {
\modl\Privacy::set($nodeid, 0);
\Modl\Privacy::set($nodeid, 0);
} elseif($privacy == 'black') {
\modl\Privacy::set($nodeid, 1);
\Modl\Privacy::set($nodeid, 1);
}
RPC::call('movim_change_class', $nodeid , 'protect '.$privacy, getFlagTitle($privacy));

Loading…
Cancel
Save