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 | |
| parent | a0d5234fe7c16d78c243079fae0b9a4798cdcd0b (diff) | |
#228 initial code
Former-commit-id: a3de04e4b05eecb335611d1ba720548c25c6e8ef
| -rw-r--r-- | www/css/style.css | 5 | ||||
| -rw-r--r-- | www/js/DataModel.js | 2 | ||||
| -rw-r--r-- | www/js/DevOptionsCtrl.js | 2 | ||||
| -rw-r--r-- | www/js/LoginCtrl.js | 57 | ||||
| -rw-r--r-- | www/templates/events.html | 18 | ||||
| -rw-r--r-- | www/templates/login.html | 8 |
6 files changed, 78 insertions, 14 deletions
diff --git a/www/css/style.css b/www/css/style.css index 4eca8318..3f08dbd8 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -389,6 +389,11 @@ http://www.cssportal.com/tryit/index.php?file=blog/css-notification-badge */ width:80% !important; } +.popup90 .popup +{ + width:90% !important; +} + .events-modal-camera-icon { position:absolute; 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 diff --git a/www/templates/events.html b/www/templates/events.html index 483308f2..c9400acb 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -41,9 +41,9 @@ <ion-item collection-repeat="event in events| filter:search.text" item-height="event.Event.height" id="item-{{$index}}" > - <span style="float:right;margin-top:-18px;background-color:#6d0909;color:#fff;font-size:11px;opacity:0.7;width:90px;border-radius: 0px 0px 5px 5px;"> <i class="ion-clock"></i> {{::prettifyTime(event.Event.StartTime)}}</span> + <span style="float:right;margin-top:-18px;background-color:#6d0909;color:#fff;font-size:11px;opacity:0.7;width:90px;border-radius: 0px 0px 5px 5px;"> <i class="ion-clock"></i> {{prettifyTime(event.Event.StartTime)}}</span> - <span style="float:left;margin-top:-18px;background-color:#444444;color:#fff;font-size:11px;opacity:0.7;width:90px;border-radius: 0px 0px 5px 5px;"> <i class="ion-calendar"></i> {{::prettifyDate(event.Event.StartTime)}}</span> + <span style="float:left;margin-top:-18px;background-color:#444444;color:#fff;font-size:11px;opacity:0.7;width:90px;border-radius: 0px 0px 5px 5px;"> <i class="ion-calendar"></i> {{prettifyDate(event.Event.StartTime)}}</span> <div class="row"> @@ -80,27 +80,27 @@ <br/> <span style="font-size:80%; color:rgb(110,110,110)"> - {{::event.Event.Length}}s + {{event.Event.Length}}s </span> </div> <!-- col col left--> <div class="col col-80"> <div class="item-text-wrap"> <i class="ion-monitor"></i> - <b>{{::event.Event.MonitorName}}</b> ({{::event.Event.Name}}) + <b>{{event.Event.MonitorName}}</b> ({{event.Event.Name}}) </div> - <i class="ion-images"></i> {{::event.Event.Frames}} - <i class="ion-ios-bell-outline"></i> {{::event.Event.AlarmFrames}} - <i class="ion-arrow-graph-up-right"></i> {{::event.Event.TotScore}} + <i class="ion-images"></i> {{event.Event.Frames}} + <i class="ion-ios-bell-outline"></i> {{event.Event.AlarmFrames}} + <i class="ion-arrow-graph-up-right"></i> {{event.Event.TotScore}} </div> </div> <!--row--> <div class="row" style="font-size:80%; color:rgb(110,110,110)"> - <div class="item-text-wrap"><i class="ion-calendar"></i> {{::prettify(event.Event.StartTime)}} + <div class="item-text-wrap"><i class="ion-calendar"></i> {{prettify(event.Event.StartTime)}} <br/> - <i class="ion-clipboard"></i> {{::event.Event.Notes}} + <i class="ion-clipboard"></i> {{event.Event.Notes}} <!-- <br/> Default video:{{event.Event.relativePath}}{{event.Event.DefaultVideo}}--> </div> </div> diff --git a/www/templates/login.html b/www/templates/login.html index 6e9280cb..9a7794cc 100644 --- a/www/templates/login.html +++ b/www/templates/login.html @@ -56,15 +56,19 @@ placeholder="ZM portal url " ng-model="loginData.url" ng-keyup="portalKeypress($event)"> </label> - <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();"> <i class="ion-help-circled"></i> help</span> + + <span class="input-label">path to cgi-bin</span> <input autocapitalize="none" autocomplete="off" autocorrect="off" type="text" placeholder="eg. server.com/zm/cgi-bin" ng-model="loginData.streamingurl"> - </label> + </label> <label class="item item-input item-floating-label" > <span class="input-label">ZM api url</span> <input autocapitalize="none" |
