summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/EventCtrl.js118
-rw-r--r--www/js/EventModalCtrl.js5
-rw-r--r--www/js/LoginCtrl.js3
-rw-r--r--www/js/MontageCtrl.js15
-rw-r--r--www/js/MontageHistoryCtrl.js6
-rw-r--r--www/js/NVR.js2
-rwxr-xr-xwww/js/app.js4
7 files changed, 117 insertions, 36 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index d5ec228d..502a568d 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -32,7 +32,7 @@ angular.module('zmApp.controllers')
})
- .controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'NVR', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', '$ionicPopup', 'EventServer', '$sce', '$cordovaBadge', '$cordovaLocalNotification', '$q', 'carouselUtils', '$translate', '$cordovaFileTransfer', '$cordovaFile', '$ionicListDelegate', 'ionPullUpFooterState', 'SecuredPopups', function ($scope, $rootScope, zm, NVR, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover, $ionicPopup, EventServer, $sce, $cordovaBadge, $cordovaLocalNotification, $q, carouselUtils, $translate, $cordovaFileTransfer, $cordovaFile, $ionicListDelegate, ionPullUpFooterState,SecuredPopups) {
+ .controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'NVR', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', '$ionicPopup', 'EventServer', '$sce', '$cordovaBadge', '$cordovaLocalNotification', '$q', 'carouselUtils', '$translate', '$cordovaFileTransfer', '$cordovaFile', '$ionicListDelegate', 'ionPullUpFooterState', 'SecuredPopups', '$window', function ($scope, $rootScope, zm, NVR, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover, $ionicPopup, EventServer, $sce, $cordovaBadge, $cordovaLocalNotification, $q, carouselUtils, $translate, $cordovaFileTransfer, $cordovaFile, $ionicListDelegate, ionPullUpFooterState,SecuredPopups, $window) {
// events in last 5 minutes
// TODO https://server/zm/api/events/consoleEvents/5%20minute.json
@@ -78,7 +78,12 @@ angular.module('zmApp.controllers')
//---------------------------------------------------
-
+ $scope.$on('sizechanged', function() {
+ $timeout (function () {
+ recomputeThumbSize();
+ },10);
+
+ });
//we come here is TZ is updated after the view loads
var tzu = $scope.$on('tz-updated', function () {
@@ -95,7 +100,6 @@ angular.module('zmApp.controllers')
$scope.$on('$ionicView.afterEnter', function () {
- window.addEventListener("resize", recomputeThumbSize, false);
$ionicListDelegate.canSwipeItems(true);
// NVR.debug("enabling options swipe");
@@ -178,11 +182,24 @@ angular.module('zmApp.controllers')
$scope.$on('$ionicView.beforeLeave', function () {
+ //$window.removeEventListener('orientationchange', updateUI);
+ if ($stateParams.lastCheckTime != undefined && $stateParams.lastCheckTime != '' && moment($stateParams.lastCheckTime).isValid()) {
+ NVR.debug ("removing montage temporary filter");
+ $rootScope.isEventFilterOn = false;
+ $rootScope.fromDate = "";
+ $rootScope.fromTime = "";
+ $rootScope.toDate = "";
+ $rootScope.toTime = "";
+ $rootScope.fromString = "";
+ $rootScope.toString = "";
+ $rootScope.monitorsFilter="";
+ }
NVR.debug ("Cancelling page reload timer");
$interval.cancel(intervalReloadEvents);
- NVR.debug("EventCtrl: Deregistering resize listener");
- window.removeEventListener("resize", recomputeThumbSize, false);
+ document.removeEventListener("pause", onPause, false);
+
+
//NVR.debug("EventCtrl: Deregistering broadcast handles");
for (var i = 0; i < broadcastHandles.length; i++) {
// broadcastHandles[i]();
@@ -192,28 +209,46 @@ angular.module('zmApp.controllers')
$scope.$on('$ionicView.beforeEnter', function () {
- //console.log ("********* BEFORE ENTER");
- //
+ /*
+ It's a bleeding mess trying to get this working on
+ multiple devices and orientations with flex-box, primarily
+ because I'm not a CSS guru.
+
+ Plus, collection-repeat offers significant performance benefits
+ and this requires fixed row sizes across all rows.
+
+ The layout I am using:
+ a) If you are using large thumbs, it's a single column format
+ b) If you are using small thumbs, it's a two column format
+
+ The max size of the image is in computeThumbnailSize()
+ */
-
-
var ld = NVR.getLogin();
- if (ld.eventViewThumbsSize == 'large') {
- NVR.debug ('Switching to big thumbs style');
- $scope.thumbClass = 'large';
- $scope.rowHeightRegular = 450;
- $scope.rowHeightExpanded = $scope.rowHeightRegular + 200;
+ if (ld.eventViewThumbs != 'none') {
+ if (ld.eventViewThumbsSize == 'large') {
+ NVR.debug ('Switching to big thumbs style');
+ $scope.thumbClass = 'large';
+ $scope.rowHeightRegular = 450;
+ $scope.rowHeightExpanded = $scope.rowHeightRegular + 230;
+ } else {
+ NVR.debug ('using small thumbs style');
+ $scope.thumbClass = 'small';
+ $scope.rowHeightRegular = 250;
+ $scope.rowHeightExpanded = $scope.rowHeightRegular + 200;
+
+ }
} else {
- NVR.debug ('using small thumbs style');
- $scope.thumbClass = 'small';
- $scope.rowHeightRegular = 250;
- $scope.rowHeightExpanded = $scope.rowHeightRegular + 200;
-
+ NVR.debug ('No thumbs');
+ $scope.rowHeightRegular = 170;
+ $scope.rowHeightExpanded = $scope.rowHeightRegular + 200;
}
+
$scope.rowHeight = $scope.rowHeightRegular;
$scope.mid = '';
+
$scope.$on ("alarm", function() {
NVR.debug ("EventCtrl: new event notification, doing an immediate reload");
// do an immediate display reload and schedule timer again
@@ -248,7 +283,13 @@ angular.module('zmApp.controllers')
document.addEventListener("pause", onPause, false);
//console.log("I got STATE PARAM " + $stateParams.id);
$scope.id = parseInt($stateParams.id, 10);
- if (isNaN($scope.id)) $scope.id = 0;
+ if (isNaN($scope.id)) {
+ $scope.id = 0;
+ }
+
+ if ($scope.id)
+ $rootScope.isEventFilterOn = true;
+
$scope.showEvent = $stateParams.playEvent || false;
$scope.monitors = NVR.getMonitorsNow();
@@ -267,6 +308,8 @@ angular.module('zmApp.controllers')
//console.log("toString: " + $rootScope.toString);
}
+
+
//console.log("BEFORE ENTER >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
NVR.log("EventCtrl called with: E/MID=" + $scope.id + " playEvent = " + $scope.showEvent);
@@ -1795,12 +1838,20 @@ angular.module('zmApp.controllers')
$scope.filterTapped = function () {
//console.log("FILTER TAPPED");
- var myFrom = moment($rootScope.fromString).format("MMM/DD/YYYY " + NVR.getTimeFormat()).toString();
- var toString = moment($rootScope.toString).format("MMM/DD/YYYY " + NVR.getTimeFormat()).toString();
+ var myFrom = $translate.instant('kAll');
+ var toString = $translate.instant('kAll');
+ var monString = '';
+
+ if (moment($rootScope.fromString).isValid())
+ myFrom = moment($rootScope.fromString).format("MMM/DD/YYYY " + NVR.getTimeFormat()).toString();
+ if (moment($rootScope.toString).isValid())
+ toString = moment($rootScope.toString).format("MMM/DD/YYYY " + NVR.getTimeFormat()).toString();
+ if ($rootScope.monitorsFilter != '')
+ monString = $translate.instant('kFilterEventsSelectiveMon');
$rootScope.zmPopup = $ionicPopup.confirm({
title: $translate.instant('kFilterSettings'),
- template: $translate.instant('kFilterEventsBetween1') + ':<br/> <b>' + myFrom + "</b> " + $translate.instant('kTo') + " <b>" + toString + '</b><br/>' + $translate.instant('kFilterEventsBetween2'),
+ template: $translate.instant('kFilterEventsBetween1') + ':<br/> <b>' + myFrom + "</b> " + $translate.instant('kTo') + " <b>" + toString + '</b> '+ monString+'<br/>' + $translate.instant('kFilterEventsBetween2'),
okText: $translate.instant('kButtonOk'),
cancelText: $translate.instant('kButtonCancel'),
});
@@ -1814,8 +1865,7 @@ angular.module('zmApp.controllers')
$rootScope.toTime = "";
$rootScope.fromString = "";
$rootScope.toString = "";
- $rootScope.monitorsFilter = '';
-
+ $rootScope.monitorsFilter = "";
$scope.id = 0;
$scope.showEvent = false;
$scope.footerState = ionPullUpFooterState.MINIMIZED;
@@ -2995,30 +3045,34 @@ angular.module('zmApp.controllers')
function computeThumbnailSize(mw, mh, mo) {
+ // if ZM is going to rotate the view, lets flip our dimensions
if (mo != 0 && mo != 180) {
-
var tmp = mw;
mw = mh;
mh = tmp;
}
var ld = NVR.getLogin();
var landscape = ($rootScope.devWidth > $rootScope.devHeight) ? true:false;
-
- var maxRowHeight = $scope.rowHeight - 120;
+ var maxRowHeight;
if (ld.eventViewThumbsSize == 'large') {
+ maxRowHeight = $scope.rowHeight - 170;
if (landscape) {
- return calculateAspectRatioFit(mw, mh, 0.7* $rootScope.devWidth, maxRowHeight);
+ // go till 90% of width in large landscape, but restricted to useable row height
+ return calculateAspectRatioFit(mw, mh, 0.9* $rootScope.devWidth, maxRowHeight);
} else {
- return calculateAspectRatioFit(mw, mh, 0.4* $rootScope.devWidth, maxRowHeight);
+ // go till 80% of width in large portrait, but restricted to useable row height
+
+ return calculateAspectRatioFit(mw, mh, 0.8* $rootScope.devWidth, maxRowHeight);
}
} else { // small
-
+ maxRowHeight = $scope.rowHeight - 150;
if (landscape) {
+ // go till 50% of width in small landscape, but restricted to useable row height
return calculateAspectRatioFit(mw, mh, 0.5* $rootScope.devWidth, maxRowHeight);
-
} else {
+ // go till 30% of width in small portrait, but restricted to useable row height
return calculateAspectRatioFit(mw, mh, 0.3* $rootScope.devWidth, maxRowHeight);
}
diff --git a/www/js/EventModalCtrl.js b/www/js/EventModalCtrl.js
index e91bea99..a6dd87e8 100644
--- a/www/js/EventModalCtrl.js
+++ b/www/js/EventModalCtrl.js
@@ -1125,6 +1125,11 @@ angular.module('zmApp.controllers').controller('EventModalCtrl', ['$scope', '$ro
});
+ $scope.$on('$ionicView.beforeLeave', function () {
+ document.removeEventListener("pause", onPause, false);
+ ddocument.removeEventListener("resume", onResume, false);
+ });
+
$scope.showHideControls = function () {
if (videoPlaybarClicked) {
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index e64d7a6f..9ba5e8bc 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -328,6 +328,9 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
$scope.$on('$ionicView.beforeLeave', function () {
//console.log("**VIEW ** LoginCtrl Entered");
+ document.removeEventListener("pause", onPause, false);
+ document.removeEventListener("resume", onResume, false);
+
var newLoginData = JSON.stringify($scope.loginData);
if ($scope.loginData.serverName && newLoginData != oldLoginData) {
NVR.log("Login data changed, saving...");
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index 41b38e8c..8708970d 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -1734,7 +1734,11 @@ angular.module('zmApp.controllers')
NVR.debug("Deregistering handlers for multi-window");
window.MultiWindowPlugin.deregisterOnStop("montage-pause");
+ } else {
+ document.removeEventListener("pause", onPause, false);
+
}
+
if ($scope.modal) $scope.modal.remove();
});
@@ -2380,8 +2384,13 @@ angular.module('zmApp.controllers')
$state.go(s[0],s[1],s[2]);
});
- window.addEventListener("resize", jiggleMontage, false);
-
+ //window.addEventListener("resize", jiggleMontage, false);
+ $scope.$on('sizechanged', function() {
+ $timeout (function () {
+ jiggleMontage();
+ },10);
+
+ });
timeInMontage = new Date();
broadcastHandles = [];
@@ -2632,7 +2641,7 @@ angular.module('zmApp.controllers')
};
$scope.$on('$ionicView.beforeLeave', function () {
- window.removeEventListener("resize", jiggleMontage, false);
+ // window.removeEventListener("resize", jiggleMontage, false);
currentStreamState = streamState.STOPPED;
viewCleanup();
viewCleaned = true;
diff --git a/www/js/MontageHistoryCtrl.js b/www/js/MontageHistoryCtrl.js
index 53a27b3c..501c0f48 100644
--- a/www/js/MontageHistoryCtrl.js
+++ b/www/js/MontageHistoryCtrl.js
@@ -1116,6 +1116,12 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc
viewCleanup();
viewCleaned = true;
+ //$window.removeEventListener('orientationchange', updateUI);
+
+ document.removeEventListener("pause", onPause, false);
+ document.removeEventListener("resume", onResume, false);
+
+
// if ($scope.modal) $scope.modal.remove();
NVR.log("Cancelling event query timer");
diff --git a/www/js/NVR.js b/www/js/NVR.js
index 3eb477f2..99116eb4 100644
--- a/www/js/NVR.js
+++ b/www/js/NVR.js
@@ -228,7 +228,7 @@ angular.module('zmApp.controllers')
'currentZMGroupNames': [],
'unsupported': {},
'monitorSpecific': {},
- 'eventViewThumbs': true,
+ 'eventViewThumbs': 'snapshot',
'eventViewThumbsSize': 'small',
diff --git a/www/js/app.js b/www/js/app.js
index 8799784d..81977def 100755
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1480,6 +1480,10 @@ angular.module('zmApp', [
$rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width);
$rootScope.devHeight = ((window.innerHeight > 0) ? window.innerHeight : screen.height);
$rootScope.videoHeight = $rootScope.devHeight - 20;
+ $rootScope.devWidthIgnorePix = $rootScope.devWidth;
+
+ $rootScope.devWidth *= pixelRatio;
+ $rootScope.devHeight *= pixelRatio;
NVR.debug("resize/orient: " + $rootScope.devWidth + "(w) * " + $rootScope.devHeight+"(h)");