From e9b668186efc28425521d9e5467803dd1c24b5f5 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 19 Dec 2007 12:28:22 +0000 Subject: [PATCH] Fixed sorting iof entries. -Natural sorting git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8145 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/applications/class_applicationManagement.inc | 8 +++++--- .../plugins/admin/devices/class_deviceManagement.inc | 8 +++++--- .../plugins/admin/mimetypes/class_mimetypeManagement.inc | 8 +++++--- .../plugins/admin/ogroups/class_ogroupManagement.inc | 8 +++++--- gosa-core/plugins/admin/users/class_userManagement.inc | 2 +- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/gosa-core/plugins/admin/applications/class_applicationManagement.inc b/gosa-core/plugins/admin/applications/class_applicationManagement.inc index 69a4c0f48..7736f1963 100644 --- a/gosa-core/plugins/admin/applications/class_applicationManagement.inc +++ b/gosa-core/plugins/admin/applications/class_applicationManagement.inc @@ -521,14 +521,16 @@ class applicationManagement extends plugin } $res= get_list($Filter, "application", $use_base, array("cn","description","dn","objectClass"), $Flags); + $tmp2 = array(); foreach ($res as $val){ $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val; + $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn']; } - ksort($tmp); + natcasesort($tmp2); $this->applications=array(); - foreach($tmp as $val){ - $this->applications[]=$val; + foreach($tmp2 as $val){ + $this->applications[]=$tmp[$val]; } reset ($this->applications); } diff --git a/gosa-core/plugins/admin/devices/class_deviceManagement.inc b/gosa-core/plugins/admin/devices/class_deviceManagement.inc index dbdfc0fb4..59e702ff4 100644 --- a/gosa-core/plugins/admin/devices/class_deviceManagement.inc +++ b/gosa-core/plugins/admin/devices/class_deviceManagement.inc @@ -512,15 +512,17 @@ class deviceManagement extends plugin /* Get results and create index */ $res= get_list($Filter, "devices", $base, array("cn","description","dn","objectClass"), $Flags); + $tmp2 = array(); foreach ($res as $val){ + $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn']; $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val; } /* sort entries */ - ksort($tmp); + natcasesort($tmp2); $this->devices=array(); - foreach($tmp as $val){ - $this->devices[]=$val; + foreach($tmp2 as $val){ + $this->devices[]=$tmp[$val]; } reset ($this->devices); } diff --git a/gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc b/gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc index 5cd9c15b3..651110360 100755 --- a/gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc +++ b/gosa-core/plugins/admin/mimetypes/class_mimetypeManagement.inc @@ -527,15 +527,17 @@ class mimetypeManagement extends plugin /* Get results and create index */ $res= get_list($Filter, "mimetypes", $use_base, array("cn","description","dn","objectClass"), $Flags); + $tmp2 = array(); foreach ($res as $val){ $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val; + $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn']; } /* sort entries */ - ksort($tmp); + natcasesort($tmp2); $this->mimetypes=array(); - foreach($tmp as $val){ - $this->mimetypes[]=$val; + foreach($tmp2 as $val){ + $this->mimetypes[]=$tmp[$val]; } reset ($this->mimetypes); } diff --git a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc index 574087740..1e66866da 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc @@ -532,13 +532,15 @@ class ogroupManagement extends plugin ksort ($this->ogrouplist); reset ($this->ogrouplist); $tmp=array(); + $tmp2 = array(); foreach($this->ogrouplist as $tkey => $val ){ $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val; + $tmp2[strtolower($val['cn'][0]).$val['cn'][0]] = strtolower($val['cn'][0]).$val['cn'][0]; } - ksort($tmp); + natcasesort($tmp2); $this->ogrouplist=array(); - foreach($tmp as $val){ - $this->ogrouplist[]=$val; + foreach($tmp2 as $val){ + $this->ogrouplist[]=$tmp[$val]; } reset ($this->ogrouplist); } diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index a031e89d9..977a26f6b 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -990,7 +990,7 @@ class userManagement extends plugin $SortTemp[$display] = $display; } } - sort($SortTemp); + natcasesort($SortTemp); reset($SortTemp); $this->list = array(); -- 2.30.2