Added support for remote cameras.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@407 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-03-26 11:41:22 +00:00
parent c7f87a7cb1
commit ea0462fb2c
7 changed files with 118 additions and 136 deletions

View File

@ -84,7 +84,8 @@ if ( $needs_daemon )
foreach my $arg ( @ARGV ) foreach my $arg ( @ARGV )
{ {
# Detaint arguments, if they look ok # Detaint arguments, if they look ok
if ( $arg =~ /^(-{0,2}[\w]+)/ ) #if ( $arg =~ /^(-{0,2}[\w]+)/ )
if ( $arg =~ /^(-{0,2}[\w\/?&=.-]+)$/ )
{ {
push( @args, $1 ); push( @args, $1 );
} }
@ -215,7 +216,8 @@ if ( !connect( CLIENT, $saddr ) )
foreach my $arg ( @args ) foreach my $arg ( @args )
{ {
# Detaint arguments, if they look ok # Detaint arguments, if they look ok
if ( $arg =~ /^(-{0,2}[\w]+)/ ) #if ( $arg =~ /^(-{0,2}[\w]+)/ )
if ( $arg =~ /^(-{0,2}[\w\/?&=.-]+)$/ )
{ {
push( @good_args, $1 ); push( @good_args, $1 );
} }

View File

@ -131,8 +131,15 @@ if ( $command =~ /^(?:start|restart)$/ )
while( my $monitor = $sth->fetchrow_hashref() ) while( my $monitor = $sth->fetchrow_hashref() )
{ {
if ( $monitor->{Function} ne 'None' ) if ( $monitor->{Function} ne 'None' )
{
if ( $monitor->{Type} eq 'Local' )
{ {
execute( ZM_PATH_BIN."/zmdc.pl start zmc -d $monitor->{Device}" ); execute( ZM_PATH_BIN."/zmdc.pl start zmc -d $monitor->{Device}" );
}
else
{
execute( ZM_PATH_BIN."/zmdc.pl start zmc -H $monitor->{Host} -P $monitor->{Port} -p '$monitor->{Path}'" );
}
if ( $monitor->{Function} eq 'Active' ) if ( $monitor->{Function} eq 'Active' )
{ {
execute( ZM_PATH_BIN."/zmdc.pl start zma -m $monitor->{Id}" ); execute( ZM_PATH_BIN."/zmdc.pl start zma -m $monitor->{Id}" );

View File

@ -106,7 +106,14 @@ while( 1 )
next; next;
} }
# If we are here then something bad has happened # If we are here then something bad has happened
$command = ZM_PATH_BIN."/zmdc.pl restart zmc -d ".$monitor->{Device}; if ( $monitor->{Type} eq 'Local' )
{
$command = ZM_PATH_BIN."/zmdc.pl restart zmc -d $monitor->{Device}";
}
else
{
$command = ZM_PATH_BIN."/zmdc.pl restart zmc -H $monitor->{Host} -P $monitor->{Port} -p '$monitor->{Path}'";
}
print( "Restarting capture daemon ('$command')\n" ); print( "Restarting capture daemon ('$command')\n" );
print( qx( $command ) ); print( qx( $command ) );
} }

View File

@ -231,9 +231,19 @@ if ( $action )
$changes = array(); $changes = array();
if ( $new_name != $monitor[Name] ) $changes[] = "Name = '$new_name'"; if ( $new_name != $monitor[Name] ) $changes[] = "Name = '$new_name'";
if ( $new_function != $monitor['Function'] ) $changes[] = "Function = '$new_function'"; if ( $new_function != $monitor['Function'] ) $changes[] = "Function = '$new_function'";
if ( $new_type != $monitor['Type'] ) $changes[] = "Type = '$new_type'";
if ( $new_type == "Local" )
{
if ( $new_device != $monitor['Device'] ) $changes[] = "Device = '$new_device'"; if ( $new_device != $monitor['Device'] ) $changes[] = "Device = '$new_device'";
if ( $new_channel != $monitor['Channel'] ) $changes[] = "Channel = '$new_channel'"; if ( $new_channel != $monitor['Channel'] ) $changes[] = "Channel = '$new_channel'";
if ( $new_format != $monitor['Format'] ) $changes[] = "Format = '$new_format'"; if ( $new_format != $monitor['Format'] ) $changes[] = "Format = '$new_format'";
}
else
{
if ( $new_host != $monitor['Device'] ) $changes[] = "Host = '$new_host'";
if ( $new_port != $monitor['Channel'] ) $changes[] = "port = '$new_port'";
if ( $new_path != $monitor['Format'] ) $changes[] = "Path = '$new_path'";
}
if ( $new_width != $monitor['Width'] ) $changes[] = "Width = '$new_width'"; if ( $new_width != $monitor['Width'] ) $changes[] = "Width = '$new_width'";
if ( $new_height != $monitor['Height'] ) $changes[] = "Height = '$new_height'"; if ( $new_height != $monitor['Height'] ) $changes[] = "Height = '$new_height'";
if ( $new_colours != $monitor['Colours'] ) $changes[] = "Colours = '$new_colours'"; if ( $new_colours != $monitor['Colours'] ) $changes[] = "Colours = '$new_colours'";

View File

@ -143,10 +143,10 @@ $jws = array(
'console' => array( 'w'=>720, 'h'=>400 ), 'console' => array( 'w'=>720, 'h'=>400 ),
'cycle' => array( 'w'=>46, 'h'=>80 ), 'cycle' => array( 'w'=>46, 'h'=>80 ),
'montage' => array( 'w'=>20, 'h'=>20 ), 'montage' => array( 'w'=>20, 'h'=>20 ),
'monitor' => array( 'w'=>360, 'h'=>450 ), 'monitor' => array( 'w'=>420, 'h'=>480 ),
'watch' => array( 'w'=>72, 'h'=>315 ), 'watch' => array( 'w'=>72, 'h'=>315 ),
'device' => array( 'w'=>196, 'h'=>164 ), 'device' => array( 'w'=>196, 'h'=>164 ),
'function' => array( 'w'=>248, 'h'=>72 ), 'function' => array( 'w'=>248, 'h'=>92 ),
'events' => array( 'w'=>720, 'h'=>480 ), 'events' => array( 'w'=>720, 'h'=>480 ),
'event' => array( 'w'=>420, 'h'=>500 ), 'event' => array( 'w'=>420, 'h'=>500 ),
'filter' => array( 'w'=>560, 'h'=>250 ), 'filter' => array( 'w'=>560, 'h'=>250 ),

View File

@ -106,13 +106,19 @@ function daemonControl( $command, $daemon=false, $args=false )
exec( $string ); exec( $string );
} }
function zmcControl( $device, $restart=false ) function zmcControl( $monitor, $restart=false )
{ {
if ( is_array( $device ) ) print_r( $monitor );
if ( $monitor[Type] == "Local" )
{ {
$device = $device[Device]; $sql = "select count(if(Function='Passive',1,NULL)) as PassiveCount, count(if(Function='Active',1,NULL)) as ActiveCount, count(if(Function='X10',1,NULL)) as X10Count from Monitors where Device = '$monitor[Device]'";
$zmc_args = "-d $monitor[Device]";
}
else
{
$sql = "select count(if(Function='Passive',1,NULL)) as PassiveCount, count(if(Function='Active',1,NULL)) as ActiveCount, count(if(Function='X10',1,NULL)) as X10Count from Monitors where Host = '$monitor[Host]' and Port = '$monitor[Port]' and Path = '$monitor[Path]'";
$zmc_args = "-H $monitor[Host] -P $monitor[Port] -p '$monitor[Path]'";
} }
$sql = "select count(if(Function='Passive',1,NULL)) as PassiveCount, count(if(Function='Active',1,NULL)) as ActiveCount, count(if(Function='X10',1,NULL)) as X10Count from Monitors where Device = '$device'";
$result = mysql_query( $sql ); $result = mysql_query( $sql );
if ( !$result ) if ( !$result )
echo mysql_error(); echo mysql_error();
@ -123,15 +129,15 @@ function zmcControl( $device, $restart=false )
if ( !$passive_count && !$active_count && !$x10_count ) if ( !$passive_count && !$active_count && !$x10_count )
{ {
daemonControl( "stop", "zmc", "-d $device" ); daemonControl( "stop", "zmc", $zmc_args );
} }
else else
{ {
if ( $restart ) if ( $restart )
{ {
daemonControl( "stop", "zmc", "-d $device" ); daemonControl( "stop", "zmc", $zmc_args );
} }
daemonControl( "start", "zmc", "-d $device" ); daemonControl( "start", "zmc", $zmc_args );
} }
} }
@ -172,13 +178,17 @@ function daemonCheck( $daemon=false, $args=false )
return( preg_match( '/running/', $result ) ); return( preg_match( '/running/', $result ) );
} }
function zmcCheck( $device ) function zmcCheck( $monitor )
{ {
if ( is_array( $device ) ) if ( $monitor[Type] == 'Local' )
{ {
$device = $device[Device]; $zmc_args = "-d $monitor[Device]";
} }
return( daemonCheck( "zmc", "-d $device" ) ); else
{
$zmc_args = "-H $monitor[Host] -P $monitor[Port] -p '$monitor[Path]'";
}
return( daemonCheck( "zmc", $zmc_args ) );
} }
function zmaCheck( $monitor ) function zmaCheck( $monitor )

View File

@ -64,20 +64,8 @@ switch( $view )
header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0 header("Pragma: no-cache"); // HTTP/1.0
$sql = "select distinct Device from Monitors order by Device";
$result = mysql_query( $sql );
if ( !$result )
echo mysql_error();
$devices = array();
while( $row = mysql_fetch_assoc( $result ) )
{
$row['zmc'] = zmcCheck( $row );
$devices[$row[Device]] = $row;
}
$db_now = strftime( "%Y-%m-%d %H:%M:%S" ); $db_now = strftime( "%Y-%m-%d %H:%M:%S" );
$sql = "select M.*, count(E.Id) as EventCount, count(if(E.Archived,1,NULL)) as ArchEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 1 HOUR && E.Archived = 0,1,NULL)) as HourEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 1 DAY && E.Archived = 0,1,NULL)) as DayEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 7 DAY && E.Archived = 0,1,NULL)) as WeekEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 1 MONTH && E.Archived = 0,1,NULL)) as MonthEventCount from Monitors as M left join Events as E on E.MonitorId = M.Id group by E.MonitorId order by Id"; $sql = "select M.*, count(E.Id) as EventCount, count(if(E.Archived,1,NULL)) as ArchEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 1 HOUR && E.Archived = 0,1,NULL)) as HourEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 1 DAY && E.Archived = 0,1,NULL)) as DayEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 7 DAY && E.Archived = 0,1,NULL)) as WeekEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 1 MONTH && E.Archived = 0,1,NULL)) as MonthEventCount from Monitors as M left join Events as E on E.MonitorId = M.Id group by M.Id order by M.Id";
$result = mysql_query( $sql ); $result = mysql_query( $sql );
if ( !$result ) if ( !$result )
echo mysql_error(); echo mysql_error();
@ -87,6 +75,7 @@ switch( $view )
$cycle_count = 0; $cycle_count = 0;
while( $row = mysql_fetch_assoc( $result ) ) while( $row = mysql_fetch_assoc( $result ) )
{ {
$row['zmc'] = zmcCheck( $row );
$row['zma'] = zmaCheck( $row ); $row['zma'] = zmaCheck( $row );
$sql = "select count(Id) as ZoneCount, count(if(Type='Active',1,NULL)) as ActZoneCount, count(if(Type='Inclusive',1,NULL)) as IncZoneCount, count(if(Type='Exclusive',1,NULL)) as ExcZoneCount, count(if(Type='Inactive',1,NULL)) as InactZoneCount from Zones where MonitorId = '$row[Id]'"; $sql = "select count(Id) as ZoneCount, count(if(Type='Active',1,NULL)) as ActZoneCount, count(if(Type='Inclusive',1,NULL)) as IncZoneCount, count(if(Type='Exclusive',1,NULL)) as ExcZoneCount, count(if(Type='Inactive',1,NULL)) as InactZoneCount from Zones where MonitorId = '$row[Id]'";
$result2 = mysql_query( $sql ); $result2 = mysql_query( $sql );
@ -183,7 +172,7 @@ function confirmStatus( new_status )
<tr><td align="left" class="smallhead">Id</td> <tr><td align="left" class="smallhead">Id</td>
<td align="left" class="smallhead">Name</td> <td align="left" class="smallhead">Name</td>
<td align="left" class="smallhead">Function</td> <td align="left" class="smallhead">Function</td>
<td align="left" class="smallhead">Device/Channel</td> <td align="left" class="smallhead">Source</td>
<!--<td align="left" class="smallhead">Dimensions</td>--> <!--<td align="left" class="smallhead">Dimensions</td>-->
<td align="right" class="smallhead">Events</td> <td align="right" class="smallhead">Events</td>
<td align="right" class="smallhead">Hour</td> <td align="right" class="smallhead">Hour</td>
@ -204,7 +193,6 @@ function confirmStatus( new_status )
$zone_count = 0; $zone_count = 0;
foreach( $monitors as $monitor ) foreach( $monitors as $monitor )
{ {
$device = $devices[$monitor[Device]];
$event_count += $monitor[EventCount]; $event_count += $monitor[EventCount];
$hour_event_count += $monitor[HourEventCount]; $hour_event_count += $monitor[HourEventCount];
$day_event_count += $monitor[DayEventCount]; $day_event_count += $monitor[DayEventCount];
@ -216,7 +204,7 @@ function confirmStatus( new_status )
<tr> <tr>
<td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=monitor&mid=<?= $monitor[Id] ?>', 'zmMonitor', <?= $jws['monitor']['w'] ?>, <?= $jws['monitor']['h'] ?> );"><?= $monitor[Id] ?>.</a></td> <td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=monitor&mid=<?= $monitor[Id] ?>', 'zmMonitor', <?= $jws['monitor']['w'] ?>, <?= $jws['monitor']['h'] ?> );"><?= $monitor[Id] ?>.</a></td>
<?php <?php
if ( !$device[zmc] ) if ( !$monitor[zmc] )
{ {
$dclass = "redtext"; $dclass = "redtext";
} }
@ -250,7 +238,11 @@ function confirmStatus( new_status )
?> ?>
<td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor[Id] ?>', 'zmWatch<?= $monitor[Name] ?>', <?= $monitor[Width]+$jws['watch']['w'] ?>, <?= $monitor[Height]+$jws['watch']['h'] ?> );"><?= $monitor[Name] ?></a></td> <td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor[Id] ?>', 'zmWatch<?= $monitor[Name] ?>', <?= $monitor[Width]+$jws['watch']['w'] ?>, <?= $monitor[Height]+$jws['watch']['h'] ?> );"><?= $monitor[Name] ?></a></td>
<td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=function&mid=<?= $monitor[Id] ?>', 'zmFunction', <?= $jws['function']['w'] ?>, <?= $jws['function']['h'] ?> );"><span class="<?= $fclass ?>"><?= $monitor['Function'] ?></span></a></td> <td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=function&mid=<?= $monitor[Id] ?>', 'zmFunction', <?= $jws['function']['w'] ?>, <?= $jws['function']['h'] ?> );"><span class="<?= $fclass ?>"><?= $monitor['Function'] ?></span></a></td>
<?php if ( $monitor[Type] == "Local" ) { ?>
<td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=monitor&mid=<?= $monitor[Id] ?>', 'zmMonitor', <?= $jws['monitor']['w'] ?>, <?= $jws['monitor']['h'] ?> );"><span class="<?= $dclass ?>">/dev/video<?= $monitor[Device] ?> (<?= $monitor[Channel] ?>)</span></a></td> <td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=monitor&mid=<?= $monitor[Id] ?>', 'zmMonitor', <?= $jws['monitor']['w'] ?>, <?= $jws['monitor']['h'] ?> );"><span class="<?= $dclass ?>">/dev/video<?= $monitor[Device] ?> (<?= $monitor[Channel] ?>)</span></a></td>
<?php } else { ?>
<td align="left" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=monitor&mid=<?= $monitor[Id] ?>', 'zmMonitor', <?= $jws['monitor']['w'] ?>, <?= $jws['monitor']['h'] ?> );"><span class="<?= $dclass ?>"><?= $monitor[Host] ?></span></a></td>
<?php } ?>
<!--<td align="left" class="text"><?= $monitor[Width] ?>x<?= $monitor[Height] ?>x<?= $monitor[Colours]*8 ?></td>--> <!--<td align="left" class="text"><?= $monitor[Width] ?>x<?= $monitor[Height] ?>x<?= $monitor[Colours]*8 ?></td>-->
<td align="right" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=events&mid=<?= $monitor[Id] ?>&filter=1', 'zmEvents<?= $monitor[Name] ?>', <?= $jws['events']['w'] ?>, <?= $jws['events']['h'] ?> );"><?= $monitor[EventCount] ?></a></td> <td align="right" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=events&mid=<?= $monitor[Id] ?>&filter=1', 'zmEvents<?= $monitor[Name] ?>', <?= $jws['events']['w'] ?>, <?= $jws['events']['h'] ?> );"><?= $monitor[EventCount] ?></a></td>
<td align="right" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=events&mid=<?= $monitor[Id] ?>&filter=1&trms=2&attr1=Archived&val1=0&cnj2=and&attr2=DateTime&op2=%3e%3d&val2=last+hour', 'zmEvents<?= $monitor[Name] ?>', <?= $jws['events']['w'] ?>, <?= $jws['events']['h'] ?> );"><?= $monitor[HourEventCount] ?></a></td> <td align="right" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=events&mid=<?= $monitor[Id] ?>&filter=1&trms=2&attr1=Archived&val1=0&cnj2=and&attr2=DateTime&op2=%3e%3d&val2=last+hour', 'zmEvents<?= $monitor[Name] ?>', <?= $jws['events']['w'] ?>, <?= $jws['events']['h'] ?> );"><?= $monitor[HourEventCount] ?></a></td>
@ -1952,6 +1944,9 @@ function configureButton(form,name)
{ {
$monitor = array(); $monitor = array();
$monitor[Name] = "New"; $monitor[Name] = "New";
$monitor['Function'] = "None";
$monitor[Type] = "Local";
$monitor[Port] = "80";
$monitor[LabelFormat] = '%%s - %y/%m/%d %H:%M:%S'; $monitor[LabelFormat] = '%%s - %y/%m/%d %H:%M:%S';
$monitor[LabelX] = 0; $monitor[LabelX] = 0;
$monitor[LabelY] = 0; $monitor[LabelY] = 0;
@ -1995,7 +1990,7 @@ function closeWindow()
</tr> </tr>
<form name="monitorForm" method="get" action="<?= $PHP_SELF ?>" onsubmit="return validateForm(this)"> <form name="monitorForm" method="get" action="<?= $PHP_SELF ?>" onsubmit="return validateForm(this)">
<input type="hidden" name="view" value="<?= $view ?>"> <input type="hidden" name="view" value="<?= $view ?>">
<input type="hidden" name="action" value="monitor"> <input type="hidden" name="action" value="">
<input type="hidden" name="mid" value="<?= $mid ?>"> <input type="hidden" name="mid" value="<?= $mid ?>">
<tr> <tr>
<td align="left" class="smallhead">Parameter</td><td align="left" class="smallhead">Value</td> <td align="left" class="smallhead">Parameter</td><td align="left" class="smallhead">Value</td>
@ -2013,13 +2008,34 @@ function closeWindow()
} }
?> ?>
</select></td></tr> </select></td></tr>
<?php
$select_name = "new_type";
$$select_name = $$select_name?$$select_name:$monitor[Type];
$source_types = array( "Local"=>"Local", "Remote"=>"Remote" );
?>
<tr><td align="left" class="text">Source Type</td><td><?php buildSelect( $select_name, $source_types, "monitorForm.submit();" ); ?></td></tr>
<?php
if ( $$select_name == "Local" )
{
?>
<tr><td align="left" class="text">Device Number (/dev/video?)</td><td align="left" class="text"><input type="text" name="new_device" value="<?= $monitor[Device] ?>" size="4" class="form"></td></tr> <tr><td align="left" class="text">Device Number (/dev/video?)</td><td align="left" class="text"><input type="text" name="new_device" value="<?= $monitor[Device] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Device Channel</td><td align="left" class="text"><input type="text" name="new_channel" value="<?= $monitor[Channel] ?>" size="4" class="form"></td></tr> <tr><td align="left" class="text">Device Channel</td><td align="left" class="text"><input type="text" name="new_channel" value="<?= $monitor[Channel] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Device Format (0=PAL,1=NTSC etc)</td><td align="left" class="text"><input type="text" name="new_format" value="<?= $monitor[Format] ?>" size="4" class="form"></td></tr> <tr><td align="left" class="text">Device Format (0=PAL,1=NTSC etc)</td><td align="left" class="text"><input type="text" name="new_format" value="<?= $monitor[Format] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Device Width (pixels)</td><td align="left" class="text"><input type="text" name="new_width" value="<?= $monitor[Width] ?>" size="4" class="form"></td></tr> <?php
<tr><td align="left" class="text">Device Height (pixels)</td><td align="left" class="text"><input type="text" name="new_height" value="<?= $monitor[Height] ?>" size="4" class="form"></td></tr> }
else
{
?>
<tr><td align="left" class="text">Remote Host Name</td><td align="left" class="text"><input type="text" name="new_host" value="<?= $monitor[Host] ?>" size="16" class="form"></td></tr>
<tr><td align="left" class="text">Remote Host Port</td><td align="left" class="text"><input type="text" name="new_port" value="<?= $monitor[Port] ?>" size="6" class="form"></td></tr>
<tr><td align="left" class="text">Remote Host Path</td><td align="left" class="text"><input type="text" name="new_path" value="<?= $monitor[Path] ?>" size="36" class="form"></td></tr>
<?php
}
?>
<tr><td align="left" class="text">Capture Width (pixels)</td><td align="left" class="text"><input type="text" name="new_width" value="<?= $monitor[Width] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Capture Height (pixels)</td><td align="left" class="text"><input type="text" name="new_height" value="<?= $monitor[Height] ?>" size="4" class="form"></td></tr>
<?php $depths = array( 8, 24 ); ?> <?php $depths = array( 8, 24 ); ?>
<tr><td align="left" class="text">Device Colour Depth (bits)</td><td align="left" class="text"><select name="new_colours" class="form"><?php foreach ( $depths as $depth ) { ?><option<?php if ( $depth == $monitor[Colours] ) { ?> selected<?php } ?>><?= $depth ?></option><?php } ?></select></td></tr> <tr><td align="left" class="text">Capture Colour Depth (bits)</td><td align="left" class="text"><select name="new_colours" class="form"><?php foreach ( $depths as $depth ) { ?><option<?php if ( $depth == $monitor[Colours] ) { ?> selected<?php } ?>><?= $depth ?></option><?php } ?></select></td></tr>
<tr><td align="left" class="text">Timestamp Label Format</td><td align="left" class="text"><input type="text" name="new_label_format" value="<?= $monitor[LabelFormat] ?>" size="20" class="form"></td></tr> <tr><td align="left" class="text">Timestamp Label Format</td><td align="left" class="text"><input type="text" name="new_label_format" value="<?= $monitor[LabelFormat] ?>" size="20" class="form"></td></tr>
<tr><td align="left" class="text">Timestamp Label X</td><td align="left" class="text"><input type="text" name="new_label_x" value="<?= $monitor[LabelX] ?>" size="4" class="form"></td></tr> <tr><td align="left" class="text">Timestamp Label X</td><td align="left" class="text"><input type="text" name="new_label_x" value="<?= $monitor[LabelX] ?>" size="4" class="form"></td></tr>
<tr><td align="left" class="text">Timestamp Label Y</td><td align="left" class="text"><input type="text" name="new_label_y" value="<?= $monitor[LabelY] ?>" size="4" class="form"></td></tr> <tr><td align="left" class="text">Timestamp Label Y</td><td align="left" class="text"><input type="text" name="new_label_y" value="<?= $monitor[LabelY] ?>" size="4" class="form"></td></tr>
@ -2036,7 +2052,7 @@ function closeWindow()
<?php } ?> <?php } ?>
<tr><td colspan="2" align="left" class="text">&nbsp;</td></tr> <tr><td colspan="2" align="left" class="text">&nbsp;</td></tr>
<tr> <tr>
<td align="left"><input type="submit" value="Save" class="form"></td> <td align="left"><input type="submit" value="Save" class="form" onClick="monitorForm.view.value='none'; monitorForm.action.value='monitor';"></td>
<td align="left"><input type="button" value="Cancel" class="form" onClick="closeWindow()"></td> <td align="left"><input type="button" value="Cancel" class="form" onClick="closeWindow()"></td>
</tr> </tr>
</table> </table>
@ -2361,76 +2377,6 @@ function closeWindow()
break; break;
} }
case "device" :
{
$ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $did' | grep -v grep" ) );
if ( $ps_array[3] )
{
$zmc = 1;
}
$ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zma $did' | grep -v grep" ) );
if ( $ps_array[3] )
{
$zma = 1;
}
?>
<html>
<head>
<title>ZM - Device - /dev/video<?= $did ?></title>
<link rel="stylesheet" href="zmstyles.css" type="text/css">
<script language="JavaScript">
<?php
if ( $zmc_status != $zmc_action || $zma_status != $zma_action )
{
?>
opener.location.reload();
<?php
}
?>
window.focus();
function refreshWindow()
{
window.location.reload();
}
function closeWindow()
{
window.close();
}
</script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" align="left" class="head">Device Daemon Status</td>
</tr>
<form method="get" action="<?= $PHP_SELF ?>">
<input type="hidden" name="view" value="<?= $view ?>">
<input type="hidden" name="action" value="device">
<input type="hidden" name="zmc_status" value="<?= $zmc ?>">
<input type="hidden" name="zma_status" value="<?= $zma ?>">
<input type="hidden" name="did" value="<?= $did ?>">
<tr>
<td align="left" class="smallhead">Daemon</td><td align="left" class="smallhead">Active</td>
</tr>
<tr>
<td align="left" class="text">Capture</td><td align="left" class="text"><input type="checkbox" name="zmc_action" value="1"<?php if ( $zmc ) { echo " checked"; } ?> class="form"></td>
</tr>
<tr>
<td align="left" class="text">Analysis</td><td align="left" class="text"><input type="checkbox" name="zma_action" value="1"<?php if ( $zma ) { echo " checked"; } ?> class="form"></td>
</tr>
<tr>
<td colspan="2" align="left" class="text">&nbsp;</td>
</tr>
<tr>
<td align="left"><input type="submit" value="Save" class="form"></td>
<td align="left"><input type="button" value="Cancel" class="form" onClick="closeWindow()"></td>
</tr>
</table>
</body>
</html>
<?php
break;
}
case "function" : case "function" :
{ {
$result = mysql_query( "select * from Monitors where Id = '$mid'" ); $result = mysql_query( "select * from Monitors where Id = '$mid'" );