From 1643fb686b3b00160a80c5718270906fea1b8f4e Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 3 Oct 2020 16:51:25 -0500 Subject: [PATCH] convert settings popup to modal --- .../views => ajax/modals}/settings.php | 61 +++++++------------ web/skins/classic/views/js/watch.js | 27 +++++++- web/skins/classic/views/js/watch.js.php | 1 + web/skins/classic/views/watch.php | 4 +- 4 files changed, 52 insertions(+), 41 deletions(-) rename web/{skins/classic/views => ajax/modals}/settings.php (53%) diff --git a/web/skins/classic/views/settings.php b/web/ajax/modals/settings.php similarity index 53% rename from web/skins/classic/views/settings.php rename to web/ajax/modals/settings.php index 0c51add26..59d19ddbb 100644 --- a/web/skins/classic/views/settings.php +++ b/web/ajax/modals/settings.php @@ -1,27 +1,6 @@ $_REQUEST['mid'])); $zmuCommand = getZmuCommand(' -m '.escapeshellarg($_REQUEST['mid']).' -B -C -H -O'); @@ -35,17 +14,22 @@ if ( $zmuOutput ) { $monitor->Colour($colour); } -$focusWindow = true; - -xhtmlHeaders(__FILE__, validHtmlStr($monitor->Name()).' - '.translate('Settings')); ?> - -
- -
-
+
diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index ebb8b4d04..48d27dd82 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -845,9 +845,32 @@ function getCtrlPresetModal() { .fail(logAjaxFail); } +function getSettingsModal() { + $j.getJSON(thisUrl + '?request=modal&modal=settings&mid=' + monitorId) + .done(function(data) { + if ( $j('#settingsModal').length ) { + $j('#settingsModal').replaceWith(data.html); + } else { + $j("body").append(data.html); + } + updatePresetLabels(); + // Manage the Save button + $j('#settingsSubmitModal').click(function(evt) { + evt.preventDefault(); + $j('#settingsForm').submit(); + }); + }) + .fail(logAjaxFail); +} + function initPage() { - // Load the PTZ Preset modal into the DOM - getCtrlPresetModal(); + + if ( canViewControl ) { + // Load the PTZ Preset modal into the DOM + getCtrlPresetModal(); + // Load the settings modal into the DOM + getSettingsModal(); + } if ( monitorType != 'WebSite' ) { if ( streamMode == 'single' ) { diff --git a/web/skins/classic/views/js/watch.js.php b/web/skins/classic/views/js/watch.js.php index 268d9d0e3..d20347476 100644 --- a/web/skins/classic/views/js/watch.js.php +++ b/web/skins/classic/views/js/watch.js.php @@ -68,6 +68,7 @@ var imageRefreshTimeout = ; var canEditMonitors = ; var canStreamNative = ; +var canViewControl = ; var canPlayPauseAudio = Browser.ie; diff --git a/web/skins/classic/views/watch.php b/web/skins/classic/views/watch.php index 1b9ca2994..b0063f4a2 100644 --- a/web/skins/classic/views/watch.php +++ b/web/skins/classic/views/watch.php @@ -67,7 +67,9 @@ xhtmlHeaders(__FILE__, $monitor->Name().' - '.translate('Feed')); Type() == 'Local' ) { ?> -
UrlToIndex().'?view=settings&mid='.$monitor->Id().'&'.get_auth_relay(), 'zmSettings'.$monitor->Id(), 'settings', translate('Settings'), true, 'id="settingsLink"') ?>
+
+ +