diff --git a/app/assets/js/movim_tpl.js b/app/assets/js/movim_tpl.js index 8f5d7aed9..7965b78f2 100755 --- a/app/assets/js/movim_tpl.js +++ b/app/assets/js/movim_tpl.js @@ -128,7 +128,7 @@ var MovimTpl = { back : function() { // If the contect menu is show var cm = document.querySelector('ul.context_menu'); - if(cm != null && cm.className.contains('shown')) { + if(cm != null && cm.className.includes('shown')) { MovimTpl.toggleContextMenu(document); } // If a dialog box is show diff --git a/app/widgets/Account/Account.php b/app/widgets/Account/Account.php index f58736673..8c67abdea 100644 --- a/app/widgets/Account/Account.php +++ b/app/widgets/Account/Account.php @@ -2,6 +2,7 @@ use Moxl\Xec\Action\Register\ChangePassword; use Moxl\Xec\Action\Register\Remove; +use Moxl\Xec\Action\Register\Get; use Respect\Validation\Validator; class Account extends WidgetBase @@ -11,6 +12,7 @@ class Account extends WidgetBase $this->addjs('account.js'); $this->registerEvent('register_changepassword_handle', 'onPasswordChanged'); $this->registerEvent('register_remove_handle', 'onRemoved'); + $this->registerEvent('register_get_handle', 'onRegister'); } function onPasswordChanged() @@ -28,6 +30,28 @@ class Account extends WidgetBase RPC::call('Account.clearAccount'); } + function onRegister($package) + { + $content = $package->content; + + $view = $this->tpl(); + + if(isset($content->x)) { + $xml = new \XMPPtoForm(); + $form = $xml->getHTML($content->x->asXML()); + + $view->assign('form', $form); + $view->assign('attributes', $content->attributes()); + $view->assign('actions', null); + if(isset($content->actions)) { + $view->assign('actions', $content->actions); + } + + Dialog::fill($view->draw('_account_form', true), true); + } + + } + function ajaxChangePassword($form) { $validate = Validator::string()->length(6, 40); @@ -67,6 +91,22 @@ class Account extends WidgetBase $da->request(); } + function ajaxRegister($server) + { + if(!$this->validateServer($server)) return; + + $da = new Get; + $da->setTo($server) + ->request(); + } + + private function validateServer($server) + { + $validate_server = Validator::string()->noWhitespace()->length(6, 80); + if(!$validate_server->validate($server)) return false; + else return true; + } + function display() { } diff --git a/app/widgets/Account/_account_form.tpl b/app/widgets/Account/_account_form.tpl new file mode 100644 index 000000000..3573cff4a --- /dev/null +++ b/app/widgets/Account/_account_form.tpl @@ -0,0 +1,32 @@ +
+
+ {$form} +
+
+
+ + {$c->__('button.close')} + + {if="$actions != null"} + {if="isset($actions->next)"} + + {$c->__('button.next')} + + {/if} + {if="isset($actions->previous)"} + + {$c->__('button.previous')} + + {/if} + {if="isset($actions->cancel)"} + + {$c->__('button.cancel')} + + {/if} + {if="isset($actions->complete)"} + + {/if} + {/if} +
diff --git a/app/widgets/Chat/chat.js b/app/widgets/Chat/chat.js index c5055b73b..5bbb607df 100644 --- a/app/widgets/Chat/chat.js +++ b/app/widgets/Chat/chat.js @@ -48,8 +48,6 @@ var Chat = { appendMessage : function(message) { if(message.body == '') return; - - console.log(message); var bubble = null; var id = null; diff --git a/app/widgets/Rooms/Rooms.php b/app/widgets/Rooms/Rooms.php index cdcf7e577..ebe37110b 100644 --- a/app/widgets/Rooms/Rooms.php +++ b/app/widgets/Rooms/Rooms.php @@ -19,17 +19,13 @@ class Rooms extends WidgetBase function onBookmark() { - RPC::call('movim_fill', 'rooms_widget', $this->prepareRooms()); - Notification::append(null, $this->__('bookmarks.updated')); - RPC::call('Rooms.refresh'); + $this->refreshRooms(); RPC::call('MovimTpl.hidePanel'); } function onConnected() { - RPC::call('movim_fill', 'rooms_widget', $this->prepareRooms()); - Notification::append(null, $this->__('chatrooms.connected')); - RPC::call('Rooms.refresh'); + $this->refreshRooms(); } function onDisconnected() @@ -38,6 +34,11 @@ class Rooms extends WidgetBase $c = new Chat(); $c->ajaxGet(); + $this->refreshRooms(); + } + + private function refreshRooms() + { RPC::call('movim_fill', 'rooms_widget', $this->prepareRooms()); Notification::append(null, $this->__('chatrooms.disconnected')); RPC::call('Rooms.refresh'); @@ -248,7 +249,7 @@ class Rooms extends WidgetBase */ private function validateRoom($room) { - $validate_server = Validator::email()->noWhitespace()->length(6, 40); + $validate_server = Validator::string()->noWhitespace()->length(6, 80); if(!$validate_server->validate($room)) return false; else return true; } diff --git a/system/Route.php b/system/Route.php index e35000670..72a4c00c1 100755 --- a/system/Route.php +++ b/system/Route.php @@ -34,7 +34,9 @@ class Route extends \BaseController { $cd = new \Modl\ConfigDAO(); $config = $cd->get(); - if($config->rewrite == true) { + if($config->rewrite == true + && isset($_SERVER['HTTP_MOD_REWRITE']) + && $_SERVER['HTTP_MOD_REWRITE']) { $request = explode('/', $this->fetchGet('query')); $this->_page = $request[0]; array_shift($request); @@ -80,28 +82,30 @@ class Route extends \BaseController { //} else { if($tab != false) $tab = '#'.$tab; + // Here we got a beautiful rewriten URL ! + if($config->rewrite == true + && isset($_SERVER['HTTP_MOD_REWRITE']) + && $_SERVER['HTTP_MOD_REWRITE']) { + $uri = BASE_URI . $page; + if($params != false && is_array($params)) + foreach($params as $value) + $uri .= '/' . $value; + elseif($params != false) + $uri .= '/' . $params; + } //We construct a classic URL if the rewriting is disabled - if($config->rewrite == false) { - $uri = BASE_URI . '?q='.$page; + else { + $uri = BASE_URI . '?q=' . $page; if($params != false && is_array($params)) { $i = 0; foreach($params as $value) { - $uri .= '&'.$routes[$page][$i].'='.$value; + $uri .= '&' . $routes[$page][$i] . '=' . $value; $i++; } } elseif($params != false) $uri .= '&'.$routes[$page][0].'='.$params; - } - // Here we got a beautiful rewriten URL ! - else { - $uri = BASE_URI . $page; - if($params != false && is_array($params)) - foreach($params as $value) - $uri .= '/'.$value; - elseif($params != false) - $uri .= '/'.$params; } return $uri.$tab; //}