summaryrefslogtreecommitdiff
path: root/www/js/EventCtrl.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/EventCtrl.js')
-rw-r--r--www/js/EventCtrl.js122
1 files changed, 122 insertions, 0 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index 8a8673e4..e12d2f32 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -65,9 +65,12 @@ angular.module('zmApp.controllers')
$scope.typeOfFrames = $translate.instant('kShowTimeDiffFrames');
$scope.outlineMotion = false;
$scope.outlineMotionParam = "";
+
+
var eventsListScrubHeight = eventsListScrubHeight;
var eventsListDetailsHeight = eventsListDetailsHeight;
+
//---------------------------------------------------
// initial code
//---------------------------------------------------
@@ -148,6 +151,14 @@ angular.module('zmApp.controllers')
eventsListDetailsHeight = parseInt(zm.eventsListDetailsHeight * $rootScope.textScaleFactor);
eventsListScrubHeight = parseInt(zm.eventsListScrubHeight * $rootScope.textScaleFactor);
+
+ if (NVRDataModel.getLogin().enableThumbs) {
+ NVRDataModel.debug ("--> thumbnail means increasing row size");
+ eventsListScrubHeight=370;
+ eventsListDetailsHeight=330;
+
+ }
+
NVRDataModel.debug(">>>height of list/scrub set to " + eventsListDetailsHeight + " and " + eventsListScrubHeight);
pageLoaded = false;
@@ -369,6 +380,7 @@ angular.module('zmApp.controllers')
// console.log ("WE GOT EVENTS="+JSON.stringify(data));
var myevents = data;
+
NVRDataModel.debug("EventCtrl: success, got " + myevents.length + " events");
var loginData = NVRDataModel.getLogin();
for (var i = 0; i < myevents.length; i++)
@@ -407,6 +419,53 @@ angular.module('zmApp.controllers')
myevents[i].Event.BasePath = computeBasePath(myevents[i]);
myevents[i].Event.relativePath = computeRelativePath(myevents[i]);
+ // get thumbW/H
+
+ var tempMon = NVRDataModel.getMonitorObject(myevents[i].Event.MonitorId);
+ if (tempMon != undefined) {
+
+ var ratio;
+ var mw = parseInt(tempMon.Monitor.Width);
+ var mh = parseInt(tempMon.Monitor.Height);
+ var mo =parseInt(tempMon.Monitor.Orientation);
+
+ myevents[i].Event.Rotation = '';
+
+ // scale by X if width > height
+ if (mw > mh ) {
+ ratio = mw / zm.thumbWidth;
+ myevents[i].Event.thumbWidth = 200;
+ myevents[i].Event.thumbHeight = Math.round(mh/ratio);
+ }
+ else {
+
+ ratio = mh / zm.thumbWidth;
+ myevents[i].Event.thumbHeight = 200;
+ myevents[i].Event.thumbWidth = Math.round(mw/ratio);
+
+ }
+
+ if (mo != 0) {
+ /*
+ myevents[i].Event.Rotation = {
+ 'transform' : 'rotate('+mo+'deg'+')'
+ }; */
+
+ var tmp = myevents[i].Event.thumbHeight;
+ myevents[i].Event.thumbHeight = myevents[i].Event.thumbWidth;
+ myevents[i].Event.thumbWidth = tmp;
+
+
+ } // swap
+
+ console.log ("--------->" +"MW:"+myevents[i].Event.thumbWidth+ " MH:"+ myevents[i].Event.thumbHeight + " for Monitor:" + myevents[i].Event.MonitorName);
+
+
+
+
+
+ }
+
// in multiserver BasePath is login url for frames
// http://login.url/index.php?view=frame&eid=19696772&fid=21
@@ -2682,6 +2741,32 @@ angular.module('zmApp.controllers')
});
+
+
+ $scope.showThumbnail = function (b,f) {
+
+
+ $scope.thumbnailLarge=b+'/index.php?view=image&fid='+f;
+ $ionicModal.fromTemplateUrl('templates/image-modal.html',
+ {
+ scope: $scope,
+ animation: 'slide-in-up',
+ id: 'thumbnail',
+ })
+ .then(function(modal)
+ {
+ $scope.modal = modal;
+
+
+ $scope.modal.show();
+
+ var ld = NVRDataModel.getLogin();
+
+ });
+
+ };
+
+
//--------------------------------------------------------
//This is called when we first tap on an event to see
// the feed. It's important to instantiate ionicModal here
@@ -2882,6 +2967,43 @@ angular.module('zmApp.controllers')
myevents[i].Event.relativePath = computeRelativePath(myevents[i]);
myevents[i].Event.height = eventsListDetailsHeight;
+ // get thumbW/H
+
+ var tempMon = NVRDataModel.getMonitorObject(myevents[i].Event.MonitorId);
+ if (tempMon != undefined) {
+
+ var ratio;
+ var mw = parseInt(tempMon.Monitor.Width);
+ var mh = parseInt(tempMon.Monitor.Height);
+ var mo = parseInt(tempMon.Monitor.Orientation);
+
+ // scale by X if width > height
+ if (mw > mh ) {
+ ratio = mw / zm.thumbWidth;
+ myevents[i].Event.thumbWidth = 200;
+ myevents[i].Event.thumbHeight = Math.round(mh/ratio);
+ }
+ else {
+
+ ratio = mh / zm.thumbWidth;
+ myevents[i].Event.thumbHeight = 200;
+ myevents[i].Event.thumbWidth = Math.round(mw/ratio);
+
+ }
+ if (mo != 0) {
+
+ /*myevents[i].Event.Rotation = {
+ 'transform' : 'rotate('+mo+'deg'+')'
+ }; */
+
+ var tmp = myevents[i].Event.thumbHeight;
+ myevents[i].Event.thumbHeight = myevents[i].Event.thumbWidth;
+ myevents[i].Event.thumbWidth = tmp;
+
+ } // swap
+ }
+
+
if (myevents[i].Event.imageMode == 'path')
//if (1)
myevents[i].Event.videoPath = myevents[i].Event.baseURL + "/events/" + myevents[i].Event.relativePath + myevents[i].Event.DefaultVideo;