Changed views to switch from big if statement.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@102 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
7590a3d767
commit
f63c3b61e5
192
web/zmhtml.php
192
web/zmhtml.php
|
@ -40,8 +40,10 @@ if ( !$view )
|
|||
$view = "console";
|
||||
}
|
||||
|
||||
if ( $view == "console" )
|
||||
switch( $view )
|
||||
{
|
||||
case "console" :
|
||||
{
|
||||
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
|
||||
|
@ -49,7 +51,6 @@ if ( $view == "console" )
|
|||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
//$result = mysql_query( "select M.*, count(E.Id) as EventCount, count(if(E.Archived,1,NULL)) as ArchEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 HOUR && E.Archived = 0,1,NULL)) as HourEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 DAY && E.Archived = 0,1,NULL)) as DayEventCount, count(if(E.StartTime>NOW() - INTERVAL 7 DAY && E.Archived = 0,1,NULL)) as WeekEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 MONTH && E.Archived = 0,1,NULL)) as MonthEventCount, count(Z.MonitorId) as ZoneCount from Monitors as M inner join Zones as Z on Z.MonitorId = M.Id left join Events as E on E.MonitorId = M.Id group by E.MonitorId,Z.MonitorId order by Id" );
|
||||
$sql = "select M.*, count(E.Id) as EventCount, count(if(E.Archived,1,NULL)) as ArchEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 HOUR && E.Archived = 0,1,NULL)) as HourEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 DAY && E.Archived = 0,1,NULL)) as DayEventCount, count(if(E.StartTime>NOW() - INTERVAL 7 DAY && E.Archived = 0,1,NULL)) as WeekEventCount, count(if(E.StartTime>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 );
|
||||
if ( !$result )
|
||||
|
@ -192,9 +193,10 @@ function newWindow(Url,Name,Width,Height)
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif ( $view == "cycle" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "cycle" :
|
||||
{
|
||||
$result = mysql_query( "select * from Monitors where Function != 'None' order by Id" );
|
||||
$monitors = array();
|
||||
$mon_idx = 0;
|
||||
|
@ -232,9 +234,10 @@ function newWindow(Url,Name,Width,Height)
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif ( $view == "watch" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "watch" :
|
||||
{
|
||||
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
|
@ -255,9 +258,10 @@ window.focus();
|
|||
<frame src="<?php echo $PHP_SELF ?>?view=watchevents&max_events=<?php echo MAX_EVENTS ?>&mid=<?php echo $monitor[Id] ?>" marginwidth="0" marginheight="0" name="MonitorEvents" scrolling="auto">
|
||||
</frameset>
|
||||
<?php
|
||||
}
|
||||
elseif( $view == "watchfeed" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "watchfeed" :
|
||||
{
|
||||
if ( !$mode )
|
||||
{
|
||||
if ( canStream() )
|
||||
|
@ -304,8 +308,9 @@ function closeWindow()
|
|||
<?php } ?>
|
||||
<td width="33%" align="right" class="text"><a href="javascript: closeWindow();">Close</a></td>
|
||||
</tr>
|
||||
<?php if ( $mode == "stream" )
|
||||
{
|
||||
<?php
|
||||
if ( $mode == "stream" )
|
||||
{
|
||||
$stream_src = ZMS_PATH."?monitor=$monitor[Id]&idle=".STREAM_IDLE_DELAY."&refresh=".STREAM_FRAME_DELAY;
|
||||
if ( isNetscape() )
|
||||
{
|
||||
|
@ -319,21 +324,22 @@ function closeWindow()
|
|||
<tr><td colspan="3" align="center"><applet code="com.charliemouse.cambozola.Viewer" archive="<?php echo CAMBOZOLA_PATH ?>" align="middle" width="<?php echo $monitor[Width] ?>" height="<?php echo $monitor[Height] ?>"><param name="url" value="<?php echo $stream_src ?>"></applet></td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<tr><td colspan="3" align="center"><img src="<?php echo $monitor[Name] ?>.jpg" border="0" width="<?php echo $monitor[Width] ?>" height="<?php echo $monitor[Height] ?>"></td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif ( $view == "watchstatus" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "watchstatus" :
|
||||
{
|
||||
$status = exec( escapeshellcmd( ZMU_PATH." -m $mid -s" ) );
|
||||
$status_string = "Unknown";
|
||||
$class = "text";
|
||||
|
@ -387,9 +393,10 @@ top.window.focus();
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif ( $view == "watchevents" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "watchevents" :
|
||||
{
|
||||
switch( $sort_field )
|
||||
{
|
||||
case 'Id' :
|
||||
|
@ -416,7 +423,8 @@ elseif ( $view == "watchevents" )
|
|||
break;
|
||||
}
|
||||
$sort_order = $sort_asc?"asc":"desc";
|
||||
if ( !$sort_asc ) $sort_asc = 0;
|
||||
if ( !$sort_asc )
|
||||
$sort_asc = 0;
|
||||
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
|
||||
|
@ -511,9 +519,10 @@ function checkAll(form,name){
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif ( $view == "events" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "events" :
|
||||
{
|
||||
switch( $sort_field )
|
||||
{
|
||||
case 'Id' :
|
||||
|
@ -753,9 +762,10 @@ filterWindow( '<?php echo $PHP_SELF ?>?view=filter&mid=<?php echo $mid ?><?php e
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif ( $view == "filter" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "filter" :
|
||||
{
|
||||
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
|
@ -785,8 +795,8 @@ function closeWindow()
|
|||
function validateForm( form )
|
||||
{
|
||||
<?php
|
||||
if ( $trms > 2 )
|
||||
{
|
||||
if ( $trms > 2 )
|
||||
{
|
||||
?>
|
||||
var bracket_count = 0;
|
||||
<?php
|
||||
|
@ -804,7 +814,7 @@ if ( $trms > 2 )
|
|||
return( false );
|
||||
}
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
for ( $i = 1; $i <= $trms; $i++ )
|
||||
|
@ -852,8 +862,8 @@ function submitToEvents( form )
|
|||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<?php
|
||||
for ( $i = 1; $i <= $trms; $i++ )
|
||||
{
|
||||
for ( $i = 1; $i <= $trms; $i++ )
|
||||
{
|
||||
$conjunction_name = "cnj$i";
|
||||
$obracket_name = "obr$i";
|
||||
$cbracket_name = "cbr$i";
|
||||
|
@ -891,7 +901,7 @@ for ( $i = 1; $i <= $trms; $i++ )
|
|||
<td class="text"><?php if ( $trms > 2 ) { buildSelect( $cbracket_name, $cbracket_types ); } else { ?> <?php } ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</td>
|
||||
|
@ -905,9 +915,10 @@ for ( $i = 1; $i <= $trms; $i++ )
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif( $view == "image" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "image" :
|
||||
{
|
||||
$result = mysql_query( "select E.*,M.Name as MonitorName,M.Width,M.Height from Events as E, Monitors as M where E.Id = '$eid' and E.MonitorId = M.Id" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
|
@ -935,7 +946,6 @@ elseif( $view == "image" )
|
|||
{
|
||||
$image_path = $anal_image;
|
||||
}
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -988,9 +998,10 @@ function deleteEvent()
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif( $view == "event" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "event" :
|
||||
{
|
||||
if ( !$mode )
|
||||
{
|
||||
if ( canStream() )
|
||||
|
@ -1058,8 +1069,9 @@ function newWindow(Url,Name,Width,Height)
|
|||
<?php } ?>
|
||||
<td align="right" class="text"><a href="javascript: closeWindow();">Close</a></td>
|
||||
</tr>
|
||||
<?php if ( $mode == "stream" )
|
||||
{
|
||||
<?php
|
||||
if ( $mode == "stream" )
|
||||
{
|
||||
$stream_src = ZMS_PATH."?path=".ZMS_EVENT_PATH."&event=$eid&refresh=".STREAM_EVENT_DELAY;
|
||||
if ( isNetscape() )
|
||||
{
|
||||
|
@ -1073,9 +1085,9 @@ function newWindow(Url,Name,Width,Height)
|
|||
<tr><td colspan="6" align="center"><applet code="com.charliemouse.cambozola.Viewer" archive="<?php echo CAMBOZOLA_PATH ?>" align="middle" width="<?php echo $event[Width] ?>" height="<?php echo $event[Height] ?>"><param name="url" value="<?php echo $stream_src ?>"></applet></td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = mysql_query( "select * from Frames where EventID = '$eid' order by Id" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
|
@ -1138,15 +1150,16 @@ else
|
|||
</tr>
|
||||
</table></td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif( $view == "zones" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "zones" :
|
||||
{
|
||||
$status = exec( escapeshellcmd( ZMU_PATH." -m $mid -z" ) );
|
||||
|
||||
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
||||
|
@ -1238,9 +1251,10 @@ function closeWindow()
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif( $view == "monitor" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "monitor" :
|
||||
{
|
||||
if ( $mid > 0 )
|
||||
{
|
||||
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
||||
|
@ -1260,12 +1274,12 @@ elseif( $view == "monitor" )
|
|||
<link rel="stylesheet" href="zmstyles.css" type="text/css">
|
||||
<script language="JavaScript">
|
||||
<?php
|
||||
if ( $refresh_parent )
|
||||
{
|
||||
if ( $refresh_parent )
|
||||
{
|
||||
?>
|
||||
opener.location.reload();
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
window.focus();
|
||||
function validateForm(theForm)
|
||||
|
@ -1317,9 +1331,10 @@ function closeWindow()
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif( $view == "zone" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "zone" :
|
||||
{
|
||||
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
|
@ -1348,12 +1363,12 @@ elseif( $view == "zone" )
|
|||
<link rel="stylesheet" href="zmstyles.css" type="text/css">
|
||||
<script language="JavaScript">
|
||||
<?php
|
||||
if ( $refresh_parent )
|
||||
{
|
||||
if ( $refresh_parent )
|
||||
{
|
||||
?>
|
||||
opener.location.reload();
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
window.focus();
|
||||
function validateForm(theForm)
|
||||
|
@ -1572,9 +1587,10 @@ function closeWindow()
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif( $view == "video" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "video" :
|
||||
{
|
||||
$result = mysql_query( "select E.*,M.Name as MonitorName, M.Colours from Events as E, Monitors as M where E.Id = '$eid' and E.MonitorId = M.Id" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
|
@ -1630,9 +1646,11 @@ elseif( $view == "video" )
|
|||
//header("Content-type: video/mpeg");
|
||||
//header("Content-Disposition: inline; filename=$video_name");
|
||||
header("Location: $video_file" );
|
||||
}
|
||||
elseif ( $view == "device" )
|
||||
{
|
||||
|
||||
break;
|
||||
}
|
||||
case "device" :
|
||||
{
|
||||
$ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $did' | grep -v grep" ) );
|
||||
if ( $ps_array[3] )
|
||||
{
|
||||
|
@ -1650,12 +1668,12 @@ elseif ( $view == "device" )
|
|||
<link rel="stylesheet" href="zmstyles.css" type="text/css">
|
||||
<script language="JavaScript">
|
||||
<?php
|
||||
if ( $zmc_status != $zmc_action || $zma_status != $zma_action )
|
||||
{
|
||||
if ( $zmc_status != $zmc_action || $zma_status != $zma_action )
|
||||
{
|
||||
?>
|
||||
opener.location.reload();
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
window.focus();
|
||||
function refreshWindow()
|
||||
|
@ -1699,9 +1717,10 @@ function closeWindow()
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif ( $view == "function" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "function" :
|
||||
{
|
||||
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
|
@ -1713,12 +1732,12 @@ elseif ( $view == "function" )
|
|||
<link rel="stylesheet" href="zmstyles.css" type="text/css">
|
||||
<script language="JavaScript">
|
||||
<?php
|
||||
if ( $refresh_parent )
|
||||
{
|
||||
if ( $refresh_parent )
|
||||
{
|
||||
?>
|
||||
opener.location.reload();
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
window.focus();
|
||||
function refreshWindow()
|
||||
|
@ -1760,26 +1779,29 @@ function closeWindow()
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
elseif ( $view == "none" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case "none" :
|
||||
{
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<script language="JavaScript">
|
||||
<?php
|
||||
if ( $refresh_parent )
|
||||
{
|
||||
if ( $refresh_parent )
|
||||
{
|
||||
?>
|
||||
opener.location.reload();
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
window.close();
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue