Code

Fixed dialog ignore account state
[gosa.git] / gosa-core / include / class_pathNavigator.inc
index 1ebb7d42acc980ef69030ddb0a6b879eca2f34d1..815a5081b2496db4e38d034cad2fb4024327a3ff 100644 (file)
@@ -3,10 +3,10 @@
 class pathNavigator
 {
 
-  static function registerPlugin($class)
+  static function registerPlugin($class, $title= "")
   {
     
-    $str = $title = "";
+    $str = "";
 
     // Display headline of management plugins
     if($class instanceOf management && isset($class->plHeadline)){
@@ -15,9 +15,7 @@ class pathNavigator
 
     // Shown title of sub dialogs (They have no plHeadline set.)
     if($class instanceOf plugin && !isset($class->plHeadline)){
-      if(empty($class->pathTitle)){
-        $str = "Missing: ".get_class($class);
-      }else{
+      if(!empty($class->pathTitle)){
         $str = _($class->pathTitle);
       }
     }
@@ -30,15 +28,22 @@ class pathNavigator
         if(!session::is_set("pathNavigator::registerPlugin:{$class->dn}")){
           global $config;
           $ldap = $config->get_ldap_link();
-          $ldap->cat($class->dn, array('cn'));
-          if($ldap->count()){
-            $attrs = $ldap->fetch();
-            $str = $attrs['cn'][0];
+
+          if(!empty($class->dn)){
+            $namingAttr = preg_replace("/^([^=]*)=.*$/","\\1",$class->dn);
+
+            $ldap->cat($class->dn, array($namingAttr));
+            if($ldap->count()){
+              $attrs = $ldap->fetch();
+              $str = $attrs[$namingAttr][0];
+            }
+            session::set("pathNavigator::registerPlugin:{$class->dn}", $str);
           }
-          session::set("pathNavigator::registerPlugin:{$class->dn}", $str);
         }
         $str = session::get("pathNavigator::registerPlugin:{$class->dn}");
-        $title = $class->dn;
+        if(empty($title)){
+          $title = $class->dn;
+        }
       }
     }
 
@@ -52,11 +57,7 @@ class pathNavigator
 
       if(!empty($title)) $title = " title='{$title}' ";
 
-      if(empty($cur)){
-        $cur.= "\n<li {$title} class='left path-element'>{$str}</li>";
-      }else{
-        $cur.= "\n<li {$title} class='left path-element'>{$str}</li>";
-      }
+      $cur.= "\n<li {$title} class='left path-element'>{$str}</li>";
       session::set('pathNavigator::position', $cur);
     }
   }