Enhancement: Adding Group on the Sidebar updates the multiselect on the Userlist.

This commit is contained in:
raghunayyar 2014-03-06 13:27:29 +05:30 committed by Arthur Schiwon
parent e159f7e4a9
commit d3cee79b5a
3 changed files with 48 additions and 31 deletions

View File

@ -55,6 +55,19 @@
var addedGroups = result.data.groupname;
UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups));
GroupList.addGroup(result.data.groupname);
$('#newusergroups').children().first().attr('value', result.data.groupname);
$('#newusergroups').children().first().text(result.data.groupname);
$('.groupsselect').each( function (index, element) {
$(element).children().first().attr('value', result.data.groupname);
$(element).children().first().text(result.data.groupname);
});
$('.subadminsselect').each( function (index, element) {
$(element).children().first().attr('value', result.data.groupname);
$(element).children().first().text(result.data.groupname);
});
}
GroupList.toggleAddGroup();
}
@ -124,7 +137,7 @@
initDeleteHandling: function() {
//set up handler
GroupDeleteHandler = new DeleteHandler('removegroup.php', 'groupname',
GroupList.hide, GroupList.remove);
GroupList.hide, GroupList.remove);
//configure undo
OC.Notification.hide();

View File

@ -1,16 +1,18 @@
<div id="user-controls">
<form id="newuser" autocomplete="off">
<input id="newusername" type="text" placeholder="<?php p($l->t('Login Name'))?>" /> <input
<input id="newusername" type="text" placeholder="<?php p($l->t('Login Name'))?>" />
<input
type="password" id="newuserpassword"
placeholder="<?php p($l->t('Password'))?>" /> <select
class="groupsselect"
id="newusergroups" data-placeholder="groups"
placeholder="<?php p($l->t('Password'))?>"
/>
<select
class="groupsselect" id="newusergroups" data-placeholder="groups"
title="<?php p($l->t('Groups'))?>" multiple="multiple">
<?php foreach($_["adminGroup"] as $adminGroup): ?>
<option value="<?php p($adminGroup['name']);?>"><?php p($adminGroup['name']); ?></option>
<option value="<?php p($adminGroup['name']);?>"><?php p($adminGroup['name']); ?></option>
<?php endforeach; ?>
<?php foreach($_["groups"] as $group): ?>
<option value="<?php p($group['name']);?>"><?php p($group['name']);?></option>
<option value="<?php p($group['name']);?>"><?php p($group['name']);?></option>
<?php endforeach;?>
</select>
<input type="submit" class="button" value="<?php p($l->t('Create'))?>" />

View File

@ -33,32 +33,34 @@
src="<?php print_unescaped(image_path('core', 'actions/rename.svg'))?>"
alt="<?php p($l->t("set new password"))?>" title="<?php p($l->t("set new password"))?>"/>
</td>
<td class="groups"><select
class="groupsselect"
data-username="<?php p($user['name']) ;?>"
data-user-groups="<?php p(json_encode($user['groups'])) ;?>"
data-placeholder="groups" title="<?php p($l->t('Groups'))?>"
multiple="multiple">
<?php foreach($_["adminGroup"] as $adminGroup): ?>
<option value="<?php p($adminGroup['name']);?>"><?php p($adminGroup['name']); ?></option>
<?php endforeach; ?>
<?php foreach($_["groups"] as $group): ?>
<option value="<?php p($group['name']);?>"><?php p($group['name']);?></option>
<?php endforeach;?>
</select>
<td class="groups">
<select
class="groupsselect"
data-username="<?php p($user['name']) ;?>"
data-user-groups="<?php p(json_encode($user['groups'])) ;?>"
data-placeholder="groups" title="<?php p($l->t('Groups'))?>"
multiple="multiple">
<?php foreach($_["adminGroup"] as $adminGroup): ?>
<option value="<?php p($adminGroup['name']);?>"><?php p($adminGroup['name']); ?></option>
<?php endforeach; ?>
<?php foreach($_["groups"] as $group): ?>
<option value="<?php p($group['name']);?>"><?php p($group['name']);?></option>
<?php endforeach;?>
</select>
</td>
<?php if(is_array($_['subadmins']) || $_['subadmins']): ?>
<td class="subadmins"><select
class="subadminsselect"
data-username="<?php p($user['name']) ;?>"
data-subadmin="<?php p(json_encode($user['subadmin']));?>"
data-placeholder="subadmins" title="<?php p($l->t('Group Admin'))?>"
multiple="multiple">
<?php foreach($_["subadmingroups"] as $group): ?>
<option value="<?php p($group);?>"><?php p($group);?></option>
<?php endforeach;?>
</select>
</td>
<td class="subadmins">
<select
class="subadminsselect"
data-username="<?php p($user['name']) ;?>"
data-subadmin="<?php p(json_encode($user['subadmin']));?>"
data-placeholder="subadmins" title="<?php p($l->t('Group Admin'))?>"
multiple="multiple">
<?php foreach($_["subadmingroups"] as $group): ?>
<option value="<?php p($group);?>"><?php p($group);?></option>
<?php endforeach;?>
</select>
</td>
<?php endif;?>
<td class="quota">
<select class='quota-user' data-inputtitle="<?php p($l->t('Please enter storage quota (ex: "512 MB" or "12 GB")')) ?>">