Code

Updated tabs.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Feb 2008 14:22:27 +0000 (14:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Feb 2008 14:22:27 +0000 (14:22 +0000)
-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

gosa-plugins/gofon/admin/systems/gofon/tabs_phone.inc
gosa-plugins/goto/admin/systems/goto/class_terminalService.inc
gosa-plugins/goto/admin/systems/goto/tabs_terminal.inc
gosa-plugins/systems/admin/systems/tabs_component.inc
gosa-plugins/systems/admin/systems/tabs_server.inc

index e965657870fe4dda6d263b479557d6de69aa3649..e4d05b1e04c053bdbef19e39c8b4f71b5e47046a 100644 (file)
@@ -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;
   }
 
index 2f8141c64aed94ae7f5b451d83b4e086aaf9068f..a243f8882fd8a797c86b84414454ea052f6fe06d 100644 (file)
@@ -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 
index 9f806acb6d80f91dc5cdc477acbbfe2700afb34a..ab2779a2f80dc7cf29b269e9d9b11387f3a376a9 100644 (file)
@@ -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;
     }
   }
 
index 25f34f2615246e6c60f9a475f52e048867c60e5c..924b6308e6102b84f4fd6bd1217f7b28d637b48c 100644 (file)
@@ -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;
   }
 
index 97e45602fe0159d961d65a0d0f826881f3cb4b88..3c09bb5cea623864be743b48a7a7842ac23dbfbe 100644 (file)
@@ -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;
   }