Skip to content

Commit dca0f76

Browse files
feat: add ZM_WEB_SHOW_NAV_BUTTONS config to hide Back/Refresh buttons
Add a boolean web config option to control visibility of the Back and Refresh navigation buttons shown at the top of most views. Uses a body class and CSS rule so no individual view files need changes. Also remove the ZM_WEB_BUTTON_STYLE INSERT from the migration SQL since zmupdate.pl handles Config table inserts from ConfigData.pm.in. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 217c415 commit dca0f76

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

db/zm_update-1.39.4.sql

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,3 @@ UPDATE Config SET
1717
No: Checkbox is shown and unchecked by default. Users may check it to persist the session.
1818
'
1919
WHERE Name = 'ZM_OPT_USE_REMEMBER_ME';
20-
21-
--
22-
-- Add ZM_WEB_BUTTON_STYLE config option
23-
--
24-
25-
SET @s = (SELECT IF(
26-
(SELECT COUNT(*) FROM Config WHERE Name = 'ZM_WEB_BUTTON_STYLE') > 0,
27-
"SELECT 'ZM_WEB_BUTTON_STYLE already exists'",
28-
"INSERT INTO Config SET Id = 251, Name = 'ZM_WEB_BUTTON_STYLE', Value = 'icons+text', Type = 'string', DefaultValue = 'icons+text', Hint = 'icons+text|icons|text', Pattern = '(?^i:^([it]))', Format = ' $1 ', Prompt = 'How to display toolbar buttons throughout the interface', Help = 'Controls the display of toolbar buttons across the web interface. Icons + Text: Show both icon and label (default). Icons Only: Show only the icon; labels are hidden. Text Only: Show only the label; icons are hidden on buttons that have labels.', Category = 'web', Readonly = '0', Requires = ''"
29-
));
30-
31-
PREPARE stmt FROM @s;
32-
EXECUTE stmt;
33-
DEALLOCATE PREPARE stmt;

scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,6 +3035,19 @@ our @options = (
30353035
},
30363036
category => 'web',
30373037
},
3038+
{
3039+
name => 'ZM_WEB_SHOW_NAV_BUTTONS',
3040+
default => 'yes',
3041+
description => 'Show Back and Refresh buttons at the top of views.',
3042+
help => q`
3043+
Controls whether the Back and Refresh navigation buttons are
3044+
displayed in the top-left corner of most views. If disabled,
3045+
the buttons are hidden to save screen space. You can still use
3046+
your browser's back and refresh functions.
3047+
`,
3048+
type => $types{boolean},
3049+
category => 'web',
3050+
},
30383051
{
30393052
name => 'ZM_WEB_H_REFRESH_MAIN',
30403053
default => '240',

web/skins/classic/css/base/skin.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,4 +1647,9 @@ video-stream[id^='liveStream'] video{
16471647
.btn-text-only .btn:has(.text) > i.fa {
16481648
display: none;
16491649
}
1650+
/* Hide Back and Refresh nav buttons when config disables them */
1651+
.hide-nav-buttons #backBtn,
1652+
.hide-nav-buttons #refreshBtn {
1653+
display: none;
1654+
}
16501655
/* --- This block should always be located at the end! */

web/skins/classic/includes/functions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ function getBodyTopHTML() {
161161
if (defined('ZM_WEB_FILTER_SETTINGS_POSITION') and ZM_WEB_FILTER_SETTINGS_POSITION == 'inline') $classes .= ' filter-inline';
162162
if (defined('ZM_WEB_BUTTON_STYLE') and ZM_WEB_BUTTON_STYLE == 'icons') $classes .= ' btn-icons-only';
163163
else if (defined('ZM_WEB_BUTTON_STYLE') and ZM_WEB_BUTTON_STYLE == 'text') $classes .= ' btn-text-only';
164+
if (defined('ZM_WEB_SHOW_NAV_BUTTONS') and !ZM_WEB_SHOW_NAV_BUTTONS) $classes .= ' hide-nav-buttons';
164165
$classHTML = ' class="'.$classes.'"';
165166
echo '
166167
<body data-swipe-threshold="10" data-swipe-unit="vw" data-swipe-timeout="300"'.$classHTML.'>

0 commit comments

Comments
 (0)