From 6c70dda0011722186c13040fe36eed3845d80209 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 20 Apr 2006 13:30:47 +0000 Subject: [PATCH] Added new department sorting for div lists git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3076 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_applicationManagement.inc | 23 +++++------- plugins/admin/fai/class_faiManagement.inc | 35 ++++++++----------- .../admin/groups/class_groupManagement.inc | 26 +++++++------- .../admin/ogroups/class_ogroupManagement.inc | 25 +++++-------- .../admin/systems/class_systemManagement.inc | 19 +++++----- 5 files changed, 52 insertions(+), 76 deletions(-) diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc index 8cd0d4d9e..e1a4dd820 100644 --- a/plugins/admin/applications/class_applicationManagement.inc +++ b/plugins/admin/applications/class_applicationManagement.inc @@ -624,26 +624,21 @@ class applicationManagement extends plugin * So we are able to navigate like in konquerer */ $peopleOU = get_people_ou(); - $base2 = $_SESSION['CurrentMainBase']; - $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL, - $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); - $this->departments= array(); - $tmp = array(); - foreach ($res3 as $value){ - $tmp[strtolower($value['dn']).$value['dn']]=$value; - } - ksort($tmp); - foreach($tmp as $value){ - if(isset($value["description"][0])){ + /* Get all departments within this subtree */ + $deps= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL, + $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); + + $this->departments = array(); + foreach($deps as $value){ + if(isset($value['description'][0])){ $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]"; }else{ - $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0]; + $this->departments[$value['dn']]= get_sub_department($value['dn']); } } - - + natcasesort($this->departments); /* END NEW LIST MANAGMENT */ diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 2d3a7fc21..6f3b0e30e 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -902,27 +902,22 @@ class faiManagement extends plugin */ $base2 = $_SESSION['CurrentMainBase']; - $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", - $this->ui->subtreeACL, $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); - - $this->departments= array(); - $tmp = array(); - foreach ($res3 as $value){ - $tmp[strtolower($value['dn']).$value['dn']]=$value; - } - ksort($tmp); - foreach($tmp as $value){ - if(isset($value["description"][0])){ - $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]"; - }else{ - $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0]; - } - } - - /* END NEW LIST MANAGMENT + /* Get all departments within this subtree */ + $deps= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL, + $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); + + $this->departments = array(); + foreach($deps as $value){ + if(isset($value['description'][0])){ + $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]"; + }else{ + $this->departments[$value['dn']]= get_sub_department($value['dn']); + } + } + natcasesort($this->departments); + + /* END NEW LIST MANAGMENT */ - - $res= get_list("(objectClass=organizationalUnit)", $this->ui->subtreeACL, $base, array("cn","description","objectClass"), GL_SIZELIMIT); diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 047bb76aa..4eedcbacb 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -679,21 +679,19 @@ class groupManagement extends plugin * So we are able to navigate like in konquerer */ - $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", - $this->ui->subtreeACL, $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); - $this->departments= array(); - $tmp = array(); - foreach ($res3 as $value){ - $tmp[strtolower($value['dn']).$value['dn']]=$value; - } - ksort($tmp); - foreach($tmp as $value){ - if(isset($value["description"][0])){ - $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]"; - }else{ - $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0]; - } + /* Get all departments within this subtree */ + $deps= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL, + $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); + + $this->departments = array(); + foreach($deps as $value){ + if(isset($value['description'][0])){ + $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]"; + }else{ + $this->departments[$value['dn']]= get_sub_department($value['dn']); } + } + natcasesort($this->departments); /* Ende department generation */ diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc index 4980494a0..a626537cd 100644 --- a/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/plugins/admin/ogroups/class_ogroupManagement.inc @@ -706,24 +706,19 @@ name='dep_root' alt='"._("Root")."'> ". $base2 = preg_replace("/".$peopleOU."/i","",$base); } - $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", - $this->ui->subtreeACL, $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); + /* Get all departments within this subtree */ + $deps= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL, + $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); - $this->departments= array(); - $tmp = array(); - foreach ($res3 as $value){ - $tmp[strtolower($value['dn']).$value['dn']]=$value; - } - ksort($tmp); - foreach($tmp as $value){ - if(isset($value["description"][0])){ + $this->departments = array(); + foreach($deps as $value){ + if(isset($value['description'][0])){ $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]"; }else{ - $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0]; + $this->departments[$value['dn']]= get_sub_department($value['dn']); } } - /* END NEW LIST MANAGMENT - */ + natcasesort($this->departments); $tmp=array(); foreach($this->ogrouplist as $tkey => $val ){ @@ -735,11 +730,7 @@ name='dep_root' alt='"._("Root")."'> ". $this->ogrouplist[]=$val; } reset ($this->ogrouplist); - - - } - } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc index 6b022edd3..6d188a699 100644 --- a/plugins/admin/systems/class_systemManagement.inc +++ b/plugins/admin/systems/class_systemManagement.inc @@ -1101,22 +1101,19 @@ class systems extends plugin $base2 = preg_replace("/".$peopleOU."/i","",$base); } - $res3= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL, - $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); + /* Get all departments within this subtree */ + $deps= get_list("(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", $this->ui->subtreeACL, + $base2, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT); - $this->departments= array(); - $tmp = array(); - foreach ($res3 as $value){ - $tmp[strtolower($value['dn']).$value['dn']]=$value; - } - ksort($tmp); - foreach($tmp as $value){ - if(isset($value["description"][0])){ + $this->departments = array(); + foreach($deps as $value){ + if(isset($value['description'][0])){ $this->departments[$value['dn']]= get_sub_department($value['dn'])." - [".$value["description"][0]."]"; }else{ - $this->departments[$value['dn']]= get_sub_department($value['dn']);//$value["description"][0]; + $this->departments[$value['dn']]= get_sub_department($value['dn']); } } + natcasesort($this->departments); /* END NEW LIST MANAGMENT */ -- 2.30.2