system: sort user/group list, small tweaks; closes #2870

This commit is contained in:
Franco Fichtner 2018-11-03 14:57:17 +01:00
parent fbe8ac7de9
commit 436b0a7f02
2 changed files with 45 additions and 35 deletions

View File

@ -1,33 +1,33 @@
<?php
/*
Copyright (C) 2014-2016 Deciso B.V.
Copyright (C) 2008 Shrew Soft Inc. <mgrooms@shrew.net>
Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
* Copyright (C) 2014-2016 Deciso B.V.
* Copyright (C) 2008 Shrew Soft Inc. <mgrooms@shrew.net>
* Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>
* Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
require_once("guiconfig.inc");
@ -378,7 +378,12 @@ $( document ).ready(function() {
<tbody>
<?php
$i = 0;
foreach ($a_group as $group) :?>
/* create a copy for sorting */
$a_group_ro = $a_group;
usort($a_group_ro, function($a, $b) {
return strnatcasecmp($a['name'], $b['name']);
});
foreach ($a_group_ro as $group): ?>
<tr>
<td>
<span class="fa fa-user <?= !empty($group['priv']) && in_array('page-all', $group['priv']) ? 'text-danger' : 'text-info' ?>"></span>
@ -388,7 +393,7 @@ $( document ).ready(function() {
<td ><?=$group['description'];?></td>
<td class="text-nowrap">
<a href="system_groupmanager.php?act=edit&groupid=<?=$i?>"
class="btn btn-default btn-xs" data-toggle="tooltip" title="<?=gettext("edit group");?>">
class="btn btn-default btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Edit')) ?>">
<span class="fa fa-pencil fa-fw"></span>
</a>
@ -396,7 +401,7 @@ $( document ).ready(function() {
if ($group['scope'] != "system") :?>
<button type="button" class="btn btn-default btn-xs act-del-group"
data-groupname="<?=$group['name'];?>"
data-groupid="<?=$i?>" title="<?=gettext("delete group");?>" data-toggle="tooltip">
data-groupid="<?=$i?>" title="<?= html_safe(gettext('Delete')) ?>" data-toggle="tooltip">
<span class="fa fa-trash fa-fw"></span>
</button>
<?php

View File

@ -995,7 +995,11 @@ $( document ).ready(function() {
<tbody>
<?php
$i = 0;
foreach ($a_user as $userent) :?>
$a_user_ro = $a_user;
usort($a_user_ro, function($a, $b) {
return strnatcasecmp($a['name'], $b['name']);
});
foreach ($a_user_ro as $userent): ?>
<tr>
<td>
<?php
@ -1012,14 +1016,14 @@ $( document ).ready(function() {
<td><?= implode(', ', local_user_get_groups($userent)) ?></td>
<td class="text-nowrap">
<a href="system_usermanager.php?act=edit&userid=<?=$i?>"
class="btn btn-default btn-xs" data-toggle="tooltip" title="<?=gettext("edit user");?>">
class="btn btn-default btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Edit')) ?>">
<span class="fa fa-pencil fa-fw"></span>
</a>
<?php
if ($userent['scope'] != "system") :?>
<button type="button" class="btn btn-default btn-xs act-del-user"
data-username="<?=$userent['name'];?>"
data-userid="<?=$i?>" title="<?=gettext("delete user");?>" data-toggle="tooltip">
data-userid="<?=$i?>" title="<?= html_safe(gettext('Delete')) ?>" data-toggle="tooltip">
<span class="fa fa-trash fa-fw"></span>
</button>
<?php
@ -1062,8 +1066,9 @@ $( document ).ready(function() {
<?php if ($can_import): ?>
<button type="submit" name="import"
id="import_ldap_users"
class="btn btn-default btn-xs"
title="<?=gettext("import users")?>">
data-toggle="tooltip"
class="btn btn-primary btn-xs"
title="<?= html_safe(gettext('Import')) ?>">
<i class="fa fa-cloud-download fa-fw"></i>
</button>
<?php endif ?>