Do not use logarithm base from session if the timeline is not being extended

refs #4190
This commit is contained in:
Johannes Meyer 2014-03-27 10:57:03 +01:00
parent f7c6cd3c2a
commit 3d658a664c
3 changed files with 10 additions and 5 deletions

View File

@ -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) {

View File

@ -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();

View File

@ -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');
}