JS/XHR: handle multiple notifications

As there seems to be problems with sending the same header multiple
times we put multiple notifications in one header.
This commit is contained in:
Thomas Gelf 2014-06-20 13:20:20 +02:00
parent 617741c62f
commit 07134cf931
1 changed files with 3 additions and 1 deletions

View File

@ -439,9 +439,11 @@ class ActionController extends Zend_Controller_Action
$notifications = Notification::getInstance(); $notifications = Notification::getInstance();
if ($isXhr && ! $this->isRedirect && $notifications->hasMessages()) { if ($isXhr && ! $this->isRedirect && $notifications->hasMessages()) {
$notificationList = array();
foreach ($notifications->getMessages() as $m) { foreach ($notifications->getMessages() as $m) {
header('X-Icinga-Notification: ' . rawurlencode($m->type . ' ' . $m->message)); $notificationList[] = rawurlencode($m->type . ' ' . $m->message);
} }
header('X-Icinga-Notification: ' . implode('&', $notificationList));
} }
if ($isXhr && ($this->reloadCss || $this->getParam('_reload') === 'css')) { if ($isXhr && ($this->reloadCss || $this->getParam('_reload') === 'css')) {