diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-31 10:54:32 -0400 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-31 10:54:32 -0400 |
| commit | b20e0e323bf95ad32520f012bb404efec7d9fed1 (patch) | |
| tree | 689b160efd45dba33a64f5d4d7a6399814aceb17 /www/js | |
| parent | 9fd21b4416f88092e6010df90391ec0d851a8f91 (diff) | |
#59 desktop mode support
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/DataModel.js | 2 | ||||
| -rw-r--r-- | www/js/EventCtrl.js | 17 | ||||
| -rw-r--r-- | www/js/app.js | 37 |
3 files changed, 50 insertions, 6 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index cafb3b36..3ea54158 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -334,6 +334,8 @@ angular.module('zmApp.controllers') }, getLogin: function () { + + return loginData; }, diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 816d25e4..483e3d55 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -17,7 +17,8 @@ angular.module('zmApp.controllers') //--------------------------------------------------- var loginData = ZMDataModel.getLogin(); - + + $scope.hours = []; $scope.days = []; @@ -87,6 +88,11 @@ angular.module('zmApp.controllers') $scope.myfilter = ""; $scope.eventCommands = eventCommands; $scope.loginData = ZMDataModel.getLogin(); + $scope.playbackURL = $scope.loginData.url; + if ($rootScope.platformOS == "unknown") + { + $scope.playbackURL = zm.desktopUrl; + } $scope.mycarousel = { index: 0 @@ -1105,6 +1111,15 @@ angular.module('zmApp.controllers') $scope.eFramesNum = eframes; $scope.eventDur = Math.round(edur); $scope.loginData = ZMDataModel.getLogin(); + + $scope.playbackURL = $scope.loginData.url; + if ($rootScope.platformOS == "unknown") + { + $scope.playbackURL = zm.desktopUrl; + } + + + $scope.eventBasePath = basepath; $scope.relativePath = relativepath; $rootScope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111; diff --git a/www/js/app.js b/www/js/app.js index 0f65d43b..5e0a8a65 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -29,7 +29,7 @@ angular.module('zmApp', [ //----------------------------------------------- .constant('zm', { - minAppVersion: '1.28.107', // if ZM is less than this, the app won't work + minAppVersion: '1.28.105', // if ZM is less than this, the app won't work minEventServerVersion: '0.4', gcmSenderId:'710936220256', httpTimeout: 15000, @@ -57,7 +57,9 @@ angular.module('zmApp', [ montageScaleFrequency: 300, eventsListDetailsHeight: 200.0, eventsListScrubHeight: 300, - loginScreenString: "var currentView = 'login'" // Isn't there a better way? + loginScreenString: "var currentView = 'login'", // Isn't there a better way? + desktopUrl:"/zm", + desktopApiUrl: "/api/zm" }) //------------------------------------------------------------------ @@ -195,11 +197,33 @@ angular.module('zmApp', [ // That way the user can try again, and won't get stuck // Also remember you need to add it to .config //------------------------------------------------------------------ -.factory('timeoutHttpIntercept', function ($rootScope, $q, zm) { +.factory('timeoutHttpIntercept', [ '$rootScope', '$q', 'zm', '$injector', function ( $rootScope, $q, zm, $injector) { var zmCookie = ""; return { 'request': function (config) { + + + if ($rootScope.platformOS == "unknown") + { + var zmD = $injector.get('ZMDataModel'); + var ld = zmD.getLogin(); + + // This takes care of url and apiurl as they have + // the same base + if (config.url.indexOf(ld.url) > -1) + { + zmD.zmDebug("Running in desktop, removing URLs for proxy"); + zmD.zmDebug ("OLD URL " + config.url); + config.url = config.url.replace(ld.url,zm.desktopUrl); + zmD.zmDebug ("NEW URL " + config.url); + } + + + + } + + // config.withCredentials = true; if (zmCookie) { config.headers.Cookie = "ZMSESSID=" + zmCookie; @@ -240,7 +264,7 @@ angular.module('zmApp', [ }; -}) +}]) //----------------------------------------------------------------- // This service automatically logs into ZM at periodic intervals @@ -328,9 +352,10 @@ angular.module('zmApp', [ }); - + var loginData = ZMDataModel.getLogin(); + //ZMDataModel.zmDebug ("*** AUTH LOGIN URL IS " + loginData.url); $http({ method: 'POST', //withCredentials: true, @@ -969,6 +994,8 @@ angular.module('zmApp', [ $urlRouterProvider.otherwise(function ($injector, $location) { var $state = $injector.get("$state"); + //console.log ("******************* OTHERWISE PROBLEM"); + var $rootScope = $injector.get('$rootScope'); $state.go("zm-portal-login"); }); |
