From 909c0e903f8660ed9ede5e23052156327912a738 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 17 Feb 2022 13:30:01 -0500 Subject: [PATCH 1/9] Include EndDateTimeShort in event ajax response --- web/ajax/status.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/ajax/status.php b/web/ajax/status.php index 0d17213a5..b37a3bda6 100644 --- a/web/ajax/status.php +++ b/web/ajax/status.php @@ -113,6 +113,7 @@ $statusData = array( 'StartTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ), 'StartDateTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ), 'EndDateTime' => true, + 'EndDateTimeShort' => array( 'sql' => 'date_format( EndDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ), 'Width' => true, 'Height' => true, 'Length' => true, @@ -141,6 +142,7 @@ $statusData = array( 'StartTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ), 'StartDateTimeShort' => array( 'sql' => 'date_format( StartDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ), 'EndDateTime' => true, + 'EndDateTimeShort' => array( 'sql' => 'date_format( EndDateTime, \''.MYSQL_FMT_DATETIME_SHORT.'\' )' ), 'Width' => true, 'Height' => true, 'Length' => true, From 8dedac1a216fe5f78c8a170f759b53d14b559c11 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 17 Feb 2022 13:30:50 -0500 Subject: [PATCH 2/9] Handle empty endtime more gracefully. If there is a next event just jump to it. --- web/skins/classic/views/js/event.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index 31363e154..1c7a11954 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -52,14 +52,19 @@ function vjsReplay() { var overLaid = $j("#videoobj"); overLaid.append('

No more events

'); } else { - var endTime = (Date.parse(eventData.EndDateTime)).getTime(); + if (!eventData.EndDateTime) { + // No EndTime but have a next event, just go to it. + streamNext(true); + return; + } + var endTime = Date.parse(eventData.EndDateTime).getTime(); var nextStartTime = nextEventStartTime.getTime(); //nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse if ( nextStartTime <= endTime ) { streamNext(true); return; } - var overLaid = $j("#videoobj"); vid.pause(); + var overLaid = $j("#videoobj"); overLaid.append('

'); var gapDuration = (new Date().getTime()) + (nextStartTime - endTime); var messageP = $j('.vjsMessage'); From adf84133336133915eec031ee8a8009eaac443fb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 17 Feb 2022 13:31:25 -0500 Subject: [PATCH 3/9] Include EndDateTimeShort in event stats --- web/skins/classic/views/js/event.js.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/skins/classic/views/js/event.js.php b/web/skins/classic/views/js/event.js.php index c2b61f395..700558cca 100644 --- a/web/skins/classic/views/js/event.js.php +++ b/web/skins/classic/views/js/event.js.php @@ -52,6 +52,7 @@ var eventData = { StartDateTime: 'StartDateTime() ?>', StartDateTimeShort: 'StartDateTime())) ?>', EndDateTime: 'EndDateTime() ?>', + EndDateTimeShort: 'EndDateTime()? strftime(STRF_FMT_DATETIME_SHORT, strtotime($Event->EndDateTime())) : '' ?>', Frames: 'Frames() ?>', AlarmFrames: 'AlarmFrames() ?>', TotScore: 'TotScore() ?>', @@ -75,6 +76,7 @@ var eventDataStrings = { Cause: '', Notes: '', StartDateTimeShort: '', + EndDateTimeShort: '', Length: '', Frames: '', AlarmFrames: '', From 28f3cb18e4458385e6d67e449bd66bdcc05eca1d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 18 Feb 2022 15:59:00 -0500 Subject: [PATCH 4/9] Make std function warning into a debug. Warning will happen if they are actually used --- src/zm_image.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zm_image.cpp b/src/zm_image.cpp index 35efa8774..7a2048102 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -98,7 +98,7 @@ void Image::update_function_pointers() { delta8_abgr = &std_delta8_abgr; delta8_gray8 = &std_delta8_gray8; blend = &std_blend; - Warning("Using slow std functions because pixels %d mod 4=%d", pixels, pixels%4); + Debug(1, "Using slow std functions because pixels %d mod 4=%d", pixels, pixels%4); } else { // Use either sse or neon, or loop unrolled version delta8_rgb = fptr_delta8_rgb; @@ -1167,7 +1167,7 @@ bool Image::WriteJpeg(const std::string &filename, } else if (subpixelorder == ZM_SUBPIX_ORDER_ABGR) { cinfo->in_color_space = JCS_EXT_XBGR; } else { - Warning("Unknwon subpixelorder %d", subpixelorder); + Warning("Unknown subpixelorder %d", subpixelorder); /* Assume RGBA */ cinfo->in_color_space = JCS_EXT_RGBX; } From 002b2c39aa3f97e5200b82405bb5306dfb24c63d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 18 Feb 2022 17:08:40 -0500 Subject: [PATCH 5/9] fix button assignments. Don't abort ajax, as it might be important --- web/js/MonitorStream.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/js/MonitorStream.js b/web/js/MonitorStream.js index 86b9b97e0..110f1665d 100644 --- a/web/js/MonitorStream.js +++ b/web/js/MonitorStream.js @@ -26,7 +26,7 @@ function MonitorStream(monitorData) { this.buttons = {}; // index by name this.setButton = function(name, element) { - this.buttons.name = element; + this.buttons[name] = element; }; this.element = null; @@ -380,6 +380,8 @@ function MonitorStream(monitorData) { if ('enableAlarmButton' in this.buttons) { this.buttons.enableAlarmButton.addClass('disabled'); this.buttons.enableAlarmButton.prop('title', disableAlarmsStr); + } else { + console.log('enableAlarmButton not found in buttons'); } if ('forceAlarmButton' in this.buttons) { if (streamStatus.forced) { @@ -390,8 +392,11 @@ function MonitorStream(monitorData) { this.buttons.forceAlarmButton.prop('title', forceAlarmStr); } this.buttons.forceAlarmButton.prop('disabled', false); + } else { + console.log('forceAlarmButton not found in buttons'); } } else { + console.log("streamStatus not enabled"); if ('enableAlarmButton' in this.buttons) { this.buttons.enableAlarmButton.removeClass('disabled'); this.buttons.enableAlarmButton.prop('title', enableAlarmsStr); @@ -462,6 +467,8 @@ function MonitorStream(monitorData) { this.alarmCommand = function(command) { if (this.ajaxQueue) { + console.log("Aborting in progress ajax for alarm"); + // Doing this for responsiveness, but we could be aborting something important. Need smarter logic this.ajaxQueue.abort(); } const alarmCmdParms = Object.assign({}, this.streamCmdParms); @@ -485,9 +492,6 @@ function MonitorStream(monitorData) { } this.streamCmdReq = function(streamCmdParms) { - if (this.ajaxQueue) { - this.ajaxQueue.abort(); - } this.ajaxQueue = jQuery.ajaxQueue({url: this.url, data: streamCmdParms, dataType: "json"}) .done(this.getStreamCmdResponse.bind(this)) .fail(this.onFailure.bind(this)); From 1a54a96c0479537411205a6e6c84961409520833 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 18 Feb 2022 17:09:24 -0500 Subject: [PATCH 6/9] Improve title on alarm buttons when we don't have permission. Move onclick from data-on-click to setup in initPage only if permitted --- web/skins/classic/views/js/watch.js | 8 ++++++++ web/skins/classic/views/watch.php | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 21026c3c8..4af160389 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -833,6 +833,14 @@ function initPage() { monitorStream.setButton('enableAlarmButton', enableAlmBtn); monitorStream.setButton('forceAlarmButton', forceAlmBtn); monitorStream.setButton('zoomOutButton', $j('zoomOutBtn')); + if (canEdit.Monitors) { + // Will be enabled by streamStatus ajax + enableAlmBtn.on('click', cmdAlarm); + forceAlmBtn.on('click', cmdForce); + } else { + forceAlmBtn.prop('title', forceAlmBtn.prop('title') + ': disabled because cannot edit Monitors'); + enableAlmBtn.prop('title', enableAlmBtn.prop('title') + ': disabled because cannot edit Monitors'); + } /* if (streamMode == 'single') { diff --git a/web/skins/classic/views/watch.php b/web/skins/classic/views/watch.php index fdcdae06d..8ceb06ab2 100644 --- a/web/skins/classic/views/watch.php +++ b/web/skins/classic/views/watch.php @@ -159,8 +159,8 @@ xhtmlHeaders(__FILE__, $monitor->Name().' - '.translate('Feed')); - - + +