From fbcedae7f5331e8de1e89022824aff1a3c719c0b Mon Sep 17 00:00:00 2001 From: IgorA100 Date: Tue, 21 May 2024 22:50:11 +0300 Subject: [PATCH 1/3] Fix: Select layout on Montage page (montage.php) If there is no cookie, set Layout="Auto" --- web/skins/classic/views/montage.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/web/skins/classic/views/montage.php b/web/skins/classic/views/montage.php index af15957ac..0650fa692 100644 --- a/web/skins/classic/views/montage.php +++ b/web/skins/classic/views/montage.php @@ -202,21 +202,21 @@ foreach ($displayMonitors as &$row) { } } # end foreach Monitor -if (!$layout_id || !is_numeric($layout_id) || !isset($layoutsById[$layout_id]) || $layout_id == $AutoLayoutName) { - $default_layout = ''; - if (count($monitors) >= 6) { - $default_layout = '6 Wide'; - } else if (count($monitors) >= 4) { - $default_layout = '4 Wide'; - } else { - $default_layout = '2 Wide'; - } - if ($layout_id != $AutoLayoutName) { - $layout_id = $arrNameId[$default_layout]; - } else { - $AutoLayoutName = $default_layout; - } +$default_layout = ''; +if (count($monitors) >= 6) { + $default_layout = '6 Wide'; +} else if (count($monitors) >= 4) { + $default_layout = '4 Wide'; +} else { + $default_layout = '2 Wide'; } + +if (!$layout_id || !is_numeric($layout_id) || !isset($layoutsById[$layout_id]) || $layout_id == $AutoLayoutName) { + $layout_id = $arrNameId["Freeform"]; +} else if ($layout_id == $AutoLayoutName) { + $layout_id = $arrNameId[$default_layout]; +} +$AutoLayoutName = $default_layout; if ( $layout_id and is_numeric($layout_id) and isset($layoutsById[$layout_id]) ) { From f6281d82d01813e26785ba508d94f452522637b7 Mon Sep 17 00:00:00 2001 From: IgorA100 Date: Tue, 21 May 2024 22:58:25 +0300 Subject: [PATCH 2/3] Removed meaningless condition (montage.php) --- web/skins/classic/views/montage.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/web/skins/classic/views/montage.php b/web/skins/classic/views/montage.php index 0650fa692..389c7d8fd 100644 --- a/web/skins/classic/views/montage.php +++ b/web/skins/classic/views/montage.php @@ -218,12 +218,6 @@ if (!$layout_id || !is_numeric($layout_id) || !isset($layoutsById[$layout_id]) | } $AutoLayoutName = $default_layout; -if ( $layout_id and is_numeric($layout_id) and isset($layoutsById[$layout_id]) ) { - -} else { - ZM\Debug('Layout not found'); -} - xhtmlHeaders(__FILE__, translate('Montage')); getBodyTopHTML(); echo getNavBarHTML(); From ada2f2dc0fbb955bd40e1fe7d34f02c8e5f60d1f Mon Sep 17 00:00:00 2001 From: IgorA100 Date: Tue, 21 May 2024 23:12:33 +0300 Subject: [PATCH 3/3] Fix: Layout "Auto" is considered as "Freeform" (montage.js) --- web/skins/classic/views/js/montage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index 207bf884c..cbc6ed6e4 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -49,6 +49,7 @@ var defaultPresetRatio = 'auto'; var averageMonitorsRatio; function isPresetLayout(name) { + name = (name == "Auto") ? "Freeform" : name; return ((ZM_PRESET_LAYOUT_NAMES.indexOf(name) != -1) ? true : false); }