2014-05-29 23:47:52 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web event view file, $Date$, $Revision$
|
|
|
|
// Copyright (C) 2001-2008 Philip Coombes
|
|
|
|
//
|
|
|
|
// 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
|
2008-07-14 21:54:50 +08:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2014-05-29 23:47:52 +08:00
|
|
|
// 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
|
2008-07-14 21:54:50 +08:00
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
2014-05-29 23:47:52 +08:00
|
|
|
//
|
|
|
|
|
2016-09-29 21:28:48 +08:00
|
|
|
if ( !canView( 'Events' ) ) {
|
|
|
|
$view = 'error';
|
2008-07-14 21:54:50 +08:00
|
|
|
return;
|
2014-05-29 23:47:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$eid = validInt( $_REQUEST['eid'] );
|
|
|
|
$fid = !empty($_REQUEST['fid'])?validInt($_REQUEST['fid']):1;
|
|
|
|
|
2016-10-12 21:17:57 +08:00
|
|
|
$Event = new Event( $eid );
|
|
|
|
$Monitor = $Event->Monitor();
|
2015-02-24 03:10:18 +08:00
|
|
|
if ( $user['MonitorIds'] ) {
|
2016-10-12 21:17:57 +08:00
|
|
|
$monitor_ids = explode( ',', $user['MonitorIds'] );
|
|
|
|
if ( count($monitor_ids) and ! in_array( $Event->MonitorId(), $monitors_ids ) ) {
|
|
|
|
$view = 'error';
|
|
|
|
return;
|
|
|
|
}
|
2015-02-24 03:10:18 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2014-05-29 23:47:52 +08:00
|
|
|
if ( isset( $_REQUEST['rate'] ) )
|
2008-09-26 17:47:20 +08:00
|
|
|
$rate = validInt($_REQUEST['rate']);
|
2014-05-29 23:47:52 +08:00
|
|
|
else
|
2016-10-13 03:39:32 +08:00
|
|
|
$rate = reScale( RATE_BASE, $Monitor->DefaultRate(), ZM_WEB_DEFAULT_RATE );
|
2016-09-27 21:46:04 +08:00
|
|
|
|
|
|
|
if ( isset( $_REQUEST['scale'] ) ) {
|
|
|
|
$scale = validInt($_REQUEST['scale']);
|
2016-10-12 21:17:57 +08:00
|
|
|
} else if ( isset( $_COOKIE['zmWatchScale'.$Event->MonitorId()] ) ) {
|
|
|
|
$scale = $_COOKIE['zmEventScale'.$Event->MonitorId()];
|
2016-09-27 21:46:04 +08:00
|
|
|
} else {
|
2016-10-13 03:39:32 +08:00
|
|
|
$scale = reScale( SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE );
|
2016-09-27 21:46:04 +08:00
|
|
|
}
|
2014-05-29 23:47:52 +08:00
|
|
|
|
|
|
|
$replayModes = array(
|
2015-05-10 21:10:30 +08:00
|
|
|
'single' => translate('ReplaySingle'),
|
|
|
|
'all' => translate('ReplayAll'),
|
|
|
|
'gapless' => translate('ReplayGapless'),
|
2014-05-29 23:47:52 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
if ( isset( $_REQUEST['streamMode'] ) )
|
2008-09-26 17:47:20 +08:00
|
|
|
$streamMode = validHtmlStr($_REQUEST['streamMode']);
|
2014-05-29 23:47:52 +08:00
|
|
|
else
|
2016-04-01 23:35:38 +08:00
|
|
|
$streamMode = 'video';
|
2014-05-29 23:47:52 +08:00
|
|
|
|
|
|
|
if ( isset( $_REQUEST['replayMode'] ) )
|
2008-09-26 17:47:20 +08:00
|
|
|
$replayMode = validHtmlStr($_REQUEST['replayMode']);
|
2014-05-29 23:47:52 +08:00
|
|
|
if ( isset( $_COOKIE['replayMode']) && preg_match('#^[a-z]+$#', $_COOKIE['replayMode']) )
|
2010-11-03 23:49:46 +08:00
|
|
|
$replayMode = validHtmlStr($_COOKIE['replayMode']);
|
2014-05-29 23:47:52 +08:00
|
|
|
else {
|
|
|
|
$keys = array_keys( $replayModes );
|
|
|
|
$replayMode = array_shift( $keys );
|
|
|
|
}
|
|
|
|
|
2015-04-14 00:41:21 +08:00
|
|
|
// videojs zoomrotate only when direct recording
|
|
|
|
$Zoom = 1;
|
|
|
|
$Rotation = 0;
|
2016-10-12 21:17:57 +08:00
|
|
|
if ( $Monitor->VideoWriter() == '2' ) {
|
2016-04-01 23:35:38 +08:00
|
|
|
# Passthrough
|
2016-10-12 21:17:57 +08:00
|
|
|
$Rotation = $Event->Orientation();
|
|
|
|
if ( in_array($Event->Orientation(),array('90','270')) )
|
|
|
|
$Zoom = $Event->Height()/$Event->Width();
|
2015-04-14 00:41:21 +08:00
|
|
|
}
|
|
|
|
|
2014-05-29 23:47:52 +08:00
|
|
|
parseSort();
|
|
|
|
parseFilter( $_REQUEST['filter'] );
|
|
|
|
$filterQuery = $_REQUEST['filter']['query'];
|
|
|
|
|
|
|
|
$panelSections = 40;
|
2016-10-12 21:17:57 +08:00
|
|
|
$panelSectionWidth = (int)ceil(reScale($Event->Width(),$scale)/$panelSections);
|
2014-05-29 23:47:52 +08:00
|
|
|
$panelWidth = ($panelSections*$panelSectionWidth-1);
|
|
|
|
|
|
|
|
$connkey = generateConnKey();
|
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
2015-05-10 21:10:30 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('Event') );
|
2014-05-29 23:47:52 +08:00
|
|
|
?>
|
|
|
|
<body>
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="page">
|
|
|
|
<div id="content">
|
2016-10-13 03:39:32 +08:00
|
|
|
<?php
|
|
|
|
if ( ! $Event->Id() ) {
|
|
|
|
echo 'Event was not found.';
|
|
|
|
} else {
|
|
|
|
?>
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="dataBar">
|
|
|
|
<table id="dataTable" class="major" cellspacing="0">
|
|
|
|
<tr>
|
2016-10-12 21:17:57 +08:00
|
|
|
<td><span id="dataId" title="<?php echo translate('Id') ?>"><?php echo $Event->Id() ?></span></td>
|
|
|
|
<td><span id="dataCause" title="<?php echo $Event->Notes()?validHtmlStr($Event->Notes()):translate('AttrCause') ?>"><?php echo validHtmlStr($Event->Cause()) ?></span></td>
|
|
|
|
<td><span id="dataTime" title="<?php echo translate('Time') ?>"><?php echo strftime( STRF_FMT_DATETIME_SHORT, strtotime($Event->StartTime() ) ) ?></span></td>
|
|
|
|
<td><span id="dataDuration" title="<?php echo translate('Duration') ?>"><?php echo $Event->Length() ?></span>s</td>
|
|
|
|
<td><span id="dataFrames" title="<?php echo translate('AttrFrames')."/".translate('AttrAlarmFrames') ?>"><?php echo $Event->Frames() ?>/<?php echo $Event->AlarmFrames() ?></span></td>
|
|
|
|
<td><span id="dataScore" title="<?php echo translate('AttrTotalScore')."/".translate('AttrAvgScore')."/".translate('AttrMaxScore') ?>"><?php echo $Event->TotScore() ?>/<?php echo $Event->AvgScore() ?>/<?php echo $Event->MaxScore() ?></span></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div id="menuBar1">
|
2015-05-10 21:10:30 +08:00
|
|
|
<div id="scaleControl"><label for="scale"><?php echo translate('Scale') ?></label><?php echo buildSelect( "scale", $scales, "changeScale();" ); ?></div>
|
|
|
|
<div id="replayControl"><label for="replayMode"><?php echo translate('Replay') ?></label><?php echo buildSelect( "replayMode", $replayModes, "changeReplayMode();" ); ?></div>
|
2016-10-12 21:17:57 +08:00
|
|
|
<div id="nameControl"><input type="text" id="eventName" name="eventName" value="<?php echo validHtmlStr($Event->Name()) ?>" size="16"/><input type="button" value="<?php echo translate('Rename') ?>" onclick="renameEvent()"<?php if ( !canEdit( 'Events' ) ) { ?> disabled="disabled"<?php } ?>/></div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<div id="menuBar2">
|
2015-05-10 21:10:30 +08:00
|
|
|
<div id="closeWindow"><a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a></div>
|
2014-05-29 23:47:52 +08:00
|
|
|
<?php
|
2016-09-29 21:28:48 +08:00
|
|
|
if ( canEdit( 'Events' ) ) {
|
2014-05-29 23:47:52 +08:00
|
|
|
?>
|
2015-05-10 21:10:30 +08:00
|
|
|
<div id="deleteEvent"><a href="#" onclick="deleteEvent()"><?php echo translate('Delete') ?></a></div>
|
|
|
|
<div id="editEvent"><a href="#" onclick="editEvent()"><?php echo translate('Edit') ?></a></div>
|
2015-06-10 21:09:30 +08:00
|
|
|
<div id="archiveEvent" class="hidden"><a href="#" onclick="archiveEvent()"><?php echo translate('Archive') ?></a></div>
|
|
|
|
<div id="unarchiveEvent" class="hidden"><a href="#" onclick="unarchiveEvent()"><?php echo translate('Unarchive') ?></a></div>
|
2014-05-29 23:47:52 +08:00
|
|
|
<?php
|
2016-10-12 21:17:57 +08:00
|
|
|
} // end if can edit Events
|
2016-09-29 21:28:48 +08:00
|
|
|
if ( canView( 'Events' ) ) {
|
2014-05-29 23:47:52 +08:00
|
|
|
?>
|
2016-04-30 20:27:10 +08:00
|
|
|
<div id="framesEvent"><a href="#" onclick="showEventFrames()"><?php echo translate('Frames') ?></a></div>
|
2014-05-29 23:47:52 +08:00
|
|
|
<?php
|
2016-10-12 21:17:57 +08:00
|
|
|
if ( $Event->SaveJPEGs() & 3 ) { // Analysis or Jpegs
|
2014-05-29 23:47:52 +08:00
|
|
|
?>
|
2016-04-30 20:27:10 +08:00
|
|
|
<div id="stillsEvent"<?php if ( $streamMode == 'still' ) { ?> class="hidden"<?php } ?>><a href="#" onclick="showStills()"><?php echo translate('Stills') ?></a></div>
|
2014-05-29 23:47:52 +08:00
|
|
|
<?php
|
2016-10-13 03:39:32 +08:00
|
|
|
} // has frames or analysis
|
2014-05-29 23:47:52 +08:00
|
|
|
?>
|
2016-04-30 20:27:10 +08:00
|
|
|
<div id="videoEvent"<?php if ( $streamMode == 'video' ) { ?> class="hidden"<?php } ?>><a href="#" onclick="showVideo()"><?php echo translate('Video') ?></a></div>
|
|
|
|
<div id="exportEvent"><a href="#" onclick="exportEvent()"><?php echo translate('Export') ?></a></div>
|
|
|
|
</div>
|
|
|
|
<div id="eventVideo" class="">
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2016-10-12 21:17:57 +08:00
|
|
|
if ( $Event->DefaultVideo() ) {
|
2014-05-12 06:08:23 +08:00
|
|
|
?>
|
2016-04-30 20:27:10 +08:00
|
|
|
<div id="videoFeed">
|
2016-10-12 21:17:57 +08:00
|
|
|
<video id="videoobj" class="video-js vjs-default-skin" width="<?php echo reScale( $Event->Width(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $scale ) ?>" data-setup='{ "controls": true, "playbackRates": [0.5, 1, 1.5, 2, 4, 8, 16, 32, 64, 128, 256], "autoplay": true, "preload": "auto", "plugins": { "zoomrotate": { "rotate": "<?php echo $Rotation ?>", "zoom": "<?php echo $Zoom ?>"}}}'>
|
2016-10-13 03:39:32 +08:00
|
|
|
<source src="<?php echo $Event->getStreamSrc( array( "mode=mpeg&format=h264" ) ); ?>" type="video/mp4">
|
2016-04-30 20:27:10 +08:00
|
|
|
Your browser does not support the video tag.
|
|
|
|
</video>
|
|
|
|
</div>
|
2016-10-13 03:39:32 +08:00
|
|
|
<!--script>includeVideoJs();</script-->
|
|
|
|
<link href="//vjs.zencdn.net/4.11/video-js.css" rel="stylesheet">
|
|
|
|
<script src="//vjs.zencdn.net/4.11/video.js"></script>
|
|
|
|
<script src="./js/videojs.zoomrotate.js"></script>
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
|
|
|
|
<script>
|
|
|
|
var LabelFormat = "<?php echo validJsStr($Monitor->LabelFormat())?>";
|
|
|
|
var monitorName = "<?php echo validJsStr($Monitor->Name())?>";
|
|
|
|
var duration = <?php echo $Event->Length() ?>, startTime = '<?php echo $Event->StartTime() ?>';
|
|
|
|
|
|
|
|
addVideoTimingTrack(document.getElementById('videoobj'), LabelFormat, monitorName, duration, startTime);
|
|
|
|
</script>
|
2014-05-12 06:08:23 +08:00
|
|
|
<?php
|
2016-10-13 03:39:32 +08:00
|
|
|
} // end if DefaultVideo
|
2015-02-16 16:43:13 +08:00
|
|
|
?>
|
2016-10-13 03:39:32 +08:00
|
|
|
<div id="imageFeed" <?php if ( $Event->DefaultVideo() ) { ?>class="hidden"<?php } ?> >
|
2015-02-16 16:43:13 +08:00
|
|
|
<?php
|
2016-09-29 21:28:48 +08:00
|
|
|
if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
2008-09-26 17:47:20 +08:00
|
|
|
$streamSrc = getStreamSrc( array( "source=event", "mode=mpeg", "event=".$eid, "frame=".$fid, "scale=".$scale, "rate=".$rate, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_MPEG_REPLAY_FORMAT, "replay=".$replayMode ) );
|
2016-10-12 21:17:57 +08:00
|
|
|
outputVideoStream( "evtStream", $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ), ZM_MPEG_LIVE_FORMAT );
|
2016-09-29 21:28:48 +08:00
|
|
|
} else {
|
2008-09-26 17:47:20 +08:00
|
|
|
$streamSrc = getStreamSrc( array( "source=event", "mode=jpeg", "event=".$eid, "frame=".$fid, "scale=".$scale, "rate=".$rate, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "replay=".$replayMode) );
|
2016-09-29 21:28:48 +08:00
|
|
|
if ( canStreamNative() ) {
|
2016-10-12 21:17:57 +08:00
|
|
|
outputImageStream( "evtStream", $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ), validHtmlStr($Event->Name()) );
|
2016-09-29 21:28:48 +08:00
|
|
|
} else {
|
2016-10-12 21:17:57 +08:00
|
|
|
outputHelperStream( "evtStream", $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ) );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2016-10-12 21:17:57 +08:00
|
|
|
} // end if stream method
|
2014-05-29 23:47:52 +08:00
|
|
|
?>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<p id="dvrControls">
|
2016-10-12 21:17:57 +08:00
|
|
|
<input type="button" value="<+" id="prevBtn" title="<?php echo translate('Prev') ?>" class="inactive" onclick="streamPrev( true );"/>
|
|
|
|
<input type="button" value="<<" id="fastRevBtn" title="<?php echo translate('Rewind') ?>" class="inactive" disabled="disabled" onclick="streamFastRev( true );"/>
|
|
|
|
<input type="button" value="<" id="slowRevBtn" title="<?php echo translate('StepBack') ?>" class="unavail" disabled="disabled" onclick="streamSlowRev( true );"/>
|
|
|
|
<input type="button" value="||" id="pauseBtn" title="<?php echo translate('Pause') ?>" class="inactive" onclick="streamPause( true );"/>
|
|
|
|
<input type="button" value="|>" id="playBtn" title="<?php echo translate('Play') ?>" class="active" disabled="disabled" onclick="streamPlay( true );"/>
|
|
|
|
<input type="button" value=">" id="slowFwdBtn" title="<?php echo translate('StepForward') ?>" class="unavail" disabled="disabled" onclick="streamSlowFwd( true );"/>
|
|
|
|
<input type="button" value=">>" id="fastFwdBtn" title="<?php echo translate('FastForward') ?>" class="inactive" disabled="disabled" onclick="streamFastFwd( true );"/>
|
|
|
|
<input type="button" value="–" id="zoomOutBtn" title="<?php echo translate('ZoomOut') ?>" class="avail" onclick="streamZoomOut();"/>
|
|
|
|
<input type="button" value="+>" id="nextBtn" title="<?php echo translate('Next') ?>" class="inactive" onclick="streamNext( true );"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
</p>
|
|
|
|
<div id="replayStatus">
|
2015-05-10 21:10:30 +08:00
|
|
|
<span id="mode"><?php echo translate('Mode') ?>: <span id="modeValue"> </span></span>
|
|
|
|
<span id="rate"><?php echo translate('Rate') ?>: <span id="rateValue"></span>x</span>
|
|
|
|
<span id="progress"><?php echo translate('Progress') ?>: <span id="progressValue"></span>s</span>
|
|
|
|
<span id="zoom"><?php echo translate('Zoom') ?>: <span id="zoomValue"></span>x</span>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<div id="progressBar" class="invisible">
|
2016-10-12 21:17:57 +08:00
|
|
|
<?php for ( $i = 0; $i < $panelSections; $i++ ) { ?>
|
2014-12-05 07:44:23 +08:00
|
|
|
<div class="progressBox" id="progressBox<?php echo $i ?>" title=""></div>
|
2016-10-12 21:17:57 +08:00
|
|
|
<?php } ?>
|
2016-04-30 20:27:10 +08:00
|
|
|
</div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-10-12 21:24:10 +08:00
|
|
|
<?php
|
|
|
|
if ($Event->SaveJPEGs() & 3) { // frames or analysis
|
2015-02-16 16:43:13 +08:00
|
|
|
?>
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="eventStills" class="hidden">
|
|
|
|
<div id="eventThumbsPanel">
|
|
|
|
<div id="eventThumbs">
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-06-10 21:09:30 +08:00
|
|
|
<div id="eventImagePanel">
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="eventImageFrame">
|
|
|
|
<img id="eventImage" src="graphics/transparent.gif" alt=""/>
|
|
|
|
<div id="eventImageBar">
|
2015-05-10 21:10:30 +08:00
|
|
|
<div id="eventImageClose"><input type="button" value="<?php echo translate('Close') ?>" onclick="hideEventImage()"/></div>
|
|
|
|
<div id="eventImageStats" class="hidden"><input type="button" value="<?php echo translate('Stats') ?>" onclick="showFrameStats()"/></div>
|
|
|
|
<div id="eventImageData"><?php echo translate('Frame') ?> <span id="eventImageNo"></span></div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="eventImageNav">
|
|
|
|
<div id="eventImageButtons">
|
|
|
|
<div id="prevButtonsPanel">
|
|
|
|
<input id="prevEventBtn" type="button" value="<E" onclick="prevEvent()" disabled="disabled"/>
|
|
|
|
<input id="prevThumbsBtn" type="button" value="<<" onclick="prevThumbs()" disabled="disabled"/>
|
|
|
|
<input id="prevImageBtn" type="button" value="<" onclick="prevImage()" disabled="disabled"/>
|
|
|
|
<input id="nextImageBtn" type="button" value=">" onclick="nextImage()" disabled="disabled"/>
|
|
|
|
<input id="nextThumbsBtn" type="button" value=">>" onclick="nextThumbs()" disabled="disabled"/>
|
|
|
|
<input id="nextEventBtn" type="button" value="E>" onclick="nextEvent()" disabled="disabled"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2009-05-08 19:21:28 +08:00
|
|
|
<div id="thumbsSliderPanel">
|
|
|
|
<div id="thumbsSlider">
|
2009-10-17 01:09:16 +08:00
|
|
|
<div id="thumbsKnob">
|
2009-05-08 19:21:28 +08:00
|
|
|
</div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-04-14 00:41:21 +08:00
|
|
|
<?php
|
2016-10-12 21:17:57 +08:00
|
|
|
} // end if SaveJPEGs() & 3 Analysis or Jpegs
|
2016-10-13 03:39:32 +08:00
|
|
|
} // end if canView
|
|
|
|
} // end if Event exists
|
2015-04-14 00:41:21 +08:00
|
|
|
?>
|
2016-10-13 03:39:32 +08:00
|
|
|
</div><!--page-->
|
2014-05-29 23:47:52 +08:00
|
|
|
</body>
|
2008-07-14 21:54:50 +08:00
|
|
|
</html>
|