From 2b007d28e89202b5ca55ce663d742df43afdd972 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Mon, 12 Sep 2016 14:30:29 -0400 Subject: #325 - force timeline to english - it only supports two locales Former-commit-id: a2d9586dc2ed2cfe82cf71b604dc702d8402fef7 --- www/js/DataModel.js | 2 +- www/js/TimelineCtrl.js | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'www') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index dcd6b768..bcbce199 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -40,7 +40,7 @@ angular.module('zmApp.controllers') text: 'Portugese', value: 'pt' }, - /*{ + /* { text: 'Arabic', value: 'ar' }, diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js index b7624c1b..8626fccd 100644 --- a/www/js/TimelineCtrl.js +++ b/www/js/TimelineCtrl.js @@ -127,7 +127,8 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla fromDate = ds.format("YYYY-MM-DD HH:mm:ss"); toDate = es.format("YYYY-MM-DD HH:mm:ss"); - + + $scope.fromDate = fromDate; $scope.toDate = toDate; $rootScope.customTimelineRange = false; @@ -527,6 +528,10 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla curFromDate = fromDate; curToDate = toDate; curCount = count; + + + var fromDateNoLang = moment(fromDate).locale('en').format("YYYY-MM-DD HH:mm:ss"); + var toDateNoLang = moment(toDate).locale('en').format("YYYY-MM-DD HH:mm:ss"); $ionicLoading.show({ template: $translate.instant('kLoadingGraph') + "...", @@ -537,7 +542,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla duration: zm.loadingTimeout, //specifically for Android - http seems to get stuck at times }); - NVRDataModel.log("TimelineCtrl/drawgraph: from->" + fromDate + " to->" + toDate + " count:" + count); + NVRDataModel.log("TimelineCtrl/drawgraph: from->" + fromDateNoLang + " to->" + toDateNoLang + " count:" + count); $scope.graphLoaded = false; NVRDataModel.debug("TimelineCtrl/drawgraph: graphLoaded:" + $scope.graphLoaded); @@ -552,18 +557,19 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla //console.log ("AFTER VIS"); + var options = { - + editable: false, throttleRedraw: 100, moveable: true, zoomable: true, selectable: true, - start: fromDate, - end: toDate, + start: moment(fromDate).locale('en').format("YYYY-MM-DD HH:mm:ss"), + end: moment(toDate).locale('en').format("YYYY-MM-DD HH:mm:ss"), orientation: 'top', - min: fromDate, - max: toDate, + min: moment(fromDate).locale('en').format("YYYY-MM-DD HH:mm:ss"), + max: moment(toDate).locale('en').format("YYYY-MM-DD HH:mm:ss"), zoomMin: 1 * 60 * 1000, // 1 min stack: false, format: { @@ -581,7 +587,10 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla var graphIndex = 1; // will be used for graph ID - NVRDataModel.getEventsPages(0, fromDate, toDate) + + console.log ("**NOLANG" + fromDateNoLang + " " + toDateNoLang); + + NVRDataModel.getEventsPages(0, fromDateNoLang, toDateNoLang) .then(function (data) { var pages = parseInt(data.pageCount); var itemsPerPage = parseInt(data.limit); @@ -597,7 +606,7 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla // I am waiting for the full data to load before I draw var promises = []; while ((pages > 0) && (iterCount > 0)) { - var promise = NVRDataModel.getEvents(0, pages, "none", fromDate, toDate); + var promise = NVRDataModel.getEvents(0, pages, "none", fromDateNoLang, toDateNoLang); promises.push(promise); pages--; iterCount--; -- cgit v1.2.3