Merge branch 'master' of github.com:ZoneMinder/ZoneMinder

This commit is contained in:
Isaac Connor 2018-07-09 12:39:08 -04:00
commit 65564fa480
6 changed files with 122 additions and 98 deletions

View File

@ -0,0 +1,3 @@
input[type="text"] {
width: 100%;
}

View File

@ -44,12 +44,12 @@ foreach( $displayMonitors as &$row ) {
if ( isset($_REQUEST['mid']) && $row['Id'] == $_REQUEST['mid'] )
$monIdx = count($monitors);
$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 );
$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);
$row['connKey'] = generateConnKey();
$monitors[] = new Monitor( $row );
$monitors[] = new Monitor($row);
} # end foreach Monitor
if ( $monitors ) {
@ -63,14 +63,14 @@ if ( $monitors ) {
}
noCacheHeaders();
xhtmlHeaders(__FILE__, translate('CycleWatch') );
xhtmlHeaders(__FILE__, translate('CycleWatch'));
?>
<body>
<div id="page">
<?php echo $navbar = getNavBarHTML(); ?>
<?php echo $navbar = getNavBarHTML(); ?>
<div id="header">
<div id="headerButtons">
<?php if ( $mode == "stream" ) { ?>
<?php if ( $mode == 'stream' ) { ?>
<a href="?view=<?php echo $view ?>&amp;mode=still&amp;mid=<?php echo $monitor ? $monitor->Id() : '' ?>"><?php echo translate('Stills') ?></a>
<?php } else { ?>
<a href="?view=<?php echo $view ?>&amp;mode=stream&amp;mid=<?php echo $monitor ? $monitor->Id() : '' ?>"><?php echo translate('Stream') ?></a>
@ -84,7 +84,7 @@ xhtmlHeaders(__FILE__, translate('CycleWatch') );
<div id="imageFeed">
<?php
if ( $monitor ) {
echo getStreamHTML( $monitor, array( 'scale'=>$scale, 'mode'=>$mode ) );
echo getStreamHTML($monitor, array('scale'=>$scale, 'mode'=>$mode));
} else {
echo "There are no monitors to view.";
}

View File

@ -1,9 +1,9 @@
function nextCycleView() {
window.location.replace( '?view=cycle&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout );
window.location.replace('?view=cycle&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout);
}
function initCycle() {
nextCycleView.periodical( cycleRefreshTimeout );
nextCycleView.periodical(cycleRefreshTimeout);
}
window.addEvent( 'domready', initCycle );
window.addEvent('domready', initCycle);

View File

@ -240,7 +240,7 @@ function timerFire() {
if ( liveMode ) {
outputUpdate(currentTimeSecs); // In live mode we basically do nothing but redisplay
} else if (currentTimeSecs + playSecsperInterval >= maxTimeSecs) {
} else if ( currentTimeSecs + playSecsperInterval >= maxTimeSecs ) {
// beyond the end just stop
console.log("Current time " + currentTimeSecs + " + " + playSecsperInterval + " >= " + maxTimeSecs + " so stopping");
setSpeed(0);
@ -472,7 +472,9 @@ function redrawScreen() {
function outputUpdate(time) {
drawSliderOnGraph(time);
for ( var i=0; i < numMonitors; i++ ) {
loadImage2Monitor(monitorPtr[i],getImageSource(monitorPtr[i],time));
var src = getImageSource(monitorPtr[i],time);
console.log("New image src: " + src);
loadImage2Monitor(monitorPtr[i],src);
}
currentTimeSecs = time;
}

View File

@ -27,7 +27,7 @@ require_once('includes/MontageLayout.php');
$showControl = false;
$showZones = false;
if ( isset( $_REQUEST['showZones'] ) ) {
if ( isset($_REQUEST['showZones']) ) {
if ( $_REQUEST['showZones'] == 1 ) {
$showZones = true;
}
@ -51,7 +51,7 @@ $scale = '100'; # actual
if ( isset( $_REQUEST['scale'] ) ) {
$scale = validInt($_REQUEST['scale']);
Logger::Debug("Setting scale from request to $scale");
} else if ( isset( $_COOKIE['zmMontageScale'] ) ) {
} else if ( isset($_COOKIE['zmMontageScale']) ) {
$scale = $_COOKIE['zmMontageScale'];
Logger::Debug("Setting scale from cookie to $scale");
}
@ -65,7 +65,6 @@ foreach ( $layouts as $l ) {
$layoutsById[$l->Id()] = $l;
}
session_start();
$layout_id = '';
@ -80,28 +79,29 @@ $Layout = '';
$Positions = '';
if ( $layout_id and is_numeric($layout_id) and isset($layoutsById[$layout_id]) ) {
$Layout = $layoutsById[$layout_id];
$Positions = json_decode( $Layout->Positions(), true );
$Positions = json_decode($Layout->Positions(), true);
}
if ( $Layout and ( $Layout->Name() != 'Freeform' ) ) {
// Use layout instead of other options
}
if ( isset($_COOKIE['zmMontageWidth']) and $_COOKIE['zmMontageWidth'] ) {
if ( isset($_COOKIE['zmMontageWidth']) and $_COOKIE['zmMontageWidth'] ) {
$_SESSION['zmMontageWidth'] = $options['width'] = $_COOKIE['zmMontageWidth'];
} elseif ( isset($_SESSION['zmMontageWidth']) and $_SESSION['zmMontageWidth'] ) {
} elseif ( isset($_SESSION['zmMontageWidth']) and $_SESSION['zmMontageWidth'] ) {
$options['width'] = $_SESSION['zmMontageWidth'];
} else
} else
$options['width'] = '';
if ( isset($_COOKIE['zmMontageHeight']) and $_COOKIE['zmMontageHeight'] )
if ( isset($_COOKIE['zmMontageHeight']) and $_COOKIE['zmMontageHeight'] )
$_SESSION['zmMontageHeight'] = $options['height'] = $_COOKIE['zmMontageHeight'];
else if ( isset($_SESSION['zmMontageHeight']) and $_SESSION['zmMontageHeight'] )
else if ( isset($_SESSION['zmMontageHeight']) and $_SESSION['zmMontageHeight'] )
$options['height'] = $_SESSION['zmMontageHeight'];
else
else
$options['height'] = '';
if ( $scale )
if ( $scale )
$options['scale'] = $scale;
session_write_close();
ob_start();
@ -120,16 +120,16 @@ foreach( $displayMonitors as &$row ) {
if ( ZM_OPT_CONTROL && $row['ControlId'] && $row['Controllable'] )
$showControl = true;
$row['connKey'] = generateConnKey();
if ( ! isset( $widths[$row['Width']] ) ) {
if ( ! isset($widths[$row['Width']]) ) {
$widths[$row['Width']] = $row['Width'];
}
if ( ! isset( $heights[$row['Height']] ) ) {
if ( ! isset($heights[$row['Height']]) ) {
$heights[$row['Height']] = $row['Height'];
}
$monitors[] = new Monitor( $row );
$monitors[] = new Monitor($row);
} # end foreach Monitor
xhtmlHeaders(__FILE__, translate('Montage') );
xhtmlHeaders(__FILE__, translate('Montage'));
?>
<body>
<div id="page">
@ -139,7 +139,7 @@ xhtmlHeaders(__FILE__, translate('Montage') );
<?php
if ( $showControl ) {
?>
<a href="#" onclick="createPopup( '?view=control', 'zmControl', 'control' )"><?php echo translate('Control') ?></a>
<a href="#" onclick="createPopup('?view=control', 'zmControl', 'control')"><?php echo translate('Control') ?></a>
<?php
}
if ( $showZones ) {
@ -153,21 +153,30 @@ if ( $showZones ) {
}
?>
</div>
<form method="get">
<input type="hidden" name="view" value="montage"/>
<form method="get">
<input type="hidden" name="view" value="montage"/>
<?php echo $filterbar ?>
</form>
</form>
<div id="sizeControl">
<form action="index.php?view=montage" method="post">
<input type="hidden" name="object" value="MontageLayout"/>
<input type="hidden" name="action" value="Save"/>
<span id="widthControl"><label><?php echo translate('Width') ?>:</label><?php echo htmlSelect( 'width', $widths, $options['width'], 'changeSize(this);' ); ?></span>
<span id="heightControl"><label><?php echo translate('Height') ?>:</label><?php echo htmlSelect( 'height', $heights, $options['height'], 'changeSize(this);' ); ?></span>
<span id="scaleControl"><label><?php echo translate('Scale') ?>:</label><?php echo htmlSelect( 'scale', $scales, $scale, 'changeScale(this);' ); ?></span>
<span id="widthControl">
<label><?php echo translate('Width') ?>:</label>
<?php echo htmlSelect('width', $widths, $options['width'], 'changeSize(this);'); ?>
</span>
<span id="heightControl">
<label><?php echo translate('Height') ?>:</label>
<?php echo htmlSelect('height', $heights, $options['height'], 'changeSize(this);'); ?>
</span>
<span id="scaleControl">
<label><?php echo translate('Scale') ?>:</label>
<?php echo htmlSelect('scale', $scales, $scale, 'changeScale(this);'); ?>
</span>
<span id="layoutControl">
<label for="layout"><?php echo translate('Layout') ?>:</label>
<?php echo htmlSelect( 'zmMontageLayout', $layoutsById, $layout_id, array( 'onchange'=>'selectLayout(this);', 'id'=>'zmMontageLayout') ); ?>
<?php echo htmlSelect('zmMontageLayout', $layoutsById, $layout_id, array('onchange'=>'selectLayout(this);', 'id'=>'zmMontageLayout')); ?>
</span>
<input type="hidden" name="Positions"/>
<input type="button" id="EditLayout" value="<?php echo translate('EditLayout') ?>" onclick="edit_layout(this);"/>
@ -187,7 +196,10 @@ foreach ( $monitors as $monitor ) {
?>
<div id="monitorFrame<?php echo $monitor->Id() ?>" class="monitorFrame" title="<?php echo $monitor->Id() . ' ' .$monitor->Name() ?>" style="<?php echo $options['width'] ? 'width:'.$options['width'].'px;':''?>">
<div id="monitor<?php echo $monitor->Id() ?>" class="monitor idle">
<div id="imageFeed<?php echo $monitor->Id() ?>" class="imageFeed" onclick="createPopup( '?view=watch&amp;mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?> );">
<div
id="imageFeed<?php echo $monitor->Id() ?>"
class="imageFeed"
onclick="createPopup('?view=watch&amp;mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?> );">
<?php
$monitor_options = $options;
if ( $Positions ) {
@ -204,59 +216,67 @@ foreach ( $monitors as $monitor ) {
}
}
if ( $monitor->Type() == "WebSite" ) {
echo getWebSiteUrl( 'liveStream'.$monitor->Id(), $monitor->Path(), reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
if ( $monitor->Type() == 'WebSite' ) {
echo getWebSiteUrl(
'liveStream'.$monitor->Id(),
$monitor->Path(),
reScale($monitor->Width(), $scale),
reScale($monitor->Height(), $scale),
$monitor->Name()
);
} else {
echo getStreamHTML( $monitor, $monitor_options );
echo getStreamHTML($monitor, $monitor_options);
}
if ( $showZones ) {
$height = null;
$width = null;
if ( $options['width'] ) {
$width = $options['width'];
if ( ! $options['height'] ) {
if ( !$options['height'] ) {
$scale = (int)( 100 * $options['width'] / $monitor->Width() );
$height = reScale( $monitor->Height(), $scale );
$height = reScale($monitor->Height(), $scale);
}
} else if ( $options['height'] ) {
$height = $options['height'];
if ( ! $options['width'] ) {
if ( !$options['width'] ) {
$scale = (int)( 100 * $options['height'] / $monitor->Height() );
$width = reScale( $monitor->Width(), $scale );
$width = reScale($monitor->Width(), $scale);
}
} else if ( $scale ) {
$width = reScale( $monitor->Width(), $scale );
$height = reScale( $monitor->Height(), $scale );
$width = reScale($monitor->Width(), $scale);
$height = reScale($monitor->Height(), $scale);
}
$zones = array();
foreach( dbFetchAll( 'SELECT * FROM Zones WHERE MonitorId=? ORDER BY Area DESC', NULL, array($monitor->Id()) ) as $row ) {
$row['Points'] = coordsToPoints( $row['Coords'] );
foreach( dbFetchAll('SELECT * FROM Zones WHERE MonitorId=? ORDER BY Area DESC', NULL, array($monitor->Id()) ) as $row ) {
$row['Points'] = coordsToPoints($row['Coords']);
if ( $scale ) {
limitPoints( $row['Points'], 0, 0, $monitor->Width(), $monitor->Height() );
scalePoints( $row['Points'], $scale );
limitPoints($row['Points'], 0, 0, $monitor->Width(), $monitor->Height());
scalePoints($row['Points'], $scale);
} else {
limitPoints( $row['Points'], 0, 0,
limitPoints($row['Points'], 0, 0,
( $width ? $width-1 : $monitor->Width()-1 ),
( $height ? $height-1 : $monitor->Height()-1 )
);
}
$row['Coords'] = pointsToCoords( $row['Points'] );
$row['AreaCoords'] = preg_replace( '/\s+/', ',', $row['Coords'] );
$row['Coords'] = pointsToCoords($row['Points']);
$row['AreaCoords'] = preg_replace('/\s+/', ',', $row['Coords']);
$zones[] = $row;
} // end foreach Zone
?>
<svg class="zones" id="zones<?php echo $monitor->Id() ?>" style="position:absolute; top: 0; left: 0; background: none; width: <?php echo $width ?>px; height: <?php echo $height ?>px;">
<?php
foreach( array_reverse($zones) as $zone ) {
<svg class="zones" id="zones<?php echo $monitor->Id() ?>" style="position:absolute; top: 0; left: 0; background: none; width: <?php echo $width ?>px; height: <?php echo $height ?>px;">
<?php
foreach( array_reverse($zones) as $zone ) {
echo '<polygon points="'. $zone['AreaCoords'] .'" class="'. $zone['Type'].'" />';
} // end foreach zone
} // end foreach zone
?>
Sorry, your browser does not support inline SVG
</svg>
<?php } # end if showZones ?>
</svg>
<?php
} # end if showZones
?>
</div>
<?php
if ( (!ZM_WEB_COMPACT_MONTAGE) && ($monitor->Type() != 'WebSite') ) {
@ -268,7 +288,7 @@ foreach ( $monitors as $monitor ) {
</div>
</div>
<?php
}
} # end foreach monitor
?>
</div>
</div>

View File

@ -37,7 +37,6 @@ if ( ! visibleMonitor($mid) ) {
return;
}
$monitor = new Monitor($mid);
#Whether to show the controls button
@ -68,7 +67,7 @@ xhtmlHeaders( __FILE__, $monitor->Name().' - '.translate('Feed') );
<div id="monitorName"><?php echo $monitor->Name() ?></div>
<div id="menuControls">
<?php
if ( canView( 'Control' ) && $monitor->Type() == 'Local' ) {
if ( canView('Control') && $monitor->Type() == 'Local' ) {
?>
<div id="settingsControl"><?php echo makePopupLink( '?view=settings&amp;mid='.$monitor->Id(), 'zmSettings'.$monitor->Id(), 'settings', translate('Settings'), true, 'id="settingsLink"' ) ?></div>
<?php