diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-14 18:47:12 -0500 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-11-14 18:47:12 -0500 |
| commit | 0fd6a9966ae83fb9b5f08f8a398e786615ecd9d3 (patch) | |
| tree | 3d8dc35de0ee7dbdd1fae4541bfde125a42c2dc5 /www/js/LoginCtrl.js | |
| parent | a7240a7cbcdddacbd7d865d9ba10042a0acb886b (diff) | |
#83 - stuff mostly working - data switching is in place
Former-commit-id: b580fe5785166f667ca03193630516158f6a7f0f
Diffstat (limited to 'www/js/LoginCtrl.js')
| -rw-r--r-- | www/js/LoginCtrl.js | 71 |
1 files changed, 32 insertions, 39 deletions
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index c5ba53c9..ec0c3939 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -7,6 +7,10 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r $ionicSideMenuDelegate.toggleLeft(); }; + + var serverbuttons = []; + var availableServers; + //---------------------------------------------------------------- // Alarm notification handling //---------------------------------------------------------------- @@ -27,50 +31,24 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r isUseAuth: "", isUseEventServer: "" }; + $scope.check.isUseAuth = ($scope.loginData.isUseAuth == '1') ? true : false; $scope.check.isUseEventServer = ($scope.loginData.isUseEventServer == '1') ? true : false; - + + console.log ("*************************************************"); + + + availableServers = Object.keys(ZMDataModel.getServerGroups()); + serverbuttons = []; + for (var servIter=0; servIter<availableServers.length; servIter++) + { + serverbuttons.push({text: availableServers[servIter]}); + console.log ("ADDING : "+availableServers[servIter]); + } $scope.serverActionSheet = function () { var hideSheet = $ionicActionSheet.show({ - buttons: [ - { - text: 'New Group...' - }, - { - text: 'New Group...' - }, - { - text: 'New Group...' - }, - { - text: 'New Group...' - }, - { - text: 'New Group...' - }, - { - text: 'New Group...' - }, - { - text: 'New Group...' - }, - { - text: 'New Group...' - }, - { - text: 'New Group...' - }, - { - text: 'New Group...' - }, - - { - text: 'Rename' - }, - - - ], + buttons: serverbuttons, destructiveText: 'Delete', titleText: 'Manage Server Groups', cancelText: 'Cancel', @@ -78,6 +56,10 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r // add cancel code.. }, buttonClicked: function (index) { + console.log ("YOU WANT " + serverbuttons[index].text + " INDEX " + index); + var zmServers = ZMDataModel.getServerGroups(); + $scope.loginData = zmServers[serverbuttons[index].text]; + return true; } }); @@ -107,6 +89,9 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r $scope.$on('$ionicView.enter', function () { console.log("**VIEW ** LoginCtrl Entered"); ZMDataModel.setAwake(false); + + + }); @@ -366,6 +351,14 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r else { saveItems(); + availableServers = Object.keys(ZMDataModel.getServerGroups()); + serverbuttons = []; + for (var servIter=0; servIter<availableServers.length; servIter++) + { + serverbuttons.push({text: availableServers[servIter]}); + console.log ("ADDING : "+availableServers[servIter]); + } + } |
