diff options
Diffstat (limited to 'www')
| -rw-r--r-- | www/css/style.css | 31 | ||||
| -rw-r--r-- | www/js/EventCtrl.js | 92 | ||||
| -rw-r--r-- | www/lang/locale-en.json | 2 | ||||
| -rw-r--r-- | www/templates/events.html | 19 |
4 files changed, 141 insertions, 3 deletions
diff --git a/www/css/style.css b/www/css/style.css index 18a34314..ed8ac441 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -1172,7 +1172,36 @@ videogular div.event-time { top: -99999px; } - +.item-options .button{ + display: -webkit-box; + display: -moz-box; + display: -ms-inline-flexbox; + display: -webkit-inline-flex; + display: inline-flex; + -webkit-box-direction: normal; + -moz-box-direction: normal; + -webkit-box-orient: horizontal; + -moz-box-orient: horizontal; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + -webkit-flex-wrap: nowrap; + -ms-flex-wrap: nowrap; + flex-wrap: nowrap; + -webkit-box-pack: center; + -moz-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-align-content: center; + -ms-flex-line-pack: center; + align-content: center; + -webkit-box-align: center; + -moz-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + align-items: center; +} @media (min-width:600px) { .montage-time { diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 32f8b119..3af0de79 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -37,7 +37,7 @@ angular.module('zmApp.controllers') }) -.controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'NVRDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', '$ionicPopup', 'EventServer', '$sce', '$cordovaBadge', '$cordovaLocalNotification', '$q', 'carouselUtils', '$translate', '$cordovaFileTransfer', '$cordovaFile', function($scope, $rootScope, zm, NVRDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover, $ionicPopup, EventServer, $sce, $cordovaBadge, $cordovaLocalNotification, $q, carouselUtils, $translate, $cordovaFileTransfer, $cordovaFile) +.controller('zmApp.EventCtrl', ['$scope', '$rootScope', 'zm', 'NVRDataModel', 'message', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$ionicPlatform', '$ionicSlideBoxDelegate', '$ionicPosition', '$ionicPopover', '$ionicPopup', 'EventServer', '$sce', '$cordovaBadge', '$cordovaLocalNotification', '$q', 'carouselUtils', '$translate', '$cordovaFileTransfer', '$cordovaFile', '$ionicListDelegate',function($scope, $rootScope, zm, NVRDataModel, message, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $ionicPlatform, $ionicSlideBoxDelegate, $ionicPosition, $ionicPopover, $ionicPopup, EventServer, $sce, $cordovaBadge, $cordovaLocalNotification, $q, carouselUtils, $translate, $cordovaFileTransfer, $cordovaFile, $ionicListDelegate) { // events in last 5 minutes @@ -1556,6 +1556,94 @@ angular.module('zmApp.controllers') ); } + $scope.archiveUnarchiveEvent = function (ndx,eid) + { + //https://server/zm/api/events/11902.json -XPUT -d"Event[Archived]=1" + // + $ionicListDelegate.closeOptionButtons(); + + NVRDataModel.debug ("Archiving request for EID="+eid); + var loginData = NVRDataModel.getLogin(); + var apiArchive = loginData.apiurl + "/events/" + eid + ".json"; + var setArchiveBit = ($scope.events[ndx].Event.Archived == '0') ? "1":"0"; + + NVRDataModel.debug ("Calling archive with:"+apiArchive+ " and Archive="+setArchiveBit); + //put(url, data, [config]); + + // $http.put(apiArchive,"Event[Archived]="+setArchiveBit) + // + $ionicLoading.show( + { + template: "{{'kPleaseWait' | translate}}...", + noBackdrop: true, + duration: zm.httpTimeout + }); + + $http({ + + method: 'POST', + headers: + { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Accept': '*/*', + }, + transformRequest: function(obj) + { + var str = []; + for (var p in obj) + str.push(encodeURIComponent(p) + "=" + + encodeURIComponent(obj[p])); + var foo = str.join("&"); + // console.log("****RETURNING " + foo); + NVRDataModel.debug("MonitorCtrl: parmeters constructed: " + foo); + return foo; + }, + url: apiArchive, + data: { + "Event[Archived]":setArchiveBit + + } + }) + .then (function (success) { + + NVRDataModel.log ("archiving response: "+ JSON.stringify(success)); + if (success.data.message == 'Error') + { + $ionicLoading.show( + { + template: "{{'kError' | translate}}...", + noBackdrop: true, + duration: 1500 + }); + + } + else + { + + + $ionicLoading.show( + { + template: "{{'kSuccess' | translate}}...", + noBackdrop: true, + duration: 1000 + }); + if ($scope.events[ndx].Event.Archived == '0') + $scope.events[ndx].Event.Archived = '1'; + else + $scope.events[ndx].Event.Archived = '0'; + } + + + + }, + function (error) { + NVRDataModel.log ("Error archiving: "+ JSON.stringify(error)); + } ); + + + + }; + //-------------------------------------------------------------------------- // Takes care of deleting individual events //-------------------------------------------------------------------------- @@ -1576,6 +1664,8 @@ angular.module('zmApp.controllers') duration: zm.httpTimeout }); + + $http.delete(apiDelete) .success(function(data) { diff --git a/www/lang/locale-en.json b/www/lang/locale-en.json index 77a33f8f..e214a366 100644 --- a/www/lang/locale-en.json +++ b/www/lang/locale-en.json @@ -119,6 +119,7 @@ "kFilterOn" :"Filter On", "kFilterSettings" :"Filter Settings", "kFitScreen" :"fit screen", + "kFlag" :"Flag", "kFootage" :"Footage", "kForceAlarmConfirm" :"Are you sure you want to force an alarm for Monitor:", "kForceImagePath" :"Force events to use file path", @@ -344,6 +345,7 @@ "kToastSearchingPage" :"searching page ", "kTrying" :"trying", "kType" :"type", + "kUnflag" : "Unflag", "kUnknown" :"(unknown)", "kUpdateTimeline" :"dynamic updates", "kUseEventServer" :"Use event server", diff --git a/www/templates/events.html b/www/templates/events.html index 5d60a46b..cb6809f3 100644 --- a/www/templates/events.html +++ b/www/templates/events.html @@ -63,7 +63,7 @@ <div class="col col-80"> <div class="item-text-wrap"> - <b>{{event.Event.MonitorName}}</b> ({{event.Event.Id}}) + <b><i ng-if="event.Event.Archived=='1'" class="ion-ios-flag" style="color:red"> </i>{{event.Event.MonitorName}}</b> ({{event.Event.Id}}) <button ng-if="gifshotSupported" class="button button-small button-clear icon gif-icon" ng-click="permissionsDownload(event)"> </button> @@ -79,6 +79,8 @@ <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--> @@ -184,6 +186,18 @@ <!-- isGroupShown --> <ion-delete-button class="ion-minus-circled" ng-click="deleteEvent(event.Event.Id, $index)"> </ion-delete-button> + + + <ion-option-button ng-if="event.Event.Archived == 1" class="button-balanced" ng-click= "archiveUnarchiveEvent($index,event.Event.Id)">{{'kUnflag' | translate}}</ion-option-button> + + <ion-option-button ng-if="event.Event.Archived == 0" class="button-assertive" ng-click="archiveUnarchiveEvent($index, event.Event.Id)" >{{'kFlag' | translate}}</ion-option-button> + + <!-- hack to make sure swipe left displays well + if there is no content and our list height is set + to a larger height, the swipe display acts weird --> + + <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> + </ion-item> </ion-list> </div> @@ -198,6 +212,9 @@ </ion-infinite-scroll> </div> <canvas id="canvas" class="hiddengifcanvas"></canvas> + + + </ion-content> <div class="events-float-filter" ng-if="isEventFilterOn" on-tap="filterTapped();"><span translate="kFilterOn"></span></div> <div class="bwmode" ng-if="$root.runMode=='lowbw'"> |
