From: Jan Schneider Date: Fri, 13 Feb 2009 00:32:12 +0000 (+0100) Subject: Status message support. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9ea3def87aff24eed2ac5cc75e497ca031a45b1c;p=horde.git Status message support. --- diff --git a/kronolith/js/src/kronolith.js b/kronolith/js/src/kronolith.js index 7214b1d3b..0e6cd59ae 100644 --- a/kronolith/js/src/kronolith.js +++ b/kronolith/js/src/kronolith.js @@ -53,12 +53,12 @@ KronolithCore = { 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); } @@ -77,7 +77,7 @@ KronolithCore = { // 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); } @@ -90,7 +90,7 @@ KronolithCore = { this.alertrequest = div; } - if (tmp = $('alertslog')) { + if (tmp = $('hordeAlertslog')) { switch (m.type) { case 'horde.error': log = Kronolith.text.alog_error; @@ -111,7 +111,7 @@ KronolithCore = { 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() + ']')))); @@ -131,7 +131,7 @@ KronolithCore = { 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); @@ -150,7 +150,7 @@ KronolithCore = { elt.remove(); if (!parent.childElements().size() && - parent.readAttribute('id') == 'ie6alertsfix') { + parent.readAttribute('id') == 'hordeIE6AlertsFix') { parent.remove(); } } catch (e) { @@ -553,9 +553,6 @@ KronolithCore = { _onResize: function(noupdate, nowait) { - if (this.viewport) { - this.viewport.onResize(noupdate, nowait); - } this._resizeIE6(); }, @@ -716,7 +713,7 @@ KronolithCore = { this.toggleAlertsLog(); break; - case 'alerts': + case 'hordeAlerts': this.alertsFade(elt); break; } diff --git a/kronolith/lib/Notification/Listener/status.php b/kronolith/lib/Notification/Listener/status.php new file mode 100644 index 000000000..ec792d60e --- /dev/null +++ b/kronolith/lib/Notification/Listener/status.php @@ -0,0 +1,88 @@ + + * @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; + } + +} diff --git a/kronolith/lib/base.php b/kronolith/lib/base.php index a7ad8d31c..a1801881b 100644 --- a/kronolith/lib/base.php +++ b/kronolith/lib/base.php @@ -61,7 +61,8 @@ require_once 'Horde/Help.php'; /* 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'; diff --git a/kronolith/templates/index/index.inc b/kronolith/templates/index/index.inc index ea218514d..fe8d93710 100644 --- a/kronolith/templates/index/index.inc +++ b/kronolith/templates/index/index.inc @@ -232,3 +232,13 @@ require dirname(__FILE__) . '/day.inc'; teste teste + +isBrowser('msie') && ($browser->getMajor() < 7))): ?> +
+
+
    +
  • +
+
+
+ diff --git a/kronolith/themes/print/screen.css b/kronolith/themes/print/screen.css index 97f6f57e2..116ba3dcc 100644 --- a/kronolith/themes/print/screen.css +++ b/kronolith/themes/print/screen.css @@ -55,3 +55,7 @@ table.monthgrid td.today { body.rightPanel #page { margin: 0; } + +#hordeAlertslog { + display: none !important; +} diff --git a/kronolith/themes/screen.css b/kronolith/themes/screen.css index c2adfbfbe..1227f2b7a 100644 --- a/kronolith/themes/screen.css +++ b/kronolith/themes/screen.css @@ -1119,3 +1119,10 @@ li.panel-tags { .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; +}