summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorpliablepixels <pliablepixels@gmail.com>2016-04-21 15:23:42 -0400
committerpliablepixels <pliablepixels@gmail.com>2016-04-21 15:23:42 -0400
commit3fe790551c69ba379615baffed6fa97a2d03399d (patch)
treec54d902b6634baf2b1bae5161d2913d3904349c3 /www
parent3b82e939beb7bd2cdbee8727c1ca3690ba10a3b0 (diff)
#228 - more edits, and detections of login state
Former-commit-id: 3cd040ba77434af6c3a92ff4ba3c87112f14af90
Diffstat (limited to 'www')
-rw-r--r--www/js/LoginCtrl.js71
-rw-r--r--www/templates/login.html2
2 files changed, 64 insertions, 9 deletions
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index 157a2546..f89ed726 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -249,7 +249,33 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
$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 == "")
+ {
+ $rootScope.zmPopup = SecuredPopups.show('show',{
+ title: 'Portal not configured',
+ cssClass: 'popup90',
+ template: "Please fill in your login details as well as portal URL and save it before you try to detect the cgi-path",
+ buttons: [{text: 'Ok'}]
+
+ });
+ return;
+
+ }
+
+ if ( $rootScope.authSession == 'undefined')
+ {
+ $rootScope.zmPopup = SecuredPopups.show('show',{
+ title: 'Not logged in',
+ cssClass: 'popup90',
+ template: "It doesn't look like you are logged in. For detection to work, you must fill in your login details, portal URL and then tap on Save. Then come back to this feature.",
+ buttons: [{text: 'Ok'}]
+
+ });
+ return;
+ }
+
+ var defaultText = "<br/><br/>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);
@@ -259,8 +285,9 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
ZMDataModel.getPathZms()
.then (function (data)
{
+ // coming here means we were able to login
var c=URI.parse($scope.loginData.url);
- var p1,p2,p3;
+ var p1,p2,p3,text;
p1 ="";
p2 ="";
@@ -273,22 +300,41 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
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',{
+ // have we already set the right path?
+ if (dtext == $scope.loginData.streamingurl.toLowerCase())
+ {
+ text = "It looks like you have already set your cgi-path correctly to <b>" + dtext +"</b>, which is what ZoneMinder reports too";
+
+ $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;}}]
+ buttons: [{text: 'Ok'}]
- });
+ });
+
+ }
+ else
+ {
+ text = "Zoneminder reports your cgi-bin path as <b>"+dtext+"</b>, while you have it set as "+$scope.loginData.streamingurl.toLowerCase();
+
+ $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;}}, /*{text:'try harder', onTap:function(e) {tryHarder();}}*/]
+
+ });
+ }
+
+
},
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;
+ var text = "(could not detect cgi-path, try coming back here after setting up your portal url and credentials correctly, and saving)<br/><br/>"+defaultText;
$rootScope.zmPopup = SecuredPopups.show('alert',{
title: 'cgi-bin settings',
cssClass: 'popup90',
@@ -301,6 +347,15 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
};
+
+ function tryHarder()
+ {
+ $rootScope.zmPopup = SecuredPopups.show('alert',{
+ title: 'Harder',
+ cssClass: 'popup90',
+ template: "trying harder"
+ });
+ }
//--------------------------------------------------------------------------
// When PIN is enabled, this is called to specify a PIN
diff --git a/www/templates/login.html b/www/templates/login.html
index 9a7794cc..b9954ba6 100644
--- a/www/templates/login.html
+++ b/www/templates/login.html
@@ -59,7 +59,7 @@
<label class="item item-input item-floating-label" >
- <span style="float:right;margin-top:-7px;background-color:#6d0909;color:#fff;font-size:14px;opacity:0.7;width:30px;border-radius: 0px 0px 5px 5px;" on-tap="detectCgi();">&nbsp;&nbsp;&nbsp;<i class="ion-help-circled"></i>&nbsp;&nbsp;help</span>
+ <span style="float:right;margin-top:-7px;background-color:#6d0909;color:#fff;font-size:14px;opacity:0.7;width:30px;border-radius: 0px 0px 5px 5px;" on-tap="detectCgi();">&nbsp;&nbsp;&nbsp;<i class="ion-wand"></i>&nbsp;&nbsp;help</span>
<span class="input-label">path to cgi-bin</span>