Code

Removed dependency on 'PATH'
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 18 Apr 2008 15:42:27 +0000 (15:42 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 18 Apr 2008 15:42:27 +0000 (15:42 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10570 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/contrib/gosa.conf
gosa-core/include/class_pluglist.inc

index 27907d6575e0b42cd92612107adcc6c2a9ac826c..1a202fbd4a3ee261b9033d5808a2db160486a6da 100644 (file)
        <config_version>{$get_gosa_version}</config_version>
        <menu>
                <section name="My account">
-                       <plugin acl="users/generic" class="user" path="plugins/personal/generic" />
-                       <plugin acl="users/posixAccount" class="posixAccount" icon="posix.png"
-                               path="plugins/personal/posix" />
+                       <plugin acl="users/generic" class="user" />
+                       <plugin acl="users/posixAccount" class="posixAccount" icon="posix.png" />
                        <plugin acl="users/environment" class="environment" icon="env.png"
 {if $cv.optional.kioskpath_active}
                                kioskpath="{$cv.optional.kioskpath}"
 {/if}
-                               path="plugins/personal/environment" />
-                       <plugin acl="users/mailAccount" class="mailAccount" icon="email.png"
-                               path="plugins/personal/mail" />
-                       <plugin acl="users/sambaAccount" class="sambaAccount" icon="samba.png"
-                               path="plugins/personal/samba" />
+                                />
+                       <plugin acl="users/mailAccount" class="mailAccount" icon="email.png" />
+                       <plugin acl="users/sambaAccount" class="sambaAccount" icon="samba.png" />
 {if $cv.use_netatalk}
-                       <plugin acl="users/netatalk" class="netatalk" icon="netatalk.png"
-                               path="plugins/personal/netatalk" />
+                       <plugin acl="users/netatalk" class="netatalk" icon="netatalk.png" />
 {else}
 <!--
-                       <plugin acl="default" class="netatalk" icon="netatalk.png"
-                               path="plugins/personal/netatalk" />
+                       <plugin acl="default" class="netatalk" icon="netatalk.png" />
 -->
 {/if}
-                       <plugin acl="users/connectivity" class="connectivity" icon="proxy.png"
-                               path="plugins/personal/connectivity" />
-                       <plugin acl="users/gofaxAccount" class="gofaxAccount" icon="fax.png"
-                               path="plugins/gofax/faxaccount" />
-                       <plugin acl="users/phoneAccount" class="phoneAccount" icon="phone.png"
-                               path="plugins/gofon/phoneaccount" />
+                       <plugin acl="users/connectivity" class="connectivity" icon="proxy.png" />
+                       <plugin acl="users/gofaxAccount" class="gofaxAccount" icon="fax.png" />
+                       <plugin acl="users/phoneAccount" class="phoneAccount" icon="phone.png" />
 <!--
-                       <plugin acl="users/nagiosAccount" class="nagiosAccount" icon="monitoring.png"
-                               path="plugins/personal/nagios" />
+                       <plugin acl="users/nagiosAccount" class="nagiosAccount" icon="monitoring.png" />
 -->
-                       <plugin acl="users/password" class="password" icon="password.png"
-                               path="plugins/personal/password" />
+                       <plugin acl="users/password" class="password" icon="password.png" />
                </section>
                
                <section name="Administration">
-                       <plugin acl="department" class="departmentManagement" path="plugins/admin/departments" />
-                       <plugin acl="users" class="userManagement" icon="user.png"
-                               path="plugins/admin/users" />
-                       <plugin acl="groups" class="groupManagement" path="plugins/admin/groups" />
-                       <plugin acl="sudo" class="sudoManagement" icon="sudo.png"
-                               path="plugins/admin/sudo" />
-                       <plugin acl="ogroups" class="ogroupManagement" icon="ogroup.png"
-                               path="plugins/admin/ogroups" />
-                       <plugin acl="application" class="applicationManagement"
-                               icon="application.png" path="plugins/admin/applications" />
+                       <plugin acl="department" class="departmentManagement"  />
+                       <plugin acl="users" class="userManagement" icon="user.png" />
+                       <plugin acl="groups" class="groupManagement" />
+                       <plugin acl="sudo" class="sudoManagement" icon="sudo.png" />
+                       <plugin acl="ogroups" class="ogroupManagement" icon="ogroup.png" />
+                       <plugin acl="application" class="applicationManagement" icon="application.png" />
 {if $cv.enableMimeType}
-                       <plugin acl="mimetypes" class="mimetypeManagement"
-                               icon="mimetypes.png" path="plugins/admin/mimetypes" />
+                       <plugin acl="mimetypes" class="mimetypeManagement" icon="mimetypes.png" />
 {else}
 <!--
-                       <plugin acl="mimetype" class="mimetypeManagement"
-                               icon="mimetypes.png" path="plugins/admin/mimetypes" />
+                       <plugin acl="mimetype" class="mimetypeManagement" icon="mimetypes.png" />
 -->
 {/if}
                        <plugin acl="devices" class="deviceManagement"
-                               icon="devices.png" path="plugins/admin/devices" />
-                       <plugin acl="terminal,workstation,server,phone,printer,component,winworkstation" class="systems" icon="system.png"
-                               path="plugins/admin/systems" />
+                               icon="devices.png" />
+                       <plugin acl="terminal,workstation,server,phone,printer,component,winworkstation" class="systems" icon="system.png" />
                        <!-- Use 'lock_dn'      for dn
                                'lock_name'    for name
                                'lock_type'    for branch/freeze -->
 {if $cv.enableFAI_management}
-                       <plugin acl="fai" class="faiManagement" icon="fai.png" 
-                               path="plugins/admin/fai" />
+                       <plugin acl="fai" class="faiManagement" icon="fai.png" />
 {else}
 <!--
-                       <plugin acl="FAIclass" class="faiManagement" icon="fai.png" 
-                               path="plugins/admin/fai" />
+                       <plugin acl="FAIclass" class="faiManagement" icon="fai.png" />
 -->
 {/if}
-                       <plugin acl="gofaxlist" class="blocklist" icon="blocklists.png"
-                               path="plugins/gofax/blocklists" />
-                       <plugin acl="gofonmacro" class="goFonMacro" icon="macros.png"
-                               path="plugins/gofon/macro" />
-                       <plugin acl="gofonconference" class="phoneConferenceManagment" icon="conference.png"
-                               path="plugins/gofon/conference" />
-                       <plugin acl="acl" class="acl" path="plugins/admin/acl" />
-                       <plugin acl="sudo" class="sudoManagement" icon="sudo.png"
-                               path="plugins/admin/sudo" />
+                       <plugin acl="gofaxlist" class="blocklist" icon="blocklists.png" />
+                       <plugin acl="gofonmacro" class="goFonMacro" icon="macros.png" />
+                       <plugin acl="gofonconference" class="phoneConferenceManagment" icon="conference.png" />
+                       <plugin acl="acl" class="aclManagement" />
+                       <plugin acl="sudo" class="sudoManagement" icon="sudo.png" />
                </section>
 
                <section name="Addons">
-                       <plugin acl="addressbook" class="addressbook" icon="addressbook.png"
-                               path="plugins/addons/addressbook" />
-                       <plugin acl="mailqueue" class="mailqueue" icon="mailqueue.png"
-                               path="plugins/addons/mailqueue" />
-                       <plugin acl="faxreport" class="faxreport" icon="reports.png"
-                               path="plugins/gofax/faxreports" />
-                       <plugin acl="fonreport" class="fonreport" icon="phonereport.png"
-                               path="plugins/gofon/fonreports" />
-                       <plugin acl="logview" class="logview" icon="logview.png"
-                               path="plugins/addons/logview" />
-                       <plugin acl="gotomasses" class="gotomasses" icon="queue.png"
-                               path="plugins/addons/goto" />
-                       <plugin acl="ldapmanager" class="ldif" icon="ldif.png"
-                               path="plugins/addons/ldapmanager" />
+                       <plugin acl="addressbook" class="addressbook" icon="addressbook.png" />
+                       <plugin acl="mailqueue" class="mailqueue" icon="mailqueue.png" />
+                       <plugin acl="faxreport" class="faxreport" icon="reports.png" />
+                       <plugin acl="fonreport" class="fonreport" icon="phonereport.png" />
+                       <plugin acl="logview" class="logview" icon="logview.png" />
+                       <plugin acl="gotomasses" class="gotomasses" icon="queue.png" />
+                       <plugin acl="ldapmanager" class="ldif" icon="ldif.png" />
                </section>
        </menu>
 
index 9725b4b1486cbf06e5be7ae68b3eae9ea2f0e8aa..b4a35ba4af39b111824b16021887f916e30ff43a 100644 (file)
@@ -38,7 +38,7 @@ class pluglist {
                $this->config= &$config;
 
                /* Create dirlist for all plugins */
-               $this->dirlist= $this->get_plugins ($this->dirlist, $this->config->data);
+               $this->dirlist= $this->get_plugins ($this->dirlist, $this->config->data['MENU']);
 
                 /* Fill info part of pluglist */
                 $classes= get_declared_classes();
@@ -59,25 +59,27 @@ class pluglist {
 
        function get_plugins($list, &$config)
        {
+                global $class_mapping;
+
                /* Error reporting, because I'm getting strange messages in PHP 4.2.x */
-               if (!isset($config['PATH']) && !isset($config['CLASS'])){
+               if (!isset($config['CLASS'])){
                        if (is_array($config)){
                                foreach ($config as $val){
                                        $list= $this->get_plugins($list, $val);
                                }
                        }
                } else {
-                       if (isset ($config['PATH']) && is_array($config)){
-                               $list[$this->index++]= $config['PATH'];
-                               if (isset($config['CLASS'])){
-                                       $class= $config['CLASS'];
-                               }
+                        if (is_array($config) && isset($class_mapping[$config['CLASS']])){
+                               $list[$this->index++]= dirname($class_mapping[$config['CLASS']]);
+                       } else {
+                               $list[$this->index++]= "";
                        }
                }
 
                return ($list);
        }
 
+
        function check_access($aclname)
        {
                $acls_to_check = array();
@@ -158,7 +160,7 @@ class pluglist {
                                        $plHeadline= $vars['plHeadline'];
                                        $plDescription= $vars['plDescription'];
 
-                                       $index= $this->get_index($info['PATH'],$info['CLASS']);
+                                       $index= $this->get_index($info['CLASS']);
                                        $href= "main.php?plug=$index&amp;reset=1";
 
                                        if(!$vars){
@@ -232,6 +234,8 @@ class pluglist {
 
        function show_iconmenu()
        {
+               global $class_mapping;
+
                if ($this->iconmenu == ""){
                        $cfg= $this->config->data['MENU'];
 
@@ -261,7 +265,7 @@ class pluglist {
                                        $plHeadline= $vars['plHeadline'];
                                        $plDescription= $vars['plDescription'];
 
-                                       $index= $this->get_index($info['PATH'],$info['CLASS']);
+                                       $index= $this->get_index($info['CLASS']);
 
                                        $href = "main.php?plug=".$index."&amp;reset=1";
 
@@ -280,7 +284,7 @@ class pluglist {
                                                if (isset($info['ICON'])){
                                                        $image= get_template_path('images/'.$info['ICON']);
                                                } else {
-                                                       $image= get_template_path("plugins/".preg_replace("/^.*\//", "", $info['PATH'])."/images/plugin.png");
+                                                       $image= get_template_path("plugins/".preg_replace('%^.*/([^/]+)/[^/]+$%', '\1', $class_mapping[$info['CLASS']])."/images/plugin.png");
                                                }
                                                if ($col > 5){
                                                        $entries= $entries."</tr><tr>";
@@ -337,20 +341,20 @@ class pluglist {
                return ("../".$this->dirlist[$index]);
        }
 
-       function get_index($path,$class)
+       function get_index($class)
        {
                /* Search for plugin index (id), identify entry by path && class */
                 $data = $this->config->data['MENU'];
                 foreach($data as $section => $plugins){
                         foreach($plugins as $key => $plugin)    {
-                                if($plugin['CLASS'] == $class && $plugin['PATH'] == $path){
+                                if($plugin['CLASS'] == $class){
                                         return($key);
                                 }
                         }
                 }
 
-               /* Indentify by path*/
-                return (array_search($path, $this->dirlist));
+               /* Nothing */
+                return (0);
 
        }
 }