From 3045e9ea9fa18426a7a37eb4bb297606b64b7a57 Mon Sep 17 00:00:00 2001 From: stan Date: Sun, 7 Dec 2003 17:13:19 +0000 Subject: [PATCH] Added state change functionality and files. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@697 e3e1d417-86f3-4887-817a-d78f3d33393f --- web/Makefile.am | 4 +- web/Makefile.in | 4 +- web/zm_actions.php | 44 ++++++++- web/zm_config.php.z | 1 + web/zm_html.php | 1 + web/zm_html_view_console.php | 20 +--- web/zm_html_view_state.php | 173 +++++++++++++++++++++++++++++++++++ 7 files changed, 225 insertions(+), 22 deletions(-) create mode 100644 web/zm_html_view_state.php diff --git a/web/Makefile.am b/web/Makefile.am index 5a1182856..1b9f7481c 100644 --- a/web/Makefile.am +++ b/web/Makefile.am @@ -6,9 +6,9 @@ webdir = @WEB_PREFIX@ webuser = @WEB_USER@ webgroup = @WEB_GROUP@ -web_DATA = zm_actions.php zm_config.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_image.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_restarting.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php +web_DATA = zm_actions.php zm_config.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_image.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_restarting.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php -EXTRA_DIST = zm_config.php.z zm_actions.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_image.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_restarting.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php swap.pl retag.sh +EXTRA_DIST = zm_config.php.z zm_actions.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_image.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_restarting.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php swap.pl retag.sh # Yes, you are correct. This is a HACK! install-data-hook: diff --git a/web/Makefile.in b/web/Makefile.in index f93a1ace8..31700b00d 100644 --- a/web/Makefile.in +++ b/web/Makefile.in @@ -123,9 +123,9 @@ webdir = @WEB_PREFIX@ webuser = @WEB_USER@ webgroup = @WEB_GROUP@ -web_DATA = zm_actions.php zm_config.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_image.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_restarting.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php +web_DATA = zm_actions.php zm_config.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_image.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_restarting.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php -EXTRA_DIST = zm_config.php.z zm_actions.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_image.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_restarting.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php swap.pl retag.sh +EXTRA_DIST = zm_config.php.z zm_actions.php zm_db.php zm_funcs.php zm_html.php zm_html_view_bandwidth.php zm_html_view_function.php zm_html_view_none.php zm_html_view_video.php zm_html_view_console.php zm_html_view_state.php zm_html_view_image.php zm_html_view_optionhelp.php zm_html_view_watchevents.php zm_html_view_cycle.php zm_html_view_login.php zm_html_view_options.php zm_html_view_watchfeed.php zm_html_view_error.php zm_html_view_logout.php zm_html_view_postlogin.php zm_html_view_watch.php zm_html_view_event.php zm_html_view_monitor.php zm_html_view_restarting.php zm_html_view_watchstatus.php zm_html_view_events.php zm_html_view_montagefeed.php zm_html_view_settings.php zm_html_view_zone.php zm_html_view_filter.php zm_html_view_montage.php zm_html_view_frames.php zm_html_view_stats.php zm_html_view_zones.php zm_html_view_filtersave.php zm_html_view_montagestatus.php zm_html_view_user.php zm.php zm_styles.css zm_wml.php zm_wml_view_console.php zm_wml_view_feed.php swap.pl retag.sh subdir = web mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h diff --git a/web/zm_actions.php b/web/zm_actions.php index db2e64dc5..a4fd9d28d 100644 --- a/web/zm_actions.php +++ b/web/zm_actions.php @@ -143,6 +143,7 @@ if ( $action ) echo mysql_error(); $monitor['Function'] = $new_function; + session_write_close(); zmcControl( $monitor, true ); zmaControl( $monitor, true ); $refresh_parent = true; @@ -203,6 +204,7 @@ if ( $action ) $result = mysql_query( $sql ); if ( !$result ) die( mysql_error() ); + session_write_close(); zmaControl( $mid, true ); $refresh_parent = true; } @@ -300,6 +302,7 @@ if ( $action ) die( mysql_error() ); $monitor = mysql_fetch_assoc( $result ); fixDevices(); + session_write_close(); zmcControl( $monitor, true ); zmaControl( $monitor, true ); //daemonControl( 'restart', 'zmwatch.pl' ); @@ -326,6 +329,7 @@ if ( $action ) } if ( $deleted_zid ) { + session_write_close(); zmaControl( $mid, true ); $refresh_parent = true; } @@ -471,8 +475,47 @@ if ( $action ) } } } + elseif ( $action == "state" ) + { + if ( $run_state ) + { + session_write_close(); + packageControl( $run_state ); + $refresh_parent = true; + } + } + elseif ( $action == "save" ) + { + if ( $run_state || $new_state ) + { + $sql = "select Id,Function from Monitors order by Id"; + $result = mysql_query( $sql ); + if ( !$result ) + die( mysql_error() ); + + $definitions = array(); + while( $monitor = mysql_fetch_assoc( $result ) ) + { + $definitions[] = $monitor[Id].":".$monitor['Function']; + } + $definition = join( ',', $definitions ); + if ( $new_state ) + $run_state = $new_state; + $sql = "replace into States set Name = '$run_state', Definition = '$definition'"; + $result = mysql_query( $sql ); + if ( !$result ) + die( mysql_error() ); + } + } elseif ( $action == "delete" ) { + if ( $run_state ) + { + $sql = "delete from States where Name = '$run_state'"; + $result = mysql_query( $sql ); + if ( !$result ) + die( mysql_error() ); + } if ( $mark_uids ) { foreach( $mark_uids as $mark_uid ) @@ -512,6 +555,5 @@ if ( $action ) session_write_close(); } } -session_write_close(); ?> diff --git a/web/zm_config.php.z b/web/zm_config.php.z index 071dfc3cd..3b20de449 100644 --- a/web/zm_config.php.z +++ b/web/zm_config.php.z @@ -144,6 +144,7 @@ function loadConfig() // Javascript window sizes $jws = array( 'console' => array( 'w'=>720, 'h'=>500 ), + 'state' => array( 'w'=>300, 'h'=>120 ), 'cycle' => array( 'w'=>46, 'h'=>80 ), 'montage' => array( 'w'=>20, 'h'=>20 ), 'monitor' => array( 'w'=>360, 'h'=>300 ), diff --git a/web/zm_html.php b/web/zm_html.php index 21cafff35..cd73a96aa 100644 --- a/web/zm_html.php +++ b/web/zm_html.php @@ -68,6 +68,7 @@ switch( $view ) case "postlogin" : case "logout" : case "console" : + case "state" : case "bandwidth" : case "options" : case "optionhelp" : diff --git a/web/zm_html_view_console.php b/web/zm_html_view_console.php index d6acd249f..4a9183c90 100644 --- a/web/zm_html_view_console.php +++ b/web/zm_html_view_console.php @@ -1,19 +1,9 @@ -window.setTimeout( "window.location.replace('')", ); +window.setTimeout( "window.location.replace('')", ); @@ -106,7 +92,7 @@ window.setTimeout( "window.location.replace('')", -ZoneMinder Console - () - v +ZoneMinder Console - - v + + +ZM - State + + + + + + + + + + + + + + + + + + + + +
ZoneMinder Run State
New State:
+ + + + + + + + + + + + + + + + + + + + + + +
 
Applying ZoneMinder state change
Please wait
+ +