2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
//
|
|
|
|
// ZoneMinder web zones view file, $Date$, $Revision$
|
2005-02-24 22:40:14 +08:00
|
|
|
// Copyright (C) 2003, 2004, 2005 Philip Coombes
|
2004-01-08 19:45:57 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
2003-07-11 17:27:56 +08:00
|
|
|
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( !canView( 'Monitors' ) )
|
|
|
|
{
|
|
|
|
$view = "error";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
chdir( ZM_DIR_IMAGES );
|
2005-01-19 09:50:24 +08:00
|
|
|
$status = exec( escapeshellcmd( getZmuCommand( " -m $mid -z" ) ) );
|
2004-01-08 19:45:57 +08:00
|
|
|
chdir( '..' );
|
2003-07-11 17:27:56 +08:00
|
|
|
|
2004-01-08 19:45:57 +08:00
|
|
|
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
|
|
|
if ( !$result )
|
|
|
|
die( mysql_error() );
|
|
|
|
$monitor = mysql_fetch_assoc( $result );
|
2006-01-15 21:09:30 +08:00
|
|
|
mysql_free_result( $result );
|
2004-01-08 19:45:57 +08:00
|
|
|
|
2005-11-30 01:51:06 +08:00
|
|
|
$result = mysql_query( "select * from Zones where MonitorId = '$mid' order by Area desc" );
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( !$result )
|
|
|
|
die( mysql_error() );
|
|
|
|
$zones = array();
|
|
|
|
while( $row = mysql_fetch_assoc( $result ) )
|
|
|
|
{
|
2005-11-30 01:51:06 +08:00
|
|
|
if ( $row['Points'] = coordsToPoints( $row['Coords'] ) )
|
|
|
|
{
|
|
|
|
$row['AreaCoords'] = preg_replace( '/\s+/', ',', $row['Coords'] );
|
|
|
|
$zones[] = $row;
|
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2006-01-15 21:09:30 +08:00
|
|
|
mysql_free_result( $result );
|
2004-01-08 19:45:57 +08:00
|
|
|
|
|
|
|
$image = $monitor['Name']."-Zones.jpg";
|
2003-07-11 17:27:56 +08:00
|
|
|
|
|
|
|
?>
|
2004-12-29 03:22:23 +08:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2003-07-11 17:27:56 +08:00
|
|
|
<html>
|
|
|
|
<head>
|
2005-05-06 20:24:57 +08:00
|
|
|
<title><?= ZM_WEB_TITLE_PREFIX ?> - <?= $monitor['Name'] ?> - <?= $zmSlangZones ?></title>
|
2004-12-29 02:20:11 +08:00
|
|
|
<link rel="stylesheet" href="zm_html_styles.css" type="text/css">
|
2004-12-29 03:29:43 +08:00
|
|
|
<script type="text/javascript">
|
2003-07-11 17:27:56 +08:00
|
|
|
window.focus();
|
|
|
|
function newWindow(Url,Name,Width,Height)
|
|
|
|
{
|
2005-11-30 01:51:06 +08:00
|
|
|
var Win = window.open(Url,Name,"resizable,width="+Width+",height="+Height);
|
2003-07-11 17:27:56 +08:00
|
|
|
}
|
|
|
|
function closeWindow()
|
|
|
|
{
|
|
|
|
window.close();
|
|
|
|
}
|
|
|
|
function configureButton(form,name)
|
|
|
|
{
|
|
|
|
var checked = false;
|
|
|
|
for (var i = 0; i < form.elements.length; i++)
|
|
|
|
{
|
|
|
|
if ( form.elements[i].name.indexOf(name) == 0)
|
|
|
|
{
|
|
|
|
if ( form.elements[i].checked )
|
|
|
|
{
|
|
|
|
checked = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
form.delete_btn.disabled = !checked;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<map name="zonemap">
|
|
|
|
<?php
|
2005-11-30 01:51:06 +08:00
|
|
|
foreach( array_reverse($zones) as $zone )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2005-11-30 01:51:06 +08:00
|
|
|
<area shape="poly" coords="<?= $zone['AreaCoords'] ?>" href="javascript: newWindow( '<?= $PHP_SELF ?>?view=zone&mid=<?= $mid ?>&zid=<?= $zone['Id'] ?>', 'zmZone', <?= $monitor['Width']+$jws['zone']['w'] ?>, <?= $monitor['Height']<$jws['zone']['h']?$jws['zone']['h']:$monitor['Height'] ?> );">
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
<area shape="default" nohref>
|
|
|
|
</map>
|
|
|
|
<table align="center" border="0" cellspacing="2" cellpadding="2" width="96%">
|
|
|
|
<tr>
|
|
|
|
<td width="33%" align="left" class="text"> </td>
|
2004-01-08 18:09:35 +08:00
|
|
|
<td width="34%" align="center" class="head"><strong><?= $monitor['Name'] ?> <?= $zmSlangZones ?></strong></td>
|
2004-01-07 20:57:07 +08:00
|
|
|
<td width="33%" align="right" class="text"><a href="javascript: closeWindow();"><?= $zmSlangClose ?></a></td>
|
2003-07-11 17:27:56 +08:00
|
|
|
</tr>
|
2004-01-08 18:09:35 +08:00
|
|
|
<tr><td colspan="3" align="center"><img src="<?= ZM_DIR_IMAGES.'/'.$image ?>" usemap="#zonemap" width="<?= $monitor['Width'] ?>" height="<?= $monitor['Height'] ?>" border="0"></td></tr>
|
2003-07-11 17:27:56 +08:00
|
|
|
</table>
|
|
|
|
<table align="center" border="0" cellspacing="0" cellpadding="0" width="96%">
|
|
|
|
<form name="zone_form" method="get" action="<?= $PHP_SELF ?>">
|
|
|
|
<input type="hidden" name="view" value="<?= $view ?>">
|
|
|
|
<input type="hidden" name="action" value="delete">
|
|
|
|
<input type="hidden" name="mid" value="<?= $mid ?>">
|
2004-01-07 20:57:07 +08:00
|
|
|
<tr><td align="center" class="smallhead"><?= $zmSlangId ?></td>
|
|
|
|
<td align="center" class="smallhead"><?= $zmSlangName ?></td>
|
|
|
|
<td align="center" class="smallhead"><?= $zmSlangType ?></td>
|
2005-11-30 01:51:06 +08:00
|
|
|
<td align="center" class="smallhead"><?= $zmSlangAreaUnits ?></td>
|
2004-01-07 20:57:07 +08:00
|
|
|
<td align="center" class="smallhead"><?= $zmSlangMark ?></td>
|
2003-07-11 17:27:56 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
foreach( $zones as $zone )
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
2005-11-30 01:51:06 +08:00
|
|
|
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=zone&mid=<?= $mid ?>&zid=<?= $zone['Id'] ?>', 'zmZone', <?= $monitor['Width']+$jws['zone']['w'] ?>, <?= $monitor['Height']<$jws['zone']['h']?$jws['zone']['h']:$monitor['Height'] ?> );"><?= $zone['Id'] ?>.</a></td>
|
|
|
|
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=zone&mid=<?= $mid ?>&zid=<?= $zone['Id'] ?>', 'zmZone', <?= $monitor['Width']+$jws['zone']['w'] ?>, <?= $monitor['Height']<$jws['zone']['h']?$jws['zone']['h']:$monitor['Height'] ?> );"><?= $zone['Name'] ?></a></td>
|
2003-07-11 17:27:56 +08:00
|
|
|
<td align="center" class="text"><?= $zone['Type'] ?></td>
|
2005-11-30 01:51:06 +08:00
|
|
|
<td align="center" class="text"><?= $zone['Area'] ?> / <?= sprintf( "%.2f", ($zone['Area']*100)/($monitor['Width']*$monitor['Height']) ) ?></td>
|
2004-01-08 18:09:35 +08:00
|
|
|
<td align="center" class="text"><input type="checkbox" name="mark_zids[]" value="<?= $zone['Id'] ?>" onClick="configureButton( document.zone_form, 'mark_zids' );"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled<?php } ?>></td>
|
2003-07-11 17:27:56 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<td align="center" class="text"> </td>
|
2005-11-30 01:51:06 +08:00
|
|
|
<td colspan="3" align="center"><input type="button" value="<?= $zmSlangAddNewZone ?>" class="form" onClick="javascript: newWindow( '<?= $PHP_SELF ?>?view=zone&mid=<?= $mid ?>&zid=0', 'zmZone', <?= $monitor['Width']+$jws['zone']['w'] ?>, <?= $monitor['Height']<$jws['zone']['h']?$jws['zone']['h']:$monitor['Height'] ?> );"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled<?php } ?>></td>
|
2004-01-07 20:57:07 +08:00
|
|
|
<td align="center"><input type="submit" name="delete_btn" value="<?= $zmSlangDelete ?>" class="form" disabled></td>
|
2003-07-11 17:27:56 +08:00
|
|
|
</tr>
|
|
|
|
</form>
|
|
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|