Enforce and document logic of cycle variables. Set cycle var when start/stopping

pull/3482/head
Isaac Connor 2022-05-10 09:24:42 -04:00
parent d8aef93eb4
commit 87c7cae8c0
2 changed files with 14 additions and 1 deletions

View File

@ -881,6 +881,7 @@ function nextCycleView() {
function cyclePause() {
clearInterval(intervalId);
cycle = false;
$j('#cyclePauseBtn').hide();
$j('#cyclePlayBtn').show();
}
@ -888,6 +889,7 @@ function cyclePause() {
function cycleStart() {
secondsToCycle = $j('#cyclePeriod').val();
intervalId = setInterval(nextCycleView, 1000);
cycle = true;
$j('#cyclePauseBtn').show();
$j('#cyclePlayBtn').hide();
}

View File

@ -81,10 +81,21 @@ if (!visibleMonitor($mid)) {
$monitor = new ZM\Monitor($mid);
$nextMid = ($monitor_index == count($monitors)-1) ? $monitors[0]->Id() : $monitors[$monitor_index+1]->Id();
$cycle = isset($_REQUEST['cycle']) and ($_REQUEST['cycle'] == 'true');
# cycle is wether to do the countdown/move to next monitor bit.
# showCycle is whether to show the cycle controls.
# If cycle is true, then showcycle should also be true.
# If showcycle is false, then cycle should be false
# But showcycle can be true, and cycle false.
$cycle = false;
$showCycle = false;
if (isset($_REQUEST['cycle']) and ($_REQUEST['cycle'] == 'true')) {
$cycle = true;
}
$showCycle = $cycle;
if (isset($_COOKIE['zmCycleShow'])) {
$showCycle = $_COOKIE['zmCycleShow'] == 'true';
if (!$showCycle) $cycle = false;
}
#Whether to show the controls button
$showPtzControls = ( ZM_OPT_CONTROL && $monitor->Controllable() && canView('Control') && $monitor->Type() != 'WebSite' );