summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/BookmarkCtrl.js105
-rw-r--r--www/js/StateCtrl.js20
2 files changed, 122 insertions, 3 deletions
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