Added javascript refreshes.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@577 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-06-25 14:01:39 +00:00
parent d543323c9a
commit 0f28a2b6d5
3 changed files with 91 additions and 22 deletions

View File

@ -46,6 +46,7 @@ define( "ZM_OPT_MPEG", "<from zmconfig>" ); // Is there an (optional) mpeg vi
define( "ZM_OPT_FAST_DELETE", <from zmconfig> ); // Whether we only delete event DB records and leave zmaudit to do the rest
define( "ZM_OPT_X10", <from zmconfig> ); // Whether we want to interface with X10 devices
define( "ZM_OPT_FRAME_SERVER", <from zmconfig> ); // Whether to use the frame server
define( "ZM_WEB_REFRESH_METHOD", <from zmconfig> ); // What method windows should use to refresh themselves
// Bandwidth specific ones from zmconfig.pl, again do not edit these directly as changes may be lost
//

View File

@ -57,6 +57,7 @@ switch( $view )
packageControl( 'start' );
}
if ( ZM_WEB_REFRESH_METHOD == "http" )
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
@ -128,6 +129,14 @@ 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?' ) );
}
<?php
if ( ZM_WEB_REFRESH_METHOD == "javascript" )
{
?>
window.setTimeout( 'window.location.reload(true)', <?= ($start||$stop)?250:(REFRESH_MAIN*1000) ?> );
<?php
}
?>
</script>
</head>
<body>
@ -262,7 +271,7 @@ function confirmDelete()
?>
<tr>
<td colspan="2" align="center">
<input type="button" value="Refresh" class="form" onClick="javascript: location.reload();">
<input type="button" value="Refresh" class="form" onClick="javascript: location.reload(true);">
</td>
<td colspan="2" align="center">
<input type="button" value="Add New Monitor" class="form" onClick="javascript: newWindow( '<?= $PHP_SELF ?>?view=monitor&zid=-1', 'zmMonitor', <?= $jws['monitor']['w'] ?>, <?= $jws['monitor']['h'] ?>);">
@ -310,6 +319,7 @@ function confirmDelete()
chdir( ZM_DIR_IMAGES );
$status = exec( escapeshellcmd( ZMU_PATH." -m $monitor[Id] -i" ) );
if ( ZM_WEB_REFRESH_METHOD == "http" )
header("Refresh: ".REFRESH_CYCLE."; URL=$PHP_SELF?view=cycle&mid=$next_mid&mode=$mode" );
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
@ -330,6 +340,14 @@ function closeWindow()
{
top.window.close();
}
<?php
if ( ZM_WEB_REFRESH_METHOD == "javascript" )
{
?>
window.setTimeout( "window.location.replace( '<?= "$PHP_SELF?view=cycle&mid=$next_mid&mode=$mode" ?>', <?= REFRESH_CYCLE*1000 ?> );
<?php
}
?>
</script>
</head>
<body>
@ -477,6 +495,7 @@ function closeWindow()
chdir( ZM_DIR_IMAGES );
$status = exec( escapeshellcmd( ZMU_PATH." -m $mid -i" ) );
chdir( '..' );
if ( ZM_WEB_REFRESH_METHOD == "http" )
header("Refresh: ".REFRESH_IMAGE."; URL=$PHP_SELF?view=montagefeed&mid=$mid&mode=still" );
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
@ -489,6 +508,16 @@ function closeWindow()
<head>
<title>ZM - <?= $monitor[Name] ?> - MontageFeed</title>
<link rel="stylesheet" href="zm_styles.css" type="text/css">
<script language="JavaScript">
<?php
if ( $mode != "stream" && ZM_WEB_REFRESH_METHOD == "javascript" )
{
?>
window.setTimeout( "window.location.reload(true)", <?= REFRESH_IMAGE*1000 ?> );
<?php
}
?>
</script>
</head>
<body>
<table width="96%" align="center" border="0" cellspacing="0" cellpadding="4">
@ -560,6 +589,7 @@ function closeWindow()
$refresh = (isset($force)||$forced||$status)?1:REFRESH_STATUS;
$url = "$PHP_SELF?view=montagestatus&mid=$mid&last_status=$status";
if ( ZM_WEB_REFRESH_METHOD == "http" )
header("Refresh: $refresh; URL=$url" );
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
@ -576,6 +606,12 @@ function closeWindow()
{
?>
top.window.focus();
<?php
}
if ( ZM_WEB_REFRESH_METHOD == "javascript" )
{
?>
window.setTimeout( "window.location.reload(true)", <?= $refresh*1000 ?> );
<?php
}
?>
@ -614,7 +650,7 @@ top.window.focus();
<title>ZM - <?= $monitor[Name] ?> - Watch</title>
<link rel="stylesheet" href="zm_styles.css" type="text/css">
<script language="JavaScript">
opener.location.reload();
//opener.location.reload();
window.focus();
</script>
</head>
@ -647,6 +683,7 @@ window.focus();
chdir( ZM_DIR_IMAGES );
$status = exec( escapeshellcmd( ZMU_PATH." -m $mid -i" ) );
chdir( '..' );
if ( ZM_WEB_REFRESH_METHOD == "http" )
header("Refresh: ".REFRESH_IMAGE."; URL=$PHP_SELF?view=watchfeed&mid=$mid&mode=still" );
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
@ -668,6 +705,14 @@ function closeWindow()
{
top.window.close();
}
<?php
if ( $mode != "stream" && ZM_WEB_REFRESH_METHOD == "javascript" )
{
?>
window.setTimeout( "window.location.reload(true)", <?= REFRESH_IMAGE*1000 ?> );
<?php
}
?>
</script>
</head>
<body>
@ -738,7 +783,7 @@ function closeWindow()
if ( $refresh_parent )
{
?>
opener.location.reload();
opener.location.reload(true);
<?php
}
?>
@ -812,6 +857,7 @@ function closeWindow()
$refresh = (isset($force)||$forced||$status)?1:REFRESH_STATUS;
$url = "$PHP_SELF?view=watchstatus&mid=$mid&last_status=$status".(($force||$forced)?"&forced=1":"");
if ( ZM_WEB_REFRESH_METHOD == "http" )
header("Refresh: $refresh; URL=$url" );
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
@ -833,7 +879,13 @@ top.window.focus();
if ( $old_alarm )
{
?>
parent.frames[2].location.reload();
parent.frames[2].location.reload(true);
<?php
}
if ( ZM_WEB_REFRESH_METHOD == "javascript" )
{
?>
window.setTimeout( "window.location.replace( '<?= $url ?>' )", <?= $refresh*1000 ?> );
<?php
}
?>
@ -909,6 +961,7 @@ parent.frames[2].location.reload();
$sort_order = $sort_asc?"asc":"desc";
if ( !$sort_asc )
$sort_asc = 0;
if ( ZM_WEB_REFRESH_METHOD == "http" )
header("Refresh: ".REFRESH_EVENTS."; URL=$PHP_SELF?view=watchevents&mid=$mid&max_events=".MAX_EVENTS );
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
@ -951,6 +1004,14 @@ function configureButton(form,name)
}
form.delete_btn.disabled = !checked;
}
<?php
if ( ZM_WEB_REFRESH_METHOD == "javascript" )
{
?>
window.setTimeout( "window.location.replace( '<?= "$PHP_SELF?view=watchevents&mid=$mid&max_events=".MAX_EVENTS ?>' )", <?= REFRESH_EVENTS*1000 ?> );
<?php
}
?>
</script>
</head>
<body>
@ -1221,7 +1282,7 @@ function configureButton(form,name)
}
window.focus();
<?php if ( $filter ) { ?>
opener.location.reload();
opener.location.reload(true);
filterWindow( '<?= $PHP_SELF ?>?view=filter&mid=<?= $mid ?><?= $filter_query ?>', 'zmFilter<?= $monitor[Name] ?>' );
location.href = '<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?><?= $filter_query ?>';
<?php } ?>
@ -1243,7 +1304,7 @@ location.href = '<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?><?= $filter_query ?
</tr>
<tr><td colspan="3" class="text">&nbsp;</td></tr>
<tr>
<td align="right" class="text"><a href="javascript: location.reload();">Refresh</td>
<td align="right" class="text"><a href="javascript: location.reload(true);">Refresh</td>
<td align="right" class="text"><a href="javascript: filterWindow( '<?= $PHP_SELF ?>?view=filter&mid=<?= $mid ?><?= $filter_query ?>', 'zmFilter<?= $monitor[Name] ?>' );">Show Filter Window</a></td>
<td align="right" class="text"><a href="javascript: checkAll( document.event_form, 'mark_eids' );">Check All</a></td>
</tr>
@ -1850,7 +1911,7 @@ function closeWindow()
if ( !$event )
{
?>
opener.location.reload();
opener.location.reload(true);
window.close();
<?php
}
@ -1860,13 +1921,13 @@ window.focus();
if ( $refresh_parent )
{
?>
opener.location.reload();
opener.location.reload(true);
<?php
}
?>
function refreshWindow()
{
window.location.reload();
window.location.reload(true);
}
function closeWindow()
{
@ -2182,7 +2243,7 @@ function configureButton(form,name)
if ( $refresh_parent )
{
?>
opener.location.reload();
opener.location.reload(true);
<?php
}
?>
@ -2311,7 +2372,7 @@ $source_types = array( "Local"=>"Local", "Remote"=>"Remote" );
if ( $refresh_parent )
{
?>
opener.location.reload();
opener.location.reload(true);
<?php
}
?>
@ -2654,14 +2715,14 @@ location.replace('<?= $video_path ?>');
if ( $refresh_parent )
{
?>
opener.location.reload();
opener.location.reload(true);
<?php
}
?>
window.focus();
function refreshWindow()
{
window.location.reload();
window.location.reload(true);
}
function closeWindow()
{
@ -2713,7 +2774,7 @@ function closeWindow()
{
?>
//self.onerror = function() { return( true ); }
opener.location.reload();
opener.location.reload(true);
<?php
}
?>

View File

@ -657,11 +657,18 @@ my @options =
help => "This version of ZoneMinder records detailed information about events in the Stats table. This can help in profiling what the optimum settings are for Zones though this is tricky at present. However in future releases this will be done more easily and intuitively, especially with a large sample of events. The default option of 'yes' allows this information to be collected now in readiness for this but if you are concerned about performance you can switch this off in which case no Stats information will be saved.",
type => $types{boolean},
},
{
name => "ZM_WEB_REFRESH_METHOD",
default => "javascript",
description => "What method windows should use to refresh themselves, choose either javascript or http",
help => "Many windows in Javascript need to refresh themselves to keep their information current. This option determines what method they should use to do this. Choosing 'javascript' means that each window will have a short JavaScript statement in with a timer to prompt the refresh. This is the most compatible method. Choosing 'http' means the refresh instruction is put in the HTTP header. This is a cleaner method but refreshes are interrupted or cancelled when a link in the window is clicked meaning that the window will no longer refresh and this would have to be done manually.",
type => { hint => 'javascript|http', parse => sub { return( int($_[0] =~ /^([jh])/i ), $1 =~ /^j/ ? 'javascript' : 'http' ) } },
},
{
name => "ZM_WEB_H_REFRESH_MAIN",
default => "300",
description => "How often (in seconds) the main console window should refresh itself",
introduction => "There are now a number of options that are grouped into bandwidth categories, this allows you to configure the ZoneMinder client to work optimally over the various access methods you might to access the client.\n\nThe next few options control what happens when the client is running in 'high' bandwidth mode. You should set these options for when accessing the ZoneMinder client over a local network or high speed link. In most cases the default values will be suitable as a starting point.",
description => "How often (in seconds) the main console window should refresh itself",
help => "The main console window lists a general status and the event totals for all monitors. This is not a trivial task and should not be repeated too frequently or it may affect the performance of the rest of the system.",
type => $types{integer},
},