--- /dev/null
+<?php
+/**
+ * The IMP_Notification_Listener_Status:: class extends the
+ * Horde_Notification_Listener_Status:: class to display the messages for
+ * IMP's special message types.
+ *
+ * @author Jan Schneider <jan@horde.org>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @package Horde_Notification
+ */
+class IMP_Notification_Listener_Status extends Horde_Notification_Listener_Status
+{
+ /**
+ * The view mode.
+ *
+ * @var string
+ */
+ protected $_viewmode;
+
+ /**
+ * Constructor.
+ *
+ * @param array $options One option required: 'viewmode'.
+ */
+ public function __construct($options)
+ {
+ parent::__construct();
+
+ $this->_viewmode = $options['viewmode'];
+
+ $image_dir = $GLOBALS['registry']->getImageDir();
+
+ $this->_handles['imp.reply'] = array($image_dir . '/mail_answered.png', _("Reply"));
+ $this->_handles['imp.forward'] = array($image_dir . '/mail_forwarded.png', _("Reply"));
+ $this->_handles['imp.redirect'] = array($image_dir . '/mail_forwarded.png', _("Redirect"));
+ }
+
+ /**
+ * Handle every message of type dimp.*; otherwise delegate back to
+ * the parent.
+ *
+ * @param string $type The message type in question.
+ *
+ * @return boolean Whether this listener handles the type.
+ */
+ public function handles($type)
+ {
+ return (($this->_viewmode == 'dimp') &&
+ (substr($type, 0, 5) == 'dimp.')) ||
+ parent::handles($type);
+ }
+
+ /**
+ * Returns all status message if there are any on the 'status' message
+ * stack.
+ *
+ * @param array &$messageStack The stack of messages.
+ * @param array $options An array of options.
+ */
+ public function notify(&$messageStack, $options = array())
+ {
+ /* For dimp, don't capture notification messages if we are logging
+ * out or accessing the options pages. */
+ if (($this->_viewmode == 'dimp') &&
+ Auth::getAuth() && !strstr($_SERVER['PHP_SELF'], '/prefs.php')) {
+ $options['store'] = true;
+ }
+ parent::notify($messageStack, $options);
+ }
+
+}
+++ /dev/null
-<?php
-/**
- * The IMP_Notification_Listener_StatusDimp:: class extends the
- * IMP_Notification_Listener_StatusImp:: class to return all dimp specific
- * messages instead of printing them.
- *
- * Copyright 2005-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (GPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
- *
- * @author Jan Schneider <jan@horde.org>
- * @package Horde_Notification
- */
-class IMP_Notification_Listener_StatusDimp extends IMP_Notification_Listener_StatusImp
-{
- /**
- * Handle every message of type dimp.*; otherwise delegate back to
- * the parent.
- *
- * @param string $type The message type in question.
- *
- * @return boolean Whether this listener handles the type.
- */
- public function handles($type)
- {
- return (substr($type, 0, 5) == 'dimp.') || parent::handles($type);
- }
-
- /**
- * Returns all status message if there are any on the 'status' message
- * stack.
- *
- * @param array &$messageStack The stack of messages.
- * @param array $options An array of options.
- */
- public function notify(&$messageStack, $options = array())
- {
- /* Don't capture notification messages if we are logging out are
- * accessing the options pages. */
- if (Auth::getAuth() && !strstr($_SERVER['PHP_SELF'], '/prefs.php')) {
- $options['store'] = true;
- }
- parent::notify($messageStack, $options);
- }
-
-}
+++ /dev/null
-<?php
-/**
- * The IMP_Notification_Listener_StatusImp:: class extends the
- * Notification_Listener_status:: class to display the messages for
- * IMP's special message types.
- *
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @package Horde_Notification
- */
-class IMP_Notification_Listener_StatusImp extends Horde_Notification_Listener_Status
-{
- /**
- * Constructor.
- */
- public function __construct()
- {
- parent::__construct();
-
- $image_dir = $GLOBALS['registry']->getImageDir();
-
- $this->_handles['imp.reply'] = array($image_dir . '/mail_answered.png', _("Reply"));
- $this->_handles['imp.forward'] = array($image_dir . '/mail_forwarded.png', _("Reply"));
- $this->_handles['imp.redirect'] = array($image_dir . '/mail_forwarded.png', _("Redirect"));
- }
-
-}
if (($viewmode == 'mimp') ||
(Horde_Util::nonInputVar('login_page') && $GLOBALS['browser']->isMobile())) {
$GLOBALS['imp_notify'] = &$notification->attach('status', null, 'Horde_Notification_Listener_Mobile');
-} elseif ($viewmode == 'dimp') {
- $GLOBALS['imp_notify'] = &$notification->attach('status', null, 'IMP_Notification_Listener_StatusDimp');
} else {
- $GLOBALS['imp_notify'] = &$notification->attach('status', null, 'IMP_Notification_Listener_StatusImp');
- $notification->attach('audio');
+ $GLOBALS['imp_notify'] = &$notification->attach('status', array('viewmode' => $viewmode), 'IMP_Notification_Listener_Status');
+ if ($viewmode == 'imp') {
+ $notification->attach('audio');
+ }
}
// Initialize global $imp_mbox array.