[dev] [patch] menu.php and Registry.php
Joe Wilson
joe.wilson at mindcandy.org
Sun May 4 15:10:43 PDT 2003
Updated patch for menu.php and Registry.php. One minor change in menu.php and
both in preferred cvs diff -u format.
J
Index: menu.php
===================================================================
RCS file: /usr/local/cvs/horde/horde/menu.php,v
retrieving revision 2.38
diff -u -r2.38 menu.php
--- menu.php 18 Mar 2003 16:33:44 -0000 2.38
+++ menu.php 4 May 2003 18:02:47 -0000
@@ -18,29 +18,34 @@
global $registry;
$children = array();
- foreach ($registry->applications as $app => $params) {
- if (array_key_exists('menu_parent', $params)) {
- $children[$params['menu_parent']][$app] = $params;
+ foreach ($registry->listApps(array('active', 'heading', 'notoolbar')) as
$app) {
+ $menu_parent = $registry->getParam('menu_parent', $app);
+ if ($menu_parent) {
+ $children[$menu_parent][$app] = $registry->applications[$app];
unset($registry->applications[$app]);
}
}
$tmp = array();
- foreach ($registry->applications as $app => $params) {
- $tmp[$app] = $params;
+ foreach ($registry->listApps(array('active', 'heading', 'notoolbar')) as
$app) {
+ $tmp[$app] = $registry->applications[$app];
if (array_key_exists($app, $children)) {
$active = false;
$tmp[$app]['children'] = true;
foreach ($children[$app] as $capp => $cparams) {
$tmp[$capp] = $cparams;
- if ($cparams['status'] == 'active') {
+ if ($registry->getParam('status', $capp) == 'active') {
$active = true;
}
}
if (!$active) {
unset($tmp[$app]);
}
- }
+ } else {
+ if ($registry->getParam('status', $app) == 'heading') {
+ unset($tmp[$app]);
+ }
+ }
}
$registry->applications = $tmp;
@@ -71,6 +76,7 @@
$last_parent = 0; // Track the last parent we used.
foreach ($registry->applications as $app => $params) {
+ $params['status'] = $registry->getParam('status', $app);
$params['name'] = gettext($params['name']);
if ($params['status'] == 'active' || $params['status'] == 'heading') {
$i++;
Index: lib/Registry.php
===================================================================
RCS file: /usr/local/cvs/horde/horde/lib/Registry.php,v
retrieving revision 1.150
diff -u -r1.150 Registry.php
--- lib/Registry.php 23 Apr 2003 13:33:30 -0000 1.150
+++ lib/Registry.php 4 May 2003 03:28:19 -0000
@@ -176,7 +176,8 @@
$filter = array('notoolbar', 'active');
}
foreach ($this->applications as $app => $params) {
- if (in_array($params['status'], $filter)) {
+ $status = $this->getParam('status', $app);
+ if (in_array($status, $filter)) {
$apps[] = $app;
}
}
@@ -754,6 +755,17 @@
$ret = isset($this->applications['horde'][$parameter]) ?
$this->applications['horde'][$parameter] : null;
}
+
+ if ($parameter == 'status' && $ret == 'perm') {
+ require_once HORDE_BASE . '/lib/Perms.php';
+ $perm = &Perms::singleton();
+ if ($perm->hasPermission($app, Auth::getAuth(), _PERMS_READ)) {
+ $ret = 'active';
+ } else {
+ $ret = 'inactive';
+ }
+ }
+
if ($parameter == 'name') {
return gettext($ret);
} else {
More information about the dev
mailing list