From ccdf366ca55d299fc9941c583c0a2e5bf1d4203c Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sat, 7 Jan 2017 20:30:55 -0500 Subject: you can now cycle in montage view between saved profiles. Still needs testing, but I never really test thoroughly. Where is the fun in that? #419 --- www/js/DataModel.js | 29 ++++++++- www/js/MontageCtrl.js | 166 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 179 insertions(+), 16 deletions(-) (limited to 'www/js') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 02c719ed..6c9b806c 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -121,6 +121,7 @@ angular.module('zmApp.controllers') 'enableBlog': true, 'use24hr': false, 'packeryPositions': '', + 'currentMontageProfile': '', 'packeryPositionsArray': {}, 'EHpackeryPositions': '', 'packerySizes': '', @@ -133,6 +134,8 @@ angular.module('zmApp.controllers') 'vibrateOnPush': true, 'soundOnPush': true, 'cycleMonitors': false, + 'cycleMontage': false, + 'cycleMontageInterval': 10, // 10sec 'cycleMonitorsInterval': 10, // 10sec 'enableLowBandwidth': false, 'autoSwitchBandwidth': false, @@ -262,8 +265,11 @@ angular.module('zmApp.controllers') var positionsStr = loginData.packeryPositions; //console.log ("positionStr="+positionsStr); var positions = {}; - if (loginData.packeryPositions != '') + if (loginData.packeryPositions != '' && loginData.packeryPositions != undefined) { + console.log ("positions="+loginData.packeryPositions); + + positions = JSON.parse(positionsStr); for (var m = 0; m < monitors.length; m++) { @@ -861,6 +867,20 @@ angular.module('zmApp.controllers') } + if (typeof loginData.cycleMontage == 'undefined') + { + + loginData.cycleMontage = false; + + } + + if (typeof loginData.cycleMontageInterval == 'undefined') + { + + loginData.cycleMontageInterval = 10; + + } + if (typeof loginData.enableLowBandwidth == 'undefined') { @@ -908,6 +928,13 @@ angular.module('zmApp.controllers') } + if (typeof loginData.currentMontageProfile == 'undefined') + { + + loginData.currentMontageProfile = ''; + + } + if (typeof loginData.followTimeLine == 'undefined') { diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 8a8209df..acbaf475 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -13,6 +13,7 @@ angular.module('zmApp.controllers') var intervalHandleMontage; // image re-load handler var intervalHandleAlarmStatus; // status of each alarm state + var intervalHandleMontageCycle; var gridcontainer; var pckry, draggie; @@ -45,12 +46,21 @@ angular.module('zmApp.controllers') NVRDataModel.displayBanner('net', [ds]); var ld = NVRDataModel.getLogin(); refreshSec = (NVRDataModel.getBandwidth() == 'lowbw') ? ld.refreshSecLowBW : ld.refreshSec; + $interval.cancel(intervalHandleMontage); + $interval.cancel(intervalHandleMontageCycle); + + intervalHandleMontage = $interval(function() { loadNotifications(); }.bind(this), refreshSec * 1000); + intervalHandleMontageCycle = $interval(function() + { + cycleMontageProfiles(); + }.bind(this), NVRDataModel.getLogin().cycleMontageInterval* 1000); + if (NVRDataModel.getBandwidth() == 'lowbw') { NVRDataModel.debug("Enabling low bandwidth parameters"); @@ -126,7 +136,7 @@ angular.module('zmApp.controllers') var positionsStr = ld.packeryPositions; var positions = {}; - if (positionsStr == '') + if (positionsStr == '' || positionsStr == undefined) { NVRDataModel.log("Did NOT find a packery layout"); layouttype = true; @@ -338,6 +348,60 @@ angular.module('zmApp.controllers') return attr; }; + + function findNext (key,obj) + { + var size = Object.keys(obj).length; + var i; + for (i=0; i