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 ); OC_Group::addToGroup( $username, $i );
} }
$userManager = \OC_User::getManager();
$user = $userManager->get($username);
OC_JSON::success(array("data" => OC_JSON::success(array("data" =>
array( array(
// returns whether the home already existed // returns whether the home already existed
"homeExists" => $homeExists, "homeExists" => $homeExists,
"username" => $username, "username" => $username,
"groups" => OC_Group::getUserGroups( $username )))); "groups" => OC_Group::getUserGroups( $username ),
'storageLocation' => $user->getHome())));
} catch (Exception $exception) { } catch (Exception $exception) {
OC_JSON::error(array("data" => array( "message" => $exception->getMessage()))); OC_JSON::error(array("data" => array( "message" => $exception->getMessage())));
} }

View File

@ -33,25 +33,30 @@ if (isset($_GET['limit'])) {
$limit = 10; $limit = 10;
} }
$users = array(); $users = array();
$userManager = \OC_User::getManager();
if (OC_User::isAdminUser(OC_User::getUser())) { if (OC_User::isAdminUser(OC_User::getUser())) {
$batch = OC_User::getDisplayNames('', $limit, $offset); $batch = OC_User::getDisplayNames('', $limit, $offset);
foreach ($batch as $user => $displayname) { foreach ($batch as $uid => $displayname) {
$user = $userManager->get($uid);
$users[] = array( $users[] = array(
'name' => $user, 'name' => $uid,
'displayname' => $displayname, 'displayname' => $displayname,
'groups' => join(', ', OC_Group::getUserGroups($user)), 'groups' => join(', ', OC_Group::getUserGroups($uid)),
'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)), 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($uid)),
'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default')); 'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'),
'storageLocation' => $user->getHome());
} }
} else { } else {
$groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); $groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
$batch = OC_Group::usersInGroups($groups, '', $limit, $offset); $batch = OC_Group::usersInGroups($groups, '', $limit, $offset);
foreach ($batch as $user) { foreach ($batch as $uid) {
$user = $userManager->get($uid);
$users[] = array( $users[] = array(
'name' => $user, 'name' => $user,
'displayname' => OC_User::getDisplayName($user), 'displayname' => $user->getDisplayName(),
'groups' => join(', ', OC_Group::getUserGroups($user)), 'groups' => join(', ', OC_Group::getUserGroups($uid)),
'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default')); 'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'),
'storageLocation' => $user->getHome());
} }
} }
OC_JSON::success(array('data' => $users)); 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 tr = $('tbody tr').first().clone();
var subadminsEl; var subadminsEl;
var subadminSelect; var subadminSelect;
@ -184,6 +184,7 @@ var UserList = {
quotaSelect.append('<option value="' + escapeHTML(quota) + '" selected="selected">' + escapeHTML(quota) + '</option>'); quotaSelect.append('<option value="' + escapeHTML(quota) + '" selected="selected">' + escapeHTML(quota) + '</option>');
} }
} }
tr.find('td.storageLocation').text(storageLocation);
$(tr).appendTo('tbody'); $(tr).appendTo('tbody');
if (sort) { if (sort) {
@ -279,7 +280,7 @@ var UserList = {
if($('tr[data-uid="' + user.name + '"]').length > 0) { if($('tr[data-uid="' + user.name + '"]').length > 0) {
return true; return true;
} }
var tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, false); alert(user.storageLocation);
tr.addClass('appear transparent'); tr.addClass('appear transparent');
trs.push(tr); trs.push(tr);
loadedUsers++; loadedUsers++;
@ -574,7 +575,7 @@ $(document).ready(function () {
}, 10000); }, 10000);
} }
if($('tr[data-uid="' + username + '"]').length === 0) { 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);
} }
} }
} }

View File

@ -138,6 +138,7 @@ $_['subadmingroups'] = array_flip($items);
<th id="headerSubAdmins"><?php p($l->t('Group Admin')); ?></th> <th id="headerSubAdmins"><?php p($l->t('Group Admin')); ?></th>
<?php endif;?> <?php endif;?>
<th id="headerQuota"><?php p($l->t('Storage')); ?></th> <th id="headerQuota"><?php p($l->t('Storage')); ?></th>
<th id="headerStorageLocation"><?php p($l->t('Storage Location')); ?></th>
<th id="headerRemove">&nbsp;</th> <th id="headerRemove">&nbsp;</th>
</tr> </tr>
</thead> </thead>
@ -214,6 +215,7 @@ $_['subadmingroups'] = array_flip($items);
</option> </option>
</select> </select>
</td> </td>
<td class="storageLocation"><?php p($user["storageLocation"]); ?></td>
<td class="remove"> <td class="remove">
<?php if($user['name']!=OC_User::getUser()):?> <?php if($user['name']!=OC_User::getUser()):?>
<a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>"> <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(); $users = array();
$groups = array(); $groups = array();
$userManager = \OC_User::getManager();
if (isset($_GET['offset'])) { if (isset($_GET['offset'])) {
$offset = $_GET['offset']; $offset = $_GET['offset'];
@ -66,6 +67,7 @@ foreach($accessibleusers as $uid => $displayName) {
$name = $name . ' ('.$uid.')'; $name = $name . ' ('.$uid.')';
} }
$user = $userManager->get($uid);
$users[] = array( $users[] = array(
"name" => $uid, "name" => $uid,
"displayName" => $displayName, "displayName" => $displayName,
@ -73,6 +75,7 @@ foreach($accessibleusers as $uid => $displayName) {
'quota' => $quota, 'quota' => $quota,
'isQuotaUserDefined' => $isQuotaUserDefined, 'isQuotaUserDefined' => $isQuotaUserDefined,
'subadmin' => OC_SubAdmin::getSubAdminsGroups($uid), 'subadmin' => OC_SubAdmin::getSubAdminsGroups($uid),
'storageLocation' => $user->getHome(),
); );
} }