Browse Source

- New widget Account, to provide password changing and account deletion feature

- Fix the Chat bubble CSS (to pre-wrap)
- Merge with nodpounod <3
- New library to validate the input in Movim
pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
786c67e312
  1. 1
      app/views/conf.tpl
  2. 50
      app/widgets/Account/Account.php
  3. 35
      app/widgets/Account/account.tpl
  4. 4
      app/widgets/Account/locales.ini
  5. 3
      app/widgets/AdHoc/_adhoc_list.tpl
  6. 21
      app/widgets/Notifs/_notifs_from.tpl
  7. 12
      app/widgets/Roster/roster.css
  8. 8
      app/widgets/Roster/roster.js
  9. 2
      app/widgets/Roster/roster.tpl
  10. 3
      composer.json
  11. 4
      src/Movim/Daemon/Core.php
  12. 2
      themes/material/css/list.css

1
app/views/conf.tpl

@ -11,6 +11,7 @@
<?php $this->widget('Vcard4');?>
<?php $this->widget('Avatar');?>
<?php $this->widget('Config');?>
<?php //$this->widget('Account');?>
<?php $this->widget('AdHoc');?>
<?php //$this->widget('ConfigData');?>
<?php //$this->widget('PubsubSubscriptionConfig');?>

50
app/widgets/Account/Account.php

@ -0,0 +1,50 @@
<?php
use Moxl\Xec\Action\Register\ChangePassword;
use Moxl\Xec\Action\Register\Remove;
use Respect\Validation\Validator;
class Account extends WidgetBase
{
function load()
{
$this->registerEvent('register_changepassword_handle', 'onPasswordChanged');
}
function onPasswordChanged()
{
Notification::append(null, $this->__('account.password_changed'));
}
function ajaxChangePassword($form)
{
$validate = Validator::string()->length(6, 40);
$p1 = $form->password->value;
$p2 = $form->password_confirmation->value;
if($validate->validate($p1)
&& $validate->validate($p2)) {
if($p1 == $p2) {
// TODO send the password
} else {
Notification::append(null, $this->__('account.password_not_same'));
}
} else {
Notification::append(null, $this->__('account.password_not_valid'));
}
}
function ajaxRemoveAccount()
{
}
function ajaxRemoveAccountConfirm()
{
}
function display()
{
}
}

35
app/widgets/Account/account.tpl

@ -0,0 +1,35 @@
<div class="tabelem" title="{$c->__('account.title')}" id="account_widget" >
<ul class="middle active divided ">
<li class="subheader">Change my password</li>
<li>
<span class="icon gray">
<i class="md md-vpn-key"></i>
</span>
<form name="password" class="">
<div>
<input type="password" placeholder="Choose a nice password" name="password"/>
<label>Password</label>
</div>
<div>
<input type="password" placeholder="Type your password again" name="password_confirmation"/>
<label>Password confirmation</label>
</div>
<a onclick="
Account_ajaxChangePassword(movim_form_to_json('password'));
//this.className='button oppose inactive';" class="button color oppose">
{$c->__('button.submit')}
</a>
</form>
</li>
<li class="subheader">Delete my account</li>
<li class="action">
<span class="icon red">
<i class="md md-delete"></i>
</span>
<div class="action">
<i class="md md-chevron-right"></i>
</div>
<span>Delete your account</span>
</li>
</ul>
</div>

4
app/widgets/Account/locales.ini

@ -0,0 +1,4 @@
account.title = 'Account'
account.password_changed = 'The password has been updated'
account.password_not_valid = 'Please provide a valid password (6 characters minimum)'
account.password_not_same = 'The provided passwords are not the same'

3
app/widgets/AdHoc/_adhoc_list.tpl

@ -1,4 +1,5 @@
<ul class="divided active">
<ul class="divided active spaced">
<li class="subheader">{$c->__('adhoc.title')}</li>
{loop="$list"}
<li class="action" data-node="{$value->attributes()->node}" data-jid="{$value->attributes()->jid}">
<span class="icon gray">

21
app/widgets/Notifs/_notifs_from.tpl

@ -9,21 +9,20 @@
{if="isset($value)"}
<li data-jid="{$value->jid}" class="action">
<div class="action">
<!--
<a class="button flat red"
onclick="{$c->genCallRefuse($value->jid)}">
<i class="fa fa-times"></i>
</a>
<a class="button flat"
onclick="{$c->genCallAccept($value->jid)}">
{$c->__('button.add')}
</a>
-->
<a class="button flat" data-jid="{$value->jid}">
{$c->__('notifs.manage')}
</a>
</div>
<span class="icon"><img src="{$value->getPhoto('xs')}"/></span>
{$url = $value->getPhoto('s')}
{if="$url"}
<span class="icon bubble">
<img src="{$url}">
</span>
{else}
<span class="icon bubble color {$value->jid|stringToColor}">
<i class="md md-person"></i>
</span>
{/if}
<span href="{$c->route('friend', $value->jid)}">
{$value->getTrueName()}
</span>

12
app/widgets/Roster/roster.css

@ -16,6 +16,18 @@
overflow: hidden;
}
#roster ul#rosterlist > div li:first-child:before {
font-family: "Material Design Iconic Font";
content: "\f1b6";
display: inline-block;
}
#roster ul#rosterlist > div.groupshown li:first-child:before {
font-family: "Material Design Iconic Font";
content: "\f1b4";
display: inline-block;
}
#roster ul#rosterlist > div.groupshown {
height: 100%;
}

8
app/widgets/Roster/roster.js

@ -155,6 +155,14 @@
return title;
};
this.getOnlineCount = function(g){
count = 0;
for(var i in g){
if(g[i].aval < 5) count ++;
}
return count;
};
this.getContactClient = function(c){
liclass = "";
if(c.rosterview.client)

2
app/widgets/Roster/roster.tpl

@ -23,7 +23,7 @@
<li class="subheader" ng-click="rosterCtrl.showHideGroup(group.agroup)">
{{::group.agroup}}
<span class="info">{{group.agroupitems.length}}</span>
<span class="info">{{rosterCtrl.getOnlineCount(group.agroupitems)}}/{{group.agroupitems.length}}</span>
</li>
<li
ng-repeat="myjid in group.agroupitems"

3
composer.json

@ -21,6 +21,7 @@
"react/child-process": "0.5.*@dev",
"ratchet/pawl": "dev-master",
"forxer/Gravatar": "~1.2"
"forxer/Gravatar": "~1.2",
"respect/validation": "0.8.*"
}
}

4
src/Movim/Daemon/Core.php

@ -18,9 +18,7 @@ class Core implements MessageComponentInterface {
echo colorize("Base URI :", 'green')." {$baseuri}\n";
$ws = $this->setWebsocket($baseuri, $port);
echo colorize("Public WebSocket URL :", 'green')." {$ws}\n";
//echo colorize("WebSocket URL :", 'green')." http(s)://[your host adress]:{$port}\n";
$this->loop = $loop;
$this->baseuri = $baseuri;

2
themes/material/css/list.css

@ -211,7 +211,7 @@ ul li div.bubble {
}
ul li div.bubble div {
white-space: pre;
white-space: pre-wrap;
display: inline;
}

Loading…
Cancel
Save