summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/ModalCtrl.js10
-rw-r--r--www/js/MontageCtrl.js61
-rw-r--r--www/js/app.js3
3 files changed, 59 insertions, 15 deletions
diff --git a/www/js/ModalCtrl.js b/www/js/ModalCtrl.js
index 1e90130c..87ec4b54 100644
--- a/www/js/ModalCtrl.js
+++ b/www/js/ModalCtrl.js
@@ -10,6 +10,7 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco
console.log("**** INSIDE MODAL CTRL, recomputing rand *****");
$scope.rand = Math.floor((Math.random() * 100000) + 1);
+ $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
//$state.go($state.current, {}, {reload: true});
// This holds the PTZ menu control
@@ -28,7 +29,8 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco
$scope.showModalRangeSider = true;
console.log ("****SHOWING SLIDER");
},2000);
-
+
+
$scope.radialMenuOptions = {
content: '',
@@ -337,6 +339,12 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco
}
};
+
+$scope.reloadView = function()
+{
+ ZMDataModel.zmLog ("Reloading view for modal view, recomputing rand");
+ $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
+};
$scope.scaleImage = function() {
console.log ("Switching image style");
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index 281ca84d..7210b52d 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -4,7 +4,7 @@
/* global cordova,StatusBar,angular,console,ionic */
-angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '$rootScope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$ionicPopup', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', 'zm', '$ionicPopover', '$controller', function ($scope, $rootScope, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $ionicPopup, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, zm,$ionicPopover,$controller) {
+angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '$rootScope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$ionicPopup', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', 'zm', '$ionicPopover', '$controller', 'imageLoadingDataShare', function ($scope, $rootScope, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $ionicPopup, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, zm,$ionicPopover,$controller, imageLoadingDataShare) {
$controller('zmApp.BaseController', { $scope: $scope });
//---------------------------------------------------------------------
@@ -171,13 +171,30 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
function loadNotifications() {
// randomval is appended to img src, so after each interval the image reloads
- $scope.randomval = (new Date()).getTime();
- $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
- // console.log ("*** Montage timer");
+ // let's make sure no image is loading
+ //if (imageLoadingDataShare.get() == 0)
+ // {
+ //$scope.randomval = (new Date()).getTime();
+
+
+ $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
+ console.log ("Montage Random....");
+
+ //}
+ //else
+ //{
+ // console.log ("Not generating rand as image is loading");
+ // }
+
+ // console.log ("*** REMOVE ME Montage timer: "+$rootScope.rand);
// console.log ("New " + $scope.randomval);
}
var intervalHandle ;
+ var isModalActive = false;
+ var modalIntervalHandle;
+
+
@@ -413,15 +430,24 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
//---------------------------------------------------------------------
$scope.openModal = function (mid, controllable, controlid) {
console.log("Open Monitor Modal with monitor Id=" + mid + " and Controllable:" + controllable + " with control ID:" + controlid);
-
+ isModalActive = true;
// Note: no need to setAwake(true) as its already awake
// in montage view
- $interval.cancel(intervalHandle);
+ ZMDataModel.zmLog("Cancelling montage timer, opening Modal");
+ // ZMDataModel.zmLog("Starting Modal timer");
+ $interval.cancel(intervalHandle);
+
+ // let's start modal timer
+ // modalIntervalHandle= $interval(function () {
+ // modalLoadNotifications();
+ // console.log ("Refreshing Image...");
+ // }.bind(this), 1000);
+
$scope.monitorId = mid;
$scope.LoginData = ZMDataModel.getLogin();
- $rootScope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111;
+ $rootScope.modalRand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111;
$scope.ptzMoveCommand = "";
// This is a modal to show the monitor footage
@@ -473,17 +499,23 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
$scope.closeModal = function () {
console.log("Close & Destroy Monitor Modal");
+ isModalActive = false;
// Note: no need to setAwake(false) as needs to be awake
// in montage view
$scope.modal.remove();
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
- console.log ("Restarting montage timer...");
-
- intervalHandle= $interval(function () {
+ ZMDataModel.zmLog("Restarting montage timer, closing Modal...");
+
+ $interval.cancel(intervalHandle);
+ intervalHandle= $interval(function () {
loadNotifications();
// console.log ("Refreshing Image...");
}.bind(this), 1000);
+
+ //$interval.cancel(modalIntervalHandle);
+
+
};
@@ -550,6 +582,8 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
console.log("*** Moving to Background ***"); // Handle the pause event
console.log("*** CANCELLING INTERVAL ****");
$interval.cancel(intervalHandle);
+ // $interval.cancel(modalIntervalHandle);
+
// FIXME: Do I need to setAwake(false) here?
}
@@ -584,7 +618,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
});
$scope.$on('$ionicView.enter', function () {
- console.log("**VIEW ** Montage Ctrl Entered");
+ console.log("**VIEW ** Montage Ctrl Entered, Starting loadNotifications");
console.log("Setting Awake to " + ZMDataModel.getKeepAwake());
ZMDataModel.setAwake(ZMDataModel.getKeepAwake());
@@ -670,8 +704,11 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
$scope.doRefresh = function () {
- console.log("***Pull to Refresh");
+ console.log("***Pull to Refresh, recomputing Rand");
+ ZMDataModel.zmLog ("Reloading view for montage view, recomputing rand");
+ $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
$scope.monitors = [];
+ imageLoadingDataShare.set(0);
var refresh = ZMDataModel.getMonitors(1);
diff --git a/www/js/app.js b/www/js/app.js
index b10536ec..89e85f59 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -124,9 +124,8 @@ angular.module('zmApp', [
});
- // show an image-missing image FIXME: never seems to get called
+ // show an image-missing image
$element.bind('error',function () {
-
loader.remove();
imageLoadingDataShare.set(0);