Code

Fixed printer object tagging
[gosa.git] / plugins / admin / systems / class_workstationStartup.inc
index 893939093660948d9f7016770ec15e1252d71a7b..ef0244274ed5e61fb09bec445d83698d12d15889 100644 (file)
@@ -67,12 +67,18 @@ class workstartup extends plugin
     $_SESSION['getAvailableClassesForThisRelease_CACHE'] = array();
     $_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'] = array();
 
-    /* Search all FAI objects */
-    $ldap->search("(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAIpartitionTable))",array("cn","objectClass","FAIdebianSection"));
-    /* Sort all entries, and attach elementtype.
-     * To be able to show the types in the listbox.
-     */
-    while($attr = $ldap->fetch()){
+    $ui = get_userinfo();
+    $res = get_list(          "(|(objectClass=FAIpackageList)".
+        "(objectClass=FAItemplate)".
+        "(objectClass=FAIvariable)".
+        "(objectClass=FAIscript)".
+        "(objectClass=FAIhook)".
+        "(objectClass=FAIprofile)".
+        "(objectClass=FAIpartitionTable))",
+        $ui->subtreeACL,$this->config->current['BASE'],
+        array("cn","objectClass","FAIdebianSection"));
+    
+    foreach($res as $attr){
       $cn = $attr['cn'][0];
     
       $_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'][] = $attr;
@@ -118,8 +124,11 @@ class workstartup extends plugin
       natcasesort($this->FAIclasses);
     }
 
-    $this->FAIclassInfo = $tmp2;
-
+    if(isset($tmp2)){
+      $this->FAIclassInfo = $tmp2;
+    } else {
+      $this->FAIclassInfo = array();
+    }
 
     /* Build up an array like this one :
         [$url]['SERVER'] = 'srv1-002';
@@ -338,28 +347,6 @@ class workstartup extends plugin
       return($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release]);
     }
 
-    /* Create cache with all classes 
-     */
-    if((!isset($_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'])) ||
-       (!is_array($_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'])) ||
-       (count($_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES']) ==0 )){
-
-      /* Get ldap connection */
-      $ldap   = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-
-      /* Get possible classes ... 
-         This would be faste with some kind of caching ... 
-       */
-      $ldap->search("(|(objectClass=FAIpackageList)(objectClass=FAItemplate)(objectClass=FAIvariable)(objectClass=FAIscript)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAIpartitionTable))",array("cn"),true);
-      /* Sort all entries, and attach elementtype.
-       * To be able to show the types in the listbox.
-       */
-      while($attr = $ldap->fetch()){
-        $_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'][] = $attr;
-      }  
-    }
-
     /* Walk through cache and get out what we need.
      *   
      *   Function od : "$this->generateDNSyn($release)"
@@ -583,13 +570,6 @@ class workstartup extends plugin
       }
     }
 
-    /* Delete selected class from our list */
-    if((isset($_POST['DelClass']))&&(isset($_POST['FAIclassSel']))){
-      if(isset($this->FAIclass[$_POST['FAIclassSel']])){
-        unset($this->FAIclass[$_POST['FAIclassSel']]);
-      }
-    }
-
     /* Show main page */
     $smarty= get_smarty();
     $smarty->assign("SelectBoxLdapServer","");