diff --git a/contrib/fusiondirectory.conf b/contrib/fusiondirectory.conf index 93a4da293bdcd8d19207a53d55bb3f0161d62b90..6e6238fde33fd4b668505d493a2e49c3478a78c7 100644 --- a/contrib/fusiondirectory.conf +++ b/contrib/fusiondirectory.conf @@ -1,51 +1,6 @@ {literal}<?xml version="1.0"?>{/literal} <conf configVersion="{$config_checksum}" > - <!-- FusionDirectory menu definition ************************************************** - This tag defines the side and icon menu inside the - interface. Defining an entry here is no guarantie to get it shown, - though. Only entries with matching ACL's get shown. - - There are two types of entries inside of the menu: section and plugin - - Defining a section: - - Open a <section> tag including a "name" attribute. This will show up in - the menu as a new section later on. Own entries are not handled via I18N - by default. Close the </section> tag after your plugin definitions. - - Defining a plugin: - - Open a <plugin> tag including a "class" attribute. The "class" should be - present inside your FusionDirectory setup - the entry will be ignored if it is not. - - Plugins should have an "acl" entry, that allows FusionDirectory to decide wether - a user is allowed to see a plugin or not. The "acl" string matches with - an ACL definition done inside of FusionDirectory -> ACLs. - - You can override an icon by specifying the "icon" attribute. - - For more information about possible configuration parameters, please take - a look at the FusionDirectory.conf(5) manual page. - --> - <menu> - <!-- Section to enable administrative services --> - <section name="Administration"> - <plugin acl="terminal/termgeneric,workstation/workstationGeneric,server/serverGeneric,phone/phoneGeneric,printer/printgeneric,component/componentGeneric,winworkstation/wingeneric" class="systemManagement" /> - <!-- Use 'lockDn' for dn - 'lockName' for name - 'lockType' for branch/freeze --> - <plugin acl="fai/faiScript,fai/faiHook,fai/faiTemplate,fai/faiVariable,fai/faiPartitionTable,fai/faiPackage,fai/faiProfile,fai/faiManagement" class="faiManagement" /> - </section> - - <!-- Section to enable addon plugins --> - <section name="Addons"> - <!-- <plugin acl="mailqueue" class="mailqueue" /> --> - <plugin acl="faxreport/faxreport:self,faxreport" class="faxreport" /> - <plugin acl="fonreport/fonreport:self,fonreport" class="fonreport" /> - </section> - </menu> - <!-- Tab definitions ******************************************************* Tab definitions define the sub plugins which get included for certain tabbed dialogs. If you change something here, never (!) remove the diff --git a/include/class_config.inc b/include/class_config.inc index 92050651a27328219e2911e7a7be1ed43a5bf894..3bc99181f07fd7086ec4cfabb70b1f6b52edf2db 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -57,7 +57,7 @@ class config { */ var $data= array( 'TABS' => array(), 'LOCATIONS' => array(), 'SERVERS' => array(), 'MAIN' => array(), - 'MENU' => array(), 'SERVICE' => array()); + 'MENU' => array()); var $basedir= ""; var $config_version ="NOT SET"; @@ -157,8 +157,7 @@ class config { "TABS" => array(), "LOCATIONS" => array(), "MAIN" => array(), - "MENU" => array(), - "SERVICE" => array()); + "MENU" => array()); $this->last_modified = filemtime($filename); $this->filename = $filename; @@ -218,14 +217,14 @@ class config { } /* Look through attributes */ - switch ($this->tags[$this->level-1]){ + switch ($this->tags[$this->level-1]) { /* Handle tab section */ case 'TAB': $name= $this->tags[$this->level-2]; /* Create new array? */ - if (!isset($this->data['TABS'][$name])){ + if (!isset($this->data['TABS'][$name])) { $this->data['TABS'][$name]= array(); } @@ -235,7 +234,7 @@ class config { /* Handle location */ case 'LOCATION': - if ($this->tags[$this->level-2] == 'MAIN'){ + if ($this->tags[$this->level-2] == 'MAIN') { $name= $attrs['NAME']; $name = preg_replace("/[<>\"']/","",$name); $attrs['NAME'] = $name; @@ -248,43 +247,18 @@ class config { /* Handle referral tags */ case 'REFERRAL': - if ($this->tags[$this->level-2] == 'LOCATION'){ + if ($this->tags[$this->level-2] == 'LOCATION') { $url= $attrs['URI']; $server= preg_replace('!^([^:]+://[^/]+)/.*$!', '\\1', $url); /* Add location elements */ - if (!isset($this->data['LOCATIONS'][$this->currentLocation]['REFERRAL'])){ + if (!isset($this->data['LOCATIONS'][$this->currentLocation]['REFERRAL'])) { $this->data['LOCATIONS'][$this->currentLocation]['REFERRAL']= array(); } $this->data['LOCATIONS'][$this->currentLocation]['REFERRAL'][$server]= $attrs; } break; - - /* Load main parameters */ - case 'MAIN': - $this->data['MAIN']= array_merge ($this->data['MAIN'], $attrs); - break; - - /* Load menu */ - case 'SECTION': - if ($this->tags[$this->level-2] == 'MENU'){ - $this->section= $attrs['NAME']; - $this->data['MENU'][$this->section]= array(); ; - } - break; - - /* Inser plugins */ - case 'PLUGIN': - if ($this->tags[$this->level-3] == 'MENU' && - $this->tags[$this->level-2] == 'SECTION'){ - - $this->data['MENU'][$this->section][$this->gpc++]= $attrs; - } - if ($this->tags[$this->level-2] == 'SERVICEMENU'){ - $this->data['SERVICE'][$attrs['CLASS']]= $attrs; - } - break; } } @@ -1304,7 +1278,11 @@ class config { if (is_array($section)) { $section = key($section); - $this->data['SECTIONS'][$section] = $plInfo['plSection'][$section]; + if (is_numeric($section)) { + trigger_error("$class have wrong setting in plInfo/plSection"); + continue; + } + $this->data['SECTIONS'][$section] = array_change_key_case($plInfo['plSection'][$section], CASE_UPPER); } if (!isset($this->data['MENU'][$section])) { $this->data['MENU'][$section] = array(); @@ -1316,7 +1294,7 @@ class config { $this->data['MENU'][$section][] = $attrs; } } - $this->data['SECTIONS']["personal"] = array('name' => _('My account'), 'priority' => 20); + $this->data['SECTIONS']["personal"] = array('NAME' => _('My account'), 'PRIORITY' => 20); $personal = array(); foreach ($this->data['TABS']['USERTABS'] as $tab) { $personal[] = array('CLASS' => $tab['CLASS'], 'ACL' => 'users/'.$tab['CLASS'].':self'); @@ -1329,10 +1307,10 @@ class config { uasort($this->data['SECTIONS'], function ($a, $b) { - if ($a['priority'] == $b['priority']) { + if ($a['PRIORITY'] == $b['PRIORITY']) { return 0; } - return (($a['priority'] < $b['priority']) ? -1 : 1); + return (($a['PRIORITY'] < $b['PRIORITY']) ? -1 : 1); } ); } diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc index 20cb0913fc4c3fb4e75ce11a241f37f24a1677a2..2800990247667ce4029dde1b3db491f987855792 100644 --- a/include/class_pluglist.inc +++ b/include/class_pluglist.inc @@ -35,7 +35,6 @@ class pluglist { var $index = 0; var $menu = ""; var $iconmenu = ""; - var $menuparts = array(); var $config = NULL; var $dirlist = array(); var $ui = NULL; @@ -248,19 +247,18 @@ class pluglist { $cfg = $this->config->data['MENU']; /* Parse headlines */ - foreach ($cfg as $headline => $plug) { + foreach ($this->config->data['SECTIONS'] as $section => $section_infos) { if ($first) { $style = ""; $first = FALSE; } else { $style = "style='border-top:1px solid #AAA; margin-top:0.8em;'"; } - $menu = "<p class=\"menuheader\" $style>"._($headline)."</p>\n"; + $menu = "<p class=\"menuheader\" $style>".$section_infos['NAME']."</p>\n"; $entries = ""; - $this->menuparts[_($headline)] = array(); /* Parse sub-plugins */ - foreach ($plug as $info) { + foreach ($this->config->data['MENU'][$section] as $info) { /* Read information from class variable */ if (!isset($info['CLASS'])) { @@ -322,38 +320,6 @@ class pluglist { return $this->menu; } - function gen_current() - { - /* Do we have a current value? */ - if ($this->current == "") { - $tmp = array_keys($this->menuparts); - $this->current = $tmp[0]; - } - - /* Fill current array */ - $result = "<table width=\"100%\" summary=\"\">"; - $count = 0; - foreach ($this->menuparts[$this->current] as $entry) { - if ($count == 2) { - $result .= "</tr>"; - $count = 0; - } - if ($count == 0) { - $result .= "<tr>"; - } - $result .= "<td>$entry</td>"; - $count++; - } - - /* Add missing cell? */ - if ($count == 1) { - $result .= "<td> </td>"; - } - - $result .= "</table>"; - return $result; - } - /*! * \brief Show the menu icon */ @@ -371,14 +337,14 @@ class pluglist { } /* Parse headlines */ - foreach ($cfg as $headline => $plug) { + foreach ($this->config->data['SECTIONS'] as $section => $section_infos) { $col = 1; $menu = "<h1 class=\"menuheader\">". - _($headline)."</h1>\n<table summary=\"\" style=\"width:100%;". + $section_infos['NAME']."</h1>\n<table summary=\"\" style=\"width:100%;". "font-size: 14px;\" cellpadding=7 border=0>\n<tr>\n"; $entries = ""; - foreach ($plug as $info) { + foreach ($this->config->data['MENU'][$section] as $info) { if (!plugin_available($info['CLASS'])) { continue; diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index e32d70457a8ba0416bc95b8c42ea3c08608e4f89..885abcac4284179cb671ea2dad8b65469b8424b6 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -38,6 +38,7 @@ class departmentManagement extends management "plIcon" => "plugins/departments/images/plugin.png", "plSection" => array("admin" => array("name" => _("Administration"), "priority" => 0)), "plCategory" => array("department"), + "plPriority" => 0, "plProvidedAcls" => array() ); diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 56c8ef00ced3ebf3a09481c793ac39a921a14298..c38b55014517dfea24f9fc4204cdc5f77880cc0d 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -38,6 +38,7 @@ class groupManagement extends management "plIcon" => "plugins/groups/images/plugin.png", "plSection" => "admin", "plCategory" => array("groups"), + "plPriority" => 2, "plProvidedAcls" => array() ); diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc index 67217e14251f2a9e09d50c5bba4bb92ceed54f4d..f88dc493cb51640e9f33aaf4397130a74402da6a 100644 --- a/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/plugins/admin/ogroups/class_ogroupManagement.inc @@ -38,6 +38,7 @@ class ogroupManagement extends management "plIcon" => "plugins/ogroups/images/plugin.png", "plSection" => "admin", "plCategory" => array("ogroups"), + "plPriority" => 4, "plProvidedAcls" => array() ); diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index fa4ca5f4927412095e2a7ce6d7661bd61ac9afbc..8c991313da49a88b69b84542a659376113425c43 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -54,6 +54,7 @@ class userManagement extends management "plIcon" => "plugins/users/images/user.png", "plSection" => "admin", "plCategory" => array("users"), + "plPriority" => 1, "plProvidedAcls" => array() );