diff options
Diffstat (limited to 'www')
| -rw-r--r-- | www/index.html | 1 | ||||
| -rw-r--r-- | www/js/DataModel.js | 12 | ||||
| -rw-r--r-- | www/js/EventCtrl.js | 19 | ||||
| -rw-r--r-- | www/js/EventsGraphsCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/MonitorCtrl.js | 19 | ||||
| -rw-r--r-- | www/js/app.js | 25 | ||||
| -rw-r--r-- | www/templates/events-modal.html | 2 | ||||
| -rw-r--r-- | www/templates/login.html | 2 | ||||
| -rw-r--r-- | www/templates/monitors-modal.html | 4 |
9 files changed, 48 insertions, 38 deletions
diff --git a/www/index.html b/www/index.html index 4946b9a4..607ec11a 100644 --- a/www/index.html +++ b/www/index.html @@ -4,6 +4,7 @@ <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> + <title></title> <link href="lib/ionic/css/ionic.css" rel="stylesheet"> diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 90830e73..b0ae8ca3 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -184,9 +184,10 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion getMonitors: function (forceReload) { console.log("** Inside ZMData getMonitors with forceReload=" + forceReload); $ionicLoading.show({ - template: 'Loading ZoneMinder Monitors...', + template: 'Loading Monitors...', animation: 'fade-in', showBackdrop: true, + duration:10000, maxWidth: 200, showDelay: 0 }); @@ -196,7 +197,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion console.log("ZMDataModel: Invoking HTTP get to load monitors"); var apiurl = loginData.apiurl; var myurl = apiurl + "/monitors.json"; - $http.get(myurl) + $http.get(myurl, {timeout:10000}) .success(function (data) { //console.log("HTTP success got " + JSON.stringify(data.monitors)); monitors = data.monitors; @@ -250,11 +251,12 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion console.log("ZMData getEvents called with ID=" + monitorId); $ionicLoading.show({ - template: 'Loading ZoneMinder Events...', + template: 'Loading Events...', animation: 'fade-in', showBackdrop: true, maxWidth: 200, - showDelay: 0 + showDelay: 0, + duration:10000, //specifically for Android - http seems to get stuck at times }); var d = $q.defer(); @@ -278,7 +280,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion return d.promise; } else { // not simulated - $http.get(myurl) + $http.get(myurl, {timeout:10000}) .success(function (data) { $ionicLoading.hide(); myevents = data.events.reverse(); diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index fadc9f65..963ef3d3 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -56,18 +56,12 @@ angular.module('zmApp.controllers').controller('zmApp.EventCtrl', function ($ion play: "2" } - $scope.initLoadingImage = function() - { - console.log ("***Loading***"); - /* $ionicLoading.show({ - template: "loading, please wait...", - noBackdrop: true, - });*/ - } + $scope.finishedLoadingImage = function() { + console.log ("*** Events image FINISHED loading ***"); $ionicLoading.hide(); // alert ("IMAGE LOADED"); } @@ -93,7 +87,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventCtrl', function ($ion $ionicLoading.show({ template: "please wait...", noBackdrop: true, - + duration: 10000, }); var loginData = ZMDataModel.getLogin(); @@ -123,13 +117,14 @@ angular.module('zmApp.controllers').controller('zmApp.EventCtrl', function ($ion break; }; - + console.log ("** POST URL " +loginData.url+ 'zm/index.php'); var req = $http({ method: 'POST', - url: loginData.url + 'zm/index.php', + timeout: 10000, + url: loginData.url + '/zm/index.php', headers: { 'Content-Type': 'application/x-www-form-urlencoded', - 'Accept': '*/*', + //'Accept': '*/*', }, transformRequest: function (obj) { var str = []; diff --git a/www/js/EventsGraphsCtrl.js b/www/js/EventsGraphsCtrl.js index 8523a5c7..5cd5e71a 100644 --- a/www/js/EventsGraphsCtrl.js +++ b/www/js/EventsGraphsCtrl.js @@ -87,7 +87,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', functio console.log("Monitor event URL:" + url); if (!ZMDataModel.isSimulated()) { - $http.get(url) + $http.get(url, {timeout:10000}) .success(function (data) { console.log("**** EVENT COUNT FOR MONITOR " + monitors[j].Monitor.Id + " IS " + data.pagination.count); diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js index def65266..4e217464 100644 --- a/www/js/MonitorCtrl.js +++ b/www/js/MonitorCtrl.js @@ -16,25 +16,26 @@ $scope.reloadView = function () $ionicLoading.show({ template: "refreshed view", noBackdrop: true, - duration: 3000 + duration: 2000 }); } -$scope.initLoadingImage = function() +$scope.isSimulated = function () { + return ZMDataModel.isSimulated(); + }; + + +$scope.finishedLoadingImage = function() { - console.log ("***Loading***"); + console.log ("***Monitor image FINISHED Loading***"); + $ionicLoading.hide(); /* $ionicLoading.show({ template: "loading, please wait...", noBackdrop: true, });*/ } - - $scope.finishedLoadingImage = function() - { - $ionicLoading.hide(); - // alert ("IMAGE LOADED"); - } + $scope.$on('$ionicView.loaded', function(){ console.log("**VIEW ** Monitor Ctrl Loaded"); diff --git a/www/js/app.js b/www/js/app.js index d4059074..be83cd23 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -6,6 +6,10 @@ angular.module('zmApp', [ ]) +// this directive will be load any time an image completes loading +// via img tags where this directive is added (I am using this in +// events and mionitor view to show a loader while the image is +// downloading from ZM .directive('imageonload', function() { return { restrict: 'A', @@ -14,11 +18,14 @@ angular.module('zmApp', [ //call the function that was passed scope.$apply(attrs.imageonload); }); - } + }, + + }; }) -.directive('img', function () { +/* + .directive('img', function () { // element[0].src = 'img/demo.gif'; return { @@ -34,14 +41,11 @@ angular.module('zmApp', [ // }); } } -}) +})*/ .run(function ($ionicPlatform, $ionicPopup, $rootScope, $state, ZMDataModel,$cordovaSplashscreen) { - // generates and error in desktops but works fine - setTimeout(function() { - $cordovaSplashscreen.hide() - }, 3000) + ZMDataModel.init(); var loginData = ZMDataModel.getLogin(); @@ -92,6 +96,13 @@ angular.module('zmApp', [ $ionicPlatform.ready(function () { + + // generates and error in desktops but works fine + console.log ("**** DEVICE READY ***"); + setTimeout(function() { + $cordovaSplashscreen.hide() + }, 3000) + var pixelRatio = window.devicePixelRatio || 1; $rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width); $rootScope.devHeight = ((window.innerHeight > 0) ? window.innerHeight : screen.height); diff --git a/www/templates/events-modal.html b/www/templates/events-modal.html index 8f43b114..08dbe651 100644 --- a/www/templates/events-modal.html +++ b/www/templates/events-modal.html @@ -24,7 +24,7 @@ <div ng-if="isSimulated()"> <ion-scroll has-bouncing=false min-zoom=1 zooming="true" direction="xy" style="width: 100%; "> - <img ng-src="img/demo.gif" width="100%"> + <img imageonload="finishedLoadingImage()" ng-src="img/demo.gif" width="100%" /> </ion-scroll> </div> diff --git a/www/templates/login.html b/www/templates/login.html index 05d28848..0e302c9e 100644 --- a/www/templates/login.html +++ b/www/templates/login.html @@ -14,7 +14,7 @@ <input type="password" placeholder="Password" ng-model="loginData.password"> </label> <label class="item item-input"> - <input autocapitalize="none" type="text" placeholder="Zoneminder base URL" ng-model="loginData.url"> + <input autocapitalize="none" type="text" placeholder="ZM base URL (please don't add /zm)" ng-model="loginData.url"> </label> <label class="item item-input"> <input autocapitalize="none" type="text" placeholder="API base URL" ng-model="loginData.apiurl"> diff --git a/www/templates/monitors-modal.html b/www/templates/monitors-modal.html index 1d5e5488..47da2917 100644 --- a/www/templates/monitors-modal.html +++ b/www/templates/monitors-modal.html @@ -16,13 +16,13 @@ <div ng-if="!isSimulated()"> <ion-scroll has-bouncing=false min-zoom=1 zooming="true" direction="xy" style="width: 100%; "> - <img imageonload="finishedLoadingImage()" ng-src="{{LoginData.url}}/cgi-bin/zms?mode=jpeg&monitor={{monitorId}}&maxfps=3&buffer=1000&user={{LoginData.username}}&pass={{LoginData.password}}&rand={{rand}}" width="100%" style="background-image:url('http://www.pbase.com/arjunrc/image/159892445/medium.jpg');" /> + <img imageonload="finishedLoadingImage()" ng-src="{{LoginData.url}}/cgi-bin/zms?mode=jpeg&monitor={{monitorId}}&maxfps=3&buffer=1000&user={{LoginData.username}}&pass={{LoginData.password}}&rand={{rand}}" width="100%" /> </ion-scroll> </div> <div ng-if="isSimulated()"> <ion-scroll has-bouncing=false min-zoom=1 zooming="true" direction="xy" style="width: 100%; "> - <img ng-src="img/demo.gif" width="100%"> + <img imageonload="finishedLoadingImage()" ng-src="img/demo.gif" width="100%" /> </ion-scroll> </div> |
