more work on user management

This commit is contained in:
Robin Appelman 2011-08-11 11:26:57 +02:00
parent 8639630a18
commit 2e58752e12
3 changed files with 42 additions and 7 deletions

View File

@ -1,6 +1,12 @@
form { display:inline }
td.remove>img,td.select>input { display:none;cursor:pointer }
td.select,td.remove { width:1em }
tr:hover>td.remove>img { display:inline }
li.selected { background-color:#ddd }
#content>table { margin-top:6.5em }
form { display:inline; }
td.password>img, td.remove>img{ display:none;cursor:pointer; }
td.password>span { margin-right:1.2em; }
td.password { width:12em; }
td.password>img { float:right; }
td.remove { width:1em }
tr:hover>td.password>span{ margin:0; }
tr:hover>td.remove>img, tr:hover>td.password>img { display:inline; }
li.selected { background-color:#ddd; }
#content>table { margin-top:6.5em; }
table { width:100%; }

View File

@ -45,6 +45,29 @@ $(document).ready(function(){
$(this).parent().parent().remove();
});
$('td.password>img').live('click',function(event){
var img=$(this);
var uid=img.parent().parent().data('uid');
var input=$('<input type="password">');
img.css('display','none');
img.parent().children('span').replaceWith(input);
input.focus();
input.keypress(function(event) {
if(event.keyCode == 13) {
$.post(
OC.filePath('admin','ajax','changepassword.php'),
{username:uid,password:$(this).val()},
function(result){}
);
input.blur();
}
});
input.blur(function(){
$(this).replaceWith($('<span>●●●●●●●</span>'));
img.css('display','');
});
});
$('#newuser').submit(function(event){
event.preventDefault();
var username=$('#newusername').val();
@ -72,6 +95,9 @@ $(document).ready(function(){
select.append($('<option value="'+group+'">'+group+'</option>'));
});
tr.find('td.groups').append(select);
if(tr.find('td.remve img').length==0){
tr.find('td.remove').append($('<img alt="Remove" title="'+t('admin','Remove')+'" class="svg" src="'+OC.imagePath('core','actions/delete')+'"/>'));
}
applyMultiplySelect(select);
$('#content table tr').last().after(tr);
});

View File

@ -19,8 +19,11 @@ foreach($_["groups"] as $group){
<table data-groups="<?php echo implode(', ',$allGroups);?>">
<?php foreach($_["users"] as $user): ?>
<tr data-uid="<?php echo $user["name"] ?>">
<td class="select"><input type="checkbox"></input></td>
<td class="name"><?php echo $user["name"]; ?></td>
<td class="password">
<span>●●●●●●●</span>
<img class="svg" src="<?php echo image_path('core','actions/rename.svg')?>"/>
</td>
<td class="groups">
<select data-username="<?php echo $user['name'] ;?>" data-user-groups="<?php echo $user['groups'] ;?>" data-placeholder="groups" title="<?php echo $l->t('Groups')?>" multiple="multiple">
<?php foreach($_["groups"] as $group): ?>