From b0f2ff6302f0d781d7f59ceaafaa607328f0b807 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 8 Dec 2020 10:21:55 -0500 Subject: [PATCH 01/53] Add Session cleaning --- scripts/zmstats.pl.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/zmstats.pl.in b/scripts/zmstats.pl.in index 8aef4ddc6..81fdd3129 100644 --- a/scripts/zmstats.pl.in +++ b/scripts/zmstats.pl.in @@ -91,6 +91,9 @@ while( 1 ) { } } # end if ZM_LOG_DATABASE_LIMIT + # Delete any sessions that are more ethan a week old. Limiting to 100 because mysql sucks + zmDbDo('DELETE FROM Sessions WHERE access < ? LIMIT 100', time - (60*60*24*7)); + sleep($Config{ZM_STATS_UPDATE_INTERVAL}); } # end while (1) From c156731f0be28a76977e29055ba350ed7f82f733 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 8 Dec 2020 10:33:25 -0500 Subject: [PATCH 02/53] Allow users with canView Events to view event list. Don't allow unarchive or delete if they don't have canEdit --- web/ajax/events.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/web/ajax/events.php b/web/ajax/events.php index 37e225527..b613fe10c 100644 --- a/web/ajax/events.php +++ b/web/ajax/events.php @@ -6,7 +6,7 @@ $data = array(); // INITIALIZE AND CHECK SANITY // -if ( !canEdit('Events') ) $message = 'Insufficient permissions for user '.$user['Username']; +if ( !canView('Events') ) $message = 'Insufficient permissions for user '.$user['Username']; if ( empty($_REQUEST['task']) ) { $message = 'Must specify a task'; @@ -74,10 +74,22 @@ if ( isset($_REQUEST['limit']) ) { switch ( $task ) { case 'archive' : + foreach ( $eids as $eid ) archiveRequest($task, $eid); + break; case 'unarchive' : + # The idea is that anyone can archive, but only people with Event Edit permission can unarchive.. + if ( !canEdit('Events') ) { + ajaxError('Insufficient permissions for user '.$user['Username']); + return; + } foreach ( $eids as $eid ) archiveRequest($task, $eid); break; case 'delete' : + if ( !canEdit('Events') ) { + ajaxError('Insufficient permissions for user '.$user['Username']); + return; + } + foreach ( $eids as $eid ) $data[] = deleteRequest($eid); break; case 'query' : From bfe5bb0249d366ee48be7894a109826d1f556fec Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 8 Dec 2020 11:19:22 -0500 Subject: [PATCH 03/53] Include code to handle when we are already logged in but trying to auth with a mismatched auth_hash --- web/includes/auth.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/web/includes/auth.php b/web/includes/auth.php index a4e1e4268..4084e8386 100644 --- a/web/includes/auth.php +++ b/web/includes/auth.php @@ -187,6 +187,26 @@ function getAuthUser($auth) { } // end if $auth == $authHash } // end foreach hour } // end foreach user + + if ( isset($_SESSION['username']) ) { + # In a multi-server case, we might be logged in as another user and so the auth hash didn't work + $sql = 'SELECT * FROM Users WHERE Enabled = 1 AND Username != ?'; + + foreach ( dbFetchAll($sql, NULL, $values) as $user ) { + $now = time(); + for ( $i = 0; $i < ZM_AUTH_HASH_TTL; $i++, $now -= 3600 ) { // Try for last TTL hours + $time = localtime($now); + $authKey = ZM_AUTH_HASH_SECRET.$user['Username'].$user['Password'].$remoteAddr.$time[2].$time[3].$time[4].$time[5]; + $authHash = md5($authKey); + + if ( $auth == $authHash ) { + return $user; + } // end if $auth == $authHash + } // end foreach hour + } // end foreach user + } // end if + } // end if using auth hash + } // end if using auth hash ZM\Error("Unable to authenticate user from auth hash '$auth'"); return null; From 84c7a117f5651023be66901589d156e46ccb21d7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 8 Dec 2020 11:26:43 -0500 Subject: [PATCH 04/53] Use width and height attrs instead of css for rendering speed. Also alt doesn't need validHtmlStr because Event.Id will have no weird characters --- web/ajax/events.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/ajax/events.php b/web/ajax/events.php index b613fe10c..51949f84e 100644 --- a/web/ajax/events.php +++ b/web/ajax/events.php @@ -229,12 +229,12 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim $event = new ZM\Event($row); $scale = intval(5*100*ZM_WEB_LIST_THUMB_WIDTH / $event->Width()); - $imgSrc = $event->getThumbnailSrc(array(),'&'); + $imgSrc = $event->getThumbnailSrc(array(), '&'); $streamSrc = $event->getStreamSrc(array( 'mode'=>'jpeg', 'scale'=>$scale, 'maxfps'=>ZM_WEB_VIDEO_MAXFPS, 'replay'=>'single', 'rate'=>'400'), '&'); // Modify the row data as needed - $row['imgHtml'] = '' .validHtmlStr('Event ' .$event->Id()). ''; + $row['imgHtml'] = 'Event '.$event->Id().''; $row['Name'] = validHtmlStr($row['Name']); $row['Archived'] = $row['Archived'] ? translate('Yes') : translate('No'); $row['Emailed'] = $row['Emailed'] ? translate('Yes') : translate('No'); From 63e36340c6a9a52250e4863e7f532c3341c327f1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 8 Dec 2020 11:26:52 -0500 Subject: [PATCH 05/53] Remove extra } --- web/includes/auth.php | 1 - 1 file changed, 1 deletion(-) diff --git a/web/includes/auth.php b/web/includes/auth.php index 4084e8386..ced24ff9d 100644 --- a/web/includes/auth.php +++ b/web/includes/auth.php @@ -207,7 +207,6 @@ function getAuthUser($auth) { } // end if } // end if using auth hash - } // end if using auth hash ZM\Error("Unable to authenticate user from auth hash '$auth'"); return null; } // end getAuthUser($auth) From 63c483ba92545d707da75737489b0dcc068fefff Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 8 Dec 2020 11:27:18 -0500 Subject: [PATCH 06/53] canEditMonitors is set in skin.js.php --- web/skins/classic/views/js/watch.js.php | 1 - 1 file changed, 1 deletion(-) diff --git a/web/skins/classic/views/js/watch.js.php b/web/skins/classic/views/js/watch.js.php index 704ec01e2..d0ef131b6 100644 --- a/web/skins/classic/views/js/watch.js.php +++ b/web/skins/classic/views/js/watch.js.php @@ -73,7 +73,6 @@ var statusRefreshTimeout = ; var eventsRefreshTimeout = ; var imageRefreshTimeout = ; -var canEditMonitors = ; var canStreamNative = ; var canViewControl = ; From 69e540c10469ac2393c0ab4f3477255735caa15b Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Tue, 8 Dec 2020 14:25:48 -0600 Subject: [PATCH 07/53] deploy canView and canEdit js objects --- web/skins/classic/js/skin.js | 2 +- web/skins/classic/js/skin.js.php | 19 ++++++++------ web/skins/classic/views/js/controlcaps.js | 10 +++---- web/skins/classic/views/js/controlcaps.js.php | 1 - web/skins/classic/views/js/devices.js | 10 +++---- web/skins/classic/views/js/devices.js.php | 1 - web/skins/classic/views/js/event.js | 26 +++++++++---------- web/skins/classic/views/js/event.js.php | 1 - web/skins/classic/views/js/events.js | 26 +++++++++---------- web/skins/classic/views/js/groups.js | 4 +-- web/skins/classic/views/js/options.js | 8 +++--- web/skins/classic/views/js/options.js.php | 1 - web/skins/classic/views/js/watch.js | 10 +++---- web/skins/classic/views/js/watch.js.php | 1 - web/skins/classic/views/js/zone.js.php | 1 - 15 files changed, 59 insertions(+), 62 deletions(-) delete mode 100644 web/skins/classic/views/js/controlcaps.js.php delete mode 100644 web/skins/classic/views/js/devices.js.php diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index 3d59b0898..ebfa5c0fe 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -241,7 +241,7 @@ if ( currentView != 'none' && currentView != 'login' ) { $j(document).ready(function() { // Load the Logout and State modals into the dom $j('#logoutButton').click(clickLogout); - if ( canEditSystem ) $j('#stateModalBtn').click(getStateModal); + if ( canEdit.System ) $j('#stateModalBtn').click(getStateModal); // Trigger autorefresh of the widget bar stats on the navbar if ( $j('.navbar').length ) { diff --git a/web/skins/classic/js/skin.js.php b/web/skins/classic/js/skin.js.php index 1288a1e80..b10598235 100644 --- a/web/skins/classic/js/skin.js.php +++ b/web/skins/classic/js/skin.js.php @@ -40,14 +40,17 @@ var thisUrl = ''; var serverId = ''; -var canEditSystem = ; -var canViewSystem = ; -var canEditEvents = ; -var canViewEvents = ; -var canEditMonitors = ; -var canViewMonitors = ; - -var canEditGroups = ; +var canView = new Object(); +var canEdit = new Object(); + + canView[""] = ; + canEdit[""] = ; + var ANIMATE_THUMBS = ; diff --git a/web/skins/classic/views/js/controlcaps.js b/web/skins/classic/views/js/controlcaps.js index 75e6b8817..ff1b3af30 100644 --- a/web/skins/classic/views/js/controlcaps.js +++ b/web/skins/classic/views/js/controlcaps.js @@ -43,7 +43,7 @@ function getDelConfirmModal(key) { // Manage the DELETE CONFIRMATION modal button function manageDelConfirmModalBtns() { document.getElementById("delConfirmBtn").addEventListener("click", function onDelConfirmClick(evt) { - if ( ! canEditControl ) { + if ( ! canEdit.Control ) { enoperm(); return; } @@ -67,9 +67,9 @@ function initPage() { function() { selections = table.bootstrapTable('getSelections'); - addNewBtn.prop('disabled', (selections.length || !canEditControl)); - editBtn.prop('disabled', !((selections.length == 1) && canEditControl)); - deleteBtn.prop('disabled', !(selections.length && canEditControl)); + addNewBtn.prop('disabled', (selections.length || !canEdit.Control)); + editBtn.prop('disabled', !((selections.length == 1) && canEdit.Control)); + deleteBtn.prop('disabled', !(selections.length && canEdit.Control)); }); // Init the bootstrap-table @@ -92,7 +92,7 @@ function initPage() { // Manage the DELETE button document.getElementById("deleteBtn").addEventListener("click", function onDeleteClick(evt) { - if ( ! canEditControl ) { + if ( ! canEdit.Control ) { enoperm(); return; } diff --git a/web/skins/classic/views/js/controlcaps.js.php b/web/skins/classic/views/js/controlcaps.js.php deleted file mode 100644 index 6db74d130..000000000 --- a/web/skins/classic/views/js/controlcaps.js.php +++ /dev/null @@ -1 +0,0 @@ -var canEditControl = ; diff --git a/web/skins/classic/views/js/devices.js b/web/skins/classic/views/js/devices.js index a164835b4..5167b2018 100644 --- a/web/skins/classic/views/js/devices.js +++ b/web/skins/classic/views/js/devices.js @@ -42,7 +42,7 @@ function getDelConfirmModal(key) { // Manage the DELETE CONFIRMATION modal button function manageDelConfirmModalBtns() { document.getElementById("delConfirmBtn").addEventListener("click", function onDelConfirmClick(evt) { - if ( ! canEditDevice ) { + if ( ! canEdit.Device ) { enoperm(); return; } @@ -91,9 +91,9 @@ function initPage() { // Init the bootstrap-table table.bootstrapTable({icons: icons}); - if ( canEditDevice ) enableDeviceModal(); + if ( canEdit.Device ) enableDeviceModal(); - newDeviceBtn.prop('disabled', !canEditDevice); + newDeviceBtn.prop('disabled', !canEdit.Device); // Manage the BACK button document.getElementById("backBtn").addEventListener("click", function onBackClick(evt) { @@ -112,7 +112,7 @@ function initPage() { // Manage the DELETE button document.getElementById("deleteBtn").addEventListener("click", function onDeleteClick(evt) { - if ( ! canEditDevice ) { + if ( ! canEdit.Device ) { enoperm(); return; } @@ -130,7 +130,7 @@ function initPage() { function() { selections = table.bootstrapTable('getSelections'); - deleteBtn.prop('disabled', !(selections.length && canEditDevice)); + deleteBtn.prop('disabled', !(selections.length && canEdit.Device)); }); // Process mouse clicks on the table cells diff --git a/web/skins/classic/views/js/devices.js.php b/web/skins/classic/views/js/devices.js.php deleted file mode 100644 index f80541494..000000000 --- a/web/skins/classic/views/js/devices.js.php +++ /dev/null @@ -1 +0,0 @@ -var canEditDevice = ; diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index 5550ee15c..37ef5966c 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -598,8 +598,8 @@ function getEventResponse(respObj, respText) { $j('dataStorage').text( eventData.Storage ); // Refresh the status of the archive buttons - archiveBtn.prop('disabled', !(!eventData.Archived && canEditEvents)); - unarchiveBtn.prop('disabled', !(eventData.Archived && canEditEvents)); + archiveBtn.prop('disabled', !(!eventData.Archived && canEdit.Events)); + unarchiveBtn.prop('disabled', !(eventData.Archived && canEdit.Events)); history.replaceState(null, null, '?view=event&eid=' + eventData.Id + filterQuery + sortQuery); //if popup removed, check if this allows forward // Technically, events can be different sizes, so may need to update the size of the image, but it might be better to have it stay scaled... @@ -1045,7 +1045,7 @@ function getDelConfirmModal() { // Manage the DELETE CONFIRMATION modal button function manageDelConfirmModalBtns() { document.getElementById("delConfirmBtn").addEventListener("click", function onDelConfirmClick(evt) { - if ( ! canEditEvents ) { + if ( ! canEdit.Events ) { enoperm(); return; } @@ -1134,13 +1134,13 @@ function initPage() { }); // enable or disable buttons based on current selection and user rights - renameBtn.prop('disabled', !canEditEvents); - archiveBtn.prop('disabled', !(!eventData.Archived && canEditEvents)); - unarchiveBtn.prop('disabled', !(eventData.Archived && canEditEvents)); - editBtn.prop('disabled', !canEditEvents); - exportBtn.prop('disabled', !canViewEvents); - downloadBtn.prop('disabled', !canViewEvents); - deleteBtn.prop('disabled', !canEditEvents); + renameBtn.prop('disabled', !canEdit.Events); + archiveBtn.prop('disabled', !(!eventData.Archived && canEdit.Events)); + unarchiveBtn.prop('disabled', !(eventData.Archived && canEdit.Events)); + editBtn.prop('disabled', !canEdit.Events); + exportBtn.prop('disabled', !canView.Events); + downloadBtn.prop('disabled', !canView.Events); + deleteBtn.prop('disabled', !canEdit.Events); // Don't enable the back button if there is no previous zm page to go back to backBtn.prop('disabled', !document.referrer.length); @@ -1183,7 +1183,7 @@ function initPage() { // Manage the UNARCHIVE button document.getElementById("unarchiveBtn").addEventListener("click", function onUnarchiveClick(evt) { - if ( ! canEditEvents ) { + if ( ! canEdit.Events ) { enoperm(); return; } @@ -1198,7 +1198,7 @@ function initPage() { // Manage the EDIT button document.getElementById("editBtn").addEventListener("click", function onEditClick(evt) { - if ( ! canEditEvents ) { + if ( ! canEdit.Events ) { enoperm(); return; } @@ -1253,7 +1253,7 @@ function initPage() { // Manage the DELETE button document.getElementById("deleteBtn").addEventListener("click", function onDeleteClick(evt) { - if ( ! canEditEvents ) { + if ( ! canEdit.Events ) { enoperm(); return; } diff --git a/web/skins/classic/views/js/event.js.php b/web/skins/classic/views/js/event.js.php index d24b12c2f..05d9f5ffb 100644 --- a/web/skins/classic/views/js/event.js.php +++ b/web/skins/classic/views/js/event.js.php @@ -63,7 +63,6 @@ var rate = ''; // really only used when setting up initial pl var scale = ""; var LabelFormat = "LabelFormat())?>"; -var canEditEvents = ; var streamTimeout = ; var canStreamNative = ; diff --git a/web/skins/classic/views/js/events.js b/web/skins/classic/views/js/events.js index 0ea67a095..cabcc76ce 100644 --- a/web/skins/classic/views/js/events.js +++ b/web/skins/classic/views/js/events.js @@ -58,8 +58,8 @@ function processRows(rows) { row.Id = '' + eid + ''; row.Name = '' + row.Name + '' + '
' + archived + emailed + '
'; - if ( canEditMonitors ) row.Monitor = '' + row.Monitor + ''; - if ( canEditEvents ) row.Cause = '' + row.Cause + ''; + if ( canEdit.Monitors ) row.Monitor = '' + row.Monitor + ''; + if ( canEdit.Events ) row.Cause = '' + row.Cause + ''; if ( row.Notes.indexOf('detected:') >= 0 ) { row.Cause = row.Cause + '
' + row.Notes + '
'; } else if ( row.Notes != 'Forced Web: ' ) { @@ -105,7 +105,7 @@ function getDelConfirmModal() { // Manage the DELETE CONFIRMATION modal button function manageDelConfirmModalBtns() { document.getElementById("delConfirmBtn").addEventListener("click", function onDelConfirmClick(evt) { - if ( ! canEditEvents ) { + if ( ! canEdit.Events ) { enoperm(); return; } @@ -163,13 +163,13 @@ function initPage() { function() { selections = table.bootstrapTable('getSelections'); - viewBtn.prop('disabled', !(selections.length && canViewEvents)); - archiveBtn.prop('disabled', !(selections.length && canEditEvents)); - unarchiveBtn.prop('disabled', !(getArchivedSelections()) && canEditEvents); - editBtn.prop('disabled', !(selections.length && canEditEvents)); - exportBtn.prop('disabled', !(selections.length && canViewEvents)); - downloadBtn.prop('disabled', !(selections.length && canViewEvents)); - deleteBtn.prop('disabled', !(selections.length && canEditEvents)); + viewBtn.prop('disabled', !(selections.length && canView.Events)); + archiveBtn.prop('disabled', !(selections.length && canEdit.Events)); + unarchiveBtn.prop('disabled', !(getArchivedSelections()) && canEdit.Events); + editBtn.prop('disabled', !(selections.length && canEdit.Events)); + exportBtn.prop('disabled', !(selections.length && canView.Events)); + downloadBtn.prop('disabled', !(selections.length && canView.Events)); + deleteBtn.prop('disabled', !(selections.length && canEdit.Events)); }); // Don't enable the back button if there is no previous zm page to go back to @@ -228,7 +228,7 @@ function initPage() { // Manage the UNARCHIVE button document.getElementById("unarchiveBtn").addEventListener("click", function onUnarchiveClick(evt) { - if ( ! canEditEvents ) { + if ( ! canEdit.Events ) { enoperm(); return; } @@ -246,7 +246,7 @@ function initPage() { // Manage the EDIT button document.getElementById("editBtn").addEventListener("click", function onEditClick(evt) { - if ( ! canEditEvents ) { + if ( ! canEdit.Events ) { enoperm(); return; } @@ -292,7 +292,7 @@ function initPage() { // Manage the DELETE button document.getElementById("deleteBtn").addEventListener("click", function onDeleteClick(evt) { - if ( ! canEditEvents ) { + if ( ! canEdit.Events ) { enoperm(); return; } diff --git a/web/skins/classic/views/js/groups.js b/web/skins/classic/views/js/groups.js index e5b87ef02..571269ea4 100644 --- a/web/skins/classic/views/js/groups.js +++ b/web/skins/classic/views/js/groups.js @@ -50,7 +50,7 @@ function deleteGroup( element ) { } function configureButtons( element ) { - if ( canEditGroups ) { + if ( canEdit.Groups ) { var form = element.form; if ( element.checked ) { form.deleteBtn.disabled = (element.value == 0); @@ -64,7 +64,7 @@ function configModalBtns() { console.log("No groupForm found"); return; } - if ( !canEditGroups ) { + if ( !canEdit.Groups ) { console.log("Cannot edit groups"); form.elements['action'].disabled = disabled; return; diff --git a/web/skins/classic/views/js/options.js b/web/skins/classic/views/js/options.js index 96ede5a18..2566e2ab7 100644 --- a/web/skins/classic/views/js/options.js +++ b/web/skins/classic/views/js/options.js @@ -62,11 +62,11 @@ function initPage() { var NewStorageBtn = $j('#NewStorageBtn'); var NewServerBtn = $j('#NewServerBtn'); - if ( canEditSystem ) enableStorageModal(); - if ( canEditSystem ) enableServerModal(); + if ( canEdit.System ) enableStorageModal(); + if ( canEdit.System ) enableServerModal(); - NewStorageBtn.prop('disabled', !canEditSystem); - NewServerBtn.prop('disabled', !canEditSystem); + NewStorageBtn.prop('disabled', !canEdit.System); + NewServerBtn.prop('disabled', !canEdit.System); } $j(document).ready(function() { diff --git a/web/skins/classic/views/js/options.js.php b/web/skins/classic/views/js/options.js.php index 5281cde8c..49a4e94d3 100644 --- a/web/skins/classic/views/js/options.js.php +++ b/web/skins/classic/views/js/options.js.php @@ -4,4 +4,3 @@ if ( restartWarning ) { alert( "" ); } -var canEditSystem = ; diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 84c0382dd..6871095e6 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -267,7 +267,7 @@ function getStreamCmdResponse(respObj, respText) { setButtonState('zoomOutBtn', 'inactive'); } - if ( canEditMonitors ) { + if ( canEdit.Monitors ) { if ( streamStatus.enabled ) { enableAlmBtn.addClass('disabled'); enableAlmBtn.prop('title', disableAlarmsStr); @@ -285,7 +285,7 @@ function getStreamCmdResponse(respObj, respText) { forceAlmBtn.prop('disabled', true); } enableAlmBtn.prop('disabled', false); - } // end if canEditMonitors + } // end if canEdit.Monitors if ( streamStatus.auth ) { auth_hash = streamStatus.auth; @@ -772,7 +772,7 @@ function processClicks(event, field, value, row, $element) { // Manage the DELETE CONFIRMATION modal button function manageDelConfirmModalBtns() { document.getElementById("delConfirmBtn").addEventListener("click", function onDelConfirmClick(evt) { - if ( ! canEditEvents ) { + if ( ! canEdit.Events ) { enoperm(); return; } @@ -795,7 +795,7 @@ function manageDelConfirmModalBtns() { } function initPage() { - if ( canViewControl ) { + if ( canView.Control ) { // Load the PTZ Preset modal into the DOM if ( monitorControllable ) getCtrlPresetModal(); // Load the settings modal into the DOM @@ -866,7 +866,7 @@ function initPage() { }); // Only enable the settings button for local cameras - settingsBtn.prop('disabled', !canViewControl); + settingsBtn.prop('disabled', !canView.Control); if ( monitorType != 'Local' ) settingsBtn.hide(); // Init the bootstrap-table diff --git a/web/skins/classic/views/js/watch.js.php b/web/skins/classic/views/js/watch.js.php index d0ef131b6..444ae4edd 100644 --- a/web/skins/classic/views/js/watch.js.php +++ b/web/skins/classic/views/js/watch.js.php @@ -74,7 +74,6 @@ var eventsRefreshTimeout = ; var imageRefreshTimeout = ; var canStreamNative = ; -var canViewControl = ; var canPlayPauseAudio = Browser.ie; diff --git a/web/skins/classic/views/js/zone.js.php b/web/skins/classic/views/js/zone.js.php index 9fadea32c..dc9b823c2 100644 --- a/web/skins/classic/views/js/zone.js.php +++ b/web/skins/classic/views/js/zone.js.php @@ -128,7 +128,6 @@ var streamSrc = ""; var statusRefreshTimeout = ; var imageRefreshTimeout = ; -var canEditMonitors = ; var canStreamNative = ; var canPlayPauseAudio = Browser.ie; From 4e09a328367103182ae6f2158157af4530771f1d Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Tue, 8 Dec 2020 14:36:19 -0600 Subject: [PATCH 08/53] fix one canEdit --- web/skins/classic/views/js/console.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/js/console.js b/web/skins/classic/views/js/console.js index 4a64171aa..688d0d5ca 100644 --- a/web/skins/classic/views/js/console.js +++ b/web/skins/classic/views/js/console.js @@ -112,7 +112,7 @@ function reloadWindow() { function manageFunctionModal(evt) { evt.preventDefault(); - if ( !canEditEvents ) { + if ( !canEdit.Events ) { enoperm(); return; } From 951debab7fdb80536e84dece28b63d324fd5167b Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Wed, 9 Dec 2020 12:25:40 -0600 Subject: [PATCH 09/53] watch.js - replace mootools ajax w/ jquery --- web/skins/classic/views/js/watch.js | 212 +++++++++++++++------------- 1 file changed, 116 insertions(+), 96 deletions(-) diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 6871095e6..d308af7a0 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -9,23 +9,6 @@ var forceAlmBtn = $j('#forceAlmBtn'); var table = $j('#eventList'); var filterQuery = '&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId; -if ( monitorType != 'WebSite' ) { - var streamCmdParms = 'view=request&request=stream&connkey='+connKey; - if ( auth_hash ) { - streamCmdParms += '&auth='+auth_hash; - } - var streamCmdReq = new Request.JSON( { - url: monitorUrl, - method: 'get', - timeout: AJAX_TIMEOUT, - link: 'chain', - onError: getStreamCmdError, - onSuccess: getStreamCmdResponse, - onFailure: getStreamCmdFailure - } ); - var streamCmdTimer = null; -} - /* This is the format of the json object sent by bootstrap-table @@ -194,10 +177,6 @@ function getStreamCmdError(text, error) { window.location.reload(); } -function getStreamCmdFailure(xhr) { - console.log(xhr); -} - function getStreamCmdResponse(respObj, respText) { watchdogOk('stream'); if ( streamCmdTimer ) { @@ -296,10 +275,7 @@ function getStreamCmdResponse(respObj, respText) { var newSrc = oldSrc.replace(/auth=\w+/i, 'auth='+streamStatus.auth); streamImg.src = newSrc; } - streamCmdParms = streamCmdParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth); - statusCmdParms = statusCmdParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth); table.bootstrapTable('refresh'); - controlParms = controlParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth); } // end if have a new auth hash } // end if respObj.status } else { @@ -339,7 +315,10 @@ function streamCmdPause( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_PAUSE); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_PAUSE; + streamCmdReq(data); } } @@ -364,10 +343,21 @@ function streamCmdPlay( action ) { } } if ( action ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_PLAY); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_PLAY; + streamCmdReq(data); } } +function streamCmdReq(data) { + $j.getJSON(thisUrl + '?view=request&request=stream&connkey='+connKey, data) + .done(getStreamCmdResponse) + .fail(getStreamCmdError); + + var streamCmdTimer = null; +} + function streamCmdStop( action ) { setButtonState('pauseBtn', 'inactive'); setButtonState('playBtn', 'unavail'); @@ -379,7 +369,10 @@ function streamCmdStop( action ) { setButtonState('fastRevBtn', 'unavail'); } if ( action ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_STOP); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_STOP; + streamCmdReq(data); } setButtonState('stopBtn', 'unavail'); setButtonState('playBtn', 'active'); @@ -396,7 +389,10 @@ function streamCmdFastFwd( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_FASTFWD); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_FASTFWD; + streamCmdReq(data); } } @@ -411,7 +407,10 @@ function streamCmdSlowFwd( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_SLOWFWD); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_SLOWFWD; + streamCmdReq(data); } setButtonState('pauseBtn', 'active'); if ( monitorStreamReplayBuffer ) { @@ -430,7 +429,10 @@ function streamCmdSlowRev( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_SLOWREV); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_SLOWREV; + streamCmdReq(data); } setButtonState('pauseBtn', 'active'); if ( monitorStreamReplayBuffer ) { @@ -449,43 +451,51 @@ function streamCmdFastRev( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_FASTREV); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_FASTREV; + streamCmdReq(data); } } function streamCmdZoomIn( x, y ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_ZOOMIN+"&x="+x+"&y="+y); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.x = x; + data.y = y; + data.command = CMD_ZOOMIN; + streamCmdReq(data); } function streamCmdZoomOut() { - streamCmdReq.send(streamCmdParms+"&command="+CMD_ZOOMOUT); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_ZOOMOUT; + streamCmdReq(data); } function streamCmdScale( scale ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_SCALE+"&scale="+scale); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_SCALE; + data.scale = scale; + streamCmdReq(data); } function streamCmdPan( x, y ) { - streamCmdReq.send(streamCmdParms+"&command="+CMD_PAN+"&x="+x+"&y="+y); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.x = x; + data.y = y; + data.command = CMD_PAN; + streamCmdReq(data); } function streamCmdQuery() { - streamCmdReq.send(streamCmdParms+"&command="+CMD_QUERY); -} - -if ( monitorType != 'WebSite' ) { - var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate"; - if ( auth_hash ) { - statusCmdParms += '&auth='+auth_hash; - } - var statusCmdReq = new Request.JSON( { - url: monitorUrl, - method: 'get', - timeout: AJAX_TIMEOUT, - link: 'cancel', - onSuccess: getStatusCmdResponse - } ); - var statusCmdTimer = null; + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = CMD_QUERY; + streamCmdReq(data); } function getStatusCmdResponse(respObj, respText) { @@ -509,22 +519,24 @@ function getStatusCmdResponse(respObj, respText) { } function statusCmdQuery() { - statusCmdReq.send(statusCmdParms); + $j.getJSON(thisUrl + '?view=request&request=status&entity=monitor&element[]=Status&element[]=FrameRate&id='+monitorId) + .done(getStatusCmdResponse) + .fail(logAjaxFail); + + var streamCmdTimer = null; } -if ( monitorType != 'WebSite' ) { - var alarmCmdParms = 'view=request&request=alarm&id='+monitorId; - if ( auth_hash ) { - alarmCmdParms += '&auth='+auth_hash; - } - var alarmCmdReq = new Request.JSON( { - url: monitorUrl, - method: 'get', - timeout: AJAX_TIMEOUT, - link: 'cancel', - onSuccess: getAlarmCmdResponse, - onTimeout: streamCmdQuery - } ); +function alarmCmdReq(data) { + $j.getJSON(thisUrl + '?view=request&request=alarm&id='+monitorId, data) + .done(getAlarmCmdResponse) + .fail(function(jqxhr, textStatus, error) { + if(textstatus === "timeout") { + streamCmdQuery(); + } else { + logAjaxFail(jqxhr, textStatus, error); + } + }); + var alarmCmdFirst = true; } @@ -533,11 +545,17 @@ function getAlarmCmdResponse(respObj, respText) { } function cmdDisableAlarms() { - alarmCmdReq.send(alarmCmdParms+"&command=disableAlarms"); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = 'disableAlarms'; + alarmCmdReq(data); } function cmdEnableAlarms() { - alarmCmdReq.send(alarmCmdParms+"&command=enableAlarms"); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = 'enableAlarms'; + alarmCmdReq(data); } function cmdAlarm() { @@ -549,17 +567,19 @@ function cmdAlarm() { } function cmdForceAlarm() { - alarmCmdReq.send(alarmCmdParms+"&command=forceAlarm"); - if ( window.event ) { - window.event.preventDefault(); - } + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = 'forceAlarm'; + alarmCmdReq(data); + if ( window.event ) window.event.preventDefault(); } function cmdCancelForcedAlarm() { - alarmCmdReq.send(alarmCmdParms+"&command=cancelForcedAlarm"); - if ( window.event ) { - window.event.preventDefault(); - } + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.command = 'cancelForcedAlarm'; + alarmCmdReq(data); + if ( window.event ) window.event.preventDefault(); return false; } @@ -571,18 +591,10 @@ function cmdForce() { } } -if ( monitorType != 'WebSite' ) { - var controlParms = 'view=request&request=control&id='+monitorId; - if ( auth_hash ) { - controlParms += '&auth='+auth_hash; - } - var controlReq = new Request.JSON( { - url: monitorUrl, - method: 'post', - timeout: AJAX_TIMEOUT, - link: 'cancel', - onSuccess: getControlResponse - } ); +function controlReq(data) { + $j.getJSON(thisUrl + '?view=request&request=control&id='+monitorId, data) + .done(getControlResponse) + .fail(logAjaxFail); } function getControlResponse(respObj, respText) { @@ -601,7 +613,8 @@ function controlCmd(event) { xtell = button.getAttribute('data-xtell'); ytell = button.getAttribute('data-ytell'); - var locParms = ''; + var data = new Object(); + if ( event && (xtell || ytell) ) { var target = event.target; var offset = $j(target).offset(); @@ -618,7 +631,7 @@ function controlCmd(event) { } else if ( xtell == 2 ) { xge = 2*(50 - xge); } - locParms += '&xge='+xge; + data.xge = xge; } if ( ytell ) { var yge = parseInt((y*100)/height); @@ -627,21 +640,28 @@ function controlCmd(event) { } else if ( ytell == 2 ) { yge = 2*(50 - yge); } - locParms += '&yge='+yge; + data.yge = yge; } } - controlReq.send(controlParms+"&control="+control+locParms); + + if ( auth_hash ) data.auth = auth_hash; + data.control = control + controlReq(data); + if ( streamMode == 'single' ) { fetchImage.pass($('imageFeed').getElement('img')).delay(1000); } } function controlCmdImage( x, y ) { - var imageControlParms = controlParms; - imageControlParms += '&scale='+scale; - imageControlParms += '&control='+imageControlMode; - - controlReq.send( imageControlParms+"&x="+x+"&y="+y ); + var data = new Object(); + if ( auth_hash ) data.auth = auth_hash; + data.scale = scale; + data.control = imageControlMode; + data.x = x; + data.y = y; + controlReq(data); + if ( streamMode == 'single' ) { fetchImage.pass( $('imageFeed').getElement('img') ).delay( 1000 ); } From eb4b7f248d488a1ac73eb5d2f6c1cfc092c0e416 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 5 Dec 2020 19:50:58 -0500 Subject: [PATCH 10/53] handle sort_field and limit not existing in _REQUEST --- web/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index d5478b74f..c2072a706 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1200,8 +1200,8 @@ function sortHeader($field, $querySep='&') { '?view='.$view, 'page=1'.(isset($_REQUEST['filter'])?$_REQUEST['filter']['query']:''), 'sort_field='.$field, - 'sort_asc='.($_REQUEST['sort_field'] == $field ? !$_REQUEST['sort_asc'] : 0), - 'limit='.validInt($_REQUEST['limit']), + 'sort_asc='.( ( isset($_REQUEST['sort_field']) and ( $_REQUEST['sort_field'] == $field ) ) ? !$_REQUEST['sort_asc'] : 0), + 'limit='.(isset($_REQUEST['limit']) ? validInt($_REQUEST['limit']) : ''), (isset($_REQUEST['eid']) ? 'eid='.$_REQUEST['eid'] : '' ), )); } From 5482d3b3d54001ecae4a154d2a6fd4dd9ffc0421 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 9 Dec 2020 17:56:09 -0500 Subject: [PATCH 11/53] Quiet error when calling logout when already logged out --- web/includes/auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/includes/auth.php b/web/includes/auth.php index ced24ff9d..5a95dec94 100644 --- a/web/includes/auth.php +++ b/web/includes/auth.php @@ -105,7 +105,7 @@ function validateUser($username='', $password='') { function userLogout() { global $user; - ZM\Info('User "'.$user['Username'].'" logged out'); + ZM\Info('User "'.($user?$user['Username']:'no one').'" logged out'); $user = null;// unset only clears the local variable zm_session_clear(); } From 026b8cfb0c7e63e8937c5a566d489d9eae92d2ee Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Wed, 9 Dec 2020 17:58:46 -0600 Subject: [PATCH 12/53] eslint --- web/skins/classic/views/js/watch.js | 47 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index d308af7a0..6aed02d63 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -1,3 +1,4 @@ +var streamCmdTimer = null; var streamStatus; var auth_hash; var alarmState = STATE_IDLE; @@ -315,7 +316,7 @@ function streamCmdPause( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_PAUSE; streamCmdReq(data); @@ -343,7 +344,7 @@ function streamCmdPlay( action ) { } } if ( action ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_PLAY; streamCmdReq(data); @@ -369,7 +370,7 @@ function streamCmdStop( action ) { setButtonState('fastRevBtn', 'unavail'); } if ( action ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_STOP; streamCmdReq(data); @@ -389,7 +390,7 @@ function streamCmdFastFwd( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_FASTFWD; streamCmdReq(data); @@ -407,7 +408,7 @@ function streamCmdSlowFwd( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_SLOWFWD; streamCmdReq(data); @@ -429,7 +430,7 @@ function streamCmdSlowRev( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_SLOWREV; streamCmdReq(data); @@ -451,7 +452,7 @@ function streamCmdFastRev( action ) { setButtonState('fastRevBtn', 'inactive'); } if ( action ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_FASTREV; streamCmdReq(data); @@ -459,7 +460,7 @@ function streamCmdFastRev( action ) { } function streamCmdZoomIn( x, y ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.x = x; data.y = y; @@ -468,22 +469,22 @@ function streamCmdZoomIn( x, y ) { } function streamCmdZoomOut() { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_ZOOMOUT; streamCmdReq(data); } function streamCmdScale( scale ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_SCALE; data.scale = scale; - streamCmdReq(data); + streamCmdReq(data); } function streamCmdPan( x, y ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.x = x; data.y = y; @@ -492,7 +493,7 @@ function streamCmdPan( x, y ) { } function streamCmdQuery() { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = CMD_QUERY; streamCmdReq(data); @@ -530,14 +531,12 @@ function alarmCmdReq(data) { $j.getJSON(thisUrl + '?view=request&request=alarm&id='+monitorId, data) .done(getAlarmCmdResponse) .fail(function(jqxhr, textStatus, error) { - if(textstatus === "timeout") { + if (textstatus === "timeout") { streamCmdQuery(); } else { logAjaxFail(jqxhr, textStatus, error); } }); - - var alarmCmdFirst = true; } function getAlarmCmdResponse(respObj, respText) { @@ -545,14 +544,14 @@ function getAlarmCmdResponse(respObj, respText) { } function cmdDisableAlarms() { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = 'disableAlarms'; alarmCmdReq(data); } function cmdEnableAlarms() { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = 'enableAlarms'; alarmCmdReq(data); @@ -567,7 +566,7 @@ function cmdAlarm() { } function cmdForceAlarm() { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = 'forceAlarm'; alarmCmdReq(data); @@ -575,7 +574,7 @@ function cmdForceAlarm() { } function cmdCancelForcedAlarm() { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.command = 'cancelForcedAlarm'; alarmCmdReq(data); @@ -613,7 +612,7 @@ function controlCmd(event) { xtell = button.getAttribute('data-xtell'); ytell = button.getAttribute('data-ytell'); - var data = new Object(); + var data = {}; if ( event && (xtell || ytell) ) { var target = event.target; @@ -645,7 +644,7 @@ function controlCmd(event) { } if ( auth_hash ) data.auth = auth_hash; - data.control = control + data.control = control; controlReq(data); if ( streamMode == 'single' ) { @@ -654,14 +653,14 @@ function controlCmd(event) { } function controlCmdImage( x, y ) { - var data = new Object(); + var data = {}; if ( auth_hash ) data.auth = auth_hash; data.scale = scale; data.control = imageControlMode; data.x = x; data.y = y; controlReq(data); - + if ( streamMode == 'single' ) { fetchImage.pass( $('imageFeed').getElement('img') ).delay( 1000 ); } From c43ffcf58f012cf431a47c9a007b5002b41c7352 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Wed, 9 Dec 2020 18:02:34 -0600 Subject: [PATCH 13/53] eslint --- web/skins/classic/js/skin.js.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/js/skin.js.php b/web/skins/classic/js/skin.js.php index b10598235..a15d32526 100644 --- a/web/skins/classic/js/skin.js.php +++ b/web/skins/classic/js/skin.js.php @@ -40,8 +40,8 @@ var thisUrl = ''; var serverId = ''; -var canView = new Object(); -var canEdit = new Object(); +var canView = {}; +var canEdit = {}; Date: Wed, 9 Dec 2020 18:19:10 -0600 Subject: [PATCH 14/53] don't set zoom class in frames.js --- web/skins/classic/views/js/frames.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/web/skins/classic/views/js/frames.js b/web/skins/classic/views/js/frames.js index 1451c6eeb..85c2a05ef 100644 --- a/web/skins/classic/views/js/frames.js +++ b/web/skins/classic/views/js/frames.js @@ -118,8 +118,7 @@ function initPage() { var thumb_ndx = $j('#framesTable tr th').filter(function() { return $j(this).text().trim() == 'Thumbnail'; }).index(); - var thmbClass = WEB_ANIMATE_THUMBS ? 'colThumbnail zoom' : 'colThumbnail'; - table.find("tr td:nth-child(" + (thumb_ndx+1) + ")").addClass(thmbClass); + table.find("tr td:nth-child(" + (thumb_ndx+1) + ")").addClass('colThumbnail'); }); } From e0ac68786f2b4ffdb3ab983f4dd0359c912b80e0 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Wed, 9 Dec 2020 18:48:58 -0600 Subject: [PATCH 15/53] remove unneeded thumb animation functions from frames.js --- web/skins/classic/views/js/frames.js | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/web/skins/classic/views/js/frames.js b/web/skins/classic/views/js/frames.js index 85c2a05ef..3e8517fd9 100644 --- a/web/skins/classic/views/js/frames.js +++ b/web/skins/classic/views/js/frames.js @@ -26,27 +26,6 @@ function processRows(rows) { return rows; } -function thumbnail_onmouseover(event) { - var img = event.target; - img.src = ''; - img.src = img.getAttribute('full_img_src'); -} - -function thumbnail_onmouseout(event) { - var img = event.target; - img.src = ''; - img.src = img.getAttribute('img_src'); -} - -function initThumbAnimation() { - if ( WEB_ANIMATE_THUMBS ) { - $j('.colThumbnail img').each(function() { - this.addEventListener('mouseover', thumbnail_onmouseover, false); - this.addEventListener('mouseout', thumbnail_onmouseout, false); - }); - } -} - function processClicks(event, field, value, row, $element) { if ( field == 'Score' ) { window.location.assign('?view=stats&eid='+row.EventId+'&fid='+row.FrameId); From 3a4cdb7e5041599675253b3315e653adf4629f50 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Wed, 9 Dec 2020 20:06:38 -0600 Subject: [PATCH 16/53] eslint --- web/skins/classic/views/js/watch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 6aed02d63..1fe53744e 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -356,7 +356,7 @@ function streamCmdReq(data) { .done(getStreamCmdResponse) .fail(getStreamCmdError); - var streamCmdTimer = null; + streamCmdTimer = null; } function streamCmdStop( action ) { @@ -524,7 +524,7 @@ function statusCmdQuery() { .done(getStatusCmdResponse) .fail(logAjaxFail); - var streamCmdTimer = null; + streamCmdTimer = null; } function alarmCmdReq(data) { From 9fb953bc848ade9a6302268aa27489dd5b68ef21 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 10 Dec 2020 07:24:48 -0600 Subject: [PATCH 17/53] set the right image attributes for frames view --- web/skins/classic/js/skin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/js/skin.js b/web/skins/classic/js/skin.js index ebfa5c0fe..925018a12 100644 --- a/web/skins/classic/js/skin.js +++ b/web/skins/classic/js/skin.js @@ -894,8 +894,9 @@ function thumbnail_onmouseover(event) { timeout = setTimeout(function() { var img = event.target; var imgClass = ( currentView == 'console' ) ? 'zoom-console' : 'zoom'; + var imgAttr = ( currentView == 'frames' ) ? 'full_img_src' : 'stream_src'; img.src = ''; - img.src = img.getAttribute('stream_src'); + img.src = img.getAttribute(imgAttr); img.addClass(imgClass); }, 350); } @@ -904,8 +905,9 @@ function thumbnail_onmouseout(event) { clearTimeout(timeout); var img = event.target; var imgClass = ( currentView == 'console' ) ? 'zoom-console' : 'zoom'; + var imgAttr = ( currentView == 'frames' ) ? 'img_src' : 'still_src'; img.src = ''; - img.src = img.getAttribute('still_src'); + img.src = img.getAttribute(imgAttr); img.removeClass(imgClass); } From 37d4b3472f43ddb251f3433ec59126bb0f8cc60d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 10 Dec 2020 13:43:16 -0500 Subject: [PATCH 18/53] Add useful help for function modal describing each mode and the purpose of the Enabled checkbox --- web/ajax/modals/function.php | 24 +++++++- web/lang/en_gb.php | 58 ++++++++++++++++++++ web/skins/classic/css/base/views/console.css | 3 + web/skins/classic/views/js/console.js | 11 ++++ 4 files changed, 93 insertions(+), 3 deletions(-) diff --git a/web/ajax/modals/function.php b/web/ajax/modals/function.php index e6bab2718..44e23b711 100644 --- a/web/ajax/modals/function.php +++ b/web/ajax/modals/function.php @@ -37,11 +37,29 @@ if ( !canEdit('Monitors') ) return; -
+
+
+
+ + +'.$OLANG['FUNCTION_DECODING_ENABLED']['Help'].'
'; + } +?> +