From ade8d078df41eea211b492b5737c5d75707bc5e3 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 8 Jul 2018 15:28:55 -0400 Subject: [PATCH 1/3] Define minTimeSecs and maxTimeSecs --- web/skins/classic/views/montagereview.php | 1 + 1 file changed, 1 insertion(+) diff --git a/web/skins/classic/views/montagereview.php b/web/skins/classic/views/montagereview.php index a3dad631b..2a581c55d 100644 --- a/web/skins/classic/views/montagereview.php +++ b/web/skins/classic/views/montagereview.php @@ -191,6 +191,7 @@ if ( isset($_REQUEST['displayinterval']) ) #$eventsSql .= ' GROUP BY E.Id,E.Name,E.StartTime,E.Length,E.Frames,E.MaxScore,E.Cause,E.Notes,E.Archived,E.MonitorId'; +$minTimeSecs = $maxTimeSecs = 0; if ( isset($minTime) && isset($maxTime) ) { $minTimeSecs = strtotime($minTime); $maxTimeSecs = strtotime($maxTime); From 4a4e845e9cf96cb1e6f7b893bb7c7fe213df85de Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 8 Jul 2018 16:24:53 -0400 Subject: [PATCH 2/3] Fix stupid code that defaulted minTimeSecs to 2010 instead of the first event --- web/skins/classic/views/js/montagereview.js.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/web/skins/classic/views/js/montagereview.js.php b/web/skins/classic/views/js/montagereview.js.php index 61e1c9e32..47e832acb 100644 --- a/web/skins/classic/views/js/montagereview.js.php +++ b/web/skins/classic/views/js/montagereview.js.php @@ -30,10 +30,6 @@ var timeLabelsFractOfRow = 0.9; // Because we might not have time as the criteria, figure out the min/max time when we run the query -if ( ! $maxTimeSecs ) - $maxTimeSecs = time(); -if ( ! $minTimeSecs ) - $minTimeSecs = strtotime('2010-01-01 01:01:01'); // This builds the list of events that are eligible from this range @@ -41,16 +37,16 @@ $index = 0; $anyAlarms = false; $maxScore=0; -if ( ! $liveMode ) { - $result = dbQuery( $eventsSql ); - if ( ! $result ) { +if ( !$liveMode ) { + $result = dbQuery($eventsSql); + if ( !$result ) { Fatal('SQL-ERR'); return; } $EventsById = array(); - while( $event = $result->fetch( PDO::FETCH_ASSOC ) ) { + while( $event = $result->fetch(PDO::FETCH_ASSOC) ) { $event_id = $event['Id']; $EventsById[$event_id] = $event; } @@ -82,8 +78,9 @@ if ( ! $liveMode ) { $StartTimeSecs = $event['StartTimeSecs']; $EndTimeSecs = $event['EndTimeSecs']; - if ( $minTimeSecs > $StartTimeSecs ) $minTimeSecs = $StartTimeSecs; - if ( $maxTimeSecs < $EndTimeSecs ) $maxTimeSecs = $EndTimeSecs; + # It isn't neccessary to do this for each event. We should be able to just look at the first and last + if ( !$minTimeSecs or $minTimeSecs > $StartTimeSecs ) $minTimeSecs = $StartTimeSecs; + if ( !$maxTimeSecs or $maxTimeSecs < $EndTimeSecs ) $maxTimeSecs = $EndTimeSecs; $event_json = json_encode($event, JSON_PRETTY_PRINT); echo " $event_id : $event_json,\n"; From 6cf336cc33e92cb36f50ba663f1e8d6ac000b799 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 9 Jul 2018 09:47:20 -0400 Subject: [PATCH 3/3] Always use a /zm in urls to zm assets --- web/skins/classic/views/js/montagereview.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/js/montagereview.js b/web/skins/classic/views/js/montagereview.js index 1a5e5decd..ca42e9df0 100644 --- a/web/skins/classic/views/js/montagereview.js +++ b/web/skins/classic/views/js/montagereview.js @@ -124,7 +124,7 @@ function getImageSource( monId, time ) { return location.protocol + '//' + server.Hostname + //'/cgi-bin/zms?mode=jpeg&replay=single&event=' + event_id + //'&frame='+Frame.FrameId + -'/index.php?view=image&eid=' + Frame.EventId + '&fid='+Frame.FrameId + + '/zm/index.php?view=image&eid=' + Frame.EventId + '&fid='+Frame.FrameId + "&width=" + monitorCanvasObj[monId].width + "&height=" + monitorCanvasObj[monId].height; } else { @@ -132,7 +132,7 @@ function getImageSource( monId, time ) { } } //console.log("No storage found for " + eStorageId[i] ); - return '/index.php?view=image&eid=' + Frame.EventId + '&fid='+frame_id + "&width=" + monitorCanvasObj[monId].width + "&height=" + monitorCanvasObj[monId].height; + return '/zm/index.php?view=image&eid=' + Frame.EventId + '&fid='+frame_id + "&width=" + monitorCanvasObj[monId].width + "&height=" + monitorCanvasObj[monId].height; //return "/cgi-bin/zms?mode=single&replay=single&event=" + Frame.EventId + '&time='+time+ "&width=" + monitorCanvasObj[monId].width + "&height=" + monitorCanvasObj[monId].height; return "/cgi-bin/zms?mode=jpeg&replay=single&event=" + Frame.EventId + '&frame='+frame_id + "&width=" + monitorCanvasObj[monId].width + "&height=" + monitorCanvasObj[monId].height; } // end found Frame