diff options
Diffstat (limited to 'www')
| -rw-r--r-- | www/js/MonitorCtrl.js | 76 | ||||
| -rw-r--r-- | www/js/app.js | 32 | ||||
| -rw-r--r-- | www/templates/help.html | 4 | ||||
| -rw-r--r-- | www/templates/monitors-modal.html | 5 | ||||
| -rw-r--r-- | www/templates/monitors.html | 2 |
5 files changed, 83 insertions, 36 deletions
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js index aec49697..8b60c1a4 100644 --- a/www/js/MonitorCtrl.js +++ b/www/js/MonitorCtrl.js @@ -5,11 +5,13 @@ // controller for Monitor View // refer to comments in EventCtrl for the modal stuff. They are almost the same -angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$scope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$ionicLoading', '$ionicModal', '$state',function ($scope, ZMDataModel, message, $ionicSideMenuDelegate, $ionicLoading, $ionicModal, $state) { +angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopup', '$scope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$ionicLoading', '$ionicModal', '$state', '$http', function ($ionicPopup,$scope, ZMDataModel, message, $ionicSideMenuDelegate, $ionicLoading, $ionicModal, $state, $http, $rootScope) { $scope.monitors = []; + + $scope.openMenu = function () { $ionicSideMenuDelegate.toggleLeft(); }; @@ -24,6 +26,16 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$scope', ' }); }; + $scope.notSupported = function() + { + + $ionicPopup.alert({ + title: 'In a Galaxy Far Far Away...', + template: 'This feature will be supported sometime in the future.' + }); + }; + + $scope.isSimulated = function () { return ZMDataModel.isSimulated(); }; @@ -46,6 +58,7 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$scope', ' $scope.$on('$ionicView.enter', function () { console.log("**VIEW ** Monitor Ctrl Entered"); + }); $scope.$on('$ionicView.leave', function () { @@ -59,37 +72,38 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$scope', ' $scope.openModal = function (mid) { console.log("Open Monitor Modal"); - $scope.monitorId = mid; - $scope.LoginData = ZMDataModel.getLogin(); - $scope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111; - - // This is a modal to show the monitor footage - $ionicModal.fromTemplateUrl('templates/monitors-modal.html', { - scope: $scope, - animation: 'slide-in-up' - }) - .then(function (modal) { - $scope.modal = modal; - - $ionicLoading.show({ - template: "please wait...", - noBackdrop: true, - duration: 15000 - }); - $scope.modal.show(); + $scope.monitorId = mid; + $scope.LoginData = ZMDataModel.getLogin(); + $scope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111; + + // This is a modal to show the monitor footage + $ionicModal.fromTemplateUrl('templates/monitors-modal.html', { + scope: $scope, + animation: 'slide-in-up' + }) + .then(function (modal) { + $scope.modal = modal; + + $ionicLoading.show({ + template: "please wait...", + noBackdrop: true, + duration: 15000 }); + $scope.modal.show(); + }); }; + $scope.closeModal = function () { - console.log("Close & Destroy Monitor Modal"); - $scope.modal.remove(); + console.log("Close & Destroy Monitor Modal"); + $scope.modal.remove(); }; //Cleanup the modal when we're done with it! $scope.$on('$destroy', function () { - console.log("Destroy Monitor Modal"); - $scope.modal.remove(); - }); + console.log("Destroy Monitor Modal"); + $scope.modal.remove(); +}); @@ -98,14 +112,14 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$scope', ' $scope.monitors = message; $scope.doRefresh = function () { - console.log("***Pull to Refresh"); - $scope.monitors = []; + console.log("***Pull to Refresh"); + $scope.monitors = []; - var refresh = ZMDataModel.getMonitors(1); - refresh.then(function (data) { - $scope.monitors = data; - $scope.$broadcast('scroll.refreshComplete'); - }); + var refresh = ZMDataModel.getMonitors(1); + refresh.then(function (data) { + $scope.monitors = data; + $scope.$broadcast('scroll.refreshComplete'); + }); }; diff --git a/www/js/app.js b/www/js/app.js index e1c724b5..2769e73d 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -17,6 +17,7 @@ angular.module('zmApp', [ // 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', @@ -46,9 +47,38 @@ angular.module('zmApp', [ //console.log("*** HTTP INTERCEPTOR CALLED ***"); return config; } + + }; }) +/* For future use - does not work with img src intercepts +.factory ('httpAuthIntercept', function ($rootScope, $q) +{ + return { + requestError: function (response) { + console.log ("**** REJECT REQUEST: "+JSON.stringify(response)); + return $q.reject(response); + }, + + responseError: function (response) { + console.log ("**** REJECT RESPONSE: "+JSON.stringify(response)); + return $q.reject(response); + }, + response: function (response) + { + console.log("*******RESPONSE with status: "+response.status+"****************"); + if (response.status == 500) + { + console.log ("**** RESPONSE: "+JSON.stringify(response)); + } + return (response); + } + }; +}) +*/ + + .run(function ($ionicPlatform, $ionicPopup, $rootScope, $state, ZMDataModel, $cordovaSplashscreen) { ZMDataModel.init(); @@ -145,6 +175,8 @@ angular.module('zmApp', [ .config(function ($stateProvider, $urlRouterProvider, $httpProvider) { $httpProvider.interceptors.push('timeoutHttpIntercept'); + //$httpProvider.interceptors.push('httpAuthIntercept'); + $stateProvider .state('login', { diff --git a/www/templates/help.html b/www/templates/help.html index c947bfdf..c2c43947 100644 --- a/www/templates/help.html +++ b/www/templates/help.html @@ -56,12 +56,12 @@ <ion-item class="item-text-wrap"> <h2><b>I want to contribute!</b></h2> - Awesome. <a href="#" onclick="window.open('http://github.com/arjunroychowdhury/zmNinja', '_blank', 'location=yes'); return false;"> Grab</a> the source code! + Awesome. <a href="#" onclick="window.open('http://github.com/pliablepixels/zmNinja', '_blank', 'location=yes'); return false;"> Grab</a> the source code! </ion-item> <ion-item class="item-text-wrap"> <h2><b>How do I contact the author?</b></h2> - Send me an <a href="#" onclick="window.open('mailto:arjunrc@gmail.com', '_blank', 'location=yes'); return false;">email</a> + Send me an <a href="#" onclick="window.open('mailto:pliablepixels@gmail.com', '_blank', 'location=yes'); return false;">email</a> </ion-item> </div> diff --git a/www/templates/monitors-modal.html b/www/templates/monitors-modal.html index c974ec25..b410331a 100644 --- a/www/templates/monitors-modal.html +++ b/www/templates/monitors-modal.html @@ -12,11 +12,12 @@ </ion-header-bar> --> <ion-content> - <!-- replay can also be gapless --> + <!-- replay can also be gapless imageonload="finishedLoadingImage()"--> <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%" /> + + <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> diff --git a/www/templates/monitors.html b/www/templates/monitors.html index db7abea6..6ceef11f 100644 --- a/www/templates/monitors.html +++ b/www/templates/monitors.html @@ -40,7 +40,7 @@ </p> <div style="float:right;"> - <a class="button button-small icon icon-left icon ion-gear-a" href="#/app/events">Configuration</a> + <a class="button button-small icon icon-left icon ion-gear-a" href="" ng-click="notSupported();">Configuration</a> <a class="button button-small icon icon-left ion-calendar" href="#/events/{{monitor.Monitor.Id}}">Events</a> <a class="button button-small icon icon-left ion-ios-eye" ng-click="openModal(monitor.Monitor.Id)" >Live View</a> </div> |
