add group filter to montagereview

This commit is contained in:
Isaac Connor 2017-09-26 11:28:19 -04:00
parent bc1b770c14
commit d69b16df24
4 changed files with 42 additions and 65 deletions

View File

@ -166,13 +166,12 @@ function drawSliderOnGraph(val) {
// If we have data already saved first restore it from LAST time
if(typeof underSlider !== 'undefined')
{
if(typeof underSlider !== 'undefined') {
ctx.putImageData(underSlider,underSliderX, 0, 0, 0, sliderWidth, sliderHeight);
underSlider=undefined;
}
if(liveMode==0) // we get rid of the slider if we switch to live (since it may not be in the "right" place)
{
if ( liveMode == 0 ) {
// we get rid of the slider if we switch to live (since it may not be in the "right" place)
// Now save where we are putting it THIS time
underSlider=ctx.getImageData(sliderX, 0, sliderWidth, sliderHeight);
// And add in the slider'
@ -183,13 +182,10 @@ function drawSliderOnGraph(val) {
underSliderX=sliderX;
}
var o = $('scruboutput');
if(liveMode==1)
{
if(liveMode==1) {
o.innerHTML="Live Feed @ " + (1000 / currentDisplayInterval).toFixed(1) + " fps";
o.style.color="red";
}
else
{
} else {
o.innerHTML=secs2dbstr(val);
o.style.color="blue";
}
@ -494,7 +490,7 @@ function clicknav(minSecs,maxSecs,arch,live) {// we use the current time if we c
var uri = "?view=" + currentView + fitStr + groupStr + minStr + maxStr + currentStr + intervalStr + liveStr + zoomStr + "&scale=" + scale[$j("#scaleslider")[0].value] + "&speed=" + speeds[$j("#speedslider")[0].value];
window.location = uri;
}
} // end function clickNav
function lastHour() {
var now = new Date() / 1000;
@ -690,6 +686,14 @@ function clickMonitor(event,monId) {
return;
}
function changeGroup() {
var group_id = $('group').get('value');
Cookie.write( 'zmMontageReviewGroup', group_id, { duration: 10*365 } );
var url = window.location.href;
url = url.replace(/group=\d+/, 'group='+group_id);
window.location.href = url;
}
// >>>>>>>>> Initialization that runs on window load by being at the bottom
function initPage() {

View File

@ -1,7 +1,6 @@
var currentScale=<?php echo $defaultScale?>;
var liveMode=<?php echo $initialModeIsLive?>;
console.log("Live mode?"+liveMode);
var fitMode=<?php echo $fitMode?>;
var currentSpeed=<?php echo $speeds[$speedIndex]?>; // slider scale, which is only for replay and relative to real time
var speedIndex=<?php echo $speedIndex?>;
@ -18,7 +17,7 @@ var eId = [];
var eStartSecs = [];
var eEndSecs = [];
var eventFrames = []; // this is going to presume all frames equal durationlength
var groupStr=<?php if($group=="") echo '""'; else echo "\"&group=$group\""; ?>;
var groupStr=<?php echo $group_id ? "'&group=$group_id'" : '""'; ?>;
<?php

View File

@ -48,51 +48,6 @@
// It takes very high bandwidth to the server, and a pretty fast client to keep up with the image rate. To reduce the rate
// change the playback slider to 0 and then it does not try to play at the same time it is scrubbing.
//
// Jul 23 2015 update:
// - Correct problem propagating selected playback speed
// - Change from blank monitor to specific message about no data in times with no recording
// - Enlarge and better center fonts on labels for lines.
// - Add support for monitor groups in selecting criteria from console
// - Fix some no-update conditions when playback was off but scale changed or refreshed.
// - Added translate call around buttons so as to facilitate possible translations later
// - Removed range from/to labels on very small graphs to keep from overlapping slider
// - Changed initial (from other page) position of slider to be in the middle to be more obvious
//
// Jul 29 2015 update
// - Add live mode shots from cameras via single frame pull mode
// - Added dynamic refresh rate based on how fast we can upload images
// - Closed some gaps in playback frames due to time rounding in retrieval.
// - Consolidated frame in-memory records to contiguous time rather than individual frame-seconds (still requires a good deal of browser memory)
// - Took out a lot of the integral second rounding so that it works better at subsequent replay speeds
//
// Jul 30 2015 update
// - Smoother adjustment of frame rate, fixed upper/lower limits (caching can cause runaway) (and a display, probably temporary, at the bottom)
// - Change to using index.php?view= instead of direct access so image access is authenticated
// - Add fractional speed for replay, and non-linear speed slider, and update current setting as slider moves (not when done)
// - Experimenting with a black background for monitors (this should be replaced with proper CSS later)
//
// Aug 02, 2015 update
// - Add max fit, make it default
// - Remove timeline in live mode, and restore when switched back (live button becomes toggle)
// - Add +/- zooms to individual monitors so you can adjust size, persist across reload buttons (only)
// - Change default to 1 hour and live mode (reduce workload on initial load, let people ask for huge history amounts)
// - Since this may be run as a standalone window for shortcuts, etc., add a "console" link to get back to the console
//
// August 6, 2015 update
// - Fix regression on linkage to events when starting and staying in live mode
// - Remove zoom/pan buttons in live mode as they are meaningless
// - Change "fit" to a button, and remove scale when fit is in use (this means fit/live has no sliders)
//
// August 8, 2015 update:
// - Optimize events query to significantly decrease load times
// - Consolidate frames to 10 seconds not 1 for faster load and less memory usage
// - Replace graphic image for no-data with text-on-canvas (faster)
// - Correct sorting issue related to normalized scale so biggest goes to top left more reliably
// - Corrections to Safari which won't support inline-flex (thanks Apple, really?!)
//
// August 9, 2015 updates:
// - Add auth tokens to zms call for those using authorization
//
if ( !canView( 'Events' ) ) {
$view = 'error';
@ -100,15 +55,22 @@ if ( !canView( 'Events' ) ) {
}
require_once( 'includes/Monitor.php' );
require_once( 'includes/Group.php' );
$groupSql = '';
$group_id = null;
if ( !empty($_REQUEST['group']) ) {
$group_id = $_REQUEST['group'];
} elseif ( isset( $_COOKIE['zmMontageReviewGroup'] ) ) {
$group_id = $_COOKIE['zmMontageReviewGroup'];
}
# FIXME THere is no way to select group at this time.
if ( !empty($_REQUEST['group']) ) {
$group = $_REQUEST['group'];
$row = dbFetchOne( 'SELECT * FROM Groups WHERE Id = ?', NULL, array($_REQUEST['group']) );
if ( isset( $group_id ) and $group_id ) {
$row = dbFetchOne( 'SELECT * FROM Groups WHERE Id = ?', NULL, array($group_id) );
$monitorsSql = "SELECT * FROM Monitors WHERE Function != 'None' AND find_in_set( Id, '".$row['MonitorIds']."' ) ";
} else {
$monitorsSql = "SELECT * FROM Monitors WHERE Function != 'None'";
$group = '';
}
// Note that this finds incomplete events as well, and any frame records written, but still cannot "see" to the end frame
@ -197,14 +159,13 @@ for ( $i = 0; $i < count($speeds); $i++ ) {
if ( isset($_REQUEST['current']) )
$defaultCurrentTime = validHtmlStr($_REQUEST['current']);
$initialModeIsLive = 1;
if ( isset($_REQUEST['live']) && $_REQUEST['live']=='0' )
$initialModeIsLive=0;
$initialDisplayInterval=1000;
$initialDisplayInterval = 1000;
if ( isset($_REQUEST['displayinterval']) )
$initialDisplayInterval=validHtmlStr($_REQUEST['displayinterval']);
$initialDisplayInterval = validHtmlStr($_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';
@ -242,6 +203,17 @@ input[type=range]::-ms-tooltip {
<a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a>
</div>
<h2><?php echo translate('MontageReview') ?></h2>
<div id="headerControl">
<span id="groupControl"><label><?php echo translate('Group') ?>:</label>
<?php
$groups = array(0=>'All');
foreach ( Group::find_all() as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
echo htmlSelect( 'group', $groups, $group_id, 'changeGroup(this);' );
?>
</span>
</div>
</div>
<div id="ScaleDiv">
<label for="scaleslider"><?php echo translate('Scale')?></label>

View File

@ -260,7 +260,9 @@ elseif ( $tab == "users" )
</tbody>
</table>
<div id="contentButtons">
<input type="button" value="<?php echo translate('AddNewStorage') ?>" onclick="createPopup( '?view=storage&amp;id=0', 'zmStorage', 'storage' );"<?php if ( !canEdit( 'System' ) ) { ?> disabled="disabled"<?php } ?>/><input type="submit" name="deleteBtn" value="<?php echo translate('Delete') ?>" disabled="disabled"/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow();"/>
<input type="button" value="<?php echo translate('AddNewStorage') ?>" onclick="createPopup( '?view=storage&amp;id=0', 'zmStorage', 'storage' );"<?php if ( !canEdit( 'System' ) ) { ?> disabled="disabled"<?php } ?>/>
<input type="submit" name="deleteBtn" value="<?php echo translate('Delete') ?>" disabled="disabled"/>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow();"/>
</div>
</form>
<?php