From c652eda24f3caa446815194f32b78d049fa99076 Mon Sep 17 00:00:00 2001 From: Arjun Roychowdhury Date: Sat, 14 Nov 2015 14:17:25 -0500 Subject: Initial commits - #83 Former-commit-id: 2ee7fa15e0bd6964a5437a537aa4ebca5c0428c9 --- www/js/DataModel.js | 3 ++- www/js/LogCtrl.js | 2 +- www/js/LoginCtrl.js | 17 ++++++++++++++++- www/templates/login.html | 10 +++++++++- 4 files changed, 28 insertions(+), 4 deletions(-) (limited to 'www') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index f948e38b..9f6b6451 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -27,6 +27,7 @@ angular.module('zmApp.controllers') var serverGroupList={}; var loginData = { + 'serverName':'', 'username': '', 'password': '', 'url': '', // This is the ZM portal path @@ -107,7 +108,7 @@ angular.module('zmApp.controllers') zmDebug ("DataModel/setLogin: writing " + JSON.stringify(newLogin)); $localstorage.setObject($rootScope.currentServerGroup, loginData); - serverGroupList[$rootScope.currentServerGroup]=loginData; + serverGroupList[loginData.serverName]=loginData; console.log (JSON.stringify(serverGroupList)); $localstorage.setObject("serverlist", serverGroupList); diff --git a/www/js/LogCtrl.js b/www/js/LogCtrl.js index d544e419..ac027ccc 100644 --- a/www/js/LogCtrl.js +++ b/www/js/LogCtrl.js @@ -1,6 +1,6 @@ /* jshint -W041 */ /* jslint browser: true*/ -/* global saveAs, cordova,StatusBar,angular,console */ +/* global saveAs, cordova,StatusBar,angular,console,moment */ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$rootScope','zm', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$fileLogger', '$cordovaEmailComposer', '$ionicPopup', '$timeout', '$ionicHistory', '$state', '$interval', function ($scope, $rootScope,zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $fileLogger, $cordovaEmailComposer, $ionicPopup, $timeout, $ionicHistory, $state, $interval) { $scope.openMenu = function () { diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 1199d78a..27673c54 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -176,6 +176,8 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r function saveItems() { + + console.log('Saving login'); ZMDataModel.setFirstUse(false); @@ -324,7 +326,20 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r } $scope.saveItems = function () { - saveItems(); + + if (!$scope.loginData.serverName) + { + $ionicPopup.alert({ + title:'Error', + template: 'Server Name cannot be empty', + }) + .then(function(res) + {return;}); + } + else + { + saveItems(); + } }; diff --git a/www/templates/login.html b/www/templates/login.html index ab7891df..533f68f1 100644 --- a/www/templates/login.html +++ b/www/templates/login.html @@ -14,10 +14,18 @@ + +
+ Server Name:  + +
+
- ZoneMinder Settings for {{$root.currentServerGroup}} + ZoneMinder Settings for {{loginData.serverName || "(unknown)"}}
-- cgit v1.2.3