add Storage Location col

This commit is contained in:
Arthur Schiwon 2014-02-18 14:34:08 +01:00
parent dc1523355b
commit dc28f58951
5 changed files with 28 additions and 14 deletions

View File

@ -43,12 +43,15 @@ try {
OC_Group::addToGroup( $username, $i );
}
$userManager = \OC_User::getManager();
$user = $userManager->get($username);
OC_JSON::success(array("data" =>
array(
// returns whether the home already existed
"homeExists" => $homeExists,
"username" => $username,
"groups" => OC_Group::getUserGroups( $username ))));
"groups" => OC_Group::getUserGroups( $username ),
'storageLocation' => $user->getHome())));
} catch (Exception $exception) {
OC_JSON::error(array("data" => array( "message" => $exception->getMessage())));
}

View File

@ -33,25 +33,30 @@ if (isset($_GET['limit'])) {
$limit = 10;
}
$users = array();
$userManager = \OC_User::getManager();
if (OC_User::isAdminUser(OC_User::getUser())) {
$batch = OC_User::getDisplayNames('', $limit, $offset);
foreach ($batch as $user => $displayname) {
foreach ($batch as $uid => $displayname) {
$user = $userManager->get($uid);
$users[] = array(
'name' => $user,
'name' => $uid,
'displayname' => $displayname,
'groups' => join(', ', OC_Group::getUserGroups($user)),
'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)),
'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
'groups' => join(', ', OC_Group::getUserGroups($uid)),
'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($uid)),
'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'),
'storageLocation' => $user->getHome());
}
} else {
$groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
$batch = OC_Group::usersInGroups($groups, '', $limit, $offset);
foreach ($batch as $user) {
foreach ($batch as $uid) {
$user = $userManager->get($uid);
$users[] = array(
'name' => $user,
'displayname' => OC_User::getDisplayName($user),
'groups' => join(', ', OC_Group::getUserGroups($user)),
'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
'displayname' => $user->getDisplayName(),
'groups' => join(', ', OC_Group::getUserGroups($uid)),
'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'),
'storageLocation' => $user->getHome());
}
}
OC_JSON::success(array('data' => $users));

View File

@ -125,7 +125,7 @@ var UserList = {
}
},
add: function (username, displayname, groups, subadmin, quota, sort) {
add: function (username, displayname, groups, subadmin, quota, storageLocation, sort) {
var tr = $('tbody tr').first().clone();
var subadminsEl;
var subadminSelect;
@ -184,6 +184,7 @@ var UserList = {
quotaSelect.append('<option value="' + escapeHTML(quota) + '" selected="selected">' + escapeHTML(quota) + '</option>');
}
}
tr.find('td.storageLocation').text(storageLocation);
$(tr).appendTo('tbody');
if (sort) {
@ -279,7 +280,7 @@ var UserList = {
if($('tr[data-uid="' + user.name + '"]').length > 0) {
return true;
}
var tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, false);
alert(user.storageLocation);
tr.addClass('appear transparent');
trs.push(tr);
loadedUsers++;
@ -574,7 +575,7 @@ $(document).ready(function () {
}, 10000);
}
if($('tr[data-uid="' + username + '"]').length === 0) {
UserList.add(username, username, result.data.groups, null, 'default', true);
UserList.add(username, username, result.data.groups, null, 'default', result.data.storageLocation, true);
}
}
}
@ -620,7 +621,7 @@ $(document).ready(function () {
}
)
});
// Implements User Search
// Implements User Search
$('#usersearchform input').keyup(function() {
var inputVal = $(this).val(), regex = new RegExp(inputVal, "i");;
$('table tbody tr td.name').each(function (key,element) {

View File

@ -138,6 +138,7 @@ $_['subadmingroups'] = array_flip($items);
<th id="headerSubAdmins"><?php p($l->t('Group Admin')); ?></th>
<?php endif;?>
<th id="headerQuota"><?php p($l->t('Storage')); ?></th>
<th id="headerStorageLocation"><?php p($l->t('Storage Location')); ?></th>
<th id="headerRemove">&nbsp;</th>
</tr>
</thead>
@ -214,6 +215,7 @@ $_['subadmingroups'] = array_flip($items);
</option>
</select>
</td>
<td class="storageLocation"><?php p($user["storageLocation"]); ?></td>
<td class="remove">
<?php if($user['name']!=OC_User::getUser()):?>
<a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>">

View File

@ -17,6 +17,7 @@ OC_App::setActiveNavigationEntry( 'core_users' );
$users = array();
$groups = array();
$userManager = \OC_User::getManager();
if (isset($_GET['offset'])) {
$offset = $_GET['offset'];
@ -66,6 +67,7 @@ foreach($accessibleusers as $uid => $displayName) {
$name = $name . ' ('.$uid.')';
}
$user = $userManager->get($uid);
$users[] = array(
"name" => $uid,
"displayName" => $displayName,
@ -73,6 +75,7 @@ foreach($accessibleusers as $uid => $displayName) {
'quota' => $quota,
'isQuotaUserDefined' => $isQuotaUserDefined,
'subadmin' => OC_SubAdmin::getSubAdminsGroups($uid),
'storageLocation' => $user->getHome(),
);
}