summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjun Roychowdhury <pliablepixels@gmail.com>2015-11-28 07:01:04 -0500
committerArjun Roychowdhury <pliablepixels@gmail.com>2015-11-28 07:01:04 -0500
commitb73bbbccb4aaadd7513edf5e393710b36fa3d984 (patch)
tree22c0ff847319fe0d8733fde04ce395a2f2888994
parentc590ca90128aaa3c72da9b7bfaf15615f447b5f3 (diff)
various fixes
Former-commit-id: 780f7f5dba161552d4aaf377e993fdd7810eb23b
-rw-r--r--www/external/angular-carousel.js1
-rw-r--r--www/js/DataModel.js205
-rw-r--r--www/js/ModalCtrl.js62
-rw-r--r--www/js/MonitorCtrl.js14
-rw-r--r--www/js/app.js32
-rw-r--r--www/templates/devoptions.html2
-rw-r--r--www/templates/events.html2
7 files changed, 57 insertions, 261 deletions
diff --git a/www/external/angular-carousel.js b/www/external/angular-carousel.js
index 32d57ae2..5705688c 100644
--- a/www/external/angular-carousel.js
+++ b/www/external/angular-carousel.js
@@ -37,6 +37,7 @@ angular.module('angular-carousel')
var stopAutoPlay = function() {
if (scope.autoSlider) {
+ console.log ("Cancelling timer");
$interval.cancel(scope.autoSlider);
scope.autoSlider = null;
}
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index 1260f19b..56204c98 100644
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -193,7 +193,6 @@ angular.module('zmApp.controllers')
serverGroupList = $localstorage.getObject("serverGroupList");
- //console.log ("!!!!!!!!!!!!!!!!!serverGroupList is " + JSON.stringify(serverGroupList));
var sname =
$localstorage.get("defaultServerName");
//console.log ("!!!!!!!!!!!!!!!!!!default server name is " + sname);
@@ -209,210 +208,6 @@ angular.module('zmApp.controllers')
zmLog ("defaultServer configuration NOT found. Keeping login at defaults");
}
- /*
-
- if (window.localStorage.getItem("enableDebug") != undefined) {
- var dbgvalue = window.localStorage.getItem("enableDebug");
- loginData.enableDebug = (dbgvalue == "1") ? true:false;
- zmLog("enableDebug is ON");
-
- }
- else
- {
- zmLog ("enableDebug is OFF");
- }
- if (window.localStorage.getItem("isUseAuth") != undefined) {
- loginData.isUseAuth =
- window.localStorage.getItem("isUseAuth");
-
-
- }
- else
- {
- loginData.isUseAuth = "1"; // lets assume there is auth
- zmLog("I did not find isUseAuth. Older version of app, maybe.");
- }
-
-
- if (window.localStorage.getItem("isUseEventServer") != undefined) {
- loginData.isUseEventServer =
- window.localStorage.getItem("isUseEventServer");
-
-
- }
- else
- {
- loginData.isUseEventServer = "0";
-
- }
-
- if (window.localStorage.getItem("disablePush") != undefined) {
- loginData.disablePush =
- window.localStorage.getItem("disablePush");
-
-
- }
- else
- {
- loginData.disablePush = "0";
-
- }
-
-
- if (window.localStorage.getItem("username") != undefined) {
- loginData.username =
- window.localStorage.getItem("username");
-
- }
-
-
- if (window.localStorage.getItem("refreshSec") != undefined) {
- loginData.refreshSec =
- parseInt(window.localStorage.getItem("refreshSec"));
- zmLog ("Refresh in seconds is " + loginData.refreshSec);
-
- }
- else{
- zmLog ("Refresh is not defined, using " + loginData.refreshSec);
- }
-
-
- if (window.localStorage.getItem("montageQuality") != undefined) {
- loginData.montageQuality =
- window.localStorage.getItem("montageQuality");
-
- }
-
- if (window.localStorage.getItem("singleImageQuality") != undefined) {
- loginData.singleImageQuality =
- window.localStorage.getItem("singleImageQuality");
-
- }
-
- if (window.localStorage.getItem("password") != undefined) {
- loginData.password =
- window.localStorage.getItem("password");
-
- }
-
- if (window.localStorage.getItem("url") != undefined) {
- loginData.url =
- window.localStorage.getItem("url");
-
- }
-
- if (window.localStorage.getItem("onTapScreen") != undefined) {
- loginData.onTapScreen =
- window.localStorage.getItem("onTapScreen");
-
- }
-
- if (window.localStorage.getItem("eventServer") != undefined) {
- loginData.eventServer =
- window.localStorage.getItem("eventServer");
-
- }
-
-
-
- if (window.localStorage.getItem("eventServerMonitors") != undefined) {
- loginData.eventServerMonitors =
- window.localStorage.getItem("eventServerMonitors");
- }
-
- if (window.localStorage.getItem("eventServerInterval") != undefined) {
- loginData.eventServerInterval =
- window.localStorage.getItem("eventServerInterval");
- }
-
- if (window.localStorage.getItem("apiurl") != undefined) {
- loginData.apiurl =
- window.localStorage.getItem("apiurl");
-
- }
-
-
- if (window.localStorage.getItem("maxMontage") != undefined) {
- loginData.maxMontage =
- window.localStorage.getItem("maxMontage");
-
- }
-
- if (window.localStorage.getItem("streamingurl") != undefined) {
- loginData.streamingurl =
- window.localStorage.getItem("streamingurl");
- console.log("STREAMING URL " + loginData.streamingurl);
-
- }
-
- if (window.localStorage.getItem("maxFPS") != undefined) {
- loginData.maxFPS =
- window.localStorage.getItem("maxFPS");
- console.log("maxFPS " + loginData.maxFPS);
-
- }
- if (window.localStorage.getItem("montageQuality") != undefined) {
- loginData.montageQuality =
- window.localStorage.getItem("montageQuality");
- console.log("montageQuality " + loginData.montageQuality);
-
- }
-
- if (window.localStorage.getItem("singleImageQuality") != undefined) {
- loginData.singleImageQuality =
- window.localStorage.getItem("singleImageQuality");
-
-
- }
-
- if (window.localStorage.getItem("useSSL") != undefined) {
- var sslvalue = window.localStorage.getItem("useSSL");
- loginData.useSSL = (sslvalue == "1") ? true:false;
- console.log("useSSL " + loginData.useSSL);
-
- }
-
-
- if (window.localStorage.getItem("canSwipeMonitors") != undefined) {
- var canSwipeValue = window.localStorage.getItem("canSwipeMonitors");
- loginData.canSwipeMonitors = (canSwipeValue == "1") ? true:false;
- }
-
- if (window.localStorage.getItem("persistMontageOrder") != undefined) {
- var persistMontageOrder = window.localStorage.getItem("persistMontageOrder");
- loginData.persistMontageOrder = (persistMontageOrder == "1") ? true:false;
- }
-
-
- if (window.localStorage.getItem("enableh264") != undefined) {
- var enableh264 = window.localStorage.getItem("enableh264");
- loginData.enableh264 = (enableh264 == "1") ? true:false;
- }
-
- if (window.localStorage.getItem("gapless") != undefined) {
- var gapless = window.localStorage.getItem("gapless");
- loginData.gapless = (gapless == "1") ? true:false;
- }
-
- if (window.localStorage.getItem("usePin") != undefined) {
- var pinValue = window.localStorage.getItem("usePin");
- loginData.usePin = (pinValue == "1") ? true:false;
- console.log("usePin " + loginData.usePin);
-
- }
-
- if (window.localStorage.getItem("pinCode") != undefined) {
- loginData.pinCode =
- window.localStorage.getItem("pinCode");
-
- }
-
- if (window.localStorage.getItem("keepAwake") != undefined) {
- var awakevalue = window.localStorage.getItem("keepAwake");
- loginData.keepAwake = (awakevalue == "1") ? true:false;
- console.log("keepAwake " + loginData.keepAwake);
-
- } */
monitorsLoaded = 0;
console.log("Getting out of ZMDataModel init");
diff --git a/www/js/ModalCtrl.js b/www/js/ModalCtrl.js
index cf90deee..6a8a9ccf 100644
--- a/www/js/ModalCtrl.js
+++ b/www/js/ModalCtrl.js
@@ -10,14 +10,7 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco
// from parent scope
var currentEvent=$scope.currentEvent;
- /* $scope.mycarousel = {
- index: 0
- };
- $scope.ionRange = {
- index: 1
- };*/
-
-
+
var eventImageDigits = 5; // failsafe
ZMDataModel.getKeyConfigParams(0)
.then(function (data) {
@@ -69,7 +62,27 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco
});
-
+ $scope.togglePTZ = function () {
+
+ console.log ("PTZ");
+
+ if ($scope.isControllable=='1')
+ {
+ //console.log ("iscontrollable is true");
+ $scope.showPTZ = !$scope.showPTZ;
+ }
+ else
+ {
+ $ionicLoading.show({
+ template: "PTZ not configured for this monitor",
+ noBackdrop: true,
+ duration: 3000,
+ });
+ }
+
+
+
+ };
$scope.radialMenuOptions = {
@@ -978,21 +991,27 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco
}
- $scope.$watch('ionRange.index', function () {
- // console.log ("***ION RANGE CHANGED");
+ if (typeof $scope.ionRange !== 'undefined')
+ {
+ $scope.$watch('ionRange.index', function () {
+ // console.log ("***ION RANGE CHANGED");
- $scope.mycarousel.index = parseInt($scope.ionRange.index) - 1;
- });
+ $scope.mycarousel.index = parseInt($scope.ionRange.index) - 1;
+ });
+ }
+
+ if (typeof $scope.mycarousel !== 'undefined')
+ {
+ $scope.$watch('mycarousel.index', function () {
- $scope.$watch('mycarousel.index', function () {
+ $scope.ionRange.index = ($scope.mycarousel.index + 1).toString();
- $scope.ionRange.index = ($scope.mycarousel.index + 1).toString();
-
- if (currentEvent && $scope.ionRange.index == parseInt(currentEvent.Event.Frames))
- {
- playbackFinished();
- }
- });
+ if (currentEvent && $scope.ionRange.index == parseInt(currentEvent.Event.Frames))
+ {
+ playbackFinished();
+ }
+ });
+ }
function padToN(number, digits) {
@@ -1013,7 +1032,6 @@ angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootSco
}
$scope.$on('modal.shown', function() {
- console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Modal is shown!');
currentEvent=$scope.currentEvent;
if (currentEvent && currentEvent.Event)
prepareModalEvent(currentEvent.Event.Id);
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js
index f5da0733..8aaa770f 100644
--- a/www/js/MonitorCtrl.js
+++ b/www/js/MonitorCtrl.js
@@ -38,6 +38,10 @@ angular.module('zmApp.controllers')
monitorStateCheck();
console.log("Setting Awake to " + ZMDataModel.getKeepAwake());
ZMDataModel.setAwake(ZMDataModel.getKeepAwake());
+
+ // FIXME: need this as modalctrl uses it. Not needed for monitor
+ // mode
+
// --------------------------------------------------------
// Handling of back button in case modal is open should
@@ -291,6 +295,7 @@ angular.module('zmApp.controllers')
$rootScope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111;
$scope.ptzMoveCommand = "";
+
// This is a modal to show the monitor footage
// We need to switch to always awake if set so the feed doesn't get interrupted
@@ -298,6 +303,7 @@ angular.module('zmApp.controllers')
// if its controllable, lets get the control command
if (controllable == '1') {
+
var apiurl = $scope.LoginData.apiurl;
var myurl = apiurl + "/controls/" + controlid + ".json";
console.log("getting control details:" + myurl);
@@ -307,6 +313,7 @@ angular.module('zmApp.controllers')
$scope.ptzMoveCommand = "move"; // start with as move;
+
if (data.control.Control.CanMoveRel == '1')
$scope.ptzMoveCommand = "moveRel";
@@ -322,10 +329,13 @@ angular.module('zmApp.controllers')
console.log("** Error retrieving move PTZ command");
ZMDataModel.zmLog("Error retrieving PTZ command " + JSON.stringify(data), "error");
ZMDataModel.displayBanner('error', ['did not get a valid PTZ response', 'Please try again']);
+ $scope.isControllable = '0';
});
}
+
+
$ionicModal.fromTemplateUrl('templates/monitors-modal.html', {
@@ -360,9 +370,7 @@ angular.module('zmApp.controllers')
$scope.modal.remove();
});
- $scope.togglePTZ = function () {
- $scope.showPTZ = !$scope.showPTZ;
- };
+
//-----------------------------------------------------------------------
diff --git a/www/js/app.js b/www/js/app.js
index 38a451a2..e236b026 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -19,11 +19,7 @@ angular.module('zmApp', [
'com.2fdevs.videogular.plugins.controls',
'com.2fdevs.videogular.plugins.overlayplay'
-
-
-
-
-
+
])
// ------------------------------------------
@@ -67,7 +63,8 @@ angular.module('zmApp', [
loginScreenString: "var currentView = 'login'", // Isn't there a better way?
desktopUrl:"/zm",
desktopApiUrl: "/api/zm",
- latestRelease: "https://api.github.com/repos/pliablepixels/zmNinja/releases/latest"
+ latestRelease: "https://api.github.com/repos/pliablepixels/zmNinja/releases/latest",
+
})
@@ -147,7 +144,6 @@ angular.module('zmApp', [
link: function ($scope, $element, $attributes) {
if ($attributes.imageSpinnerLoader) {
- // console.log ("DIRECTIVE: IMAGE SPINNER");
var loader = $compile('<div class="image-loader-container"><ion-spinner style="position:fixed;top:5%;left:5%" class="image-loader" icon="' + $attributes.imageSpinnerLoader + '"></ion-spinner></div>')($scope);
$element.after(loader);
}
@@ -232,28 +228,6 @@ angular.module('zmApp', [
'request': function (config) {
- /* - we don't need this with electron
- if ($rootScope.platformOS == "desktop")
- {
- var zmD = $injector.get('ZMDataModel');
- var ld = zmD.getLogin();
- // This takes care of url and apiurl as they have
- // the same base
- if (ld.url !="" && config.url.indexOf(ld.url) > -1)
- {
-
- zmD.zmDebug("Running in desktop, removing URLs for proxy");
- zmD.zmDebug ("OLD URL " + config.url);
- config.url = config.url.replace(ld.url,zm.desktopUrl);
- zmD.zmDebug ("NEW URL " + config.url);
- }
-
-
-
- }
- */
-
- // config.withCredentials = true;
if (zmCookie) {
config.headers.Cookie = "ZMSESSID=" + zmCookie;
}
diff --git a/www/templates/devoptions.html b/www/templates/devoptions.html
index c60e13f0..ffab7fc9 100644
--- a/www/templates/devoptions.html
+++ b/www/templates/devoptions.html
@@ -18,7 +18,7 @@
</span>
<div class="item item-input-inset">
- Playback Frame update (seconds)&nbsp;
+ Frame update (sec.)&nbsp;
<label class="item-input-wrapper">
<input type="tel" placeholder="min is 1s" ng-model="loginData.refreshSec">
</label>
diff --git a/www/templates/events.html b/www/templates/events.html
index 1f1b76e4..a1cd6367 100644
--- a/www/templates/events.html
+++ b/www/templates/events.html
@@ -132,10 +132,10 @@
<br/>
<br/>
<br/>
-
<div style="width:90%">
<input ng-model="ionRange.index" type="text" id="mySlider1" slider options="slider_options" />
</div>
+
<br/>