diff options
| author | pliablepixels <pliablepixels@gmail.com> | 2016-04-21 09:09:22 -0400 |
|---|---|---|
| committer | pliablepixels <pliablepixels@gmail.com> | 2016-04-21 09:09:22 -0400 |
| commit | d99c6ffb8ed5b05101dd1d89585cd4bd622262d9 (patch) | |
| tree | 47c82d6974b8d47de3aa8746b1fb443dec47f9bb /www/js | |
| parent | a0d5234fe7c16d78c243079fae0b9a4798cdcd0b (diff) | |
#228 initial code
Former-commit-id: a3de04e4b05eecb335611d1ba720548c25c6e8ef
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/DataModel.js | 2 | ||||
| -rw-r--r-- | www/js/DevOptionsCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/LoginCtrl.js | 57 |
3 files changed, 58 insertions, 3 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 9e6188aa..6fb94989 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -821,7 +821,7 @@ angular.module('zmApp.controllers') }) .error (function(error) { zmLog("Error retrieving ZM_PATH_ZMS: " + JSON.stringify(error)); - d.resolve(""); + d.reject(""); return (d.promise); }); return (d.promise); diff --git a/www/js/DevOptionsCtrl.js b/www/js/DevOptionsCtrl.js index 3196acbc..a85322cd 100644 --- a/www/js/DevOptionsCtrl.js +++ b/www/js/DevOptionsCtrl.js @@ -21,7 +21,7 @@ angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope' { $rootScope.alarmCount="0"; $ionicHistory.nextViewOptions({disableBack: true}); - ZMDataModel.$state.("events", {"id": 0}, { reload: true }); + $state.go("events", {"id": 0}, { reload: true }); } }; diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index e91c12d8..157a2546 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -1,6 +1,6 @@ /* jshint -W041 */ /* jslint browser: true*/ -/* global cordova,StatusBar,angular,console */ +/* global cordova,StatusBar,angular,console,alert,URI */ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$rootScope', 'zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$ionicPopup', '$http', '$q', '$ionicLoading', 'zmAutoLogin', '$cordovaPinDialog', 'EventServer', '$ionicHistory', '$state', '$ionicActionSheet', 'SecuredPopups', '$localstorage', function ($scope, $rootScope, zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, zmAutoLogin, $cordovaPinDialog, EventServer, $ionicHistory, $state, $ionicActionSheet, SecuredPopups, $localstorage) { $scope.openMenu = function () { @@ -245,7 +245,62 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r $scope.ignoreDirty = false; }); + // Make a noble attempt at deciphering + $scope.detectCgi = function() + { + var text = "Typical values:<br/><b>ubuntu:</b> http://server/zm/cgi-bin<br/><b>centos/fedora:</b> http://server/zm/cgi-bin-zm/"; + + if ($scope.loginData.url.slice(-1) == '/') { + $scope.loginData.url = $scope.loginData.url.slice(0, -1); + + } + + ZMDataModel.getPathZms() + .then (function (data) + { + var c=URI.parse($scope.loginData.url); + var p1,p2,p3; + p1 =""; + p2 =""; + + if (c.userinfo) + p1 = c.userinfo+"@"; + if (c.port) + p2 = ":"+c.port; + + var baseUri = c.scheme+"://"+p1+c.host+p2; + var dtext = baseUri + data.toLowerCase().trim(); + dtext = dtext.substr(0, dtext.lastIndexOf("/")); + + text = "Your cgi-bin path may be " + dtext + "<br/><br/>" + text; + + $rootScope.zmPopup = SecuredPopups.show('show',{ + title: 'cgi-bin settings', + cssClass: 'popup90', + template: text, + buttons: [{text: 'Ok'},{text:'Use suggestion', onTap:function(e) {$scope.loginData.streamingurl=dtext;}}] + + }); + + + }, + function (error) + { + ZMDataModel.zmDebug ("Could not get PATH_ZMS:"+JSON.stringify(error)); + text = "(could not detect cgi-path, try coming back here after setting up your portal url and credentials correctly)<br/><br/>"+text; + $rootScope.zmPopup = SecuredPopups.show('alert',{ + title: 'cgi-bin settings', + cssClass: 'popup90', + + template: text + }); + + }); + + + + }; //-------------------------------------------------------------------------- // When PIN is enabled, this is called to specify a PIN |
