From 0c1a83887147350dfce9c233bc12b6f72eee449a Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 6 May 2020 16:04:20 -0400 Subject: #939 Groups support in montage screen view new API --- www/js/MontageCtrl.js | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 1 deletion(-) (limited to 'www/js/MontageCtrl.js') diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 90cfac1c..8663918b 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -257,7 +257,7 @@ angular.module('zmApp.controllers') NVR.debug ("error parsing profile"); } - NVR.log("found a packery layout"); + // NVR.log("found a packery layout:"+positionsStr); layouttype = false; } @@ -800,6 +800,10 @@ angular.module('zmApp.controllers') $scope.saveReorder = function () { NVR.debug("Saving monitor hide/unhide"); + $scope.currentZMGroupName=''; + var ld = NVR.getLogin(); + ld.currentZMGroupName = ''; + NVR.setLogin(ld); $scope.modal.remove(); $scope.MontageMonitors = $scope.copyMontage; // call finish reorder after modal is gone @@ -958,6 +962,89 @@ angular.module('zmApp.controllers') } + }; + + $scope.selectZMGroup = function() { + + $scope.newGroup = { + val: "" + }; + + + + + $scope.tempZMGroups = angular.copy($scope.zmGroups); + $scope.tempZMGroups.push($translate.instant('kNone')); + + $rootScope.zmPopup = $ionicPopup.show({ + scope: $scope, + template: ' {{item}} ', + + title: $translate.instant('kSelect'), + subTitle: $translate.instant('kActive') + ': '+ NVR.getLogin().currentZMGroupName, + + buttons: [{ + text: $translate.instant('kButtonCancel'), + onTap: function (e) { + + } + + }, + { + text: $translate.instant('kButtonOk'), + onTap: function (e) { + NVR.log("Group selected:" + $scope.newGroup.val); + var ld = NVR.getLogin(); + if ($scope.newGroup.val == $translate.instant('kNone')) $scope.newGroup.val=''; + + if ($scope.newGroup.val != ld.currentZMGroupName) { + + ld.currentZMGroupName = $scope.newGroup.val; + NVR.setLogin(ld); + $scope.currentZMGroupName = ld.currentZMGroupName; + + if (simulStreaming) currentStreamState = streamState.STOPPED; + + for (var i = 0; i < $scope.MontageMonitors.length; i++) { + if ($scope.MontageMonitors[i].Monitor.listDisplay == 'show' && simulStreaming) NVR.killLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL); + + console.log ('Working on '+$scope.MontageMonitors[i].Monitor.Name+" with ZMG "+ld.currentZMGroupName ); + var isInGroup = !ld.currentZMGroupName ? true: false; + if (ld.currentZMGroupName) { + for (var k=0; k < $scope.MontageMonitors[i].Monitor.Group.length; k++) { + if ($scope.MontageMonitors[i].Monitor.Group[k].name==ld.currentZMGroupName) { + isInGroup = true; + break; + + } + } + } + + $scope.MontageMonitors[i].Monitor.listDisplay = isInGroup? 'show':'noshow'; + // console.log ('----> Setting '+ $scope.MontageMonitors[i].Monitor.Name+' to '+ $scope.MontageMonitors[i].Monitor.listDisplay); + + + } + + $timeout ( function () { + beforeReorderPositions = pckry.getShiftPositions('data-item-id'); + finishReorder(); + $timeout(function () { + pckry.layout(); + },600); + },300); + + } else { + NVR.debug ("No action taken as selection is same as current"); + } + + } + } + ] + }); + + + }; $scope.selectUnselectAllToggleReorder = function () { @@ -2242,6 +2329,10 @@ angular.module('zmApp.controllers') $scope.eventModalOpen = false; + + $scope.zmGroups = NVR.listOfZMGroups(); + $scope.currentZMGroupName = NVR.getLogin().currentZMGroupName; + $scope.$on ( "process-push", function () { NVR.debug (">> MontageCtrl: push handler"); var s = NVR.evaluateTappedNotification(); -- cgit v1.2.3