Move notification init to Horde_Registry_Application
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 19 Jan 2010 23:26:09 +0000 (16:26 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 19 Jan 2010 23:26:09 +0000 (16:26 -0700)
framework/Core/lib/Horde/Registry/Application.php
gollem/lib/Application.php
horde/lib/Application.php
hylax/lib/Application.php
imp/lib/Application.php
kronolith/lib/Application.php
skeleton/lib/Application.php
turba/lib/Application.php

index 360caf6..28bc502 100644 (file)
@@ -61,6 +61,9 @@ class Horde_Registry_Application
      * Initialization. Does any necessary init needed to setup the full
      * environment for the application.
      *
+     * Global variables defined:
+     *   $notification - Notification object.
+     *
      * Global constants defined:
      *   [APPNAME]_TEMPLATES - (string) Location of template files.
      */
@@ -74,6 +77,9 @@ class Horde_Registry_Application
                 define($appname . '_TEMPLATES', $GLOBALS['registry']->get('templates'));
             }
 
+            $GLOBALS['notification'] = Horde_Notification::singleton();
+            $this->_initNotification($GLOBALS['notification']);
+
             $this->_init();
         }
     }
@@ -86,4 +92,15 @@ class Horde_Registry_Application
     {
     }
 
+    /**
+     * Initialization for Notification system.
+     *
+     * @param Horde_Notification_Handler_Base $notify  The notification
+     *                                                 object.
+     */
+    protected function _initNotification($notify)
+    {
+        $notify->attach('status');
+    }
+
 }
index f33b249..be71518 100644 (file)
@@ -49,14 +49,9 @@ class Gollem_Application extends Horde_Registry_Application
      *   $gollem_backends - A link to the current list of available backends
      *   $gollem_be - A link to the current backend parameters in the session
      *   $gollem_vfs - A link to the current VFS object for the active backend
-     *   $notification - Notification object
      */
     protected function _init()
     {
-        // Notification system.
-        $GLOBALS['notification'] = Horde_Notification::singleton();
-        $GLOBALS['notification']->attach('status');
-
         // Set the global $gollem_be variable to the current backend's
         // parameters.
         $GLOBALS['gollem_be'] = empty($_SESSION['gollem']['backend_key'])
index 7bb5a7d..b56ebd3 100644 (file)
@@ -25,18 +25,6 @@ class Horde_Application extends Horde_Registry_Application
     public $version = '4.0-git';
 
     /**
-     * Application initialization.
-     *
-     * Global variables defined:
-     *   $notification - Notification object
-     */
-    protected function _init()
-    {
-        $GLOBALS['notification'] = Horde_Notification::singleton();
-        $GLOBALS['notification']->attach('status');
-    }
-
-    /**
      * Returns a list of available permissions.
      *
      * @return array  TODO
index 8ac5ff9..679f5db 100644 (file)
@@ -38,11 +38,6 @@ class Hylax_Application extends Horde_Registry_Application
 
     protected function _init()
     {
-        /* Notification system. */
-        $notification = Horde_Notification::singleton();
-        $notification->attach('status');
-        $GLOBALS['notification'] = &$notification;
-
         /* Hylax Driver */
         $this->gateway = Hylax_Driver::singleton($conf['fax']['driver'],
                                                  $conf['fax']['params']);
index 96b9e63..0a2ee78 100644 (file)
@@ -85,9 +85,7 @@ class IMP_Application extends Horde_Registry_Application
      * Global variables defined:
      *   $imp_imap     - An IMP_Imap object
      *   $imp_mbox     - Current mailbox information
-     *   $imp_notify   - A Horde_Notification_Listener object
      *   $imp_search   - An IMP_Search object
-     *   $notification - Notification object
      *
      * When calling Horde_Registry::appInit(), the following parameters are
      * also supported:
@@ -115,21 +113,32 @@ class IMP_Application extends Horde_Registry_Application
             Horde_Mime_Headers::$defaultCharset = $def_charset;
         }
 
-        $GLOBALS['notification'] = Horde_Notification::singleton();
+        // Initialize global $imp_mbox array. This call also initializes the
+        // IMP_Search object.
+        IMP::setCurrentMailboxInfo();
+    }
+
+    /**
+     * Initialization for Notification system.
+     *
+     * Global variables defined:
+     *   $imp_notify   - A Horde_Notification_Listener object
+     *
+     * @param Horde_Notification_Handler_Base $notify  The notification
+     *                                                 object.
+     */
+    protected function _initNotification($notify)
+    {
         $viewmode = IMP::getViewMode();
 
         if ($viewmode == 'mimp') {
-            $GLOBALS['imp_notify'] = $GLOBALS['notification']->attach('status', null, 'IMP_Notification_Listener_StatusMobile');
+            $GLOBALS['imp_notify'] = $notify->attach('status', null, 'IMP_Notification_Listener_StatusMobile');
         } else {
-            $GLOBALS['imp_notify'] = $GLOBALS['notification']->attach('status', array('viewmode' => $viewmode), 'IMP_Notification_Listener_Status');
+            $GLOBALS['imp_notify'] = $notify->attach('status', array('viewmode' => $viewmode), 'IMP_Notification_Listener_Status');
             if ($viewmode == 'imp') {
-                $GLOBALS['notification']->attach('audio');
+                $notify->attach('audio');
             }
         }
-
-        // Initialize global $imp_mbox array. This call also initializes the
-        // IMP_Search object.
-        IMP::setCurrentMailboxInfo();
     }
 
     /* Horde permissions. */
index c5ce69b..b6772ce 100644 (file)
@@ -43,9 +43,7 @@ class Kronolith_Application extends Horde_Registry_Application
      * Initialization function.
      *
      * Global variables defined:
-     *   $kronolith_notify - A Horde_Notification_Listener object
      *   $kronolith_shares - TODO
-     *   $notification - Notification object
      *
      * When calling Horde_Registry::appInit(), the following parameters are
      * also supported:
@@ -67,10 +65,6 @@ class Kronolith_Application extends Horde_Registry_Application
             throw new Horde_Exception('The Content_Tagger class could not be found. Make sure the registry entry for the Content system is present.');
         }
 
-        /* Notification system. */
-        $GLOBALS['notification'] = Horde_Notification::singleton();
-        $GLOBALS['kronolith_notify'] = $GLOBALS['notification']->attach('status', null, 'Kronolith_Notification_Listener_Status');
-
         /* Set the timezone variable, if available. */
         Horde_Nls::setTimeZone();
 
@@ -81,6 +75,20 @@ class Kronolith_Application extends Horde_Registry_Application
     }
 
     /**
+     * Initialization for Notification system.
+     *
+     * Global variables defined:
+     *   $kronolith_notify - A Horde_Notification_Listener object.
+     *
+     * @param Horde_Notification_Handler_Base $notify  The notification
+     *                                                 object.
+     */
+    protected function _initNotification($notify)
+    {
+        $GLOBALS['kronolith_notify'] = $notify->attach('status', null, 'Kronolith_Notification_Listener_Status');
+    }
+
+    /**
      * Returns a list of available permissions.
      *
      * @return array  An array describing all available permissions.
index 81a33cc..6322068 100644 (file)
@@ -40,19 +40,6 @@ class Skeleton_Application extends Horde_Registry_Application
     public $version = 'H4 (0.1-git)';
 
     /**
-     * Initialization function.
-     *
-     * Global variables defined:
-     *   $notification - Notification object
-     */
-    protected function _init()
-    {
-        // Notification system.
-        $notification = Horde_Notification::singleton();
-        $notification->attach('status');
-    }
-
-    /**
      * Generate the menu to use on the prefs page.
      *
      * @return Horde_Menu  A Horde_Menu object.
index 22dba10..6965299 100644 (file)
@@ -50,7 +50,6 @@ class Turba_Application extends Horde_Registry_Application
      *   $cfgSources   - TODO
      *   $copymove_source_options - TODO
      *   $copymoveSources - TODO
-     *   $notification - Notification object
      *   $turba_shares - TODO
      *
      * When calling Horde_Registry::appInit(), the following parameters are
@@ -65,9 +64,6 @@ class Turba_Application extends Horde_Registry_Application
             Horde_Auth::setAuth($this->initParams['user'], array());
         }
 
-        $GLOBALS['notification'] = Horde_Notification::singleton();
-        $GLOBALS['notification']->attach('status');
-
         // Turba source and attribute configuration.
         include TURBA_BASE . '/config/attributes.php';
         include TURBA_BASE . '/config/sources.php';