2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web cycle 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-07-10 00:50:57 +08:00
|
|
|
if ( !canView('Stream') ) {
|
2017-05-30 23:52:48 +08:00
|
|
|
$view = 'error';
|
2016-07-14 23:55:27 +08:00
|
|
|
return;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2016-07-14 23:55:27 +08:00
|
|
|
if ( empty($_REQUEST['mode']) ) {
|
|
|
|
if ( canStream() )
|
2017-05-30 23:52:48 +08:00
|
|
|
$mode = 'stream';
|
2016-07-14 23:55:27 +08:00
|
|
|
else
|
2017-05-30 23:52:48 +08:00
|
|
|
$mode = 'still';
|
2016-07-14 23:55:27 +08:00
|
|
|
} else {
|
|
|
|
$mode = validHtmlStr($_REQUEST['mode']);
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-12-05 04:52:16 +08:00
|
|
|
ob_start();
|
|
|
|
include('_monitor_filters.php');
|
|
|
|
$filterbar = ob_get_contents();
|
|
|
|
ob_end_clean();
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$monIdx = 0;
|
2017-12-05 04:52:16 +08:00
|
|
|
$monitors = array();
|
2019-01-05 23:20:34 +08:00
|
|
|
$monitor = NULL;
|
2017-12-05 04:52:16 +08:00
|
|
|
foreach( $displayMonitors as &$row ) {
|
|
|
|
if ( $row['Function'] == 'None' )
|
2016-07-14 23:55:27 +08:00
|
|
|
continue;
|
|
|
|
if ( isset($_REQUEST['mid']) && $row['Id'] == $_REQUEST['mid'] )
|
|
|
|
$monIdx = count($monitors);
|
2017-12-05 04:52:16 +08:00
|
|
|
|
2018-07-10 00:33:21 +08:00
|
|
|
$row['ScaledWidth'] = reScale($row['Width'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
|
|
|
|
$row['ScaledHeight'] = reScale($row['Height'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
|
|
|
|
$row['PopupScale'] = reScale(SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
|
2017-12-05 04:52:16 +08:00
|
|
|
|
|
|
|
$row['connKey'] = generateConnKey();
|
2018-07-10 00:33:21 +08:00
|
|
|
$monitors[] = new Monitor($row);
|
2017-12-05 04:52:16 +08:00
|
|
|
} # end foreach Monitor
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2017-10-01 02:19:32 +08:00
|
|
|
if ( $monitors ) {
|
|
|
|
$monitor = $monitors[$monIdx];
|
|
|
|
$nextMid = $monIdx==(count($monitors)-1)?$monitors[0]->Id():$monitors[$monIdx+1]->Id();
|
|
|
|
$montageWidth = $monitor->ScaledWidth();
|
|
|
|
$montageHeight = $monitor->ScaledHeight();
|
|
|
|
$widthScale = ($montageWidth*SCALE_BASE)/$monitor->Width();
|
|
|
|
$heightScale = ($montageHeight*SCALE_BASE)/$monitor->Height();
|
|
|
|
$scale = (int)(($widthScale<$heightScale)?$widthScale:$heightScale);
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
noCacheHeaders();
|
2018-07-10 00:33:21 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('CycleWatch'));
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
2018-07-10 00:33:21 +08:00
|
|
|
<?php echo $navbar = getNavBarHTML(); ?>
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="header">
|
|
|
|
<div id="headerButtons">
|
2018-07-10 00:33:21 +08:00
|
|
|
<?php if ( $mode == 'stream' ) { ?>
|
2017-10-01 02:19:32 +08:00
|
|
|
<a href="?view=<?php echo $view ?>&mode=still&mid=<?php echo $monitor ? $monitor->Id() : '' ?>"><?php echo translate('Stills') ?></a>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php } else { ?>
|
2017-10-01 02:19:32 +08:00
|
|
|
<a href="?view=<?php echo $view ?>&mode=stream&mid=<?php echo $monitor ? $monitor->Id() : '' ?>"><?php echo translate('Stream') ?></a>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php } ?>
|
|
|
|
</div>
|
2017-10-01 02:19:32 +08:00
|
|
|
<div class="controlHeader">
|
2018-07-10 00:50:57 +08:00
|
|
|
<form method="get">
|
|
|
|
<input type="hidden" name="view" value="cycle"/>
|
|
|
|
<?php echo $filterbar ?>
|
|
|
|
</form>
|
2017-10-01 02:19:32 +08:00
|
|
|
</div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<div id="imageFeed">
|
2017-10-01 02:19:32 +08:00
|
|
|
<?php
|
|
|
|
if ( $monitor ) {
|
2018-07-10 00:50:57 +08:00
|
|
|
echo getStreamHTML($monitor, array('scale'=>$scale, 'mode'=>$mode, 'width'=>'100%'));
|
2017-10-01 02:19:32 +08:00
|
|
|
} else {
|
|
|
|
echo "There are no monitors to view.";
|
|
|
|
}
|
|
|
|
?>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-10-02 23:55:52 +08:00
|
|
|
<?php xhtmlFooter() ?>
|