case 'kronolith.request':
case 'kronolith.sticky':
var iefix, log, tmp,
- alerts = $('alerts'),
+ alerts = $('hordeAlerts'),
div = new Element('DIV', { className: m.type.replace('.', '-') }),
msg = m.message;
if (!alerts) {
- alerts = new Element('DIV', { id: 'alerts' });
+ alerts = new Element('DIV', { id: 'hordeAlerts' });
$(document.body).insert(alerts);
}
// overlay the div with a like sized div containing a clear
// gif, which tricks IE into the correct behavior.
if (Kronolith.conf.is_ie6) {
- iefix = new Element('DIV', { id: 'ie6alertsfix' }).clonePosition(div, { setLeft: false, setTop: false });
+ iefix = new Element('DIV', { id: 'hordeIE6AlertsFix' }).clonePosition(div, { setLeft: false, setTop: false });
iefix.insert(div.remove());
alerts.insert(iefix);
}
this.alertrequest = div;
}
- if (tmp = $('alertslog')) {
+ if (tmp = $('hordeAlertslog')) {
switch (m.type) {
case 'horde.error':
log = Kronolith.text.alog_error;
if (log) {
tmp = tmp.down('DIV UL');
- if (tmp.down().hasClassName('noalerts')) {
+ if (tmp.down().hasClassName('hordeNoalerts')) {
tmp.down().remove();
}
tmp.insert(new Element('LI').insert(new Element('P', { className: 'label' }).insert(log)).insert(new Element('P', { className: 'indent' }).insert(msg).insert(new Element('SPAN', { className: 'alertdate'}).insert('[' + (new Date).toLocaleString() + ']'))));
toggleAlertsLog: function()
{
var alink = $('alertsloglink').down('A'),
- div = $('alertslog').down('DIV'),
+ div = $('hordeAlertslog').down('DIV'),
opts = { duration: 0.5 };
if (div.visible()) {
Effect.BlindUp(div, opts);
elt.remove();
if (!parent.childElements().size() &&
- parent.readAttribute('id') == 'ie6alertsfix') {
+ parent.readAttribute('id') == 'hordeIE6AlertsFix') {
parent.remove();
}
} catch (e) {
_onResize: function(noupdate, nowait)
{
- if (this.viewport) {
- this.viewport.onResize(noupdate, nowait);
- }
this._resizeIE6();
},
this.toggleAlertsLog();
break;
- case 'alerts':
+ case 'hordeAlerts':
this.alertsFade(elt);
break;
}
--- /dev/null
+<?php
+
+require_once 'Horde/Notification/Listener/status.php';
+require_once 'Horde/Notification/Event.php';
+
+/**
+ * The Notification_Listener_status_kronolith:: class extends the
+ * Notification_Listener_status:: class to return all 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 Notification_Listener_status_kronolith extends Notification_Listener_status {
+
+ /**
+ * The notified message stack.
+ *
+ * @var array
+ */
+ var $_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.
+ */
+ 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.
+ *
+ * @param string $type The message type in question.
+ *
+ * @return boolean Whether this listener handles the type.
+ */
+ function handles($type)
+ {
+ if (substr($type, 0, 10) == 'kronolith.') {
+ return true;
+ }
+ return parent::handles($type);
+ }
+
+ /**
+ * Returns the message stack.
+ * To return something useful, notify() needs to be called first.
+ *
+ * @param boolean $encode Encode HTML entities?
+ *
+ * @return array List of message hashes.
+ */
+ function getStack($encode = false)
+ {
+ $msgs = $this->_messageStack;
+ if (!$encode) {
+ return $msgs;
+ }
+
+ 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;
+ }
+
+}
/* Notification system. */
$notification = &Notification::singleton();
-$notification->attach('status');
+require_once KRONOLITH_BASE . '/lib/Notification/Listener/status.php';
+$GLOBALS['kronolith_notify'] = &$notification->attach('status', null, 'Notification_Listener_status_kronolith');
/* Kronolith base library. */
require_once KRONOLITH_BASE . '/lib/Kronolith.php';
<a href="#">teste</a>
<a href="#">teste</a>
</div>
+
+<?php if (!($browser->isBrowser('msie') && ($browser->getMajor() < 7))): ?>
+<div id="hordeAlertslog">
+ <div style="display:none">
+ <ul>
+ <li class="hordeNoalerts"><strong><?php echo _("No Alerts") ?></strong></li>
+ </ul>
+ </div>
+</div>
+<?php endif; ?>
body.rightPanel #page {
margin: 0;
}
+
+#hordeAlertslog {
+ display: none !important;
+}
.panel-tags li:hover {
text-decoration: underline;
}
+
+#hordeAlerts div.kronolith-sticky, #hordeAlerts div.kronolith-sticky {
+ background-color: #ebe20c;
+ background-image: url("graphics/warning.png");
+ border-color: #807b00;
+ color: #000;
+}