Use a button element instead of an anchor tag for plus and minus point buttons. Cleanup dead code
This commit is contained in:
parent
6488122862
commit
9cf31eafa0
|
@ -49,9 +49,9 @@ function validateForm( form ) {
|
|||
}
|
||||
if ( errors.length ) {
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
return false;
|
||||
}
|
||||
return( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
function submitForm( form ) {
|
||||
|
@ -324,7 +324,7 @@ function limitPointValue( point, loVal, hiVal ) {
|
|||
}
|
||||
|
||||
function updateArea( ) {
|
||||
area = Polygon_calcArea( zone['Points'] );
|
||||
area = Polygon_calcArea(zone['Points']);
|
||||
zone.Area = area;
|
||||
var form = $('zoneForm');
|
||||
form.elements['newZone[Area]'].value = area;
|
||||
|
@ -333,7 +333,7 @@ function updateArea( ) {
|
|||
} else if ( form.elements['newZone[Units]'].value == 'Pixels' ) {
|
||||
form.elements['newZone[TempArea]'].value = area;
|
||||
} else {
|
||||
alert("Unknown units: " + form.elements['newZone[Units]'].value );
|
||||
alert("Unknown units: " + form.elements['newZone[Units]'].value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,15 +368,23 @@ function saveChanges( element ) {
|
|||
if ( form.elements['newZone[Type]'].value == 'Privacy' ) {
|
||||
alert( 'Capture process for this monitor will be restarted for the Privacy zone changes to take effect.' );
|
||||
}
|
||||
return( true );
|
||||
return true;
|
||||
}
|
||||
return( false );
|
||||
return false;
|
||||
}
|
||||
|
||||
function drawZonePoints() {
|
||||
$('imageFrame').getElements( 'div.zonePoint' ).each( function( element ) { element.destroy(); } );
|
||||
for ( var i = 0; i < zone['Points'].length; i++ ) {
|
||||
var div = new Element( 'div', { 'id': 'point'+i, 'class': 'zonePoint', 'title': 'Point '+(i+1), 'styles': { 'left': zone['Points'][i].x, 'top': zone['Points'][i].y } } );
|
||||
var div = new Element( 'div', {
|
||||
'id': 'point'+i,
|
||||
'class': 'zonePoint',
|
||||
'title': 'Point '+(i+1),
|
||||
'styles': {
|
||||
'left': zone['Points'][i].x,
|
||||
'top': zone['Points'][i].y
|
||||
}
|
||||
} );
|
||||
div.addEvent( 'mouseover', highlightOn.pass( i ) );
|
||||
div.addEvent( 'mouseout', highlightOff.pass( i ) );
|
||||
div.inject( $('imageFrame') );
|
||||
|
@ -410,9 +418,11 @@ function drawZonePoints() {
|
|||
cell.inject( row );
|
||||
|
||||
cell = new Element( 'td' );
|
||||
new Element( 'a', { 'href': '#', 'events': { 'click': addPoint.pass( i ) } } ).set( 'text', '+' ).inject( cell );
|
||||
if ( zone['Points'].length > 3 )
|
||||
new Element( 'a', { 'id': 'delete'+i, 'href': '#', 'events': { 'click': delPoint.pass( i ) } } ).set( 'text', '-' ).inject( cell );
|
||||
new Element( 'button', { 'type': 'button', 'events': { 'click': addPoint.pass( i ) } } ).set( 'text', '+' ).inject( cell );
|
||||
if ( zone['Points'].length > 3 ) {
|
||||
cell.appendText(' ');
|
||||
new Element( 'button', { 'id': 'delete'+i, 'type': 'button', 'events': { 'click': delPoint.pass( i ) } } ).set( 'text', '-' ).inject( cell );
|
||||
}
|
||||
cell.inject( row );
|
||||
|
||||
row.inject( tables[i%tables.length].getElement( 'tbody' ) );
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
if ( !canView( 'Monitors' ) ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
if ( !canView('Monitors') ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
$mid = validInt($_REQUEST['mid']);
|
||||
|
@ -62,39 +62,39 @@ $minY = 0;
|
|||
$maxY = $monitor->Height()-1;
|
||||
|
||||
if ( !isset($newZone) ) {
|
||||
if ( $zid > 0 ) {
|
||||
$zone = dbFetchOne( 'SELECT * FROM Zones WHERE MonitorId = ? AND Id=?', NULL, array( $monitor->Id(), $zid ) );
|
||||
} else {
|
||||
$zone = array(
|
||||
'Id' => 0,
|
||||
'Name' => translate('New'),
|
||||
'Type' => 'Active',
|
||||
'MonitorId' => $monitor->Id(),
|
||||
'NumCoords' => 4,
|
||||
'Coords' => sprintf( "%d,%d %d,%d, %d,%d %d,%d", $minX, $minY, $maxX, $minY, $maxX, $maxY, $minX, $maxY ),
|
||||
'Area' => $monitor->Width() * $monitor->Height(),
|
||||
'AlarmRGB' => 0xff0000,
|
||||
'CheckMethod' => 'Blobs',
|
||||
'MinPixelThreshold' => '',
|
||||
'MaxPixelThreshold' => '',
|
||||
'MinAlarmPixels' => '',
|
||||
'MaxAlarmPixels' => '',
|
||||
'FilterX' => '',
|
||||
'FilterY' => '',
|
||||
'MinFilterPixels' => '',
|
||||
'MaxFilterPixels' => '',
|
||||
'MinBlobPixels' => '',
|
||||
'MaxBlobPixels' => '',
|
||||
'MinBlobs' => '',
|
||||
'MaxBlobs' => '',
|
||||
'OverloadFrames' => '',
|
||||
'ExtendAlarmFrames' => '',
|
||||
);
|
||||
}
|
||||
$zone['Points'] = coordsToPoints( $zone['Coords'] );
|
||||
$zone['AreaCoords'] = preg_replace( '/\s+/', ',', $zone['Coords'] );
|
||||
if ( $zid > 0 ) {
|
||||
$zone = dbFetchOne( 'SELECT * FROM Zones WHERE MonitorId = ? AND Id=?', NULL, array( $monitor->Id(), $zid ) );
|
||||
} else {
|
||||
$zone = array(
|
||||
'Id' => 0,
|
||||
'Name' => translate('New'),
|
||||
'Type' => 'Active',
|
||||
'MonitorId' => $monitor->Id(),
|
||||
'NumCoords' => 4,
|
||||
'Coords' => sprintf("%d,%d %d,%d, %d,%d %d,%d", $minX, $minY, $maxX, $minY, $maxX, $maxY, $minX, $maxY),
|
||||
'Area' => $monitor->Width() * $monitor->Height(),
|
||||
'AlarmRGB' => 0xff0000,
|
||||
'CheckMethod' => 'Blobs',
|
||||
'MinPixelThreshold' => '',
|
||||
'MaxPixelThreshold' => '',
|
||||
'MinAlarmPixels' => '',
|
||||
'MaxAlarmPixels' => '',
|
||||
'FilterX' => '',
|
||||
'FilterY' => '',
|
||||
'MinFilterPixels' => '',
|
||||
'MaxFilterPixels' => '',
|
||||
'MinBlobPixels' => '',
|
||||
'MaxBlobPixels' => '',
|
||||
'MinBlobs' => '',
|
||||
'MaxBlobs' => '',
|
||||
'OverloadFrames' => '',
|
||||
'ExtendAlarmFrames' => '',
|
||||
);
|
||||
}
|
||||
$zone['Points'] = coordsToPoints( $zone['Coords'] );
|
||||
$zone['AreaCoords'] = preg_replace( '/\s+/', ',', $zone['Coords'] );
|
||||
|
||||
$newZone = $zone;
|
||||
$newZone = $zone;
|
||||
} # end if new Zone
|
||||
|
||||
# Ensure Zone fits within the limits of the Monitor
|
||||
|
@ -235,16 +235,15 @@ if ( count( $other_zones ) ) {
|
|||
</div>
|
||||
</div>
|
||||
<div id="monitorState"><?php echo translate('State') ?>: <span id="stateValue"></span> - <span id="fpsValue"></span> fps</div>
|
||||
<table id="zonePoints" cellspacing="0">
|
||||
<table id="zonePoints">
|
||||
<tbody>
|
||||
<tr>
|
||||
<?php
|
||||
$pointCols = 2;
|
||||
for ( $i = 0; $i < $pointCols; $i++ )
|
||||
{
|
||||
for ( $i = 0; $i < $pointCols; $i++ ) {
|
||||
?>
|
||||
<td>
|
||||
<table cellspacing="0">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo translate('Point') ?></th>
|
||||
|
@ -254,26 +253,11 @@ for ( $i = 0; $i < $pointCols; $i++ )
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if ( false )
|
||||
for ( $j = $i; $j < count($newZone['Points']); $j += 2 )
|
||||
{
|
||||
?>
|
||||
<tr id="row<?php echo $j ?>" onmouseover="highlightOn( <?php echo $j ?> )" onmouseout="highlightOff( <?php echo $j ?> )" onclick="setActivePoint( <?php echo $j ?> )">
|
||||
<td><?php echo $j+1 ?></td>
|
||||
<td><input name="newZone[Points][<?php echo $j ?>][x]" id="newZone[Points][<?php echo $j ?>][x]" size="5" value="<?php echo $newZone['Points'][$j]['x'] ?>" oninput="updateX( this, <?php echo $j ?> );"<?php if ( canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></td>
|
||||
<td><input name="newZone[Points][<?php echo $j ?>][y]" id="newZone[Points][<?php echo $j ?>][y]" size="5" value="<?php echo $newZone['Points'][$j]['y'] ?>" oninput="updateY( this, <?php echo $j ?> );"<?php if ( canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/></td>
|
||||
<td><a href="#" onclick="addPoint( this, <?php echo $j ?> ); return( false );">+</a><?php if ( count($newZone['Points']) > 3 ) { ?> <a id="delete<?php echo $j ?>" href="#" onclick="delPoint( this, <?php echo $j ?> ); return(false);">–</a><?php } ?> <a id="cancel<?php echo $j ?>" href="#" onclick="unsetActivePoint( <?php echo $j ?> ); return( false );">X</a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<?php
|
||||
if ( $i < ($pointCols-1) )
|
||||
{
|
||||
if ( $i < ($pointCols-1) ) {
|
||||
?>
|
||||
<td> </td>
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue