From 09e01138ba23fed92e79ce052cf4331c1554f689 Mon Sep 17 00:00:00 2001 From: Alexander Bias <alexander.bias@uni-ulm.de> Date: Thu, 14 Jan 2021 20:10:49 +0100 Subject: [PATCH] Improvement: Add option to output the information banner without any particular Bootstrap color. --- CHANGES.md | 1 + lang/en/theme_boost_campus.php | 4 ++++ layout/columns2.php | 8 ++++++-- layout/login.php | 8 ++++++-- settings.php | 14 ++++++++++---- templates/columns2.mustache | 4 ++-- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2925dee..648e600 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2021-01-14 - Improvement: Add option to output the information banner without any particular Bootstrap color. * 2021-01-14 - Bugfix: The infobanner should not clean the entered HTML code too strictly. ### Release v3.10-r1 diff --git a/lang/en/theme_boost_campus.php b/lang/en/theme_boost_campus.php index a58bd1f..5241461 100644 --- a/lang/en/theme_boost_campus.php +++ b/lang/en/theme_boost_campus.php @@ -285,6 +285,9 @@ $string['timedibendsetting_desc'] = 'With this setting you can define when the t <br/>Please enter a valid date in this format: YYYY-MM-DD HH:MM:SS. For example: "2020-01-07 08:00:00. The time zone will be the time zone you have defined in the setting "Default timezone". <br/>If you leave this setting empty but entered a date in the for the start, the banner won\'t hide after the starting time has been reached.'; +// ...General information banner. +$string['ibcsssetting_nobootstrap'] = 'If you choose the \'{$a->bootstrapnone}\' option, the information banner will be output without any particular Bootstrap color.'; + // ADDITIONAL STRINGS (IN ALPHABETICAL ORDER). $string['backtotop'] = 'Back to top'; $string['bootstrapprimarycolor'] = 'Primary color'; @@ -295,6 +298,7 @@ $string['bootstrapwarningcolor'] = 'Warning color'; $string['bootstrapinfocolor'] = 'Info color'; $string['bootstraplightcolor'] = 'Light color'; $string['bootstrapdarkcolor'] = 'Dark color'; +$string['bootstrapnone'] = 'No Bootstrap color'; $string['cachedef_imagearea'] = 'Cache for imagearea items'; $string['close'] = 'Close'; $string['confirmation'] = 'Confirmation'; diff --git a/layout/columns2.php b/layout/columns2.php index 86aa04a..b3e5322 100644 --- a/layout/columns2.php +++ b/layout/columns2.php @@ -125,7 +125,9 @@ if ($perpibenable) { // Add the variables to the templatecontext array. $templatecontext['perpibcontent'] = $perpibcontent; - $templatecontext['perpibcss'] = $perpibcss; + if ($perpibcss != 'none') { + $templatecontext['perpibcss'] = $perpibcss; + } $templatecontext['perpibdismiss'] = $perpibdismiss; $templatecontext['perpinfobannershowonselectedpage'] = $perpinfobannershowonselectedpage; $templatecontext['perbibconfirmdialogue'] = $perbibconfirmdialogue; @@ -151,7 +153,9 @@ if ($timedibenable) { // Add the variables to the templatecontext array. $templatecontext['timedibcontent'] = $timedibcontent; - $templatecontext['timedibcss'] = $timedibcss; + if ($timedibcss != 'none') { + $templatecontext['timedibcss'] = $timedibcss; + } $templatecontext['timedinfobannershowonselectedpage'] = $timedinfobannershowonselectedpage; } // MODIFICATION END. diff --git a/layout/login.php b/layout/login.php index 2c14fbb..672c992 100644 --- a/layout/login.php +++ b/layout/login.php @@ -59,7 +59,9 @@ if ($perpibenable) { // Add the variables to the templatecontext array. $templatecontext['perpibcontent'] = $perpibcontent; - $templatecontext['perpibcss'] = $perpibcss; + if ($perpibcss != 'none') { + $templatecontext['perpibcss'] = $perpibcss; + } $templatecontext['perpinfobannershowonselectedpage'] = $perpinfobannershowonselectedpage; } // MODIFICATION END. @@ -72,7 +74,9 @@ if ($timedibenable) { $timedibcontent = format_text(get_config('theme_boost_campus', 'timedibcontent'), FORMAT_HTML, $formatoptions); // Result of multiselect is a string divided by a comma, so exploding into an array. $timedibshowonpages = explode(",", get_config('theme_boost_campus', 'timedibshowonpages')); - $timedibcss = get_config('theme_boost_campus', 'timedibcss'); + if ($perpibcss != 'none') { + $timedibcss = get_config('theme_boost_campus', 'timedibcss'); + } $timedibstartsetting = get_config('theme_boost_campus', 'timedibstart'); $timedibendsetting = get_config('theme_boost_campus', 'timedibend'); // Get the current server time. diff --git a/settings.php b/settings.php index c41f1a2..2f76d16 100644 --- a/settings.php +++ b/settings.php @@ -730,7 +730,9 @@ if ($ADMIN->fulltree) { // Select the bootstrap class that should be used for the perpetual info banner. $name = 'theme_boost_campus/perpibcss'; $title = get_string('perpibcsssetting', 'theme_boost_campus', null, true); - $description = get_string('perpibcsssetting_desc', 'theme_boost_campus', null, true); + $description = get_string('perpibcsssetting_desc', 'theme_boost_campus', null, true).'<br />'. + get_string('ibcsssetting_nobootstrap', 'theme_boost_campus', + array('bootstrapnone' => get_string('bootstrapnone', 'theme_boost_campus'))); $perpibcssoptions = [ // Don't use string lazy loading (= false) because the string will be directly used and would produce a // PHP warning otherwise. @@ -741,7 +743,8 @@ if ($ADMIN->fulltree) { 'warning' => get_string('bootstrapwarningcolor', 'theme_boost_campus', null, false), 'info' => get_string('bootstrapinfocolor', 'theme_boost_campus', null, false), 'light' => get_string('bootstraplightcolor', 'theme_boost_campus', null, false), - 'dark' => get_string('bootstrapdarkcolor', 'theme_boost_campus', null, false) + 'dark' => get_string('bootstrapdarkcolor', 'theme_boost_campus', null, false), + 'none' => get_string('bootstrapnone', 'theme_boost_campus', null, false) ]; $setting = new admin_setting_configselect($name, $title, $description, $perpibcssoptions['primary'], $perpibcssoptions); @@ -824,7 +827,9 @@ if ($ADMIN->fulltree) { // Select the bootstrap class that should be used for the perpetual info banner. $name = 'theme_boost_campus/timedibcss'; $title = get_string('timedibcsssetting', 'theme_boost_campus', null, true); - $description = get_string('timedibcsssetting_desc', 'theme_boost_campus', null, true); + $description = get_string('timedibcsssetting_desc', 'theme_boost_campus', null, true).'<br />'. + get_string('ibcsssetting_nobootstrap', 'theme_boost_campus', + array('bootstrapnone' => get_string('bootstrapnone', 'theme_boost_campus'))); $timedibcssoptions = [ // Don't use string lazy loading (= false) because the string will be directly used and would produce a // PHP warning otherwise. @@ -835,7 +840,8 @@ if ($ADMIN->fulltree) { 'warning' => get_string('bootstrapwarningcolor', 'theme_boost_campus', null, false), 'info' => get_string('bootstrapinfocolor', 'theme_boost_campus', null, false), 'light' => get_string('bootstraplightcolor', 'theme_boost_campus', null, false), - 'dark' => get_string('bootstrapdarkcolor', 'theme_boost_campus', null, false) + 'dark' => get_string('bootstrapdarkcolor', 'theme_boost_campus', null, false), + 'none' => get_string('bootstrapnone', 'theme_boost_campus', null, false) ]; $setting = new admin_setting_configselect($name, $title, $description, $timedibcssoptions['primary'], $timedibcssoptions); diff --git a/templates/columns2.mustache b/templates/columns2.mustache index cbbff71..0337236 100644 --- a/templates/columns2.mustache +++ b/templates/columns2.mustache @@ -94,13 +94,13 @@ <div id="page" class="container-fluid d-print-block"> {{#timedinfobannershowonselectedpage}} - <div id="themeboostcampusitimedinfobanner" class="alert alert-{{{ timedibcss }}} mt-3" role="alert"> + <div id="themeboostcampusitimedinfobanner" class="alert {{#timedibcss}}alert-{{{ timedibcss }}}{{/timedibcss}} mt-3" role="alert"> {{{ timedibcontent }}} </div> {{/timedinfobannershowonselectedpage}} {{#perpinfobannershowonselectedpage}} - <div id="themeboostcampusperpinfobanner" class="alert alert-{{{ perpibcss }}} {{#perpibdismiss}}alert-dismissible fade show{{/perpibdismiss}} mt-3" role="alert"> + <div id="themeboostcampusperpinfobanner" class="alert {{#perpibcss}}alert-{{{ perpibcss }}}{{/perpibcss}} {{#perpibdismiss}}alert-dismissible fade show{{/perpibdismiss}} mt-3" role="alert"> {{{ perpibcontent }}} {{#perpibdismiss}} <button type="button" id="themeboostcampusperpinfobannerclosebutton" class="close" data-dismiss="alert" aria-label="{{#str}}close, theme_boost_campus{{/str}}"> -- GitLab