Code

Fixed dialog ignore account state
[gosa.git] / gosa-core / include / class_pathNavigator.inc
index cc280955a39345d54e9375f375fa364f65fda6ef..815a5081b2496db4e38d034cad2fb4024327a3ff 100644 (file)
@@ -3,7 +3,7 @@
 class pathNavigator
 {
 
-  static function registerPlugin($class)
+  static function registerPlugin($class, $title= "")
   {
     
     $str = "";
@@ -15,16 +15,36 @@ 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);
       }
     }
   
     // In case of tabs add the 'dn' of the entry 
     if($class instanceOf tabs){
-      $str = $class->dn;
+
+      // Convert dn to cn
+      if(isset($class->dn)){
+        if(!session::is_set("pathNavigator::registerPlugin:{$class->dn}")){
+          global $config;
+          $ldap = $config->get_ldap_link();
+
+          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);
+          }
+        }
+        $str = session::get("pathNavigator::registerPlugin:{$class->dn}");
+        if(empty($title)){
+          $title = $class->dn;
+        }
+      }
     }
 
     // Simple string given 
@@ -34,11 +54,10 @@ class pathNavigator
     
     if(!empty($str)){
       $cur = session::get('pathNavigator::position');
-      if(empty($cur)){
-        $cur.= "<li class='left path-element'>{$str}</li>";
-      }else{
-        $cur.= "<li class='left path-element'>{$str}</li>";
-      }
+
+      if(!empty($title)) $title = " title='{$title}' ";
+
+      $cur.= "\n<li {$title} class='left path-element'>{$str}</li>";
       session::set('pathNavigator::position', $cur);
     }
   }