Updated cycle window and added workaround for file_exists bug.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@402 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-03-21 10:54:25 +00:00
parent c722d9046d
commit b9fa172777
3 changed files with 52 additions and 5 deletions

View File

@ -140,7 +140,7 @@ switch ( $bandwidth )
// Javascript window sizes // Javascript window sizes
$jws = array( $jws = array(
'console' => array( 'w'=>720, 'h'=>400 ), 'console' => array( 'w'=>720, 'h'=>400 ),
'cycle' => array( 'w'=>36, 'h'=>72 ), 'cycle' => array( 'w'=>46, 'h'=>80 ),
'monitor' => array( 'w'=>360, 'h'=>450 ), 'monitor' => array( 'w'=>360, 'h'=>450 ),
'watch' => array( 'w'=>72, 'h'=>315 ), 'watch' => array( 'w'=>72, 'h'=>315 ),
'device' => array( 'w'=>196, 'h'=>164 ), 'device' => array( 'w'=>196, 'h'=>164 ),

View File

@ -74,7 +74,7 @@ function isNetscape()
function canStream() function canStream()
{ {
return( ZM_CAN_STREAM || isNetscape() || (ZM_OPT_CAMBOZOLA && file_exists( ZM_PATH_CAMBOZOLA )) ); return( ZM_CAN_STREAM || isNetscape() || (ZM_OPT_CAMBOZOLA && file_exists( ZM_PATH_WEB.'/'.ZM_PATH_CAMBOZOLA )) );
} }
function fixDevices() function fixDevices()

View File

@ -276,6 +276,14 @@ function confirmStatus( new_status )
} }
case "cycle" : case "cycle" :
{ {
if ( !$mode )
{
if ( canStream() )
$mode = "stream";
else
$mode = "still";
}
$result = mysql_query( "select * from Monitors where Function != 'None' order by Id" ); $result = mysql_query( "select * from Monitors where Function != 'None' order by Id" );
$monitors = array(); $monitors = array();
$mon_idx = 0; $mon_idx = 0;
@ -293,7 +301,7 @@ function confirmStatus( new_status )
chdir( ZM_DIR_IMAGES ); chdir( ZM_DIR_IMAGES );
$status = exec( escapeshellcmd( ZMU_PATH." -m $monitor[Id] -i" ) ); $status = exec( escapeshellcmd( ZMU_PATH." -m $monitor[Id] -i" ) );
header("Refresh: ".REFRESH_CYCLE."; URL='$PHP_SELF?view=cycle&mid=$next_mid'" ); 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("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("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: no-store, no-cache, must-revalidate"); // HTTP/1.1
@ -309,11 +317,50 @@ function newWindow(Url,Name,Width,Height)
{ {
var Name = window.open(Url,Name,"resizable,scrollbars,width="+Width+",height="+Height); var Name = window.open(Url,Name,"resizable,scrollbars,width="+Width+",height="+Height);
} }
function closeWindow()
{
top.window.close();
}
</script> </script>
</head> </head>
<body> <body>
<p class="head" align="center"><?= $monitor[Name] ?></p> <table width="96%" align="center" border="0" cellspacing="0" cellpadding="4">
<a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor[Id] ?>', 'zmWatch<?= $monitor[Name] ?>', <?= $monitor[Width]+$jws['watch']['w'] ?>, <?= $monitor[Height]+$jws['watch']['h'] ?> );"><img src="<?= ZM_DIR_IMAGES.'/'.$monitor[Name] ?>.jpg" border="0"></a> <tr>
<td width="33%" align="left" class="text"><b><?= $monitor[Name] ?></b></td>
<?php if ( $mode == "stream" ) { ?>
<td width="34%" align="center" class="text"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&mode=still&mid=<?= $mid ?>">Stills</a></td>
<?php } elseif ( canStream() ) { ?>
<td width="34%" align="center" class="text"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&mode=stream&mid=<?= $mid ?>">Stream</a></td>
<?php } else { ?>
<td width="34%" align="center" class="text">&nbsp;</td>
<?php } ?>
<td width="33%" align="right" class="text"><a href="javascript: closeWindow();">Close</a></td>
</tr>
<?php
if ( $mode == "stream" )
{
$stream_src = ZMS_PATH."?monitor=$monitor[Id]&idle=".STREAM_IDLE_DELAY."&refresh=".STREAM_FRAME_DELAY."&ttl=".REFRESH_CYCLE;
if ( isNetscape() )
{
?>
<tr><td colspan="3" align="center"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor[Id] ?>', 'zmWatch<?= $monitor[Name] ?>', <?= $monitor[Width]+$jws['watch']['w'] ?>, <?= $monitor[Height]+$jws['watch']['h'] ?> );"><img src="<?= $stream_src ?>" border="0" width="<?= $monitor[Width] ?>" height="<?= $monitor[Height] ?>"></a></td></tr>
<?php
}
else
{
?>
<tr><td colspan="3" align="center"><applet code="com.charliemouse.cambozola.Viewer" archive="<?= ZM_PATH_CAMBOZOLA ?>" align="middle" width="<?= $monitor[Width] ?>" height="<?= $monitor[Height] ?>"><param name="url" value="<?= $stream_src ?>"></applet></td></tr>
<?php
}
}
else
{
?>
<tr><td colspan="3" align="center"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor[Id] ?>', 'zmWatch<?= $monitor[Name] ?>', <?= $monitor[Width]+$jws['watch']['w'] ?>, <?= $monitor[Height]+$jws['watch']['h'] ?> );"><img src="<?= ZM_DIR_IMAGES.'/'.$monitor[Name] ?>.jpg" border="0" width="<?= $monitor[Width] ?>" height="<?= $monitor[Height] ?>"></a></td></tr>
<?php
}
?>
</table>
</body> </body>
</html> </html>
<?php <?php