2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
//
|
|
|
|
// ZoneMinder web watch status view file, $Date$, $Revision$
|
2005-02-24 22:40:14 +08:00
|
|
|
// Copyright (C) 2003, 2004, 2005 Philip Coombes
|
2004-01-08 19:45:57 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
2003-07-11 17:27:56 +08:00
|
|
|
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( !canView( 'Stream' ) )
|
|
|
|
{
|
|
|
|
$view = "error";
|
|
|
|
return;
|
|
|
|
}
|
2005-01-16 23:55:03 +08:00
|
|
|
|
2005-01-19 09:50:24 +08:00
|
|
|
$zmu_command = getZmuCommand( " -m $mid -s -f" );
|
2005-10-17 05:26:49 +08:00
|
|
|
if ( canEdit( 'Monitors' ) )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
2005-10-17 05:26:49 +08:00
|
|
|
if ( isset($force) )
|
|
|
|
{
|
|
|
|
$zmu_command .= ($force?" -a":" -c");
|
|
|
|
}
|
|
|
|
elseif ( isset($disable) )
|
|
|
|
{
|
|
|
|
$zmu_command .= ($disable?" -n":" -c");
|
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$zmu_output = exec( escapeshellcmd( $zmu_command ) );
|
|
|
|
list( $status, $fps ) = split( ' ', $zmu_output );
|
|
|
|
$status_string = $zmSlangUnknown;
|
|
|
|
$fps_string = "--.--";
|
|
|
|
$class = "text";
|
2005-01-16 23:55:03 +08:00
|
|
|
if ( $status <= STATE_PREALARM )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
|
|
|
$status_string = $zmSlangIdle;
|
|
|
|
}
|
2005-01-16 23:55:03 +08:00
|
|
|
elseif ( $status == STATE_ALARM )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
|
|
|
$status_string = $zmSlangAlarm;
|
|
|
|
$class = "redtext";
|
|
|
|
}
|
2005-01-16 23:55:03 +08:00
|
|
|
elseif ( $status == STATE_ALERT )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
|
|
|
$status_string = $zmSlangAlert;
|
|
|
|
$class = "ambtext";
|
|
|
|
}
|
2005-01-16 23:55:03 +08:00
|
|
|
elseif ( $status == STATE_TAPE )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
|
|
|
$status_string = $zmSlangRecord;
|
|
|
|
}
|
|
|
|
$fps_string = sprintf( "%.2f", $fps );
|
2005-01-16 23:55:03 +08:00
|
|
|
$new_alarm = ( $status > STATE_PREALARM && $last_status <= STATE_PREALARM );
|
|
|
|
$old_alarm = ( $status <= STATE_PREALARM && $last_status > STATE_PREALARM );
|
2004-01-08 19:45:57 +08:00
|
|
|
|
2005-10-17 05:26:49 +08:00
|
|
|
$refresh = (isset($force)||$forced||isset($disable)||$disabled||(($status>=STATE_PREALARM)&&($status<=STATE_ALERT)))?1:ZM_WEB_REFRESH_STATUS;
|
|
|
|
$url = "$PHP_SELF?view=watchstatus&mid=$mid&last_status=$status".(($force||$forced)?"&forced=1":"").(($disable||$disabled)?"&disabled=1":"");
|
2004-01-08 19:45:57 +08:00
|
|
|
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
|
|
|
|
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
|
|
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
|
|
header("Pragma: no-cache"); // HTTP/1.0
|
2003-07-11 17:27:56 +08:00
|
|
|
|
|
|
|
?>
|
2004-12-29 03:22:23 +08:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2003-07-11 17:27:56 +08:00
|
|
|
<html>
|
|
|
|
<head>
|
2004-12-29 02:20:11 +08:00
|
|
|
<link rel="stylesheet" href="zm_html_styles.css" type="text/css">
|
2004-12-29 03:29:43 +08:00
|
|
|
<script type="text/javascript">
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( ZM_WEB_POPUP_ON_ALARM && $new_alarm )
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
top.window.focus();
|
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
if ( $old_alarm )
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2005-10-17 05:26:49 +08:00
|
|
|
if ( window.parent.MonitorEvents<?= $mid ?> != null )
|
|
|
|
{
|
|
|
|
window.parent.MonitorEvents<?= $mid ?>.location.reload(true);
|
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
if ( ZM_WEB_REFRESH_METHOD == "javascript" )
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
window.setTimeout( "window.location.replace( '<?= $url ?>' )", <?= $refresh*1000 ?> );
|
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2003-09-23 17:52:45 +08:00
|
|
|
<table width="96%" align="center" border="0" cellpadding="0" cellspacing="0">
|
2003-07-11 17:27:56 +08:00
|
|
|
<tr>
|
|
|
|
<?php
|
2005-10-17 05:26:49 +08:00
|
|
|
if ( !($force || $forced) )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
2005-10-17 05:26:49 +08:00
|
|
|
if ( canEdit( 'Monitors' ) && ($disable || $disabled) )
|
|
|
|
{
|
|
|
|
?>
|
2005-11-21 02:51:24 +08:00
|
|
|
<td width="25%" align="left" class="text"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=<?= $status ?>&disable=0"><?= $zmSlangEnableAlarms ?></a></td>
|
2005-10-17 05:26:49 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( canEdit( 'Monitors' ) && zmaCheck( $mid ) )
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2005-11-21 02:51:24 +08:00
|
|
|
<td width="25%" align="left" class="text"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=<?= $status ?>&disable=1"><?= $zmSlangDisableAlarms ?></a></td>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2005-10-17 05:26:49 +08:00
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2005-10-17 05:26:49 +08:00
|
|
|
else
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2005-11-21 02:51:24 +08:00
|
|
|
<td width="25%" align="left" class="text"> </td>
|
2005-10-17 05:26:49 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2005-11-21 02:51:24 +08:00
|
|
|
<td width="50%" class="<?= $class ?>" align="center" valign="middle"><?= $zmSlangStatus ?>: <?= $status_string ?> - <?= $fps_string ?> fps</td>
|
2005-10-17 05:26:49 +08:00
|
|
|
<?php
|
|
|
|
if ( !($disable || $disabled) )
|
|
|
|
{
|
|
|
|
if ( canEdit( 'Monitors' ) && ($force || $forced) )
|
|
|
|
{
|
|
|
|
?>
|
2005-11-21 02:51:24 +08:00
|
|
|
<td width="25%" align="right" class="text"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=<?= $status ?>&force=0"><?= $zmSlangCancelForcedAlarm ?></a></td>
|
2005-10-17 05:26:49 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
elseif ( canEdit( 'Monitors' ) && zmaCheck( $mid ) )
|
|
|
|
{
|
|
|
|
?>
|
2005-11-21 02:51:24 +08:00
|
|
|
<td width="25%" align="right" class="text"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=<?= $status ?>&force=1"><?= $zmSlangForceAlarm ?></a></td>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2005-10-17 05:26:49 +08:00
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2005-11-21 02:51:24 +08:00
|
|
|
<td width="25%" align="right" class="text"> </td>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<?php
|
2005-01-16 23:55:03 +08:00
|
|
|
if ( ZM_WEB_SOUND_ON_ALARM && ($status == STATE_ALARM || $status == STATE_ALERT) )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2005-02-22 05:55:37 +08:00
|
|
|
<embed src="<?= ZM_DIR_SOUNDS.'/'.ZM_WEB_ALARM_SOUND ?>" autostart="true" hidden="true"></embed>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
</body>
|
|
|
|
</html>
|