From 6596c621b18e96ceeb74a88abeaed3e3a5f34ca9 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 10 Aug 2016 12:18:17 -0400 Subject: #301 - frame navigation through modal now possible in events view. Analyze is TBD Former-commit-id: 1711dca44ad0280b53bee52e4e2c4b78748e3961 --- www/js/EventCtrl.js | 133 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 124 insertions(+), 9 deletions(-) (limited to 'www/js/EventCtrl.js') diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 63bd0f96..1cb05bf5 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -342,25 +342,140 @@ angular.module('zmApp.controllers') // Tapping on a frame shows this image //------------------------------------------------------ - $scope.showImage = function (p,r,f, fid,e, imode, id) + $scope.showImage = function (p,r,f, fid,e, imode, id, parray, ndx) { var img; - console.log ("Image Mode " + imode); - if (imode=='path') - img = ""; + + $scope.kFrame = $translate.instant ('kFrame'); + $scope.kEvent = $translate.instant ('kEvent'); + $scope.ndx = ndx; + $scope.parray = parray; + $scope.imode = imode; + + // console.log ("Image Mode " + imode); + // console.log ("parray : " + JSON.stringify(parray)); + // console.log ("index: " + ndx); + if ($scope.imode=='path') + + $scope.imgsrc = p+"/index.php?view=image&path="+r+$scope.parray[$scope.ndx].fname; else { - img = ""; - // console.log ("IS MULTISERVER SO IMAGE IS " + img); + $scope.imgsrc = p+"/index.php?view=image&fid="+$scope.parray[$scope.ndx].id; + } + + + + + //$rootScope.zmPopup = $ionicPopup.alert({title: kFrame+':'+fid+'/'+kEvent+':'+e,template:img, cssClass:'popup80'}); + + $rootScope.zmPopup = $ionicPopup.show({ + template: '
{{parray[ndx].frameid}}/{{prettifyTimeSec(parray[ndx].time)}}

', + title: 'details', + subTitle: 'use left and right arrows to change', + scope: $scope, + cssClass: 'popup80', + buttons: [ + { + // left 1 + text: '', + type: 'button-small button-energized ion-chevron-left', + onTap: function (e) { + // look for next frame that matches the type of frame + // we are showing (all or diff timestamps); + + // console.log ("TYPE OF FRAMES: " + $scope.typeOfFrames); + var nndx = null; + var alltype = $translate.instant('kShowAllFrames'); + for (var i=$scope.ndx-1; i>=0; i--) + { + if ($scope.parray[i].type == $scope.typeOfFrames|| $scope.typeOfFrames == alltype) + { + nndx = i; + break; + } + } + if (nndx == null) nndx = $scope.ndx; + $scope.ndx = nndx; + + if ($scope.imode=='path') + { + + $scope.imgsrc = p+"/index.php?view=image&path="+r+$scope.parray[$scope.ndx].fname; + } + else + { + $scope.imgsrc = p+"/index.php?view=image&fid="+$scope.parray[$scope.ndx].id; + } + + + + e.preventDefault(); + + + } + }, + { + // right 1 + text: '', + type: 'button-small button-energized ion-chevron-right', + onTap: function (e) { + + // look for next frame that matches the type of frame + // we are showing (all or diff timestamps); + + // console.log ("TYPE OF FRAMES: " + $scope.typeOfFrames); + var nndx = null; + var alltype = $translate.instant('kShowAllFrames'); + for (var i=$scope.ndx+1; i<$scope.parray.length; i++) + { + //console.log ("Comparing: " +$scope.parray[i].type +" to " + $scope.typeOfFrames); + if ($scope.parray[i].type == $scope.typeOfFrames || $scope.typeOfFrames == alltype) + { + nndx = i; + break; + } + } + if (nndx == null) nndx = $scope.ndx; + $scope.ndx = nndx; + + if ($scope.imode=='path') + { + + $scope.imgsrc = p+"/index.php?view=image&path="+r+$scope.parray[$scope.ndx].fname; + } + else + { + $scope.imgsrc = p+"/index.php?view=image&fid="+$scope.parray[$scope.ndx].id; + } + + e.preventDefault(); + + + } + }, + + + + { + text: '', + type: 'button-positive button-small ion-checkmark-round', + onTap: function (e) { + + + } + }] + }); + - var kFrame = $translate.instant ('kFrame'); - var kEvent = $translate.instant ('kEvent'); - $rootScope.zmPopup = $ionicPopup.alert({title: kFrame+':'+fid+'/'+kEvent+':'+e,template:img, cssClass:'popup80'}); }; + + + + $scope.toggleTypeOfAlarms = function() -- cgit v1.2.3