Code

Added pathNavigator
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Mar 2010 08:41:53 +0000 (08:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Mar 2010 08:41:53 +0000 (08:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16403 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/html/main.php
gosa-core/include/class_management.inc
gosa-core/include/class_pathNavigator.inc [new file with mode: 0644]
gosa-core/include/class_plugin.inc
gosa-core/include/class_pluglist.inc
gosa-core/include/class_tabs.inc

index 0e0a5eac0352b98a6b9914128ec99ea4821748ce..11fa7dc5e4df1f082ea6b2ab31ee6976ba76fae4 100644 (file)
@@ -41,6 +41,8 @@ session::set('errorsAlreadyPosted',array());
 session::global_set('runtime_cache',array());
 session::set('limit_exceeded',FALSE);
 
+pathNavigator::clear();
+
 if ($_SERVER["REQUEST_METHOD"] == "POST"){
   @DEBUG (DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, "_POST");
 }
@@ -301,7 +303,6 @@ if($reload_navigation){
   $plist->menu="";
 }
 $smarty->assign ("menu", $plist->gen_menu());
-$smarty->assign ("pathMenu", $plist->genPathMenu());
 $smarty->assign ("plug", "$plug");
 
 $smarty->assign("iePngWorkaround", $config->get_cfg_value("iePngWorkaround","false" ) == "true");
@@ -355,6 +356,7 @@ if (is_file("$plugin_dir/main.inc")){
 
 /* Print_out last ErrorMessage repeated string. */
 $smarty->assign("msg_dialogs", msg_dialog::get_dialogs());
+$smarty->assign ("pathMenu", $plist->genPathMenu());
 $smarty->assign("contents", $display);
 
 /* If there's some post, take a look if everything is there... */
index b15a124623ef4f417141566efd8d290a03d62a5b..a1d935eb3627aee32bede308f3b10e7ac369f7e9 100644 (file)
@@ -132,6 +132,8 @@ class management
     $vars = array('/^act$/','/^listing/','/^PID$/','/^FILTER_PID$/');
     session::set('LOCK_VARS_TO_USE',$vars);
 
+    pathNavigator::registerPlugin($this);
+
     /* Display the copy & paste dialog, if it is currently open */
     $ret = $this->copyPasteHandler("",array());
     if($ret){
diff --git a/gosa-core/include/class_pathNavigator.inc b/gosa-core/include/class_pathNavigator.inc
new file mode 100644 (file)
index 0000000..83872cc
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+class pathNavigator
+{
+
+  static function registerPlugin($class)
+  {
+    $str = "";
+    if($class instanceOf management){
+      $str = "<b>".$class->plHeadline."</b>";
+    }elseif($class instanceOf plugin){
+      $str = $class->plHeadline;
+    }elseif($class instanceOf tabs){
+      $str = $class->dn;
+    }
+    
+    if(!empty($str)){
+      $cur = session::get('pathNavigator::position');
+      $cur.= "<li class='left'>{$str}</li>";
+      session::set('pathNavigator::position', $cur);
+    }
+  }
+
+  static function getCurrentPath()
+  {
+    return(session::get('pathNavigator::position'));
+  }
+
+  static function clear()
+  {
+    session::set('pathNavigator::position','');
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
index 333ae0a7e0530895ea30df828656360726fa1e5a..75da65582e81a825d6c7f025f1a6907be8d07a3e 100644 (file)
@@ -276,6 +276,8 @@ class plugin
     session::set('LOCK_VARS_USED_GET',array());
     session::set('LOCK_VARS_USED_POST',array());
     session::set('LOCK_VARS_USED_REQUEST',array());
+
+    pathNavigator::registerPlugin($this);
   }
 
   /*! \brief Removes object from parent
index 41fbd1d382d23282168cf644aed631965fdd0f8f..64cd42ef2fd1e161caff00607784a7ce3c17e054 100644 (file)
@@ -323,7 +323,7 @@ class pluglist
         "\n            <li class='left right-border' onClick=\"openPlugin('');\">".
         "\n              <div class='nav-home'></div>".
         "\n            </li>".
-        "\n            <li class='left'>Welcome to GOsa</li>";
+        "\n            %navigator%";
 
       // Check if we've at least one entry defined ih the pathmenu
       if(isset($this->config->data['PATHMENU'])){
@@ -336,8 +336,10 @@ class pluglist
       }
       $this->pathMenu.= "\n          </ul>";
       $this->pathMenu.= "\n        </div>";
-    } 
-    return($this->pathMenu); 
+    }
+
+    $menu = pathNavigator::getCurrentPath();
+    return(preg_replace("/%navigator%/", $menu, $this->pathMenu)); 
   }
   
 
index 9f52e45a6af012b8ce4fcac64292d47ea71f2c25..af356229f9cd67bd8c35a4b26db99bb9c1f720b9 100644 (file)
@@ -114,6 +114,8 @@ class tabs
       $this->current = key($this->by_name);
     }
 
+    pathNavigator::registerPlugin($this);
+
     // Rotate current to last 
     $this->last= $this->current;