From 48360a7399b640a69bf51ea671798837b5c49780 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 29 Jun 2010 18:02:16 +0200 Subject: [PATCH] Don't store in the session whether to hide the sidebar/menu or attach the ajax notification listener. Instead, do this per request and pass the request parameter through with Horde::url(). Fixes bug 9017. --- ansel/templates/menu.inc | 6 ++---- beatnik/templates/menu.inc | 2 +- chora/templates/menu.inc | 2 +- crumb/templates/menu.inc | 2 +- fima/templates/menu.inc | 2 +- folks/templates/menu.inc | 2 +- framework/Core/lib/Horde.php | 5 +++++ framework/Core/lib/Horde/Core/Prefs/Ui.php | 15 ++------------- framework/Core/lib/Horde/Registry.php | 3 ++- gollem/lib/Gollem.php | 4 +++- hermes/templates/menu.inc | 2 +- horde/templates/admin/menu.inc | 4 ++-- horde/templates/menu/menu.inc | 2 +- imp/lib/Auth.php | 2 -- imp/lib/IMP.php | 4 +++- imp/templates/dimp/javascript_defs_dimp.php | 2 +- ingo/lib/Ingo.php | 4 +++- kastalia/templates/menu.inc | 2 +- kronolith/index.php | 1 - kronolith/lib/Kronolith.php | 4 ++-- kronolith/templates/menu.inc | 2 +- luxor/templates/menu.inc | 2 +- mnemo/templates/menu.inc | 2 +- nag/templates/menu.inc | 2 +- news/templates/menu.inc | 2 +- operator/templates/menu.inc | 2 +- pastie/templates/menu.inc | 2 +- shout/templates/menu.inc | 2 +- skeleton/templates/menu.inc | 2 +- skoli/templates/menu.inc | 2 +- trean/templates/menu.inc | 2 +- turba/templates/menu.inc | 2 +- whups/templates/menu.inc | 2 +- wicked/templates/menu.inc | 4 ++-- 34 files changed, 48 insertions(+), 52 deletions(-) diff --git a/ansel/templates/menu.inc b/ansel/templates/menu.inc index 900134078..0fb2e81e6 100644 --- a/ansel/templates/menu.inc +++ b/ansel/templates/menu.inc @@ -1,7 +1,5 @@ - - -notify(array('listeners' => 'status')); + +notify(array('listeners' => 'status')); ?> diff --git a/beatnik/templates/menu.inc b/beatnik/templates/menu.inc index 56455b439..48b2d43a0 100644 --- a/beatnik/templates/menu.inc +++ b/beatnik/templates/menu.inc @@ -37,5 +37,5 @@ $menu_view = $prefs->getValue('menu_view'); - + notify(array('listeners' => 'status')) ?> diff --git a/chora/templates/menu.inc b/chora/templates/menu.inc index 4224b9f67..f6d1648dc 100644 --- a/chora/templates/menu.inc +++ b/chora/templates/menu.inc @@ -4,5 +4,5 @@ render() ?> - + notify(array('listeners' => 'status')) ?> diff --git a/crumb/templates/menu.inc b/crumb/templates/menu.inc index a77bfd53f..e8d056f94 100644 --- a/crumb/templates/menu.inc +++ b/crumb/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/fima/templates/menu.inc b/fima/templates/menu.inc index b6395f4cd..613cfca26 100644 --- a/fima/templates/menu.inc +++ b/fima/templates/menu.inc @@ -37,5 +37,5 @@ function ledgerSubmit(clear) } } - + notify(array('listeners' => 'status')) ?> diff --git a/folks/templates/menu.inc b/folks/templates/menu.inc index ddb1d82da..c38fc018b 100644 --- a/folks/templates/menu.inc +++ b/folks/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 720241bdb..87924ce92 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -960,6 +960,11 @@ HTML; $ob->add(session_name(), session_id()); } + if (($append_session == 0 || $append_session == 1) && + Horde_Util::getFormData('ajaxui')) { + $ob->add('ajaxui', 1); + } + return $ob; } diff --git a/framework/Core/lib/Horde/Core/Prefs/Ui.php b/framework/Core/lib/Horde/Core/Prefs/Ui.php index 4276d5edf..c8b1de44a 100644 --- a/framework/Core/lib/Horde/Core/Prefs/Ui.php +++ b/framework/Core/lib/Horde/Core/Prefs/Ui.php @@ -7,7 +7,6 @@ * * Session variables set (stored in 'horde_prefs'): * 'advanced' - (boolean) If true, display advanced prefs. - * 'nomenu' - (boolean) If true, hide menu display. * * Copyright 2001-2010 The Horde Project (http://www.horde.org/) * @@ -119,16 +118,6 @@ class Horde_Core_Prefs_Ui } /** - * Hide the menu display for prefs UI pages during this session? - * - * @param boolean $hide If true, hides the menu. - */ - static public function hideMenu($hide) - { - $_SESSION['horde_prefs']['nomenu'] = $hide; - } - - /** * Determine whether or not a preferences group is editable. * * @param string $group The preferences group to check. @@ -532,7 +521,7 @@ class Horde_Core_Prefs_Ui /* Get the menu output before we start to output the page. * Again, this will catch any javascript inserted into the page. */ - if (empty($_SESSION['horde_prefs']['nomenu'])) { + if (!Horde_Util::getFormData('ajaxui')) { if ($registry->hasAppMethod($this->app, 'prefsMenu')) { $menu = $registry->callAppMethod($this->app, 'prefsMenu', array('args' => array($this))); } @@ -552,7 +541,7 @@ class Horde_Core_Prefs_Ui $GLOBALS['bodyId'] = 'services_prefs'; require $h_templates . '/common-header.inc'; - if (empty($_SESSION['horde_prefs']['nomenu'])) { + if (!Horde_Util::getFormData('ajaxui')) { require $h_templates . '/menu/menu.inc'; } diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 9646ab573..ca1f102a5 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -374,7 +374,8 @@ class Horde_Registry * default. Default status listener can be overriden through the * $_SESSION['horde_notification']['override'] variable. */ $GLOBALS['notification'] = $injector->getInstance('Horde_Notification'); - if (isset($_SESSION['horde_notification']['override'])) { + if (Horde_Util::getFormData('ajaxui') && + isset($_SESSION['horde_notification']['override'])) { require_once $_SESSION['horde_notification']['override'][0]; $GLOBALS['notification']->attach('status', null, $_SESSION['horde_notification']['override'][1]); } else { diff --git a/gollem/lib/Gollem.php b/gollem/lib/Gollem.php index ce7d1f4a7..c9b76fe04 100644 --- a/gollem/lib/Gollem.php +++ b/gollem/lib/Gollem.php @@ -714,7 +714,9 @@ class Gollem $t->set('menu_string', Gollem::getMenu()->render()); echo $t->fetch(GOLLEM_TEMPLATES . '/menu.html'); - require HORDE_BASE . '/services/portal/sidebar.php'; + if (!Horde_Util::getFormData('ajaxui')) { + require HORDE_BASE . '/services/portal/sidebar.php'; + } } /** diff --git a/hermes/templates/menu.inc b/hermes/templates/menu.inc index 64e011b05..b63c007cc 100644 --- a/hermes/templates/menu.inc +++ b/hermes/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/horde/templates/admin/menu.inc b/horde/templates/admin/menu.inc index 981b35b37..38e23bf5a 100644 --- a/horde/templates/admin/menu.inc +++ b/horde/templates/admin/menu.inc @@ -15,5 +15,5 @@ ?> - -notify(array('listeners' => 'status')); + +notify(array('listeners' => 'status')); diff --git a/horde/templates/menu/menu.inc b/horde/templates/menu/menu.inc index 40cac39a8..f3b0d0729 100644 --- a/horde/templates/menu/menu.inc +++ b/horde/templates/menu/menu.inc @@ -10,4 +10,4 @@ - + diff --git a/imp/lib/Auth.php b/imp/lib/Auth.php index 4dbef871f..8dd116445 100644 --- a/imp/lib/Auth.php +++ b/imp/lib/Auth.php @@ -483,8 +483,6 @@ class IMP_Auth /* Suppress menus in options screen and indicate that notifications * should use the ajax mode. */ if ($sess['view'] == 'dimp') { - Horde_Core_Prefs_Ui::hideMenu(true); - $_SESSION['horde_prefs']['nomenu'] = true; $_SESSION['horde_notification']['override'] = array( IMP_BASE . '/lib/Notification/Listener/AjaxStatus.php', 'IMP_Notification_Listener_AjaxStatus' diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index fd23469b8..18072c720 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -600,7 +600,9 @@ class IMP { self::prepareMenu(); echo self::$_menuTemplate->fetch(IMP_TEMPLATES . '/imp/menu/menu.html'); - require HORDE_BASE . '/services/portal/sidebar.php'; + if (!Horde_Util::getFormData('ajaxui')) { + require HORDE_BASE . '/services/portal/sidebar.php'; + } } /** diff --git a/imp/templates/dimp/javascript_defs_dimp.php b/imp/templates/dimp/javascript_defs_dimp.php index 3127c4534..acb8108d1 100644 --- a/imp/templates/dimp/javascript_defs_dimp.php +++ b/imp/templates/dimp/javascript_defs_dimp.php @@ -45,7 +45,7 @@ $code['conf'] = array_filter(array( 'URI_DIMP' => (string) Horde::applicationUrl('index-dimp.php'), 'URI_MESSAGE' => (string) Horde::applicationUrl('message-dimp.php'), 'URI_PREFS' => (string) Horde::getServiceLink('prefsapi', 'imp'), - 'URI_PREFS_IMP' => str_replace('&', '&', (string) Horde::getServiceLink('options', 'imp')), + 'URI_PREFS_IMP' => str_replace('&', '&', (string) Horde::getServiceLink('options', 'imp')->add('ajaxui', 1)), 'URI_SEARCH' => (string) Horde::applicationUrl('search.php'), 'URI_VIEW' => (string) Horde::applicationUrl('view.php'), diff --git a/ingo/lib/Ingo.php b/ingo/lib/Ingo.php index 6fbab1679..252d7eba8 100644 --- a/ingo/lib/Ingo.php +++ b/ingo/lib/Ingo.php @@ -489,7 +489,9 @@ class Ingo { self::prepareMenu(); echo self::$_menuTemplate->fetch(INGO_TEMPLATES . '/menu/menu.html'); - require HORDE_BASE . '/services/portal/sidebar.php'; + if (!Horde_Util::getFormData('ajaxui')) { + require HORDE_BASE . '/services/portal/sidebar.php'; + } } /** diff --git a/kastalia/templates/menu.inc b/kastalia/templates/menu.inc index 1b4437e14..f049fef08 100755 --- a/kastalia/templates/menu.inc +++ b/kastalia/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/kronolith/index.php b/kronolith/index.php index bcfd997af..683a49dee 100644 --- a/kronolith/index.php +++ b/kronolith/index.php @@ -30,7 +30,6 @@ $today = new Horde_Date($_SERVER['REQUEST_TIME']); /* Suppress menus in options screen and indicate that notifications should use * the ajax mode. */ -Horde_Core_Prefs_Ui::hideMenu(true); $_SESSION['horde_notification']['override'] = array( KRONOLITH_BASE . '/lib/Notification/Listener/AjaxStatus.php', 'Kronolith_Notification_Listener_AjaxStatus' diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 9f0a6d231..43b51ea11 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -180,7 +180,7 @@ class Kronolith if (isset($GLOBALS['conf']['menu']['apps']) && is_array($GLOBALS['conf']['menu']['apps'])) { foreach ($GLOBALS['conf']['menu']['apps'] as $app) { - $app_urls[$app] = (string) Horde::url($registry->getInitialPage($app), true); + $app_urls[$app] = (string)Horde::url($registry->getInitialPage($app), true)->add('ajaxui', 1); } } @@ -200,7 +200,7 @@ class Kronolith 'exception' => (string)Horde_Themes::img('exception-fff.png'), ), 'user' => $GLOBALS['registry']->convertUsername($GLOBALS['registry']->getAuth(), false), - 'prefs_url' => str_replace('&', '&', Horde::getServiceLink('options', 'kronolith')), + 'prefs_url' => str_replace('&', '&', Horde::getServiceLink('options', 'kronolith')->add('ajaxui', 1)), 'app_urls' => $app_urls, 'name' => $registry->get('name'), 'has_tasks' => $has_tasks, diff --git a/kronolith/templates/menu.inc b/kronolith/templates/menu.inc index 1483c9e53..8c12cf737 100644 --- a/kronolith/templates/menu.inc +++ b/kronolith/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/luxor/templates/menu.inc b/luxor/templates/menu.inc index c9df7890c..c7fdbafec 100644 --- a/luxor/templates/menu.inc +++ b/luxor/templates/menu.inc @@ -17,5 +17,5 @@ function jump() - + notify(array('listeners' => 'status')) ?> diff --git a/mnemo/templates/menu.inc b/mnemo/templates/menu.inc index 49654b75b..f9268260a 100644 --- a/mnemo/templates/menu.inc +++ b/mnemo/templates/menu.inc @@ -1,4 +1,4 @@ - + diff --git a/nag/templates/menu.inc b/nag/templates/menu.inc index 0c6a24b3a..da55b68e1 100644 --- a/nag/templates/menu.inc +++ b/nag/templates/menu.inc @@ -1,5 +1,5 @@ - + render() ?> - + notify(array('listeners' => 'status')) ?> diff --git a/operator/templates/menu.inc b/operator/templates/menu.inc index d3c19df67..a45c4da78 100644 --- a/operator/templates/menu.inc +++ b/operator/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/pastie/templates/menu.inc b/pastie/templates/menu.inc index a3881937f..df3a62ac2 100644 --- a/pastie/templates/menu.inc +++ b/pastie/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/shout/templates/menu.inc b/shout/templates/menu.inc index e5d54a9cc..0eecd4ddf 100644 --- a/shout/templates/menu.inc +++ b/shout/templates/menu.inc @@ -55,4 +55,4 @@ function accountSubmit(clear) - + diff --git a/skeleton/templates/menu.inc b/skeleton/templates/menu.inc index c3ce3dfd5..513b3eac8 100644 --- a/skeleton/templates/menu.inc +++ b/skeleton/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/skoli/templates/menu.inc b/skoli/templates/menu.inc index c1174406e..893d639c0 100644 --- a/skoli/templates/menu.inc +++ b/skoli/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/trean/templates/menu.inc b/trean/templates/menu.inc index e21f50a58..3846eaa59 100644 --- a/trean/templates/menu.inc +++ b/trean/templates/menu.inc @@ -1,5 +1,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/turba/templates/menu.inc b/turba/templates/menu.inc index a9a510a5d..98445d790 100644 --- a/turba/templates/menu.inc +++ b/turba/templates/menu.inc @@ -13,5 +13,5 @@ - + notify(array('listeners' => 'status')) ?> diff --git a/whups/templates/menu.inc b/whups/templates/menu.inc index e2414d791..711ce0e14 100644 --- a/whups/templates/menu.inc +++ b/whups/templates/menu.inc @@ -8,6 +8,6 @@
- + notify(array('listeners' => 'status')) ?> diff --git a/wicked/templates/menu.inc b/wicked/templates/menu.inc index bf5ca94cd..b3afc4fab 100644 --- a/wicked/templates/menu.inc +++ b/wicked/templates/menu.inc @@ -20,5 +20,5 @@ function jump()
- -notify(array('listeners' => 'status')); + +notify(array('listeners' => 'status')); -- 2.11.0