Simplify return from the perms() application call.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 8 Sep 2010 23:07:48 +0000 (17:07 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 13 Sep 2010 06:27:22 +0000 (00:27 -0600)
23 files changed:
agora/lib/Application.php
ansel/lib/Application.php
babel/lib/Application.php
beatnik/lib/Application.php
chora/lib/Application.php
framework/Perms/lib/Horde/Perms.php
gollem/lib/Application.php
hermes/lib/Application.php
horde/lib/Application.php
imp/lib/Application.php
ingo/lib/Application.php
jonah/lib/Application.php
kronolith/lib/Application.php
mnemo/lib/Application.php
nag/lib/Application.php
news/lib/Application.php
operator/lib/Application.php
shout/lib/Application.php
trean/lib/Application.php
turba/lib/Application.php
vilma/lib/Application.php
whups/lib/Application.php
wicked/lib/Application.php

index f5b4747..60dc091 100644 (file)
@@ -50,27 +50,31 @@ class Agora_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        self::$_perms['tree']['agora']['admin'] = true;
-        self::$_perms['title']['agora:admin'] = _("Admin");
-        self::$_perms['title']['agora:forums'] = _("Forums");
-
+        $perms = array(
+            'admin' => array(
+                'title' => _("Admin")
+            ),
+            'forums' => array(
+                'title' => _("Forums")
+            )
+        );
         foreach ($GLOBALS['registry']->listApps() as $scope) {
-            self::$_perms['title']['agora:forums:' . $scope] = $GLOBALS['registry']->get('name', $scope);
-            self::$_perms['tree']['agora']['forums'][$scope] = false;
+            $perms['forums:' . $scope] = array(
+                'title' => $GLOBALS['registry']->get('name', $scope)
+            );
 
             $forums = Agora_Messages::singleton($scope);
             $forums_list = $forums->getBareForums();
-            if (($forums_list instanceof PEAR_Error) || empty($forums_list)) {
-                continue;
-            }
-
-            foreach ($forums_list as $id => $title) {
-                self::$_perms['tree']['agora']['forums'][$scope][$id] = false;
-                self::$_perms['title']['agora:forums:' . $scope . ':' . $id] = $title;
+            if (!($forums_list instanceof PEAR_Error)) {
+                foreach ($forums_list as $id => $title) {
+                    $perms['forums:' . $scope . ':' . $id] = array(
+                        'title' => $title
+                    );
+                }
             }
         }
 
-        return self::$_perms;
+        return $perms;
     }
 
     /**
index c5baf8d..5d33b2b 100644 (file)
@@ -91,11 +91,11 @@ class Ansel_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms = array();
-        $perms['tree']['ansel']['admin'] = false;
-        $perms['title']['ansel:admin'] = _("Administrators");
-
-        return $perms;
+        return array(
+            'admin' => array(
+                'title' => _("Administrators")
+            )
+        );
     }
 
     /**
index fe02895..9b42895 100644 (file)
@@ -20,51 +20,54 @@ class Babel_Application extends Horde_Registry_Application
     {
         global $registry;
 
-        $perms['tree']['babel']['language'] = array();
-        $perms['title']['babel:language'] = _("Languages");
-        $perms['type']['babel:language']  = 'none';
+        $perms = array(
+            'language' => array(
+                'title' => _("Languages"),
+                'type' => 'none'
+            ),
+            'module' => array(
+                'title' => _("Modules"),
+                'type' => 'none'
+            )
+        );
 
         foreach($registry->nlsconfig['languages'] as $langcode => $langdesc) {
-               $perms['tree']['babel']['language'][$langcode] = false;
-               $perms['title']['babel:language:' . $langcode] = sprintf("%s (%s)", $langdesc, $langcode);
-               $perms['type']['babel:language:' . $langcode] = 'boolean';
+            $perms['language:' . $langcode] = array(
+                   'title' => sprintf("%s (%s)", $langdesc, $langcode),
+                'type' => 'boolean'
+            );
         }
 
-        $perms['tree']['babel']['module'] = array();
-        $perms['title']['babel:module'] = _("Modules");
-        $perms['type']['babel:module']  = 'none';
 
         foreach ($registry->applications as $app => $params) {
-               if ($params['status'] == 'heading' || $params['status'] == 'block') {
+               if (in_array($params['status'], array('block', 'heading')) ||
+                   (isset($params['fileroot']) && !is_dir($params['fileroot'])) ||
+                   preg_match('/_[tools|reports]$/', $app)) {
                    continue;
                }
 
-               if (isset($params['fileroot']) && !is_dir($params['fileroot'])) {
-                   continue;
-               }
-
-               if (preg_match('/_reports$/', $app) || preg_match('/_tools$/', $app)) {
-                   continue;
-               }
-
-               $perms['tree']['babel']['module'][$app] = false;
-               $perms['title']['babel:module:' . $app] = sprintf("%s (%s)", $params['name'], $app);
-               $perms['type']['babel:module:' . $app] = 'boolean';
+            $perms['module:' . $app] = array(
+                'title' => sprintf("%s (%s)", $params['name'], $app),
+                'type' => 'boolean'
+            );
         }
 
-        $tabdesc['download']   = _("Download");
-        $tabdesc['upload']     = _("Upload");
-        $tabdesc['stats']      = _("Statistics");
-        $tabdesc['view']       = _("View/Edit");
-        $tabdesc['viewsource'] = _("View Source");
-        $tabdesc['extract']    = _("Extract");
-        $tabdesc['make']       = _("Make");
-        $tabdesc['commit']     = _("Commit");
-        $tabdesc['reset']      = _("Reset");
+        $tabdesc = array(
+            'download' => _("Download"),
+            'upload' => _("Upload"),
+            'stats' => _("Statistics"),
+            'view' => _("View/Edit"),
+            'viewsource' => _("View Source"),
+            'extract' => _("Extract"),
+            'make' => _("Make"),
+            'commit' => _("Commit"),
+            'reset' => _("Reset")
+        );
 
         foreach ($tabdesc as $cat => $desc) {
-               $perms['tree']['babel'][$cat] = array();
-               $perms['title']['babel:' . $cat] = $desc;
+            $perms[$cat] = array(
+                'title' => $desc
+            );
         }
 
         return $perms;
index 1b95cca..8f561e0 100644 (file)
@@ -85,12 +85,17 @@ class Beatnik_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms['title']['beatnik:domains'] = _("Domains");
+        $perms = array(
+            'domains' => array(
+                'title' => _("Domains")
+            ),
+        );
 
         // Run through every domain
         foreach ($beatnik->driver->getDomains() as $domain) {
-            $perms['tree']['beatnik']['domains'][$domain['zonename']] = false;
-            $perms['title']['beatnik:domains:' . $domain['zonename']] = $domain['zonename'];
+            $perms['domains:' . $domain['zonename']] = array(
+                'title' => $domain['zonename'];
+            );
         }
 
         return $perms;
index a1cafa2..1e7db1e 100644 (file)
@@ -169,14 +169,18 @@ class Chora_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms['tree']['chora']['sourceroots'] = false;
-        $perms['title']['chora:sourceroots'] = _("Repositories");
+        $perms = array(
+            'sourceroots' => array(
+                'title' => _("Repositories")
+            )
+        );
 
         // Run through every source repository
         require dirname(__FILE__) . '/../config/backends.php';
         foreach ($sourceroots as $sourceroot => $srconfig) {
-            $perms['tree']['chora']['sourceroots'][$sourceroot] = false;
-            $perms['title']['chora:sourceroots:' . $sourceroot] = $srconfig['name'];
+            $perms['sourceroots:' . $sourceroot] = array(
+                'title' => $srconfig['name']
+            );
         }
 
         return $perms;
index 8864473..d91592b 100644 (file)
@@ -234,10 +234,32 @@ class Horde_Perms
     {
         if (!isset($this->_appPerms[$app])) {
             try {
-                $this->_appPerms[$app] = $GLOBALS['registry']->callAppMethod($app, 'perms');
+                $perms = array(
+                    'title' => array(),
+                    'tree' => array(
+                        $app => array()
+                    ),
+                    'type' => array()
+                );
+
+                foreach ($GLOBALS['registry']->callAppMethod($app, 'perms') as $key => $val) {
+                    $ptr = &$perms['tree'][$app];
+                    foreach (explode(':', $key) as $kval) {
+                        $ptr[$kval] = false;
+                        $ptr = &$perms['tree'][$app];
+                    }
+                    if (isset($val['title'])) {
+                        $perms['title'][$app . ':' . $key] = $val['title'];
+                    }
+                    if (isset($val['type'])) {
+                        $perms['type'][$app . ':' . $key] = $val['type'];
+                    }
+                }
             } catch (Horde_Exception $e) {
-                $this->_appPerms[$app] = array();
+                $perms = array();
             }
+
+            $this->_appPerms[$app] = $perms;
         }
 
         return $this->_appPerms[$app];
index 0032bdb..ede0136 100644 (file)
@@ -74,21 +74,17 @@ class Gollem_Application extends Horde_Registry_Application
     public function perms()
     {
         $perms = array(
-            'tree' => array(
-                'gollem' => array(
-                    'backends' => false
-                )
-            ),
-            'title' => array(
-                'gollem:backends' => _("Backends")
+            'backends' => array(
+                'title' => _("Backends")
             )
         );
 
         // Run through every backend.
         require GOLLEM_BASE . '/config/backends.php';
         foreach ($backends as $key => $val) {
-            $perms['tree']['gollem']['backends'][$key] = false;
-            $perms['title']['gollem:backends:' . $key] = $val['name'];
+            $perms['backends:' . $key] = array(
+                'title' => $val['name']
+            );
         }
 
         return $perms;
index 9231303..7f06cfa 100644 (file)
@@ -67,15 +67,17 @@ class Hermes_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms = array();
-        $perms['tree']['hermes']['review'] = array();
-        $perms['title']['hermes:review'] = _("Time Review Screen");
-        $perms['tree']['hermes']['deliverables'] = array();
-        $perms['title']['hermes:deliverables'] = _("Deliverables");
-        $perms['tree']['hermes']['invoicing'] = array();
-        $perms['title']['hermes:invoicing'] = _("Invoicing");
-
-        return $perms;
+        return array(
+            'review' => array(
+                'title' => _("Time Review Screen")
+            ),
+            'deliverables' => array(
+                'title' => _("Deliverables")
+            ),
+            'invoicing' => array(
+                'title' => _("Invoicing");
+            )
+        );
     }
 
     /* Sidebar method. */
index 912bdd5..90ce967 100644 (file)
@@ -33,13 +33,12 @@ class Horde_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms = array();
-
-        $perms['tree']['horde']['max_blocks'] = false;
-        $perms['title']['horde:max_blocks'] = _("Maximum Number of Portal Blocks");
-        $perms['type']['horde:max_blocks'] = 'int';
-
-        return $perms;
+        return array(
+            'max_blocks' => array(
+                'title' => _("Maximum Number of Portal Blocks"),
+                'type' => 'int'
+            )
+        );
     }
 
     /**
index b8bf8a0..61480b5 100644 (file)
@@ -155,25 +155,21 @@ class IMP_Application extends Horde_Registry_Application
     public function perms()
     {
         return array(
-            'tree' => array(
-                'imp' => array(
-                     'create_folders' => false,
-                     'max_folders' => false,
-                     'max_recipients' => false,
-                     'max_timelimit' => false,
-                 ),
+            'create_folders' => array(
+                'title' => _("Allow Folder Creation?"),
+                'type' => 'boolean'
             ),
-            'title' => array(
-                'imp:create_folders' => _("Allow Folder Creation?"),
-                'imp:max_folders' => _("Maximum Number of Folders"),
-                'imp:max_recipients' => _("Maximum Number of Recipients per Message"),
-                'imp:max_timelimit' => _("Maximum Number of Recipients per Time Period"),
+            'max_folders' => array(
+                'title' => _("Maximum Number of Folders"),
+                'type' => 'int'
             ),
-            'type' => array(
-                'imp:create_folders' => 'boolean',
-                'imp:max_folders' => 'int',
-                'imp:max_recipients' => 'int',
-                'imp:max_timelimit' => 'int',
+            'max_recipients' => array(
+                'title' => _("Maximum Number of Recipients per Message"),
+                'type' => 'int'
+            ),
+            'max_timelimit' => array(
+                'title' => _("Maximum Number of Recipients per Time Period"),
+                'type' => 'int'
             )
         );
     }
index 89aa379..efccc27 100644 (file)
@@ -101,19 +101,13 @@ class Ingo_Application extends Horde_Registry_Application
     public function perms()
     {
         return array(
-            'title' => array(
-                'ingo:allow_rules' => _("Allow Rules"),
-                'ingo:max_rules' => _("Maximum Number of Rules")
+            'allow_rules' => array(
+                'title' => _("Allow Rules"),
+                'type' => 'boolean'
             ),
-            'tree' => array(
-                'ingo' => array(
-                    'allow_rules' => false,
-                    'max_rules' => false
-                )
-            ),
-            'type' => array(
-                'ingo:allow_rules' => 'boolean',
-                'ingo:max_rules' => 'int'
+            'max_rules' => array(
+                'title' => _("Maximum Number of Rules"),
+                'type' => 'int'
             )
         );
     }
index d810f3a..5a1b09c 100644 (file)
@@ -44,40 +44,40 @@ class Jonah_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $news = Jonah_News::factory();
-        $channels = $news->getChannels(Jonah::INTERNAL_CHANNEL);
-
-        /* Loop through internal channels and add their ids to the
-         * perms. */
-        $perms = array();
-        foreach ($channels as $channel) {
-            $perms['tree']['jonah']['news']['internal_channels'][$channel['channel_id']] = false;
-        }
-
-        /* Human names and default permissions. */
-        $perms['title']['jonah:admin'] = _("Administrator");
-        $perms['tree']['jonah']['admin'] = false;
-        $perms['title']['jonah:news'] = _("News");
-        $perms['tree']['jonah']['news'] = false;
-        $perms['title']['jonah:news:internal_channels'] = _("Internal Channels");
-        $perms['tree']['jonah']['news']['internal_channels'] = false;
-        $perms['title']['jonah:news:external_channels'] = _("External Channels");
-        $perms['tree']['jonah']['news']['external_channels'] = false;
+        $perms = array(
+            'admin' => array(
+                'title' => _("Administrator")
+            ),
+            'news' => array(
+                'title' => _("News")
+            ),
+            'news:internal_channels' => array(
+                'title' => _("Internal Channels")
+            ),
+            'news:external_channels' => array(
+                'title' => _("External Channels")
+            )
+        );
 
         /* Loop through internal channels and add them to the perms
          * titles. */
+        $news = Jonah_News::factory();
+        $channels = $news->getChannels(Jonah::INTERNAL_CHANNEL);
+
         foreach ($channels as $channel) {
-            $perms['title']['jonah:news:internal_channels:' . $channel['channel_id']] = $channel['channel_name'];
-            $perms['tree']['jonah']['news']['internal_channels'][$channel['channel_id']] = false;
+            $perms['news:internal_channels:' . $channel['channel_id']] = array(
+                'title' => $channel['channel_name']
+            );
         }
 
-        $channels = $news->getChannels(Jonah::EXTERNAL_CHANNEL);
-
         /* Loop through external channels and add their ids to the
          * perms. */
+        $channels = $news->getChannels(Jonah::EXTERNAL_CHANNEL);
+
         foreach ($channels as $channel) {
-            $perms['title']['jonah:news:external_channels:' . $channel['channel_id']] = $channel['channel_name'];
-            $perms['tree']['jonah']['news']['external_channels'][$channel['channel_id']] = false;
+            $perms['news:external_channels:' . $channel['channel_id']] = array(
+                'title' => $channel['channel_name']
+            );
         }
 
         return $perms;
index 539542f..869d8b6 100644 (file)
@@ -80,12 +80,12 @@ class Kronolith_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms = array();
-        $perms['tree']['kronolith']['max_events'] = false;
-        $perms['title']['kronolith:max_events'] = _("Maximum Number of Events");
-        $perms['type']['kronolith:max_events'] = 'int';
-
-        return $perms;
+        return array(
+            'max_events' => array(
+                'title' => _("Maximum Number of Events"),
+                'type' => 'int'
+            )
+        );
     }
 
     /**
index 37f400c..d8e9391 100644 (file)
@@ -59,12 +59,12 @@ class Mnemo_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms = array();
-        $perms['tree']['mnemo']['max_notes'] = false;
-        $perms['title']['mnemo:max_notes'] = _("Maximum Number of Notes");
-        $perms['type']['mnemo:max_notes'] = 'int';
-
-        return $perms;
+        return array(
+            'max_notes' => array(
+                'title' => _("Maximum Number of Notes"),
+                'type' => 'int'
+            )
+        );
     }
 
     /**
index 5e23d4c..af4f254 100644 (file)
@@ -63,12 +63,12 @@ class Nag_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms = array();
-        $perms['tree']['nag']['max_tasks'] = false;
-        $perms['title']['nag:max_tasks'] = _("Maximum Number of Tasks");
-        $perms['type']['nag:max_tasks'] = 'int';
-
-        return $perms;
+        return array(
+            'max_tasks' => array(
+                'title' => _("Maximum Number of Tasks"),
+                'type' => 'int'
+            )
+        );
     }
 
     /**
index b0e6e43..82aa02f 100644 (file)
@@ -21,19 +21,25 @@ class News_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms['tree']['news']['admin'] = true;
-        $perms['title']['news:admin'] = _("Admin");
-
-        $perms['tree']['news']['editors'] = true;
-        $perms['title']['news:editors'] = _("Editors");
+        $perms = array(
+            'admin' => array(
+                'title' => _("Admin")
+            ),
+            'categories' => array(
+                'title' => _("Categories")
+            ),
+            'editors' => array(
+                'title' => _("Editors")
+            )
+        );
 
         require_once dirname(__FILE__) . '/base.php';
         $tree = $GLOBALS['news_cat']->getEnum();
 
-        $perms['title']['news:categories'] = _("Categories");
         foreach ($tree as $cat_id => $cat_name) {
-            $perms['tree']['news']['categories'][$cat_id] = false;
-            $perms['title']['news:categories:' . $cat_id] = $cat_name;
+            $perms['categories:' . $cat_id] = array(
+                'title' => $cat_name
+            );
         }
 
         return $perms;
index 49c7150..cbc7a7c 100644 (file)
@@ -67,13 +67,17 @@ class Operator_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms['tree']['operator']['accountcodes'] = false;
-        $perms['title']['operator:accountcodes'] = _("Account Codes");
+        $perms = array(
+            'accountcodes' => array(
+                'title' => _("Account Codes")
+            )
+        );
 
         $accountcodes = Operator::getAccountCodes();
         foreach ($accountcodes as $accountcode) {
-            $perms['tree']['operator']['accountcodes'][$accountcode] = false;
-            $perms['title']['operator:accountcodes:' . $accountcode] = $accountcode;
+            $perms['accountcodes:' . $accountcode] = array(
+                'title' => $accountcode
+            );
         }
 
         return $perms;
index 28f2c44..936ed74 100644 (file)
@@ -119,18 +119,22 @@ class Shout_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms['tree']['shout']['superadmin'] = false;
-        $perms['title']['shout:superadmin'] = _("Super Administrator");
+        $perms = array(
+            'accounts' => array(
+                'title' => _("Accounts")
+            ),
+            'superadmin' => array(
+                'title' => _("Super Administrator")
+            )
+        );
 
         $accounts = $this->storage->getAccounts();
 
-        $perms['tree']['shout']['accounts'] = false;
-        $perms['title']['shout:accounts'] = _("Accounts");
-
         // Run through every contact source.
         foreach ($accounts as $code => $info) {
-            $perms['tree']['shout']['accounts'][$code] = false;
-            $perms['title']['shout:accounts:' . $code] = $info['name'];
+            $perms['account:' . $code] = array(
+                'title' => $info['name']
+            );
 
             foreach(
                 array(
@@ -139,8 +143,9 @@ class Shout_Application extends Horde_Registry_Application
                     'conferences' => 'Conference Rooms',
                 )
                 as $module => $modname) {
-                $perms['tree']['shout']['accounts'][$code][$module] = false;
-                $perms['title']["shout:accounts:$code:$module"] = $modname;
+                $perms['accounts:' . $code . ':' . $module] = array(
+                    'title' => $modname
+                );
             }
         }
 
index 7b7f691..c800f84 100644 (file)
@@ -67,16 +67,16 @@ class Trean_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms = array();
-
-        $perms['tree']['trean']['max_folders'] = false;
-        $perms['title']['trean:max_folders'] = _("Maximum Number of Folders");
-        $perms['type']['trean:max_folders'] = 'int';
-        $perms['tree']['trean']['max_bookmarks'] = false;
-        $perms['title']['trean:max_bookmarks'] = _("Maximum Number of Bookmarks");
-        $perms['type']['trean:max_bookmarks'] = 'int';
-
-        return $perms;
+        return array(
+            'max_bookmarks' => array(
+                'title' => _("Maximum Number of Bookmarks"),
+                'type' => 'int'
+            ),
+            'max_folders' => array(
+                'title' => _("Maximum Number of Folders"),
+                'type' => 'int'
+            )
+        );
     }
 
     /**
index f160851..027c638 100644 (file)
@@ -149,16 +149,21 @@ class Turba_Application extends Horde_Registry_Application
     {
         require TURBA_BASE . '/config/backends.php';
 
-        $perms['tree']['turba']['sources'] = false;
-        $perms['title']['turba:sources'] = _("Sources");
+        $parms = array(
+            'sources' => array(
+                'title' => _("Sources")
+            )
+        );
 
         // Run through every contact source.
         foreach ($cfgSources as $source => $curSource) {
-            $perms['tree']['turba']['sources'][$source] = false;
-            $perms['title']['turba:sources:' . $source] = $curSource['title'];
-            $perms['tree']['turba']['sources'][$source]['max_contacts'] = false;
-            $perms['title']['turba:sources:' . $source . ':max_contacts'] = _("Maximum Number of Contacts");
-            $perms['type']['turba:sources:' . $source . ':max_contacts'] = 'int';
+            $perms['sources:' . $source] = array(
+                'title' => $curSource['title']
+            );
+            $perms['sources:' . $source . ':max_contacts'] = array(
+                'title' => _("Maximum Number of Contacts"),
+                'type' => 'int'
+            );
         }
 
         return $perms;
index 71a33c8..c9b5e41 100644 (file)
@@ -33,16 +33,19 @@ class Vilma_Application extends Horde_Registry_Application
 
     public function perms()
     {
-        $perms['tree']['vilma']['superadmin'] = false;
-        $perms['title']['vilma:superadmin'] = _("Super Administrator");
+        $perms = array(
+            'superadmin' => array(
+                'title' => _("Super Administrator")
+            )
+        );
 
         $domains = $this->driver->getDomains();
 
         // Run through every domain
         foreach ($domains as $domain) {
-            $d = $domain['domain_id'];
-            $perms['tree']['vilma']['domains'][$d] = false;
-            $perms['title']['vilma:domains:' . $d] = $domain['name'];
+            $perms['domains:' . $domain['domain_id']] = array(
+                'title' => $domain['name']
+            );
         }
 
         return $perms;
index b71ea34..8488a91 100644 (file)
@@ -65,20 +65,27 @@ class Whups_Application extends Horde_Registry_Application
     public function perms()
     {
         /* Available Whups permissions. */
-        $perms['tree']['whups']['admin'] = false;
-        $perms['title']['whups:admin'] = _("Administration");
-
-        $perms['tree']['whups']['hiddenComments'] = false;
-        $perms['title']['whups:hiddenComments'] = _("Hidden Comments");
-
-        $perms['tree']['whups']['queues'] = array();
-        $perms['title']['whups:queues'] = _("Queues");
+        $perms = array(
+            'admin' => array(
+                'title' => _("Administration")
+            ),
+            'hiddenComments' => array(
+                'title' => _("Hidden Comments")
+            ),
+            'queues' => array(
+                'title' => _("Queues")
+            ),
+            'replies' => array(
+                'title' => _("Form Replies")
+            )
+        );
 
         /* Loop through queues and add their titles. */
         $queues = $GLOBALS['whups_driver']->getQueues();
         foreach ($queues as $id => $name) {
-            $perms['tree']['whups']['queues'][$id] = false;
-            $perms['title']['whups:queues:' . $id] = $name;
+            $perms['queues:' . $id] = array(
+                'title' => $name
+            );
 
             $entries = array(
                 'assign' => _("Assign"),
@@ -87,21 +94,19 @@ class Whups_Application extends Horde_Registry_Application
             );
 
             foreach ($entries as $key => $val) {
-                $perms['tree']['whups']['queues'][$id][$key] = false;
-                $perms['title']['whups:queues:' . $id . ':' . $key] = $val;
-                $perms['type']['whups:queues:' . $id . ':' . $key] = 'boolean';
-                $perms['params']['whups:queues:' . $id . ':' . $key] = array();
+                $perms['queues:' . $id . ':' . $key] = array(
+                    'title' => $val,
+                    'type' => 'boolean'
+                );
             }
         }
 
-        $perms['tree']['whups']['replies'] = array();
-        $perms['title']['whups:replies'] = _("Form Replies");
-
         /* Loop through type and replies and add their titles. */
         foreach ($GLOBALS['whups_driver']->getAllTypes() as $type_id => $type_name) {
             foreach ($GLOBALS['whups_driver']->getReplies($type_id) as $reply_id => $reply) {
-                $perms['tree']['whups']['replies'][$reply_id] = false;
-                $perms['title']['whups:replies:' . $reply_id] = $type_name . ': ' . $reply['reply_name'];
+                $perms['replies:' . $reply_id] = array(
+                    'title' => $type_name . ': ' . $reply['reply_name']
+                );
             }
         }
 
index 2a005a5..03250f8 100644 (file)
@@ -59,22 +59,26 @@ class Wicked_Application extends Horde_Registry_Application
      */
     public function perms()
     {
-        $perms['tree']['wicked']['pages'] = array();
-        $perms['title']['wicked:pages'] = _("Pages");
+        $perms = array(
+            'pages' => array(
+                'title' => _("Pages")
+            )
+        );
 
         foreach (array('AllPages', 'LeastPopular', 'MostPopular', 'RecentChanges') as $val) {
-            $perms['tree']['wicked']['pages'][$val] = false;
-            $perms['title']['wicked:pages:' . $val] = $val;
+            $perms['pages:' . $val] = array(
+                'title' => $val
+            );
         }
 
         $pages = $GLOBALS['wicked']->getPages();
         if (!($pages instanceof PEAR_Error)) {
+            sort($pages);
             foreach ($pages as $pagename) {
-                $pageId = $GLOBALS['wicked']->getPageId($pagename);
-                $perms['tree']['wicked']['pages'][$pageId] = false;
-                $perms['title']['wicked:pages:' . $pageId] = $pagename;
+                $perms['pages:' .$GLOBALS['wicked']->getPageId($pagename)] = array(
+                    'title' => $pagename
+                );
             }
-            ksort($perms['tree']['wicked']['pages']);
         }
 
         return $perms;