From d5937c90427ac0395b9b0f8476fc5191bca762d2 Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 24 Dec 2002 11:56:34 +0000 Subject: [PATCH] Revamped daemon control stuff and reorganised control window. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@211 e3e1d417-86f3-4887-817a-d78f3d33393f --- web/zmhtml.php | 108 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 30 deletions(-) diff --git a/web/zmhtml.php b/web/zmhtml.php index de62b6028..553fbe756 100644 --- a/web/zmhtml.php +++ b/web/zmhtml.php @@ -44,23 +44,43 @@ switch( $view ) { case "console" : { - daemonControl( 'status' ); - if ( FAST_DELETE ) + $running = daemonCheck(); + $status = $running?"Running":"Stopped"; + $new_status = $running?"stop":"start"; + + if ( $stop ) + { + daemonControl( 'shutdown' ); + } + + if ( $start && FAST_DELETE ) { daemonControl( 'start', 'zmaudit.pl', '-d 900 -y' ); } - if ( HAS_X10 ) + if ( $start && HAS_X10 ) { daemonControl( 'start', 'zmx10.pl', '-c start' ); } - header("Refresh: ".REFRESH_MAIN."; URL='$PHP_SELF'" ); + header("Refresh: ".(($start||$stop)?1:REFRESH_MAIN)."; URL='$PHP_SELF'" ); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); 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" ); $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"; $result = mysql_query( $sql ); @@ -72,6 +92,12 @@ switch( $view ) $cycle_count = 0; while( $row = mysql_fetch_assoc( $result ) ) { + if ( $start ) + { + zmcControl( $row ); + zmaControl( $row ); + } + $row['zma'] = zmaCheck( $row ); if ( $max_width < $row[Width] ) $max_width = $row[Width]; if ( $max_height < $row[Height] ) $max_height = $row[Height]; $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]'"; @@ -80,28 +106,10 @@ switch( $view ) echo mysql_error(); $row2 = mysql_fetch_assoc( $result2 ); $monitors[] = array_merge( $row, $row2 ); - if ( $row['Function'] != 'None' ) $cycle_count++; - } - - $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 ) ) - { - $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $row[Device]' | grep -v grep" ) ); - if ( $ps_array[3] ) + if ( $row['Function'] != 'None' ) { - $row['zmc'] = 1; + $cycle_count++; } - $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zma $row[Device]' | grep -v grep" ) ); - if ( $ps_array[3] ) - { - $row['zma'] = 1; - } - $devices[] = $row; } ?> @@ -130,18 +138,22 @@ function configureButton(form,name) } form.delete_btn.disabled = !checked; } +function confirmStatus( new_status ) +{ + return( confirm( 'Are you sure you wish to '+new_status+' all processes?' ) ); +} - + - - + @@ -195,9 +207,42 @@ function configureButton(form,name) ?> + - - + + @@ -1605,6 +1650,9 @@ function closeWindow() + + + @@ -2040,7 +2088,7 @@ function closeWindow() - +
ZoneMinder ConsoleZoneMinder Console - () Report Bug
MonitorsCurrently configured for bandwidth (change to +Configured for bandwidth (change to 1, "medium"=>1, "low"=>1 ); unset( $bw_array[$bandwidth] ); @@ -162,8 +174,8 @@ function configureButton(form,name)
Id NameDevice/Channel FunctionDevice/Channel Events Hour
. ">/dev/video ()/dev/video ()
Post Event Image Buffer
FPS Report Interval
Reference Image Blend %ge
X10 Activation String
X10 Input Alarm String
X10 Output Alarm String