From c7a97314df736834f15b536fcf8bf1f7cd70eb65 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 22 Apr 2003 17:01:19 +0000 Subject: [PATCH] lists are now sorted correctly at first view --- lam/lib/listgroups.php | 3 ++- lam/lib/listhosts.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lam/lib/listgroups.php b/lam/lib/listgroups.php index 715dd2ba..ebea2917 100644 --- a/lam/lib/listgroups.php +++ b/lam/lib/listgroups.php @@ -137,8 +137,9 @@ echo "\n"; function cmp_array($a, $b) { // list specifies the sort column global $list; + global $attr_array; // sort by first attribute with name $list - if (!$list) $list = 0; + if (!$list) $list = strtolower($attr_array[0]); if ($a[$list][0] == $b[$list][0]) return 0; else if ($a[$list][0] == max($a[$list][0], $b[$list][0])) return 1; else return -1; diff --git a/lam/lib/listhosts.php b/lam/lib/listhosts.php index f8c5d32b..0443d9b6 100644 --- a/lam/lib/listhosts.php +++ b/lam/lib/listhosts.php @@ -119,8 +119,9 @@ echo "\n"; function cmp_array($a, $b) { // list specifies the sort column global $list; + global $attr_array; // sort by first attribute with name $list - if (!$list) $list = 0; + if (!$list) $list = strtolower($attr_array[0]); if ($a[$list][0] == $b[$list][0]) return 0; else if ($a[$list][0] == max($a[$list][0], $b[$list][0])) return 1; else return -1;