From: Jan Schneider Date: Tue, 27 Apr 2010 12:45:14 +0000 (+0200) Subject: Use ajax notifications from iframe pages. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3771519a814ad4dfb90d0e70c1d7a0e92a1bdab5;p=horde.git Use ajax notifications from iframe pages. --- diff --git a/kronolith/index.php b/kronolith/index.php index 1781e8858..7951b131a 100644 --- a/kronolith/index.php +++ b/kronolith/index.php @@ -27,7 +27,14 @@ if ($help_link) { $help_link = Horde::widget($help_link, _("Help"), 'helplink', 'help', Horde::popupJs($help_link, array('urlencode' => true)) . 'return false;'); } $today = new Horde_Date($_SERVER['REQUEST_TIME']); + +/* Suppress menus in options screen and indicate that notifications should use + * the ajax mode. */ Horde_Core_Prefs_Ui::hideMenu(true); +$_SESSION['horde_notification']['override'] = array( + KRONOLITH_BASE . '/lib/Notification/Listener/AjaxStatus.php', + 'Kronolith_Notification_Listener_AjaxStatus' +); $alarm_methods = $alarm_params = ''; foreach (Horde_Alarm::notificationMethods() as $method => $params) { diff --git a/kronolith/lib/Notification/Listener/AjaxStatus.php b/kronolith/lib/Notification/Listener/AjaxStatus.php new file mode 100644 index 000000000..6107180ff --- /dev/null +++ b/kronolith/lib/Notification/Listener/AjaxStatus.php @@ -0,0 +1,30 @@ + + * @package Kronolith + */ +class Kronolith_Notification_Listener_AjaxStatus extends Horde_Notification_Listener_Status +{ + /** + * Outputs the status line if there are any messages on the 'status' + * message stack. + * + * @param array $events The list of events to handle. + * @param array $options An array of options. Not used. + */ + public function notify($events, $options = array()) + { + Horde::addInlineScript(array( + 'if (window.KronolithCore || parent.KronolithCore) { (window.KronolithCore || parent.KronolithCore).showNotifications(' . Horde_Serialize::serialize($events, Horde_Serialize::JSON) . ') }' + ), 'dom'); + } + +}