diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-13 15:45:33 -0500 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-13 15:45:33 -0500 |
| commit | 07a0c77c39c2813748c276750083fed9ad9c0bb8 (patch) | |
| tree | 54c745858628e626e0466256f67f62844f463a05 /www | |
| parent | 6e91a956d4d069f15385663ca5e21dc6d391fc88 (diff) | |
#82 - added code to make it work with push mode - requires upgrade to event server
Former-commit-id: 5a3ffdcbe3c43dae25185604e7f47e7899d8f73a
Diffstat (limited to 'www')
| -rw-r--r-- | www/js/EventServer.js | 77 | ||||
| -rw-r--r-- | www/js/app.js | 2 | ||||
| -rw-r--r-- | www/templates/montage.html | 50 |
3 files changed, 58 insertions, 71 deletions
diff --git a/www/js/EventServer.js b/www/js/EventServer.js index a9b44a8f..ff2f9026 100644 --- a/www/js/EventServer.js +++ b/www/js/EventServer.js @@ -168,21 +168,28 @@ angular.module('zmApp.controllers') if (str.status == 'Success' && str.event == 'alarm') // new events { - - new Audio('sounds/blop.mp3').play(); - var localNotText = "Latest Alarms: "; - $rootScope.isAlarm = 1; + var localNotText; + // ZMN specific hack for Event Server + if (str.supplementary != 'true') + { + new Audio('sounds/blop.mp3').play(); + localNotText = "Latest Alarms: "; + $rootScope.isAlarm = 1; + + // Show upto a max of 99 when it comes to display + // so aesthetics are maintained + if ($rootScope.alarmCount == "99") { + $rootScope.alarmCount = "99+"; + } + if ($rootScope.alarmCount != "99+") { + $rootScope.alarmCount = (parseInt($rootScope.alarmCount) + 1).toString(); + } - // Show upto a max of 99 when it comes to display - // so aesthetics are maintained - if ($rootScope.alarmCount == "99") { - $rootScope.alarmCount = "99+"; } - if ($rootScope.alarmCount != "99+") { - $rootScope.alarmCount = (parseInt($rootScope.alarmCount) + 1).toString(); + else + { + ZMDataModel.zmDebug("received supplementary event information over websockets"); } - - var eventsToDisplay = []; var listOfMonitors=[]; for (var iter = 0; iter < str.events.length; iter++) { @@ -200,40 +207,26 @@ angular.module('zmApp.controllers') //emit alarm details - this is when received over websockets $rootScope.$emit('alarm',{message:listOfMonitors}); - ZMDataModel.zmDebug("App is in foreground, displaying banner"); - if (eventsToDisplay.length > 0) { - - if (eventsToDisplay.length == 1) { - console.log("Single Display: " + eventsToDisplay[0]); - ZMDataModel.displayBanner('alarm', [eventsToDisplay[0]], 5000, 5000); - } else { - ZMDataModel.displayBanner('alarm', eventsToDisplay, 5000, 5000 * eventsToDisplay.length); - } + + if (str.supplementary != 'true') + { + + ZMDataModel.zmDebug("App is in foreground, displaying banner"); + if (eventsToDisplay.length > 0) { + + if (eventsToDisplay.length == 1) { + console.log("Single Display: " + eventsToDisplay[0]); + ZMDataModel.displayBanner('alarm', [eventsToDisplay[0]], 5000, 5000); + } else { + ZMDataModel.displayBanner('alarm', eventsToDisplay, + 5000, 5000 * eventsToDisplay.length); + } + } } } - /* if (!$ionicPlatform.is('ios') ) - { - // this is only used for local notifications which is not - // used for iOS - // lets set badge of app irrespective of background or foreground - $cordovaBadge.hasPermission().then(function (yes) { - - $cordovaBadge.set($rootScope.alarmCount).then(function () { - // You have permission, badge set. - ZMDataModel.zmDebug("Setting badge to " + $rootScope.alarmCount); - }, function (err) { - // You do not have permission. - ZMDataModel.zmDebug("Error Setting badge to " + $rootScope.alarmCount); - }); - - - // You have permission - }, function (no) { - ZMDataModel.zmDebug("zmNinja does not have badge permissions. Please check your phone notification settings"); - }); - }*/ + } //end of success handler diff --git a/www/js/app.js b/www/js/app.js index 8cb5e869..b51578a0 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -33,7 +33,7 @@ angular.module('zmApp', [ .constant('zm', { minAppVersion: '1.28.107', // if ZM is less than this, the app won't work - minEventServerVersion: '0.4', + minEventServerVersion: '0.5', alarmFlashTimer:20000, // time to flash alarm gcmSenderId:'710936220256', httpTimeout: 15000, diff --git a/www/templates/montage.html b/www/templates/montage.html index 87838e76..8039820a 100644 --- a/www/templates/montage.html +++ b/www/templates/montage.html @@ -22,7 +22,6 @@ </ion-refresher> - <!--{{stateofSlide}} Status--> <span ng-show="!minimal"> <div class="range range-positive"> <i style="color:#bbbbbb" class="icon ion-arrow-shrink"></i> @@ -36,42 +35,37 @@ <div class="wrapper"> <span ng-repeat="monitor in MontageMonitors|limitTo: monLimit" ng-if="monitor.Monitor.Function!='None' && monitor.Monitor.listDisplay!='noshow'"> - <span ng-show="!minimal"> - <div ng-if="monitor.Monitor.isAlarmed=='true'"> - <header class="alarmed-header animated infinite flash"> <i class="ion-monitor"></i> - {{monitor.Monitor.Name}} - </header> - </div> + + <div ng-class="monitor.Monitor.isAlarmed=='true'? 'animated infinite flash':''"> - <div ng-if="monitor.Monitor.isAlarmed!='true'"> - <header class="header"> <i class="ion-monitor"></i> - {{monitor.Monitor.Name}} + <span ng-show="!minimal"> + <header ng-class="monitor.Monitor.isAlarmed=='true'?'alarmed-header':'header'"> <i class="ion-monitor"></i> + {{monitor.Monitor.Name}} </header> - </div> - </span> - <article class="main"> + </span> + + <article class="main"> + + <!-- back to ng-src. spinner was not updating when rand changes--> + <!-- moving to single so I can rely on rand for reloads --> - <!-- back to ng-src. spinner was not updating when rand changes--> - <!-- moving to single so I can rely on rand for reloads --> + <div ng-if="!isModalActive"> + <div ng-if="$root.authSession!='undefined'"> + <img id="img-$index" image-spinner-src="{{LoginData.streamingurl}}/cgi-bin/nph-zms?mode=single&monitor={{monitor.Monitor.Id}}&scale={{LoginData.montageQuality}}{{$root.authSession}}&rand={{$root.rand}}" width="{{((devWidth)/(7-monitorSize[$index]))}}px;" ng-click="openModal(monitor.Monitor.Id, monitor.Monitor.Controllable, monitor.Monitor.ControlId)" style="display:block;" image-spinner-loader="lines" /> - <div ng-if="!isModalActive"> - <div ng-if="$root.authSession!='undefined'"> - <img ng-class="monitor.Monitor.isAlarmed=='true'? 'animated infinite flash':''" id="img-$index" image-spinner-src="{{LoginData.streamingurl}}/cgi-bin/nph-zms?mode=single&monitor={{monitor.Monitor.Id}}&scale={{LoginData.montageQuality}}{{$root.authSession}}&rand={{$root.rand}}" width="{{((devWidth)/(7-monitorSize[$index]))}}px;" ng-click="openModal(monitor.Monitor.Id, monitor.Monitor.Controllable, monitor.Monitor.ControlId)" style="display:block;" image-spinner-loader="lines" /> + </div> + + <div ng-if="!$root.authSession=='undefined'"> + <img id="img-$index" ng-src="img/pausevideo.png" style="display:block;" width="{{((devWidth)/(7-monitorSize[$index]))}}px;" /> + </div> </div> - - <div ng-if="!$root.authSession=='undefined'"> + <div ng-if="isModalActive"> <img id="img-$index" ng-src="img/pausevideo.png" style="display:block;" width="{{((devWidth)/(7-monitorSize[$index]))}}px;" /> </div> - - </div> - <div ng-if="isModalActive"> - <img id="img-$index" ng-src="img/pausevideo.png" style="display:block;" width="{{((devWidth)/(7-monitorSize[$index]))}}px;" /> - </div> - - - </article> + </article> + </div> <!-- alarm flash --> </span> <!-- ngrepeat --> </div> <!--wrapper--> |
