more merges/fixes from SA
parent
8b3b9eb30e
commit
b96f5cf49d
|
@ -18,9 +18,8 @@
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,29 +33,25 @@ $hicolor = '0x00ff00'; // Green
|
||||||
$presets = array();
|
$presets = array();
|
||||||
$presetNames = array();
|
$presetNames = array();
|
||||||
$presetNames[0] = translate('ChoosePreset');
|
$presetNames[0] = translate('ChoosePreset');
|
||||||
$sql = "select *, Units-1 as UnitsIndex, CheckMethod-1 as CheckMethodIndex from ZonePresets order by Id asc";
|
$sql = 'SELECT *, Units-1 AS UnitsIndex, CheckMethod-1 AS CheckMethodIndex FROM ZonePresets ORDER BY Id ASC';
|
||||||
foreach( dbFetchAll( $sql ) as $preset )
|
foreach( dbFetchAll( $sql ) as $preset ) {
|
||||||
{
|
$presetNames[$preset['Id']] = $preset['Name'];
|
||||||
$presetNames[$preset['Id']] = $preset['Name'];
|
$presets[] = $preset;
|
||||||
$presets[] = $preset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$optTypes = array();
|
$optTypes = array();
|
||||||
foreach ( getEnumValues( 'Zones', 'Type' ) as $optType )
|
foreach ( getEnumValues( 'Zones', 'Type' ) as $optType ) {
|
||||||
{
|
$optTypes[$optType] = $optType;
|
||||||
$optTypes[$optType] = $optType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$optUnits = array();
|
$optUnits = array();
|
||||||
foreach ( getEnumValues( 'Zones', 'Units' ) as $optUnit )
|
foreach ( getEnumValues( 'Zones', 'Units' ) as $optUnit ) {
|
||||||
{
|
$optUnits[$optUnit] = $optUnit;
|
||||||
$optUnits[$optUnit] = $optUnit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$optCheckMethods = array();
|
$optCheckMethods = array();
|
||||||
foreach ( getEnumValues( 'Zones', 'CheckMethod' ) as $optCheckMethod )
|
foreach ( getEnumValues( 'Zones', 'CheckMethod' ) as $optCheckMethod ) {
|
||||||
{
|
$optCheckMethods[$optCheckMethod] = $optCheckMethod;
|
||||||
$optCheckMethods[$optCheckMethod] = $optCheckMethod;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$monitor = new Monitor( $mid );
|
$monitor = new Monitor( $mid );
|
||||||
|
@ -66,14 +61,10 @@ $maxX = $monitor->Width()-1;
|
||||||
$minY = 0;
|
$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'),
|
||||||
|
@ -104,17 +95,16 @@ if ( !isset($newZone) )
|
||||||
$zone['AreaCoords'] = preg_replace( '/\s+/', ',', $zone['Coords'] );
|
$zone['AreaCoords'] = preg_replace( '/\s+/', ',', $zone['Coords'] );
|
||||||
|
|
||||||
$newZone = $zone;
|
$newZone = $zone;
|
||||||
}
|
} # end if new Zone
|
||||||
|
|
||||||
//if ( !$points )
|
# Ensure Zone fits within the limits of the Monitor
|
||||||
//{
|
limitPoints( $newZone['Points'], $minX, $minY, $maxX, $maxY );
|
||||||
//$points = $zone['Points'];
|
|
||||||
//}
|
|
||||||
|
|
||||||
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'] );
|
||||||
$selfIntersecting = isSelfIntersecting( $newZone['Points'] );
|
$selfIntersecting = isSelfIntersecting( $newZone['Points'] );
|
||||||
|
|
||||||
$focusWindow = true;
|
$focusWindow = true;
|
||||||
|
@ -122,7 +112,7 @@ $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, $scale );
|
$StreamHTML = getStreamHTML( $monitor, array('scale'=>$scale) );
|
||||||
|
|
||||||
xhtmlHeaders(__FILE__, translate('Zone') );
|
xhtmlHeaders(__FILE__, translate('Zone') );
|
||||||
?>
|
?>
|
||||||
|
@ -162,7 +152,13 @@ xhtmlHeaders(__FILE__, translate('Zone') );
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php echo translate('ZoneAlarmColour') ?></th>
|
<th scope="row"><?php echo translate('ZoneAlarmColour') ?></th>
|
||||||
<td colspan="2"><input type="text" name="newAlarmRgbR" value="<?php echo ($newZone['AlarmRGB']>>16)&0xff ?>" size="3" onchange="limitRange( this, 0, 255 )"/> / <input type="text" name="newAlarmRgbG" value="<?php echo ($newZone['AlarmRGB']>>8)&0xff ?>" size="3" onchange="limitRange( this, 0, 255 )"/> / <input type="text" name="newAlarmRgbB" value="<?php echo $newZone['AlarmRGB']&0xff ?>" size="3" onchange="limitRange( this, 0, 255 )"/></td>
|
<td colspan="2">
|
||||||
|
<input type="text" name="newAlarmRgbR" value="<?php echo ($newZone['AlarmRGB']>>16)&0xff ?>" size="3" onchange="limitRange( this, 0, 255 )"/>
|
||||||
|
/
|
||||||
|
<input type="text" name="newAlarmRgbG" value="<?php echo ($newZone['AlarmRGB']>>8)&0xff ?>" size="3" onchange="limitRange( this, 0, 255 )"/>
|
||||||
|
/
|
||||||
|
<input type="text" name="newAlarmRgbB" value="<?php echo $newZone['AlarmRGB']&0xff ?>" size="3" onchange="limitRange( this, 0, 255 )"/>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php echo translate('CheckMethod') ?></th>
|
<th scope="row"><?php echo translate('CheckMethod') ?></th>
|
||||||
|
|
|
@ -18,23 +18,27 @@
|
||||||
// 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']);
|
||||||
$monitor = new Monitor( $mid );
|
$monitor = new Monitor( $mid );
|
||||||
|
# Width() and Height() are already rotated
|
||||||
|
$minX = 0;
|
||||||
|
$maxX = $monitor->Width()-1;
|
||||||
|
$minY = 0;
|
||||||
|
$maxY = $monitor->Height()-1;
|
||||||
|
|
||||||
$zones = array();
|
$zones = array();
|
||||||
foreach( dbFetchAll( 'select * from Zones where MonitorId = ? order by Area desc', NULL, array($mid) ) as $row )
|
foreach( dbFetchAll( 'SELECT * FROM Zones WHERE MonitorId=? ORDER BY Area DESC', NULL, array($mid) ) as $row ) {
|
||||||
{
|
$row['Points'] = coordsToPoints( $row['Coords'] );
|
||||||
if ( $row['Points'] = coordsToPoints( $row['Coords'] ) )
|
|
||||||
{
|
limitPoints( $row['Points'], $minX, $minY, $maxX, $maxY );
|
||||||
$row['AreaCoords'] = preg_replace( '/\s+/', ',', $row['Coords'] );
|
$row['Coords'] = pointsToCoords( $row['Points'] );
|
||||||
$zones[] = $row;
|
$row['AreaCoords'] = preg_replace( '/\s+/', ',', $row['Coords'] );
|
||||||
}
|
$zones[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
$connkey = generateConnKey();
|
$connkey = generateConnKey();
|
||||||
|
@ -48,21 +52,14 @@ xhtmlHeaders(__FILE__, translate('Zones') );
|
||||||
<h2><?php echo translate('Zones') ?></h2>
|
<h2><?php echo translate('Zones') ?></h2>
|
||||||
</div>
|
</div>
|
||||||
<div id="content" style="width:<?php echo $monitor->Width() ?>px; height:<?php echo $monitor->Height() ?>px; position:relative; margin: 0 auto;">
|
<div id="content" style="width:<?php echo $monitor->Width() ?>px; height:<?php echo $monitor->Height() ?>px; position:relative; margin: 0 auto;">
|
||||||
<?php echo getStreamHTML( $monitor ); ?>
|
|
||||||
<svg class="zones" width="<?php echo $monitor->Width() ?>" height="<?php echo $monitor->Height() ?>" style="position:absolute; top: 0; left: 0; background: none;">
|
|
||||||
<?php
|
|
||||||
foreach( array_reverse($zones) as $zone ) {
|
|
||||||
?>
|
|
||||||
<polygon points="<?php echo $zone['AreaCoords'] ?>" class="<?php echo $zone['Type']?>" onclick="streamCmdQuit( true ); createPopup( '?view=zone&mid=<?php echo $mid ?>&zid=<?php echo $zone['Id'] ?>', 'zmZone', 'zone', <?php echo $monitor->Width ?>, <?php echo $monitor->Height ?> ); return( false );"/>
|
|
||||||
<?php
|
|
||||||
} // end foreach zone
|
|
||||||
?>
|
|
||||||
Sorry, your browser does not support inline SVG
|
|
||||||
</svg>
|
|
||||||
<form name="contentForm" id="contentForm" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
<form name="contentForm" id="contentForm" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
|
||||||
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
||||||
<input type="hidden" name="action" value="delete"/>
|
<input type="hidden" name="action" value="delete"/>
|
||||||
<input type="hidden" name="mid" value="<?php echo $mid ?>"/>
|
<input type="hidden" name="mid" value="<?php echo $mid ?>"/>
|
||||||
|
<div id="contentButtons">
|
||||||
|
<input type="button" value="<?php echo translate('AddNewZone') ?>" onclick="createPopup( '?view=zone&mid=<?php echo $mid ?>&zid=0', 'zmZone', 'zone', <?php echo $monitor->Width() ?>, <?php echo $monitor->Height() ?> );"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/>
|
||||||
|
<input type="submit" name="deleteBtn" value="<?php echo translate('Delete') ?>" disabled="disabled"/>
|
||||||
|
</div>
|
||||||
<table id="contentTable" class="major" cellspacing="0">
|
<table id="contentTable" class="major" cellspacing="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -88,9 +85,18 @@ foreach( $zones as $zone )
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div id="contentButtons">
|
<div class="ZonesImage" style="position:relative; clear:both;">
|
||||||
<input type="button" value="<?php echo translate('AddNewZone') ?>" onclick="createPopup( '?view=zone&mid=<?php echo $mid ?>&zid=0', 'zmZone', 'zone', <?php echo $monitor->Width() ?>, <?php echo $monitor->Height() ?> );"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/>
|
<?php echo getStreamHTML( $monitor ); ?>
|
||||||
<input type="submit" name="deleteBtn" value="<?php echo translate('Delete') ?>" disabled="disabled"/>
|
<svg class="zones" width="<?php echo $monitor->Width() ?>" height="<?php echo $monitor->Height() ?>" style="position:absolute; top: 0; left: 0; background: none;">
|
||||||
|
<?php
|
||||||
|
foreach( array_reverse($zones) as $zone ) {
|
||||||
|
?>
|
||||||
|
<polygon points="<?php echo $zone['AreaCoords'] ?>" class="<?php echo $zone['Type']?>" onclick="streamCmdQuit( true ); createPopup( '?view=zone&mid=<?php echo $mid ?>&zid=<?php echo $zone['Id'] ?>', 'zmZone', 'zone', <?php echo $monitor->Width ?>, <?php echo $monitor->Height ?> ); return( false );"/>
|
||||||
|
<?php
|
||||||
|
} // end foreach zone
|
||||||
|
?>
|
||||||
|
Sorry, your browser does not support inline SVG
|
||||||
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue