From 9583b1984dd8cd40fde0bbc6e67291ab16374451 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 18 Aug 2010 13:22:26 -0600 Subject: [PATCH] Remove icondir parameter from Horde_Tree:: --- ansel/lib/Widget/OtherGalleries.php | 2 +- chora/lib/Block/tree_menu.php | 3 +- fima/lib/Block/tree_menu.php | 23 +++++---- fima/templates/accounts/accounts.inc | 3 +- framework/Core/lib/Horde/Core/Perms/Ui.php | 6 +-- framework/Tree/lib/Horde/Tree.php | 3 +- framework/Tree/lib/Horde/Tree/Html.php | 4 +- gollem/lib/Block/tree_menu.php | 20 ++++---- horde/admin/activesync.php | 7 ++- horde/admin/groups.php | 5 +- horde/js/hordetree.js | 10 ---- horde/lib/Ui/Sidebar.php | 1 - horde/services/help/index.php | 5 +- imp/config/hooks.php.dist | 45 +++++++---------- imp/lib/Ajax/Application.php | 7 +-- imp/lib/Block/tree_folders.php | 14 ++---- imp/lib/Imap/Tree/Element.php | 14 +++--- imp/lib/Ui/Folder.php | 2 +- jonah/lib/Block/tree_menu.php | 20 ++++---- kastalia/lib/Block/tree_menu.php | 21 ++++---- kronolith/lib/Block/tree_alarms.php | 36 ++++++++----- kronolith/lib/Block/tree_menu.php | 23 +++++---- mnemo/lib/Block/tree_menu.php | 60 ++++++++++++---------- nag/lib/Block/tree_alarms.php | 32 ++++++------ nag/lib/Block/tree_menu.php | 60 ++++++++++++---------- news/lib/Categories.php | 3 +- skoli/lib/Block/tree_menu.php | 63 +++++++++++++---------- trean/lib/Block/tree_menu.php | 67 +++++++++++++----------- turba/lib/Block/tree_menu.php | 81 +++++++++++++++++------------- whups/lib/Block/tree_menu.php | 40 ++++++++------- 30 files changed, 350 insertions(+), 330 deletions(-) diff --git a/ansel/lib/Widget/OtherGalleries.php b/ansel/lib/Widget/OtherGalleries.php index 0c924d80f..2d5e7f9a6 100644 --- a/ansel/lib/Widget/OtherGalleries.php +++ b/ansel/lib/Widget/OtherGalleries.php @@ -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(); diff --git a/chora/lib/Block/tree_menu.php b/chora/lib/Block/tree_menu.php index d38f577ed..dc74c72c9 100644 --- a/chora/lib/Block/tree_menu.php +++ b/chora/lib/Block/tree_menu.php @@ -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)) ) ); diff --git a/fima/lib/Block/tree_menu.php b/fima/lib/Block/tree_menu.php index 448c19d8e..196d9c4b3 100644 --- a/fima/lib/Block/tree_menu.php +++ b/fima/lib/Block/tree_menu.php @@ -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] + ) + ); } } diff --git a/fima/templates/accounts/accounts.inc b/fima/templates/accounts/accounts.inc index ff2a56bf0..363406877 100644 --- a/fima/templates/accounts/accounts.inc +++ b/fima/templates/accounts/accounts.inc @@ -29,11 +29,10 @@ function Submit(action)
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 = '' . $accountLabel . ''; diff --git a/framework/Core/lib/Horde/Core/Perms/Ui.php b/framework/Core/lib/Horde/Core/Perms/Ui.php index 6959a88b0..772cf1330 100644 --- a/framework/Core/lib/Horde/Core/Perms/Ui.php +++ b/framework/Core/lib/Horde/Core/Perms/Ui.php @@ -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 . ''; - $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, diff --git a/framework/Tree/lib/Horde/Tree.php b/framework/Tree/lib/Horde/Tree.php index f8025b7b3..72a28a0c4 100644 --- a/framework/Tree/lib/Horde/Tree.php +++ b/framework/Tree/lib/Horde/Tree.php @@ -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', ); diff --git a/framework/Tree/lib/Horde/Tree/Html.php b/framework/Tree/lib/Horde/Tree/Html.php index 8fef934f9..1c198324d 100644 --- a/framework/Tree/lib/Horde/Tree/Html.php +++ b/framework/Tree/lib/Horde/Tree/Html.php @@ -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']; diff --git a/gollem/lib/Block/tree_menu.php b/gollem/lib/Block/tree_menu.php index 5f73266a1..fd223c3dd 100644 --- a/gollem/lib/Block/tree_menu.php +++ b/gollem/lib/Block/tree_menu.php @@ -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)) + ) + ); } } } diff --git a/horde/admin/activesync.php b/horde/admin/activesync.php index 220091f31..87850dba6 100644 --- a/horde/admin/activesync.php +++ b/horde/admin/activesync.php @@ -80,10 +80,9 @@ require HORDE_TEMPLATES . '/admin/menu.inc'; 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'); diff --git a/horde/admin/groups.php b/horde/admin/groups.php index 5b6093697..dba71247b 100644 --- a/horde/admin/groups.php +++ b/horde/admin/groups.php @@ -205,8 +205,7 @@ $nodes[Horde_Group::ROOT] = Horde_Group::ROOT; /* Set up some node params. */ $spacer = '    '; -$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 . ''; - $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); diff --git a/horde/js/hordetree.js b/horde/js/hordetree.js index 54a641cae..efef57827 100644 --- a/horde/js/hordetree.js +++ b/horde/js/hordetree.js @@ -411,11 +411,6 @@ var Horde_Tree = Class.create({ img.push(' '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; // } diff --git a/imp/lib/Ajax/Application.php b/imp/lib/Ajax/Application.php index bcb44ff7a..6a0f3242e 100644 --- a/imp/lib/Ajax/Application.php +++ b/imp/lib/Ajax/Application.php @@ -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; } diff --git a/imp/lib/Block/tree_folders.php b/imp/lib/Block/tree_folders.php index 6b896aafc..db553d427 100644 --- a/imp/lib/Block/tree_folders.php +++ b/imp/lib/Block/tree_folders.php @@ -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('%s (%s)', $name, $unseen); } diff --git a/imp/lib/Imap/Tree/Element.php b/imp/lib/Imap/Tree/Element.php index 755a7fee7..a6aa369b4 100644 --- a/imp/lib/Imap/Tree/Element.php +++ b/imp/lib/Imap/Tree/Element.php @@ -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(); } } diff --git a/imp/lib/Ui/Folder.php b/imp/lib/Ui/Folder.php index e5d35e632..046ce99c1 100644 --- a/imp/lib/Ui/Folder.php +++ b/imp/lib/Ui/Folder.php @@ -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) : ''; if ($elt->children && isset($options['expand_url'])) { diff --git a/jonah/lib/Block/tree_menu.php b/jonah/lib/Block/tree_menu.php index 7a2f70ec5..22a4672a9 100644 --- a/jonah/lib/Block/tree_menu.php +++ b/jonah/lib/Block/tree_menu.php @@ -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']) + ) + ); } } diff --git a/kastalia/lib/Block/tree_menu.php b/kastalia/lib/Block/tree_menu.php index 62eeaa93f..0ba6ad648 100644 --- a/kastalia/lib/Block/tree_menu.php +++ b/kastalia/lib/Block/tree_menu.php @@ -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') + ) + ); } } diff --git a/kronolith/lib/Block/tree_alarms.php b/kronolith/lib/Block/tree_alarms.php index e3ea9e5a0..42b344cc0 100644 --- a/kronolith/lib/Block/tree_alarms.php +++ b/kronolith/lib/Block/tree_alarms.php @@ -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 = '' . $pnode_name . ''; } - $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, + ) + ); } } diff --git a/kronolith/lib/Block/tree_menu.php b/kronolith/lib/Block/tree_menu.php index b8cff440e..2319eed33 100644 --- a/kronolith/lib/Block/tree_menu.php +++ b/kronolith/lib/Block/tree_menu.php @@ -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] + ) + ); } } diff --git a/mnemo/lib/Block/tree_menu.php b/mnemo/lib/Block/tree_menu.php index 7bea433e4..28b470f03 100644 --- a/mnemo/lib/Block/tree_menu.php +++ b/mnemo/lib/Block/tree_menu.php @@ -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') + ) + ); } } diff --git a/nag/lib/Block/tree_alarms.php b/nag/lib/Block/tree_alarms.php index 740f6501c..239a64816 100644 --- a/nag/lib/Block/tree_alarms.php +++ b/nag/lib/Block/tree_alarms.php @@ -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 = '' . $pnode_name . ''; diff --git a/nag/lib/Block/tree_menu.php b/nag/lib/Block/tree_menu.php index ced9c5569..24840bb02 100644 --- a/nag/lib/Block/tree_menu.php +++ b/nag/lib/Block/tree_menu.php @@ -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') + ) + ); } } diff --git a/news/lib/Categories.php b/news/lib/Categories.php index daf0c9cf1..9216e16cb 100644 --- a/news/lib/Categories.php +++ b/news/lib/Categories.php @@ -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( diff --git a/skoli/lib/Block/tree_menu.php b/skoli/lib/Block/tree_menu.php index 27bc1fd90..e02a78676 100644 --- a/skoli/lib/Block/tree_menu.php +++ b/skoli/lib/Block/tree_menu.php @@ -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') + ) + ); + } } + } diff --git a/trean/lib/Block/tree_menu.php b/trean/lib/Block/tree_menu.php index d85a40110..f97d554a6 100644 --- a/trean/lib/Block/tree_menu.php +++ b/trean/lib/Block/tree_menu.php @@ -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() + ) + ); } } } diff --git a/turba/lib/Block/tree_menu.php b/turba/lib/Block/tree_menu.php index 2f7869426..105408428 100644 --- a/turba/lib/Block/tree_menu.php +++ b/turba/lib/Block/tree_menu.php @@ -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') + ) + ); } } diff --git a/whups/lib/Block/tree_menu.php b/whups/lib/Block/tree_menu.php index b82096e0a..49bbccc74 100644 --- a/whups/lib/Block/tree_menu.php +++ b/whups/lib/Block/tree_menu.php @@ -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') + ) + ); } } -- 2.11.0