Browse Source

Better account creation form

pull/16/merge
Jaussoin Timothée 10 years ago
parent
commit
aabfb0a047
  1. 51
      app/widgets/AccountNext/AccountNext.php
  2. 3
      app/widgets/AccountNext/_accountnext_form.tpl
  3. 2
      app/widgets/AccountNext/_accountnext_oob.tpl
  4. 29
      app/widgets/AccountNext/accountnext.css
  5. 23
      app/widgets/AccountNext/accountnext.tpl
  6. 1
      app/widgets/AccountNext/locales.ini
  7. 4
      app/widgets/Login/login.tpl

51
app/widgets/AccountNext/AccountNext.php

@ -1,7 +1,6 @@
<?php
use Moxl\Xec\Action\Disco\Request;
use Moxl\Xec\Action\Register\Get;
use Moxl\Xec\Action\Register\Set;
class AccountNext extends WidgetBase {
@ -30,32 +29,40 @@ class AccountNext extends WidgetBase {
{
$form = $package->content;
$xtf = new \XMPPtoForm();
if(!empty($form->x)){
switch($form->x->attributes()->xmlns) {
case 'jabber:x:data' :
$formview = $this->tpl();
if($package->from == 'movim.eu') {
$movimview = $this->tpl();
$movimview->assign('submitdata', $this->call('ajaxRegister', "movim_form_to_json('data')"));
$html = $movimview->draw('_accountnext_movim', true);
$formh = $xtf->getHTML($form->x->asXML());
$formview->assign('submitdata', $this->call('ajaxRegister', "movim_form_to_json('data')"));
RPC::call('movim_fill', 'subscription_form', $html);
} else {
$xtf = new \XMPPtoForm();
if(!empty($form->x)){
switch($form->x->attributes()->xmlns) {
case 'jabber:x:data' :
$formview = $this->tpl();
$formview->assign('formh', $formh);
$html = $formview->draw('_accountnext_form', true);
$formh = $xtf->getHTML($form->x->asXML());
$formview->assign('submitdata', $this->call('ajaxRegister', "movim_form_to_json('data')"));
RPC::call('movim_fill', 'subscription_form', $html);
break;
case 'jabber:x:oob' :
$oobview = $this->tpl();
$oobview->assign('url', (string)$form->x->url);
$formview->assign('formh', $formh);
$html = $formview->draw('_accountnext_form', true);
$html = $oobview->draw('_accountnext_oob', true);
RPC::call('movim_fill', 'subscription_form', $html);
break;
case 'jabber:x:oob' :
$oobview = $this->tpl();
$oobview->assign('url', (string)$form->x->url);
RPC::call('movim_fill', 'subscription_form', $html);
break;
}
$html = $oobview->draw('_accountnext_oob', true);
RPC::call('movim_fill', 'subscription_form', $html);
break;
}
} else{
$formh = $xtf->getHTML($form->asXML());
} else{
$formh = $xtf->getHTML($form->asXML());
}
}
}
@ -68,7 +75,7 @@ class AccountNext extends WidgetBase {
$html = $view->draw('_accountnext_registered', true);
RPC::call('movim_fill', 'subscription_form', $html);
RPC::call('movim_fill', 'subscribe', $html);
RPC::call('setUsername', $data->username->value);
}

3
app/widgets/AccountNext/_accountnext_form.tpl

@ -1,8 +1,7 @@
<br />
<form name="data">
{$formh}
<a
class="button color green oppose"
class="button color green oppose"
onclick="{$submitdata}"
>
{$c->__('button.validate')}

2
app/widgets/AccountNext/_accountnext_oob.tpl

@ -1,4 +1,4 @@
<ul class="thick">
<ul id="obb" class="thick">
<li class="condensed">
<span class="icon bubble color blue">
<i class="zmdi zmdi-chevron-right"></i>

29
app/widgets/AccountNext/accountnext.css

@ -1,3 +1,30 @@
#subscription_form form > div {
left: 2rem;
left: 1rem;
}
#subscription_form form {
padding-top: 5rem;
}
#subscription_form ul#obb {
padding-top: 10rem;
}
#subscription_form div#movim input {
width: calc(100% - 15rem);
text-align: right;
}
#subscription_form div#movim span {
color: gray;
font-weight: bold;
text-align: left;
font-size: 2rem;
top: 4rem;
float: right;
position: relative;
line-height: 3rem;
padding: 1rem;
width: 15rem;
box-sizing: border-box;
}

23
app/widgets/AccountNext/accountnext.tpl

@ -1,11 +1,20 @@
<div id="subscribe">
<div id="subscription_form" class="padded_right">
<ul class="simple thick">
<li>
<span>{$c->__('create.title')} {$c->__('create.server_on')} {$host}</span>
<p>{$c->__('create.loading')}</p>
</li>
</ul>
<div class="flex">
<div class="block on_desktop">
<div class="placeholder icon account">
<h4>{$c->__('create.title')}</h4>
<h4>{$c->__('create.placeholder')}</h4>
</div>
</div>
<div id="subscription_form" class="block">
<ul class="simple thick">
<li>
<span>{$c->__('create.title')} {$c->__('create.server_on')} {$host}</span>
<p>{$c->__('create.loading')}</p>
</li>
</ul>
</div>
</div>
<script type="text/javascript">
MovimWebsocket.attach(function()

1
app/widgets/AccountNext/locales.ini

@ -4,6 +4,7 @@ notfound = No account creation form found on the server
server_on = on
successfull = Your acccount has been successfully registered
loading = Loading
placeholder = …and start playing
[error]
not_acceptable = Not Acceptable

4
app/widgets/Login/login.tpl

@ -21,7 +21,7 @@
name="login">
<div>
<input type="email" name="login" id="login" autofocus required disabled
placeholder="{$c->__('form.username')}"/>
placeholder="username@server.com"/>
<label for="login">{$c->__('form.username')}</label>
</div>
<div>
@ -38,7 +38,7 @@
disabled
data-loading="{$c->__('button.connecting')}"
value="{$c->__('button.come_in')}"
class="button flat"/>
class="button flat"/>
</div>
<a id="return_sessions" class="button flat" href="#" onclick="Login.toChoose()">
{$c->__('account.title')}

Loading…
Cancel
Save