Added state change functionality and files.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@697 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
d5acf76049
commit
3045e9ea9f
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
?>
|
||||
|
|
|
@ -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 ),
|
||||
|
|
|
@ -68,6 +68,7 @@ switch( $view )
|
|||
case "postlogin" :
|
||||
case "logout" :
|
||||
case "console" :
|
||||
case "state" :
|
||||
case "bandwidth" :
|
||||
case "options" :
|
||||
case "optionhelp" :
|
||||
|
|
|
@ -1,19 +1,9 @@
|
|||
<?php
|
||||
$running = daemonCheck();
|
||||
$status = $running?"Running":"Stopped";
|
||||
$new_status = $running?"stop":"start";
|
||||
|
||||
if ( $stop )
|
||||
{
|
||||
packageControl( 'stop' );
|
||||
}
|
||||
if ( $start )
|
||||
{
|
||||
packageControl( 'start' );
|
||||
}
|
||||
|
||||
if ( ZM_WEB_REFRESH_METHOD == "http" )
|
||||
header("Refresh: ".(($start||$stop)?1:REFRESH_MAIN)."; URL=$PHP_SELF" );
|
||||
header("Refresh: ".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
|
||||
|
@ -84,10 +74,6 @@ 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?' ) );
|
||||
}
|
||||
function confirmDelete()
|
||||
{
|
||||
return( confirm( 'Warning, deleting a monitor also deletes all events and database entries associated with it.\nAre you sure you wish to delete?' ) );
|
||||
|
@ -96,7 +82,7 @@ function confirmDelete()
|
|||
if ( ZM_WEB_REFRESH_METHOD == "javascript" )
|
||||
{
|
||||
?>
|
||||
window.setTimeout( "window.location.replace('<?= $PHP_SELF ?>')", <?= ($start||$stop)?250:(REFRESH_MAIN*1000) ?> );
|
||||
window.setTimeout( "window.location.replace('<?= $PHP_SELF ?>')", <?= (REFRESH_MAIN*1000) ?> );
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
@ -106,7 +92,7 @@ window.setTimeout( "window.location.replace('<?= $PHP_SELF ?>')", <?= ($start||$
|
|||
<table align="center" border="0" cellspacing="2" cellpadding="2" width="96%">
|
||||
<tr>
|
||||
<td class="smallhead" align="left"><?= date( "D jS M, g:ia" ) ?></td>
|
||||
<td class="bighead" align="center"><strong>ZoneMinder Console - <?= $status ?><?php if ( canEdit( 'System' ) ) { ?> (<a href="javascript: if ( confirmStatus( '<?= $new_status ?>' ) ) location='<?= $PHP_SELF ?>?<?= $new_status ?>=1';"><?= $new_status ?></a>) <?php } ?>- v<?= ZM_VERSION ?></strong></td>
|
||||
<td class="bighead" align="center"><strong>ZoneMinder Console - <?php if ( canEdit( 'System' ) ) { ?><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=state', 'zmState', <?= $jws['state']['w'] ?>, <?= $jws['state']['h'] ?> );"><?= $status ?></a> - <?php } ?>v<?= ZM_VERSION ?></strong></td>
|
||||
<?php
|
||||
$uptime = shell_exec( 'uptime' );
|
||||
$load = '';
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
<?php
|
||||
if ( !canEdit( 'System' ) )
|
||||
{
|
||||
$view = "error";
|
||||
return;
|
||||
}
|
||||
$running = daemonCheck();
|
||||
|
||||
$result = mysql_query( "select * from States" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
while( $state = mysql_fetch_assoc( $result ) )
|
||||
{
|
||||
$states[] = $state;
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>ZM - State</title>
|
||||
<link rel="stylesheet" href="zm_styles.css" type="text/css">
|
||||
<script language="JavaScript">
|
||||
<?php
|
||||
if ( $refresh_parent )
|
||||
{
|
||||
?>
|
||||
opener.location.reload(true);
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
window.focus();
|
||||
function refreshWindow()
|
||||
{
|
||||
window.location.reload(true);
|
||||
}
|
||||
function closeWindow()
|
||||
{
|
||||
window.close();
|
||||
}
|
||||
function checkState()
|
||||
{
|
||||
with ( document.state_form )
|
||||
{
|
||||
<?php
|
||||
if ( $running )
|
||||
{
|
||||
?>
|
||||
if ( run_state.selectedIndex < 2 )
|
||||
{
|
||||
save_btn.disabled = true;
|
||||
delete_btn.disabled = true;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
if ( run_state.selectedIndex < 1 )
|
||||
{
|
||||
save_btn.disabled = true;
|
||||
delete_btn.disabled = true;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
else
|
||||
{
|
||||
save_btn.disabled = false;
|
||||
delete_btn.disabled = false;
|
||||
}
|
||||
if ( new_state.value != '' )
|
||||
{
|
||||
save_btn.disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
function saveState()
|
||||
{
|
||||
with ( document.state_form )
|
||||
{
|
||||
view.value = '<?= $view ?>';
|
||||
action.value = 'save';
|
||||
submit();
|
||||
}
|
||||
}
|
||||
function deleteState()
|
||||
{
|
||||
with ( document.state_form )
|
||||
{
|
||||
view.value = '<?= $view ?>';
|
||||
action.value = 'delete';
|
||||
submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" cellspacing="0" cellpadding="4" width="100%">
|
||||
<tr>
|
||||
<td colspan="4" align="center" class="head">ZoneMinder Run State</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ( !$apply )
|
||||
{
|
||||
?>
|
||||
<form name="state_form" method="get" action="<?= $PHP_SELF ?>">
|
||||
<input type="hidden" name="view" value="<?= $view ?>">
|
||||
<input type="hidden" name="action" value="">
|
||||
<input type="hidden" name="apply" value="1">
|
||||
<tr>
|
||||
<td colspan="2" align="center"><select name="run_state" class="form" onChange="checkState();">
|
||||
<?php
|
||||
if ( $running )
|
||||
{
|
||||
?>
|
||||
<option value="stop" selected>Stop</option>
|
||||
<option value="restart">Restart</option>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<option value="start" selected>Start</option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
foreach ( $states as $state )
|
||||
{
|
||||
?>
|
||||
<option value="<?= $state[Name] ?>"><?= $state[Name] ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" class="text">New State:</td>
|
||||
<td align="left"><input type="text" name="new_state" value="" size="16" class="form" onChange="checkState();"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" cellspacing="0" cellpadding="1" width="100%">
|
||||
<tr>
|
||||
<td width="25%" align="center"><input type="submit" value="Apply" class="form"></td>
|
||||
<td width="25%" align="center"><input type="button" name="save_btn" value="Save" class="form" disabled onClick="saveState();"></td>
|
||||
<td width="25%" align="center"><input type="button" name="delete_btn" value="Delete" class="form" disabled onClick="deleteState();"></td>
|
||||
<td width="25%" align="center"><input type="button" value="Cancel" class="form" onClick="closeWindow()"></td>
|
||||
</tr>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" align="center" class="text"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center" class="text">Applying ZoneMinder state change<br/>Please wait</td>
|
||||
</tr>
|
||||
<form name="state_form" method="get" action="<?= $PHP_SELF ?>">
|
||||
<input type="hidden" name="view" value="none">
|
||||
<input type="hidden" name="action" value="state">
|
||||
<input type="hidden" name="run_state" value="<?= $run_state ?>">
|
||||
</form>
|
||||
<script language="JavaScript">
|
||||
window.setTimeout( "document.state_form.submit()", 500 );
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue