summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/DataModel.js9
-rw-r--r--www/js/EventServer.js3
-rw-r--r--www/js/EventServerSettingsCtrl.js64
-rw-r--r--www/js/PortalLoginCtrl.js22
4 files changed, 90 insertions, 8 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index 51105f7d..cafb3b36 100644
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -48,6 +48,7 @@ angular.module('zmApp.controllers')
'pinCode':'',
'canSwipeMonitors':true,
'persistMontageOrder':false,
+ 'onTapScreen':'events',
};
@@ -220,6 +221,12 @@ angular.module('zmApp.controllers')
}
+ if (window.localStorage.getItem("onTapScreen") != undefined) {
+ loginData.onTapScreen =
+ window.localStorage.getItem("onTapScreen");
+
+ }
+
if (window.localStorage.getItem("eventServer") != undefined) {
loginData.eventServer =
window.localStorage.getItem("eventServer");
@@ -427,6 +434,8 @@ angular.module('zmApp.controllers')
window.localStorage.setItem("isUseAuth", loginData.isUseAuth);
window.localStorage.setItem("isUseEventServer", loginData.isUseEventServer);
window.localStorage.setItem("disablePush", loginData.disablePush);
+ window.localStorage.setItem("onTapScreen", loginData.onTapScreen);
+
console.log ("***** SETTING ISUSEAUTH TO " + loginData.isUseAuth);
diff --git a/www/js/EventServer.js b/www/js/EventServer.js
index a333f2dd..b74298c3 100644
--- a/www/js/EventServer.js
+++ b/www/js/EventServer.js
@@ -431,7 +431,7 @@ angular.module('zmApp.controllers')
// data.image,
// data.additionalData
- media.play();
+
if (data.additionalData.foreground == false)
{
@@ -446,6 +446,7 @@ angular.module('zmApp.controllers')
{
// alarm received in foregroun
//var str=data.additionalData.alarm_details;
+ media.play();
var str = data.message;
// console.log ("***STRING: " + str + " " +str.status);
var eventsToDisplay=[];
diff --git a/www/js/EventServerSettingsCtrl.js b/www/js/EventServerSettingsCtrl.js
index 53ee4fdf..9ace8a99 100644
--- a/www/js/EventServerSettingsCtrl.js
+++ b/www/js/EventServerSettingsCtrl.js
@@ -2,7 +2,7 @@
/* jslint browser: true*/
/* global cordova,StatusBar,angular,console */
-angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl', ['$scope', '$ionicSideMenuDelegate', 'zm', '$stateParams', 'EventServer', '$ionicHistory', '$rootScope', '$state', 'message', 'ZMDataModel', '$ionicPlatform', function ($scope, $ionicSideMenuDelegate, zm, $stateParams, EventServer, $ionicHistory, $rootScope, $state, message, ZMDataModel, $ionicPlatform) {
+angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl', ['$scope', '$ionicSideMenuDelegate', 'zm', '$stateParams', 'EventServer', '$ionicHistory', '$rootScope', '$state', 'message', 'ZMDataModel', '$ionicPlatform','$ionicPopup', function ($scope, $ionicSideMenuDelegate, zm, $stateParams, EventServer, $ionicHistory, $rootScope, $state, message, ZMDataModel, $ionicPlatform, $ionicPopup) {
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
};
@@ -11,8 +11,8 @@ angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl',
$scope.openMenu = function () {
$ionicSideMenuDelegate.toggleLeft();
};
-
-
+
+
//----------------------------------------------------------------
// Alarm notification handling
//----------------------------------------------------------------
@@ -43,6 +43,62 @@ angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl',
});
+ //--------------------------------------------------
+ // notification tap action
+ //--------------------------------------------------
+
+
+
+ $scope.selectScreen = function () {
+
+ var ld = ZMDataModel.getLogin();
+
+ $scope.myopt = {
+ selectedState: ld.onTapScreen
+ };
+
+
+
+ $rootScope.zmPopup = $ionicPopup.show({
+ scope: $scope,
+ template: '<ion-radio-fix ng-model="myopt.selectedState" ng-value="\'events\'"> Event view </ion-radio-fix><ion-radio-fix ng-model="myopt.selectedState" ng-value="\'montage\'"> Montage view </ion-radio-fix>',
+
+
+ title: 'View to navigate to:',
+ subTitle: 'currently set to: ' + ld.onTapScreen,
+ buttons: [
+ {
+ text: 'Cancel',
+ onTap: function (e) {
+ return "CANCEL";
+ }
+
+ },
+ {
+ text: 'OK',
+ onTap: function (e) {
+ return "OK";
+
+ }
+ }
+ ]
+ });
+
+ // It seems invoking a popup within a popup handler
+ // causes issues. Doing this outside due to that reason
+ $rootScope.zmPopup.then(function (res) {
+
+ if (res == "OK") {
+ ld.onTapScreen = $scope.myopt.selectedState;
+ ZMDataModel.zmDebug("Setting new onTap State:");
+ ZMDataModel.setLogin(ld);
+ $scope.defScreen = $scope.myopt.selectedState;
+ // if ($scope.myopt.selectedState != "")
+ // controlZM($scope.myopt.selectedState);
+ }
+ });
+ };
+
//----------------------------------------------------------------
// Accordion list show/hide
//----------------------------------------------------------------
@@ -201,8 +257,10 @@ angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl',
//------------------------------------------------------------------------
$scope.monitors = [];
$scope.monitors = message;
+
$scope.loginData = ZMDataModel.getLogin();
+ $scope.defScreen = $scope.loginData.onTapScreen;
if ($scope.loginData.eventServer == "")
{
diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js
index 1dc9c8b5..f828a0df 100644
--- a/www/js/PortalLoginCtrl.js
+++ b/www/js/PortalLoginCtrl.js
@@ -92,11 +92,25 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
if ($rootScope.tappedNotification)
{
- console.log ("***** NOTIFICATION TAPPED GOING TO EVENTS ");
+ var ld = ZMDataModel.getLogin();
+
+ console.log ("***** NOTIFICATION TAPPED ");
$rootScope.tappedNotification = 0;
- $ionicHistory.nextViewOptions({disableBack: true});
- $state.go("events", {"id": 0}, { reload: true });
- return;
+ $ionicHistory.nextViewOptions({disableBack: true});
+
+ if (ld.onTapScreen == 'montage' )
+ {
+ ZMDataModel.zmDebug("Going to montage");
+ $state.go("montage", {}, { reload: true });
+
+ return;
+ }
+ else
+ {
+ ZMDataModel.zmDebug("Going to events");
+ $state.go("events", {"id": 0}, { reload: true });
+ return;
+ }
}
$state.go($rootScope.lastState ? $rootScope.lastState : 'montage', $rootScope.lastStateParam);