diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 7429d89c8..be0f32756 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -160,16 +160,22 @@ class ActionController extends Zend_Controller_Action * Return a window-aware session by using the given prefix * * @param string $prefix The prefix to use + * @param bool $reset Whether to reset any existing session-data * * @return SessionNamespace */ - public function getWindowSession($prefix) + public function getWindowSession($prefix, $reset = false) { $session = Session::getSession(); $windowId = $this->getWindowId(); - $namespace = $session->getNamespace($prefix . '_' . $windowId); - if ($windowId !== 'undefined' && $session->hasNamespace($prefix . '_undefined')) { + $identifier = $prefix . '_' . $windowId; + if ($reset && $session->hasNamespace($identifier)) { + $session->removeNamespace($identifier); + } + $namespace = $session->getNamespace($identifier); + + if (!$reset && $windowId !== 'undefined' && $session->hasNamespace($prefix . '_undefined')) { // We do not have any window-id on the very first request. Now we add all values from the // namespace, that has been created in this case, to the new one and remove it afterwards. foreach ($session->getNamespace($prefix . '_undefined') as $name => $value) { diff --git a/modules/monitoring/application/controllers/TimelineController.php b/modules/monitoring/application/controllers/TimelineController.php index d7343e054..7bebb6d82 100644 --- a/modules/monitoring/application/controllers/TimelineController.php +++ b/modules/monitoring/application/controllers/TimelineController.php @@ -66,7 +66,7 @@ class Monitoring_TimelineController extends ActionController $timeline->setMinimumCircleWidth('0.15em'); $timeline->setDisplayRange($displayRange); $timeline->setForecastRange($forecastRange); - $timeline->setSession($this->getWindowSession('timeline')); + $timeline->setSession($this->getWindowSession('timeline', $this->getRequest()->getParam('extend') != 1)); $this->view->timeline = $timeline; $this->view->intervalFormat = $this->getIntervalFormat(); diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php index bb2651ea2..88396a43f 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php @@ -270,7 +270,6 @@ class TimeLine implements IteratorAggregate { if ($this->calculationBase === null) { if ($this->session !== null) { - // TODO: Do not use this if the interval has changed or the user did a reload $this->calculationBase = $this->session->get('calculationBase'); }