diff options
Diffstat (limited to 'www')
| -rw-r--r-- | www/.DS_Store | bin | 6148 -> 6148 bytes | |||
| -rw-r--r-- | www/js/DataModel.js | 6 | ||||
| -rw-r--r-- | www/js/EventCtrl.js | 323 | ||||
| -rw-r--r-- | www/js/MonitorCtrl.js | 3 | ||||
| -rw-r--r-- | www/js/app.js | 785 | ||||
| -rw-r--r-- | www/js/controllers.js | 19 |
6 files changed, 529 insertions, 607 deletions
diff --git a/www/.DS_Store b/www/.DS_Store Binary files differindex 5a9c6250..21fe6175 100644 --- a/www/.DS_Store +++ b/www/.DS_Store diff --git a/www/js/DataModel.js b/www/js/DataModel.js index d85c4a5c..7f84d9aa 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -39,6 +39,10 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion $fileLogger.log(logtype, val); } + + //-------------------------------------------------------------------------- + // Banner display of messages + //-------------------------------------------------------------------------- function displayBanner (mytype, mytext, myinterval, mytimer) { var contentBannerInstance = $ionicContentBanner.show({ @@ -390,7 +394,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion //----------------------------------------------------------------------------- // - //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- setMonitors: function (mon) { console.log("ZMData setMonitors called with " + mon.length + " monitors"); monitors = mon; diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 562cbc1d..e59bad3a 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -22,26 +22,24 @@ angular.module('zmApp.controllers') $scope.currentEventTime = 0; var oldEvent = ""; // will hold previous event that had showScrub = true var scrollbynumber = 0; - $scope.eventsBeingLoaded = true; - $scope.FrameArray=[]; // will hold frame info from detailed Events API + $scope.eventsBeingLoaded = true; + $scope.FrameArray = []; // will hold frame info from detailed Events API document.addEventListener("pause", onPause, false); console.log("I got STATE PARAM " + $stateParams.id); $scope.id = parseInt($stateParams.id, 10); $scope.connKey = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111; - //var segmentHandle = 0; + - - - -$ionicPopover.fromTemplateUrl('templates/events-popover.html', { + $ionicPopover.fromTemplateUrl('templates/events-popover.html', { scope: $scope, - }).then(function(popover) { + }).then(function (popover) { $scope.popover = popover; - }); + }); // These are the commands ZM uses to move around - // in ZMS + // in ZMS - not used anymore as I am doing direct + // image access via image.php var eventCommands = { next: "13", previous: "12", @@ -61,7 +59,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { .then(function (data) { //console.log ("***GETKEY: " + JSON.stringify(data)); eventImageDigits = parseInt(data); - ZMDataModel.zmLog ("Image padding digits reported as " + eventImageDigits); + ZMDataModel.zmLog("Image padding digits reported as " + eventImageDigits); }); @@ -119,7 +117,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { console.log("TOTAL EVENT PAGES IS " + eventsPage); pageLoaded = true; $scope.viewTitle.title = data.count; - ZMDataModel.getEvents($scope.id, eventsPage, "",$rootScope.fromString, $rootScope.toString) + ZMDataModel.getEvents($scope.id, eventsPage, "", $rootScope.fromString, $rootScope.toString) .then(function (data) { console.log("EventCtrl Got events"); //var events = []; @@ -151,7 +149,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { sec + "/"; myevents[i].Event.relativePath = - myevents[i].Event.MonitorId + "/" + + myevents[i].Event.MonitorId + "/" + yy + "/" + mm + "/" + dd + "/" + @@ -178,29 +176,25 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { // not explictly handling error --> I have a default "No events found" message // displayed in the template if events list is null - $scope.calcMsTimer = function(frames,len) - { + $scope.calcMsTimer = function (frames, len) { var myframes, mylen; - myframes = parseFloat(frames); - mylen = parseFloat(len); - // console.log ("frames " + myframes + "length " + mylen); - // console.log ("*** MS COUNT " + (1000.0/(myframes/mylen))); - return (Math.round(1000/(myframes/mylen))); + myframes = parseFloat(frames); + mylen = parseFloat(len); + // console.log ("frames " + myframes + "length " + mylen); + // console.log ("*** MS COUNT " + (1000.0/(myframes/mylen))); + return (Math.round(1000 / (myframes / mylen))); }; $scope.openMenu = function () { $ionicSideMenuDelegate.toggleLeft(); }; - $scope.scrollPosition= function() { - var scrl = parseFloat( $ionicScrollDelegate.$getByHandle("mainScroll").getScrollPosition().top); - var item = Math.round(scrl/200.0); - if ($scope.events[item] == undefined) - { + $scope.scrollPosition = function () { + var scrl = parseFloat($ionicScrollDelegate.$getByHandle("mainScroll").getScrollPosition().top); + var item = Math.round(scrl / 200.0); + if ($scope.events[item] == undefined) { return ""; - } - else - { + } else { return prettifyDate($scope.events[item].Event.StartTime); } //return Math.random(); @@ -252,14 +246,14 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { // them in sync while doing format conversion. //------------------------------------------------------------------------- $scope.$watch('ionRange.index', function () { - // console.log ("***ION RANGE CHANGED"); + // console.log ("***ION RANGE CHANGED"); - $scope.mycarousel.index = parseInt($scope.ionRange.index)-1; + $scope.mycarousel.index = parseInt($scope.ionRange.index) - 1; }); $scope.$watch('mycarousel.index', function () { - $scope.ionRange.index = ($scope.mycarousel.index+1).toString(); + $scope.ionRange.index = ($scope.mycarousel.index + 1).toString(); }); @@ -268,10 +262,10 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { // scrub view for an event. //------------------------------------------------------------------------- - $scope.toggleGroup = function(event,ndx,frames) - { + $scope.toggleGroup = function (event, ndx, frames) { toggleGroup(event, ndx, frames); }; + function toggleGroup(event, ndx, frames) { // If we are here and there is a record of a previous scroll @@ -281,27 +275,27 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { scrollbynumber = 0; } - if (oldEvent && event !=oldEvent) { + if (oldEvent && event != oldEvent) { console.log("SWITCHING OLD EVENT OFF"); oldEvent.Event.ShowScrub = false; oldEvent.Event.height = zm.eventsListDetailsHeight; oldEvent = ""; } - event.Event.ShowScrub = !event.Event.ShowScrub; - // $ionicScrollDelegate.resize(); + event.Event.ShowScrub = !event.Event.ShowScrub; + // $ionicScrollDelegate.resize(); - if (event.Event.ShowScrub==true) // turn on display now + if (event.Event.ShowScrub == true) // turn on display now { //$ionicScrollDelegate.freezeScroll(true); $ionicSideMenuDelegate.canDragContent(false); $scope.slider_options = { - from:1, - to:event.Event.Frames, - realtime:true, - step:1, - className:"mySliderClass", - callback: function(value, released) { + from: 1, + to: event.Event.Frames, + realtime: true, + step: 1, + className: "mySliderClass", + callback: function (value, released) { //console.log("CALLBACK"+value+released); $ionicScrollDelegate.freezeScroll(!released); @@ -309,18 +303,30 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { }, //modelLabels:function(val) {return "";}, css: { - background: {"background-color": "silver"}, - before: {"background-color": "purple"}, - default: {"background-color": "white"}, // default value: 1px - after: {"background-color": "green"}, // zone after default value - pointer: {"background-color": "red"}, // circle pointer - range: {"background-color": "red"} // use it if double value + background: { + "background-color": "silver" + }, + before: { + "background-color": "purple" + }, + default: { + "background-color": "white" + }, // default value: 1px + after: { + "background-color": "green" + }, // zone after default value + pointer: { + "background-color": "red" + }, // circle pointer + range: { + "background-color": "red" + } // use it if double value }, - scale:[] + scale: [] }; - event.Event.height=zm.eventsListDetailsHeight + zm.eventsListScrubHeight; + event.Event.height = zm.eventsListDetailsHeight + zm.eventsListScrubHeight; $ionicScrollDelegate.resize(); $scope.mycarousel.index = 0; $scope.ionRange.index = 1; @@ -336,38 +342,37 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { } // now get event details to show alarm frames - var loginData=ZMDataModel.getLogin(); - var myurl = loginData.apiurl+'/events/'+event.Event.Id+".json"; + var loginData = ZMDataModel.getLogin(); + var myurl = loginData.apiurl + '/events/' + event.Event.Id + ".json"; ZMDataModel.zmLog("*** Constructed API for detailed events: " + myurl); $http.get(myurl) - .success(function(data){ - $scope.FrameArray = data.event.Frame; - // $scope.slider_options.scale=[]; - $scope.slider_options.scale=[]; - //$scope.slider_options.modelLabels={2:'X'}; - //$scope.slider_options.dimension="arjun"; - var i; - for (i=0; i<data.event.Frame.length; i++) - { - if (data.event.Frame[i].Type=="Alarm") - { - //⬤ - //console.log ("**ALARM AT " + i); - $scope.slider_options.scale.push({val:i+1,label:' '}); - } - else - { - //$scope.slider_options.scale.push(' '); - } + .success(function (data) { + $scope.FrameArray = data.event.Frame; + // $scope.slider_options.scale=[]; + $scope.slider_options.scale = []; + //$scope.slider_options.modelLabels={2:'X'}; + //$scope.slider_options.dimension="arjun"; + var i; + for (i = 0; i < data.event.Frame.length; i++) { + if (data.event.Frame[i].Type == "Alarm") { + + //console.log ("**ALARM AT " + i); + $scope.slider_options.scale.push({ + val: i + 1, + label: ' ' + }); + } else { + //$scope.slider_options.scale.push(' '); + } - } + } - //console.log (JSON.stringify(data)); - }) - .error(function(err) { - ZMDataModel.zmLog("Error retrieving detailed frame API " + JSON.stringify(err)); - ZMDataModel.displayBanner ('error', ['could not retrieve frame details', 'please try again']); - }); + //console.log (JSON.stringify(data)); + }) + .error(function (err) { + ZMDataModel.zmLog("Error retrieving detailed frame API " + JSON.stringify(err)); + ZMDataModel.displayBanner('error', ['could not retrieve frame details', 'please try again']); + }); oldEvent = event; @@ -389,12 +394,10 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { // we need to scroll up to make space } - } - else - { - // $ionicScrollDelegate.freezeScroll(false); + } else { + // $ionicScrollDelegate.freezeScroll(false); $ionicSideMenuDelegate.canDragContent(true); - event.Event.height=zm.eventsListDetailsHeight; + event.Event.height = zm.eventsListDetailsHeight; $ionicScrollDelegate.resize(); if (scrollbynumber) { @@ -406,12 +409,10 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { } - $scope.closeIfOpen = function(event) - { - if (event != undefined) - { + $scope.closeIfOpen = function (event) { + if (event != undefined) { if (event.Event.ShowScrub) - toggleGroup(event); + toggleGroup(event); } }; @@ -420,7 +421,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { // console.log ("IS SHOW INDEX is " + ndx); //console.log ("SHOW GROUP IS " + showGroup); - return (event==undefined)?false:event.Event.ShowScrub; + return (event == undefined) ? false : event.Event.ShowScrub; }; @@ -732,69 +733,80 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { $rootScope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111; $scope.slider_modal_options = { - from:1, - to:eframes, - realtime:true, - step:1, - className:"mySliderClass", - callback: function(value, released) { - //console.log("CALLBACK"+value+released); - $ionicScrollDelegate.freezeScroll(!released); + from: 1, + to: eframes, + realtime: true, + step: 1, + className: "mySliderClass", + callback: function (value, released) { + //console.log("CALLBACK"+value+released); + $ionicScrollDelegate.freezeScroll(!released); + }, + //modelLabels:function(val) {return "";}, + smooth: false, + css: { + background: { + "background-color": "silver" }, - //modelLabels:function(val) {return "";}, - smooth: false, - css: { - background: {"background-color": "silver"}, - before: {"background-color": "purple"}, - default: {"background-color": "white"}, // default value: 1px - after: {"background-color": "green"}, // zone after default value - pointer: {"background-color": "red"}, // circle pointer - range: {"background-color": "red"} // use it if double value + before: { + "background-color": "purple" }, - scale:[] + default: { + "background-color": "white" + }, // default value: 1px + after: { + "background-color": "green" + }, // zone after default value + pointer: { + "background-color": "red" + }, // circle pointer + range: { + "background-color": "red" + } // use it if double value + }, + scale: [] - }; + }; - $scope.mycarousel.index = 0; - $scope.ionRange.index = 1; - //console.log("**Resetting range"); - $scope.slides = []; - var i; - for (i = 1; i <= eframes; i++) { - var fname = padToN(i, eventImageDigits) + "-capture.jpg"; - // console.log ("Building " + fname); - $scope.slides.push({ - id: i, - img: fname - }); - } + $scope.mycarousel.index = 0; + $scope.ionRange.index = 1; + //console.log("**Resetting range"); + $scope.slides = []; + var i; + for (i = 1; i <= eframes; i++) { + var fname = padToN(i, eventImageDigits) + "-capture.jpg"; + // console.log ("Building " + fname); + $scope.slides.push({ + id: i, + img: fname + }); + } - // now get event details to show alarm frames - var loginData=ZMDataModel.getLogin(); - var myurl = loginData.apiurl+'/events/'+eid+".json"; - ZMDataModel.zmLog("*** Constructed API for detailed events: " + myurl); - $http.get(myurl) - .success(function(data){ + // now get event details to show alarm frames + var loginData = ZMDataModel.getLogin(); + var myurl = loginData.apiurl + '/events/' + eid + ".json"; + ZMDataModel.zmLog("*** Constructed API for detailed events: " + myurl); + $http.get(myurl) + .success(function (data) { $scope.FrameArray = data.event.Frame; - // $scope.slider_options.scale=[]; - $scope.slider_modal_options.scale=[]; + // $scope.slider_options.scale=[]; + $scope.slider_modal_options.scale = []; //$scope.slider_options.modelLabels={2:'X'}; //$scope.slider_options.dimension="arjun"; var i; - for (i=0; i<data.event.Frame.length; i++) - { - if (data.event.Frame[i].Type=="Alarm") - { + for (i = 0; i < data.event.Frame.length; i++) { + if (data.event.Frame[i].Type == "Alarm") { //⬤ - // console.log ("**ALARM AT " + i); - $scope.slider_modal_options.scale.push({val:i+1,label:' '}); - } - else - { + // console.log ("**ALARM AT " + i); + $scope.slider_modal_options.scale.push({ + val: i + 1, + label: ' ' + }); + } else { //$scope.slider_options.scale.push(' '); } @@ -802,9 +814,9 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { //console.log (JSON.stringify(data)); }) - .error(function(err) { + .error(function (err) { ZMDataModel.zmLog("Error retrieving detailed frame API " + JSON.stringify(err)); - ZMDataModel.displayBanner ('error', ['could not retrieve frame details', 'please try again']); + ZMDataModel.displayBanner('error', ['could not retrieve frame details', 'please try again']); }); $scope.totalEventTime = Math.round(parseFloat(edur)) - 1; @@ -836,11 +848,11 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { // call on progress indicator every 5 seconds // don't want to overload - /* - segmentHandle = $interval(function () { - segmentCheck(); - }, zm.progressIntervalCheck); - segmentCheck();*/ + /* + segmentHandle = $interval(function () { + segmentCheck(); + }, zm.progressIntervalCheck); + segmentCheck();*/ }); @@ -938,7 +950,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { loadingStr = "none"; } - ZMDataModel.getEvents($scope.id, eventsPage, loadingStr,$rootScope.fromString, $rootScope.toString) + ZMDataModel.getEvents($scope.id, eventsPage, loadingStr, $rootScope.fromString, $rootScope.toString) .then(function (data) { var loginData = ZMDataModel.getLogin(); console.log("Got new page of events with Page=" + eventsPage); @@ -1010,12 +1022,11 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { return moment(str).format('MMM Do'); }; - function prettifyDate (str) - { + function prettifyDate(str) { return moment(str).format('MMM Do'); } - $scope.prettifyTime = function (str) { + $scope.prettifyTime = function (str) { return moment(str).format('h:mm:ssa'); }; @@ -1045,7 +1056,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { console.log("TOTAL EVENT PAGES IS " + eventsPage); pageLoaded = true; $scope.viewTitle.title = data.count; - ZMDataModel.getEvents($scope.id, eventsPage, "",$rootScope.fromString, $rootScope.toString) + ZMDataModel.getEvents($scope.id, eventsPage, "", $rootScope.fromString, $rootScope.toString) .then(function (data) { console.log("EventCtrl Got events"); @@ -1055,7 +1066,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { myevents[i].Event.MonitorName = ZMDataModel.getMonitorName(myevents[i].Event.MonitorId); - // now construct base path + // now construct base path var str = myevents[i].Event.StartTime; //var yy = moment(str).format('h:mm:ssa on MMMM Do YYYY'); @@ -1076,7 +1087,7 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { sec + "/"; myevents[i].Event.relativePath = - myevents[i].Event.MonitorId + "/" + + myevents[i].Event.MonitorId + "/" + yy + "/" + mm + "/" + dd + "/" + @@ -1084,8 +1095,8 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { min + "/" + sec + "/"; - myevents[i].Event.ShowScrub = false; - myevents[i].Event.height = zm.eventsListDetailsHeight; + myevents[i].Event.ShowScrub = false; + myevents[i].Event.height = zm.eventsListDetailsHeight; } $scope.events = myevents; loadMore(); @@ -1094,4 +1105,4 @@ $ionicPopover.fromTemplateUrl('templates/events-popover.html', { }); }; //dorefresh -}]); +}]);
\ No newline at end of file diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js index 610741e2..f816ec27 100644 --- a/www/js/MonitorCtrl.js +++ b/www/js/MonitorCtrl.js @@ -30,9 +30,6 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu }; - - - //----------------------------------------------------------------------- // This function takes care of changing monitor parameters // For now, I've only limited it to enable/disable and change monitor mode diff --git a/www/js/app.js b/www/js/app.js index da984cac..43873675 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -24,31 +24,31 @@ angular.module('zmApp', [ //----------------------------------------------- .constant('zm', { - httpTimeout:15000, - largeHttpTimeout:60000, - logFile:'zmNinjaLog.txt', - authoremail:'pliablepixels+zmNinja@gmail.com', + httpTimeout: 15000, + largeHttpTimeout: 60000, + logFile: 'zmNinjaLog.txt', + authoremail: 'pliablepixels+zmNinja@gmail.com', logFileMaxSize: 10000, // after this limit log gets reset - loginInterval:300000, //5m*60s*1000 - ZM auto login after 5 mins - loadingTimeout:15000, - safeMontageLimit:10, - maxFPS:30, - defaultFPS:3, - maxMontageQuality:70, - defaultMontageQuality:50, - progressIntervalCheck:5000, // used for progress indicator on event playback - graphFillColor:'rgba(151,187,205,0.5)', + loginInterval: 300000, //5m*60s*1000 - ZM auto login after 5 mins + loadingTimeout: 15000, + safeMontageLimit: 10, + maxFPS: 30, + defaultFPS: 3, + maxMontageQuality: 70, + defaultMontageQuality: 50, + progressIntervalCheck: 5000, // used for progress indicator on event playback + graphFillColor: 'rgba(151,187,205,0.5)', graphStrokeColor: 'rgba(151,187,205,0.8)', graphHighlightFill: 'rgba(0,163,124,0.5)', - monitorCheckingColor:'#03A9F4', + monitorCheckingColor: '#03A9F4', monitorNotRunningColor: '#F44336', monitorPendingColor: '#FF9800', monitorRunningColor: '#4CAF50', monitorErrorColor: '#795548', - montageScaleFrequency:300, - eventsListDetailsHeight:200, - eventsListScrubHeight:300, - loginScreenString:"var currentView = 'login'" // oh shit. Isn't there a better way? + montageScaleFrequency: 300, + eventsListDetailsHeight: 200, + eventsListScrubHeight: 300, + loginScreenString: "var currentView = 'login'" // oh shit. Isn't there a better way? @@ -65,7 +65,7 @@ angular.module('zmApp', [ imageLoading = val; //console.log ("** IMAGE LOADING **"+val); }, - 'get': function() { + 'get': function () { return imageLoading; } @@ -99,8 +99,8 @@ angular.module('zmApp', [ // This directive is adapted from https://github.com/paveisistemas/ionic-image-lazy-load // I've removed lazyLoad and only made it show a spinner when an image is loading //-------------------------------------------------------------------------------------------- -.directive('imageSpinnerSrc', ['$document', '$compile','imageLoadingDataShare', - function ($document , $compile, imageLoadingDataShare) { +.directive('imageSpinnerSrc', ['$document', '$compile', 'imageLoadingDataShare', + function ($document, $compile, imageLoadingDataShare) { return { restrict: 'A', scope: { @@ -109,41 +109,41 @@ angular.module('zmApp', [ link: function ($scope, $element, $attributes) { if ($attributes.imageSpinnerLoader) { - // console.log ("DIRECTIVE: IMAGE SPINNER"); + // console.log ("DIRECTIVE: IMAGE SPINNER"); var loader = $compile('<div class="image-loader-container"><ion-spinner style="position:fixed;top:5%;left:5%" class="image-loader" icon="' + $attributes.imageSpinnerLoader + '"></ion-spinner></div>')($scope); $element.after(loader); } - imageLoadingDataShare.set(1); - loadImage(); - - $attributes.$observe('imageSpinnerSrc', function(value){ + imageLoadingDataShare.set(1); + loadImage(); + + $attributes.$observe('imageSpinnerSrc', function (value) { //console.log ("DIRECTIVE SOURCE CHANGED"); imageLoadingDataShare.set(1); - loadImage(); - //deregistration(); + loadImage(); + //deregistration(); }); - - // show an image-missing image - $element.bind('error',function () { - // console.log ("DIRECTIVE: IMAGE ERROR"); + + // show an image-missing image + $element.bind('error', function () { + // console.log ("DIRECTIVE: IMAGE ERROR"); loader.remove(); - imageLoadingDataShare.set(0); - + imageLoadingDataShare.set(0); + var url = 'img/novideo.png'; $element.prop('src', url); - }); + }); function loadImage() { $element.bind("load", function (e) { if ($attributes.imageSpinnerLoader) { - // console.log ("DIRECTIVE: IMAGE LOADED"); + // console.log ("DIRECTIVE: IMAGE LOADED"); loader.remove(); imageLoadingDataShare.set(0); } }); - + @@ -156,7 +156,7 @@ angular.module('zmApp', [ $element[0].style.backgroundImage = 'url(' + $attributes.imageSpinnerSrc + ')'; // set style attribute on element (it will load image) }; bgImg.src = $attributes.imageSpinnerSrc; - //console.log ("DIRECTIVE: BGIMAGE SRC SET TO " + $attributes.imageSpinnerSrc); + //console.log ("DIRECTIVE: BGIMAGE SRC SET TO " + $attributes.imageSpinnerSrc); } else { $element[0].src = $attributes.imageSpinnerSrc; // set src attribute on element (it will load image) //console.log ("DIRECTIVE: IMAGE SRC SET TO "+$attributes.imageSpinnerSrc); @@ -164,13 +164,13 @@ angular.module('zmApp', [ } function isInView() { - return true; + return true; } $element.on('$destroy', function () { - // console.log ("**************** DIRECTIVE DESTROY IMAGE: " + $element[0].src); + // console.log ("**************** DIRECTIVE DESTROY IMAGE: " + $element[0].src); }); - $element[0].src="img/novideo.png"; + // $element[0].src = "img/novideo.png"; } }; @@ -185,50 +185,44 @@ angular.module('zmApp', [ // That way the user can try again, and won't get stuck // Also remember you need to add it to .config //------------------------------------------------------------------ -.factory('timeoutHttpIntercept', function ($rootScope, $q,zm) { +.factory('timeoutHttpIntercept', function ($rootScope, $q, zm) { var zmCookie = ""; return { 'request': function (config) { - // config.withCredentials = true; - if (zmCookie) - { - // console.log ("** ADDING COOKIE TO REQUEST "+zmCookie); - config.headers.Cookie = "ZMSESSID="+zmCookie; + // config.withCredentials = true; + if (zmCookie) { + config.headers.Cookie = "ZMSESSID=" + zmCookie; } - if ( !(config.url.indexOf("/api/states/change/") > -1 || - config.url.indexOf("getDiskPercent.json") > -1 )) - { - config.timeout = 15000; - } - else + if ((config.url.indexOf("/api/states/change/") > -1) || + (config.url.indexOf("getDiskPercent.json") > -1) || + (config.url.indexOf("daemonCheck.json") > -1) || + (config.url.indexOf("getLoad.json") > -1 )) + + { - //console.log ("HTTP INTERCEPT:Skipping HTTP timeout for "+config.url); + // these can take time, so lets bump up timeout + config.timeout = zm.largeHttpTimeout; + + } else { + config.timeout = zm.httpTimeout; } return config; }, - 'response': function (response) - { - //console.log ("******** WHOA RESPONSE CAUGHT ************"); + 'response': function (response) { var cookies = response.headers("Set-Cookie"); - if (cookies !=null) - { + if (cookies != null) { - var zmSess=cookies.match("ZMSESSID=(.*?);"); - - if (zmSess) - { - if (zmSess[1]) - { - //console.log ("***RESPONSE HEADER COOKIE " + zmSess[1]); - // console.log ("WHOLE STRING " + cookies); - zmCookie=zmSess[1]; + var zmSess = cookies.match("ZMSESSID=(.*?);"); + + if (zmSess) { + if (zmSess[1]) { + + zmCookie = zmSess[1]; } - } - else - { - // console.log ("WHOLE STRING " + cookies); + } else { + // console.log ("WHOLE STRING " + cookies); } } return response; @@ -242,29 +236,28 @@ angular.module('zmApp', [ // This service automatically logs into ZM at periodic intervals //------------------------------------------------------------------ -.factory('zmAutoLogin', function($interval, ZMDataModel, $http,zm, $browser,$timeout,$q, $rootScope, $ionicLoading, $ionicPopup, $state, $ionicContentBanner) { +.factory('zmAutoLogin', function ($interval, ZMDataModel, $http, zm, $browser, $timeout, $q, $rootScope, $ionicLoading, $ionicPopup, $state, $ionicContentBanner) { var zmAutoLoginHandle; - -//------------------------------------------------------------------ -// doLogin() emits this when there is an auth error in the portal -//------------------------------------------------------------------ - - $rootScope.$on ("auth-error", function() - { - console.log ("**** ZM LOGIN ERROR INTERCEPT"); - + + //------------------------------------------------------------------ + // doLogin() emits this when there is an auth error in the portal + //------------------------------------------------------------------ + + $rootScope.$on("auth-error", function () { + console.log("**** ZM LOGIN ERROR INTERCEPT"); + var contentBannerInstance = $ionicContentBanner.show({ - text: ['ZoneMinder authentication failed', 'Please check settings'], - interval: 2000, - type: 'error', - transition: 'vertical' + text: ['ZoneMinder authentication failed', 'Please check settings'], + interval: 2000, + type: 'error', + transition: 'vertical' }); - - $timeout (function() { + + $timeout(function () { contentBannerInstance(); - },6000); - - + }, 6000); + + /*var alertPopup = $ionicPopup.alert( { title: 'Zoneminder authentication failed', @@ -277,179 +270,157 @@ angular.module('zmApp', [ alertPopup.close(); },5000);*/ - - + }); - -//------------------------------------------------------------------ -// doLogin() emits this when our auth credentials work -//------------------------------------------------------------------ - - - $rootScope.$on ("auth-success", function() - { - var contentBannerInstance = $ionicContentBanner.show({ - text: ['ZoneMinder authentication success'], - interval: 2000, - type: 'info', - transition: 'vertical' + + //------------------------------------------------------------------ + // doLogin() emits this when our auth credentials work + //------------------------------------------------------------------ + + + $rootScope.$on("auth-success", function () { + var contentBannerInstance = $ionicContentBanner.show({ + text: ['ZoneMinder authentication success'], + interval: 2000, + type: 'info', + transition: 'vertical' }); - - $timeout (function() { + + $timeout(function () { contentBannerInstance(); - },2000); - console.log ("**** ZM LOGIN SUCCESS INTERCEPT"); + }, 2000); + console.log("**** ZM LOGIN SUCCESS INTERCEPT"); }); - - -//------------------------------------------------------------------ -// doLogin() is the function that tries to login to ZM -// it also makes sure we are not back to the same page -// which actually means auth failed, but ZM treats it as a success -//------------------------------------------------------------------ - - function doLogin(str) - { + + + //------------------------------------------------------------------ + // doLogin() is the function that tries to login to ZM + // it also makes sure we are not back to the same page + // which actually means auth failed, but ZM treats it as a success + //------------------------------------------------------------------ + + function doLogin(str) { var d = $q.defer(); var ld = ZMDataModel.getLogin(); - if (ld.isUseAuth == "0") - { + if (ld.isUseAuth == "0") { $ionicLoading.hide(); - ZMDataModel.zmLog ("Authentication is disabled. Skipping login"); + ZMDataModel.zmLog("Authentication is disabled. Skipping login"); d.resolve("Login success - no auth"); return d.promise; } - console.log ("**** ZM AUTO LOGIN CALLED"); + console.log("**** ZM AUTO LOGIN CALLED"); ZMDataModel.zmLog("zmAutologin called"); - - if (str) - { - $ionicLoading.show({ + + if (str) { + $ionicLoading.show({ template: str, noBackdrop: true, duration: zm.httpTimeout }); } - - + + var loginData = ZMDataModel.getLogin(); $http({ - method:'POST', - //withCredentials: true, - url:loginData.url + '/index.php', - headers:{ - 'Content-Type': 'application/x-www-form-urlencoded', - 'Accept': 'application/json', - }, - transformRequest: function (obj) { - var str = []; - for (var p in obj) - str.push(encodeURIComponent(p) + "=" + - encodeURIComponent(obj[p])); - var foo = str.join("&"); - //console.log("****RETURNING " + foo); - return foo; - }, + method: 'POST', + //withCredentials: true, + url: loginData.url + '/index.php', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Accept': 'application/json', + }, + transformRequest: function (obj) { + var str = []; + for (var p in obj) + str.push(encodeURIComponent(p) + "=" + + encodeURIComponent(obj[p])); + var foo = str.join("&"); + //console.log("****RETURNING " + foo); + return foo; + }, + + data: { + username: loginData.username, + password: loginData.password, + action: "login", + view: "console" + } + }) + .success(function (data, status, headers) { + $ionicLoading.hide(); + + // Coming here does not mean success + // it could also be a bad login, but + // ZM returns you to login.php and returns 200 OK + // so we will check if the data has + // <title>ZM - Login</title> -- it it does then its the login page + + + if (data.indexOf(zm.loginScreenString) == -1) { + + $rootScope.loggedIntoZm = 1; + console.log("**** ZM Login OK"); + ZMDataModel.zmLog("zmAutologin successfully logged into Zoneminder"); + + d.resolve("Login Success"); + + $rootScope.$emit('auth-success', data); + $rootScope.rand = Math.floor((Math.random() * 100000) + 1); + } else // this means login error + { + $rootScope.loggedIntoZm = -1; + console.log("**** ZM Login FAILED"); + ZMDataModel.zmLog("zmAutologin Error: Bad Credentials ", "error"); + $rootScope.$emit('auth-error', "incorrect credentials"); + + d.reject("Login Error"); + } + + + return (d.promise); + + }) + .error(function (error) { + $ionicLoading.hide(); + $rootScope.loggedIntoZm = -1; + console.log("**** ZM Login FAILED"); + ZMDataModel.zmLog("zmAutologin Error " + JSON.stringify(error), "error, but not calling auth-error emit"); + // bad urls etc come here + $rootScope.$emit('auth-error', error); - data: { - username:loginData.username, - password:loginData.password, - action:"login", - view:"console" - } - }) - .success(function(data,status,headers) - { - $ionicLoading.hide(); - - // Coming here does not mean success - // it could also be a bad login, but - // ZM returns you to login.php and returns 200 OK - // so we will check if the data has - // <title>ZM - Login</title> -- it it does then its the login page - - - if (data.indexOf(zm.loginScreenString) == -1 ) - { - - $rootScope.loggedIntoZm = 1; - console.log ("**** ZM Login OK"); - ZMDataModel.zmLog("zmAutologin successfully logged into Zoneminder"); - - d.resolve("Login Success"); - - $rootScope.$emit('auth-success', data); - $rootScope.rand = Math.floor((Math.random() * 100000) + 1); - } - else // this means login error - { - $rootScope.loggedIntoZm = -1; - console.log ("**** ZM Login FAILED"); - ZMDataModel.zmLog ("zmAutologin Error: Bad Credentials ", "error"); - $rootScope.$emit('auth-error', "incorrect credentials"); - d.reject("Login Error"); - } - - - //$timeout( function() {console.log ("***** ALL COOKIES:" + JSON.stringify( $browser.cookies()));},1000); - - - - return (d.promise); - - }) - .error(function(error) - { - $ionicLoading.hide(); - $rootScope.loggedIntoZm = -1; - console.log ("**** ZM Login FAILED"); - ZMDataModel.zmLog ("zmAutologin Error " + JSON.stringify(error), "error, but not calling auth-error emit"); - // FIXME should I really emit here? This usually does not mean bad login - // that is handled in success. But looks like bad urls etc come here - $rootScope.$emit('auth-error', error); - - d.reject("Login Error"); - return d.promise; - }); + return d.promise; + }); return d.promise; - + } - function start() - { + function start() { var ld = ZMDataModel.getLogin(); - if (ld.isUseAuth == '1') - { + if (ld.isUseAuth == '1') { $rootScope.loggedIntoZm = 0; $interval.cancel(zmAutoLoginHandle); //doLogin(); - zmAutoLoginHandle = $interval(function() - { + zmAutoLoginHandle = $interval(function () { doLogin(""); - },zm.loginInterval); // Auto login every 5 minutes - // PHP timeout is around 10 minutes - // should be ok? - } - else - { - ZMDataModel.zmLog ("Authentication not enabled. Skipping Timer"); + }, zm.loginInterval); // Auto login every 5 minutes + // PHP timeout is around 10 minutes + // should be ok? + } else { + ZMDataModel.zmLog("Authentication not enabled. Skipping Timer"); } } - function stop() - { + + function stop() { var ld = ZMDataModel.getLogin(); - if (ld.isUseAuth == '1') - { + if (ld.isUseAuth == '1') { $interval.cancel(zmAutoLoginHandle); $rootScope.loggedIntoZm = 0; ZMDataModel.zmLog("Cancelling zmAutologin timer"); - } - else - { - ZMDataModel.zmLog ("No need to cancel zmAutologin timer. Auth is off"); + } else { + ZMDataModel.zmLog("No need to cancel zmAutologin timer. Auth is off"); } } @@ -461,236 +432,191 @@ angular.module('zmApp', [ }) +//------------------------------------------------------------------ +// First run in ionic +//------------------------------------------------------------------ - - - +.run(function ($ionicPlatform, $ionicPopup, $rootScope, zm, $state, $stateParams, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, $fileLogger, $timeout, $ionicHistory, $window, $ionicSideMenuDelegate) { + $rootScope.zmGlobalCookie = ""; + $rootScope.isEventFilterOn = false; + $rootScope.fromDate = ""; + $rootScope.fromTime = ""; + $rootScope.toDate = ""; + $rootScope.toTime = ""; + $rootScope.fromString = ""; + $rootScope.toString = ""; + $rootScope.loggedIntoZm = 0; -/* 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); - } - }; -}) -*/ + ZMDataModel.init(); + // for making sure we canuse $state.go with ng-click + // needed for views that use popovers + $rootScope.$state = $state; + $rootScope.$stateParams = $stateParams; -//------------------------------------------------------------------ -// First run in ionic -//------------------------------------------------------------------ + var loginData = ZMDataModel.getLogin(); -.run(function ($ionicPlatform, $ionicPopup, $rootScope, zm, $state, $stateParams, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, $fileLogger,$timeout, $ionicHistory, $window, $ionicSideMenuDelegate) -{ - - $rootScope.zmGlobalCookie=""; - $rootScope.isEventFilterOn = false; - $rootScope.fromDate = ""; - $rootScope.fromTime= ""; - $rootScope.toDate = ""; - $rootScope.toTime=""; - $rootScope.fromString=""; - $rootScope.toString=""; - $rootScope.loggedIntoZm = 0; - - ZMDataModel.init(); - // for making sure we canuse $state.go with ng-click - // needed for views that use popovers - $rootScope.$state = $state; - $rootScope.$stateParams = $stateParams; - - var loginData = ZMDataModel.getLogin(); - - - - // This code takes care of trapping the Android back button - // and takes it to the menu. - $ionicPlatform.registerBackButtonAction(function(e) { - e.preventDefault(); - if (!$ionicSideMenuDelegate.isOpenLeft()) { - $ionicSideMenuDelegate.toggleLeft(); - console.log ("Status of SIDE MENU IS : " + $ionicSideMenuDelegate.isOpen()); - } else { - navigator.app.exitApp(); - } - }, 1000); - // this works reliably on both Android and iOS. The "onorientation" seems to reverse w/h in Android. Go figure. - // http://stackoverflow.com/questions/1649086/detect-rotation-of-android-phone-in-the-browser-with-javascript + // This code takes care of trapping the Android back button + // and takes it to the menu. + $ionicPlatform.registerBackButtonAction(function (e) { + e.preventDefault(); + if (!$ionicSideMenuDelegate.isOpenLeft()) { + $ionicSideMenuDelegate.toggleLeft(); + console.log("Status of SIDE MENU IS : " + $ionicSideMenuDelegate.isOpen()); + } else { + navigator.app.exitApp(); + } + }, 1000); - var checkOrientation = function () { - var pixelRatio = window.devicePixelRatio || 1; - $rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width); - $rootScope.devHeight = ((window.innerHeight > 0) ? window.innerHeight : screen.height); - console.log("********NEW Computed Dev Width & Height as" + $rootScope.devWidth + "*" + $rootScope.devHeight); + // this works reliably on both Android and iOS. The "onorientation" seems to reverse w/h in Android. Go figure. + // http://stackoverflow.com/questions/1649086/detect-rotation-of-android-phone-in-the-browser-with-javascript + var checkOrientation = function () { + var pixelRatio = window.devicePixelRatio || 1; + $rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width); + $rootScope.devHeight = ((window.innerHeight > 0) ? window.innerHeight : screen.height); + console.log("********NEW Computed Dev Width & Height as" + $rootScope.devWidth + "*" + $rootScope.devHeight); - //ZMDataModel.zmLog("Device orientation change: "+$rootScope.devWidth + "*" + $rootScope.devHeight); }; - window.addEventListener("resize", checkOrientation, false); + window.addEventListener("resize", checkOrientation, false); - $rootScope.$on('$stateChangeStart', function (event, toState, toParams) { - var requireLogin = toState.data.requireLogin; + $rootScope.$on('$stateChangeStart', function (event, toState, toParams) { + var requireLogin = toState.data.requireLogin; - if (ZMDataModel.isLoggedIn()) { - console.log("State transition is authorized"); - return; - } - - if (requireLogin) { + if (ZMDataModel.isLoggedIn()) { + console.log("State transition is authorized"); + return; + } - console.log("**** STATE from " + "**** STATE TO " + toState.name); + if (requireLogin) { - $ionicPopup.alert({ - title: "Credentials Required", - template: "Please provide your ZoneMinder credentials" - }); - // for whatever reason, .go was resulting in digest loops. - // if you don't prevent, states will stack - event.preventDefault(); - $state.transitionTo('login'); - } + $ionicPopup.alert({ + title: "Credentials Required", + template: "Please provide your ZoneMinder credentials" + }); + // for whatever reason, .go was resulting in digest loops. + // if you don't prevent, states will stack + event.preventDefault(); + $state.transitionTo('login'); + } - }); + }); - - - $ionicPlatform.ready(function () { - // generates and error in desktops but works fine - ZMDataModel.zmLog("Device is ready"); - console.log("**** DEVICE READY ***"); + $ionicPlatform.ready(function () { - $fileLogger.checkFile().then(function(resp) { - if (parseInt(resp.size) > zm.logFileMaxSize) - { - console.log ("Deleting old log file as it exceeds " + zm.logFileMaxSize+" bytes"); - $fileLogger.deleteLogfile().then(function() - { - console.log('Logfile deleted'); - }); - } - else - { - console.log ("Log file size is " + resp.size + " bytes"); - } + // generates and error in desktops but works fine + ZMDataModel.zmLog("Device is ready"); + console.log("**** DEVICE READY ***"); + $fileLogger.checkFile().then(function (resp) { + if (parseInt(resp.size) > zm.logFileMaxSize) { + console.log("Deleting old log file as it exceeds " + zm.logFileMaxSize + " bytes"); + $fileLogger.deleteLogfile().then(function () { + console.log('Logfile deleted'); + }); + } else { + console.log("Log file size is " + resp.size + " bytes"); + } - }); - //fileLogger is an excellent cross platform library - // that allows you to manage log files without worrying about - // paths etc.https://github.com/pbakondy/filelogger - $fileLogger.setStorageFilename(zm.logFile); - // easier tz reading - $fileLogger.setTimestampFormat('medium'); - - if (window.cordova) - { - // getAppVersion is a handy library - // that lets you extract the app version in config.xml - // given that you are always changing versions while - // uploading to app/play stores, this is very useful - // to keep in sync and use within your app - - cordova.getAppVersion(function(version) { - appVersion = version; - ZMDataModel.zmLog ("zmNinja Version: " + appVersion); - ZMDataModel.setAppVersion(appVersion); }); - } + //fileLogger is an excellent cross platform library + // that allows you to manage log files without worrying about + // paths etc.https://github.com/pbakondy/filelogger + $fileLogger.setStorageFilename(zm.logFile); + // easier tz reading + $fileLogger.setTimestampFormat('medium'); + + if (window.cordova) { + // getAppVersion is a handy library + // that lets you extract the app version in config.xml + // given that you are always changing versions while + // uploading to app/play stores, this is very useful + // to keep in sync and use within your app + + cordova.getAppVersion(function (version) { + appVersion = version; + ZMDataModel.zmLog("zmNinja Version: " + appVersion); + ZMDataModel.setAppVersion(appVersion); + }); - setTimeout(function () { - if (window.cordova) - { - $cordovaSplashscreen.hide(); } - }, 2000); - - /*if(window.navigator && window.navigator.splashscreen) { - window.navigator.splashscreen.hide(); - console.log ("Unlocking portrait mode after splash"); - window.plugins.orientationLock.unlock(); - }*/ - var pixelRatio = window.devicePixelRatio || 1; - $rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width); - $rootScope.devHeight = ((window.innerHeight > 0) ? window.innerHeight : screen.height); - - console.log("********Computed Dev Width & Height as" + $rootScope.devWidth + "*" + $rootScope.devHeight); + setTimeout(function () { + if (window.cordova) { + $cordovaSplashscreen.hide(); + } + }, 2000); - // What I noticed is when I moved the app to the device - // the montage screens were not redrawn after resuming from background mode - // Everything was fine if I switched back to the montage screen - // so as a global hack I'm just reloading the current state if you switch - // from foreground to background and back - document.addEventListener("resume", function () { - console.log("****The application is resuming from the background"); - ZMDataModel.zmLog("App is resuming from background"); - $rootScope.rand = Math.floor((Math.random() * 100000) + 1); - //$scope.rand = Math.floor((Math.random() * 100000) + 1); - console.log("** generated Random of " + $rootScope.rand); - zmAutoLogin.stop(); //safety - zmAutoLogin.start(); - zmAutoLogin.doLogin("authenticating ..."); + /*if(window.navigator && window.navigator.splashscreen) { + window.navigator.splashscreen.hide(); + console.log ("Unlocking portrait mode after splash"); + window.plugins.orientationLock.unlock(); + }*/ + + var pixelRatio = window.devicePixelRatio || 1; + $rootScope.devWidth = ((window.innerWidth > 0) ? window.innerWidth : screen.width); + $rootScope.devHeight = ((window.innerHeight > 0) ? window.innerHeight : screen.height); + + console.log("********Computed Dev Width & Height as" + $rootScope.devWidth + "*" + $rootScope.devHeight); + + // What I noticed is when I moved the app to the device + // the montage screens were not redrawn after resuming from background mode + // Everything was fine if I switched back to the montage screen + // so as a global hack I'm just reloading the current state if you switch + // from foreground to background and back + document.addEventListener("resume", function () { + console.log("****The application is resuming from the background"); + ZMDataModel.zmLog("App is resuming from background"); + $rootScope.rand = Math.floor((Math.random() * 100000) + 1); + //$scope.rand = Math.floor((Math.random() * 100000) + 1); + console.log("** generated Random of " + $rootScope.rand); + zmAutoLogin.stop(); //safety + zmAutoLogin.start(); + zmAutoLogin.doLogin("authenticating ..."); - }, false); + }, false); - document.addEventListener("pause", function () { - console.log("****The application is going into background"); - ZMDataModel.zmLog("App is going into background"); - zmAutoLogin.stop(); + document.addEventListener("pause", function () { + console.log("****The application is going into background"); + ZMDataModel.zmLog("App is going into background"); + zmAutoLogin.stop(); - }, false); + }, false); - if (window.cordova && window.cordova.plugins.Keyboard) { - cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); - // solves screen bouncing on form input - // since I am using JS Scroll - cordova.plugins.Keyboard.disableScroll(true); - } - if (window.StatusBar) { - // org.apache.cordova.statusbar required - StatusBar.styleDefault(); - } + if (window.cordova && window.cordova.plugins.Keyboard) { + cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); + // solves screen bouncing on form input + // since I am using JS Scroll + cordova.plugins.Keyboard.disableScroll(true); + } + if (window.StatusBar) { + // org.apache.cordova.statusbar required + StatusBar.styleDefault(); + } - }); //platformReady + }); //platformReady - // lets POST so we get a session ID right hre + // lets POST so we get a session ID right hre - console.log ("Setting up POST LOGIN timer"); - zmAutoLogin.start(); + console.log("Setting up POST LOGIN timer"); + zmAutoLogin.start(); -}) //run + }) //run //------------------------------------------------------------------ // Route configuration @@ -701,8 +627,6 @@ angular.module('zmApp', [ // If you do this, Allow Origin can't be * //$httpProvider.defaults.withCredentials = true; $httpProvider.interceptors.push('timeoutHttpIntercept'); - //$httpProvider.interceptors.push('httpAuthIntercept'); - $stateProvider .state('login', { @@ -725,11 +649,11 @@ angular.module('zmApp', [ }) .state('app', { - url: '/', - abstract: true, - templateUrl: 'index.html', - cache:false, - //controller: 'AppCtrl' + url: '/', + abstract: true, + templateUrl: 'index.html', + cache: false, + //controller: 'AppCtrl' }) @@ -775,7 +699,7 @@ angular.module('zmApp', [ }) - .state('events-date-time-filter', { + .state('events-date-time-filter', { data: { requireLogin: true }, @@ -802,7 +726,7 @@ angular.module('zmApp', [ controller: 'zmApp.DevOptionsCtrl', }) - .state('timeline', { + .state('timeline', { data: { requireLogin: true }, @@ -826,8 +750,8 @@ angular.module('zmApp', [ templateUrl: "templates/log.html", controller: 'zmApp.LogCtrl', }) - - .state('zm-portal-login', { + + .state('zm-portal-login', { data: { requireLogin: false }, @@ -841,16 +765,19 @@ angular.module('zmApp', [ requireLogin: true }, resolve: { - message: function (ZMDataModel) { + message: function (ZMDataModel) { console.log("Inside app.events resolve"); return ZMDataModel.getMonitors(0); - } - + } + }, url: "/montage", templateUrl: "templates/montage.html", controller: 'zmApp.MontageCtrl', - params: {minimal:false, isRefresh:false} + params: { + minimal: false, + isRefresh: false + } }); @@ -869,8 +796,8 @@ angular.module('zmApp', [ $urlRouterProvider.otherwise(function ($injector, $location) { var $state = $injector.get("$state"); - console.log ("** PORTAL LOGIN STATE"); + console.log("** PORTAL LOGIN STATE"); $state.go("zm-portal-login"); }); -}); //config +}); //config
\ No newline at end of file diff --git a/www/js/controllers.js b/www/js/controllers.js index 8ea39044..fa18a330 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -18,24 +18,7 @@ angular.module('zmApp.controllers', ['ionic', 'ngCordova', 'ng-mfb','angularCirc $rootScope.stateofSlide = $ionicSideMenuDelegate.isOpen() + new Date(); },500); - /* $timeout ( function() { - - - if ($ionicSideMenuDelegate.$getByHandle('sideMenu').isOpenLeft()) - { - console.log ("**** EXITING APP ****"); - } - else - { - console.log ("**** GOING TO SLIDE MENU"); - // $ionicSideMenuDelegate.toggleLeft(); - $ionicSideMenuDelegate.$getByHandle('sideMenu').toggleLeft(); - } - - - },100);*/ - - + }, 100); }); |
