From 1e220f70c31a04aa91e49ec9b6d16db1aec3b729 Mon Sep 17 00:00:00 2001 From: cajus Date: Tue, 7 Aug 2007 12:37:40 +0000 Subject: [PATCH] Fixed sorting of DHCP list git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6987 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_dhcpNewSectionDialog.inc | 13 +++++-------- plugins/admin/systems/class_servDHCP.inc | 11 +++++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/plugins/admin/systems/class_dhcpNewSectionDialog.inc b/plugins/admin/systems/class_dhcpNewSectionDialog.inc index 1b675e5d8..26188f514 100644 --- a/plugins/admin/systems/class_dhcpNewSectionDialog.inc +++ b/plugins/admin/systems/class_dhcpNewSectionDialog.inc @@ -10,30 +10,26 @@ class dhcpNewSectionDialog extends plugin /* Mapping array */ var $types= array(); var $classtype= ""; - static $sectionMap= array( "dhcpService" => array("dhcpSharedNetwork", "dhcpSubnet", "dhcpGroup", "dhcpHost", "dhcpClass", "dhcpLeases"), + static $sectionMap= array( "dhcpService" => array("dhcpSharedNetwork", "dhcpSubnet", "dhcpGroup", "dhcpHost", "dhcpClass"), "dhcpClass" => array("dhcpSubClass"), "dhcpSubClass" => array(), - "dhcpLeases" => array(), "dhcpHost" => array(), "dhcpGroup" => array("dhcpHost"), - "dhcpPool" => array("dhcpLeases"), - "dhcpSubnet" => array("dhcpPool", "dhcpGroup", "dhcpHost", "dhcpClass", "dhcpLeases"), + "dhcpPool" => array(), + "dhcpSubnet" => array("dhcpPool", "dhcpGroup", "dhcpHost", "dhcpClass"), "dhcpSharedNetwork" => array("dhcpSubnet", "dhcpPool")); function dhcpNewSectionDialog($type) { - $this->types= array( "dhcpLog" => _("Logging"), - "dhcpService" => _("Global options"), + $this->types= array( "dhcpService" => _("Global options"), "dhcpClass" => _("Class"), "dhcpSubClass" => _("Subclass"), - "dhcpLeases" => _("Lease"), "dhcpHost" => _("Host"), "dhcpGroup" => _("Group"), "dhcpPool" => _("Pool"), "dhcpSubnet" => _("Subnet"), - "dhcpFailOverPeer" => _("Failover peer"), "dhcpSharedNetwork" => _("Shared network")); $this->classtype= $type; @@ -50,6 +46,7 @@ class dhcpNewSectionDialog extends plugin foreach ($sections as $section){ $t_sections[$section]= $this->types[$section]; } + asort($t_sections); $smarty->assign("sections", $t_sections); $smarty->assign("dhcpSectionACL", chkacl($this->acl,"DHCP")); $display.= $smarty->fetch(get_template_path('dhcpNewSection.tpl', TRUE)); diff --git a/plugins/admin/systems/class_servDHCP.inc b/plugins/admin/systems/class_servDHCP.inc index f4749767e..30ebc6f7c 100644 --- a/plugins/admin/systems/class_servDHCP.inc +++ b/plugins/admin/systems/class_servDHCP.inc @@ -77,9 +77,16 @@ class servdhcp extends plugin $data= $this->dialog->save(); if ($this->current_object == ""){ /* New object */ + $newsects= array(); + foreach ($this->dhcpSections as $key => $dsc){ + $newsects[$key]= $dsc; + if ($key == $dn){ + $spaces.= "    "; + $newsects[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'"; + } + } $this->dhcpObjectCache[$data['dn']]= $data; - $spaces.= "    "; - $this->dhcpSections[$data['dn']]= "$spaces$type '".preg_replace('/^[^=]+=([^,]+),.*$/', '\1', $data['dn'])."'"; + $this->dhcpSections= $newsects; } else { if ($dn != $data['dn']){ /* Old object, new name */ -- 2.30.2