Don't store in the session whether to hide the sidebar/menu or attach the ajax
authorJan Schneider <jan@horde.org>
Tue, 29 Jun 2010 16:02:16 +0000 (18:02 +0200)
committerJan Schneider <jan@horde.org>
Tue, 29 Jun 2010 16:03:45 +0000 (18:03 +0200)
notification listener. Instead, do this per request and pass the request
parameter through with Horde::url(). Fixes bug 9017.

34 files changed:
ansel/templates/menu.inc
beatnik/templates/menu.inc
chora/templates/menu.inc
crumb/templates/menu.inc
fima/templates/menu.inc
folks/templates/menu.inc
framework/Core/lib/Horde.php
framework/Core/lib/Horde/Core/Prefs/Ui.php
framework/Core/lib/Horde/Registry.php
gollem/lib/Gollem.php
hermes/templates/menu.inc
horde/templates/admin/menu.inc
horde/templates/menu/menu.inc
imp/lib/Auth.php
imp/lib/IMP.php
imp/templates/dimp/javascript_defs_dimp.php
ingo/lib/Ingo.php
kastalia/templates/menu.inc
kronolith/index.php
kronolith/lib/Kronolith.php
kronolith/templates/menu.inc
luxor/templates/menu.inc
mnemo/templates/menu.inc
nag/templates/menu.inc
news/templates/menu.inc
operator/templates/menu.inc
pastie/templates/menu.inc
shout/templates/menu.inc
skeleton/templates/menu.inc
skoli/templates/menu.inc
trean/templates/menu.inc
turba/templates/menu.inc
whups/templates/menu.inc
wicked/templates/menu.inc

index 9001340..0fb2e81 100644 (file)
@@ -1,7 +1,5 @@
 <div id="menu">
  <?php echo Ansel::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
-
-<?php
-$GLOBALS['notification']->notify(array('listeners' => 'status'));
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php $GLOBALS['notification']->notify(array('listeners' => 'status')); ?>
index 56455b4..48b2d43 100644 (file)
@@ -37,5 +37,5 @@ $menu_view = $prefs->getValue('menu_view');
 </span>
 <?php echo Beatnik::getMenu('string') ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index 4224b9f..f6d1648 100644 (file)
@@ -4,5 +4,5 @@
  </div>
  <?php echo Chora::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index a77bfd5..e8d056f 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Crumb::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index b6395f4..613cfca 100644 (file)
@@ -37,5 +37,5 @@ function ledgerSubmit(clear)
     }
 }
 </script>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index ddb1d82..c38fc01 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Folks::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index 720241b..87924ce 100644 (file)
@@ -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;
     }
 
index 4276d5e..c8b1de4 100644 (file)
@@ -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';
         }
 
index 9646ab5..ca1f102 100644 (file)
@@ -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 {
index ce7d1f4..c9b76fe 100644 (file)
@@ -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';
+        }
     }
 
     /**
index 64e011b..b63c007 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Hermes::getMenu('string') ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index 981b35b..38e23bf 100644 (file)
@@ -15,5 +15,5 @@
 ?>
  </div>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
-<?php $notification->notify(array('listeners' => 'status'));
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php $GLOBALS['notification']->notify(array('listeners' => 'status'));
index 40cac39..f3b0d07 100644 (file)
@@ -10,4 +10,4 @@
 <div id="menu">
  <div class="leftFloat"><?php echo $menu->render(); ?></div>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
index 4dbef87..8dd1164 100644 (file)
@@ -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'
index fd23469..18072c7 100644 (file)
@@ -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';
+        }
     }
 
     /**
index 3127c45..acb8108 100644 (file)
@@ -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('&amp;', '&', (string) Horde::getServiceLink('options', 'imp')),
+    'URI_PREFS_IMP' => str_replace('&amp;', '&', (string) Horde::getServiceLink('options', 'imp')->add('ajaxui', 1)),
     'URI_SEARCH' => (string) Horde::applicationUrl('search.php'),
     'URI_VIEW' => (string) Horde::applicationUrl('view.php'),
 
index 6fbab16..252d7eb 100644 (file)
@@ -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';
+        }
     }
 
     /**
index 1b4437e..f049fef 100755 (executable)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Kastalia::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index bcfd997..683a49d 100644 (file)
@@ -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'
index 9f0a6d2..43b51ea 100644 (file)
@@ -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('&amp;', '&', Horde::getServiceLink('options', 'kronolith')),
+            'prefs_url' => str_replace('&amp;', '&', Horde::getServiceLink('options', 'kronolith')->add('ajaxui', 1)),
             'app_urls' => $app_urls,
             'name' => $registry->get('name'),
             'has_tasks' => $has_tasks,
index 1483c9e..8c12cf7 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Kronolith::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index c9df789..c7fdbaf 100644 (file)
@@ -17,5 +17,5 @@ function jump()
 </div>
 </form>
 
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index 49654b7..f926826 100644 (file)
@@ -1,4 +1,4 @@
 <div id="menu">
  <?php echo Mnemo::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
index 0c6a24b..da55b68 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Nag::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php Nag::status();
index d3fe6c2..28a32b7 100644 (file)
@@ -10,5 +10,5 @@
 </div>
 <?php echo News::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index d3c19df..a45c4da 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Operator::getMenu('string') ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index a388193..df3a62a 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Pastie::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index e5d54a9..0eecd4d 100644 (file)
@@ -55,4 +55,4 @@ function accountSubmit(clear)
 
   <?php echo Shout::getMenu('string') ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
index c3ce3df..513b3ea 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Skeleton::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index c117440..893d639 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Skoli::getMenu()->render() ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index e21f50a..3846eaa 100644 (file)
@@ -1,5 +1,5 @@
 <div id="menu">
  <?php echo Trean::getMenu('string') ?>
 </div>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index a9a510a..98445d7 100644 (file)
@@ -13,5 +13,5 @@
  </div>
 </div>
 </form>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index e2414d7..711ce0e 100644 (file)
@@ -8,6 +8,6 @@
  <br class="clear" />
 </div>
 </form>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
 <?php echo Horde_Util::nonInputVar('menuBottom'); ?>
 <?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
index bf5ca94..b3afc4f 100644 (file)
@@ -20,5 +20,5 @@ function jump()
  <br class="clear" />
 </div>
 </form>
-<?php require HORDE_BASE . '/services/portal/sidebar.php'; ?>
-<?php $notification->notify(array('listeners' => 'status'));
+<?php if (!Horde_Util::getFormData('ajaxui')) require HORDE_BASE . '/services/portal/sidebar.php'; ?>
+<?php $GLOBALS['notification']->notify(array('listeners' => 'status'));