From 5214cdac945bc95cc18f449e91188f6f3c53d3e2 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Thu, 31 May 2018 08:22:26 -0400 Subject: placeholder code for bookmarks - not enabled --- www/css/style.css | 27 ++++++++++++ www/index.html | 1 + www/js/BookmarkCtrl.js | 105 ++++++++++++++++++++++++++++++++++++++++++++ www/js/StateCtrl.js | 20 +++++++-- www/lang/locale-en.json | 1 + www/templates/bookmark.html | 51 +++++++++++++++++++++ www/templates/menu.html | 7 +++ www/templates/state.html | 24 ++-------- 8 files changed, 212 insertions(+), 24 deletions(-) create mode 100644 www/js/BookmarkCtrl.js create mode 100644 www/templates/bookmark.html (limited to 'www') diff --git a/www/css/style.css b/www/css/style.css index 2847d2be..39cf95b7 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -1435,6 +1435,33 @@ fill-opacity: 0.8; } +.bookmarkButton { + width:100%; + height:100px; + background-color:#6e7375; + color: white; + +} + +.bookmarkButton i{ + position: relative; + float: left; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + color: white; + font-size:2em; + text-align:center; + +} + +.bookmark_text { + font-variant:small-caps; + font-size:0.6em; + color:white; + text-align:center; + +} @media (min-width:600px) { diff --git a/www/index.html b/www/index.html index 01a87cc5..4d8d2332 100644 --- a/www/index.html +++ b/www/index.html @@ -134,6 +134,7 @@ + diff --git a/www/js/BookmarkCtrl.js b/www/js/BookmarkCtrl.js new file mode 100644 index 00000000..9472f8d3 --- /dev/null +++ b/www/js/BookmarkCtrl.js @@ -0,0 +1,105 @@ +/* jshint -W041 */ +/* jslint browser: true*/ +/* global cordova,StatusBar,angular,console, Masonry */ + +angular.module('zmApp.controllers').controller('zmApp.BookmarkCtrl', ['$scope', '$rootScope', '$ionicModal', 'NVRDataModel', '$ionicSideMenuDelegate', '$ionicHistory', '$state', '$translate', '$q', '$templateRequest', '$sce', '$compile', function ($scope, $rootScope, $ionicModal, NVRDataModel, $ionicSideMenuDelegate, $ionicHistory, $state, $translate, $q, $templateRequest, $sce, $compile) { + $scope.openMenu = function () { + $ionicSideMenuDelegate.toggleLeft(); + }; + + //---------------------------------------------------------------- + // Alarm notification handling + //---------------------------------------------------------------- + $scope.handleAlarms = function () { + $rootScope.isAlarm = !$rootScope.isAlarm; + if (!$rootScope.isAlarm) { + $rootScope.alarmCount = "0"; + $ionicHistory.nextViewOptions({ + disableBack: true + }); + $state.go("app.events", { + "id": 0, + "playEvent": false + }, { + reload: true + }); + return; + } + }; + + + //------------------------------------------------------------------------- + // Lets make sure we set screen dim properly as we enter + // The problem is we enter other states before we leave previous states + // from a callback perspective in ionic, so we really can't predictably + // reset power state on exit as if it is called after we enter another + // state, that effectively overwrites current view power management needs + //------------------------------------------------------------------------ + $scope.$on('$ionicView.beforeEnter', function () { + //console.log("**VIEW ** Help Ctrl Entered"); + NVRDataModel.setAwake(false); + + $scope.bookmarks = []; + + + + $scope.bookmarks.push( + { + text:"Change State", + state:"app.state", + params: { + shortcut: { + fn:"selectCustomState", + fnargs:null, + } + } + }, + { + text:"Stop ZM", + state:"app.state", + params: { + shortcut: { + fn:"controlZM", + fnargs:'stop', + } + }, + }, + { + text:"Start ZM", + state:"app.state", + params: { + shortcut: { + fn:"controlZM", + fnargs:'start', + } + }, + }, + { + text:"Restart ZM", + state:"app.state", + params: { + shortcut: { + fn:"controlZM", + fnargs:'restart', + } + }, + } + ); + + $scope.bookmarks.push({text:""}); + + + }); + + $scope.action = function (item) { + + $ionicHistory.nextViewOptions({ + historyRoot: true, + disableAnimate: true, + expire: 300 + }); + console.log ("GOIN WITH "+ JSON.stringify(item.params)); + $state.go(item.state, item.params); + }; + +}]); diff --git a/www/js/StateCtrl.js b/www/js/StateCtrl.js index a278c55d..d845d02a 100644 --- a/www/js/StateCtrl.js +++ b/www/js/StateCtrl.js @@ -4,8 +4,8 @@ // controller for State View -angular.module('zmApp.controllers').controller('zmApp.StateCtrl', ['$ionicPopup', '$scope', 'zm', 'NVRDataModel', '$ionicSideMenuDelegate', '$ionicLoading', '$ionicModal', '$state', '$http', '$rootScope', '$timeout', '$ionicHistory', '$translate', function ( - $ionicPopup, $scope, zm, NVRDataModel, $ionicSideMenuDelegate, $ionicLoading, $ionicModal, $state, $http, $rootScope, $timeout, $ionicHistory, $translate) { +angular.module('zmApp.controllers').controller('zmApp.StateCtrl', ['$ionicPopup', '$scope', 'zm', 'NVRDataModel', '$ionicSideMenuDelegate', '$ionicLoading', '$ionicModal', '$state', '$http', '$rootScope', '$timeout', '$ionicHistory', '$translate', '$stateParams', function ( + $ionicPopup, $scope, zm, NVRDataModel, $ionicSideMenuDelegate, $ionicLoading, $ionicModal, $state, $http, $rootScope, $timeout, $ionicHistory, $translate, $stateParams) { //---------------------------------------------------------------------- // Controller main @@ -63,6 +63,16 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl', ['$ionicPopup' $scope.$on('$ionicView.enter', function () { // console.log("**VIEW ** Montage Ctrl Entered"); NVRDataModel.setAwake(false); + + }); + + $scope.$on('$ionicView.afterEnter', function () { + // console.log("**VIEW ** Montage Ctrl Entered"); + + console.log ("STATE SHORTCUT: " + JSON.stringify($stateParams)); + $stateParams.shortcut && $stateParams.shortcut.fn && + $scope[$stateParams.shortcut.fn]($stateParams.shortcut.fnargs); // jshint ignore:line + }); //--------------------------------------------------------- @@ -121,6 +131,10 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl', ['$ionicPopup' // Allows the user to select a custom run state //--------------------------------------------------------- $scope.selectCustomState = function () { + selectCustomState(); + }; + + function selectCustomState() { $scope.myopt = { selectedState: "" }; @@ -158,7 +172,7 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl', ['$ionicPopup' controlZM($scope.myopt.selectedState); } }); - }; + } //---------------------------------------------------------------------- // returns disk space in gigs taken up by events diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json index da35e82c..e3711040 100644 --- a/www/lang/locale-en.json +++ b/www/lang/locale-en.json @@ -26,6 +26,7 @@ "kBannerPleaseCheck" :"Please check settings", "kBeCareful" :"be careful", "kBodyPortalNotConfigured" :"Please fill in your login details as well as portal URL and save it before you try to detect the cgi-path", + "kBookmark" : "Bookmark", "kButtonCancel" :"Cancel", "kButtonClear" :"Clear", "kButtonNo" :"No", diff --git a/www/templates/bookmark.html b/www/templates/bookmark.html new file mode 100644 index 00000000..3538dbfd --- /dev/null +++ b/www/templates/bookmark.html @@ -0,0 +1,51 @@ + + + + + + + +
+ +
+
+ +
+ {{bookmarks[$index].text}} +
+
+
+ + +
+
+ +
+ {{bookmarks[$index+1].text}} +
+
+
+ +
+
+ +
+ {{bookmarks[$index+2].text}} +
+
+
+ +
+
+ +
+ {{bookmarks[$index+3].text}} +
+ +
+
+
+ +
+
diff --git a/www/templates/menu.html b/www/templates/menu.html index 43833490..0c1d06a3 100644 --- a/www/templates/menu.html +++ b/www/templates/menu.html @@ -16,6 +16,13 @@ + + + + + {{'kBookmark'| translate}} + + diff --git a/www/templates/state.html b/www/templates/state.html index d227bb5b..dd672e7a 100644 --- a/www/templates/state.html +++ b/www/templates/state.html @@ -35,28 +35,10 @@ - + - -
+ +