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 ) {
|
if ( errors.length ) {
|
||||||
alert( errors.join( "\n" ) );
|
alert( errors.join( "\n" ) );
|
||||||
return( false );
|
return false;
|
||||||
}
|
}
|
||||||
return( true );
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitForm( form ) {
|
function submitForm( form ) {
|
||||||
|
@ -324,7 +324,7 @@ function limitPointValue( point, loVal, hiVal ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateArea( ) {
|
function updateArea( ) {
|
||||||
area = Polygon_calcArea( zone['Points'] );
|
area = Polygon_calcArea(zone['Points']);
|
||||||
zone.Area = area;
|
zone.Area = area;
|
||||||
var form = $('zoneForm');
|
var form = $('zoneForm');
|
||||||
form.elements['newZone[Area]'].value = area;
|
form.elements['newZone[Area]'].value = area;
|
||||||
|
@ -333,7 +333,7 @@ function updateArea( ) {
|
||||||
} else if ( form.elements['newZone[Units]'].value == 'Pixels' ) {
|
} else if ( form.elements['newZone[Units]'].value == 'Pixels' ) {
|
||||||
form.elements['newZone[TempArea]'].value = area;
|
form.elements['newZone[TempArea]'].value = area;
|
||||||
} else {
|
} 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' ) {
|
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.' );
|
||||||
}
|
}
|
||||||
return( true );
|
return true;
|
||||||
}
|
}
|
||||||
return( false );
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawZonePoints() {
|
function drawZonePoints() {
|
||||||
$('imageFrame').getElements( 'div.zonePoint' ).each( function( element ) { element.destroy(); } );
|
$('imageFrame').getElements( 'div.zonePoint' ).each( function( element ) { element.destroy(); } );
|
||||||
for ( var i = 0; i < zone['Points'].length; i++ ) {
|
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( 'mouseover', highlightOn.pass( i ) );
|
||||||
div.addEvent( 'mouseout', highlightOff.pass( i ) );
|
div.addEvent( 'mouseout', highlightOff.pass( i ) );
|
||||||
div.inject( $('imageFrame') );
|
div.inject( $('imageFrame') );
|
||||||
|
@ -410,9 +418,11 @@ function drawZonePoints() {
|
||||||
cell.inject( row );
|
cell.inject( row );
|
||||||
|
|
||||||
cell = new Element( 'td' );
|
cell = new Element( 'td' );
|
||||||
new Element( 'a', { 'href': '#', 'events': { 'click': addPoint.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 )
|
if ( zone['Points'].length > 3 ) {
|
||||||
new Element( 'a', { 'id': 'delete'+i, 'href': '#', 'events': { 'click': delPoint.pass( i ) } } ).set( 'text', '-' ).inject( cell );
|
cell.appendText(' ');
|
||||||
|
new Element( 'button', { 'id': 'delete'+i, 'type': 'button', 'events': { 'click': delPoint.pass( i ) } } ).set( 'text', '-' ).inject( cell );
|
||||||
|
}
|
||||||
cell.inject( row );
|
cell.inject( row );
|
||||||
|
|
||||||
row.inject( tables[i%tables.length].getElement( 'tbody' ) );
|
row.inject( tables[i%tables.length].getElement( 'tbody' ) );
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( !canView( 'Monitors' ) ) {
|
if ( !canView('Monitors') ) {
|
||||||
$view = 'error';
|
$view = 'error';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mid = validInt($_REQUEST['mid']);
|
$mid = validInt($_REQUEST['mid']);
|
||||||
|
@ -62,39 +62,39 @@ $minY = 0;
|
||||||
$maxY = $monitor->Height()-1;
|
$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,
|
||||||
'Name' => translate('New'),
|
'Name' => translate('New'),
|
||||||
'Type' => 'Active',
|
'Type' => 'Active',
|
||||||
'MonitorId' => $monitor->Id(),
|
'MonitorId' => $monitor->Id(),
|
||||||
'NumCoords' => 4,
|
'NumCoords' => 4,
|
||||||
'Coords' => sprintf( "%d,%d %d,%d, %d,%d %d,%d", $minX, $minY, $maxX, $minY, $maxX, $maxY, $minX, $maxY ),
|
'Coords' => sprintf("%d,%d %d,%d, %d,%d %d,%d", $minX, $minY, $maxX, $minY, $maxX, $maxY, $minX, $maxY),
|
||||||
'Area' => $monitor->Width() * $monitor->Height(),
|
'Area' => $monitor->Width() * $monitor->Height(),
|
||||||
'AlarmRGB' => 0xff0000,
|
'AlarmRGB' => 0xff0000,
|
||||||
'CheckMethod' => 'Blobs',
|
'CheckMethod' => 'Blobs',
|
||||||
'MinPixelThreshold' => '',
|
'MinPixelThreshold' => '',
|
||||||
'MaxPixelThreshold' => '',
|
'MaxPixelThreshold' => '',
|
||||||
'MinAlarmPixels' => '',
|
'MinAlarmPixels' => '',
|
||||||
'MaxAlarmPixels' => '',
|
'MaxAlarmPixels' => '',
|
||||||
'FilterX' => '',
|
'FilterX' => '',
|
||||||
'FilterY' => '',
|
'FilterY' => '',
|
||||||
'MinFilterPixels' => '',
|
'MinFilterPixels' => '',
|
||||||
'MaxFilterPixels' => '',
|
'MaxFilterPixels' => '',
|
||||||
'MinBlobPixels' => '',
|
'MinBlobPixels' => '',
|
||||||
'MaxBlobPixels' => '',
|
'MaxBlobPixels' => '',
|
||||||
'MinBlobs' => '',
|
'MinBlobs' => '',
|
||||||
'MaxBlobs' => '',
|
'MaxBlobs' => '',
|
||||||
'OverloadFrames' => '',
|
'OverloadFrames' => '',
|
||||||
'ExtendAlarmFrames' => '',
|
'ExtendAlarmFrames' => '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$zone['Points'] = coordsToPoints( $zone['Coords'] );
|
$zone['Points'] = coordsToPoints( $zone['Coords'] );
|
||||||
$zone['AreaCoords'] = preg_replace( '/\s+/', ',', $zone['Coords'] );
|
$zone['AreaCoords'] = preg_replace( '/\s+/', ',', $zone['Coords'] );
|
||||||
|
|
||||||
$newZone = $zone;
|
$newZone = $zone;
|
||||||
} # 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
|
||||||
|
@ -235,16 +235,15 @@ if ( count( $other_zones ) ) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="monitorState"><?php echo translate('State') ?>: <span id="stateValue"></span> - <span id="fpsValue"></span> fps</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>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
$pointCols = 2;
|
$pointCols = 2;
|
||||||
for ( $i = 0; $i < $pointCols; $i++ )
|
for ( $i = 0; $i < $pointCols; $i++ ) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<table cellspacing="0">
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php echo translate('Point') ?></th>
|
<th><?php echo translate('Point') ?></th>
|
||||||
|
@ -254,26 +253,11 @@ for ( $i = 0; $i < $pointCols; $i++ )
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
if ( $i < ($pointCols-1) )
|
if ( $i < ($pointCols-1) ) {
|
||||||
{
|
|
||||||
?>
|
?>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue