diff --git a/library/Icinga/Web/Response.php b/library/Icinga/Web/Response.php index 88d9e2302..d869f8f09 100644 --- a/library/Icinga/Web/Response.php +++ b/library/Icinga/Web/Response.php @@ -61,6 +61,13 @@ class Response extends Zend_Controller_Response_Http */ protected $rerenderLayout = false; + /** + * Whether to send the current window ID to the client + * + * @var bool + */ + protected $overrideWindowId = false; + /** * Get the auto-refresh interval * @@ -237,6 +244,29 @@ class Response extends Zend_Controller_Response_Http return $this; } + /** + * Get whether to send the current window ID to the client + * + * @return bool + */ + public function getOverrideWindowId() + { + return $this->overrideWindowId; + } + + /** + * Set whether to send the current window ID to the client + * + * @param bool $overrideWindowId + * + * @return $this + */ + public function setOverrideWindowId($overrideWindowId = true) + { + $this->overrideWindowId = $overrideWindowId; + return $this; + } + /** * Entry point for HTTP responses in JSON format * @@ -262,6 +292,9 @@ class Response extends Zend_Controller_Response_Http $this->setHeader('X-Icinga-Rerender-Layout', 'yes', true); } } + if ($this->getOverrideWindowId()) { + $this->setHeader('X-Icinga-WindowId', Window::getInstance()->getId(), true); + } if ($this->getRerenderLayout()) { $this->setHeader('X-Icinga-Container', 'layout', true); }