static public function notify()
{
$GLOBALS['notification']->notify(array('listeners' => 'status'));
- $msgs = $GLOBALS['imp_notify']->getStack(true);
+ $msgs = $GLOBALS['imp_notify']->getStack();
return count($msgs)
? 'DimpCore.showNotifications(' . Horde_Serialize::serialize($msgs, Horde_Serialize::JSON) . ')'
<?php
/**
* The IMP_Notification_Listener_StatusDimp:: class extends the
- * IMP_Notification_Listener_StatusImp:: class to return all messages instead
- * of printing them.
+ * 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/)
*
class IMP_Notification_Listener_StatusDimp extends IMP_Notification_Listener_StatusImp
{
/**
- * The notified message stack.
- *
- * @var array
- */
- protected $_messageStack = array();
-
- /**
- * 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())
- {
- while ($message = array_shift($messageStack)) {
- $event = @unserialize($message['event']);
- $this->_messageStack[] = array('type' => $message['type'],
- 'flags' => $message['flags'],
- 'message' => is_object($event)
- ? $event->getMessage()
- : null);
- }
- }
-
- /**
* Handle every message of type dimp.*; otherwise delegate back to
* the parent.
*
}
/**
- * Returns the message stack.
- * To return something useful, notify() needs to be called first.
- *
- * @param boolean $encode Encode HTML entities?
+ * Returns all status message if there are any on the 'status' message
+ * stack.
*
- * @return array List of message hashes.
+ * @param array &$messageStack The stack of messages.
+ * @param array $options An array of options.
*/
- public function getStack($encode = false)
+ public function notify(&$messageStack, $options = array())
{
- $msgs = $this->_messageStack;
- if (!$encode) {
- return $msgs;
+ /* 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;
}
-
- for ($i = 0, $mcount = count($msgs); $i < $mcount; ++$i) {
- if (!in_array('content.raw', $this->getFlags($msgs[$i]))) {
- $msgs[$i]['message'] = htmlspecialchars($msgs[$i]['message'], ENT_COMPAT, NLS::getCharset());
- }
- }
-
- return $msgs;
+ parent::notify($messageStack, $options);
}
}
/**
* The IMP_Notification_Listener_StatusImp:: class extends the
* Notification_Listener_status:: class to display the messages for
- * IMP's special message types 'imp.forward' and 'imp.reply'.
+ * IMP's special message types.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @package Horde_Notification
public function __construct()
{
parent::__construct();
- $this->_handles['imp.reply'] = true;
- $this->_handles['imp.forward'] = true;
- $this->_handles['imp.redirect'] = true;
- }
-
- /**
- * Outputs one message if it's an IMP message or calls the parent
- * method otherwise.
- *
- * @param array $message One message hash from the stack.
- */
- public function getMessage($message)
- {
- $event = $this->getEvent($message);
- switch ($message['type']) {
- case 'imp.reply':
- return '<p class="notice">' . Horde::img('mail_answered.png') . ' ' . $event->getMessage() . '</p>';
- case 'imp.forward':
- case 'imp.redirect':
- return '<p class="notice">' . Horde::img('mail_forwarded.png') . ' ' . $event->getMessage() . '</p>';
- }
+ $image_dir = $GLOBALS['registry']->getImageDir();
- return parent::getMessage($message);
+ $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"));
}
}
<?php
/**
* The Kronolith_Notification_Listener_Status:: class extends the
- * Horde_Notification_Listener_Status:: class to return all messages instead
- * of printing them.
+ * Horde_Notification_Listener_Status:: class to return all kronolith 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.
*
- * @todo Move this into Notification core functionality
* @author Jan Schneider <jan@horde.org>
* @package Horde_Notification
*/
class Kronolith_Notification_Listener_Status extends Horde_Notification_Listener_Status
{
/**
- * The notified message stack.
- *
- * @var array
- */
- protected $_messageStack = array();
-
- /**
- * 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())
- {
- while ($message = array_shift($messageStack)) {
- $event = @unserialize($message['event']);
- $this->_messageStack[] = array('type' => $message['type'],
- 'flags' => $message['flags'],
- 'message' => is_object($event)
- ? $event->getMessage()
- : null);
- }
- }
-
- /**
* Handle every message of type dimp.*; otherwise delegate back to
* the parent.
*
}
/**
- * Returns the message stack.
- * To return something useful, notify() needs to be called first.
- *
- * @param boolean $encode Encode HTML entities?
+ * Returns all status message if there are any on the 'status' message
+ * stack.
*
- * @return array List of message hashes.
+ * @param array &$messageStack The stack of messages.
+ * @param array $options An array of options.
*/
- public function getStack($encode = false)
+ public function notify(&$messageStack, $options = array())
{
- $msgs = $this->_messageStack;
- if (!$encode) {
- return $msgs;
+ /* 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;
}
-
- for ($i = 0, $mcount = count($msgs); $i < $mcount; ++$i) {
- if (!in_array('content.raw', $this->getFlags($msgs[$i]))) {
- $msgs[$i]['message'] = htmlspecialchars($msgs[$i]['message'], ENT_COMPAT, NLS::getCharset());
- }
- }
-
- return $msgs;
+ parent::notify($messageStack, $options);
}
}