From 84ed491765a89ff7de47e993f33a9d5a2dff455c Mon Sep 17 00:00:00 2001 From: Linwood-F Date: Wed, 22 Jul 2015 13:51:31 -0400 Subject: [PATCH] Initial Montage Review for people to take a look at --- web/skins/classic/views/console.php | 6 +- web/skins/classic/views/montagereview.php | 688 ++++++++++++++++++++++ 2 files changed, 693 insertions(+), 1 deletion(-) create mode 100644 web/skins/classic/views/montagereview.php diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index 5930ebe95..f7724d6e7 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -210,7 +210,11 @@ if ( canView( 'Stream' ) && $cycleCount > 1 ) { $cycleGroup = isset($_COOKIE['zmGroup'])?$_COOKIE['zmGroup']:0; ?> -
 / 
+
+  /  +  /  + +
0 "; + +// This program only calls itself with the time range involved -- it does all monitors (the user can see) all the time + +if ( !empty($user['MonitorIds']) ) +{ + $monFilterSql = ' AND M.Id IN ('.$user['MonitorIds'].')'; + + $eventsSql .= $monFilterSql; + $monitorsSQL .= $monFilterSql; + $frameSql .= $monFilterSql; +} + +// Parse input parameters -- note for future, validate/clean up better in case we don't get called from self. + +if ( isset($_REQUEST['minTime']) ) + $minTime = validHtmlStr($_REQUEST['minTime']); + +if ( isset($_REQUEST['maxTime']) ) + $maxTime = validHtmlStr($_REQUEST['maxTime']); + +if ( isset($_REQUEST['scale']) ) + $defaultScale=validHtmlStr($_REQUEST['scale']); +else + $defaultScale=0.3; + +if (isset($_REQUEST['speed']) ) + $defaultSpeed=validHtmlStr($_REQUEST['speed']); +else + $defaultSpeed=1; + +if (isset($_REQUEST['current']) ) + $defaultCurrentTime=validHtmlStr($_REQUEST['current']); + +$archive=1; +if (isset($_REQUEST['archive']) ) + $archive=validHtmlStr($_REQUEST['archive']); + +if ($archive==0) +{ + $eventsSql .= " and E.Archived=0 "; +} $frameSql .= " and E.Archived=0 "; + +$eventsSql .= "group by E.Id,E.Name,E.StartTime,E.Length,E.Frames,E.MaxScore,E.Cause,E.Notes,E.Archived,E.MonitorId "; + +if( isset($minTime) && isset($maxTime) ) +{ + $eventsSql .= "having CalcEndTime > '" . $minTime . "' and StartTime < '" . $maxTime . "'"; + $frameSql .= " + and TimeStamp > '" . $minTime . "' and TimeStamp < '" . $maxTime . "'"; +} +$frameSql .= "group by E.Id, E.MonitorId, F.TimeStamp order by E.MonitorId, F.TimeStamp asc"; + +xhtmlHeaders(__FILE__, translate('montagereview') ); +?> + + + +
+ + +
+ + step=0.10 width=20% onchange='changescale(this.value)'/> + x +
+
+ + step=1 wdth=20% onchange='changespeed(this.value)'/> + x +
+
+ + + + + + + +
+ +
+ + + + +
+ + +\n"; +echo "var eventMonitorId = [];\n"; +echo "var eventId = [];\n"; +echo "var eventStartTimeSecs = [];\n"; +echo "var eventEndTimeSecs = [];\n"; +echo "var eventPath = [];\n"; +echo "var eventFrames = [];\n"; // this is going to presume all frames equal durationlength + +// Because we might not have time as the criteria, figure out the min/max time when we run the query + +$minTimeSecs = strtotime("2036-01-01 01:01:01"); +$maxTimeSecs = strtotime("1950-01-01 01:01:01"); + +$index=0; +$anyAlarms=false; +$eventsMonitorsFound = array(); // this will just flag which ones found + +foreach( dbFetchAll( $eventsSql ) as $event ) +{ + if( $minTimeSecs > strtotime($event['StartTime'])) $minTimeSecs=strtotime($event['StartTime']); + if( $maxTimeSecs < strtotime($event['CalcEndTime'])) $maxTimeSecs=strtotime($event['CalcEndTime']); + echo "eventMonitorId[$index]=" . $event['MonitorId'] . "; eventId[$index]=" . $event['Id'] . "; "; + echo "eventStartTimeSecs[$index]=" . strtotime($event['StartTime']) . "; eventEndTimeSecs[$index]=" . strtotime($event['CalcEndTime']) . "; "; + echo "eventFrames[$index]=" . $event['Frames'] . "; "; + + if ( ZM_USE_DEEP_STORAGE ) + echo "eventPath[$index] = \"events/" . $event['MonitorId'] . "/" . strftime("%y/%m/%d/%H/%M/%S", strtotime($event['StartTime'])) . "/\";" ; + else + echo "eventPath[$index] = \"events/" . $event['MonitorId'] . "/" . $event['Id'] . "/\";" ; + $eventsMonitorsFound[$event['MonitorId']] = true; + $index=$index+1; + if($event['MaxScore']>0) + $anyAlarms=true; + 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'); + } +} + +// 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 we had any alarms in those events, this builds the list of all alarm frames (thought for later - should these be ranges, so as to minimize list if very long?) + +echo "var frameMonitorId = [];\n"; +echo "var frameTimeStampSecs = [];\n"; +echo "var frameScore = [];\n"; +$maxScore=0; +$index=0; + +if($anyAlarms) + foreach( dbFetchAll ($frameSql) as $frame ) + { + echo " frameMonitorId[$index]=" . $frame['MonitorId'] . ";"; + echo " frameTimeStampSecs[$index]=" . strtotime($frame['TimeStamp']) . ";"; + echo " frameScore[$index]=" . $frame['Score'] . ";\n"; + if($maxScore <= $frame['Score']) + $maxScore=$frame['Score']; + $index += 1; + } + +// This is where we have to display the canvases -- AFTER determining which monitors we use (above in events) and BEFORE we loop through them to cache the objects +// This splits up the javascript and html a bit, but it's a lot simpler than trying in php to cache one while completing the other + +// Monitor images - these had to be loaded after the monitors used were determined (after loading events) + +echo "\n"; + +foreach ($monitors as $m) +{ + if(!empty($eventsMonitorsFound[$m['Id']])) // only save the monitor if it's part of these events + { + echo "No Canvas Support!!\n"; + } +} +echo " + +
+ + + +