Merge branch 'fix_2671' into storageareas

This commit is contained in:
Isaac Connor 2019-08-02 08:05:12 -04:00
commit 8759eb88a9
3 changed files with 24 additions and 22 deletions

View File

@ -44,7 +44,7 @@ if ( !empty($_REQUEST['mid']) && canEdit('Monitors', $_REQUEST['mid']) ) {
$_REQUEST['newZone']['MaxBlobPixels'] = intval(($_REQUEST['newZone']['MaxBlobPixels']*$_REQUEST['newZone']['Area'])/100); $_REQUEST['newZone']['MaxBlobPixels'] = intval(($_REQUEST['newZone']['MaxBlobPixels']*$_REQUEST['newZone']['Area'])/100);
} }
unset( $_REQUEST['newZone']['Points'] ); unset($_REQUEST['newZone']['Points']);
# convert these fields to integer e.g. NULL -> 0 # convert these fields to integer e.g. NULL -> 0
$types = array( $types = array(

View File

@ -371,8 +371,8 @@ function updateY( index ) {
function saveChanges( element ) { function saveChanges( element ) {
var form = element.form; var form = element.form;
if ( validateForm( form ) ) { if ( validateForm(form) ) {
submitForm( form ); submitForm(form);
if ( form.elements['newZone[Type]'].value == 'Privacy' ) { if ( form.elements['newZone[Type]'].value == 'Privacy' ) {
alert( 'Capture process for this monitor will be restarted for the Privacy zone changes to take effect.' ); alert( 'Capture process for this monitor will be restarted for the Privacy zone changes to take effect.' );
} }

View File

@ -63,7 +63,7 @@ $maxY = $monitor->Height()-1;
if ( !isset($newZone) ) { if ( !isset($newZone) ) {
if ( $zid > 0 ) { if ( $zid > 0 ) {
$zone = dbFetchOne( 'SELECT * FROM Zones WHERE MonitorId = ? AND Id=?', NULL, array( $monitor->Id(), $zid ) ); $zone = dbFetchOne('SELECT * FROM Zones WHERE MonitorId = ? AND Id=?', NULL, array($monitor->Id(), $zid));
} else { } else {
$zone = array( $zone = array(
'Id' => 0, 'Id' => 0,
@ -98,23 +98,23 @@ if ( !isset($newZone) ) {
} # end if new Zone } # end if new Zone
# Ensure Zone fits within the limits of the Monitor # Ensure Zone fits within the limits of the Monitor
limitPoints( $newZone['Points'], $minX, $minY, $maxX, $maxY ); limitPoints($newZone['Points'], $minX, $minY, $maxX, $maxY);
ksort( $newZone['Points'], SORT_NUMERIC ); ksort($newZone['Points'], SORT_NUMERIC);
$newZone['Coords'] = pointsToCoords( $newZone['Points'] ); $newZone['Coords'] = pointsToCoords($newZone['Points']);
$newZone['Area'] = getPolyArea( $newZone['Points'] ); $newZone['Area'] = getPolyArea($newZone['Points']);
$newZone['AreaCoords'] = preg_replace( '/\s+/', ',', $newZone['Coords'] ); $newZone['AreaCoords'] = preg_replace('/\s+/', ',', $newZone['Coords']);
$selfIntersecting = isSelfIntersecting( $newZone['Points'] ); $selfIntersecting = isSelfIntersecting($newZone['Points']);
$focusWindow = true; $focusWindow = true;
$connkey = generateConnKey(); $connkey = generateConnKey();
$streamSrc = ''; $streamSrc = '';
$streamMode = ''; $streamMode = '';
# Have to do this here, because the .js.php references somethings figured out when generating the streamHTML # Have to do this here, because the .js.php references somethings figured out when generating the streamHTML
$StreamHTML = getStreamHTML( $monitor, array('scale'=>$scale) ); $StreamHTML = getStreamHTML($monitor, array('scale'=>$scale));
xhtmlHeaders(__FILE__, translate('Zone') ); xhtmlHeaders(__FILE__, translate('Zone'));
?> ?>
<body> <body>
<div id="page"> <div id="page">
@ -132,7 +132,7 @@ xhtmlHeaders(__FILE__, translate('Zone') );
<input type="hidden" name="newZone[Area]" value="<?php echo $newZone['Area'] ?>"/> <input type="hidden" name="newZone[Area]" value="<?php echo $newZone['Area'] ?>"/>
<input type="hidden" name="newZone[AlarmRGB]" value=""/> <input type="hidden" name="newZone[AlarmRGB]" value=""/>
<div id="settingsPanel"> <div id="settingsPanel">
<table id="zoneSettings" cellspacing="0"> <table id="zoneSettings">
<tbody> <tbody>
<tr> <tr>
<th scope="row"><?php echo translate('Name') ?></th> <th scope="row"><?php echo translate('Name') ?></th>
@ -162,7 +162,7 @@ xhtmlHeaders(__FILE__, translate('Zone') );
</tr> </tr>
<tr> <tr>
<th scope="row"><?php echo translate('CheckMethod') ?></th> <th scope="row"><?php echo translate('CheckMethod') ?></th>
<td colspan="2"><?php echo buildSelect( "newZone[CheckMethod]", $optCheckMethods, 'applyCheckMethod()' ) ?></td> <td colspan="2"><?php echo buildSelect('newZone[CheckMethod]', $optCheckMethods, 'applyCheckMethod()' ) ?></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php echo translate('ZoneMinMaxPixelThres') ?></th> <th scope="row"><?php echo translate('ZoneMinMaxPixelThres') ?></th>
@ -216,14 +216,14 @@ xhtmlHeaders(__FILE__, translate('Zone') );
<svg id="zoneSVG" class="zones" style="position: absolute; top: 0; left: 0; width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px; background: none;"> <svg id="zoneSVG" class="zones" style="position: absolute; top: 0; left: 0; width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px; background: none;">
<?php <?php
if ( $zone['Id'] ) { if ( $zone['Id'] ) {
$other_zones = dbFetchAll( 'SELECT * FROM Zones WHERE MonitorId = ? AND Id != ?', NULL, array( $monitor->Id(), $zone['Id'] ) ); $other_zones = dbFetchAll('SELECT * FROM Zones WHERE MonitorId = ? AND Id != ?', NULL, array($monitor->Id(), $zone['Id']));
} else { } else {
$other_zones = dbFetchAll( 'SELECT * FROM Zones WHERE MonitorId = ?', NULL, array( $monitor->Id() ) ); $other_zones = dbFetchAll('SELECT * FROM Zones WHERE MonitorId = ?', NULL, array($monitor->Id()));
} }
if ( count( $other_zones ) ) { if ( count($other_zones) ) {
$html = ''; $html = '';
foreach( $other_zones as $other_zone ) { foreach ( $other_zones as $other_zone ) {
$other_zone['AreaCoords'] = preg_replace( '/\s+/', ',', $other_zone['Coords'] ); $other_zone['AreaCoords'] = preg_replace('/\s+/', ',', $other_zone['Coords']);
$html .= '<polygon id="zonePoly'.$other_zone['Id'].'" points="'. $other_zone['AreaCoords'] .'" class="'. $other_zone['Type'] .'"/>'; $html .= '<polygon id="zonePoly'.$other_zone['Id'].'" points="'. $other_zone['AreaCoords'] .'" class="'. $other_zone['Type'] .'"/>';
} }
echo $html; echo $html;
@ -267,9 +267,11 @@ for ( $i = 0; $i < $pointCols; $i++ ) {
</tr> </tr>
</tbody> </tbody>
</table> </table>
<input id="pauseBtn" type="button" value="<?php echo translate('Pause') ?>" data-on-click="streamCmdPauseToggle"/> <button id="pauseBtn" type="button" data-on-click="streamCmdPauseToggle"><?php echo translate('Pause') ?></button>
<input type="submit" id="submitBtn" name="submitBtn" value="<?php echo translate('Save') ?>" onclick="return saveChanges( this )"<?php if (!canEdit( 'Monitors' ) || (false && $selfIntersecting)) { ?> disabled="disabled"<?php } ?>/> <button type="button" id="submitBtn" name="submitBtn" value="Save" data-on-click-this="saveChanges"<?php if (!canEdit('Monitors') || (false && $selfIntersecting)) { ?> disabled="disabled"<?php } ?>>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="refreshParentWindow(); closeWindow();"/> <?php echo translate('Save') ?>
</button>
<button type="button" value="Cancel" onclick="refreshParentWindow(); closeWindow();"><?php echo translate('Cancel') ?></button>
</div> </div>
</form> </form>
</div> </div>