summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/js/DevOptionsCtrl.js70
-rw-r--r--www/js/EventCtrl.js422
-rw-r--r--www/js/EventDateTimeFilterCtrl.js142
-rw-r--r--www/js/EventsGraphsCtrl.js67
-rw-r--r--www/js/LoginCtrl.js272
-rw-r--r--www/js/ModalCtrl.js258
-rw-r--r--www/js/MonitorCtrl.js126
-rw-r--r--www/js/MontageCtrl.js455
-rw-r--r--www/js/PortalLoginCtrl.js206
-rw-r--r--www/js/StateCtrl.js185
-rw-r--r--www/js/TimelineCtrl.js317
-rw-r--r--www/js/app.js158
12 files changed, 1307 insertions, 1371 deletions
diff --git a/www/js/DevOptionsCtrl.js b/www/js/DevOptionsCtrl.js
index b711a373..98ee9160 100644
--- a/www/js/DevOptionsCtrl.js
+++ b/www/js/DevOptionsCtrl.js
@@ -2,7 +2,7 @@
/* jslint browser: true*/
/* global cordova,StatusBar,angular,console */
-angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope', '$rootScope', '$ionicModal','zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', function ($scope, $rootScope, $ionicModal,zm, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading) {
+angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope', '$rootScope', '$ionicModal', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', function ($scope, $rootScope, $ionicModal, zm, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading) {
$scope.openMenu = function () {
@@ -21,47 +21,51 @@ angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope'
ZMDataModel.setAwake(false);
});
-//------------------------------------------------------------------
-// Perform the login action when the user submits the login form
-//------------------------------------------------------------------
+ //------------------------------------------------------------------
+ // Perform the login action when the user submits the login form
+ //------------------------------------------------------------------
$scope.saveDevOptions = function () {
- ZMDataModel.zmDebug ("SaveDevOptions: called");
+ ZMDataModel.zmDebug("SaveDevOptions: called");
+
+ if (parseInt($scope.loginData.maxMontage) > zm.safeMontageLimit) {
+ $ionicPopup.alert({
+ title: 'Note',
+ template: 'You have selected to view more than 10 monitors in the Montage screen. Note that this is very resource intensive and may load the server or cause issues in the application. If you are not sure, please consider limiting this value to 10'
+ });
+ ZMDataModel.zmDebug("SaveDevOptions: " + $scope.loginData.maxMontage +
+ " monitors for montage");
+ }
- if (parseInt($scope.loginData.maxMontage) > zm.safeMontageLimit) {
- $ionicPopup.alert({
- title: 'Note',
- template: 'You have selected to view more than 10 monitors in the Montage screen. Note that this is very resource intensive and may load the server or cause issues in the application. If you are not sure, please consider limiting this value to 10'
- });
- ZMDataModel.zmDebug ("SaveDevOptions: " + $scope.loginData.maxMontage + " monitors for montage");
- }
+ if ((parseInt($scope.loginData.maxFPS) < 0) || (parseInt($scope.loginData.maxFPS) > zm.maxFPS)) {
+ $scope.loginData.maxFPS = zm.defaultFPS.toString();
+ }
- if ((parseInt($scope.loginData.maxFPS) < 0) || (parseInt($scope.loginData.maxFPS) > zm.maxFPS)) {
- $scope.loginData.maxFPS = zm.defaultFPS.toString();
- }
-
- if (parseInt($scope.loginData.refeshSec) <=0)
- {
- ZMDataModel.zmDebug ("SaveDevOptions: refresh sec was too low at " + $scope.loginData.refreshSec+ " reset to 1");
- $scope.loginData.refreshSec=1;
-
- }
+ if (parseInt($scope.loginData.refeshSec) <= 0) {
+ ZMDataModel.zmDebug("SaveDevOptions: refresh sec was too low at " +
+ $scope.loginData.refreshSec + " reset to 1");
+ $scope.loginData.refreshSec = 1;
+ }
- if ((parseInt($scope.loginData.montageQuality) < zm.safeMontageLimit) || (parseInt($scope.loginData.montageQuality) > 70)) {
- $scope.loginData.montageQuality = zm.defaultMontageQuality.toString();
- }
+ if ((parseInt($scope.loginData.montageQuality) < zm.safeMontageLimit) ||
+ (parseInt($scope.loginData.montageQuality) > 70)) {
+ $scope.loginData.montageQuality = zm.defaultMontageQuality.toString();
+ }
- ZMDataModel.zmDebug ("SaveDevOptions: Saving to disk");
- ZMDataModel.setLogin($scope.loginData);
+
+ ZMDataModel.zmDebug("SaveDevOptions: Saving to disk");
+ ZMDataModel.setLogin($scope.loginData);
$ionicPopup.alert({
- title: 'Settings Saved',
- template: 'Please explore the menu and enjoy zmNinja!'
- }).then(function(res) { $ionicSideMenuDelegate.toggleLeft();});
-};
- //------------------------------------------------------------------
+ title: 'Settings Saved',
+ template: 'Please explore the menu and enjoy zmNinja!'
+ }).then(function (res) {
+ $ionicSideMenuDelegate.toggleLeft();
+ });
+ };
+ //------------------------------------------------------------------
// controller main
//------------------------------------------------------------------
@@ -70,4 +74,4 @@ angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope'
-}]);
+}]); \ No newline at end of file
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index 27c12c20..6bd711e3 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -7,7 +7,7 @@
// and whether the new API has a better mechanism
angular.module('zmApp.controllers')
- .controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', '$ionicPopup',function ($scope, $rootScope, zm, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover, $ionicPopup) {
+ .controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', '$ionicPopup', function ($scope, $rootScope, zm, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover, $ionicPopup) {
// events in last 5 minutes
// TODO https://server/zm/api/events/consoleEvents/5%20minute.json
@@ -15,14 +15,16 @@ angular.module('zmApp.controllers')
//---------------------------------------------------
// Controller main
//---------------------------------------------------
-
+
$scope.hours = [];
$scope.days = [];
$scope.weeks = [];
$scope.months = [];
-
- $scope.eventList = {showDelete:false};
-
+
+ $scope.eventList = {
+ showDelete: false
+ };
+
$scope.slides = []; // will hold scrub frames
var segmentHandle = 0; // holds timer for progress bar
$scope.totalEventTime = 0; // used to display max of progress bar
@@ -36,7 +38,7 @@ angular.module('zmApp.controllers')
console.log("I got STATE PARAM " + $stateParams.id);
$scope.id = parseInt($stateParams.id, 10);
$scope.connKey = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111;
-
+
$ionicPopover.fromTemplateUrl('templates/events-popover.html', {
scope: $scope,
@@ -117,24 +119,24 @@ angular.module('zmApp.controllers')
// First get total pages and then
// start from the latest. If this fails, nothing displays
-
- ZMDataModel.zmDebug ("EventCtrl: grabbing # of event pages");
+
+ ZMDataModel.zmDebug("EventCtrl: grabbing # of event pages");
ZMDataModel.getEventsPages($scope.id, $rootScope.fromString, $rootScope.toString)
.then(function (data) {
eventsPage = data.pageCount;
- ZMDataModel.zmDebug ("EventCtrl: found " + eventsPage + " pages of events");
+ ZMDataModel.zmDebug("EventCtrl: found " + eventsPage + " pages of events");
//console.log("TOTAL EVENT PAGES IS " + eventsPage);
pageLoaded = true;
$scope.viewTitle.title = data.count;
- ZMDataModel.zmDebug ("EventCtrl: grabbing events for: id="+$scope.id+" Date/Time:" + $rootScope.fromString +
- "-" + $rootScope.toString);
+ ZMDataModel.zmDebug("EventCtrl: grabbing events for: id=" + $scope.id + " Date/Time:" + $rootScope.fromString +
+ "-" + $rootScope.toString);
ZMDataModel.getEvents($scope.id, eventsPage, "", $rootScope.fromString, $rootScope.toString)
.then(function (data) {
console.log("EventCtrl Got events");
//var events = [];
-
+
var myevents = data;
- ZMDataModel.zmDebug ("EventCtrl: success, got " + myevents.length + " events");
+ ZMDataModel.zmDebug("EventCtrl: success, got " + myevents.length + " events");
var loginData = ZMDataModel.getLogin();
for (var i = 0; i < myevents.length; i++) {
@@ -169,15 +171,15 @@ angular.module('zmApp.controllers')
hh + "/" +
min + "/" +
sec + "/";
-
- if (i==0) // just for debug sampling to see what we are getting
+
+ if (i == 0) // just for debug sampling to see what we are getting
{
- ZMDataModel.zmDebug ("EventCtrl: Sample data from first event: " + JSON.stringify(myevents[i]));
+ ZMDataModel.zmDebug("EventCtrl: Sample data from first event: " + JSON.stringify(myevents[i]));
}
} //for
-
+
$scope.events = myevents;
// we only need to stop the template from loading when the list is empty
// so this can be false once we have _some_ content
@@ -186,8 +188,7 @@ angular.module('zmApp.controllers')
// to avoid only few events being displayed
// if last page has less events
//console.log("**Loading Next Page ***");
- if (myevents.length < 50)
- {
+ if (myevents.length < 50) {
ZMDataModel.zmDebug("EventCtrl:loading one more page just in case we don't have enough to display");
loadMore();
}
@@ -197,222 +198,224 @@ angular.module('zmApp.controllers')
// not explictly handling error --> I have a default "No events found" message
// displayed in the template if events list is null
-
-
- $scope.showEvents = function(val,unit,monitorId)
- {
- ZMDataModel.zmDebug("ShowEvents called with val:"+val+" unit:"+unit+" for Monitor:"+monitorId);
-
- $ionicHistory.nextViewOptions({
- disableBack: true
- });
-
- var mToDate = moment();
-
- var mFromDate = moment().subtract(parseInt(val),unit);
-
- console.log ("Moment Dates:" + mFromDate.format() + " TO " + mToDate.format());
-
- $rootScope.fromTime = mFromDate.toDate();
- $rootScope.toTime =mToDate.toDate();
- $rootScope.fromDate = $rootScope.fromTime;
- $rootScope.toDate = $rootScope.toTime;
-
- ZMDataModel.zmDebug ("From: " + $rootScope.fromTime);
- ZMDataModel.zmDebug ("To: " + $rootScope.toTime);
-
- //$rootScope.fromDate = fromDate.toDate();
- //$rootScope.toDate = toDate.toDate();
- $rootScope.isEventFilterOn = true;
- $rootScope.fromString = mFromDate
- .format("YYYY-MM-DD") + " " + mFromDate.format ("HH:mm:ss");
-
- $rootScope.toString = mToDate
- .format("YYYY-MM-DD") + " " + mToDate
- .format ("HH:mm:ss");
-
-
- console.log ("**************From String: " + $rootScope.fromString);
- console.log ("**************To String: " + $rootScope.toString);
-
- $state.go("events", {"id":monitorId});
+
+ //--------------------------------------------------------------------------
+ // This is what the pullup bar calls depending on what range is specified
+ //--------------------------------------------------------------------------
+ $scope.showEvents = function (val, unit, monitorId) {
+ ZMDataModel.zmDebug("ShowEvents called with val:" + val + " unit:" + unit + " for Monitor:" + monitorId);
+
+ $ionicHistory.nextViewOptions({
+ disableBack: true
+ });
+
+ var mToDate = moment();
+
+ var mFromDate = moment().subtract(parseInt(val), unit);
+
+ console.log("Moment Dates:" + mFromDate.format() + " TO " + mToDate.format());
+
+ $rootScope.fromTime = mFromDate.toDate();
+ $rootScope.toTime = mToDate.toDate();
+ $rootScope.fromDate = $rootScope.fromTime;
+ $rootScope.toDate = $rootScope.toTime;
+
+ ZMDataModel.zmDebug("From: " + $rootScope.fromTime);
+ ZMDataModel.zmDebug("To: " + $rootScope.toTime);
+
+ //$rootScope.fromDate = fromDate.toDate();
+ //$rootScope.toDate = toDate.toDate();
+ $rootScope.isEventFilterOn = true;
+ $rootScope.fromString = mFromDate
+ .format("YYYY-MM-DD") + " " + mFromDate.format("HH:mm:ss");
+
+ $rootScope.toString = mToDate
+ .format("YYYY-MM-DD") + " " + mToDate
+ .format("HH:mm:ss");
+
+
+ console.log("**************From String: " + $rootScope.fromString);
+ console.log("**************To String: " + $rootScope.toString);
+
+ $state.go("events", {
+ "id": monitorId
+ });
};
-
-
- $scope.deleteEvent = function (id, itemid)
- {
+
+ //--------------------------------------------------------------------------
+ // Takes care of deleting individual events
+ //--------------------------------------------------------------------------
+ $scope.deleteEvent = function (id, itemid) {
//$scope.eventList.showDelete = false;
- //curl -XDELETE http://server/zm/api/events/1.json
- var loginData = ZMDataModel.getLogin();
- var apiDelete = loginData.apiurl + "/events/" + id + ".json";
- ZMDataModel.zmDebug("DeleteEvent: ID="+id+" item="+itemid);
- ZMDataModel.zmLog("Delete event " + apiDelete);
-
- $ionicLoading.show({
+ //curl -XDELETE http://server/zm/api/events/1.json
+ var loginData = ZMDataModel.getLogin();
+ var apiDelete = loginData.apiurl + "/events/" + id + ".json";
+ ZMDataModel.zmDebug("DeleteEvent: ID=" + id + " item=" + itemid);
+ ZMDataModel.zmLog("Delete event " + apiDelete);
+
+ $ionicLoading.show({
template: "deleting event...",
noBackdrop: true,
duration: zm.httpTimeout
});
-
- $http.delete(apiDelete)
- .success(function(data)
- {
- $ionicLoading.hide();
- ZMDataModel.zmDebug ("delete success: " + JSON.stringify(data));
- ZMDataModel.displayBanner ('info', ['deleted event'],2000,2000);
-
-
- /*var element = angular.element(document.getElementById("item-"+itemid));
- element.addClass("eventDeleteSpeed animated slideOutLeft")
- .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',
-
- function () {
- // element.removeClass("animated slideOutLeft");
- });
- $ionicScrollDelegate.$getByHandle("mainScroll").resize();*/
-
- $scope.events.splice(itemid, 1);
- //doRefresh();
-
- })
- .error (function (data)
- {
- $ionicLoading.hide();
- ZMDataModel.zmDebug ("delete error: " + JSON.stringify(data));
- ZMDataModel.displayBanner ('error', ['could not delete event', 'please check logs']);
- });
-
-
- };
-
+
+ $http.delete(apiDelete)
+ .success(function (data) {
+ $ionicLoading.hide();
+ ZMDataModel.zmDebug("delete success: " + JSON.stringify(data));
+ ZMDataModel.displayBanner('info', ['deleted event'], 2000, 2000);
+
+ $scope.events.splice(itemid, 1);
+ //doRefresh();
+
+ })
+ .error(function (data) {
+ $ionicLoading.hide();
+ ZMDataModel.zmDebug("delete error: " + JSON.stringify(data));
+ ZMDataModel.displayBanner('error', ['could not delete event', 'please check logs']);
+ });
+
+
+ };
+
//------------------------------------------------
// Tapping on the filter sign lets you reset it
//-------------------------------------------------
-
- $scope.filterTapped = function()
- {
- console.log ("FILTER TAPPED");
+
+ $scope.filterTapped = function () {
+ console.log("FILTER TAPPED");
var myFrom = moment($rootScope.fromString).format("MMM/DD/YYYY hh:mm a").toString();
var toString = moment($rootScope.toString).format("MMM/DD/YYYY hh:mm a").toString();
-
- var confirmPopup = $ionicPopup.confirm({
- title: 'Filter settings',
- template: 'You are viewing Events between:<br/> <b>' + myFrom + "</b> to <b>" + toString +'</b><br/>Do you want to delete this filter?'
- });
- confirmPopup.then(function(res) {
- if(res) {
- ZMDataModel.zmLog("Filter reset requested in popup");
+
+ var confirmPopup = $ionicPopup.confirm({
+ title: 'Filter settings',
+ template: 'You are viewing Events between:<br/> <b>' + myFrom + "</b> to <b>" + toString + '</b><br/>Do you want to delete this filter?'
+ });
+ confirmPopup.then(function (res) {
+ if (res) {
+ ZMDataModel.zmLog("Filter reset requested in popup");
$rootScope.isEventFilterOn = false;
$rootScope.fromDate = "";
- $rootScope.fromTime= "";
+ $rootScope.fromTime = "";
$rootScope.toDate = "";
- $rootScope.toTime="";
- $rootScope.fromString="";
- $rootScope.toString="";
- $ionicHistory.nextViewOptions({
- disableBack: true
- });
- $state.go("events", {"id":0});
- } else {
- ZMDataModel.zmLog("Filter reset cancelled in popup");
- }
- });
+ $rootScope.toTime = "";
+ $rootScope.fromString = "";
+ $rootScope.toString = "";
+ $ionicHistory.nextViewOptions({
+ disableBack: true
+ });
+ $state.go("events", {
+ "id": 0
+ });
+ } else {
+ ZMDataModel.zmLog("Filter reset cancelled in popup");
+ }
+ });
};
-
- $scope.footerExpand = function()
- {
+
+ //--------------------------------------------------------------------------
+ // When the user pulls the pullup bar we call this to get the latest
+ // data for events ranges summaries using the consolveEvents facility of ZM
+ //--------------------------------------------------------------------------
+
+ $scope.footerExpand = function () {
//https://server/zm/api/events/consoleEvents/5%20minute.json
var ld = ZMDataModel.getLogin();
-
+
var apiurl = ld.apiurl + "/events/consoleEvents/1%20hour.json";
$http.get(apiurl)
- .success(function(data) {
- ZMDataModel.zmDebug(JSON.stringify(data));
- $scope.hours = [];
- var p = data.results;
- for (var key in data.results)
- {
- if (p.hasOwnProperty(key)) {
- //console.log(ZMDataModel.getMonitorName(key) + " -> " + p[key]);
- $scope.hours.push(
- {monitor:ZMDataModel.getMonitorName(key),
- events:p[key], mid:key});
-
+ .success(function (data) {
+ ZMDataModel.zmDebug(JSON.stringify(data));
+ $scope.hours = [];
+ var p = data.results;
+ for (var key in data.results) {
+ if (p.hasOwnProperty(key)) {
+ //console.log(ZMDataModel.getMonitorName(key) + " -> " + p[key]);
+ $scope.hours.push({
+ monitor: ZMDataModel.getMonitorName(key),
+ events: p[key],
+ mid: key
+ });
+
+ }
}
- }
- });
-
-
+ });
+
+
apiurl = ld.apiurl + "/events/consoleEvents/1%20day.json";
$http.get(apiurl)
- .success(function(data) {
- ZMDataModel.zmDebug(JSON.stringify(data));
- $scope.days = [];
- var p = data.results;
- for (var key in data.results)
- {
- if (p.hasOwnProperty(key)) {
- //console.log(ZMDataModel.getMonitorName(key) + " -> " + p[key]);
- $scope.days.push(
- {monitor:ZMDataModel.getMonitorName(key),
- events:p[key],mid:key});
-
+ .success(function (data) {
+ ZMDataModel.zmDebug(JSON.stringify(data));
+ $scope.days = [];
+ var p = data.results;
+ for (var key in data.results) {
+ if (p.hasOwnProperty(key)) {
+ //console.log(ZMDataModel.getMonitorName(key) + " -> " + p[key]);
+ $scope.days.push({
+ monitor: ZMDataModel.getMonitorName(key),
+ events: p[key],
+ mid: key
+ });
+
+ }
}
- }
- });
+ });
+
-
-
- apiurl = ld.apiurl + "/events/consoleEvents/1%20week.json";
+
+ apiurl = ld.apiurl + "/events/consoleEvents/1%20week.json";
$http.get(apiurl)
- .success(function(data) {
- ZMDataModel.zmDebug(JSON.stringify(data));
- $scope.weeks = [];
- var p = data.results;
- for (var key in data.results)
- {
- if (p.hasOwnProperty(key)) {
- //console.log(ZMDataModel.getMonitorName(key) + " -> " + p[key]);
- $scope.weeks.push(
- {monitor:ZMDataModel.getMonitorName(key),
- events:p[key],mid:key});
-
+ .success(function (data) {
+ ZMDataModel.zmDebug(JSON.stringify(data));
+ $scope.weeks = [];
+ var p = data.results;
+ for (var key in data.results) {
+ if (p.hasOwnProperty(key)) {
+ //console.log(ZMDataModel.getMonitorName(key) + " -> " + p[key]);
+ $scope.weeks.push({
+ monitor: ZMDataModel.getMonitorName(key),
+ events: p[key],
+ mid: key
+ });
+
+ }
}
- }
- });
-
-
+ });
+
+
apiurl = ld.apiurl + "/events/consoleEvents/1%20month.json";
$http.get(apiurl)
- .success(function(data) {
- ZMDataModel.zmDebug(JSON.stringify(data));
- $scope.months = [];
- var p = data.results;
- for (var key in data.results)
- {
- if (p.hasOwnProperty(key)) {
- //console.log(ZMDataModel.getMonitorName(key) + " -> " + p[key]);
- $scope.months.push(
- {monitor:ZMDataModel.getMonitorName(key),
- events:p[key],mid:key});
-
+ .success(function (data) {
+ ZMDataModel.zmDebug(JSON.stringify(data));
+ $scope.months = [];
+ var p = data.results;
+ for (var key in data.results) {
+ if (p.hasOwnProperty(key)) {
+ //console.log(ZMDataModel.getMonitorName(key) + " -> " + p[key]);
+ $scope.months.push({
+ monitor: ZMDataModel.getMonitorName(key),
+ events: p[key],
+ mid: key
+ });
+
+ }
}
- }
- });
-
-
-
-
-
+ });
+
+
};
+ //--------------------------------------------------------------------------
+ // This is used to compute automatic playback speed for event playback
+ // and scrub
+ //--------------------------------------------------------------------------
+
$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)));
};
@@ -435,7 +438,7 @@ angular.module('zmApp.controllers')
// called when user switches to background
//-------------------------------------------------------------------------
function onPause() {
- ZMDataModel.zmDebug ("EventCtrl:onpause called");
+ ZMDataModel.zmDebug("EventCtrl:onpause called");
console.log("*** Moving to Background ***"); // Handle the pause event
console.log("*** CANCELLING INTERVAL ****");
if ($scope.popover) $scope.popover.remove();
@@ -468,7 +471,7 @@ angular.module('zmApp.controllers')
// FIXME: Are we using this?
//-------------------------------------------------------------------------
$scope.disableSlide = function () {
- ZMDataModel.zmDebug ("EventCtrl:DisableSlide called");
+ ZMDataModel.zmDebug("EventCtrl:DisableSlide called");
$ionicSlideBoxDelegate.$getByHandle("eventSlideBox").enableSlide(false);
};
@@ -510,7 +513,7 @@ angular.module('zmApp.controllers')
if (oldEvent && event != oldEvent) {
console.log("SWITCHING OLD EVENT OFF");
- ZMDataModel.zmDebug ("EventCtrl:Old event scrub will hide now");
+ ZMDataModel.zmDebug("EventCtrl:Old event scrub will hide now");
oldEvent.Event.ShowScrub = false;
oldEvent.Event.height = zm.eventsListDetailsHeight;
oldEvent = "";
@@ -521,7 +524,7 @@ angular.module('zmApp.controllers')
if (event.Event.ShowScrub == true) // turn on display now
{
- ZMDataModel.zmDebug ("EventCtrl: Scrubbing will turn on now");
+ ZMDataModel.zmDebug("EventCtrl: Scrubbing will turn on now");
//$ionicScrollDelegate.freezeScroll(true);
$ionicSideMenuDelegate.canDragContent(false);
$scope.slider_options = {
@@ -533,7 +536,7 @@ angular.module('zmApp.controllers')
callback: function (value, released) {
//console.log("CALLBACK"+value+released);
$ionicScrollDelegate.freezeScroll(!released);
- ZMDataModel.zmDebug ("EventCtrl: freezeScroll called with " + !released);
+ ZMDataModel.zmDebug("EventCtrl: freezeScroll called with " + !released);
},
@@ -569,7 +572,7 @@ angular.module('zmApp.controllers')
//console.log("**Resetting range");
$scope.slides = [];
var i;
- ZMDataModel.zmDebug ("EventCtrl: found " + frames + " frames to scrub");
+ ZMDataModel.zmDebug("EventCtrl: found " + frames + " frames to scrub");
for (i = 1; i <= frames; i++) {
var fname = padToN(i, eventImageDigits) + "-capture.jpg";
$scope.slides.push({
@@ -592,7 +595,7 @@ angular.module('zmApp.controllers')
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,
@@ -1288,9 +1291,8 @@ angular.module('zmApp.controllers')
$scope.doRefresh = function () {
doRefresh();
}; //dorefresh
-
- function doRefresh()
- {
+
+ function doRefresh() {
console.log("***Pull to Refresh");
$scope.events = [];
moreEvents = true;
@@ -1349,4 +1351,4 @@ angular.module('zmApp.controllers')
});
}
-}]); \ No newline at end of file
+}]);
diff --git a/www/js/EventDateTimeFilterCtrl.js b/www/js/EventDateTimeFilterCtrl.js
index 5169c939..e68abfa4 100644
--- a/www/js/EventDateTimeFilterCtrl.js
+++ b/www/js/EventDateTimeFilterCtrl.js
@@ -5,76 +5,80 @@
angular.module('zmApp.controllers')
- .controller('zmApp.EventDateTimeFilterCtrl', ['$scope', '$ionicSlideBoxDelegate', '$ionicSideMenuDelegate', '$rootScope', '$ionicHistory', 'ZMDataModel', '$state', function ($scope, $ionicScrollDelegate,$ionicSideMenuDelegate, $rootScope, $ionicHistory, ZMDataModel, $state) {
-
-$scope.removeFilters = function()
-{
- $rootScope.isEventFilterOn = false;
- $rootScope.fromDate = "";
- $rootScope.fromTime= "";
- $rootScope.toDate = "";
- $rootScope.toTime="";
- $rootScope.fromString="";
- $rootScope.toString="";
-
- // if you come here via the events pullup
- // you are looking at a specific monitor ID
- // going back will only retain that monitor ID
- // so lets reload with all monitors
- $ionicHistory.nextViewOptions({
- disableBack: true
- });
- $state.go("events", {"id":0});
-
- //$ionicHistory.goBack();
-};
-
-$scope.saveFilters = function()
-{
- if (!$rootScope.fromDate)
- {
- console.log ("RESET fromDate");
- $rootScope.fromDate = new Date();
- ZMDataModel.zmDebug ("DateTimeFilter: resetting from date");
- }
-
- if (!$rootScope.toDate)
- {
- console.log ("RESET toDate");
- $rootScope.toDate = new Date();
- ZMDataModel.zmDebug ("DateTimeFilter: resetting to date");
- }
-
- if (!$rootScope.fromTime)
- {
- console.log ("RESET fromTime");
- $rootScope.fromTime = new Date(99,5,24,0,0,0,0); //moment().format("hh:mm:ss");
- ZMDataModel.zmDebug ("DateTimeFilter: resetting from time");
- }
-
-
- if (!$rootScope.toTime)
- {
- console.log ("RESET toTime");
- $rootScope.toTime =new Date(99,5,24,23,59,59,0);
- //$rootScope.toTime = "01:01:02"; //moment().format("hh:mm:ss");
- ZMDataModel.zmDebug ("DateTimeFilter: resetting to time");
- }
-
-
- $rootScope.isEventFilterOn = true;
- $rootScope.fromString = moment($rootScope.fromDate).format("YYYY-MM-DD") + " " + moment($rootScope.fromTime).format ("HH:mm:ss");
-
- $rootScope.toString = moment($rootScope.toDate).format("YYYY-MM-DD") + " " + moment($rootScope.toTime).format ("HH:mm:ss");
-
- //console.log("CONCAT DATES " + temp);
- //
- // var startDate = moment(temp).format("YYYY-MM-DD hh:mm:ss");
- ZMDataModel.zmDebug ("DateTimeFilter: From/To is now: " + $rootScope.fromString + " & " +$rootScope.toString);
- $ionicHistory.goBack();
-};
+ .controller('zmApp.EventDateTimeFilterCtrl', ['$scope', '$ionicSlideBoxDelegate', '$ionicSideMenuDelegate', '$rootScope', '$ionicHistory', 'ZMDataModel', '$state', function ($scope, $ionicScrollDelegate, $ionicSideMenuDelegate, $rootScope, $ionicHistory, ZMDataModel, $state) {
+
+ //--------------------------------------------------------------------------
+ // Clears filters
+ //--------------------------------------------------------------------------
+
+ $scope.removeFilters = function () {
+ $rootScope.isEventFilterOn = false;
+ $rootScope.fromDate = "";
+ $rootScope.fromTime = "";
+ $rootScope.toDate = "";
+ $rootScope.toTime = "";
+ $rootScope.fromString = "";
+ $rootScope.toString = "";
+
+ // if you come here via the events pullup
+ // you are looking at a specific monitor ID
+ // going back will only retain that monitor ID
+ // so lets reload with all monitors
+ $ionicHistory.nextViewOptions({
+ disableBack: true
+ });
+ $state.go("events", {
+ "id": 0
+ });
+
+ //$ionicHistory.goBack();
+ };
+
+ //--------------------------------------------------------------------------
+ // Saves filters in root variables so EventFilter can access it. I know:
+ // don't root.
+ //--------------------------------------------------------------------------
+ $scope.saveFilters = function () {
+ if (!$rootScope.fromDate) {
+ console.log("RESET fromDate");
+ $rootScope.fromDate = new Date();
+ ZMDataModel.zmDebug("DateTimeFilter: resetting from date");
+ }
+
+ if (!$rootScope.toDate) {
+ console.log("RESET toDate");
+ $rootScope.toDate = new Date();
+ ZMDataModel.zmDebug("DateTimeFilter: resetting to date");
+ }
+
+ if (!$rootScope.fromTime) {
+ console.log("RESET fromTime");
+ $rootScope.fromTime = new Date(99, 5, 24, 0, 0, 0, 0); //moment().format("hh:mm:ss");
+ ZMDataModel.zmDebug("DateTimeFilter: resetting from time");
+ }
+
+
+ if (!$rootScope.toTime) {
+ console.log("RESET toTime");
+ $rootScope.toTime = new Date(99, 5, 24, 23, 59, 59, 0);
+ //$rootScope.toTime = "01:01:02"; //moment().format("hh:mm:ss");
+ ZMDataModel.zmDebug("DateTimeFilter: resetting to time");
+ }
+
+
+ $rootScope.isEventFilterOn = true;
+ $rootScope.fromString = moment($rootScope.fromDate).format("YYYY-MM-DD") + " " + moment($rootScope.fromTime).format("HH:mm:ss");
+
+ $rootScope.toString = moment($rootScope.toDate).format("YYYY-MM-DD") + " " + moment($rootScope.toTime).format("HH:mm:ss");
+
+ //console.log("CONCAT DATES " + temp);
+ //
+ // var startDate = moment(temp).format("YYYY-MM-DD hh:mm:ss");
+ ZMDataModel.zmDebug("DateTimeFilter: From/To is now: " + $rootScope.fromString + " & " + $rootScope.toString);
+ $ionicHistory.goBack();
+ };
}
-]);
+]); \ No newline at end of file
diff --git a/www/js/EventsGraphsCtrl.js b/www/js/EventsGraphsCtrl.js
index 05deb431..fabe64a6 100644
--- a/www/js/EventsGraphsCtrl.js
+++ b/www/js/EventsGraphsCtrl.js
@@ -8,7 +8,7 @@
// the main function is generateChart. I call generate chart with required parameters
// from the template file
-angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ionicPlatform', '$scope','zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$rootScope', '$http',function ($ionicPlatform, $scope, zm,ZMDataModel, $ionicSideMenuDelegate, $rootScope, $http) {
+angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ionicPlatform', '$scope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$rootScope', '$http', function ($ionicPlatform, $scope, zm, ZMDataModel, $ionicSideMenuDelegate, $rootScope, $http) {
console.log("Inside Graphs controller");
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
@@ -43,7 +43,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ioni
// Controller main
//-------------------------------------------------
- // $scope.chart = "";
+ // $scope.chart = "";
$scope.navTitle = 'Tab Page';
// $scope.chart="";
$scope.leftButtons = [{
@@ -55,24 +55,49 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ioni
var container = angular.element(document.getElementById('visualization'));
- console.log (JSON.stringify(container));
- var data = [
- {id: 1, content: 'item 1', start: '2013-04-20'},
- {id: 2, content: 'item 2', start: '2013-04-14'},
- {id: 3, content: 'item 3', start: '2013-04-18'},
- {id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'},
- {id: 5, content: 'item 5', start: '2013-04-25'},
- {id: 6, content: 'item 6', start: '2013-04-27'}
+ console.log(JSON.stringify(container));
+ var data = [
+ {
+ id: 1,
+ content: 'item 1',
+ start: '2013-04-20'
+ },
+ {
+ id: 2,
+ content: 'item 2',
+ start: '2013-04-14'
+ },
+ {
+ id: 3,
+ content: 'item 3',
+ start: '2013-04-18'
+ },
+ {
+ id: 4,
+ content: 'item 4',
+ start: '2013-04-16',
+ end: '2013-04-19'
+ },
+ {
+ id: 5,
+ content: 'item 5',
+ start: '2013-04-25'
+ },
+ {
+ id: 6,
+ content: 'item 6',
+ start: '2013-04-27'
+ }
];
- var options = {};
- //var timeline = new vis.Timeline(container[0], data, options);
+ var options = {};
+ //var timeline = new vis.Timeline(container[0], data, options);
// -------------------------------------------------
// Called when user taps on a bar
//---------------------------------------------------
$scope.handleChartClick = function (event) {
- console.log (JSON.stringify( $scope.chartwithbars.getBarsAtEvent(event)));
+ console.log(JSON.stringify($scope.chartwithbars.getBarsAtEvent(event)));
//console.log(angular.element[0].getContext('2d'));
//console.log (JSON.stringify( $scope.chart));
@@ -88,9 +113,9 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ioni
var endDate = "";
$scope.chart = {
- barHeight:"",
- data:"",
- options:""
+ barHeight: "",
+ data: "",
+ options: ""
};
@@ -120,7 +145,8 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ioni
highlightFill: zm.graphHighlightFill,
data: []
},
- ]};
+ ]
+ };
ZMDataModel.getMonitors(0).then(function (data) {
monitors = data;
@@ -149,7 +175,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ioni
"/events/index/MonitorId:" + monitors[j].Monitor.Id + dateString +
".json?page=1";
// console.log("Monitor event URL:" + url);
- ZMDataModel.zmLog ("EventGraph: composed url is " + url);
+ ZMDataModel.zmLog("EventGraph: composed url is " + url);
$http.get(url /*,{timeout:15000}*/ )
.success(function (data) {
ZMDataModel.zmDebug("Event count for monitor" +
@@ -161,7 +187,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ioni
// but what I am really doing now is treating it like no events
// works but TBD: make this into a proper error handler
$scope.chart.data.datasets[0].data[j] = 0;
- ZMDataModel.zmLog ("Error retrieving events for graph " + JSON.stringify(data), "error");
+ ZMDataModel.zmLog("Error retrieving events for graph " + JSON.stringify(data), "error");
});
})(i); // j
} //for
@@ -184,5 +210,4 @@ angular.module('zmApp.controllers').controller('zmApp.EventsGraphsCtrl', ['$ioni
// legendTemplate : '<ul class="tc-chart-js-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'
};
}; //generateTCChart
-}]);
-
+}]); \ No newline at end of file
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index f37f2b56..2322391f 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -2,21 +2,23 @@
/* jslint browser: true*/
/* global cordova,StatusBar,angular,console */
-angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$rootScope','zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', 'zmAutoLogin', '$cordovaPinDialog', function ($scope, $rootScope,zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, zmAutoLogin, $cordovaPinDialog) {
+angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$rootScope', 'zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', 'zmAutoLogin', '$cordovaPinDialog', function ($scope, $rootScope, zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, zmAutoLogin, $cordovaPinDialog) {
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
};
$scope.loginData = ZMDataModel.getLogin();
-
- $scope.auth={isUseAuth:""};
- $scope.auth.isUseAuth = ($scope.loginData.isUseAuth == '1') ? true:false;
-
-
+ $scope.auth = {
+ isUseAuth: ""
+ };
+ $scope.auth.isUseAuth = ($scope.loginData.isUseAuth == '1') ? true : false;
+
+
- //-------------------------------------------------------------------------
+
+ //-------------------------------------------------------------------------
// Lets make sure we set screen dim properly as we enter
// The problem is we enter other states before we leave previous states
// from a callback perspective in ionic, so we really can't predictably
@@ -28,90 +30,81 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
ZMDataModel.setAwake(false);
});
-
- $scope.pinPrompt = function(evt)
- {
- ZMDataModel.zmLog ("Password prompt");
- if ($scope.loginData.usePin)
- {
- $scope.loginData.pinCode="";
- $cordovaPinDialog.prompt('Enter PIN', 'PIN Protect').then (
- function(result1) {
-
- // console.log (JSON.stringify(result1));
- if (result1.input1 && result1.buttonIndex==1)
- {
- $cordovaPinDialog.prompt('Reconfirm PIN', 'PIN Protect')
- .then(function(result2)
- {
- if (result1.input1 == result2.input1)
- {
- ZMDataModel.zmLog("Pin code match");
- $scope.loginData.pinCode=result1.input1;
- }
- else
- {
- ZMDataModel.zmLog("Pin code mismatch");
- $scope.loginData.usePin = false;
- ZMDataModel.displayBanner ('error', ['Pin code mismatch']);
- }
- },
- function(error)
- {
- console.log ("Error inside");
- $scope.loginData.usePin = false;
- });
- }
- else
- {
- $scope.loginData.usePin = false;
- }
- },
- function (error)
- {
- console.log ("Error outside");
- $scope.loginData.usePin = false;
- });
-
-
-
- }
- else {
- ZMDataModel.zmDebug("Password disabled");
- }
+
+ //--------------------------------------------------------------------------
+ // When PIN is enabled, this is called to specify a PIN
+ // FIXME: Get rid of cordovaPinDialog. It's really not needed
+ //--------------------------------------------------------------------------
+ $scope.pinPrompt = function (evt) {
+ ZMDataModel.zmLog("Password prompt");
+ if ($scope.loginData.usePin) {
+ $scope.loginData.pinCode = "";
+ $cordovaPinDialog.prompt('Enter PIN', 'PIN Protect').then(
+ function (result1) {
+
+ // console.log (JSON.stringify(result1));
+ if (result1.input1 && result1.buttonIndex == 1) {
+ $cordovaPinDialog.prompt('Reconfirm PIN', 'PIN Protect')
+ .then(function (result2) {
+ if (result1.input1 == result2.input1) {
+ ZMDataModel.zmLog("Pin code match");
+ $scope.loginData.pinCode = result1.input1;
+ } else {
+ ZMDataModel.zmLog("Pin code mismatch");
+ $scope.loginData.usePin = false;
+ ZMDataModel.displayBanner('error', ['Pin code mismatch']);
+ }
+ },
+ function (error) {
+ console.log("Error inside");
+ $scope.loginData.usePin = false;
+ });
+ } else {
+ $scope.loginData.usePin = false;
+ }
+ },
+ function (error) {
+ console.log("Error outside");
+ $scope.loginData.usePin = false;
+ });
+
+
+
+ } else {
+ ZMDataModel.zmDebug("Password disabled");
+ }
};
//-------------------------------------------------------------------------------
// Makes input easier
//-------------------------------------------------------------------------------
- $scope.portalKeypress = function(evt)
- {
+ $scope.portalKeypress = function (evt) {
- // if ($scope.loginData.streamingurl.indexOf($scope.loginData.url) !=0)
- $scope.loginData.streamingurl = $scope.loginData.url;
+ // if ($scope.loginData.streamingurl.indexOf($scope.loginData.url) !=0)
+ $scope.loginData.streamingurl = $scope.loginData.url;
- // Changed Sep 16 2015: Seems cgi-bin will now have /zm/cgi-bin by
- // default in packages instead of /cgi-bin
- //if ($scope.loginData.streamingurl.slice(-3).toLowerCase() == '/zm') {
- //$scope.loginData.streamingurl = $scope.loginData.streamingurl.slice(0, -3);
+ // Changed Sep 16 2015: Seems cgi-bin will now have /zm/cgi-bin by
+ // default in packages instead of /cgi-bin
+ //if ($scope.loginData.streamingurl.slice(-3).toLowerCase() == '/zm') {
+ //$scope.loginData.streamingurl = $scope.loginData.streamingurl.slice(0, -3);
//}
- // if ($scope.loginData.apiurl.indexOf($scope.loginData.url) !=0)
- $scope.loginData.apiurl = $scope.loginData.url+"/api";
+ // if ($scope.loginData.apiurl.indexOf($scope.loginData.url) !=0)
+ $scope.loginData.apiurl = $scope.loginData.url + "/api";
};
-//-------------------------------------------------------------------------------
-// Adds http to url if not present
-// http://stackoverflow.com/questions/11300906/check-if-a-string-starts-with-http-using-javascript
-//-------------------------------------------------------------------------------
-function addhttp(url) {
-
- if ((!/^(f|ht)tps?:\/\//i.test(url)) && (url !="") ) {
- url = "http://" + url;
- }
- return url;
-}
+ //-------------------------------------------------------------------------------
+ // Adds http to url if not present
+ // http://stackoverflow.com/questions/11300906/check-if-a-string-starts-with-http-using-javascript
+ //-------------------------------------------------------------------------------
+ function addhttp(url) {
+
+ if ((!/^(f|ht)tps?:\/\//i.test(url)) && (url != "")) {
+ url = "http://" + url;
+ }
+ return url;
+ }
//-----------------------------------------------------------------------------
// Perform the login action when the user submits the login form
@@ -137,8 +130,8 @@ function addhttp(url) {
$scope.loginData.apiurl = $scope.loginData.apiurl.trim();
$scope.loginData.username = $scope.loginData.username.trim();
$scope.loginData.streamingurl = $scope.loginData.streamingurl.trim();
-
- $scope.loginData.isUseAuth = ($scope.auth.isUseAuth) ? "1": "0";
+
+ $scope.loginData.isUseAuth = ($scope.auth.isUseAuth) ? "1" : "0";
if ($scope.loginData.url.slice(-1) == '/') {
$scope.loginData.url = $scope.loginData.url.slice(0, -1);
@@ -164,87 +157,84 @@ function addhttp(url) {
// check for protocol and if not put it in
$scope.loginData.url = addhttp($scope.loginData.url);
- $scope.loginData.apiurl = addhttp($scope.loginData.apiurl);
- $scope.loginData.streamingurl = addhttp($scope.loginData.streamingurl);
+ $scope.loginData.apiurl = addhttp($scope.loginData.apiurl);
+ $scope.loginData.streamingurl = addhttp($scope.loginData.streamingurl);
- if ($scope.loginData.useSSL)
- {
+ if ($scope.loginData.useSSL) {
// replace all http with https
- $scope.loginData.url = $scope.loginData.url.replace("http:","https:");
- $scope.loginData.apiurl = $scope.loginData.apiurl.replace("http:","https:");
- $scope.loginData.streamingurl = $scope.loginData.streamingurl.replace("http:","https:");
+ $scope.loginData.url = $scope.loginData.url.replace("http:", "https:");
+ $scope.loginData.apiurl = $scope.loginData.apiurl.replace("http:", "https:");
+ $scope.loginData.streamingurl = $scope.loginData.streamingurl.replace("http:", "https:");
- }
- else
- {
+ } else {
// replace all https with http
- $scope.loginData.url = $scope.loginData.url.replace("https:","http:");
- $scope.loginData.apiurl = $scope.loginData.apiurl.replace("https:","http:");
- $scope.loginData.streamingurl = $scope.loginData.streamingurl.replace("https:","http:");
+ $scope.loginData.url = $scope.loginData.url.replace("https:", "http:");
+ $scope.loginData.apiurl = $scope.loginData.apiurl.replace("https:", "http:");
+ $scope.loginData.streamingurl = $scope.loginData.streamingurl.replace("https:", "http:");
}
var apiurl = $scope.loginData.apiurl + '/host/getVersion.json';
var portalurl = $scope.loginData.url + '/index.php';
-
-
-
+
+
+
// Check if isUseAuth is set make sure u/p have a dummy value
- if ($scope.isUseAuth)
- {
- if (!$scope.loginData.username) $scope.loginData.username="x";
- if (!$scope.loginData.password) $scope.loginData.password="x";
+ if ($scope.isUseAuth) {
+ if (!$scope.loginData.username) $scope.loginData.username = "x";
+ if (!$scope.loginData.password) $scope.loginData.password = "x";
ZMDataModel.zmLog("Authentication is disabled, setting dummy user & pass");
}
-
+
ZMDataModel.setLogin($scope.loginData);
-
+
// now grab and report PATH_ZMS
ZMDataModel.getPathZms()
- .then (function(data) {
- var ld = ZMDataModel.getLogin();
- ZMDataModel.zmLog ("PATH_ZMS:"+data+" ,Path ZmNinja will use:"+ld.streamingurl+"/cgi-bin/nph-zms");
- ZMDataModel.zmLog ("If live streams are not working, make sure you check these values");
-
-
-
- });
-
-
+ .then(function (data) {
+ var ld = ZMDataModel.getLogin();
+ ZMDataModel.zmLog("PATH_ZMS:" + data + " ,Path ZmNinja will use:" + ld.streamingurl + "/cgi-bin/nph-zms");
+ ZMDataModel.zmLog("If live streams are not working, make sure you check these values");
+
+
+
+ });
+
+
zmAutoLogin.doLogin("authenticating...")
- // 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
- // box
-
- .then( function(data)
- {
-
+ // 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
+ // box
+
+ .then(function (data) {
+
// Now let's validate if the API works
-
- ZMDataModel.zmLog ("Validating APIs at " + apiurl);
+
+ ZMDataModel.zmLog("Validating APIs at " + apiurl);
$http.get(apiurl)
- .success (function (data) {
-
- $ionicPopup.alert({
- title: 'Login validated',
- template: 'Please explore the menu and enjoy zmNinja!'
- }).then(function(res) { $ionicSideMenuDelegate.toggleLeft();});
-
- })
- .error (function (error) {
- ZMDataModel.displayBanner ('error',['ZoneMinder API check failed', 'Please check API settings']);
- ZMDataModel.zmLog ("API login error " + JSON.stringify(error));
- $ionicPopup.alert({
- title: 'Login validated but API failed',
- template: 'Please check your API settings'
+ .success(function (data) {
+
+ $ionicPopup.alert({
+ title: 'Login validated',
+ template: 'Please explore the menu and enjoy zmNinja!'
+ }).then(function (res) {
+ $ionicSideMenuDelegate.toggleLeft();
});
- });
-
-
+
+ })
+ .error(function (error) {
+ ZMDataModel.displayBanner('error', ['ZoneMinder API check failed', 'Please check API settings']);
+ ZMDataModel.zmLog("API login error " + JSON.stringify(error));
+ $ionicPopup.alert({
+ title: 'Login validated but API failed',
+ template: 'Please check your API settings'
+ });
+ });
+
+
});
};
-}]);
+}]); \ No newline at end of file
diff --git a/www/js/ModalCtrl.js b/www/js/ModalCtrl.js
index 721cd911..834eeecc 100644
--- a/www/js/ModalCtrl.js
+++ b/www/js/ModalCtrl.js
@@ -4,65 +4,53 @@
/* global cordova,StatusBar,angular,console,ionic */
-angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootScope', 'zm','ZMDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', function ($scope, $rootScope,zm, ZMDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate) {
+angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', function ($scope, $rootScope, zm, ZMDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate) {
console.log("**** INSIDE MODAL CTRL, recomputing rand *****");
- // $scope.rand = Math.floor((Math.random() * 100000) + 1);
- // $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
- //$state.go($state.current, {}, {reload: true});
-
- // This holds the PTZ menu control
- // Note that I hacked radialMenu
- // so please don't use the one you get from bower
-
- //var imageStyle=1;
- //$scope.imageAspect = "max-width: 100%;max-height: 100%;";
- $scope.imageFit=false;
+ $scope.imageFit = false;
// FIXME: This is a hack - for some reason
// the custom slider view is messed up till the image loads
// in modal view
$scope.showModalRangeSider = false;
- $scope.isModalActive = true;
+ $scope.isModalActive = true;
- $timeout( function() {
+ $timeout(function () {
$scope.showModalRangeSider = true;
- // console.log ("****SHOWING SLIDER");
- },2000);
-
+
+ }, 2000);
+
document.addEventListener("pause", onPause, false);
document.addEventListener("resume", onResume, false);
-
- $rootScope.authSession = "undefined";
- $ionicLoading.show({
- template: 'negotiating stream authentication...',
- animation: 'fade-in',
- showBackdrop: true,
- duration: zm.loadingTimeout,
- maxWidth: 300,
- showDelay: 0
- });
+
+ $rootScope.authSession = "undefined";
+ $ionicLoading.show({
+ template: 'negotiating stream authentication...',
+ animation: 'fade-in',
+ showBackdrop: true,
+ duration: zm.loadingTimeout,
+ maxWidth: 300,
+ showDelay: 0
+ });
var ld = ZMDataModel.getLogin();
ZMDataModel.getAuthKey()
- .then(function(success)
- {
- $ionicLoading.hide();
- $rootScope.authSession = success;
- ZMDataModel.zmLog ("Modal: Stream authentication construction: " + $rootScope.authSession);
-
- },
- function (error)
- {
-
- $ionicLoading.hide();
- ZMDataModel.zmDebug ("ModalCtrl: Error details of stream auth:" + error);
- //$rootScope.authSession="";
- ZMDataModel.zmLog ("Modal: Error returned Stream authentication construction. Retaining old value of: " + $rootScope.authSession);
- });
-
-
-
+ .then(function (success) {
+ $ionicLoading.hide();
+ $rootScope.authSession = success;
+ ZMDataModel.zmLog("Modal: Stream authentication construction: " + $rootScope.authSession);
+
+ },
+ function (error) {
+
+ $ionicLoading.hide();
+ ZMDataModel.zmDebug("ModalCtrl: Error details of stream auth:" + error);
+ //$rootScope.authSession="";
+ ZMDataModel.zmLog("Modal: Error returned Stream authentication construction. Retaining old value of: " + $rootScope.authSession);
+ });
+
+
+
$scope.radialMenuOptions = {
content: '',
@@ -170,58 +158,57 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco
console.log('About');
}
},
- ]};
-
-
- $interval.cancel(intervalModalHandle);
- intervalModalHandle= $interval(function () {
- loadModalNotifications();
+ ]
+ };
+
+
+ $interval.cancel(intervalModalHandle);
+ intervalModalHandle = $interval(function () {
+ loadModalNotifications();
// console.log ("Refreshing Image...");
}.bind(this), ld.refreshSec * 1000);
loadModalNotifications();
-
-
+
+
function onPause() {
- ZMDataModel.zmDebug ("ModalCtrl: onpause called");
+ ZMDataModel.zmDebug("ModalCtrl: onpause called");
$interval.cancel(intervalModalHandle);
- // $interval.cancel(modalIntervalHandle);
-
+ // $interval.cancel(modalIntervalHandle);
+
// FIXME: Do I need to setAwake(false) here?
}
- function onResume()
- {
+ function onResume() {
ZMDataModel.zmDebug("ModalCtrl: Modal resume called");
- if ($scope.isModalActive)
- {
- ZMDataModel.zmLog ("ModalCtrl: Restarting Modal timer on resume");
-
+ if ($scope.isModalActive) {
+ ZMDataModel.zmLog("ModalCtrl: Restarting Modal timer on resume");
+
$interval.cancel(intervalModalHandle);
- intervalModalHandle= $interval(function () {
- loadModalNotifications();
- // console.log ("Refreshing Image...");
- }.bind(this), ld.refreshSec*1000);
-
-
+ intervalModalHandle = $interval(function () {
+ loadModalNotifications();
+ // console.log ("Refreshing Image...");
+ }.bind(this), ld.refreshSec * 1000);
+
+
$rootScope.modalRand = Math.floor((Math.random() * 100000) + 1);
-
+
}
-
-
+
+
}
-function loadModalNotifications() {
-
- //console.log ("Inside Modal timer...");
- $rootScope.modalRand = Math.floor((Math.random() * 100000) + 1);
-
+ function loadModalNotifications() {
+
+ //console.log ("Inside Modal timer...");
+ $rootScope.modalRand = Math.floor((Math.random() * 100000) + 1);
+
}
- var intervalModalHandle ;
+ var intervalModalHandle;
@@ -231,16 +218,15 @@ function loadModalNotifications() {
//-------------------------------------------------------------
function controlPTZ(monitorId, cmd) {
- //curl -X POST "http://server.com/zm/index.php?view=request" -d
- //"request=control&user=admin&passwd=xx&id=4&control=moveConLeft"
+ //curl -X POST "http://server.com/zm/index.php?view=request" -d
+ //"request=control&user=admin&passwd=xx&id=4&control=moveConLeft"
- if (!$scope.ptzMoveCommand)
- {
+ if (!$scope.ptzMoveCommand) {
$ionicLoading.show({
- template: "Not Ready for PTZ",
- noBackdrop: true,
- duration: 2000,
- });
+ template: "Not Ready for PTZ",
+ noBackdrop: true,
+ duration: 2000,
+ });
return;
}
@@ -312,16 +298,15 @@ function loadModalNotifications() {
}
$scope.finishedLoadingImage = function () {
- // console.log("***Monitor image FINISHED Loading***");
+ // console.log("***Monitor image FINISHED Loading***");
$ionicLoading.hide();
};
-
- $scope.onSwipeLeft = function(m,d)
- {
- ZMDataModel.zmDebug ("ModalCtrl:Left swipe detected, moving to "+ ZMDataModel.getNextMonitor(m,d));
- $scope.monitorId = ZMDataModel.getNextMonitor(m,d);
+ // not being used anymore - using a dedicated menu instead
+ $scope.onSwipeLeft = function (m, d) {
+ ZMDataModel.zmDebug("ModalCtrl:Left swipe detected, moving to " + ZMDataModel.getNextMonitor(m, d));
+ $scope.monitorId = ZMDataModel.getNextMonitor(m, d);
$ionicLoading.hide();
@@ -331,32 +316,32 @@ function loadModalNotifications() {
duration: zm.loadingTimeout,
});
- };
-
- $scope.onSwipeRight = function(m,d)
- {
- ZMDataModel.zmDebug ("ModalCtrl:Right swipe detected, moving to "+ ZMDataModel.getNextMonitor(m,d));
- $scope.monitorId = ZMDataModel.getNextMonitor(m,d);
+ };
+
+ // not being used anymore - using a dedicated menu instead
+ $scope.onSwipeRight = function (m, d) {
+ ZMDataModel.zmDebug("ModalCtrl:Right swipe detected, moving to " + ZMDataModel.getNextMonitor(m, d));
+ $scope.monitorId = ZMDataModel.getNextMonitor(m, d);
- $ionicLoading.show({
+ $ionicLoading.show({
template: "please wait...",
noBackdrop: true,
duration: zm.loadingTimeout,
});
- };
+ };
//-----------------------------------------------------------------------
// Sucess/Error handlers for saving a snapshot of the
// monitor image to phone storage
//-----------------------------------------------------------------------
- function SaveSuccess() {
+ function SaveSuccess() {
$ionicLoading.show({
template: "done!",
noBackdrop: true,
duration: 1000
});
- ZMDataModel.zmDebug ("ModalCtrl:Photo saved successfuly");
+ ZMDataModel.zmDebug("ModalCtrl:Photo saved successfuly");
}
function SaveError(e) {
@@ -369,7 +354,7 @@ function loadModalNotifications() {
console.log("***ERROR");
}
- //-----------------------------------------------------------------------
+ //-----------------------------------------------------------------------
// Saves a snapshot of the monitor image to phone storage
//-----------------------------------------------------------------------
@@ -381,7 +366,7 @@ function loadModalNotifications() {
duration: zm.httpTimeout
});
- ZMDataModel.zmDebug ("ModalCtrl: SaveImageToPhone called");
+ ZMDataModel.zmDebug("ModalCtrl: SaveImageToPhone called");
var canvas, context, imageDataUrl, imageData;
var loginData = ZMDataModel.getLogin();
var url = loginData.streamingurl +
@@ -418,46 +403,45 @@ function loadModalNotifications() {
}
};
-
-$scope.reloadView = function()
-{
- ZMDataModel.zmLog ("Reloading view for modal view, recomputing rand");
- $rootScope.modalRand = Math.floor((Math.random() * 100000) + 1);
- $scope.isModalActive = true;
-};
-
- $scope.scaleImage = function() {
- console.log ("Switching image style");
- $scope.imageFit = !$scope.imageFit;
-};
-
- $scope.$on ('$ionicView.enter', function() {
-
-
-
+
+ $scope.reloadView = function () {
+ ZMDataModel.zmLog("Reloading view for modal view, recomputing rand");
+ $rootScope.modalRand = Math.floor((Math.random() * 100000) + 1);
+ $scope.isModalActive = true;
+ };
+
+ $scope.scaleImage = function () {
+ console.log("Switching image style");
+ $scope.imageFit = !$scope.imageFit;
+ };
+
+ $scope.$on('$ionicView.enter', function () {
+
+
+
});
-
- $scope.$on('$ionicView.leave', function () {
+
+ $scope.$on('$ionicView.leave', function () {
console.log("**MODAL: Stopping modal timer");
- $scope.isModalActive = false;
- $interval.cancel(intervalModalHandle);
+ $scope.isModalActive = false;
+ $interval.cancel(intervalModalHandle);
});
$scope.$on('$ionicView.unloaded', function () {
$scope.isModalActive = false;
- console.log("**MODAL UNLOADED: Stopping modal timer");
- $interval.cancel(intervalModalHandle);
-
- // console.log("Modal monitor left");
+ console.log("**MODAL UNLOADED: Stopping modal timer");
+ $interval.cancel(intervalModalHandle);
+
+ // console.log("Modal monitor left");
});
-
- $scope.$on('modal.removed', function() {
+
+ $scope.$on('modal.removed', function () {
$scope.isModalActive = false;
- console.log("**MODAL REMOVED: Stopping modal timer");
- $interval.cancel(intervalModalHandle);
-
- // Execute action
- });
-
+ console.log("**MODAL REMOVED: Stopping modal timer");
+ $interval.cancel(intervalModalHandle);
+
+ // Execute action
+ });
+
-}]);
+}]); \ No newline at end of file
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js
index 5a238546..b93f35ae 100644
--- a/www/js/MonitorCtrl.js
+++ b/www/js/MonitorCtrl.js
@@ -5,14 +5,16 @@
// 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', ['$ionicPopup', 'zm', '$scope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$ionicLoading', '$ionicModal', '$state', '$http', '$rootScope', function ($ionicPopup, zm, $scope, ZMDataModel, message, $ionicSideMenuDelegate, $ionicLoading, $ionicModal, $state, $http, $rootScope, $timeout) {
+angular.module('zmApp.controllers')
+ .controller('zmApp.MonitorCtrl', ['$ionicPopup', 'zm', '$scope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$ionicLoading', '$ionicModal', '$state', '$http', '$rootScope',
+ function ($ionicPopup, zm, $scope, ZMDataModel, message, $ionicSideMenuDelegate, $ionicLoading, $ionicModal, $state, $http, $rootScope, $timeout) {
//-----------------------------------------------------------------------
// Controller Main
//-----------------------------------------------------------------------
- // var isModalOpen = false;
+ // var isModalOpen = false;
console.log("***EVENTS: Waiting for Monitors to load before I proceed");
$scope.monitors = [];
@@ -29,8 +31,6 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
$ionicSideMenuDelegate.toggleLeft();
};
-
-
//-----------------------------------------------------------------------
// This function takes care of changing monitor parameters
@@ -89,9 +89,9 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
{
text: 'Save',
onTap: function (e) {
-
+
ZMDataModel.zmDebug("MonitorCtrl:changeConfig selection:" + $scope.monfunc.myenabled +
- $scope.monfunc.myfunc);
+ $scope.monfunc.myfunc);
var loginData = ZMDataModel.getLogin();
var apiRestart = loginData.apiurl + "/states/change/restart.json";
var apiMon = loginData.apiurl + "/monitors/" + monitorId + ".json";
@@ -100,12 +100,12 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
var isEnabled = "";
isEnabled = ($scope.monfunc.myenabled == true) ? '1' : '0';
-
+
$ionicLoading.show({
- template: "Applying changes. Please wait...",
- noBackdrop: true,
- duration: zm.largeHttpTimeout,
- });
+ template: "Applying changes. Please wait...",
+ noBackdrop: true,
+ duration: zm.largeHttpTimeout,
+ });
$http({
url: apiMon,
@@ -120,8 +120,8 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
str.push(encodeURIComponent(p) + "=" +
encodeURIComponent(obj[p]));
var foo = str.join("&");
- // console.log("****RETURNING " + foo);
- ZMDataModel.zmDebug ("MonitorCtrl: parmeters constructed: " + foo);
+ // console.log("****RETURNING " + foo);
+ ZMDataModel.zmDebug("MonitorCtrl: parmeters constructed: " + foo);
return foo;
},
data: {
@@ -131,37 +131,37 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
})
- // I am restarting ZM after monitor change
- // do I need this? FIXME: Ask Kyle
+ // I am not restarting ZM after monitor change
+
.success(function () {
$ionicLoading.hide();
- ZMDataModel.zmDebug ("MonitorCtrl: Not restarting ZM - Make sure you have the patch installed in MonitorsController.php or this won't work");
- doRefresh();
- /* ZMDataModel.zmDebug ("MonitorCtrl: Restarting ZM");
- $ionicLoading.show({
- template: "Successfully changed Monitor. Please wait, restarting ZoneMinder...",
- noBackdrop: true,
- duration: zm.largeHttpTimeout,
- });
- $http.post(apiRestart)
- .then(function (success) {
- $ionicLoading.hide();
- var refresh = ZMDataModel.getMonitors(1);
- refresh.then(function (data) {
- $scope.monitors = data;
- $scope.$broadcast('scroll.refreshComplete');
- });
-
- },
- function (error) {
- $ionicLoading.hide();
-
- }
- );*/
+ ZMDataModel.zmDebug("MonitorCtrl: Not restarting ZM - Make sure you have the patch installed in MonitorsController.php or this won't work");
+ doRefresh();
+ /* ZMDataModel.zmDebug ("MonitorCtrl: Restarting ZM");
+ $ionicLoading.show({
+ template: "Successfully changed Monitor. Please wait, restarting ZoneMinder...",
+ noBackdrop: true,
+ duration: zm.largeHttpTimeout,
+ });
+ $http.post(apiRestart)
+ .then(function (success) {
+ $ionicLoading.hide();
+ var refresh = ZMDataModel.getMonitors(1);
+ refresh.then(function (data) {
+ $scope.monitors = data;
+ $scope.$broadcast('scroll.refreshComplete');
+ });
+
+ },
+ function (error) {
+ $ionicLoading.hide();
+
+ }
+ );*/
})
.error(function (data, status, headers, config) {
- ZMDataModel.zmDebug ("MonitorCtrl: Error changing monitor " + JSON.stringify(data));
+ ZMDataModel.zmDebug("MonitorCtrl: Error changing monitor " + JSON.stringify(data));
$ionicLoading.hide();
$ionicLoading.show({
template: "Error changing Monitor. Please check ZM logs...",
@@ -219,13 +219,14 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
});
$scope.openModal = function (mid, controllable, controlid) {
- ZMDataModel.zmDebug("MonitorCtrl:Open Monitor Modal with monitor Id=" + mid + " and Controllable:" + controllable + " with control ID:" + controlid);
+ ZMDataModel.zmDebug("MonitorCtrl:Open Monitor Modal with monitor Id=" + mid +
+ " and Controllable:" + controllable + " with control ID:" + controlid);
$scope.monitorId = mid;
$scope.LoginData = ZMDataModel.getLogin();
$scope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111;
- $rootScope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111;
+ $rootScope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111;
$scope.ptzMoveCommand = "";
@@ -241,16 +242,16 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
$http.get(myurl)
.success(function (data) {
-
+
$scope.ptzMoveCommand = "move"; // start with as move;
-
- if (data.control.Control.CanMoveRel == '1')
- $scope.ptzMoveCommand = "moveRel";
-
- // Prefer con over rel if both enabled
- // I've tested con
- if (data.control.Control.CanMoveCon == '1')
- $scope.ptzMoveCommand = "moveCon";
+
+ if (data.control.Control.CanMoveRel == '1')
+ $scope.ptzMoveCommand = "moveRel";
+
+ // Prefer con over rel if both enabled
+ // I've tested con
+ if (data.control.Control.CanMoveCon == '1')
+ $scope.ptzMoveCommand = "moveCon";
console.log("***moveCommand: " + $scope.ptzMoveCommand);
ZMDataModel.zmLog("ControlDB reports PTZ command to be " + $scope.ptzMoveCommand);
@@ -258,8 +259,8 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
.error(function (data) {
console.log("** Error retrieving move PTZ command");
ZMDataModel.zmLog("Error retrieving PTZ command " + JSON.stringify(data), "error");
- ZMDataModel.displayBanner ('error', ['did not get a valid PTZ response', 'Please try again']);
-
+ ZMDataModel.displayBanner('error', ['did not get a valid PTZ response', 'Please try again']);
+
});
}
@@ -320,11 +321,11 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
$scope.monitors[j].Monitor.color = zm.monitorCheckingColor;
$scope.monitors[j].Monitor.char = "ion-checkmark-circled";
apiMonCheck = loginData.apiurl + "/monitors/daemonStatus/id:" + $scope.monitors[j].Monitor.Id + "/daemon:zmc.json";
- ZMDataModel.zmDebug ("MonitorCtrl:monitorStateCheck: " + apiMonCheck);
+ ZMDataModel.zmDebug("MonitorCtrl:monitorStateCheck: " + apiMonCheck);
//console.log("**** ZMC CHECK " + apiMonCheck);
$http.get(apiMonCheck)
.success(function (data) {
- ZMDataModel.zmDebug ("MonitorCtrl: monitor check state returned: " + JSON.stringify(data));
+ ZMDataModel.zmDebug("MonitorCtrl: monitor check state returned: " + JSON.stringify(data));
if (data.statustext.indexOf("not running") > -1) {
$scope.monitors[j].Monitor.isRunning = "false";
$scope.monitors[j].Monitor.color = zm.monitorNotRunningColor;
@@ -345,9 +346,9 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
$scope.monitors[j].Monitor.isRunningText = data.statustext;
})
.error(function (data) {
- ZMDataModel.zmDebug ("MonitorCtrl: Error->monitor check state returned: " +
- JSON.stringify(data));
- ZMDataModel.displayBanner ('error', ['error retrieving state', 'Please try again']);
+ ZMDataModel.zmDebug("MonitorCtrl: Error->monitor check state returned: " +
+ JSON.stringify(data));
+ ZMDataModel.displayBanner('error', ['error retrieving state', 'Please try again']);
$scope.monitors[j].Monitor.isRunning = "error";
$scope.monitors[j].Monitor.color = zm.monitorErrorColor;
$scope.monitors[j].Monitor.char = "ion-help-circled";
@@ -359,8 +360,7 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
}
- function doRefresh()
- {
+ function doRefresh() {
$scope.monitors = [];
var refresh = ZMDataModel.getMonitors(1);
@@ -371,15 +371,13 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
$scope.$broadcast('scroll.refreshComplete');
});
}
-
+
$scope.doRefresh = function () {
console.log("***Pull to Refresh");
doRefresh();
-
-
- };
+ };
-}]);
+}]); \ No newline at end of file
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index 85604dcf..7b296f70 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -4,26 +4,28 @@
/* global cordova,StatusBar,angular,console,ionic */
-angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '$rootScope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$ionicPopup', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', 'zm', '$ionicPopover', '$controller', 'imageLoadingDataShare', '$window', function ($scope, $rootScope, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $ionicPopup, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, zm,$ionicPopover,$controller, imageLoadingDataShare, $window) {
+angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '$rootScope', 'ZMDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$ionicPopup', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', 'zm', '$ionicPopover', '$controller', 'imageLoadingDataShare', '$window', function ($scope, $rootScope, ZMDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $ionicPopup, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, zm, $ionicPopover, $controller, imageLoadingDataShare, $window) {
- $controller('zmApp.BaseController', { $scope: $scope });
+ $controller('zmApp.BaseController', {
+ $scope: $scope
+ });
//---------------------------------------------------------------------
// Controller main
//---------------------------------------------------------------------
- console.log("******** HAVE ALL MONITORS");
+ console.log("******** HAVE ALL MONITORS");
$scope.monitors = message;
- ZMDataModel.zmLog ("Inside Montage Ctrl:We found " + $scope.monitors.length + " monitors");
+ ZMDataModel.zmLog("Inside Montage Ctrl:We found " + $scope.monitors.length + " monitors");
document.addEventListener("pause", onPause, false);
document.addEventListener("resume", onResume, false);
- $scope.showSizeButtons = false;
+ $scope.showSizeButtons = false;
$ionicPopover.fromTemplateUrl('templates/help/montage-help.html', {
- scope: $scope,
- }).then(function(popover) {
- $scope.popover = popover;
- });
+ scope: $scope,
+ }).then(function (popover) {
+ $scope.popover = popover;
+ });
var timestamp = new Date().getUTCMilliseconds();
$scope.minimal = $stateParams.minimal;
@@ -44,8 +46,6 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
$scope.slider = {};
$scope.slider.monsize = ZMDataModel.getMontageSize();
-
-
// The difference between old and original is this:
// old will have a copy of the last re-arranged monitor list
// while original will have a copy of the order returned by ZM
@@ -84,12 +84,11 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
ZMDataModel.zmDebug("MontageCtrl: Hidden order is " + myhiddenorder);
if (myorder) montageOrder = myorder.split(",");
if (myhiddenorder) hiddenOrder = myhiddenorder.split(",");
-
+
// handle add/delete monitors after the array has been
// saved
-
- if ($scope.monitors.length != montageOrder.length)
- {
+
+ if ($scope.monitors.length != montageOrder.length) {
ZMDataModel.zmLog("Monitors array length different from stored hidden/order array. It's possible monitors were added/removed. Resetting...");
montageOrder = [];
hiddenOrder = [];
@@ -98,17 +97,17 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
hiddenOrder[i] = 0; // don't hide them
}
window.localStorage.setItem("montageOrder",
- montageOrder.toString());
- window.localStorage.setItem("montageHiddenOrder",
- hiddenOrder.toString());
-
-
+ montageOrder.toString());
+ window.localStorage.setItem("montageHiddenOrder",
+ hiddenOrder.toString());
+
+
}
} // at this stage, the monitor arrangement is not matching
// the montage order. Its in true order. Let us first process the hiddenOrder part
// now
-
+
for (i = 0; i < montageOrder.length; i++) {
montageOrder[i] = parseInt(montageOrder[i]);
hiddenOrder[i] = parseInt(hiddenOrder[i]);
@@ -117,13 +116,13 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
// disabled monitors
if (hiddenOrder[i] == 1) {
// $scope.monitors[i].Monitor.listDisplay='noshow';
-
- if ($scope.monitors[i] !== undefined)
- $scope.monitors[i].Monitor.listDisplay = 'noshow';
+
+ if ($scope.monitors[i] !== undefined)
+ $scope.monitors[i].Monitor.listDisplay = 'noshow';
ZMDataModel.zmLog("Monitor " + i + " is marked as hidden in montage");
} else {
- if ($scope.monitors[i] !== undefined)
- $scope.monitors[i].Monitor.listDisplay = 'show';
+ if ($scope.monitors[i] !== undefined)
+ $scope.monitors[i].Monitor.listDisplay = 'show';
}
}
// now arrange monitors according to montage order
@@ -172,40 +171,38 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
$scope.LoginData = ZMDataModel.getLogin();
$scope.monLimit = $scope.LoginData.maxMontage;
console.log("********* Inside Montage Ctrl, MAX LIMIT=" + $scope.monLimit);
-
-
+
+
$rootScope.authSession = "undefined";
- $ionicLoading.show({
- template: 'negotiating stream authentication...',
- animation: 'fade-in',
- showBackdrop: true,
- duration: zm.loadingTimeout,
- maxWidth: 300,
- showDelay: 0
- });
-
-
- var ld = ZMDataModel.getLogin();
- ZMDataModel.getAuthKey()
- .then(function(success)
- {
- $ionicLoading.hide();
- console.log (success);
- $rootScope.authSession =success;
- ZMDataModel.zmLog ("Stream authentication construction: " +
- $rootScope.authSession);
-
- },
- function (error)
- {
-
- $ionicLoading.hide();
- ZMDataModel.zmDebug("MontageCtrl: Error in authkey retrieval " + error);
- //$rootScope.authSession="";
- ZMDataModel.zmLog ("MontageCtrl: Error returned Stream authentication construction. Retaining old value of: " + $rootScope.authSession);
+ $ionicLoading.show({
+ template: 'negotiating stream authentication...',
+ animation: 'fade-in',
+ showBackdrop: true,
+ duration: zm.loadingTimeout,
+ maxWidth: 300,
+ showDelay: 0
});
+ var ld = ZMDataModel.getLogin();
+ ZMDataModel.getAuthKey()
+ .then(function (success) {
+ $ionicLoading.hide();
+ console.log(success);
+ $rootScope.authSession = success;
+ ZMDataModel.zmLog("Stream authentication construction: " +
+ $rootScope.authSession);
+
+ },
+ function (error) {
+
+ $ionicLoading.hide();
+ ZMDataModel.zmDebug("MontageCtrl: Error in authkey retrieval " + error);
+ //$rootScope.authSession="";
+ ZMDataModel.zmLog("MontageCtrl: Error returned Stream authentication construction. Retaining old value of: " + $rootScope.authSession);
+ });
+
+
// I was facing a lot of problems with Chrome/crosswalk getting stuck with
// pending HTTP requests after a while. There is a problem with chrome handling
// multiple streams of always open HTTP get's (image streaming). This problem
@@ -217,16 +214,16 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
function loadNotifications() {
-
- $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
- // console.log ("Inside Montage timer...");
-
+
+ $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
+ // console.log ("Inside Montage timer...");
+
}
- var intervalHandle ;
- $scope.isModalActive = false;
+ var intervalHandle;
+ $scope.isModalActive = false;
var modalIntervalHandle;
-
+
$scope.closeReorderModal = function () {
console.log("Close & Destroy Monitor Modal");
@@ -241,98 +238,89 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
// Called when user taps on the reorder button
//-------------------------------------------------------------
- $scope.reorderList = function()
- {
- console.log ("REORDER");
- $scope.data.showDelete = false;
+ $scope.reorderList = function () {
+ console.log("REORDER");
+ $scope.data.showDelete = false;
$scope.data.showReorder = !$scope.data.showReorder;
};
-
- $scope.deleteList = function()
- {
- console.log ("DELETE");
- $scope.data.showDelete = !$scope.data.showDelete;
+
+ $scope.deleteList = function () {
+ console.log("DELETE");
+ $scope.data.showDelete = !$scope.data.showDelete;
$scope.data.showReorder = false;
};
-
- $scope.reloadReorder = function()
- {
- var refresh = ZMDataModel.getMonitors(1);
- refresh.then(function (data) {
- $scope.monitors = data;
- $scope.MontageMonitors = data;
- oldMonitors = angular.copy($scope.monitors);
- var i;
- montageOrder = [];
- for (i = 0; i < $scope.monitors.length; i++) {
- montageOrder[i] = i;
- hiddenOrder[i] = 0;
- }
- window.localStorage.setItem("montageOrder", montageOrder.toString());
- window.localStorage.setItem("montageHiddenOrder", hiddenOrder.toString());
- ZMDataModel.zmLog("Montage order saved on refresh: " + montageOrder.toString() + " and hidden order: " + hiddenOrder.toString());
-
- });
+
+ $scope.reloadReorder = function () {
+ var refresh = ZMDataModel.getMonitors(1);
+ refresh.then(function (data) {
+ $scope.monitors = data;
+ $scope.MontageMonitors = data;
+ oldMonitors = angular.copy($scope.monitors);
+ var i;
+ montageOrder = [];
+ for (i = 0; i < $scope.monitors.length; i++) {
+ montageOrder[i] = i;
+ hiddenOrder[i] = 0;
+ }
+ window.localStorage.setItem("montageOrder", montageOrder.toString());
+ window.localStorage.setItem("montageHiddenOrder", hiddenOrder.toString());
+ ZMDataModel.zmLog("Montage order saved on refresh: " + montageOrder.toString() + " and hidden order: " + hiddenOrder.toString());
+
+ });
};
-
- $scope.saveReorder = function()
- {
+
+ $scope.saveReorder = function () {
window.localStorage.setItem("montageOrder", montageOrder.toString());
- window.localStorage.setItem("montageHiddenOrder",
- hiddenOrder.toString());
- console.log("Saved " + montageOrder.toString());
- ZMDataModel.zmLog("User press OK. Saved Monitor Order as: " +
- montageOrder.toString() +
- " and hidden order as " + hiddenOrder.toString());
+ window.localStorage.setItem("montageHiddenOrder",
+ hiddenOrder.toString());
+ console.log("Saved " + montageOrder.toString());
+ ZMDataModel.zmLog("User press OK. Saved Monitor Order as: " +
+ montageOrder.toString() +
+ " and hidden order as " + hiddenOrder.toString());
$scope.modal.remove();
};
-
- $scope.cancelReorder = function()
- {
- // user tapped cancel
- var i,myhiddenorder;
- if (window.localStorage.getItem("montageOrder") == undefined) {
- for (i = 0; i < $scope.MontageMonitors.length; i++) {
- montageOrder[i] = i;
- hiddenOrder[i] = 0;
- }
- console.log("Order string is " + montageOrder.toString());
- ZMDataModel.zmLog("User press Cancel. Reset Monitor Order to: " + montageOrder.toString());
- }
- else // montageOrder exists
- {
- var myorder = window.localStorage.getItem("montageOrder");
-
- if (window.localStorage.getItem("montageHiddenOrder") == undefined)
- {
- for (i = 0; i < $scope.MontageMonitors.length; i++) {
- hiddenOrder[i] = 0;
- }
- }
- else
- {
- myhiddenorder = window.localStorage.getItem("montageHiddenOrder");
- hiddenOrder = myhiddenorder.split(",");
- }
-
- console.log("Montage order is " + myorder + " and hidden order is " + myhiddenorder);
- montageOrder = myorder.split(",");
-
- for (i = 0; i < montageOrder.length; i++) {
- montageOrder[i] = parseInt(montageOrder[i]);
- hiddenOrder[i] = parseInt(hiddenOrder[i]);
- }
-
- $scope.MontageMonitors = oldMonitors;
- ZMDataModel.zmLog("User press Cancel. Restored Monitor Order as: " + montageOrder.toString() + " and hidden order as: " + hiddenOrder.toString());
-
- }
- $scope.modal.remove();
+
+ $scope.cancelReorder = function () {
+ // user tapped cancel
+ var i, myhiddenorder;
+ if (window.localStorage.getItem("montageOrder") == undefined) {
+ for (i = 0; i < $scope.MontageMonitors.length; i++) {
+ montageOrder[i] = i;
+ hiddenOrder[i] = 0;
+ }
+ console.log("Order string is " + montageOrder.toString());
+ ZMDataModel.zmLog("User press Cancel. Reset Monitor Order to: " + montageOrder.toString());
+ } else // montageOrder exists
+ {
+ var myorder = window.localStorage.getItem("montageOrder");
+
+ if (window.localStorage.getItem("montageHiddenOrder") == undefined) {
+ for (i = 0; i < $scope.MontageMonitors.length; i++) {
+ hiddenOrder[i] = 0;
+ }
+ } else {
+ myhiddenorder = window.localStorage.getItem("montageHiddenOrder");
+ hiddenOrder = myhiddenorder.split(",");
+ }
+
+ console.log("Montage order is " + myorder + " and hidden order is " + myhiddenorder);
+ montageOrder = myorder.split(",");
+
+ for (i = 0; i < montageOrder.length; i++) {
+ montageOrder[i] = parseInt(montageOrder[i]);
+ hiddenOrder[i] = parseInt(hiddenOrder[i]);
+ }
+
+ $scope.MontageMonitors = oldMonitors;
+ ZMDataModel.zmLog("User press Cancel. Restored Monitor Order as: " + montageOrder.toString() + " and hidden order as: " + hiddenOrder.toString());
+
+ }
+ $scope.modal.remove();
};
-
+
$scope.toggleReorder = function () {
$scope.isReorder = !$scope.isReorder;
- $scope.data={};
+ $scope.data = {};
$scope.data.showDelete = false;
$scope.data.showReorder = false;
@@ -344,44 +332,39 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
}*/
ld = ZMDataModel.getLogin();
- if (ld.enableDebug)
- {
+ if (ld.enableDebug) {
// Lets show the re-order list
- for (i=0; i < $scope.MontageMonitors.length; i++)
- {
- ZMDataModel.zmDebug ("Montage reorder list: " + $scope.MontageMonitors[i].Monitor.Name +
- ":listdisplay->"+$scope.MontageMonitors[i].Monitor.listDisplay);
-
+ for (i = 0; i < $scope.MontageMonitors.length; i++) {
+ ZMDataModel.zmDebug("Montage reorder list: " + $scope.MontageMonitors[i].Monitor.Name +
+ ":listdisplay->" + $scope.MontageMonitors[i].Monitor.listDisplay);
+
}
}
-
+
$ionicModal.fromTemplateUrl('templates/reorder-modal.html', {
- scope:$scope,
- animation: 'slide-in-up'
- })
- .then (function(modal) {
- $scope.modal = modal;
- $scope.modal.show();
- });
-
-
-
+ scope: $scope,
+ animation: 'slide-in-up'
+ })
+ .then(function (modal) {
+ $scope.modal = modal;
+ $scope.modal.show();
+ });
+
+
+
};
-
- $scope.onSwipeLeft = function ($index)
- {
+
+ $scope.onSwipeLeft = function ($index) {
$scope.showSizeButtons = true;
};
-
- $scope.onSwipeRight= function ($index)
- {
- $timeout( function()
- {
- $scope.showSizeButtons=false;
- },1000);
-
+
+ $scope.onSwipeRight = function ($index) {
+ $timeout(function () {
+ $scope.showSizeButtons = false;
+ }, 1000);
+
};
-
+
//---------------------------------------------------------------------
// This marks a monitor as hidden in montage view
//---------------------------------------------------------------------
@@ -445,7 +428,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
//---------------------------------------------------------------------
$scope.switchMinimal = function () {
$scope.minimal = !$scope.minimal;
- ZMDataModel.zmDebug ("MontageCtrl: switch minimal is " + $scope.minimal);
+ ZMDataModel.zmDebug("MontageCtrl: switch minimal is " + $scope.minimal);
console.log("Hide Statusbar");
ionic.Platform.fullScreen($scope.minimal, !$scope.minimal);
$interval.cancel(intervalHandle); //we will renew on reload
@@ -486,20 +469,20 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
//---------------------------------------------------------------------
$scope.openModal = function (mid, controllable, controlid) {
ZMDataModel.zmDebug("MontageCtrl: Open Monitor Modal with monitor Id=" + mid + " and Controllable:" + controllable + " with control ID:" + controlid);
- // $scope.isModalActive = true;
+ // $scope.isModalActive = true;
// Note: no need to setAwake(true) as its already awake
// in montage view
ZMDataModel.zmLog("Cancelling montage timer, opening Modal");
// ZMDataModel.zmLog("Starting Modal timer");
$interval.cancel(intervalHandle);
-
+
// let's start modal timer
- // modalIntervalHandle= $interval(function () {
- // modalLoadNotifications();
+ // modalIntervalHandle= $interval(function () {
+ // modalLoadNotifications();
// console.log ("Refreshing Image...");
- // }.bind(this), 1000);
-
+ // }.bind(this), 1000);
+
$scope.monitorId = mid;
$scope.LoginData = ZMDataModel.getLogin();
@@ -512,10 +495,10 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
// if its controllable, lets get the control command
if (controllable == '1') {
- ZMDataModel.zmDebug ("MontageCtrl: getting controllable data " + myurl);
+ ZMDataModel.zmDebug("MontageCtrl: getting controllable data " + myurl);
var apiurl = $scope.LoginData.apiurl;
var myurl = apiurl + "/controls/" + controlid + ".json";
- ZMDataModel.zmDebug ("MontageCtrl: getting controllable data " + myurl);
+ ZMDataModel.zmDebug("MontageCtrl: getting controllable data " + myurl);
$http.get(myurl)
.success(function (data) {
@@ -546,12 +529,12 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
});
$scope.isControllable = controllable;
$scope.showPTZ = false;
-
+
$scope.isModalActive = true;
-
-
- $scope.modal.show();
-
+
+
+ $scope.modal.show();
+
});
};
@@ -562,25 +545,25 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
$scope.closeModal = function () {
ZMDataModel.zmDebug("MontageCtrl: Close & Destroy Monitor Modal");
- // $scope.isModalActive = false;
+ // $scope.isModalActive = false;
// Note: no need to setAwake(false) as needs to be awake
// in montage view
$scope.modal.remove();
-
+
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
- $scope.isModalActive = false;
+ $scope.isModalActive = false;
ZMDataModel.zmLog("Restarting montage timer, closing Modal...");
var ld = ZMDataModel.getLogin();
- $interval.cancel(intervalHandle);
- intervalHandle= $interval(function () {
- loadNotifications();
- // console.log ("Refreshing Image...");
- }.bind(this), ld.refreshSec*1000);
-
- //$interval.cancel(modalIntervalHandle);
+ $interval.cancel(intervalHandle);
+ intervalHandle = $interval(function () {
+ loadNotifications();
+ // console.log ("Refreshing Image...");
+ }.bind(this), ld.refreshSec * 1000);
+
+ //$interval.cancel(modalIntervalHandle);
+
-
};
@@ -644,42 +627,39 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
//---------------------------------------------------------------------
function onPause() {
- ZMDataModel.zmDebug ("MontageCtrl: onpause called");
+ ZMDataModel.zmDebug("MontageCtrl: onpause called");
$interval.cancel(intervalHandle);
- // $interval.cancel(modalIntervalHandle);
-
+ // $interval.cancel(modalIntervalHandle);
+
// FIXME: Do I need to setAwake(false) here?
}
- function onResume()
- {
- if (!$scope.isModalActive)
- {
+ function onResume() {
+ if (!$scope.isModalActive) {
var ld = ZMDataModel.getLogin();
- ZMDataModel.zmDebug ("MontageCtrl: onresume called");
- ZMDataModel.zmLog ("Restarting montage timer on resume");
+ ZMDataModel.zmDebug("MontageCtrl: onresume called");
+ ZMDataModel.zmLog("Restarting montage timer on resume");
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
$interval.cancel(intervalHandle);
- intervalHandle= $interval(function () {
- loadNotifications();
- // console.log ("Refreshing Image...");
- }.bind(this), ld.refreshSec*1000);
- }
- else // modal is active
+ intervalHandle = $interval(function () {
+ loadNotifications();
+ // console.log ("Refreshing Image...");
+ }.bind(this), ld.refreshSec * 1000);
+ } else // modal is active
{
- // $rootScope.modalRand = Math.floor((Math.random() * 100000) + 1);
+ // $rootScope.modalRand = Math.floor((Math.random() * 100000) + 1);
}
-
-
-
+
+
+
}
$scope.openMenu = function () {
- $timeout (function() {
+ $timeout(function () {
$rootScope.stateofSlide = $ionicSideMenuDelegate.isOpen();
- },500);
+ }, 500);
$ionicSideMenuDelegate.toggleLeft();
};
@@ -701,12 +681,12 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
ZMDataModel.setAwake(ZMDataModel.getKeepAwake());
$interval.cancel(intervalHandle);
- intervalHandle= $interval(function () {
- loadNotifications();
- // console.log ("Refreshing Image...");
- }.bind(this), ld.refreshSec*1000);
+ intervalHandle = $interval(function () {
+ loadNotifications();
+ // console.log ("Refreshing Image...");
+ }.bind(this), ld.refreshSec * 1000);
- loadNotifications();
+ loadNotifications();
});
$scope.$on('$ionicView.leave', function () {
@@ -715,8 +695,8 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
});
$scope.$on('$ionicView.unloaded', function () {
- // console.log("**************** CLOSING WINDOW ***************************");
- // $window.close();
+ // console.log("**************** CLOSING WINDOW ***************************");
+ // $window.close();
});
//---------------------------------------------------------
@@ -778,21 +758,20 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
// This rand is really used to reload the monitor image in img-src so it is not cached
// I am making sure the image in montage view is always fresh
// I don't think I am using this anymore FIXME: check and delete if needed
- // $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
+ // $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
});
- $scope.reloadView = function()
- {
- $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
- ZMDataModel.zmLog ("User action: image reload " + $rootScope.rand);
- };
+ $scope.reloadView = function () {
+ $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
+ ZMDataModel.zmLog("User action: image reload " + $rootScope.rand);
+ };
$scope.doRefresh = function () {
-
-
-
+
+
+
console.log("***Pull to Refresh, recomputing Rand");
- ZMDataModel.zmLog ("Reloading view for montage view, recomputing rand");
+ ZMDataModel.zmLog("Reloading view for montage view, recomputing rand");
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
$scope.monitors = [];
imageLoadingDataShare.set(0);
@@ -806,4 +785,4 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
};
-}]);
+}]); \ No newline at end of file
diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js
index 8b859a95..cfec3004 100644
--- a/www/js/PortalLoginCtrl.js
+++ b/www/js/PortalLoginCtrl.js
@@ -5,106 +5,101 @@
/* global vis,cordova,StatusBar,angular,console,moment */
angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionicPlatform', '$scope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$rootScope', '$http', '$q', '$state', '$ionicLoading', '$ionicPopover', '$ionicScrollDelegate', '$ionicModal', '$timeout', 'zmAutoLogin', '$ionicHistory', '$cordovaTouchID', function ($ionicPlatform, $scope, zm, ZMDataModel, $ionicSideMenuDelegate, $rootScope, $http, $q, $state, $ionicLoading, $ionicPopover, $ionicScrollDelegate, $ionicModal, $timeout, zmAutoLogin, $ionicHistory, $cordovaTouchID) {
-
- $scope.$on('$ionicView.enter',
- function(){
-
- ZMDataModel.zmDebug("Inside Portal login Enter handler");
-
-
- $ionicHistory.nextViewOptions({
- disableBack: true
- });
-
- $scope.pindata = {};
- if ($ionicSideMenuDelegate.isOpen()) {
- $ionicSideMenuDelegate.toggleLeft();
- ZMDataModel.zmDebug("Sliding menu close");
- }
-
- $scope.pinPrompt = false; // if true, then PIN is displayed else skip
-
- if (ZMDataModel.isLoggedIn() ) {
- ZMDataModel.zmLog("User credentials are provided");
-
- // You can login either via touch ID or typing in your code
- if ( $ionicPlatform.is('ios') && loginData.usePin)
- {
- $cordovaTouchID.checkSupport()
- .then(function () {
- // success, TouchID supported
- $cordovaTouchID.authenticate("")
- .then(function() {
- ZMDataModel.zmLog("Touch Success");
- // Don't assign pin as it may be alphanum
- unlock(true);
-
- },
- function () {
- ZMDataModel.zmLog("Touch Failed");
- });
- }, function (error) {
- ZMDataModel.zmLog("TouchID not supported");
+ $scope.$on('$ionicView.enter',
+ function () {
+
+ ZMDataModel.zmDebug("Inside Portal login Enter handler");
+
+
+ $ionicHistory.nextViewOptions({
+ disableBack: true
});
- }
- else
- {
- ZMDataModel.zmLog("Not iOS, not checking for touchID");
- }
-
- if (loginData.usePin ) {
- $scope.pinPrompt = true;
+ $scope.pindata = {};
+ if ($ionicSideMenuDelegate.isOpen()) {
+ $ionicSideMenuDelegate.toggleLeft();
+ ZMDataModel.zmDebug("Sliding menu close");
+ }
+
+
+ $scope.pinPrompt = false; // if true, then PIN is displayed else skip
+
+ if (ZMDataModel.isLoggedIn()) {
+ ZMDataModel.zmLog("User credentials are provided");
- }
- else // no PIN Code so skip
- {
+ // You can login either via touch ID or typing in your code
+ if ($ionicPlatform.is('ios') && loginData.usePin) {
+ $cordovaTouchID.checkSupport()
+ .then(function () {
+ // success, TouchID supported
+ $cordovaTouchID.authenticate("")
+ .then(function () {
+ ZMDataModel.zmLog("Touch Success");
+ // Don't assign pin as it may be alphanum
+ unlock(true);
+
+ },
+ function () {
+ ZMDataModel.zmLog("Touch Failed");
+ });
+ }, function (error) {
+ ZMDataModel.zmLog("TouchID not supported");
+ });
+ } else {
+ ZMDataModel.zmLog("Not iOS, not checking for touchID");
+ }
+
+ if (loginData.usePin) {
+ $scope.pinPrompt = true;
+
+
+ } else // no PIN Code so skip
+ {
+
+ // don't get stuck in this state
+ // will happen if you switch to background in portal state
+ if ($rootScope.lastState == "zm-portal-login") {
+ ZMDataModel.zmDebug("Last state was portal-login, so forcing montage");
+ $rootScope.lastState = "montage";
+ }
+ ZMDataModel.zmDebug("PIN code not set");
+ $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
+ zmAutoLogin.stop(); //safety
+ zmAutoLogin.start();
+ zmAutoLogin.doLogin("authenticating...")
+ .then(function (data) // success
+ {
+ ZMDataModel.zmDebug("PortalLogin: auth success");
+ ZMDataModel.getKeyConfigParams(1);
+ ZMDataModel.zmDebug("Transitioning state to: " + $rootScope.lastState ? $rootScope.lastState : 'montage');
+
+ $state.go($rootScope.lastState ? $rootScope.lastState : 'montage', $rootScope.lastStateParam);
+ },
+ // coming here means auth error
+ // so go back to login
+ function (error) {
+ ZMDataModel.zmDebug("PortalLogin: error authenticating " +
+ JSON.stringify(error));
+ $state.go('login');
+ });
+ }
+
+ } else {
+ ZMDataModel.zmDebug("PortalLogin: Not logged in, so going to login");
+ $state.go('login');
- // don't get stuck in this state
- // will happen if you switch to background in portal state
- if ($rootScope.lastState == "zm-portal-login")
- {
- ZMDataModel.zmDebug("Last state was portal-login, so forcing montage");
- $rootScope.lastState = "montage";
}
- ZMDataModel.zmDebug("PIN code not set");
- $rootScope.rand = Math.floor((Math.random() * 100000) + 1);
- zmAutoLogin.stop(); //safety
- zmAutoLogin.start();
- zmAutoLogin.doLogin("authenticating...")
- .then(function (data) // success
- {
- ZMDataModel.zmDebug("PortalLogin: auth success");
- ZMDataModel.getKeyConfigParams(1);
- ZMDataModel.zmDebug("Transitioning state to: " + $rootScope.lastState? $rootScope.lastState:'montage');
-
- $state.go($rootScope.lastState? $rootScope.lastState:'montage',$rootScope.lastStateParam);
- },
- // coming here means auth error
- // so go back to login
- function (error) {
- ZMDataModel.zmDebug("PortalLogin: error authenticating " +
- JSON.stringify(error));
- $state.go('login');
- });
- }
- } else {
- ZMDataModel.zmDebug("PortalLogin: Not logged in, so going to login");
- $state.go('login');
+ });
- }
-
- });
-
//-------------------------------------------------------------------------------
// remove status is pin is empty
//-------------------------------------------------------------------------------
-
+
$scope.pinChange = function () {
if ($scope.pindata.pin == null) {
- $scope.pindata.status = "";
+ $scope.pindata.status = "";
}
};
@@ -114,11 +109,10 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
$scope.unlock = function () {
unlock(false);
};
-
- function unlock(touchVerified)
- {
- ZMDataModel.zmDebug("Trying to unlock PIN");
- if (touchVerified || ($scope.pindata.pin == loginData.pinCode) ) {
+
+ function unlock(touchVerified) {
+ ZMDataModel.zmDebug("Trying to unlock PIN");
+ if (touchVerified || ($scope.pindata.pin == loginData.pinCode)) {
ZMDataModel.zmDebug("PIN code entered is correct");
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
zmAutoLogin.stop(); //safety
@@ -128,14 +122,14 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
{
// don't get stuck in this state
// will happen if you switch to background in portal state
- if ($rootScope.lastState == "zm-portal-login") {
- ZMDataModel.zmDebug("Last state was portal-login, so forcing montage");
- $rootScope.lastState = "montage";
- }
+ if ($rootScope.lastState == "zm-portal-login") {
+ ZMDataModel.zmDebug("Last state was portal-login, so forcing montage");
+ $rootScope.lastState = "montage";
+ }
ZMDataModel.zmDebug("PortalLogin: auth success");
ZMDataModel.getKeyConfigParams(1);
- ZMDataModel.zmDebug("Transitioning state to: " + $rootScope.lastState? $rootScope.lastState:'montage');
- $state.go($rootScope.lastState? $rootScope.lastState:'montage', $rootScope.lastStateParam);
+ ZMDataModel.zmDebug("Transitioning state to: " + $rootScope.lastState ? $rootScope.lastState : 'montage');
+ $state.go($rootScope.lastState ? $rootScope.lastState : 'montage', $rootScope.lastStateParam);
},
// coming here means auth error
// so go back to login
@@ -146,25 +140,25 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
});
} else {
$scope.pindata.status = "Invalid PIN";
-
+
// wobble the input box on error
var element = angular.element(document.getElementById("pin-box"));
-
+
element.addClass("animated shake")
- .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',
+ .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',
function () {
- element.removeClass("animated shake");
+ element.removeClass("animated shake");
});
}
}
-
+
//-------------------------------------------------------------------------------
// Controller Main
//-------------------------------------------------------------------------------
- console.log ("************* ENTERING PORTAL MAIN ");
- var loginData = ZMDataModel.getLogin();
+ console.log("************* ENTERING PORTAL MAIN ");
+ var loginData = ZMDataModel.getLogin();
+
-
}]); \ No newline at end of file
diff --git a/www/js/StateCtrl.js b/www/js/StateCtrl.js
index 05498352..bfffa49c 100644
--- a/www/js/StateCtrl.js
+++ b/www/js/StateCtrl.js
@@ -4,9 +4,8 @@
// controller for State View
-angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
- ['$ionicPopup', '$scope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicLoading', '$ionicModal', '$state', '$http', '$rootScope','$timeout',function (
- $ionicPopup, $scope, zm, ZMDataModel, $ionicSideMenuDelegate, $ionicLoading, $ionicModal, $state, $http, $rootScope, $timeout) {
+angular.module('zmApp.controllers').controller('zmApp.StateCtrl', ['$ionicPopup', '$scope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicLoading', '$ionicModal', '$state', '$http', '$rootScope', '$timeout', function (
+ $ionicPopup, $scope, zm, ZMDataModel, $ionicSideMenuDelegate, $ionicLoading, $ionicModal, $state, $http, $rootScope, $timeout) {
//----------------------------------------------------------------------
// Controller main
@@ -32,13 +31,22 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
var inProgress = 0; // prevents user from another op if one is in progress
getRunStatus();
-
+
// Let's stagger this by 500ms each to see if Chrome lets these through
// This may also help if your Apache is not configured to let multiple connections through
-
- $timeout( function() {ZMDataModel.zmDebug("invoking LoadStatus...");getLoadStatus();},500);
- $timeout( function() {ZMDataModel.zmDebug("invoking DiskStatus...");getDiskStatus();},1000);
- $timeout( function() {ZMDataModel.zmDebug("invoking CurrentState...");getCurrentState();},1500);
+
+ $timeout(function () {
+ ZMDataModel.zmDebug("invoking LoadStatus...");
+ getLoadStatus();
+ }, 500);
+ $timeout(function () {
+ ZMDataModel.zmDebug("invoking DiskStatus...");
+ getDiskStatus();
+ }, 1000);
+ $timeout(function () {
+ ZMDataModel.zmDebug("invoking CurrentState...");
+ getCurrentState();
+ }, 1500);
//-------------------------------------------------------------------------
// Lets make sure we set screen dim properly as we enter
@@ -100,12 +108,11 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
title: 'Select run state',
- subTitle: 'current state:'+$scope.customState ? ("current state: " + $scope.customState):"",
+ subTitle: 'current state:' + $scope.customState ? ("current state: " + $scope.customState) : "",
buttons: [
{
text: 'Cancel',
- onTap: function(e)
- {
+ onTap: function (e) {
return "CANCEL";
}
@@ -114,16 +121,17 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
text: 'OK',
onTap: function (e) {
return "OK";
-
+
}
}
]
});
-
- getConfig.then(function(res) {
- console.log ("GOT : " + JSON.stringify(res));
- if (res == "OK")
- {
+
+ // It seems invoking a popup within a popup handler
+ // causes issues. Doing this outside due to that reason
+ getConfig.then(function (res) {
+ console.log("GOT : " + JSON.stringify(res));
+ if (res == "OK") {
if ($scope.myopt.selectedState != "")
controlZM($scope.myopt.selectedState);
}
@@ -139,28 +147,16 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
$http.get(apiDisk)
.then(
function (success) {
- ZMDataModel.zmDebug("StateCtrl/getDiskStatus: success");
+ ZMDataModel.zmDebug("StateCtrl/getDiskStatus: success");
ZMDataModel.zmDebug("Disk results: " + JSON.stringify(success));
var obj = success.data.usage;
- if (obj.Total.space != undefined)
- {
- $scope.zmDisk = parseFloat(obj.Total.space).toFixed(1).toString()+"G";
- }
- else
- {
+ if (obj.Total.space != undefined) {
+ $scope.zmDisk = parseFloat(obj.Total.space).toFixed(1).toString() + "G";
+ } else {
$scope.zmDisk = "unknown";
ZMDataModel.zmLog("Error retrieving disk space, API returned null for obj.Total.space");
}
- /* var du = 0;
- console.log("DISK:" + JSON.stringify(success));
- for (var p in obj) {
- if (obj.hasOwnProperty(p)) {
- du += parseFloat(obj[p].space);
-
- }
- }
- $scope.zmDisk = du.toFixed(1).toString() + "G";*/
-
+
},
function (error) {
$scope.zmDisk = "unknown";
@@ -174,12 +170,12 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
// returns ZM running status
//----------------------------------------------------------------------
function getRunStatus() {
- ZMDataModel.zmDebug("StateCtrl/getRunStatus: " + apiRun);
+ ZMDataModel.zmDebug("StateCtrl/getRunStatus: " + apiRun);
$http.get(apiRun)
.then(
function (success) {
- ZMDataModel.zmDebug("StateCtrl/getRunStatus: success");
- ZMDataModel.zmDebug("Run results: " + JSON.stringify(success));
+ ZMDataModel.zmDebug("StateCtrl/getRunStatus: success");
+ ZMDataModel.zmDebug("Run results: " + JSON.stringify(success));
switch (success.data.result) {
case 1:
$scope.zmRun = 'running';
@@ -214,14 +210,14 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
// gets ZM load - max[0], avg[1], min[2]
//----------------------------------------------------------------------
function getLoadStatus() {
- ZMDataModel.zmDebug("StateCtrl/getLoadStatus: " + apiLoad);
+ ZMDataModel.zmDebug("StateCtrl/getLoadStatus: " + apiLoad);
$http.get(apiLoad)
.then(
function (success) {
ZMDataModel.zmDebug("Load results: " + JSON.stringify(success));
//console.log(JSON.stringify(success));
// load returns 3 params - one in the middle is avg.
- ZMDataModel.zmDebug("StateCtrl/getLoadStatus: success");
+ ZMDataModel.zmDebug("StateCtrl/getLoadStatus: success");
$scope.zmLoad = success.data.load[1];
@@ -240,53 +236,50 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
// start/stop/restart ZM
//----------------------------------------------------------------------
- function performZMoperation(str)
- {
-
-
- ZMDataModel.zmDebug ("inside performZMoperation with " + str);
-
-
- $scope.zmRun = "please wait...";
- $scope.color = 'color:orange;';
- $scope.customState = "";
- ZMDataModel.zmDebug("StateCtrl/controlZM: POST Control command is " + apiExec + str + ".json");
- inProgress = 1;
- $http.post(apiExec + str + ".json")
- .then(
- function (success) {
- ZMDataModel.zmDebug("StateCtrl/controlZM: returned success");
- inProgress = 0;
- switch (str) {
- case "stop":
- $scope.zmRun = 'stopped';
- $scope.color = 'color:red;';
- break;
- default:
- $scope.zmRun = 'running';
- $scope.color = 'color:green;';
- getCurrentState();
- break;
-
- }
-
- },
- function (error) {
- //if (error.status) // it seems to return error with status 0 if ok
- // {
- //console.log("ERROR in Change State:" + JSON.stringify(error));
- ZMDataModel.zmDebug("StateCtrl/controlZM: returned error");
- ZMDataModel.zmLog("Error in change run state:" + JSON.stringify(error), "error");
- $scope.zmRun = 'undetermined';
- $scope.color = 'color:orange;';
- inProgress = 0;
-
- }); //incredible nesting below. I make myself proud.
+ function performZMoperation(str) {
+
+
+ ZMDataModel.zmDebug("inside performZMoperation with " + str);
+ $scope.zmRun = "please wait...";
+ $scope.color = 'color:orange;';
+ $scope.customState = "";
+ ZMDataModel.zmDebug("StateCtrl/controlZM: POST Control command is " + apiExec + str + ".json");
+ inProgress = 1;
+ $http.post(apiExec + str + ".json")
+ .then(
+ function (success) {
+ ZMDataModel.zmDebug("StateCtrl/controlZM: returned success");
+ inProgress = 0;
+ switch (str) {
+ case "stop":
+ $scope.zmRun = 'stopped';
+ $scope.color = 'color:red;';
+ break;
+ default:
+ $scope.zmRun = 'running';
+ $scope.color = 'color:green;';
+ getCurrentState();
+ break;
+
+ }
+
+ },
+ function (error) {
+ //if (error.status) // it seems to return error with status 0 if ok
+ // {
+ //console.log("ERROR in Change State:" + JSON.stringify(error));
+ ZMDataModel.zmDebug("StateCtrl/controlZM: returned error");
+ ZMDataModel.zmLog("Error in change run state:" + JSON.stringify(error), "error");
+ $scope.zmRun = 'undetermined';
+ $scope.color = 'color:orange;';
+ inProgress = 0;
+
+ });
}
-
-
+
+
function controlZM(str) {
if (inProgress) {
ZMDataModel.zmDebug("StateCtrl/controlZM: operation in progress");
@@ -296,16 +289,16 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
});
return;
}
-
- var statesearch = "startstoprestart";
-
- var promptstring = 'Are you sure you want to ' + str + ' Zoneminder?';
+
+ var statesearch = "startstoprestart";
+
+ var promptstring = 'Are you sure you want to ' + str + ' Zoneminder?';
if (statesearch.indexOf(str) == -1) {
promptstring = "Are you sure you want to change state to " + str;
}
-
-
- $ionicPopup.show({
+
+
+ $ionicPopup.show({
title: 'Please Confirm',
template: promptstring,
buttons: [
@@ -317,15 +310,13 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
text: 'Yes',
type: 'button-assertive',
onTap: function (e) {
- performZMoperation(str);
+ performZMoperation(str);
}
}
]
- });
-
-
+ });
+
-
}
// Binder so template can call controlZM
@@ -349,7 +340,7 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
$scope.doRefresh = function () {
console.log("***Pull to Refresh");
- ZMDataModel.zmDebug("StateCtrl/refresh: calling getRun/Load/Disk/CurrentState");
+ ZMDataModel.zmDebug("StateCtrl/refresh: calling getRun/Load/Disk/CurrentState");
getRunStatus();
getLoadStatus();
getDiskStatus();
@@ -358,4 +349,4 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl',
};
-}]);
+}]); \ No newline at end of file
diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js
index 1fdb03a9..b7d56ffd 100644
--- a/www/js/TimelineCtrl.js
+++ b/www/js/TimelineCtrl.js
@@ -23,11 +23,16 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
}
}];
+ //-----------------------------------------------------------
+ // Used to display date range for timeline
+ //-----------------------------------------------------------
$scope.prettify = function (str) {
return moment(str).format('MMMM Do YYYY, h:mm:ssa');
};
-
+ //-----------------------------------------------------------
+ // used for playback when you tap on a timeline event
+ //-----------------------------------------------------------
$scope.calcMsTimer = function (frames, len) {
var myframes, mylen;
myframes = parseFloat(frames);
@@ -37,9 +42,11 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
return (Math.round(1000 / (myframes / mylen)));
};
- function move(percentage)
- {
- var range = timeline.getWindow();
+ //-----------------------------------------------------------
+ // Move/Zoom are used to move the timeline around
+ //-----------------------------------------------------------
+ function move(percentage) {
+ var range = timeline.getWindow();
var interval = range.end - range.start;
timeline.setWindow({
@@ -48,8 +55,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
});
}
- function zoom (percentage)
- {
+ function zoom(percentage) {
var range = timeline.getWindow();
var interval = range.end - range.start;
@@ -142,7 +148,6 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
};
-
$scope.mycarousel.index = 0;
$scope.ionRange.index = 1;
//console.log("**Resetting range");
@@ -157,7 +162,6 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
});
}
-
// now get event details to show alarm frames
var loginData = ZMDataModel.getLogin();
var myurl = loginData.apiurl + '/events/' + eid + ".json";
@@ -184,11 +188,10 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
}
- //console.log (JSON.stringify(data));
})
.error(function (err) {
ZMDataModel.zmLog("Error retrieving detailed frame API " + JSON.stringify(err));
- ZMDataModel.displayBanner ('error', ['error retrieving event details', 'please try again']);
+ ZMDataModel.displayBanner('error', ['error retrieving event details', 'please try again']);
});
$scope.totalEventTime = Math.round(parseFloat(edur)) - 1;
@@ -231,18 +234,18 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
}
};
-
-
- //-------------------------------------------------------------------------
- // called when user switches to background
- //-------------------------------------------------------------------------
- function onPause() {
- ZMDataModel.zmDebug ("TimelineCtrl:onpause called");
- console.log("*** Moving to Background ***"); // Handle the pause event
-
- if ($scope.popover) $scope.popover.remove();
-
- }
+
+
+ //-------------------------------------------------------------------------
+ // called when user switches to background
+ //-------------------------------------------------------------------------
+ function onPause() {
+ ZMDataModel.zmDebug("TimelineCtrl:onpause called");
+ console.log("*** Moving to Background ***"); // Handle the pause event
+
+ if ($scope.popover) $scope.popover.remove();
+
+ }
//--------------------------------------------------------
@@ -251,9 +254,9 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
//--------------------------------------------------------
function showEvent(start, mid, edur, eframes, eid, ename) {
- ZMDataModel.zmDebug ("TimelineCtrl/showevent called with start:" +
- start + " monitorId:" + mid + " dur:" + edur + " frames:" + eframes +
- " eventId:" + eid + " eventName:" +ename);
+ ZMDataModel.zmDebug("TimelineCtrl/showevent called with start:" +
+ start + " monitorId:" + mid + " dur:" + edur + " frames:" + eframes +
+ " eventId:" + eid + " eventName:" + ename);
//console.log("Event STARTED WITH " + start);
var str = start;
var yy = moment(str).format('YY');
@@ -322,11 +325,11 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
// Make sure sliding for menu is disabled so it
// does not interfere with graph panning
$ionicSideMenuDelegate.canDragContent(false);
-
- document.addEventListener("pause", onPause, false);
+
+ document.addEventListener("pause", onPause, false);
// FIXME: Timeline awake to avoid graph redrawing
- ZMDataModel.setAwake(ZMDataModel.getKeepAwake());
+ ZMDataModel.setAwake(ZMDataModel.getKeepAwake());
$scope.$watch('ionRange.index', function () {
// console.log ("***ION RANGE CHANGED");
@@ -360,16 +363,16 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
var toDate = moment().endOf('day').format("YYYY-MM-DD HH:mm:ss");
- //Simulated data
+ //Simulated data
/*
fromDate = "2015-08-18 00:00:00";
toDate = "2015-08-18 23:59:59";
*/
-
+
$scope.fromDate = fromDate;
$scope.toDate = toDate;
-
-
+
+
var maxItems = zm.graphItemMax; // THAT magic # --> 300 and ZM on my m/c cries
$scope.maxItems = maxItems;
@@ -377,7 +380,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
ZMDataModel.zmDebug("TimelineCtrl/drawGraph: graphLoaded is " + $scope.graphLoaded);
//flat colors for graph - https://flatuicolors.com http://www.flatuicolorpicker.com
- var colors = ['#3498db', '#D2527F', '#f39c12', '#9b59b6', '#e74c3c','#7A942E',];
+ var colors = ['#3498db', '#D2527F', '#f39c12', '#9b59b6', '#e74c3c', '#7A942E', ];
var container;
container = angular.element(document.getElementById('visualization'));
@@ -405,33 +408,25 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
timeline.fit();
};
- $scope.toggleNav = function()
- {
- if (navControls == true)
- {
- navControls=!navControls;
+ $scope.toggleNav = function () {
+ if (navControls == true) {
+ navControls = !navControls;
// give out animation time
- $timeout ( function()
- {
+ $timeout(function () {
$scope.navControls = navControls;
- },2000);
- }
- else
- {
- navControls=!navControls;
+ }, 2000);
+ } else {
+ navControls = !navControls;
$scope.navControls = navControls;
}
var element = angular.element(document.getElementById("timeline-ctrl"));
- if (navControls)
- {
- element.removeClass("animated bounceOutLeft");
- element.addClass("animated bounceInRight");
- }
- else
- {
- element.removeClass("animated bounceInRight");
- element.addClass("animated bounceOutLeft");
+ if (navControls) {
+ element.removeClass("animated bounceOutLeft");
+ element.addClass("animated bounceInRight");
+ } else {
+ element.removeClass("animated bounceInRight");
+ element.addClass("animated bounceOutLeft");
}
};
@@ -500,12 +495,11 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
duration: zm.loadingTimeout, //specifically for Android - http seems to get stuck at times
});
- ZMDataModel.zmLog ("TimelineCtrl/drawgraph: from->"+fromDate+" to->"+toDate+" count:"+count);
+ ZMDataModel.zmLog("TimelineCtrl/drawgraph: from->" + fromDate + " to->" + toDate + " count:" + count);
$scope.graphLoaded = false;
- ZMDataModel.zmDebug ("TimelineCtrl/drawgraph: graphLoaded:"+$scope.graphLoaded);
+ ZMDataModel.zmDebug("TimelineCtrl/drawgraph: graphLoaded:" + $scope.graphLoaded);
- if (timeline)
- {
+ if (timeline) {
ZMDataModel.zmDebug("TimelineCtrl/drawgraph: destroying timeline as it exists");
timeline.destroy();
}
@@ -519,7 +513,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
var options = {
editable: false,
- throttleRedraw:100,
+ throttleRedraw: 100,
moveable: true,
zoomable: true,
selectable: true,
@@ -575,117 +569,114 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
$q.all(promises)
.then(function (data) {
- ZMDataModel.zmDebug ("TimelineCtrl/drawgraph: all pages of graph data received");
- graphIndex = 0;
- ZMDataModel.zmLog ("Creating " + $scope.monitors.length + " groups for the graph");
- // create groups
- for (var g = 0; g < $scope.monitors.length; g++) {
- groups.add({
- id: $scope.monitors[g].Monitor.Id,
- content: ZMDataModel.getMonitorName($scope.monitors[g].Monitor.Id)
- });
- ZMDataModel.zmDebug ("TimelineCtrl/drawgraph:Adding group " +
- ZMDataModel.getMonitorName($scope.monitors[g].Monitor.Id));
- }
-
-
-
- for (var j = 0; j < data.length; j++) {
- var myevents = data[j];
-
- if (graphIndex > zm.graphItemMax)
- {
- ZMDataModel.zmLog ("Exiting page count graph - reached limit of " + zm.graphItemMax);
- break;
-
- }
+ ZMDataModel.zmDebug("TimelineCtrl/drawgraph: all pages of graph data received");
+ graphIndex = 0;
+ ZMDataModel.zmLog("Creating " + $scope.monitors.length + " groups for the graph");
+ // create groups
+ for (var g = 0; g < $scope.monitors.length; g++) {
+ groups.add({
+ id: $scope.monitors[g].Monitor.Id,
+ content: ZMDataModel.getMonitorName($scope.monitors[g].Monitor.Id)
+ });
+ ZMDataModel.zmDebug("TimelineCtrl/drawgraph:Adding group " +
+ ZMDataModel.getMonitorName($scope.monitors[g].Monitor.Id));
+ }
- for (var i = 0; i < myevents.length; i++) {
-
- graphData.add({
- id: graphIndex,
- content: "<span class='my-vis-font'>"+ myevents[i].Event.Notes + "</span>",
- start: myevents[i].Event.StartTime,
- end: myevents[i].Event.EndTime,
- group: myevents[i].Event.MonitorId,
- //type: "range",
- style: "background-color:" + colors[parseInt(myevents[i].Event.MonitorId) % colors.length] + ";border-color:" + colors[parseInt(myevents[i].Event.MonitorId) % colors.length],
- myframes: myevents[i].Event.Frames,
- mydur: myevents[i].Event.Length,
- myeid: myevents[i].Event.Id,
- myename: myevents[i].Event.Name,
- });
- //console.log ("Added: Monitor:"+myevents[i].Event.MonitorId +
- // " Start:" + myevents[i].Event.StartTime +
- // " Stop:"+myevents[i].Event.EndTime);
-
- graphIndex++;
-
- if (graphIndex > zm.graphItemMax)
- {
- ZMDataModel.zmLog ("Exiting event graph - reached limit of " + zm.graphItemMax);
+
+ for (var j = 0; j < data.length; j++) {
+ var myevents = data[j];
+
+ if (graphIndex > zm.graphItemMax) {
+ ZMDataModel.zmLog("Exiting page count graph - reached limit of " + zm.graphItemMax);
break;
-
+
}
- }
- }
+ for (var i = 0; i < myevents.length; i++) {
- timeline = new vis.Timeline(container[0], null, options);
-
- timeline.setItems(graphData);
- timeline.setGroups(groups);
- timeline.fit();
-
- $ionicLoading.hide();
- $scope.graphLoaded = true;
- ZMDataModel.zmDebug ("graph loaded: " + $scope.graphLoaded);
- $scope.navControls = false;
- timeline.on('select', function (properties) {
- if (properties.items && !isNaN(properties.items[0])) {
- ZMDataModel.zmDebug("TimelineCtrl/drawGraph:You clicked on item " + properties.items);
- var item = graphData.get(properties.items);
- ZMDataModel.zmDebug("TimelineCtrl/drawGraph: clicked item details:" + JSON.stringify(item));
- showEvent(item[0].start, item[0].group, item[0].mydur, item[0].myframes, item[0].myeid, item[0].myename);
-
-
- } else {
- $ionicLoading.show({
- template: "Zoom in more to scrub events...",
- animation: 'fade-in',
- showBackdrop: true,
- maxWidth: 200,
- showDelay: 0,
- duration: 1500,
- });
- console.log("Zoomed out too far to playback events");
+ graphData.add({
+ id: graphIndex,
+ content: "<span class='my-vis-font'>" + myevents[i].Event.Notes + "</span>",
+ start: myevents[i].Event.StartTime,
+ end: myevents[i].Event.EndTime,
+ group: myevents[i].Event.MonitorId,
+ //type: "range",
+ style: "background-color:" + colors[parseInt(myevents[i].Event.MonitorId) % colors.length] +
+ ";border-color:" + colors[parseInt(myevents[i].Event.MonitorId) % colors.length],
+ myframes: myevents[i].Event.Frames,
+ mydur: myevents[i].Event.Length,
+ myeid: myevents[i].Event.Id,
+ myename: myevents[i].Event.Name,
+
+ });
+
+ graphIndex++;
+
+ if (graphIndex > zm.graphItemMax) {
+ ZMDataModel.zmLog("Exiting event graph - reached limit of " + zm.graphItemMax);
+ break;
+
+ }
+
+ }
}
- });
- },
- function (error) {
- ZMDataModel.displayBanner ('error', 'Timeline error', 'Please try again');
-
- }
-
-
- ); // get Events
+ timeline = new vis.Timeline(container[0], null, options);
+ timeline.setItems(graphData);
+ timeline.setGroups(groups);
+ timeline.fit();
+
+ $ionicLoading.hide();
+ $scope.graphLoaded = true;
+ ZMDataModel.zmDebug("graph loaded: " + $scope.graphLoaded);
+ $scope.navControls = false;
+ timeline.on('select', function (properties) {
+ if (properties.items && !isNaN(properties.items[0])) {
+ ZMDataModel.zmDebug("TimelineCtrl/drawGraph:You clicked on item " + properties.items);
+ var item = graphData.get(properties.items);
+ ZMDataModel.zmDebug("TimelineCtrl/drawGraph: clicked item details:" + JSON.stringify(item));
+ showEvent(item[0].start, item[0].group, item[0].mydur, item[0].myframes, item[0].myeid, item[0].myename);
+
+
+ } else {
+ $ionicLoading.show({
+ template: "Zoom in more to scrub events...",
+ animation: 'fade-in',
+ showBackdrop: true,
+ maxWidth: 200,
+ showDelay: 0,
+ duration: 1500,
+ });
+ console.log("Zoomed out too far to playback events");
+ }
+
+ });
+ },
+ function (error) {
+ ZMDataModel.displayBanner('error', 'Timeline error', 'Please try again');
+
+ }
+
+ ); // get Events
});
}
- $scope.radialMenuOptions = {
+ $scope.radialMenuOptions = {
content: '',
- size:'small',
+ size: 'small',
background: '#982112',
isOpen: false,
toggleOnClick: false,
button: {
cssClass: 'fa fa-compress fa-2x',
- size:'small',
- onclick: function() { console.log ("fitting");timeline.fit();}
+ size: 'small',
+ onclick: function () {
+ console.log("fitting");
+ timeline.fit();
+ }
},
items: [
{
@@ -702,7 +693,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
cssClass: 'fa fa-chevron-circle-up',
empty: true,
onclick: function () {
- // controlPTZ($scope.monitorId, 'DownLeft');
+
}
},
@@ -712,7 +703,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
empty: false,
onclick: function () {
- //controlPTZ($scope.monitorId, 'Left');
+
move(0.2);
}
},
@@ -730,8 +721,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
cssClass: 'fa fa-chevron-circle-up',
empty: true,
onclick: function () {
- //controlPTZ($scope.monitorId, 'UpLeft');
-
+
}
},
@@ -740,7 +730,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
cssClass: 'fa fa-plus-circle',
empty: false,
onclick: function () {
- //controlPTZ($scope.monitorId, 'Up');
+
zoom(-0.2);
}
},
@@ -750,8 +740,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
cssClass: 'fa fa-chevron-circle-up',
empty: true,
onclick: function () {
- //controlPTZ($scope.monitorId, 'UpRight');
-
+
}
},
@@ -768,7 +757,6 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
cssClass: 'fa fa-chevron-circle-up',
empty: false,
onclick: function () {
- //controlPTZ($scope.monitorId, 'Right');
move(-0.2);
}
},
@@ -779,7 +767,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
cssClass: 'fa fa-chevron-circle-up',
empty: true,
onclick: function () {
- //controlPTZ($scope.monitorId, 'DownRight');
+
}
},
@@ -790,10 +778,11 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
console.log('About');
}
},
- ]};
-
-
+ ]
+ };
+
+
-}]);
+}]); \ No newline at end of file
diff --git a/www/js/app.js b/www/js/app.js
index 53aa5480..131b23f9 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -152,7 +152,8 @@ angular.module('zmApp', [
if ($attributes.imageSpinnerLoader) {
loader.remove();
}
- $element[0].style.backgroundImage = 'url(' + $attributes.imageSpinnerSrc + ')'; // set style attribute on element (it will load image)
+ // set style attribute on element (it will load image)
+ $element[0].style.backgroundImage = 'url(' + $attributes.imageSpinnerSrc + ')';
};
bgImg.src = $attributes.imageSpinnerSrc;
//console.log ("DIRECTIVE: BGIMAGE SRC SET TO " + $attributes.imageSpinnerSrc);
@@ -169,7 +170,7 @@ angular.module('zmApp', [
$element.on('$destroy', function () {
// console.log ("**************** DIRECTIVE DESTROY IMAGE: " + $element[0].src);
});
- // $element[0].src = "img/novideo.png";
+ // $element[0].src = "img/novideo.png";
}
};
@@ -191,19 +192,19 @@ angular.module('zmApp', [
'request': function (config) {
// config.withCredentials = true;
if (zmCookie) {
- config.headers.Cookie = "ZMSESSID=" + zmCookie;
+ config.headers.Cookie = "ZMSESSID=" + zmCookie;
}
- if ((config.url.indexOf("/api/states/change/") > -1) ||
+ 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 ))
-
-
+ (config.url.indexOf("daemonCheck.json") > -1) ||
+ (config.url.indexOf("getLoad.json") > -1))
+
+
{
// these can take time, so lets bump up timeout
config.timeout = zm.largeHttpTimeout;
//ZMDataModel.zmDebug("timeoutHttpIntercept: HTTP request with long response time. Timeout set to "+config.timeout);
-
+
} else {
config.timeout = zm.httpTimeout;
}
@@ -244,25 +245,9 @@ angular.module('zmApp', [
//------------------------------------------------------------------
$rootScope.$on("auth-error", function () {
-
- ZMDataModel.zmDebug ("zmAutoLogin: Inside auth-error emit");
- ZMDataModel.displayBanner ('error',['ZoneMinder authentication failed', 'Please check settings']);
-
-
-
-
- /*var alertPopup = $ionicPopup.alert(
- {
- title: 'Zoneminder authentication failed',
- template: 'This might be a temporary situation and may result in zmNinja not working properly. Please try to log in again.'
- });
-
- // close it after 5 seconds
- $timeout(function() {
- ZMDataModel.zmLog("Hiding auth error dialog box");
- alertPopup.close();
- },5000);*/
+ ZMDataModel.zmDebug("zmAutoLogin: Inside auth-error emit");
+ ZMDataModel.displayBanner('error', ['ZoneMinder authentication failed', 'Please check settings']);
});
@@ -282,12 +267,11 @@ angular.module('zmApp', [
$timeout(function () {
contentBannerInstance();
}, 2000);
- ZMDataModel.zmDebug ("auth-success emit:Successful");
- //console.log("**** ZM LOGIN SUCCESS INTERCEPT");
- });
+ ZMDataModel.zmDebug("auth-success emit:Successful");
+ });
+
+
-
-
//------------------------------------------------------------------
// doLogin() is the function that tries to login to ZM
@@ -316,30 +300,27 @@ angular.module('zmApp', [
}
ZMDataModel.isReCaptcha()
- .then (function(result) {
- if (result == true)
- {
- $ionicLoading.hide();
- ZMDataModel.displayBanner ('error',
- ['reCaptcha must be disabled',
- ],"",8000);
- var alertPopup = $ionicPopup.alert(
- {
+ .then(function (result) {
+ if (result == true) {
+ $ionicLoading.hide();
+ ZMDataModel.displayBanner('error', ['reCaptcha must be disabled',
+ ], "", 8000);
+ var alertPopup = $ionicPopup.alert({
title: 'reCaptcha enabled',
template: 'Looks like you have enabled reCaptcha. It needs to be turned off for zmNinja to work'
- });
+ });
+
+ // close it after 5 seconds
+ $timeout(function () {
+
+ alertPopup.close();
+ }, 5000);
+ }
- // close it after 5 seconds
- $timeout(function() {
-
- alertPopup.close();
- },5000);
- }
-
});
-
-
+
+
var loginData = ZMDataModel.getLogin();
$http({
method: 'POST',
@@ -378,7 +359,7 @@ angular.module('zmApp', [
if (data.indexOf(zm.loginScreenString) == -1) {
$rootScope.loggedIntoZm = 1;
-
+
ZMDataModel.zmLog("zmAutologin successfully logged into Zoneminder");
d.resolve("Login Success");
@@ -394,28 +375,25 @@ angular.module('zmApp', [
d.reject("Login Error");
}
-
+
// Now go ahead and re-get auth key
- $rootScope.authSession="undefined";
+ $rootScope.authSession = "undefined";
var ld = ZMDataModel.getLogin();
ZMDataModel.getAuthKey()
- .then(function(success)
- {
-
- console.log (success);
- $rootScope.authSession = success;
- ZMDataModel.zmLog ("Stream authentication construction: " +
- $rootScope.authSession);
-
- },
- function (error)
- {
- console.log (error);
- //$rootScope.authSession="";
- ZMDataModel.zmLog ("Modal: Error returned Stream authentication construction. Retaining old value of: " + $rootScope.authSession);
+ .then(function (success) {
+
+ console.log(success);
+ $rootScope.authSession = success;
+ ZMDataModel.zmLog("Stream authentication construction: " +
+ $rootScope.authSession);
+
+ },
+ function (error) {
+ console.log(error);
+
+ ZMDataModel.zmLog("Modal: Error returned Stream authentication construction. Retaining old value of: " + $rootScope.authSession);
});
-
return (d.promise);
})
@@ -423,8 +401,9 @@ angular.module('zmApp', [
$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
+ ZMDataModel.zmLog("zmAutologin Error " + JSON.stringify(error),
+ "error, but not calling auth-error emit");
+ // bad urls etc come here
$rootScope.$emit('auth-error', error);
d.reject("Login Error");
@@ -520,7 +499,7 @@ angular.module('zmApp', [
console.log("********NEW Computed Dev Width & Height as" + $rootScope.devWidth + "*" + $rootScope.devHeight);
- };
+ };
window.addEventListener("resize", checkOrientation, false);
@@ -549,7 +528,7 @@ angular.module('zmApp', [
$ionicPlatform.ready(function () {
- console.log("**** DEVICE READY ***");
+ console.log("**** DEVICE READY ***");
// generates and error in desktops but works fine
ZMDataModel.zmLog("Device is ready");
console.log("**** DEVICE READY ***");
@@ -566,8 +545,8 @@ angular.module('zmApp', [
});
-
-
+
+
//fileLogger is an excellent cross platform library
// that allows you to manage log files without worrying about
@@ -615,40 +594,37 @@ angular.module('zmApp', [
// 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 () {
- ZMDataModel.zmLog("App is resuming from background");
+ ZMDataModel.zmLog("App is resuming from background");
// don't animate
$ionicHistory.nextViewOptions({
- disableAnimate: true,
- disableBack: true
- });
-
+ disableAnimate: true,
+ disableBack: true
+ });
+
// remember the last state so we can
// go back there after auth
- if ($ionicHistory.currentView)
- {
+ if ($ionicHistory.currentView) {
$rootScope.lastState = $ionicHistory.currentView().stateName;
$rootScope.lastStateParam =
$ionicHistory.currentView().stateParams;
- ZMDataModel.zmDebug ("Last State recorded:" +
- JSON.stringify($ionicHistory.currentView()));
-
+ ZMDataModel.zmDebug("Last State recorded:" +
+ JSON.stringify($ionicHistory.currentView()));
+
$state.go("zm-portal-login");
- }
- else
- {
+ } else {
$rootScope.lastState = "";
$rootScope.lastStateParam = "";
}
- //$ionicSideMenuDelegate.toggleLeft(false);
+ //$ionicSideMenuDelegate.toggleLeft(false);
//ZMDataModel.validatePin()
-
+
}, false);
document.addEventListener("pause", function () {
console.log("****The application is going into background");
ZMDataModel.zmLog("App is going into background");
-
+
zmAutoLogin.stop();
}, false);