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 @@
+