Code

Updated dn display to not break at spaces
[gosa.git] / plugins / admin / fai / class_askClassName.inc
index 9aa4aa826832cbe26f9ca596929a46f1cf10dfaa..727e46ca6323c56dd31bc052820912aa310e7632 100644 (file)
@@ -22,12 +22,15 @@ class askClassName extends plugin
     $this->ui = $ui;
     $this->objectClass = $objectClass;
     plugin::plugin ($config, $dn);
+    if(!isset($_SESSION['CurrentMainBase'])){
+      $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
+    }
   }
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
 
     /* Fill templating stuff */
     $smarty = get_smarty();
@@ -41,15 +44,20 @@ class askClassName extends plugin
     /* First search for every ou, in given fai base
      * With a second search detect all object that belong to the different ous. 
      */
-    $base = "ou=fai,ou=configs,ou=systems,".$faifilter['base'];
+
+    $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+    if($faifilter['branch'] != "main"){
+      $base = $faifilter['branch'];
+    }
     $ldap = $this->config->get_ldap_link();
-    $res  = get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",FALSE, $base, array("cn","description","objectClass"),TRUE);
+    $res= get_list("(objectClass=organizationalUnit)", $this->ui->subtreeACL, $base,
+                   array("cn","description","objectClass"), GL_SIZELIMIT);
     $used = array();
 
     $delete = array();
     foreach($res as $objecttypes){
-      $res2 = get_list2($this->ui->subtreeACL, "(objectClass=*)",
-          FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass"),TRUE);
+      $res2= get_list("(objectClass=*)", $this->ui->subtreeACL, $objecttypes['dn'],
+                      array("cn","description","objectClass","FAIclass"), GL_SIZELIMIT | GL_CONVERT);
 
       foreach($res2 as $object){
         /* skip class names with this name */ 
@@ -59,7 +67,9 @@ class askClassName extends plugin
     
         /* Skip profiles */
         if(!in_array("FAIprofile",$object['objectClass'])){
-          $used[$object['cn'][0]]= $object['cn'][0];
+          if(isset($object['cn'])){
+            $used[$object['cn'][0]]= $object['cn'][0];
+          }
         }
       }
     }
@@ -94,11 +104,12 @@ class askClassName extends plugin
      */
     if(count ($used)==0){
       $smarty->assign("ClassNamesAvailable", " disabled ");
+      $smarty->assign("grey", 'style="color:#C0C0C0"');
     }else{
       $smarty->assign("ClassNamesAvailable", "");
+      $smarty->assign("grey", "");
     }
     $smarty->assign("ClassNames", $used);
-    $smarty->assign("ClassNameKeys", $used);
     $display.= $smarty->fetch(get_template_path('askClassName.tpl', TRUE));
     return($display);
   }
@@ -124,7 +135,9 @@ class askClassName extends plugin
    */
   function check()
   {
-    $message= array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+  
     if(empty($this->ClassName)){
       $message[]=_("The given class name is empty.");
     }