From 1a54a96c0479537411205a6e6c84961409520833 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 18 Feb 2022 17:09:24 -0500 Subject: [PATCH] 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')); - - + +