diff --git a/web/skins/classic/views/montagereview.php b/web/skins/classic/views/montagereview.php index d62f3a8b5..132987482 100644 --- a/web/skins/classic/views/montagereview.php +++ b/web/skins/classic/views/montagereview.php @@ -151,7 +151,7 @@ if ( !empty($user['MonitorIds']) ) $eventsSql .= $monFilterSql; $monitorsSQL .= $monFilterSql; - $frameSql .= $monFilterSql; + $frameSql .= ' AND e.MonitorId IN ('.$user['MonitorIds'].')'; } // Parse input parameters -- note for future, validate/clean up better in case we don't get called from self. @@ -224,12 +224,12 @@ if( isset($minTime) && isset($maxTime) ) $eventsSql .= "having CalcEndTimeSecs > '" . $minTimeSecs . "' and StartTimeSecs < '" . $maxTimeSecs . "'"; $frameSql .= "and TimeStamp > '" . $minTime . "' and TimeStamp < '" . $maxTime . "'"; } -$frameSql .= "group by E.Id, E.MonitorId, F.TimeStamp order by E.MonitorId, F.TimeStamp asc"; +$frameSql .= "group by E.Id, E.MonitorId, F.TimeStamp, F.Delta order by E.MonitorId, F.TimeStamp asc"; // This loads all monitors the user can see - even if we don't have data for one we still show all for switch to live. $monitors = array(); -$monitorsSql .= " order by Sequence asc "; +$monitorsSql .= ' ORDER BY Sequence ASC '; $index=0; foreach( dbFetchAll( $monitorsSql ) as $row ) { @@ -256,42 +256,39 @@ input[type=range]::-ms-tooltip {
-evaluating fps
\n"; @@ -331,8 +328,7 @@ $maxTimeSecs = strtotime("1950-01-01 01:01:01"); $index=0; $anyAlarms=false; -foreach( dbFetchAll( $eventsSql ) as $event ) -{ +foreach( dbFetchAll( $eventsSql ) as $event ) { if( $minTimeSecs > $event['StartTimeSecs']) $minTimeSecs=$event['StartTimeSecs']; if( $maxTimeSecs < $event['CalcEndTimeSecs']) $maxTimeSecs=$event['CalcEndTimeSecs']; echo "eMonId[$index]=" . $event['MonitorId'] . "; eId[$index]=" . $event['Id'] . "; "; @@ -349,30 +345,25 @@ foreach( dbFetchAll( $eventsSql ) as $event ) echo "\n"; } -if($index == 0) // if there is no data set the min/max to the passed in values -{ - if(isset($minTime) && isset($maxTime)) - { - $minTimeSecs = strtotime($minTime); - $maxTimeSecs = strtotime($maxTime); - } - else // this is the case of no passed in times AND no data -- just set something arbitrary - { - $minTimeSecs=strtotime('1950-06-01 01:01:01'); // random time so there's something to display - $maxTimeSecs=strtotime('2020-06-02 02:02:02'); - } +// if there is no data set the min/max to the passed in values +if($index == 0) { + if(isset($minTime) && isset($maxTime)) { + $minTimeSecs = strtotime($minTime); + $maxTimeSecs = strtotime($maxTime); + } else { + // this is the case of no passed in times AND no data -- just set something arbitrary + $minTimeSecs=strtotime('1950-06-01 01:01:01'); // random time so there's something to display + $maxTimeSecs=strtotime('2020-06-02 02:02:02'); + } } // We only reset the calling time if there was no calling time -if(!isset($minTime) || !isset($maxTime)) -{ - $maxTime = strftime($maxTimeSecs); - $minTime = strftime($minTimeSecs); -} -else -{ - $minTimeSecs = strtotime($minTime); - $maxTimeSecs = strtotime($maxTime); +if(!isset($minTime) || !isset($maxTime)) { + $maxTime = strftime($maxTimeSecs); + $minTime = strftime($minTimeSecs); +} else { + $minTimeSecs = strtotime($minTime); + $maxTimeSecs = strtotime($maxTime); } // If we had any alarms in those events, this builds the list of all alarm frames, but consolidated down to (nearly) contiguous segments @@ -389,41 +380,37 @@ $fromSecs=-1; $toSecs=-1; $maxScore=-1; -if($anyAlarms) - foreach( dbFetchAll ($frameSql) as $frame ) - { - if($mId<0) - { - $mId=$frame['MonitorId']; - $fromSecs=$frame['TimeStampSecs']; - $toSecs=$frame['TimeStampSecs']; - $maxScore=$frame['Score']; - } - else if ($mId != $frame['MonitorId'] || $frame['TimeStampSecs'] - $toSecs > 10) // dump this one start a new - { - $index++; - echo " fMonId[$index]=" . $mId . ";"; - echo " fTimeFromSecs[$index]=" . $fromSecs . ";"; - echo " fTimeToSecs[$index]=" . $toSecs . ";"; - echo " fScore[$index]=" . $maxScore . ";\n"; - $mId=$frame['MonitorId']; - $fromSecs=$frame['TimeStampSecs']; - $toSecs=$frame['TimeStampSecs']; - $maxScore=$frame['Score']; - } - else // just add this one on - { - $toSecs=$frame['TimeStampSecs']; - if($maxScore < $frame['Score']) $maxScore=$frame['Score']; - } - } - if($mId>0) - { - echo " fMonId[$index]=" . $mId . ";"; - echo " fTimeFromSecs[$index]=" . $fromSecs . ";"; - echo " fTimeToSecs[$index]=" . $toSecs . ";"; - echo " fScore[$index]=" . $maxScore . ";\n"; +if($anyAlarms) { + foreach( dbFetchAll ($frameSql) as $frame ) { + if($mId<0) { + $mId=$frame['MonitorId']; + $fromSecs=$frame['TimeStampSecs']; + $toSecs=$frame['TimeStampSecs']; + $maxScore=$frame['Score']; + } else if ($mId != $frame['MonitorId'] || $frame['TimeStampSecs'] - $toSecs > 10) { + // dump this one start a new + $index++; + echo " fMonId[$index]=" . $mId . ";"; + echo " fTimeFromSecs[$index]=" . $fromSecs . ";"; + echo " fTimeToSecs[$index]=" . $toSecs . ";"; + echo " fScore[$index]=" . $maxScore . ";\n"; + $mId=$frame['MonitorId']; + $fromSecs=$frame['TimeStampSecs']; + $toSecs=$frame['TimeStampSecs']; + $maxScore=$frame['Score']; + } else { + // just add this one on + $toSecs=$frame['TimeStampSecs']; + if($maxScore < $frame['Score']) $maxScore=$frame['Score']; } + } +} +if($mId>0) { + echo " fMonId[$index]=" . $mId . ";"; + echo " fTimeFromSecs[$index]=" . $fromSecs . ";"; + echo " fTimeToSecs[$index]=" . $toSecs . ";"; + echo " fScore[$index]=" . $maxScore . ";\n"; +} echo "var maxScore=$maxScore;\n"; // used to skip frame load if we find no alarms. echo "var monitorName = [];\n"; @@ -446,17 +433,15 @@ echo "var monitorPtr = []; // monitorName[monitorPtr[0]] is first monitor\n"; $numMonitors=0; // this array is indexed by the monitor ID for faster access later, so it may be sparse $avgArea=floatval(0); // Calculations the normalizing scale -foreach ($monitors as $m) -{ - $avgArea = $avgArea + floatval($m['Width'] * $m['Height']); - $numMonitors++; +foreach ($monitors as $m) { + $avgArea = $avgArea + floatval($m['Width'] * $m['Height']); + $numMonitors++; } if($numMonitors>0) $avgArea= $avgArea / $numMonitors; $numMonitors=0; -foreach ($monitors as $m) -{ +foreach ($monitors as $m) { echo " monitorLoading[" . $m['Id'] . "]=false; "; echo " monitorImageObject[" . $m['Id'] . "]=null; "; echo " monitorLoadingStageURL[" . $m['Id'] . "] = ''; "; @@ -543,34 +528,28 @@ function evaluateLoadTimes() $('fps').innerHTML="Display refresh rate is " + (1000 / currentDisplayInterval).toFixed(1) + " per second, avgFrac=" + avgFrac.toFixed(3) + "."; } -function SetImageSource(monId,val) -{ - if(liveMode==1) - { // This uses the standard php routine to set up the url and authentication, but because it is called repeatedly the built in random number is not usable, so one is appended below for two total (yuck) - var effectiveScale = (100.0 * monitorCanvasObj[monId].width) / monitorWidth[monId]; - var $x = "" + "&monitor=" + monId.toString() + "&scale=" + effectiveScale + Math.random().toString() ; - return $x; - } - else - { - var zeropad = ; - for(var i=0, var eIdlength = eId.length; i