2003-07-11 17:27:56 +08:00
< ? php
2004-01-08 19:45:57 +08:00
//
// ZoneMinder web frame view file, $Date$, $Revision$
2006-01-17 19:31:31 +08:00
// Copyright (C) 2003, 2004, 2005, 2006 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
2006-01-17 19:31:31 +08:00
error_reporting ( E_ALL );
2004-01-08 19:45:57 +08:00
if ( ! canView ( 'Events' ) )
{
$view = " error " ;
return ;
}
2005-11-22 18:37:17 +08:00
$sql = " select E.*,M.Name as MonitorName,M.Width,M.Height,M.DefaultScale from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = ' $eid ' " ;
2005-11-22 18:35:22 +08:00
$result = mysql_query ( $sql );
2004-01-08 19:45:57 +08:00
if ( ! $result )
die ( mysql_error () );
$event = mysql_fetch_assoc ( $result );
2006-01-15 21:09:30 +08:00
mysql_free_result ( $result );
2003-07-11 17:27:56 +08:00
2004-01-08 19:45:57 +08:00
if ( $fid )
{
2005-11-22 18:35:22 +08:00
$result = mysql_query ( " select * from Frames where EventId = ' $eid ' and FrameId = ' $fid ' " );
2004-01-08 19:45:57 +08:00
if ( ! $result )
die ( mysql_error () );
$frame = mysql_fetch_assoc ( $result );
2006-01-15 21:09:30 +08:00
mysql_free_result ( $result );
2004-01-08 19:45:57 +08:00
}
else
{
2005-11-22 18:35:22 +08:00
$result = mysql_query ( " select * from Frames where EventId = ' $eid ' and Score = ' " . $event [ 'MaxScore' ] . " ' " );
2003-07-11 17:27:56 +08:00
if ( ! $result )
die ( mysql_error () );
2004-01-08 19:45:57 +08:00
$frame = mysql_fetch_assoc ( $result );
2006-01-15 21:09:30 +08:00
mysql_free_result ( $result );
2004-01-08 19:45:57 +08:00
$fid = $frame [ 'FrameId' ];
}
2004-03-04 23:13:10 +08:00
$max_fid = $event [ 'Frames' ];
2003-07-11 17:27:56 +08:00
2004-01-08 19:45:57 +08:00
$first_fid = 1 ;
$prev_fid = $fid - 1 ;
$next_fid = $fid + 1 ;
$last_fid = $max_fid ;
2004-09-07 16:45:00 +08:00
$event_path = ZM_DIR_EVENTS . '/' . $event [ 'MonitorId' ] . '/' . $event [ 'Id' ];
2006-01-17 19:31:31 +08:00
$capt_image = sprintf ( " %s/%0 " . ZM_EVENT_IMAGE_DIGITS . " d-capture.jpg " , $event_path , $fid );
2005-02-02 07:05:19 +08:00
$d_image_path = sprintf ( " %s/%0 " . ZM_EVENT_IMAGE_DIGITS . " d-diag-d.jpg " , $event_path , $fid );
$r_image_path = sprintf ( " %s/%0 " . ZM_EVENT_IMAGE_DIGITS . " d-diag-r.jpg " , $event_path , $fid );
2006-01-17 19:31:31 +08:00
$anal_image = preg_replace ( " /capture/ " , " analyse " , $capt_image );
$has_anal_image = file_exists ( $anal_image );
$image_path = ( $has_anal_image && ( empty ( $show ) || $show == " anal " )) ? $anal_image : $capt_image ;
2004-03-04 23:13:10 +08:00
$alarm_frame = $frame [ 'Type' ] == 'Alarm' ;
$img_class = $alarm_frame ? " alarm " : " normal " ;
2003-07-11 17:27:56 +08:00
2006-01-01 04:12:24 +08:00
if ( ! isset ( $scale ) )
$scale = max ( reScale ( SCALE_SCALE , $event [ 'DefaultScale' ], ZM_WEB_DEFAULT_SCALE ), SCALE_SCALE );
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 >
2005-05-06 20:24:57 +08:00
< title >< ? = ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangFrame ?> <?= $eid."-".$fid ?></title>
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
window . focus ();
function newWindow ( Url , Name , Width , Height )
{
2005-12-08 19:20:00 +08:00
var Win = window . open ( Url , Name , " resizable,scrollbars,width= " + Width + " ,height= " + Height );
2003-07-11 17:27:56 +08:00
}
function closeWindow ()
{
window . close ();
}
function deleteEvent ()
{
2004-01-08 18:55:16 +08:00
location . href = " <?= $PHP_SELF ?>?view=none&action=delete&mark_eid=<?= $eid ?> " ;
2003-07-11 17:27:56 +08:00
//window.close();
}
</ script >
</ head >
< body >
2006-01-17 19:31:31 +08:00
< table width = " 96% " cellpadding = " 3 " cellspacing = " 0 " border = " 0 " >
2005-02-23 20:06:44 +08:00
< tr >< td width = " 60% " class = " smallhead " >< ? = $zmSlangFrame ?> <?= $eid."-".$fid." (".$frame['Score'].")" ?>
2004-03-04 23:13:10 +08:00
< ? php if ( ZM_RECORD_EVENT_STATS && $alarm_frame ) { ?>
2004-01-07 20:57:07 +08:00
( < a href = " javascript: newWindow( '<?= $PHP_SELF ?>?view=stats&eid=<?= $eid ?>&fid=<?= $fid ?>', 'zmStats', <?= $jws['stats'] ['w'] ?>, <?= $jws['stats'] ['h'] ?> ); " >< ? = $zmSlangStats ?> </a>)
2003-07-11 17:27:56 +08:00
< ? php } ?>
</ td >
2005-02-23 20:06:44 +08:00
< td width = " 20% " align = " center " class = " text " >< ? php if ( canEdit ( 'Events' ) ) { ?> <a href="javascript: deleteEvent();"><?= $zmSlangDelete ?></a><?php } else { ?> <?php } ?></td>
< td width = " 20% " align = " right " class = " text " >< a href = " javascript: closeWindow(); " >< ? = $zmSlangClose ?> </a></td>
2003-07-11 17:27:56 +08:00
</ tr >
2006-01-17 19:31:31 +08:00
< tr >< td colspan = " 3 " align = " center " >< ? php if ( $has_anal_image ) { ?> <a href="<?= $PHP_SELF ?>?view=frame&eid=<?= $eid ?>&fid=<?= $fid ?>&scale=<?= $scale ?>&show=<?= $image_path==$anal_image?"capt":"anal" ?>"><?php } ?><img src="<?= $image_path ?>" width="<?= reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?= reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" class="<?= $img_class ?>"><?php if ( $has_anal_image ) { ?></a><?php } ?></td></tr>
2003-07-11 17:27:56 +08:00
< tr >
2006-01-17 19:31:31 +08:00
< tr >< td colspan = " 3 " align = " center " >< table width = " 96% " cellpadding = " 0 " cellspacing = " 0 " border = " 0 " >< tr >
2003-07-11 17:27:56 +08:00
< ? php if ( $fid > 1 ) { ?>
2006-01-01 04:12:24 +08:00
< td align = " center " width = " 25% " class = " text " >< a href = " <?= $PHP_SELF ?>?view=frame&eid=<?= $eid ?>&fid=<?= $first_fid ?>&scale=<?= $scale ?> " >< ? = $zmSlangFirst ?> </a></td>
2003-07-11 17:27:56 +08:00
< ? php } else { ?>
< td align = " center " width = " 25% " class = " text " >& nbsp ; </ td >
< ? php } if ( $fid > 1 ) { ?>
2006-01-01 04:12:24 +08:00
< td align = " center " width = " 25% " class = " text " >< a href = " <?= $PHP_SELF ?>?view=frame&eid=<?= $eid ?>&fid=<?= $prev_fid ?>&scale=<?= $scale ?> " >< ? = $zmSlangPrev ?> </a></td>
2003-07-11 17:27:56 +08:00
< ? php } else { ?>
< td align = " center " width = " 25% " class = " text " >& nbsp ; </ td >
< ? php } if ( $fid < $max_fid ) { ?>
2006-01-01 04:12:24 +08:00
< td align = " center " width = " 25% " class = " text " >< a href = " <?= $PHP_SELF ?>?view=frame&eid=<?= $eid ?>&fid=<?= $next_fid ?>&scale=<?= $scale ?> " >< ? = $zmSlangNext ?> </a></td>
2003-07-11 17:27:56 +08:00
< ? php } else { ?>
< td align = " center " width = " 25% " class = " text " >& nbsp ; </ td >
< ? php } if ( $fid < $max_fid ) { ?>
2006-01-01 04:12:24 +08:00
< td align = " center " width = " 25% " class = " text " >< a href = " <?= $PHP_SELF ?>?view=frame&eid=<?= $eid ?>&fid=<?= $last_fid ?>&scale=<?= $scale ?> " >< ? = $zmSlangLast ?> </a></td>
2003-07-11 17:27:56 +08:00
< ? php } else { ?>
< td align = " center " width = " 25% " class = " text " >& nbsp ; </ td >
< ? php } ?>
</ tr >
2005-02-23 20:06:44 +08:00
</ table ></ td ></ tr >
2005-02-02 07:05:19 +08:00
< ? php if ( file_exists ( $d_image_path )) { ?>
2005-02-23 20:06:44 +08:00
< tr >< td colspan = " 3 " >< ? = $d_image_path ?> </tr>
2006-01-01 04:12:24 +08:00
< tr >< td colspan = " 3 " >< img src = " <?= $d_image_path ?> " width = " <?= reScale( $event['Width'] , $event['DefaultScale'] , $scale ) ?> " height = " <?= reScale( $event ['He
ight '], $event[' DefaultScale ' ], $scale ) ?> " class="<?= $img_class ?>"></td></tr>
2005-02-02 07:05:19 +08:00
< ? php } ?>
< ? php if ( file_exists ( $r_image_path )) { ?>
2005-02-23 20:06:44 +08:00
< tr >< td colspan = " 3 " >< ? = $r_image_path ?> </tr>
2006-01-01 04:12:24 +08:00
< tr >< td colspan = " 3 " >< img src = " <?= $r_image_path ?> " width = " <?= reScale( $event['Width'] , $event['DefaultScale'] , $scale ) ?> " height = " <?= reScale( $event ['He
ight '], $event[' DefaultScale ' ], $scale ) ?> " class="<?= $img_class ?>"></td></tr>
2005-02-02 07:05:19 +08:00
< ? php } ?>
2003-07-11 17:27:56 +08:00
</ table >
</ body >
</ html >