Code

Updated class_pluglist.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 26 Feb 2010 15:07:56 +0000 (15:07 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 26 Feb 2010 15:07:56 +0000 (15:07 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15760 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_config.inc
gosa-core/include/class_pluglist.inc

index dd922df9649b76bde51fab9c5bec92e232ce33ec..64995adaccc80e487f2f38ca4820d03437a501b2 100644 (file)
@@ -247,6 +247,10 @@ class config  {
                   }
                   break;
 
+      case 'PATHMENU':
+                  $this->data['PATHMENU']= array(); ;
+                  break;
+
                   /* Inser plugins */
       case 'PLUGIN':
                   if ($this->tags[$this->level-3] == 'MENU' &&
@@ -254,6 +258,9 @@ class config  {
 
                     $this->data['MENU'][$this->section][$this->gpc++]= $attrs;
                   }
+                  if ($this->tags[$this->level-2] == 'PATHMENU'){
+                    $this->data['PATHMENU'][$this->gpc++]= $attrs;
+                  }
                   if ($this->tags[$this->level-2] == 'SERVICEMENU'){
                     $this->data['SERVICE'][$attrs['CLASS']]= $attrs;
                   }
index 2e166125915b6842bbb6238be84e439638955f47..433bb753cbfc66dadcf6942c7e96213864d79312 100644 (file)
@@ -190,20 +190,11 @@ class pluglist {
         $id = 0;
         foreach ($plug as $info){
           $id ++;
-          $vars= get_class_vars($info['CLASS']);
-          $plHeadline = _((isset($info['NAME'])) ? $info['NAME'] : $vars['plHeadline']);
-          $plDescription= $vars['plDescription'];
-          $index= $this->get_index($info['CLASS']);
-          $href= "main.php?plug=$index&amp;reset=1";
-          if(!$vars){
-            $plHeadline        = _("Unknown");
-            $plDescription     = _("Unknown");
-            $href= "main.php?reset=1";
-          }
+          list($index, $title, $desc, $icon) = $this->getPlugData($info['CLASS']);
           $this->allowed_plugins[$index] = $index;
           $class= "";
           if($id == count($plug)) $class=" class='menu-last' \n   ";
-          $menu .=  "\n  <li id='plugMenuId_{$index}' $class onClick='return openPlugin({$index});'>".$plHeadline."</li>";
+          $menu .=  "\n  <li id='plugMenuId_{$index}' $class onClick='return openPlugin({$index});'>".$title."</li>";
         }
         $menu.= "\n </ul>";
         $menu.= "\n <div></div>\n";
@@ -252,8 +243,6 @@ class pluglist {
    */
   function show_iconmenu()
   {
-    global $class_mapping;
-
     $add_hr =FALSE;
     if ($this->iconmenu == ""){
       $cfg= $this->config->data['MENU'];
@@ -270,28 +259,7 @@ class pluglist {
         foreach ($plug as $info){
 
           // Get Plugin info
-          $vars= get_class_vars($info['CLASS']);
-          $plHeadline= _($vars['plHeadline']);
-          $plDescription= _($vars['plDescription']);
-          $plIcon = (isset($vars['plIcon'])) ? $vars['plIcon']: "plugin.png";
-          $index= $this->get_index($info['CLASS']);
-
-          /* Check if class is available. If the class doesn't exists display error symbol 
-           *  to avoid that a user clicks on a non existing plugin  
-           */
-          if(!$vars){
-            $plHeadline = $plDescription = _("Unknown");
-            $info['ICON'] = "error.png";
-            $index = '';
-          }
-
-          // Detect the correct position of the plugin icon
-          if(!preg_match("/\//",$plIcon)){
-            $image= get_template_path("plugins/".preg_replace('%^.*/([^/]+)/[^/]+$%', '\1', 
-                  $class_mapping[$info['CLASS']])."/images/$plIcon");
-          }else{
-            $image = $plIcon; 
-          }
+          list($index, $title, $desc, $icon) = $this->getPlugData($info['CLASS']);
 
           // Add a seperating row
           if (($col % 4) == 0){ 
@@ -299,9 +267,9 @@ class pluglist {
           }
 
           $this->iconmenu.= "\n  <div class='container-element' style='width: 25%;' onclick='openPlugin({$index})'> ";
-          $this->iconmenu.= "\n   <div class='icon-menu-item' style='background-image: url({$image});'>";
-          $this->iconmenu.= "\n    <h1>{$plHeadline}</h1>";
-          $this->iconmenu.= "\n    <p>{$plDescription}</p>";
+          $this->iconmenu.= "\n   <div class='icon-menu-item' style='background-image: url({$icon});'>";
+          $this->iconmenu.= "\n    <h1>{$title}</h1>";
+          $this->iconmenu.= "\n    <p>{$desc}</p>";
           $this->iconmenu.= "\n   </div>";
           $this->iconmenu.= "\n  </div>\n";
           $col++ ;
@@ -313,6 +281,59 @@ class pluglist {
   }
 
 
+  function genPathNavigator()
+  {
+    $cfg= &$this->config->data['PATHMENU'];
+
+    foreach($cfg as $plug){
+      list($index, $title, $desc, $icon) = $this->getPlugData($plug['CLASS']);
+    } 
+
+    return("    <div class='plugin-path'>
+     <ul class='path-navigation'>
+      <li class='left right-border' onClick=\"openPlugin('');\">
+        <div class='nav-home'></div>
+      </li>
+      <li class='left'>Welcome to GOsa</li>
+      <li class='right left-border'>Help</li>
+      <li class='right left-border'>Change password</li>
+      <li class='right left-border'>My account</li>
+     </ul>
+    </div>
+");
+  
+  }
+  
+
+  function getPlugData($class)
+  {
+    global $class_mapping;
+    $vars= get_class_vars($class);
+    $plHeadline= _($vars['plHeadline']);
+    $plDescription= _($vars['plDescription']);
+    $plIcon = (isset($vars['plIcon'])) ? $vars['plIcon']: "plugin.png";
+    $index= $this->get_index($class);
+
+    /* Check if class is available. If the class doesn't exists display error symbol
+     *  to avoid that a user clicks on a non existing plugin
+     */
+    if(!$vars){
+      $plHeadline = $plDescription = _("Unknown");
+      $plIcon = "error.png";
+      $index = '';
+    } 
+
+    // Detect the correct position of the plugin icon
+    if(!preg_match("/\//",$plIcon)){
+      $image= get_template_path("plugins/".preg_replace('%^.*/([^/]+)/[^/]+$%', '\1', 
+            $class_mapping[$class])."/images/$plIcon");
+    }else{
+      $image = $plIcon; 
+    }
+    return(array($index, $plHeadline, $plDescription, $image));
+  }
+
+
   /*! \brief    Returns the installation path of a plugin.
    *            e.g. '../plugins/admin/mimetypes'
    */