summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/index.html2
-rw-r--r--www/js/EventCtrl.js2
-rw-r--r--www/js/FirstUseCtrl.js2
-rw-r--r--www/js/LoginCtrl.js26
-rw-r--r--www/js/MonitorCtrl.js2
-rw-r--r--www/js/MontageCtrl.js2
-rw-r--r--www/js/PortalLoginCtrl.js6
-rw-r--r--www/js/WizardCtrl.js142
-rw-r--r--www/js/app.js4
-rw-r--r--www/templates/wizard.html35
10 files changed, 158 insertions, 65 deletions
diff --git a/www/index.html b/www/index.html
index e23f40a0..2ed9c3ca 100644
--- a/www/index.html
+++ b/www/index.html
@@ -216,7 +216,7 @@
System Status
</ion-item>
- <ion-item nav-clear menu-close href="#/login">
+ <ion-item nav-clear menu-close href="#/login/false">
<span style="float:right;margin-top:-18px;background-color:#444444;color:#fff;font-size:11px;opacity:0.7;width:90px;border-radius: 0px 0px 5px 5px;:text-overflow:ellipsis;overflow:hidden;white-space:nowrap;display:inline-block;text-align:center;">&nbsp;{{$root.getProfileName();}}&nbsp;</span>
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index e9cd22b7..28b64adc 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -172,7 +172,7 @@ angular.module('zmApp.controllers')
$ionicHistory.nextViewOptions({
disableBack: true
});
- $state.go("login");
+ $state.go("login" ,{"wizard": false});
return;
}
diff --git a/www/js/FirstUseCtrl.js b/www/js/FirstUseCtrl.js
index 7e36160e..f774534b 100644
--- a/www/js/FirstUseCtrl.js
+++ b/www/js/FirstUseCtrl.js
@@ -25,7 +25,7 @@ $scope.openMenu = function () {
disableAnimate: false,
disableBack: true
});
- $state.go ("login");
+ $state.go("login" ,{"wizard": false});
};
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index ea96233d..eb2e5583 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -2,7 +2,7 @@
/* jslint browser: true*/
/* 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) {
+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', '$stateParams', function ($scope, $rootScope, zm, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $ionicPopup, $http, $q, $ionicLoading, zmAutoLogin, $cordovaPinDialog, EventServer, $ionicHistory, $state, $ionicActionSheet, SecuredPopups, $localstorage, $stateParams) {
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
};
@@ -105,7 +105,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
var zmServers = ZMDataModel.getServerGroups();
$scope.loginData = zmServers[serverbuttons[index].text];
- console.log ("NEW LOOGIN OBJECT IS " + JSON.stringify($scope.loginData));
+ console.log ("NEW LOGIN OBJECT IS " + JSON.stringify($scope.loginData));
$scope.check.isUseAuth = ($scope.loginData.isUseAuth == '1') ? true : false;
@@ -203,6 +203,28 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
}
+ ZMDataModel.zmDebug ("Does login need to hear the wizard? " + $stateParams.wizard);
+
+ if ($stateParams.wizard == "true")
+ {
+ ZMDataModel.zmLog ("Creating new login entry for wizard");
+ $scope.loginData = angular.copy(ZMDataModel.getDefaultLoginObject());
+ $scope.loginData.url = $rootScope.wizard.loginURL;
+ $scope.loginData.apiurl = $rootScope.wizard.apiURL;
+ $scope.loginData.streamingurl = $rootScope.wizard.streamingURL;
+ if ($rootScope.wizard.useauth && $rootScope.wizard.usezmauth)
+ {
+ $scope.loginData.username = $rootScope.wizard.zmuser;
+ $scope.loginData.password = $rootScope.wizard.zmpassword;
+ if ((/^https:\/\//i.test($scope.loginData.url)))
+ {
+ $scope.loginData.useSSL = true;
+ }
+ }
+
+ }
+
+
});
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js
index 1fb24a67..2fe04cd3 100644
--- a/www/js/MonitorCtrl.js
+++ b/www/js/MonitorCtrl.js
@@ -32,7 +32,7 @@ angular.module('zmApp.controllers')
$ionicHistory.nextViewOptions({
disableBack: true
});
- $state.go("login");
+ $state.go("login" ,{"wizard": false});
return;
}
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index 46699655..ab7d5260 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -49,7 +49,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', '
$ionicHistory.nextViewOptions({
disableBack: true
});
- $state.go("login");
+ $state.go("login" ,{"wizard": false});
return;
}
diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js
index abd4641a..5ac5aed6 100644
--- a/www/js/PortalLoginCtrl.js
+++ b/www/js/PortalLoginCtrl.js
@@ -89,7 +89,7 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
disableAnimate: true,
disableBack: true
});
- $state.go('login');
+ $state.go("login" ,{"wizard": false});
}
else
{
@@ -221,13 +221,13 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
disableAnimate: true,
disableBack: true
});
- $state.go('login');
+ $state.go("login" ,{"wizard": false});
}
else
{
// if user cancelled auth I guess we go to login
$rootScope.userCancelledAuth = false;
- $state.go('login');
+ $state.go("login" ,{"wizard": false});
}
});
}
diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js
index 24b5b93e..9f662adf 100644
--- a/www/js/WizardCtrl.js
+++ b/www/js/WizardCtrl.js
@@ -56,13 +56,45 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
d.reject(false);
return d.promise;
}
- });
+ })
+ .error (function (error) {
+ console.log("************ERROR");
+ $scope.wizard.portalValidText = "Portal login was unsuccessful";
+ $scope.wizard.portalColor = "#e74c3c";
+ d.reject(false);
+ return d.promise;
+
+ });
return d.promise;
}
+ function getFirstMonitor()
+ {
+ var d=$q.defer(); $http.get($scope.wizard.apiURL+"/monitors.json")
+ .then (function (success) {
+ if (success.data.monitors.length > 0)
+ {
+
+ ZMDataModel.zmDebug("zmWizard - getFirstMonitor returned " + success.data.monitors[0].Monitor.Id); d.resolve(success.data.monitors[0].Monitor.Id);
+ return d.promise;
+
+ }
+ else
+ {
+ d.reject(false);
+ return d.promise;
+ }
+ },
+ function (error) {
+ d.reject(false);
+ return d.promise;
+ });
+ return d.promise;
+ }
+
//--------------------------------------------------------------------------
// Utility function - iterates through a list of URLs
//--------------------------------------------------------------------------
@@ -133,27 +165,38 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
function continueCgi (urls)
{
- var tail = "/nph-zms?mode=single&monitor=1";
- if ($scope.wizard.useauth && $scope.wizard.usezmauth)
- {
- tail+= "&user="+$scope.wizard.zmuser+"&pass="+$scope.wizard.zmpassword;
- }
- findFirstReachableUrl(urls,tail )
- .then (function (success) {
- ZMDataModel.zmLog ("Valid cgi-bin found with: " + success);
- $scope.wizard.streamingURL = success;
- $scope.wizard.streamingValidText = "cgi-bin detection succeeded: "+$scope.wizard.streamingURL;
- $scope.wizard.streamingColor = "#16a085";
- d.resolve(true);
- return d.promise;
-
+ getFirstMonitor()
+ .then (function (success){
+
+ var tail = "/nph-zms?mode=single&monitor="+success;
+ if ($scope.wizard.useauth && $scope.wizard.usezmauth)
+ {
+ tail+= "&user="+$scope.wizard.zmuser+"&pass="+$scope.wizard.zmpassword;
+ }
+ findFirstReachableUrl(urls,tail )
+ .then (function (success) {
+ ZMDataModel.zmLog ("Valid cgi-bin found with: " + success);
+ $scope.wizard.streamingURL = success;
+ $scope.wizard.streamingValidText = "cgi-bin detection succeeded: "+$scope.wizard.streamingURL;
+ $scope.wizard.streamingColor = "#16a085";
+ d.resolve(true);
+ return d.promise;
+
+ },
+ function (error) {
+ console.log ("No cgi-bin found: " + error);
+ $scope.wizard.streamingValidText = "cgi-bin detection failed";
+ $scope.wizard.streamingColor = "#e74c3c";
+ d.reject (false);
+ return (d.promise);
+ });
},
- function (error) {
- console.log ("No cgi-bin found: " + error);
- $scope.wizard.streamingValidText = "cgi-bin detection failed";
- $scope.wizard.streamingColor = "#e74c3c";
- d.reject (false);
- return (d.promise);
+ function (error){
+ $scope.wizard.streamingValidText = "cgi-bin detection failed. No configured monitor found.";
+ $scope.wizard.streamingColor = "#e74c3c";
+ d.reject (false);
+ return (d.promise);
+
});
}
@@ -172,7 +215,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
{
var u = $scope.wizard.loginURL;
var d = $q.defer();
- var api1 = u ;
+ var api1 = u+"/api" ;
var c = URI.parse(u);
// lets also try without the path
@@ -180,16 +223,20 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
if (c.userinfo) api2+= c.userinfo+"@";
api2 +=c.host;
if (c.port) api2+= ":"+c.port;
+ api2+="/api";
// lets try both /zm/api and /api. What else is there?
var apilist = [api1, api2];
- findFirstReachableUrl(apilist, '/api/host/getVersion.json')
+ findFirstReachableUrl(apilist, '/host/getVersion.json')
.then (function (success) {
ZMDataModel.zmLog ("Valid API response found with:" + success);
$scope.wizard.apiURL = success;
+
+
+
$scope.wizard.apiValidText = "API detection succeeded: "+$scope.wizard.apiURL;
$scope.wizard.apiColor = "#16a085";
d.resolve(true);
@@ -235,16 +282,22 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
view: "login"
}
})
- .finally(function (ans) {
- return d.resolve(true);
-
- });
-
+ .then (function (success) {console.log ("ZMlogout success"); d.resolve(true); return d.promise;}, function (error) {console.log ("ZMlogout success");d.resolve(true); return d.promise;});
+
return d.promise;
}
+
+ $scope.enterResults = function()
+ {
+ $scope.portalValidText = "";
+ $scope.apiValidateText = "";
+ $scope.streamingValidateText = "";
+ $scope.wizard.fqportal = "";
+ return true;
+ };
//--------------------------------------------------------------------------
// tries to log into the portal and then discover api and cgi-bin
//--------------------------------------------------------------------------
@@ -310,7 +363,16 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
detectapi()
.then (function (success) {
ZMDataModel.zmLog ("zmWizard: API succeeded");
- return d.resolve(true);
+ // CGI detection
+ detectcgi ()
+ .then (function (success) {
+ // return true here because we want to progress
+ return d.resolve(true);
+ },
+ function (error) {
+ // return true here because we want to progress
+ return d.resolve(true);
+ });
},
function (error) {
ZMDataModel.zmLog("zmWizard: api failed");
@@ -319,16 +381,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
return d.resolve(true);
});
- // CGI detection
- detectcgi ()
- .then (function (success) {
- // return true here because we want to progress
- return d.resolve(true);
- },
- function (error) {
- // return true here because we want to progress
- return d.resolve(true);
- });
+
},
// if login failed, don't progress in the wizard
@@ -336,7 +389,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
ZMDataModel.zmLog("zmWizard: login failed");
$scope.wizard.portalValidText = "Portal login was unsuccessful. Please go back and review your settings";
$scope.wizard.portalColor = "#e74c3c";
- return d.resolve(false);
+ return d.resolve(true);
});
@@ -499,6 +552,14 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
$scope.wizard.tiptext = "show tip";
};
+ $scope.gotoLoginState = function()
+ {
+ $rootScope.wizard = angular.copy($scope.wizard);
+ $ionicHistory.nextViewOptions({
+ disableBack: true
+ });
+ $state.go("login", {"wizard":true});
+ };
//--------------------------------------------------------------------------
// initial
@@ -506,6 +567,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
$scope.$on('$ionicView.beforeEnter', function () {
//console.log("**VIEW ** Help Ctrl Entered");
+ var monId = -1;
$scope.wizard = {
tipshow: false,
tiptext: "show tip",
diff --git a/www/js/app.js b/www/js/app.js
index 18fdc820..664511be 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1106,7 +1106,7 @@ angular.module('zmApp', [
disableBack: true
});
$rootScope.userCancelledAuth = true;
- $state.go("login");
+ $state.go("login" ,{"wizard": false});
};
@@ -1419,7 +1419,7 @@ angular.module('zmApp', [
data: {
requireLogin: false
},
- url: "/login",
+ url: "/login/:wizard",
templateUrl: "templates/login.html",
controller: 'zmApp.LoginCtrl',
diff --git a/www/templates/wizard.html b/www/templates/wizard.html
index 3524c7fd..9549ae7b 100644
--- a/www/templates/wizard.html
+++ b/www/templates/wizard.html
@@ -29,7 +29,7 @@
</div>
<br/>
- <button class="button icon icon-right ion-chevron-right" wz-next>Next</button>
+ <button class="button button-small icon icon-right ion-chevron-right" wz-next>Next</button>
</wz-step>
@@ -72,34 +72,43 @@
</div>
<br/>
- <button class="button icon icon-left ion-chevron-left" wz-previous>Prev</button>
- <button class="button icon icon-right ion-chevron-right" wz-next>Next</button>
+ <button class="button button-small icon icon-left ion-chevron-left" wz-previous>Prev</button>
+ <button class="button button-small icon icon-right ion-chevron-right" wz-next>Next</button>
</wz-step>
<!-- validate url with auth -->
- <wz-step wz-title="3" canexit="exitValidate">
+ <wz-step wz-title="3" canexit="exitValidate" canenter="enterResults">
<h4>Lets try and validate your inputs</h4>
<p>I am now going to try and log into the ZM portal
+ <br/>Tap on Next to start.
<br/>
</p>
- <button class="button icon icon-left ion-chevron-left" wz-previous>Prev</button>
- <button class="button icon icon-right ion-chevron-right" wz-next>Next</button>
+ <button class="button button-small icon icon-left ion-chevron-left" wz-previous>Prev</button>
+ <button class="button button-small icon icon-right ion-chevron-right" wz-next>Next</button>
</wz-step>
- <wz-step wz-title="4" >
+ <wz-step wz-title="4" >
<h4>Results of auto-detection</h4>
- <span style="color:{{wizard.portalColor}};"><i ng-class="wizard.portalColor=='#16a085' ? 'ion-checkmark-circled':'ion-close-circled'"></i>&nbsp;{{wizard.portalValidText}}</span><br/>
+ <span ng-if="wizard.portalValidText" style="color:{{wizard.portalColor}};"><i ng-class="wizard.portalColor=='#16a085' ? 'ion-checkmark-circled':'ion-close-circled'"></i>&nbsp;{{wizard.portalValidText}}<br/></span>
- <span style="color:{{wizard.apiColor}};"><i ng-class=" wizard.apiColor=='#16a085' ? 'ion-checkmark-circled':'ion-close-circled'"></i>&nbsp;{{wizard.apiValidText}}</span><br/>
+ <span ng-if="wizard.apiValidText" style="color:{{wizard.apiColor}};"><i ng-class=" wizard.apiColor=='#16a085' ? 'ion-checkmark-circled':'ion-close-circled'"></i>&nbsp;{{wizard.apiValidText}}<br/></span>
+
+ <span ng-if="wizard.streamingValidText" style="color:{{wizard.streamingColor}};"><i ng-class="wizard.streamingColor=='#16a085' ? 'ion-checkmark-circled':'ion-close-circled'"></i>&nbsp;{{wizard.streamingValidText}}<br/></span>
- <span style="color:{{wizard.streamingColor}};"><i ng-class="wizard.streamingColor=='#16a085' ? 'ion-checkmark-circled':'ion-close-circled'"></i>&nbsp;{{wizard.streamingValidText}}</span>
<br/>
-
- <button class="button icon icon-left ion-chevron-left" wz-previous>Prev</button>
- <button class="button icon icon-right ion-chevron-right" wz-next>Validate</button>
+ <div class="wizardtip">
+ zmWizard has tried its best to autodetect what it could. You could either:
+ <ul>
+ <li>Go back to previous steps and re-do</li>
+ <li>Go to the login screen with these findings auto filled in</li>
+ </ul>
+ </div>
+ <br/><br/>
+ <button class="button button-small icon icon-left ion-chevron-left" wz-previous>Prev</button>
+ <button class="button button-small icon icon-right ion-chevron-right" ng-click="gotoLoginState()">Go to Login Screen</button>
</wz-step>