Merge branch 'release-1.34' of github.com:ZoneMinder/zoneminder into release-1.34

This commit is contained in:
Isaac Connor 2020-07-04 09:04:38 -04:00
commit 8a35ae2daf
8 changed files with 76 additions and 61 deletions

View File

@ -87,6 +87,7 @@ $SLANG = array(
'Actual' => 'Actual', 'Actual' => 'Actual',
'AddNewControl' => 'Add New Control', 'AddNewControl' => 'Add New Control',
'AddNewMonitor' => 'Add', 'AddNewMonitor' => 'Add',
'AddMonitorDisabled' => 'Your user is not allowed to add a new monitor',
'AddNewServer' => 'Add New Server', 'AddNewServer' => 'Add New Server',
'AddNewStorage' => 'Add New Storage', 'AddNewStorage' => 'Add New Storage',
'AddNewUser' => 'Add New User', 'AddNewUser' => 'Add New User',

View File

@ -178,7 +178,7 @@ getBodyTopHTML();
<div class="container-fluid"> <div class="container-fluid">
<button type="button" name="addBtn" data-on-click-this="addMonitor" <button type="button" name="addBtn" data-on-click-this="addMonitor"
<?php echo (canEdit('Monitors') && !$user['MonitorIds']) ? '' : ' disabled="disabled"' ?> <?php echo (canEdit('Monitors') && !$user['MonitorIds']) ? '' : ' disabled="disabled" title="'.translate('AddMonitorDisabled').'"' ?>
> >
<i class="material-icons md-18">add_circle</i> <i class="material-icons md-18">add_circle</i>
&nbsp;<?php echo translate('AddNewMonitor') ?> &nbsp;<?php echo translate('AddNewMonitor') ?>

View File

@ -58,32 +58,6 @@ $heights = array(
'1080px' => '1080px', '1080px' => '1080px',
); );
session_start();
if ( isset($_REQUEST['scale']) ) {
$options['scale'] = validInt($_REQUEST['scale']);
} else if ( isset($_COOKIE['zmCycleScale']) ) {
$options['scale'] = $_COOKIE['zmCycleScale'];
}
if ( !isset($options['scale']) )
$options['scale'] = 100;
if ( isset($_COOKIE['zmCycleWidth']) and $_COOKIE['zmCycleWidth'] ) {
$_SESSION['zmCycleWidth'] = $options['width'] = $_COOKIE['zmCycleWidth'];
#} elseif ( isset($_SESSION['zmCycleWidth']) and $_SESSION['zmCycleWidth'] ) {
#$options['width'] = $_SESSION['zmCycleWidth'];
} else
$options['width'] = '';
if ( isset($_COOKIE['zmCycleHeight']) and $_COOKIE['zmCycleHeight'] )
$_SESSION['zmCycleHeight'] = $options['height'] = $_COOKIE['zmCycleHeight'];
#else if ( isset($_SESSION['zmCycleHeight']) and $_SESSION['zmCycleHeight'] )
#$options['height'] = $_SESSION['zmCycleHeight'];
else
$options['height'] = '';
session_write_close();
$monIdx = 0; $monIdx = 0;
$monitors = array(); $monitors = array();
@ -113,6 +87,40 @@ if ( $monitors ) {
$monitor = $monitors[$monIdx]; $monitor = $monitors[$monIdx];
$nextMid = $monIdx==(count($monitors)-1)?$monitors[0]->Id():$monitors[$monIdx+1]->Id(); $nextMid = $monIdx==(count($monitors)-1)?$monitors[0]->Id():$monitors[$monIdx+1]->Id();
} }
if ( !$monitor ) {
ZM\Error('There was no monitor to display.');
}
session_start();
if ( isset($_REQUEST['scale']) ) {
$options['scale'] = validInt($_REQUEST['scale']);
} else if ( isset($_COOKIE['zmCycleScale']) ) {
$options['scale'] = $_COOKIE['zmCycleScale'];
} else if ( $monitor ) {
$options['scale'] = $monitor->DefaultScale();
}
if ( !isset($options['scale']) )
$options['scale'] = 100;
if ( isset($_COOKIE['zmCycleWidth']) and $_COOKIE['zmCycleWidth'] ) {
$_SESSION['zmCycleWidth'] = $options['width'] = $_COOKIE['zmCycleWidth'];
#} elseif ( isset($_SESSION['zmCycleWidth']) and $_SESSION['zmCycleWidth'] ) {
#$options['width'] = $_SESSION['zmCycleWidth'];
} else {
$options['width'] = '';
}
if ( isset($_COOKIE['zmCycleHeight']) and $_COOKIE['zmCycleHeight'] ) {
$_SESSION['zmCycleHeight'] = $options['height'] = $_COOKIE['zmCycleHeight'];
#else if ( isset($_SESSION['zmCycleHeight']) and $_SESSION['zmCycleHeight'] )
#$options['height'] = $_SESSION['zmCycleHeight'];
} else {
$options['height'] = '';
}
session_write_close();
ZM\Logger::Debug(print_r($options,true)); ZM\Logger::Debug(print_r($options,true));

View File

@ -35,7 +35,7 @@ xhtmlHeaders(__FILE__, translate('Error') );
<?php echo translate('ContactAdmin') ?> <?php echo translate('ContactAdmin') ?>
</p> </p>
<p> <p>
<a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a> <button type="button" data-on-click="closeWindow"><?php echo translate('Close') ?></button>
</p> </p>
</div> </div>
</div> </div>

View File

@ -9,24 +9,27 @@ function cyclePause() {
$('pauseBtn').disabled = true; $('pauseBtn').disabled = true;
$('playBtn').disabled = false; $('playBtn').disabled = false;
} }
function cycleStart() { function cycleStart() {
periodical_id = nextCycleView.periodical(cycleRefreshTimeout); periodical_id = nextCycleView.periodical(cycleRefreshTimeout);
$('pauseBtn').disabled = false; $('pauseBtn').disabled = false;
$('playBtn').disabled = true; $('playBtn').disabled = true;
} }
function cycleNext() { function cycleNext() {
monIdx ++; monIdx ++;
if ( monIdx >= monitorData.length ) { if ( monIdx >= monitorData.length ) {
monIdx = 0; monIdx = 0;
} }
if ( !monitorData[monIdx] ) { if ( !monitorData[monIdx] ) {
console.log("No monitorData for " + monIdx); console.log('No monitorData for ' + monIdx);
} }
window.location.replace('?view=cycle&mid='+monitorData[monIdx].id+'&mode='+mode, cycleRefreshTimeout); window.location.replace('?view=cycle&mid='+monitorData[monIdx].id+'&mode='+mode, cycleRefreshTimeout);
} }
function cyclePrev() { function cyclePrev() {
if (monIdx) { if ( monIdx ) {
monIdx -= 1; monIdx -= 1;
} else { } else {
monIdx = monitorData.length - 1; monIdx = monitorData.length - 1;
@ -71,7 +74,7 @@ function changeSize() {
streamImg.style.width = width ? width : null; streamImg.style.width = width ? width : null;
streamImg.style.height = height ? height : null; streamImg.style.height = height ? height : null;
} else { } else {
console.log("Did not find liveStream"+monitorData[monIdx].id); console.log('Did not find liveStream'+monitorData[monIdx].id);
} }
$('scale').set('value', ''); $('scale').set('value', '');
Cookie.write('zmCycleScale', '', {duration: 10*365}); Cookie.write('zmCycleScale', '', {duration: 10*365});
@ -96,7 +99,7 @@ function changeScale() {
return; return;
} }
if ( scale != '0' ) { if ( scale != '0' && scale != '' && scale != 'auto' ) {
if ( newWidth ) { if ( newWidth ) {
monitor_frame.css('width', newWidth+'px'); monitor_frame.css('width', newWidth+'px');
} }
@ -107,16 +110,21 @@ function changeScale() {
monitor_frame.css('width', '100%'); monitor_frame.css('width', '100%');
monitor_frame.css('height', 'auto'); monitor_frame.css('height', 'auto');
} }
/*Stream could be an applet so can't use moo tools*/ /*Stream could be an applet so can't use moo tools*/
var streamImg = $j('#liveStream'+monitorData[monIdx].id)[0]; var streamImg = $j('#liveStream'+monitorData[monIdx].id)[0];
if ( streamImg ) { if ( !streamImg ) {
console.log("Did not find liveStream"+monitorData[monIdx].id);
return;
}
if ( streamImg.nodeName == 'IMG' ) { if ( streamImg.nodeName == 'IMG' ) {
var src = streamImg.src; var src = streamImg.src;
streamImg.src = ''; streamImg.src = '';
//src = src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) )); //src = src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
src = src.replace(/scale=[\.\d]+/i, 'scale='+scale); src = src.replace(/scale=[\.\d]+/i, 'scale='+scale);
if ( scale != '0' ) { if ( scale != '0' && scale != '' && scale != 'auto' ) {
src = src.replace(/width=[\.\d]+/i, 'width='+newWidth); src = src.replace(/width=[\.\d]+/i, 'width='+newWidth);
src = src.replace(/height=[\.\d]+/i, 'height='+newHeight); src = src.replace(/height=[\.\d]+/i, 'height='+newHeight);
} else { } else {
@ -125,16 +133,14 @@ function changeScale() {
} }
streamImg.src = src; streamImg.src = src;
} }
if ( scale != '0' ) {
if ( scale != '0' && scale != '' && scale != 'auto' ) {
streamImg.style.width = newWidth+'px'; streamImg.style.width = newWidth+'px';
streamImg.style.height = newHeight+'px'; streamImg.style.height = newHeight+'px';
} else { } else {
streamImg.style.width = '100%'; streamImg.style.width = '100%';
streamImg.style.height = 'auto'; streamImg.style.height = 'auto';
} }
} else {
console.log("Did not find liveStream"+monitorData[monIdx].id);
}
} // end function changeScale() } // end function changeScale()
window.addEventListener('DOMContentLoaded', initCycle); window.addEventListener('DOMContentLoaded', initCycle);

View File

@ -21,7 +21,7 @@
require_once('includes/Server.php'); require_once('includes/Server.php');
require_once('includes/Storage.php'); require_once('includes/Storage.php');
if ( !canView('Monitors') ) { if ( !canEdit('Monitors', empty($_REQUEST['mid'])?0:$_REQUEST['mid']) ) {
$view = 'error'; $view = 'error';
return; return;
} }

View File

@ -18,12 +18,12 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
// //
if ( !canView('Monitors') ) { $mid = empty($_REQUEST['mid']) ? 0 : validInt($_REQUEST['mid']);
if ( !($mid and canEdit('Monitors', $mid)) ) {
$view = 'error'; $view = 'error';
return; return;
} }
$mid = validInt($_REQUEST['mid']);
$zid = (!empty($_REQUEST['zid'])) ? validInt($_REQUEST['zid']) : 0; $zid = (!empty($_REQUEST['zid'])) ? validInt($_REQUEST['zid']) : 0;
$scale = SCALE_BASE; $scale = SCALE_BASE;

View File

@ -18,12 +18,12 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
// //
if ( !canView('Monitors') ) { $mid = empty($_REQUEST['mid']) ? 0 : validInt($_REQUEST['mid']);
if ( !($mid and canEdit('Monitors', $mid)) ) {
$view = 'error'; $view = 'error';
return; return;
} }
$mid = validInt($_REQUEST['mid']);
$monitor = new ZM\Monitor($mid); $monitor = new ZM\Monitor($mid);
# ViewWidth() and ViewHeight() are already rotated # ViewWidth() and ViewHeight() are already rotated
$minX = 0; $minX = 0;