From cadf88096c24256d90db2b2c1567518187fcb125 Mon Sep 17 00:00:00 2001 From: pliablepixels Date: Mon, 16 May 2016 10:01:15 -0400 Subject: various updates to lazy to document why Former-commit-id: 21224eb61a2b5e060b38cca3bfd5e0ccb85f95d7 --- config.xml | 2 +- www/css/style.css | 2 +- www/js/DataModel.js | 14 +++-- www/js/LogCtrl.js | 12 +++-- www/js/LoginCtrl.js | 2 +- www/js/MonitorModalCtrl.js | 2 +- www/js/MontageCtrl.js | 92 ++++++++++++++++++------------- www/js/TimelineModalCtrl.js | 2 +- www/js/WizardCtrl.js | 10 ++-- www/js/app.js | 6 ++- www/templates/devoptions.html | 102 ++++++++++++++++------------------- www/templates/events.html | 12 ++--- www/templates/important_message.html | 2 +- www/templates/lowversion.html | 14 ++--- www/templates/montage-history.html | 2 +- www/templates/montage.html | 14 +++-- www/templates/timeline-modal.html | 4 +- 17 files changed, 160 insertions(+), 134 deletions(-) diff --git a/config.xml b/config.xml index 029eb36f..c25e5498 100644 --- a/config.xml +++ b/config.xml @@ -80,4 +80,4 @@ - + \ No newline at end of file diff --git a/www/css/style.css b/www/css/style.css index 0366ed84..19d08643 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -891,7 +891,7 @@ body { font-family: sans-serif; } .zmPullup { - background-color:#EB9532; + background-color:#E3BE1C; } #flyoutmenu { diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 4ce8bfbc..7d446bdc 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -50,6 +50,7 @@ angular.module('zmApp.controllers') 'eventServerMonitors':'', // list of monitors to notify from ES 'eventServerInterval':'', // list of intervals for all monitors 'refreshSec':'2', // timer value for frame change in sec + 'enableLogs':true, 'enableDebug':false, // if enabled with log messages with "debug" 'usePin':false, 'pinCode':'', @@ -116,7 +117,8 @@ angular.module('zmApp.controllers') //-------------------------------------------------------------------------- function zmLog(val,logtype) { - $fileLogger.log(logtype, val); + if (loginData.enableLogs) + $fileLogger.log(logtype, val); } @@ -134,7 +136,7 @@ angular.module('zmApp.controllers') // separate out a debug so we don't do this if comparison for normal logs function zmDebug(val) { - if (loginData.enableDebug) + if (loginData.enableDebug && loginData.enableLogs) $fileLogger.debug(val); } @@ -425,12 +427,18 @@ angular.module('zmApp.controllers') loginData.packMontage = false; } - if (typeof loginData.forceNetworkStop == 'undefined') + if (typeof loginData.forceNetworkStop == 'undefined') { zmDebug ("forceNetwork does not exist. Setting to false"); loginData.forceNetworkStop = false; } + if (typeof loginData.enableLogs == 'undefined') + { + zmDebug ("enableLogs does not exist. Setting to true"); + loginData.enableLogs = true; + } + if (typeof loginData.defaultPushSound == 'undefined') diff --git a/www/js/LogCtrl.js b/www/js/LogCtrl.js index e9684ff8..2fde7129 100644 --- a/www/js/LogCtrl.js +++ b/www/js/LogCtrl.js @@ -2,7 +2,7 @@ /* jslint browser: true*/ /* global saveAs, cordova,StatusBar,angular,console,moment */ -angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$rootScope','zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$fileLogger', '$cordovaEmailComposer', '$ionicPopup', '$timeout', '$ionicHistory', '$state', '$interval', function ($scope, $rootScope,zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $fileLogger, $cordovaEmailComposer, $ionicPopup, $timeout, $ionicHistory, $state, $interval) { +angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$rootScope','zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$fileLogger', '$cordovaEmailComposer', '$ionicPopup', '$timeout', '$ionicHistory', '$state', '$interval', '$ionicLoading', function ($scope, $rootScope,zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $fileLogger, $cordovaEmailComposer, $ionicPopup, $timeout, $ionicHistory, $state, $interval, $ionicLoading) { $scope.openMenu = function () { $ionicSideMenuDelegate.toggleLeft(); }; @@ -152,17 +152,21 @@ saveAs(blob, fname); { //console.log ("GETTING LOGS"); + $ionicLoading.show({ + template: "retrieving logs...", + noBackdrop: true, + duration: zm.loadingTimeout + }); $fileLogger.getLogfile().then(function (l) { $scope.zmLog.logString = l.split('\n').reverse().join('\n'); - //$scope.zmLog.logString = Math.random() + $scope.zmLog.logString; - // console.log ("UPDATING LOGS"); - //console.log ("LOGS" + logstring); + $ionicLoading.hide(); }, function (error) { $scope.zmLog.logString = "Error getting log: " + JSON.stringify(error); + $ionicLoading.hide(); }); } diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 100398ad..72fca590 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -632,7 +632,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r .finally ( function (ans) { - zmAutoLogin.doLogin("") + zmAutoLogin.doLogin("") // Do the happy menu only if authentication works // if it does not work, there is an emitter for auth // fail in app.js that will be called to show an error diff --git a/www/js/MonitorModalCtrl.js b/www/js/MonitorModalCtrl.js index ead42af3..c1ce8532 100644 --- a/www/js/MonitorModalCtrl.js +++ b/www/js/MonitorModalCtrl.js @@ -261,7 +261,7 @@ angular.module('zmApp.controllers').controller('MonitorModalCtrl', ['$scope', '$ } var status = ["idle", "pre-alarm","alarmed","alert","record"]; - console.log ("Inside Modal timer..."); + //console.log ("Inside Modal timer..."); var apiurl = ZMDataModel.getLogin().apiurl; var alarmurl = apiurl+"/monitors/alarm/id:"+$scope.monitorId+"/command:status.json"; ZMDataModel.zmLog ("Invoking " + alarmurl); diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 2f80e57d..494e68a3 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -272,6 +272,12 @@ function initPackery() function loadAlarmStatus() { + + if (ZMDataModel.versionCompare($rootScope.apiVersion,"1.30")==-1) + { + + //return; + } for (var i=0; i < $scope.MontageMonitors.length; i++) { @@ -281,7 +287,7 @@ function initPackery() { continue; } - // getAlarmStatus($scope.MontageMonitors[i]); + getAlarmStatus($scope.MontageMonitors[i]); } @@ -397,7 +403,7 @@ function initPackery() }; - /* + $scope.toggleDelete = function (i) { @@ -407,7 +413,7 @@ function initPackery() $scope.copyMontage[i].Monitor.listDisplay = 'show'; ZMDataModel.zmDebug ("index " + i + " is now " + $scope.copyMontage[i].Monitor.listDisplay); - };*/ + }; $scope.hideUnhide = function() { @@ -772,29 +778,7 @@ function initPackery() // console.log("**VIEW ** Montage Ctrl Loaded"); }); - $scope.$on('$ionicView.enter', function () { - - //$scope.areImagesLoading = true; - var ld = ZMDataModel.getLogin(); - //console.log("Setting Awake to " + ZMDataModel.getKeepAwake()); - ZMDataModel.setAwake(ZMDataModel.getKeepAwake()); - - $interval.cancel(intervalHandleMontage); - $interval.cancel(intervalHandleAlarmStatus); - - intervalHandleMontage = $interval(function () { - loadNotifications(); - // console.log ("Refreshing Image..."); - }.bind(this), ld.refreshSec * 1000); - - intervalHandleAlarmStatus = $interval(function () { - loadAlarmStatus(); - // console.log ("Refreshing Image..."); - }.bind(this), 5000); - - - loadNotifications(); - }); + $scope.$on('$ionicView.leave', function () { // console.log("**VIEW ** Montage Ctrl Left, force removing modal"); @@ -802,14 +786,6 @@ function initPackery() }); - $scope.$on('$ionicView.afterEnter', function () { - console.log("**VIEW ** Montage Ctrl AFTER ENTER"); - window.addEventListener("resize", orientationChanged, false); - $timeout ( function () {initPackery(); },500); - document.addEventListener("pause", onPause, false); - document.addEventListener("resume", onResume, false); - - }); function orientationChanged() { ZMDataModel.zmDebug("Detected orientation change, redoing packery resize"); @@ -817,8 +793,23 @@ function initPackery() pckry.onresize(); }); } + +$scope.toggleSizeButtons = function() +{ + + $scope.showSizeButtons = !$scope.showSizeButtons; + ZMDataModel.zmDebug ("toggling size buttons:"+$scope.showSizeButtons); +}; -$scope.$on('$ionicView.enter', function () { +// minimal has to be beforeEnter or header won't hide +$scope.$on ('$ionicView.beforeEnter', function() { + $scope.minimal = $stateParams.minimal; + //console.log ("**************** MINIMAL ENTER " + $scope.minimal); + $scope.zmMarginTop = $scope.minimal ? 0 : 15; +}); + + +$scope.$on('$ionicView.afterEnter', function () { ZMDataModel.zmDebug("Setting image mode to snapshot, will change to image when packery is all done"); $scope.allImagesLoaded = false; $scope.isDragabillyOn = false; @@ -826,8 +817,8 @@ $scope.$on('$ionicView.enter', function () { $scope.gridScale = "grid-item-50"; $scope.LoginData = ZMDataModel.getLogin(); $scope.monLimit = $scope.LoginData.maxMontage; - $scope.minimal = $stateParams.minimal; - $scope.zmMarginTop = $scope.minimal ? 0 : 15; + $scope.showSizeButtons = false; + $scope.monitors = message; $scope.MontageMonitors = angular.copy(message); @@ -842,7 +833,28 @@ $scope.$on('$ionicView.enter', function () { $scope.isReorder = false; $ionicSideMenuDelegate.canDragContent($scope.minimal ? true : true); + + + //$scope.areImagesLoading = true; + var ld = ZMDataModel.getLogin(); + //console.log("Setting Awake to " + ZMDataModel.getKeepAwake()); + ZMDataModel.setAwake(ZMDataModel.getKeepAwake()); + $interval.cancel(intervalHandleMontage); + $interval.cancel(intervalHandleAlarmStatus); + + intervalHandleMontage = $interval(function () { + loadNotifications(); + // console.log ("Refreshing Image..."); + }.bind(this), ld.refreshSec * 1000); + + intervalHandleAlarmStatus = $interval(function () { + loadAlarmStatus(); + // console.log ("Refreshing Image..."); + }.bind(this), 5000); + + + loadNotifications(); if ($scope.MontageMonitors.length == 0) { $rootScope.zmPopup = $ionicPopup.alert({ @@ -899,7 +911,11 @@ $scope.$on('$ionicView.enter', function () { ZMDataModel.zmLog("MontageCtrl: Error returned Stream authentication construction. Retaining old value of: " + $rootScope.authSession); }); - + console.log("**VIEW ** Montage Ctrl AFTER ENTER"); + window.addEventListener("resize", orientationChanged, false); + $timeout ( function () {initPackery(); },500); + document.addEventListener("pause", onPause, false); + document.addEventListener("resume", onResume, false); }); diff --git a/www/js/TimelineModalCtrl.js b/www/js/TimelineModalCtrl.js index 1cb49561..68512f7a 100644 --- a/www/js/TimelineModalCtrl.js +++ b/www/js/TimelineModalCtrl.js @@ -249,7 +249,7 @@ angular.module('zmApp.controllers').controller('TimelineModalCtrl', ['$scope', ' { label: 'Score', fill:true, - backgroundColor: 'rgba(52, 152, 219, 1.0)', + backgroundColor: 'rgba(89, 171, 227, 1.0)', borderColor: 'rgba(52, 152, 219, 1.0)', borderCapStyle: 'butt', borderJoinStyle: 'miter', diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js index c09270db..b64d5ff9 100644 --- a/www/js/WizardCtrl.js +++ b/www/js/WizardCtrl.js @@ -45,13 +45,13 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ if (data.indexOf(zm.loginScreenString) == -1) { $scope.wizard.loginURL = $scope.wizard.fqportal; - $scope.wizard.portalValidText = "Portal login was successful: "+$scope.wizard.loginURL; + $scope.wizard.portalValidText = "Portal: "+$scope.wizard.loginURL; $scope.wizard.portalColor = "#16a085"; d.resolve(true); return d.promise; } else { console.log("************ERROR"); - $scope.wizard.portalValidText = "Portal login was unsuccessful"; + $scope.wizard.portalValidText = "Portal: detection failed"; $scope.wizard.portalColor = "#e74c3c"; d.reject(false); return d.promise; @@ -59,7 +59,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ }) .error (function (error) { console.log("************ERROR"); - $scope.wizard.portalValidText = "Portal login was unsuccessful"; + $scope.wizard.portalValidText = "Portal: detection failed"; $scope.wizard.portalColor = "#e74c3c"; d.reject(false); return d.promise; @@ -212,7 +212,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ $ionicLoading.hide(); ZMDataModel.zmLog ("Valid cgi-bin found with: " + success); $scope.wizard.streamingURL = success; - $scope.wizard.streamingValidText = "cgi-bin detection succeeded: "+$scope.wizard.streamingURL; + $scope.wizard.streamingValidText = "cgi-bin: "+$scope.wizard.streamingURL; $scope.wizard.streamingColor = "#16a085"; d.resolve(true); return d.promise; @@ -275,7 +275,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ - $scope.wizard.apiValidText = "API detection succeeded: "+$scope.wizard.apiURL; + $scope.wizard.apiValidText = "API: "+$scope.wizard.apiURL; $scope.wizard.apiColor = "#16a085"; d.resolve(true); return d.promise; diff --git a/www/js/app.js b/www/js/app.js index d5821cd3..b327ddac 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -1369,9 +1369,11 @@ angular.module('zmApp', [ //------------------------------------------------------------------ // My route map connecting menu options to their respective templates and controllers -.config(function ($stateProvider, $urlRouterProvider, $httpProvider, $ionicConfigProvider, $provide,$compileProvider, $ionicNativeTransitionsProvider) { - +.config(function ($stateProvider, $urlRouterProvider, $httpProvider, $ionicConfigProvider, $provide,$compileProvider, $ionicNativeTransitionsProvider, $logProvider) { + //$logProvider.debugEnabled(false); + //$compileProvider.debugInfoEnabled(false); + // This is an exception interceptor so it can show up in app logs // if they occur. I suspect digest and other errors will be useful // for me to see diff --git a/www/templates/devoptions.html b/www/templates/devoptions.html index 7cc087d0..15ff0d1d 100644 --- a/www/templates/devoptions.html +++ b/www/templates/devoptions.html @@ -1,11 +1,11 @@ - + - + - + @@ -17,28 +17,24 @@ Developer Options for {{loginData.serverName}} -
+
Frame update (sec.) 
- - + + - +
- + - +
Max monitors in montage 
- +
- Event single image scale(%)  + Event single image scale(%) 
- +
- resume delay(ms)  + resume delay(ms)  - +
- +
- Event Montage image scale(%)  + Event Montage image scale(%) 
- +
- Max. items for Timeline  + Max. items for Timeline 
- +
- +
-
- + - + - + - - + - + + - + + +
-
+ \ No newline at end of file diff --git a/www/templates/events.html b/www/templates/events.html index e85c4d03..88dab016 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -47,7 +47,7 @@ -      {{prettifyTime(event.Event.StartTime)}} +      {{prettifyTime(event.Event.StartTime)}}      {{prettifyDate(event.Event.StartTime)}} @@ -114,20 +114,20 @@
- - - -
@@ -265,7 +265,7 @@
Filter On
- + diff --git a/www/templates/important_message.html b/www/templates/important_message.html index 5ad922e5..a97f1ada 100644 --- a/www/templates/important_message.html +++ b/www/templates/important_message.html @@ -19,7 +19,7 @@

I'd appreciate if you upgraded ZoneMinder


- You are running v{{currentVersion}}.
v{{recommendedVersion}} has an important fix that eliminates a bug related to network data consumption build up of zmNinja. While your version will work, I'd recommend you upgrade ZoneMinder. Till you do, please make sure you don't keep zmNinja running in the background (for Android). Thank you. + You are running v{{currentVersion}}.
v{{recommendedVersion}} has some important fixes that enhance the API amongst other things. This is required to avail of the new alarm APIs and other new features.
Reported Version: v{{currentVersion}}
Recommended Version:v{{recommendedVersion}}

diff --git a/www/templates/lowversion.html b/www/templates/lowversion.html index 4e976846..3b50683b 100644 --- a/www/templates/lowversion.html +++ b/www/templates/lowversion.html @@ -1,6 +1,6 @@ - +

@@ -9,8 +9,8 @@
- -
+ +

ZoneMinder upgrade needed


@@ -18,12 +18,12 @@
Reported Version: {{currentVersion}}
Minimum Required Version:{{requiredVersion}}
-

-
-
- +
+
+ + diff --git a/www/templates/montage-history.html b/www/templates/montage-history.html index b91b3e16..392f390c 100644 --- a/www/templates/montage-history.html +++ b/www/templates/montage-history.html @@ -36,7 +36,7 @@ -
+
diff --git a/www/templates/montage.html b/www/templates/montage.html index 8f6b6adc..50944b3c 100644 --- a/www/templates/montage.html +++ b/www/templates/montage.html @@ -3,6 +3,11 @@ + + + + @@ -24,14 +29,13 @@ - - + -    +    -    +   

@@ -115,7 +119,7 @@ - diff --git a/www/templates/timeline-modal.html b/www/templates/timeline-modal.html index 1584b961..89753f72 100644 --- a/www/templates/timeline-modal.html +++ b/www/templates/timeline-modal.html @@ -35,9 +35,9 @@
f:{{alarm.fid}} scr:{{alarm.score}} @ {{alarm.time}}
- + - + -- cgit v1.2.3