From 2763954e8990ea4f5d3a1b885c5988d485cf7131 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 26 Feb 2010 15:07:56 +0000 Subject: [PATCH] Updated class_pluglist. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15760 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_config.inc | 7 ++ gosa-core/include/class_pluglist.inc | 97 +++++++++++++++++----------- 2 files changed, 66 insertions(+), 38 deletions(-) diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index dd922df96..64995adac 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -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; } diff --git a/gosa-core/include/class_pluglist.inc b/gosa-core/include/class_pluglist.inc index 2e1661259..433bb753c 100644 --- a/gosa-core/include/class_pluglist.inc +++ b/gosa-core/include/class_pluglist.inc @@ -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&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
  • ".$plHeadline."
  • "; + $menu .= "\n
  • ".$title."
  • "; } $menu.= "\n "; $menu.= "\n
    \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
    "; - $this->iconmenu.= "\n
    "; - $this->iconmenu.= "\n

    {$plHeadline}

    "; - $this->iconmenu.= "\n

    {$plDescription}

    "; + $this->iconmenu.= "\n
    "; + $this->iconmenu.= "\n

    {$title}

    "; + $this->iconmenu.= "\n

    {$desc}

    "; $this->iconmenu.= "\n
    "; $this->iconmenu.= "\n
    \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("
    +
      +
    • + +
    • +
    • Welcome to GOsa
    • +
    • Help
    • +
    • Change password
    • +
    • My account
    • +
    +
    +"); + + } + + + 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' */ -- 2.30.2