2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web frame view file, $Date$, $Revision$
|
2008-07-25 17:48:16 +08:00
|
|
|
// Copyright (C) 2001-2008 Philip Coombes
|
2008-07-14 21:54:50 +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
|
2016-12-26 23:23:16 +08:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-07-14 21:54:50 +08:00
|
|
|
//
|
|
|
|
|
2018-11-15 04:54:34 +08:00
|
|
|
if ( !canView('Events') ) {
|
2017-05-31 01:47:30 +08:00
|
|
|
$view = 'error';
|
|
|
|
return;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2016-05-16 22:33:21 +08:00
|
|
|
require_once('includes/Frame.php');
|
|
|
|
|
2008-09-26 17:47:20 +08:00
|
|
|
$eid = validInt($_REQUEST['eid']);
|
2008-07-14 21:54:50 +08:00
|
|
|
if ( !empty($_REQUEST['fid']) )
|
2017-05-31 01:47:30 +08:00
|
|
|
$fid = validInt($_REQUEST['fid']);
|
2008-09-26 17:47:20 +08:00
|
|
|
|
2019-02-22 22:19:07 +08:00
|
|
|
$Event = new ZM\Event($eid);
|
2016-10-27 01:34:30 +08:00
|
|
|
$Monitor = $Event->Monitor();
|
2008-09-26 17:47:20 +08:00
|
|
|
|
2014-03-22 05:16:56 +08:00
|
|
|
if ( !empty($fid) ) {
|
2016-10-27 01:34:30 +08:00
|
|
|
$sql = 'SELECT * FROM Frames WHERE EventId = ? AND FrameId = ?';
|
|
|
|
if ( !($frame = dbFetchOne( $sql, NULL, array($eid, $fid) )) )
|
2019-05-25 02:59:33 +08:00
|
|
|
$frame = array( 'EventId'=>$eid, 'FrameId'=>$fid, 'Type'=>'Normal', 'Score'=>0 );
|
2014-03-22 05:16:56 +08:00
|
|
|
} else {
|
2019-03-26 00:18:15 +08:00
|
|
|
$frame = dbFetchOne('SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array($eid, $Event->MaxScore()));
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2019-02-22 22:19:07 +08:00
|
|
|
$Frame = new ZM\Frame($frame);
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2016-10-27 01:34:30 +08:00
|
|
|
$maxFid = $Event->Frames();
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$firstFid = 1;
|
2019-05-25 02:59:33 +08:00
|
|
|
$prevFid = $fid-1;
|
|
|
|
$nextFid = $fid+1;
|
2008-07-14 21:54:50 +08:00
|
|
|
$lastFid = $maxFid;
|
|
|
|
|
2019-03-26 00:18:15 +08:00
|
|
|
$alarmFrame = $Frame->Type() == 'Alarm';
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2016-10-27 01:34:30 +08:00
|
|
|
if ( isset( $_REQUEST['scale'] ) ) {
|
2019-02-10 07:10:42 +08:00
|
|
|
$scale = validNum($_REQUEST['scale']);
|
2016-10-27 01:34:30 +08:00
|
|
|
} else if ( isset( $_COOKIE['zmWatchScale'.$Monitor->Id()] ) ) {
|
2019-02-10 07:10:42 +08:00
|
|
|
$scale = validNum($_COOKIE['zmWatchScale'.$Monitor->Id()]);
|
2016-10-27 01:34:30 +08:00
|
|
|
} else if ( isset( $_COOKIE['zmWatchScale'] ) ) {
|
2019-02-10 07:10:42 +08:00
|
|
|
$scale = validNum($_COOKIE['zmWatchScale']);
|
2016-10-27 01:34:30 +08:00
|
|
|
} else {
|
2019-11-20 22:31:58 +08:00
|
|
|
$scale = max(reScale(SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
|
2016-10-27 01:34:30 +08:00
|
|
|
}
|
2019-03-26 00:18:15 +08:00
|
|
|
$scale = $scale ?: 'auto';
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2017-06-01 08:55:10 +08:00
|
|
|
$imageData = $Event->getImageSrc( $frame, $scale, 0 );
|
|
|
|
if ( ! $imageData ) {
|
2019-02-22 22:19:07 +08:00
|
|
|
ZM\Error("No data found for Event $eid frame $fid");
|
2017-06-01 08:55:10 +08:00
|
|
|
$imageData = array();
|
|
|
|
}
|
2017-05-31 01:47:30 +08:00
|
|
|
|
|
|
|
$show = 'capt';
|
2019-02-10 07:10:42 +08:00
|
|
|
if (isset($_REQUEST['show']) && in_array($_REQUEST['show'], array('capt', 'anal'))) {
|
2017-05-31 01:47:30 +08:00
|
|
|
$show = $_REQUEST['show'];
|
|
|
|
} else if ( $imageData['hasAnalImage'] ) {
|
|
|
|
$show = 'anal';
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$imagePath = $imageData['thumbPath'];
|
|
|
|
$eventPath = $imageData['eventPath'];
|
2019-03-26 00:18:15 +08:00
|
|
|
$dImagePath = sprintf('%s/%0'.ZM_EVENT_IMAGE_DIGITS.'d-diag-d.jpg', $eventPath, $Frame->FrameId());
|
|
|
|
$rImagePath = sprintf('%s/%0'.ZM_EVENT_IMAGE_DIGITS.'d-diag-r.jpg', $eventPath, $Frame->FrameId());
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
2019-03-26 00:18:15 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('Frame').' - '.$Event->Id().' - '.$Frame->FrameId());
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
|
|
|
<div id="header">
|
2016-10-27 01:34:30 +08:00
|
|
|
<form>
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="headerButtons">
|
2016-10-27 01:34:30 +08:00
|
|
|
<?php if ( ZM_RECORD_EVENT_STATS && $alarmFrame ) { echo makePopupLink( '?view=stats&eid='.$Event->Id().'&fid='.$Frame->FrameId(), 'zmStats', 'stats', translate('Stats') ); } ?>
|
|
|
|
<?php if ( canEdit( 'Events' ) ) { ?><a href="?view=none&action=delete&markEid=<?php echo $Event->Id() ?>"><?php echo translate('Delete') ?></a><?php } ?>
|
2019-02-10 07:10:42 +08:00
|
|
|
<a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
2019-02-10 07:10:42 +08:00
|
|
|
<div id="scaleControl"><label for="scale"><?php echo translate('Scale') ?></label><?php echo buildSelect('scale', $scales); ?></div>
|
2018-11-15 04:54:34 +08:00
|
|
|
<h2><?php echo translate('Frame') ?> <?php echo $Event->Id().'-'.$Frame->FrameId().' ('.$Frame->Score().')' ?></h2>
|
|
|
|
<input type="hidden" name="base_width" id="base_width" value="<?php echo $Event->Width(); ?>"/>
|
|
|
|
<input type="hidden" name="base_height" id="base_height" value="<?php echo $Event->Height(); ?>"/>
|
2016-10-27 01:34:30 +08:00
|
|
|
</form>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<div id="content">
|
2016-05-16 22:33:21 +08:00
|
|
|
<p id="image">
|
2017-05-31 01:47:30 +08:00
|
|
|
|
|
|
|
<?php if ( $imageData['hasAnalImage'] ) {
|
|
|
|
echo sprintf('<a href="?view=frame&eid=%d&fid=%d&scale=%d&show=%s">', $Event->Id(), $Frame->FrameId(), $scale, ( $show=='anal'?'capt':'anal' ) );
|
|
|
|
} ?>
|
2019-11-20 22:31:58 +08:00
|
|
|
<img id="frameImg"
|
|
|
|
src="<?php echo validHtmlStr($Frame->getImageSrc($show=='anal'?'analyse':'capture')) ?>"
|
|
|
|
width="<?php echo reScale($Event->Width(), $Monitor->DefaultScale(), $scale) ?>"
|
|
|
|
height="<?php echo reScale( $Event->Height(), $Monitor->DefaultScale(), $scale ) ?>"
|
|
|
|
alt="<?php echo $Frame->EventId().'-'.$Frame->FrameId() ?>"
|
|
|
|
class="<?php echo $imageData['imageClass'] ?>"
|
|
|
|
/>
|
2016-05-16 22:33:21 +08:00
|
|
|
<?php if ( $imageData['hasAnalImage'] ) { ?></a><?php } ?>
|
2017-05-31 01:47:30 +08:00
|
|
|
|
|
|
|
</p>
|
2018-11-15 04:54:34 +08:00
|
|
|
<?php
|
2019-12-03 04:49:32 +08:00
|
|
|
$frame_url_base = '?view=frame&eid='.$Event->Id().'&scale='.$scale.'&show='.$show.'&fid=';
|
2019-05-25 02:51:08 +08:00
|
|
|
?>
|
|
|
|
<p id="controls">
|
|
|
|
<a id="firstLink" <?php echo (( $Frame->FrameId() > 1 ) ? 'href="'.$frame_url_base.$firstFid.'" class="btn-primary"' : 'class="btn-primary disabled"') ?>><?php echo translate('First') ?></a>
|
|
|
|
<a id="prevLink" <?php echo ( $Frame->FrameId() > 1 ) ? 'href="'.$frame_url_base.$prevFid.'" class="btn-primary"' : 'class="btn-primary disabled"' ?>><?php echo translate('Prev') ?></a>
|
|
|
|
<a id="nextLink" <?php echo ( $Frame->FrameId() < $maxFid ) ? 'href="'.$frame_url_base.$nextFid.'" class="btn-primary"' : 'class="btn-primary disabled"' ?>><?php echo translate('Next') ?></a>
|
|
|
|
<a id="lastLink" <?php echo ( $Frame->FrameId() < $maxFid ) ? 'href="'.$frame_url_base.$lastFid .'" class="btn-primary"' : 'class="btn-primary disabled"' ?>><?php echo translate('Last') ?></a>
|
2008-07-14 21:54:50 +08:00
|
|
|
</p>
|
2019-11-20 22:31:58 +08:00
|
|
|
<?php
|
|
|
|
if ( file_exists($dImagePath) ) {
|
|
|
|
?>
|
2014-12-05 07:44:23 +08:00
|
|
|
<p id="diagImagePath"><?php echo $dImagePath ?></p>
|
2019-11-20 22:31:58 +08:00
|
|
|
<p id="diagImage">
|
|
|
|
<img
|
|
|
|
src="<?php echo viewImagePath($dImagePath) ?>"
|
|
|
|
width="<?php echo reScale($Event->Width(), $Monitor->DefaultScale(), $scale) ?>"
|
|
|
|
height="<?php echo reScale($Event->Height(), $Monitor->DefaultScale(), $scale) ?>"
|
|
|
|
class="<?php echo $imageData['imageClass'] ?>"
|
|
|
|
/>
|
|
|
|
</p>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
if ( file_exists($rImagePath) ) {
|
|
|
|
?>
|
2014-12-05 07:44:23 +08:00
|
|
|
<p id="refImagePath"><?php echo $rImagePath ?></p>
|
2019-11-20 22:31:58 +08:00
|
|
|
<p id="refImage">
|
|
|
|
<img
|
|
|
|
src="<?php echo viewImagePath($rImagePath) ?>"
|
|
|
|
width="<?php echo reScale($Event->Width(), $Monitor->DefaultScale(), $scale) ?>"
|
|
|
|
height="<?php echo reScale($Event->Height(), $Monitor->DefaultScale(), $scale) ?>"
|
|
|
|
class="<?php echo $imageData['imageClass'] ?>"
|
|
|
|
/>
|
|
|
|
</p>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php } ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|