Code

Updated config and pluglist to supprt the new shortCut menu
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Jun 2010 13:35:25 +0000 (13:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Jun 2010 13:35:25 +0000 (13:35 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18866 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 7eb2d38b6d27899873940f50455002a2fb9440b6..17b860c58386189fc00acba33f58227ca1acbe9d 100644 (file)
@@ -253,6 +253,10 @@ class config  {
                   $this->data['PATHMENU']= array(); ;
                   break;
 
+      case 'SHORTCUTMENU':
+                  $this->data['SHORTCUTMENU']= array(); ;
+                  break;
+
                   /* Inser plugins */
       case 'PLUGIN':
                   if ($this->tags[$this->level-3] == 'MENU' &&
@@ -263,6 +267,9 @@ class config  {
                   if ($this->tags[$this->level-2] == 'PATHMENU'){
                     $this->data['PATHMENU'][$this->gpc++]= $attrs;
                   }
+                  if ($this->tags[$this->level-2] == 'SHORTCUTMENU'){
+                    $this->data['SHORTCUTMENU'][$this->gpc++]= $attrs;
+                  }
                   if ($this->tags[$this->level-2] == 'SERVICEMENU'){
                     $this->data['SERVICE'][$attrs['CLASS']]= $attrs;
                   }
index 1a537eb4d442a87ab4e1cd8e2f81836c0a5eadb1..f633d55f9fd8a68742ab3902be2fc1620f07aff6 100644 (file)
@@ -313,6 +313,16 @@ class pluglist
 
       $disabledPlugins = $this->config->configRegistry->getDisabledPlugins();
 
+      // Now load the icon menu and try to register the plugins in the pluglist
+      //  if this fails for some reason, then remove the plugins from the menu.
+      if(isset($this->config->data['SHORTCUTMENU'])){
+        foreach($this->config->data['SHORTCUTMENU'] as $id => $plugin){
+          if(!$this->registerPlugin($plugin)){
+            unset($this->config->data['SHORTCUTMENU'][$id]); 
+          } 
+        }
+      }
+
       // Now load the path menu and try to register the plugins in the pluglist
       //  if this fails for some reason, then remove the plugin from the menu.
       if(isset($this->config->data['PATHMENU'])){
@@ -324,15 +334,28 @@ class pluglist
       }
 
       $this->pathMenu = 
-        "\n        <div class='plugin-path'>".
-        "\n          <ul class='path-navigation'>".
-        "\n            <li class='left right-border' onClick=\"openPlugin('');\" title='"._("Dash board")."'>".
-        "\n              ".image(get_template_path("images/dashBoard.png")).
-        "\n            </li>".
-        "\n            <li class='left' onClick=\"openPlugin('');\" title='"._("Back to main menu")."'>".
-        "\n              ".image(get_template_path("images/home.png")).
-        "\n            </li>".
-        "\n            %navigator%";
+          "\n        <div class='plugin-path'>".
+          "\n          <ul class='path-navigation'>";
+
+      // Check if we've at least one entry defined ih the iconmenu
+      if(isset($this->config->data['SHORTCUTMENU'])){
+          $icfg= &$this->config->data['SHORTCUTMENU'];
+          $rcfg = array_reverse($icfg);
+          foreach($rcfg as $id => $plug){
+              list($index, $title, $desc, $icon, $shortIcon) = $this->getPlugData($plug['CLASS']);
+
+              // The Plugin has been deactivated for some reason, perhabs a missing ldap schema.
+              if(isset($disabledPlugins[$plug['CLASS']])) continue;
+
+              $cssClass= (!isset($rcfg[$id+1]))? 'left' : 'left right-border';
+              $this->pathMenu.= "            
+                  <li class='{$cssClass}' onClick='openPlugin({$index})' title='{$title}'>".
+                  image(get_template_path($shortIcon))."</li>";
+          }
+      }
+
+      // Place the navigator part, this will be replaced during runtime.
+      $this->pathMenu .= "\n            %navigator%";
 
       // Check if we've at least one entry defined ih the pathmenu
       if(isset($this->config->data['PATHMENU'])){
@@ -367,6 +390,8 @@ class pluglist
     $plHeadline= _($vars['plHeadline']);
     $plDescription= _($vars['plDescription']);
     $plIcon = (isset($vars['plIcon'])) ? $vars['plIcon']: "plugin.png";
+    $plShortIcon = (isset($vars['plShortIcon'])) ? $vars['plShortIcon']: "plugin.png";
+
     $index= $this->get_index($class);
 
     /* Check if class is available. If the class doesn't exists display error symbol
@@ -385,7 +410,14 @@ class pluglist
     }else{
       $image = $plIcon; 
     }
-    return(array($index, $plHeadline, $plDescription, $image));
+    // Detect the correct position of the plugin icon
+    if(!preg_match("/\//",$plShortIcon)){
+      $shortImage= get_template_path("plugins/".preg_replace('%^.*/([^/]+)/[^/]+$%', '\1', 
+            $class_mapping[$class])."/images/$plShortIcon");
+    }else{
+      $shortImage = $plShortIcon; 
+    }
+    return(array($index, $plHeadline, $plDescription, $image, $shortImage));
   }