Remove icondir parameter from Horde_Tree::
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Aug 2010 19:22:26 +0000 (13:22 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Aug 2010 19:27:33 +0000 (13:27 -0600)
30 files changed:
ansel/lib/Widget/OtherGalleries.php
chora/lib/Block/tree_menu.php
fima/lib/Block/tree_menu.php
fima/templates/accounts/accounts.inc
framework/Core/lib/Horde/Core/Perms/Ui.php
framework/Tree/lib/Horde/Tree.php
framework/Tree/lib/Horde/Tree/Html.php
gollem/lib/Block/tree_menu.php
horde/admin/activesync.php
horde/admin/groups.php
horde/js/hordetree.js
horde/lib/Ui/Sidebar.php
horde/services/help/index.php
imp/config/hooks.php.dist
imp/lib/Ajax/Application.php
imp/lib/Block/tree_folders.php
imp/lib/Imap/Tree/Element.php
imp/lib/Ui/Folder.php
jonah/lib/Block/tree_menu.php
kastalia/lib/Block/tree_menu.php
kronolith/lib/Block/tree_alarms.php
kronolith/lib/Block/tree_menu.php
mnemo/lib/Block/tree_menu.php
nag/lib/Block/tree_alarms.php
nag/lib/Block/tree_menu.php
news/lib/Categories.php
skoli/lib/Block/tree_menu.php
trean/lib/Block/tree_menu.php
turba/lib/Block/tree_menu.php
whups/lib/Block/tree_menu.php

index 0c924d8..2d5e7f9 100644 (file)
@@ -97,7 +97,7 @@ class Ansel_Widget_OtherGalleries extends Ansel_Widget_Base
 
             $tree->addNode($gallery->id, $parent, $gallery->get('name'), null,
                            ($gallery->id == $this->_view->gallery->id),
-                           array('icon' => $img, 'icondir' => '', 'url' => $link));
+                           array('icon' => $img, 'url' => $link));
         }
 
         Horde::startBuffer();
index d38f577..dc74c72 100644 (file)
@@ -22,8 +22,7 @@ class Horde_Block_chora_tree_menu extends Horde_Block
                     $indent + 1,
                     false,
                     array(
-                        'icon' => 'folder.png',
-                        'icondir' => (string)Horde_Themes::img(null, 'horde') . '/tree',
+                        'icon' => Horde_Themes::img('tree/folder.png'),
                         'url' => Chora::url('browsedir', '', array('rt' => $key))
                     )
                 );
index 448c19d..196d9c4 100644 (file)
@@ -11,20 +11,23 @@ class Horde_Block_fima_tree_menu extends Horde_Block {
     {
         $menus = array(
             array('add', _("Add Postings"), 'add.png', Horde_Util::addParameter(Horde::applicationUrl('postings.php'), 'actionID', 'add_postings')),
-            array('search', _("Search"), 'search.png', Horde::applicationUrl('search.php'), (string)Horde_Themes::img(null, 'horde')),
+            array('search', _("Search"), 'search.png', Horde::applicationUrl('search.php')),
             array('accounts', _("Accounts"), 'accounts.png', Horde::applicationUrl('accounts.php')),
-            array('reports', _("Reports"), 'report.png', Horde::applicationUrl('report.php')),
+            array('reports', _("Reports"), 'report.png', Horde::applicationUrl('report.php'))
         );
 
         foreach ($menus as $menu) {
-            $tree->addNode($parent . $menu[0],
-                           $parent,
-                           $menu[1],
-                           $indent + 1,
-                           false,
-                           array('icon' => $menu[2],
-                                 'icondir' => isset($menu[4]) ? $menu[4] : (string)Horde_Themes::img(),
-                                 'url' => $menu[3]));
+            $tree->addNode(
+                $parent . $menu[0],
+                $parent,
+                $menu[1],
+                $indent + 1,
+                false,
+                array(
+                    'icon' => Horde_Themes::img($menu[2]),
+                    'url' => $menu[3]
+                )
+            );
         }
     }
 
index ff2a56b..3634068 100644 (file)
@@ -29,11 +29,10 @@ function Submit(action)
 <div id="accountList">
 <?php
 
-$params = array('icondir' => Horde_Themes::img(), 'icon' => '');
 $tree = $GLOBALS['injector']->getInstance('Horde_Tree')->getTree('account_tree', 'Javascript');
 
 foreach ($accounts as $accountId => $account) {
-    $params['icon'] = $account['icon'];
+    $params = array('icon' => Horde_Themes::img($account['icon']));
     $accountLabel = htmlspecialchars(trim($account['number'] . ' ' . $account['name']));
     if ($account['closed']) {
         $accountLabel = '<span class="closed">' . $accountLabel . '</span>';
index 6959a88..772cf13 100644 (file)
@@ -65,8 +65,7 @@ class Horde_Core_Perms_Ui
         /* Get the perms tree. */
         $nodes = $this->_perms->getTree();
 
-        $icondir = array('icondir' => Horde_Themes::img());
-        $perms_node = $icondir + array('icon' => 'perms.png');
+        $perms_node = array('icon' => Horde_Themes::img('perms.png'));
         $add = Horde::applicationUrl('admin/perms/addchild.php');
         $add_img = Horde::img('add_perm.png', _("Add Permission"));
         $edit = Horde::applicationUrl('admin/perms/edit.php');
@@ -88,8 +87,7 @@ class Horde_Core_Perms_Ui
                 : array();
             if ($perm_id == Horde_Perms::ROOT) {
                 $add_link = $add->add('perm_id', $perm_id)->link(array('title' => _("Add New Permission"))) . $add_img . '</a>';
-                $base_node_params = $icondir +
-                    array('icon' => 'administration.png');
+                $base_node_params = array('icon' => Horde_Themes::img('administration.png'));
 
                 $tree->addNode($perm_id, null, _("All Permissions"), 0, true,
                                $base_node_params + $node_class,
index f8025b7..72a28a0 100644 (file)
@@ -329,7 +329,6 @@ class Horde_Tree
      * class - CSS class to use with this node
      * icon - Icon to display next node
      * iconalt - Alt text to use for the icon
-     * icondir - Icon directory
      * iconopen - Icon to indicate this node as expanded
      * onclick - Onclick event attached to this node
      * url - URL to link the node to
@@ -347,7 +346,7 @@ class Horde_Tree
         }
 
         $allowed = array(
-            'class', 'icon', 'iconalt', 'icondir', 'iconopen',
+            'class', 'icon', 'iconalt', 'iconopen',
             'onclick', 'url', 'urlclass', 'title', 'target',
         );
 
index 8fef934..1c19832 100644 (file)
@@ -452,7 +452,9 @@ class Horde_Tree_Html extends Horde_Tree
             /* Use standard icon set. */
             if (isset($this->_nodes[$node_id]['children'])) {
                 /* Node with children. */
-                $img = ($this->_nodes[$node_id]['expanded']) ? $this->_images['folderopen'] : $this->_images['folder'];
+                $img = ($this->_nodes[$node_id]['expanded'])
+                    ? $this->_images['folderopen']
+                    : $this->_images['folder'];
             } else {
                 /* Leaf node (no children). */
                 $img = $this->_images['leaf'];
index 5f73266..fd223c3 100644 (file)
@@ -23,19 +23,21 @@ class Horde_Block_gollem_tree_menu extends Horde_Block
         // TODO
         return;
 
-        $icondir = (string)Horde_Themes::img();
         $login_url = Horde::applicationUrl('login.php');
 
         foreach ($GLOBALS['gollem_backends'] as $key => $val) {
             if (Gollem::checkPermissions('backend', Horde_Perms::SHOW, $key)) {
-                $tree->addNode($parent . $key,
-                               $parent,
-                               $val['name'],
-                               $indent + 1,
-                               false,
-                               array('icon' => 'gollem.png',
-                                     'icondir' => $icondir,
-                                     'url' => Horde_Util::addParameter($login_url, array('backend_key' => $key, 'change_backend' => 1))));
+                $tree->addNode(
+                    $parent . $key,
+                    $parent,
+                    $val['name'],
+                    $indent + 1,
+                    false,
+                    array(
+                        'icon' => Horde_Themes::img('gollem.png'),
+                        'url' => $login_url->copy()->add(array('backend_key' => $key, 'change_backend' => 1))
+                    )
+                );
             }
         }
     }
index 220091f..87850db 100644 (file)
@@ -80,10 +80,9 @@ require HORDE_TEMPLATES . '/admin/menu.inc';
 <?php
 
 $spacer = '&nbsp;&nbsp;&nbsp;&nbsp;';
-$icondir = array('icondir' => Horde_Themes::img());
-$base_node_params = $icondir + array('icon' => 'administration.png');
-$device_node = $icondir + array('icon' => 'mobile.png');
-$user_node = $icondir + array('icon' => 'user.png');
+$base_node_params = array('icon' => strval(Horde_Themes::img('administration.png')));
+$device_node = array('icon' => strval(Horde_Themes::img('mobile.png')));
+$user_node = array('icon' => strval(Horde_Themes::img('user.png')));
 $users = array();
 
 $tree = $injector->getInstance('Horde_Tree')->getTree('admin_devices', 'Javascript');
index 5b60936..dba7124 100644 (file)
@@ -205,8 +205,7 @@ $nodes[Horde_Group::ROOT] = Horde_Group::ROOT;
 
 /* Set up some node params. */
 $spacer = '&nbsp;&nbsp;&nbsp;&nbsp;';
-$icondir = array('icondir' => Horde_Themes::img());
-$group_node = $icondir + array('icon' => 'group.png');
+$group_node = array('icon' => strval(Horde_Themes::img('group.png')));
 $add = Horde::applicationUrl('admin/groups.php?actionID=addchild');
 $add_img = Horde::img('add_group.png');
 $edit = Horde::applicationUrl('admin/groups.php?actionID=edit');
@@ -230,7 +229,7 @@ foreach ($nodes as $id => $node) {
     if ($id == Horde_Group::ROOT) {
         $add_link = Horde::link(Horde_Util::addParameter($add, 'cid', $id), _("Add a new group")) . $add_img . '</a>';
 
-        $base_node_params = $icondir + array('icon' => 'administration.png');
+        $base_node_params = array('icon' => strval(Horde_Themes::img('administration.png')));
         $tree->addNode($id, null, _("All Groups"), 0, true, $base_node_params + $node_params, array($spacer, $add_link));
     } else {
         $name = $groups->getGroupShortName($node);
index 54a641c..efef578 100644 (file)
@@ -411,11 +411,6 @@ var Horde_Tree = Class.create({
 
         img.push('<img class="treeIcon" id="nodeIcon_' + nodeId + '" src="');
 
-        // Image directory.
-        if (!Object.isUndefined(node.icondir) && node.icondir) {
-            img.push(node.icondir + '/');
-        }
-
         // Image.
         if (!Object.isUndefined(node.icon)) {
             // Node has a user defined icon.
@@ -460,11 +455,6 @@ var Horde_Tree = Class.create({
         // Toggle the node's icon if it has separate open and closed
         // icons.
         if (icon = $('nodeIcon_' + nodeId)) {
-            // Image directory.
-            if (!Object.isUndefined(node.icondir) && node.icondir) {
-                src.push(node.icondir + '/');
-            }
-
             // Image.
             if (!Object.isUndefined(node.icon)) {
                 src.push((node.expanded && node.iconopen) ? node.iconopen : node.icon);
index 2edaa67..2a3c581 100644 (file)
@@ -231,7 +231,6 @@ class Horde_Ui_Sidebar
 
                 $node_params = array(
                     'icon' => strval((isset($params['icon']) ? $params['icon'] : $registry->get('icon', $app))),
-                    'icondir' => '',
                     'target' => isset($params['target']) ? $params['target'] : null,
                     'url' => $url
                 );
index d9a1ae9..a13e1ca 100644 (file)
@@ -80,9 +80,8 @@ case 'sidebar':
         $topics = $help->topics();
         $added_nodes = array();
         $node_params_master = array(
-            'target' => 'help_main',
-            'icon' => 'help.png',
-            'icondir' => dirname(Horde_Themes::img('help.png'))
+            'icon' => strval(Horde_Themes::img('help.png')),
+            'target' => 'help_main'
         );
 
         foreach ($topics as $id => $title) {
index 21a4f5e..1029c8d 100644 (file)
@@ -326,7 +326,7 @@ class IMP_Hooks
      * trash folders.)
      *
      * @return array  A list of mailboxes, with the name as keys and the
-     *               values an array with 'icon', 'icondir', and 'alt' entries.
+     *               values an array with 'icon' and 'alt' entries.
      *               If a mailbox name doesn't appear in the list, the default
      *               mailbox icon is displayed.
      */
@@ -349,30 +349,26 @@ class IMP_Hooks
 //            if ((stripos($box, "INBOX/Calendar") !== false) ||
 //                preg_match("!^user/[^/]+/Calendar!", $box)) {
 //                $newmailboxes[$box] = array(
-//                    'icon' => 'kronolith.png',
-//                    'icondir' => Horde_Themes::img(null, 'kronolith')
-//                    'alt' => _("Calendar")
+//                    'alt' => _("Calendar"),
+//                    'icon' => Horde_Themes::img('kronolith.png', 'kronolith')
 //                );
 //            } elseif ((stripos($box, "INBOX/Tasks") !== false) ||
 //                      preg_match("!^user/[^/]+/Tasks!", $box)) {
 //                $newmailboxes[$box] = array(
-//                    'icon' => 'nag.png',
-//                    'icondir' => Horde_Themes::img(null, 'nag')
 //                    'alt' => _("Tasks")
+//                    'icon' => Horde_Themes::img('nag.png', 'nag'),
 //                );
 //            } elseif ((stripos($box, "INBOX/Notes") !== false) ||
 //                      preg_match("!^user/[^/]+/Notes!", $box)) {
 //                $newmailboxes[$box] = array(
-//                    'icon' => 'mnemo.png',
-//                    'icondir' => Horde_Themes::img(null, 'mnemo')
-//                    'alt' => _("Notes")
+//                    'alt' => _("Notes"),
+//                    'icon' => Horde_Themes::img('mnemo.png', 'mnemo')
 //                );
 //            } elseif ((stripos($box, "INBOX/Contacts") !== false) ||
 //                      preg_match("!^user/[^/]+/Contacts!", $box)) {
 //                $newmailboxes[$box] = array(
-//                    'icon' => 'turba.png',
-//                    'icondir' => Horde_Themes::img(null, 'turba')
-//                    'alt' => _("Contacts")
+//                    'alt' => _("Contacts"),
+//                    'icon' => Horde_Themes::img('turba.png', 'turba')
 //                );
 //            }
 //        }
@@ -394,41 +390,36 @@ class IMP_Hooks
 //            switch ($folder[1]) {
 //            case 'event':
 //                $icons[$name] = array(
-//                    'icon' => 'kronolith.png',
-//                    'icondir' => Horde_Themes::img(null, 'kronolith')
-//                    'alt' => _("Calendar")
+//                    'alt' => _("Calendar"),
+//                    'icon' => Horde_Themes::img('kronolith.png', 'kronolith')
 //                );
 //                break;
 //
 //            case 'task':
 //                $icons[$name] = array(
-//                    'icon' => 'nag.png',
-//                    'icondir' => Horde_Themes::img(null, 'nag')
-//                    'alt' => _("Tasks")
+//                    'alt' => _("Tasks"),
+//                    'icon' => Horde_Themes::img('nag.png', 'nag')
 //                );
 //                break;
 //
 //            case 'note':
 //                $icons[$name] = array(
-//                    'icon' => 'mnemo.png',
-//                    'icondir' => Horde_Themes::img(null, 'mnemo')
-//                    'alt' => _("Notes")
+//                    'alt' => _("Notes"),
+//                    'icon' => Horde_Themes::img('mnemo.png', 'mnemo')
 //                );
 //                break;
 //
 //            case 'contact':
 //                $icons[$name] = array(
-//                    'icon' => 'turba.png',
-//                    'icondir' => Horde_Themes::img(null, 'turba')
-//                    'alt' => _("Contacts")
+//                    'alt' => _("Contacts"),
+//                    'icon' => Horde_Themes::img('turba.png', 'turba')
 //                );
 //                break;
 //
 //            case 'prefs':
 //                $icons[$name] = array(
-//                    'icon' => 'prefs.png',
-//                    'icondir' => Horde_Themes::img(null, 'horde')
-//                    'alt' => _("Preferences")
+//                    'alt' => _("Preferences"),
+//                    'icon' => Horde_Themes::img('prefs.png', 'horde')
 //                );
 //                break;
 //            }
index bcb44ff..6a0f324 100644 (file)
@@ -2043,12 +2043,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
         $icon = $elt->icon;
         if ($icon->user_icon) {
             $ob->cl = 'customimg';
-            $dir = empty($icon->icondir)
-                ? Horde_Themes::img()
-                : $icon->icondir;
-            $ob->i = empty($dir)
-                ? $icon->icon
-                : $dir . '/' . $icon->icon;
+            $ob->i = strval($icon->icon);
         } else {
             $ob->cl = $icon->class;
         }
index 6b896aa..db553d4 100644 (file)
@@ -29,9 +29,6 @@ class Horde_Block_imp_tree_folders extends Horde_Block
             $injector->getInstance('IMP_Filter')->filter('INBOX');
         }
 
-        /* Cache some additional values. */
-        $image_dir = strval(Horde_Themes::img());
-
         $tree->addNode(
             $parent . 'compose',
             $parent,
@@ -39,8 +36,7 @@ class Horde_Block_imp_tree_folders extends Horde_Block
             $indent,
             false,
             array(
-                'icon' => 'compose.png',
-                'icondir' => $image_dir,
+                'icon' => Horde_Themes::img('compose.png'),
                 'url' => strval(IMP::composeLink())
             )
         );
@@ -53,8 +49,7 @@ class Horde_Block_imp_tree_folders extends Horde_Block
             $indent,
             false,
             array(
-                'icon' => 'search.png',
-                'icondir' => $image_dir,
+                'icon' => Horde_Themes::img('search.png'),
                 'url' => Horde::applicationUrl('search.php')
             )
         );
@@ -99,7 +94,6 @@ class Horde_Block_imp_tree_folders extends Horde_Block
                 $val->is_open,
                 array(
                     'icon' => $icon->icon,
-                    'icondir' => strval($icon->icondir),
                     'iconopen' => $icon->iconopen,
                     'url' => ($val->container) ? null : $name_url->add('mailbox', $val->value),
                 )
@@ -118,14 +112,12 @@ class Horde_Block_imp_tree_folders extends Horde_Block
 
             $node_params = array(
                 'icon' => strval($registry->get('icon', $parent)),
-                'icondir' => '',
                 'url' => $url
             );
             $name = $registry->get('name', $parent);
 
             if ($unseen) {
-                $node_params['icon'] = 'newmail.png';
-                $node_params['icondir'] = $image_dir;
+                $node_params['icon'] = Horde_Themes::img('newmail.png');
                 $name = sprintf('<strong>%s</strong> (%s)', $name, $unseen);
             }
 
index 755a7fe..a6aa369 100644 (file)
@@ -71,9 +71,8 @@ class IMP_Imap_Tree_Element
      * 'icon' - (object) Icon information for the mailbox. Properties:
      *   'alt' - (string) The alt text for the icon.
      *   'class' - (string) The CSS class name.
-     *   'icon' - (string) The name of the icon graphic to use.
-     *   'icondir' - (string) The path of the icon directory.
-     *   'iconopen' - (string) The name of the openicon to use.
+     *   'icon' - (Horde_Themes_Image) The icon graphic to use.
+     *   'iconopen' - (Horde_Themes_Image) The openicon to use.
      *   'user_icon' - (boolean) Use a user defined icon?
      * 'level' - (integer) The deepness level of this element.
      * 'mbox_val' - (string) A html-ized version of 'value'.
@@ -216,7 +215,6 @@ class IMP_Imap_Tree_Element
         $this->_initCache();
 
         $info = new stdClass;
-        $info->icondir = $this->_eltCache['image_dir'];
         $info->iconopen = null;
         $info->user_icon = false;
 
@@ -230,7 +228,7 @@ class IMP_Imap_Tree_Element
                 $info->alt = _("Folder");
                 $info->class = 'folderImg';
                 $info->icon = 'folders/folder.png';
-                $info->iconopen = 'folders/open.png';
+                $info->iconopen = Horde_Themes::img('folders/open.png');
             }
         } else {
             switch ($this->_mbox['v']) {
@@ -313,9 +311,10 @@ class IMP_Imap_Tree_Element
             if (isset($mi['alt'])) {
                 $info->alt = $mi['alt'];
             }
-            $info->icon = $mi['icon'];
-            $info->icondir = $mi['icondir'];
+            $info->icon = strval($mi['icon']);
             $info->user_icon = true;
+        } elseif ($info->icon) {
+            $info->icon = Horde_Themes::img($info->icon);
         }
 
         return $info;
@@ -328,7 +327,6 @@ class IMP_Imap_Tree_Element
     {
         if (!isset($this->_eltCache)) {
             $this->_eltCache = $this->_treeob->getSpecialMailboxes();
-            $this->_eltCache['image_dir'] = Horde_Themes::img();
         }
     }
 
index e5d35e6..046ce99 100644 (file)
@@ -65,7 +65,7 @@ class IMP_Ui_Folder
         $peek = $elt->peek;
 
         $dir2 = $icon->user_icon
-            ? Horde::img($icon->icon, $icon->alt, null, $icon->icondir)
+            ? Horde::img($icon->icon, $icon->alt)
             : '<span class="foldersImg ' . $icon->class . '"></span>';
 
         if ($elt->children && isset($options['expand_url'])) {
index 7a2f70e..22a4672 100644 (file)
@@ -18,7 +18,6 @@ class Horde_Block_jonah_tree_menu extends Horde_Block {
         }
 
         $url = Horde::applicationUrl('stories/');
-        $icondir = Horde_Themes::img(null, array('notheme' => true, 'nohorde' => true));
         $news = Jonah_News::factory();
         $channels = $news->getChannels('internal');
         if (is_a($channels, 'PEAR_Error')) {
@@ -27,14 +26,17 @@ class Horde_Block_jonah_tree_menu extends Horde_Block {
         $channels = Jonah::checkPermissions('channels', Horde_Perms::SHOW, $channels);
 
         foreach ($channels as $channel) {
-            $tree->addNode($parent . $channel['channel_id'],
-                           $parent,
-                           $channel['channel_name'],
-                           $indent + 1,
-                           false,
-                           array('icon' => 'editstory.png',
-                                 'icondir' => $icondir,
-                                 'url' => Horde_Util::addParameter($url, array('channel_id' => $channel['channel_id']))));
+            $tree->addNode(
+                $parent . $channel['channel_id'],
+                $parent,
+                $channel['channel_name'],
+                $indent + 1,
+                false,
+                array(
+                    'icon' => Horde_Themes::img('editstory.png'),
+                    'url' => $url->add('channel_id', $channel['channel_id'])
+                )
+            );
         }
     }
 
index 62eeaa9..0ba6ad6 100644 (file)
@@ -19,18 +19,19 @@ class Horde_Block_kastalia_tree_menu extends Horde_Block {
 
     function _buildTree(&$tree, $indent = 0, $parent = null)
     {
-        global $registry;
-
         require_once dirname(__FILE__) . '/../base.php';
 
-        $tree->addNode($parent . '__upload',
-                       $parent,
-                       _("Upload"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'menu/upload.png',
-                             'icondir' => (string)Horde_Themes::img(null, 'kastalia'),
-                             'url' => Horde::applicationUrl('upload_menu.php')));
+        $tree->addNode(
+            $parent . '__upload',
+            $parent,
+            _("Upload"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => strval(Horde_Themes::img('menu/upload.png')),
+                'url' => Horde::applicationUrl('upload_menu.php')
+            )
+        );
     }
 
 }
index e3ea9e5..42b344c 100644 (file)
@@ -28,14 +28,17 @@ class Horde_Block_kronolith_tree_alarms extends Horde_Block
                     continue;
                 }
                 $alarmCount++;
-                $tree->addNode($parent . $calId . $event->id,
-                               $parent,
-                               htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()),
-                               $indent + 1,
-                               false,
-                               array('icon' => 'alarm.png',
-                                     'icondir' => (string)Horde_Themes::img(),
-                                     'url' => $event->getViewUrl()));
+                $tree->addNode(
+                    $parent . $calId . $event->id,
+                    $parent,
+                    htmlspecialchars($event->getTitle(), ENT_COMPAT, $GLOBALS['registry']->getCharset()),
+                    $indent + 1,
+                    false,
+                    array(
+                        'icon' => Horde_Themes::img('alarm.png'),
+                        'url' => $event->getViewUrl()
+                    )
+                );
             }
         }
 
@@ -47,16 +50,23 @@ class Horde_Block_kronolith_tree_alarms extends Horde_Block
         } else {
             $purl = Horde::url($GLOBALS['registry']->getInitialPage($parent));
         }
-        $pnode_params = array('url' => $purl,
-                              'icon' => (string)$GLOBALS['registry']->get('icon', $parent),
-                              'icondir' => '');
+
         $pnode_name = $GLOBALS['registry']->get('name', $parent);
         if ($alarmCount) {
             $pnode_name = '<strong>' . $pnode_name . '</strong>';
         }
 
-        $tree->addNode($parent, $GLOBALS['registry']->get('menu_parent', $parent),
-                       $pnode_name, $indent, false, $pnode_params);
+        $tree->addNode(
+            $parent,
+            $GLOBALS['registry']->get('menu_parent', $parent),
+            $pnode_name,
+            $indent,
+            false,
+            array(
+                'icon' => $GLOBALS['registry']->get('icon', $parent),
+                'url' => $purl,
+            )
+        );
     }
 
 }
index b8cff44..2319eed 100644 (file)
@@ -12,8 +12,6 @@ class Horde_Block_kronolith_tree_menu extends Horde_Block
 
     protected function _buildTree(&$tree, $indent = 0, $parent = null)
     {
-        global $registry;
-
         $menus = array(
             array('new', _("New Event"), 'new.png', Horde::applicationUrl('new.php')),
             array('day', _("Day"), 'dayview.png', Horde::applicationUrl('day.php')),
@@ -21,18 +19,21 @@ class Horde_Block_kronolith_tree_menu extends Horde_Block
             array('week', _("Week"), 'weekview.png', Horde::applicationUrl('week.php')),
             array('month', _("Month"), 'monthview.png', Horde::applicationUrl('month.php')),
             array('year', _("Year"), 'yearview.png', Horde::applicationUrl('year.php')),
-            array('search', _("Search"), 'search.png', Horde::applicationUrl('search.php'), (string)Horde_Themes::img(null, 'horde')),
+            array('search', _("Search"), 'search.png', Horde::applicationUrl('search.php'))
         );
 
         foreach ($menus as $menu) {
-            $tree->addNode($parent . $menu[0],
-                           $parent,
-                           $menu[1],
-                           $indent + 1,
-                           false,
-                           array('icon' => $menu[2],
-                                 'icondir' => isset($menu[4]) ? $menu[4] : (string)Horde_Themes::img(),
-                                 'url' => $menu[3]));
+            $tree->addNode(
+                $parent . $menu[0],
+                $parent,
+                $menu[1],
+                $indent + 1,
+                false,
+                array(
+                    'icon' => Horde_Themes::img($menu[2]),
+                    'url' => $menu[3]
+                )
+            );
         }
     }
 
index 7bea433..28b470f 100644 (file)
@@ -13,19 +13,19 @@ class Horde_Block_mnemo_tree_menu extends Horde_Block
 
     protected function _buildTree(&$tree, $indent = 0, $parent = null)
     {
-        global $registry;
-
         $add = Horde::applicationUrl('memo.php')->add('actionID', 'add_memo');
-        $icondir = (string)Horde_Themes::img();
 
-        $tree->addNode($parent . '__new',
-                       $parent,
-                       _("New Note"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'add.png',
-                             'icondir' => $icondir,
-                             'url' => $add));
+        $tree->addNode(
+            $parent . '__new',
+            $parent,
+            _("New Note"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => Horde_Themes::img('add.png'),
+                'url' => $add
+            )
+        );
 
         foreach (Mnemo::listNotepads() as $name => $notepad) {
             if ($notepad->get('owner') != $GLOBALS['registry']->getAuth() &&
@@ -35,24 +35,30 @@ class Horde_Block_mnemo_tree_menu extends Horde_Block
                 continue;
             }
 
-            $tree->addNode($parent . $name . '__new',
-                           $parent . '__new',
-                           sprintf(_("in %s"), $notepad->get('name')),
-                           $indent + 2,
-                           false,
-                           array('icon' => 'add.png',
-                                 'icondir' => $icondir,
-                                 'url' => Horde_Util::addParameter($add, array('memolist' => $name))));
+            $tree->addNode(
+                $parent . $name . '__new',
+                $parent . '__new',
+                sprintf(_("in %s"), $notepad->get('name')),
+                $indent + 2,
+                false,
+                array(
+                    'icon' => Horde_Themes::img('add.png'),
+                    'url' => $add->copy()->add('memolist', $name)
+                )
+            );
         }
 
-        $tree->addNode($parent . '__search',
-                       $parent,
-                       _("Search"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'search.png',
-                             'icondir' => (string)Horde_Themes::img(null, 'horde'),
-                             'url' => Horde::applicationUrl('search.php')));
+        $tree->addNode(
+            $parent . '__search',
+            $parent,
+            _("Search"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => Horde_Themes::img('search.png'),
+                'url' => Horde::applicationUrl('search.php')
+            )
+        );
     }
 
 }
index 740f650..239a648 100644 (file)
@@ -37,15 +37,18 @@ class Horde_Block_nag_tree_alarms extends Horde_Block
             $url = Horde_Util::addParameter(Horde::applicationUrl('view.php'),
                                       array('task' => $task->id,
                                             'tasklist' => $task->tasklist));
-            $tree->addNode($parent . $taskId,
-                           $parent,
-                           $task->name,
-                           $indent + 1,
-                           false,
-                           array('icon' => 'alarm.png',
-                                 'icondir' => (string)Horde_Themes::img(),
-                                 'title' => $title,
-                                 'url' => $url));
+            $tree->addNode(
+                $parent . $taskId,
+                $parent,
+                $task->name,
+                $indent + 1,
+                false,
+                array(
+                    'icon' => Horde_Themes::img('alarm.png'),
+                    'title' => $title,
+                    'url' => $url
+                )
+            );
         }
 
         if ($GLOBALS['registry']->get('url', $parent)) {
@@ -56,13 +59,10 @@ class Horde_Block_nag_tree_alarms extends Horde_Block
         } else {
             $purl = Horde::url($GLOBALS['registry']->getInitialPage($parent));
         }
-        $pnode_params = array('url' => $purl,
-                              'icon' => (string)$GLOBALS['registry']->get('icon', $parent),
-                              'icondir' => '');
-
-        $pnode_params = array('url' => $purl,
-                              'icon' => (string)$GLOBALS['registry']->get('icon', $parent),
-                              'icondir' => '');
+        $pnode_params = array(
+            'url' => $purl,
+            'icon' => (string)$GLOBALS['registry']->get('icon', $parent)
+        );
         $pnode_name = $GLOBALS['registry']->get('name', $parent);
         if ($alarmCount) {
             $pnode_name = '<strong>' . $pnode_name . '</strong>';
index ced9c55..24840bb 100644 (file)
@@ -12,19 +12,19 @@ class Horde_Block_nag_tree_menu extends Horde_Block
 
     protected function _buildTree(&$tree, $indent = 0, $parent = null)
     {
-        global $registry;
-
         $add = Horde::applicationUrl('task.php')->add('actionID', 'add_task');
-        $icondir = (string)Horde_Themes::img();
 
-        $tree->addNode($parent . '__new',
-                       $parent,
-                       _("New Task"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'add.png',
-                             'icondir' => $icondir,
-                             'url' => $add));
+        $tree->addNode(
+            $parent . '__new',
+            $parent,
+            _("New Task"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => Horde_Themes::img('add.png'),
+                'url' => $add
+            )
+        );
 
         foreach (Nag::listTasklists() as $name => $tasklist) {
             if ($tasklist->get('owner') != $GLOBALS['registry']->getAuth() &&
@@ -32,24 +32,30 @@ class Horde_Block_nag_tree_menu extends Horde_Block
                 !in_array($tasklist->getName(), $GLOBALS['display_tasklists'])) {
                 continue;
             }
-            $tree->addNode($parent . $name . '__new',
-                           $parent . '__new',
-                           sprintf(_("in %s"), $tasklist->get('name')),
-                           $indent + 2,
-                           false,
-                           array('icon' => 'add.png',
-                                 'icondir' => $icondir,
-                                 'url' => Horde_Util::addParameter($add, array('tasklist_id' => $name))));
+            $tree->addNode(
+                $parent . $name . '__new',
+                $parent . '__new',
+                sprintf(_("in %s"), $tasklist->get('name')),
+                $indent + 2,
+                false,
+                array(
+                    'icon' => Horde_Themes::img('add.png'),
+                    'url' => $add->copy()->add('tasklist_id', $name)
+                )
+            );
         }
 
-        $tree->addNode($parent . '__search',
-                       $parent,
-                       _("Search"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'search.png',
-                             'icondir' => (string)Horde_Themes::img(null, 'horde'),
-                             'url' => Horde::applicationUrl('search.php')));
+        $tree->addNode(
+            $parent . '__search',
+            $parent,
+            _("Search"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => Horde_Themes::img('search.png'),
+                'url' => Horde::applicationUrl('search.php')
+            )
+        );
     }
 
 }
index daf0c9c..9216e16 100644 (file)
@@ -473,8 +473,7 @@ class News_Categories {
     {
         $cats = $this->getCategories(false);
 
-        $params = array('icondir' => Horde_Themes::img(),
-                        'icon' => 'folder_open.png');
+        $params = array('icon' => Horde_Themes::img('folder_open.png'));
 
         // Set up the tree
         $tree = $GLOBALS['injector']->getInstance('Horde_Tree')->getTree('news_cats', 'Javascript', array(
index 27bc1fd..e02a786 100644 (file)
@@ -15,39 +15,48 @@ class Horde_Block_skoli_tree_menu extends Horde_Block {
         require_once dirname(__FILE__) . '/../base.php';
 
         $add = Horde::applicationUrl('add.php');
-        $icondir = (string)Horde_Themes::img();
+        $add_img = Horde_Themes::img('add.png');
 
         $classes = Skoli::listClasses(false, Horde_Perms::EDIT);
         if (count($classes) > 0) {
-
-            $tree->addNode($parent . '__new',
-                           $parent,
-                           _("New Entry"),
-                           $indent + 1,
-                           false,
-                           array('icon' => 'add.png',
-                                 'icondir' => $icondir,
-                                 'url' => $add));
+            $tree->addNode(
+                $parent . '__new',
+                $parent,
+                _("New Entry"),
+                $indent + 1,
+                false,
+                array(
+                    'icon' => $add_img,
+                    'url' => $add
+                )
+            );
 
             foreach ($classes as $name => $class) {
-                $tree->addNode($parent . $name . '__new',
-                               $parent . '__new',
-                               sprintf(_("in %s"), $class->get('name')),
-                               $indent + 2,
-                               false,
-                               array('icon' => 'add.png',
-                                     'icondir' => $icondir,
-                                     'url' => Horde_Util::addParameter($add, array('class' => $name))));
+                $tree->addNode(
+                    $parent . $name . '__new',
+                    $parent . '__new',
+                    sprintf(_("in %s"), $class->get('name')),
+                    $indent + 2,
+                    false,
+                    array(
+                        'icon' => $add_img,
+                        'url' => $add->copy()->add('class', $name)
+                    )
+                );
             }
-            $tree->addNode($parent . '__search',
-                           $parent,
-                           _("Search"),
-                           $indent + 1,
-                           false,
-                           array('icon' => 'search.png',
-                                 'icondir' => (string)Horde_Themes::img(null, 'horde'),
-                                 'url' => Horde::applicationUrl('search.php')));
-        }
 
+            $tree->addNode(
+                $parent . '__search',
+                $parent,
+                _("Search"),
+                $indent + 1,
+                false,
+                array(
+                    'icon' => Horde_Themes::img('search.png'),
+                    'url' => Horde::applicationUrl('search.php')
+                )
+            );
+        }
     }
+
 }
index d85a401..f97d554 100644 (file)
@@ -11,40 +11,47 @@ class Horde_Block_trean_tree_menu extends Horde_Block
 
     protected function _buildTree(&$tree, $indent = 0, $parent = null)
     {
-        global $registry;
-
-        $browse = Horde::applicationUrl('browse.php');
-
-        $tree->addNode($parent . '__new',
-                       $parent,
-                       _("Add"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'add.png',
-                             'icondir' => (string)Horde_Themes::img(),
-                             'url' => Horde::applicationUrl('add.php')));
-
-        $tree->addNode($parent . '__search',
-                       $parent,
-                       _("Search"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'search.png',
-                             'icondir' => (string)Horde_Themes::img('horde'),
-                             'url' => Horde::applicationUrl('search.php')));
+        $tree->addNode(
+            $parent . '__new',
+            $parent,
+            _("Add"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => Horde_Themes::img('add.png'),
+                'url' => Horde::applicationUrl('add.php')
+            )
+        );
+
+        $tree->addNode(
+            $parent . '__search',
+            $parent,
+            _("Search"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => Horde_Themes::img('search.png'),
+                'url' => Horde::applicationUrl('search.php')
+            )
+        );
 
         $folders = Trean::listFolders();
-        if (!is_a($folders, 'PEAR_Error')) {
+        if ($folders instanceof PEAR_Error) {
+            $browse = Horde::applicationUrl('browse.php');
+
             foreach ($folders as $folder) {
                 $parent_id = $folder->getParent();
-                $tree->addNode($parent . $folder->getId(),
-                               $parent . $parent_id,
-                               $folder->get('name'),
-                               $indent + substr_count($folder->getName(), ':') + 1,
-                               false,
-                               array('icon' => 'folder.png',
-                                     'icondir' => (string)Horde_Themes::img('horde') . '/tree',
-                                     'url' => Horde_Util::addParameter($browse, 'f', $folder->getId())));
+                $tree->addNode(
+                    $parent . $folder->getId(),
+                    $parent . $parent_id,
+                    $folder->get('name'),
+                    $indent + substr_count($folder->getName(), ':') + 1,
+                    false,
+                    array(
+                        'icon' => Horde_Themes::img('tree/folder.png'),
+                        'url' => $browse->copy()->add('f', $folder->getId()
+                    )
+                );
             }
         }
     }
index 2f78694..1054084 100644 (file)
@@ -12,55 +12,66 @@ class Horde_Block_turba_tree_menu extends Horde_Block
 
     protected function _buildTree(&$tree, $indent = 0, $parent = null)
     {
-        global $registry;
-
         $browse = Horde::applicationUrl('browse.php');
         $add = Horde::applicationUrl('add.php');
-        $icondir = (string)Horde_Themes::img() . '/menu';
 
         if ($GLOBALS['addSources']) {
-            $tree->addNode($parent . '__new',
-                           $parent,
-                           _("New Contact"),
-                           $indent + 1,
-                           false,
-                           array('icon' => 'new.png',
-                                 'icondir' => $icondir,
-                                 'url' => $add));
+            $newimg = Horde_Themes::img('menu/new.png');
+
+            $tree->addNode(
+                $parent . '__new',
+                $parent,
+                _("New Contact"),
+                $indent + 1,
+                false,
+                array(
+                    'icon' => $newimg,
+                    'url' => $add
+                )
+            );
 
             foreach ($GLOBALS['addSources'] as $addressbook => $config) {
-                $tree->addNode($parent . $addressbook . '__new',
-                               $parent . '__new',
-                               sprintf(_("in %s"), $config['title']),
-                               $indent + 2,
-                               false,
-                               array('icon' => 'new.png',
-                                     'icondir' => $icondir,
-                                     'url' => $add->copy()->add('source', $addressbook)));
+                $tree->addNode(
+                    $parent . $addressbook . '__new',
+                    $parent . '__new',
+                    sprintf(_("in %s"), $config['title']),
+                    $indent + 2,
+                    false,
+                    array(
+                        'icon' => $newimg,
+                        'url' => $add->copy()->add('source', $addressbook)
+                    )
+                );
             }
         }
 
         foreach (Turba::getAddressBooks() as $addressbook => $config) {
             if (!empty($config['browse'])) {
-                $tree->addNode($parent . $addressbook,
-                               $parent,
-                               $config['title'],
-                               $indent + 1,
-                               false,
-                               array('icon' => 'browse.png',
-                                     'icondir' => $icondir,
-                                     'url' => $browse->copy()->add('source', $addressbook)));
+                $tree->addNode(
+                    $parent . $addressbook,
+                    $parent,
+                    $config['title'],
+                    $indent + 1,
+                    false,
+                    array(
+                        'icon' => Horde_Themes::img('menu/browse.png'),
+                        'url' => $browse->copy()->add('source', $addressbook)
+                    )
+                );
             }
         }
 
-        $tree->addNode($parent . '__search',
-                       $parent,
-                       _("Search"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'search.png',
-                             'icondir' => (string)Horde_Themes::img(null, 'horde'),
-                             'url' => Horde::applicationUrl('search.php')));
+        $tree->addNode(
+            $parent . '__search',
+            $parent,
+            _("Search"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => Horde_Themes::img('search.png'),
+                'url' => Horde::applicationUrl('search.php')
+            )
+        );
     }
 
 }
index b82096e..49bbccc 100644 (file)
@@ -12,25 +12,29 @@ class Horde_Block_whups_tree_menu extends Horde_Block
 
     protected function _buildTree(&$tree, $indent = 0, $parent = null)
     {
-        global $registry;
+        $tree->addNode(
+            $parent . '__new',
+            $parent,
+            _("New Ticket"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => Horde_Themes::img('create.png'),
+                'url' => Horde::applicationUrl('ticket/create.php')
+            )
+        );
 
-        $tree->addNode($parent . '__new',
-                       $parent,
-                       _("New Ticket"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'create.png',
-                             'icondir' => (string)Horde_Themes::img(),
-                             'url' => Horde::applicationUrl('ticket/create.php')));
-
-        $tree->addNode($parent . '__search',
-                       $parent,
-                       _("Search"),
-                       $indent + 1,
-                       false,
-                       array('icon' => 'search.png',
-                             'icondir' => (string)Horde_Themes::img(),
-                             'url' => Horde::applicationUrl('search.php')));
+        $tree->addNode(
+            $parent . '__search',
+            $parent,
+            _("Search"),
+            $indent + 1,
+            false,
+            array(
+                'icon' => Horde_Themes::img('search.png'),
+                'url' => Horde::applicationUrl('search.php')
+            )
+        );
     }
 
 }