From 303cbe28859ee689cec20848bb7ecf34b69c462e Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 21 Feb 2008 14:22:27 +0000 Subject: [PATCH] Updated tabs. -Undefined variable was used Updated teminal service. -Performance improvements, from 4 seconds to few msecs git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9023 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofon/admin/systems/gofon/tabs_phone.inc | 2 +- .../systems/goto/class_terminalService.inc | 30 +++++++++++++++++-- .../goto/admin/systems/goto/tabs_terminal.inc | 4 +-- .../systems/admin/systems/tabs_component.inc | 2 +- .../systems/admin/systems/tabs_server.inc | 4 +-- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/gosa-plugins/gofon/admin/systems/gofon/tabs_phone.inc b/gosa-plugins/gofon/admin/systems/gofon/tabs_phone.inc index e96565787..e4d05b1e0 100644 --- a/gosa-plugins/gofon/admin/systems/gofon/tabs_phone.inc +++ b/gosa-plugins/gofon/admin/systems/gofon/tabs_phone.inc @@ -15,7 +15,7 @@ class phonetabs extends tabs { tabs::save_object($save_current); - $base_obj = $this->by_object['phoneGeneric']; + $baseobject = $this->by_object['phoneGeneric']; $baseobject->netConfigDNS->cn= $baseobject->cn; } diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc index 2f8141c64..a243f8882 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc @@ -198,16 +198,40 @@ class termservice extends plugin $this->hardware_list[$cn]= "$cn$description"; } + + + + /* Eventually colorize phones */ - $ldap->cd($this->config->current['BASE']); - $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware')); - while($attrs = $ldap->fetch()){ + + $deps = array(); + $ou = preg_replace("/,.*$/","",get_ou("phoneou")); + + if(!empty($ou)){ + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=organizationalUnit)(".$ou."))",array("dn")); + while($attrs = $ldap->fetch()){ + $deps[] = $attrs['dn']; + } + }else{ + + /* Phone ou seems to be empty, fall back to overall base . + */ + $deps[] = $this->config->current['BASE']; + } + + foreach($deps as $dep){ + $ldap->cd($dep); + $ldap->search("(goFonHardware=*)",array('cn','dn','goFonHardware')); + while($attrs = $ldap->fetch()){ $cn = $attrs['goFonHardware'][0]; if(isset($this->hardware_list[$cn])){ $this->used_hardware[$cn]= $cn; } + } } $this->hardware_list["automatic"]= _("automatic"); + ksort($this->hardware_list); /* Convert gotoLpdEnable diff --git a/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc b/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc index 9f806acb6..ab2779a2f 100644 --- a/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc +++ b/gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc @@ -43,10 +43,10 @@ class termtabs extends tabs $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath; } - $base_obj = $this->by_object['termgeneric']; + $baseobject = $this->by_object['termgeneric']; $baseobject->netConfigDNS->cn= $baseobject->cn; foreach($this->by_object as $name => $plug){ - $this->by_object[$name]->cn = $base_obj->cn; + $this->by_object[$name]->cn = $baseobject->cn; } } diff --git a/gosa-plugins/systems/admin/systems/tabs_component.inc b/gosa-plugins/systems/admin/systems/tabs_component.inc index 25f34f261..924b6308e 100644 --- a/gosa-plugins/systems/admin/systems/tabs_component.inc +++ b/gosa-plugins/systems/admin/systems/tabs_component.inc @@ -15,7 +15,7 @@ class componenttabs extends tabs { tabs::save_object($save_current); - $base_obj = $this->by_object['componentGeneric']; + $baseobject = $this->by_object['componentGeneric']; $baseobject->netConfigDNS->cn= $baseobject->cn; } diff --git a/gosa-plugins/systems/admin/systems/tabs_server.inc b/gosa-plugins/systems/admin/systems/tabs_server.inc index 97e45602f..3c09bb5ce 100644 --- a/gosa-plugins/systems/admin/systems/tabs_server.inc +++ b/gosa-plugins/systems/admin/systems/tabs_server.inc @@ -38,8 +38,8 @@ class servtabs extends tabs { tabs::save_object($save_current); - $base_obj = $this->by_object['servgeneric']; - $base_obj->netConfigDNS->cn= $base_obj->cn; + $baseobject = $this->by_object['servgeneric']; + $baseobject->netConfigDNS->cn= $baseobject->cn; } -- 2.30.2