X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_pathNavigator.inc;h=6140e0e0146290e591bf152726ecba82c2dccc21;hb=1069c3be6d2a5b9cf96c8decbc6bb95d42da32cc;hp=cc280955a39345d54e9375f375fa364f65fda6ef;hpb=fe85414a620657b4ab9a554d190526c9677af994;p=gosa.git diff --git a/gosa-core/include/class_pathNavigator.inc b/gosa-core/include/class_pathNavigator.inc index cc280955a..6140e0e01 100644 --- a/gosa-core/include/class_pathNavigator.inc +++ b/gosa-core/include/class_pathNavigator.inc @@ -3,9 +3,8 @@ class pathNavigator { - static function registerPlugin($class) + static function registerPlugin($class, $title= "") { - $str = ""; // Display headline of management plugins @@ -15,16 +14,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,27 +53,47 @@ class pathNavigator if(!empty($str)){ $cur = session::get('pathNavigator::position'); - if(empty($cur)){ - $cur.= "
  • {$str}
  • "; - }else{ - $cur.= "
  • {$str}
  • "; - } + $entry = array('TITLE' => $title, 'NAME' => $str); + $cur[] = $entry; session::set('pathNavigator::position', $cur); } } static function getCurrentPath() { - $path = session::get('pathNavigator::position'); + // Ensure that we've a position value initialized. + if(!session::is_set('pathNavigator::position')) { + session::set('pathNavigator::position',array()); + } + + // Get position and validate its value + $list = session::get('pathNavigator::position'); + if(!is_array($list)){ + $list = array(); + } + + // Build up title and path string. + $path = ""; + $sTitle = ""; + foreach($list as $entry){ + $title = (!empty($entry['TITLE']))? 'title="'.htmlentities(LDAP::fix($entry['TITLE']),ENT_COMPAT,'UTF-8').'"': ''; + $path.= "\n
  • {$entry['NAME']}
  • "; + $sTitle .= " - ".$entry['NAME']; + } + + // If no path is given then show a simple 'Welcome to GOsa' string. if(empty($path)){ $path = "
  • "._("Welcome to GOsa")."
  • "; } + + $smarty = get_smarty(); + $smarty->assign('title', 'GOsa '.$sTitle); return($path); } static function clear() { - session::set('pathNavigator::position',''); + session::set('pathNavigator::position', array()); } }