fix(views): legacy guard for pre-Prompt-M DB rows without theme reset

A DB row from before Prompt M still carries the old on/off keys
(brandlogo/centerlogo/rightlogo). When the theme files are updated WITHOUT
a theme reset, such a row (e.g. centerlogo=off with a non-empty old
centerlogofile) would show that logo under the new file-only logic. The
views now also honor the legacy key when present: <pos>logo == 'off' keeps
the logo hidden (|default('on') after a reset, where the key is gone).
Fresh installs are unaffected: all new keys have config.xml defaults and
the views fall back via |default when keys are absent.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-24 23:23:59 +01:00
commit cea02487c7
3 changed files with 10 additions and 5 deletions

View file

@ -92,7 +92,7 @@ NOTE: Feel free to ask for functions, variables, etc, that you feel are missing
{{ include('./subviews/header/head.twig') }}
<body
class=" {{ aSurveyInfo.class.body }} font-{{ aSurveyInfo.options.font }} lang-{{ aSurveyInfo.languagecode }} {{ aSurveyInfo.surveyformat }} {% if( aSurveyInfo.options.brandlogofile|default('off') not in ['off', '', 'inherit']) %}brand-logo{% endif %}" {{ aSurveyInfo.attr.body }} >
class=" {{ aSurveyInfo.class.body }} font-{{ aSurveyInfo.options.font }} lang-{{ aSurveyInfo.languagecode }} {{ aSurveyInfo.surveyformat }} {% if( aSurveyInfo.options.brandlogofile|default('off') not in ['off', '', 'inherit'] and aSurveyInfo.options.brandlogo|default('on') != 'off') %}brand-logo{% endif %}" {{ aSurveyInfo.attr.body }} >
{# This used for the pjax system #}
<div id="beginScripts">

View file

@ -65,7 +65,7 @@
background-color: {{ aSurveyInfo.options.privacybackgroundcolor }};
}
{% if ( aSurveyInfo.options.brandlogofile|default('off') not in ['off', '', 'inherit'] ) %}
{% if ( aSurveyInfo.options.brandlogofile|default('off') not in ['off', '', 'inherit'] and aSurveyInfo.options.brandlogo|default('on') != 'off' ) %}
body .top-container {
margin-top: 0;
}

View file

@ -54,9 +54,14 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
{% set brandLogoFile = aSurveyInfo.options.brandlogofile|default('off') %}
{% set centerLogoFile = aSurveyInfo.options.centerlogofile|default('off') %}
{% set rightLogoFile = aSurveyInfo.options.rightlogofile|default('off') %}
{% set showBrandLogo = (brandLogoFile not in ['off', '', 'inherit'] and imageSrc(brandLogoFile)) %}
{% set showCenterLogo = (centerLogoFile not in ['off', '', 'inherit'] and imageSrc(centerLogoFile)) %}
{% set showRightLogo = (rightLogoFile not in ['off', '', 'inherit'] and imageSrc(rightLogoFile)) %}
{# Legacy guard: a DB row from BEFORE Prompt M (theme files updated WITHOUT a
theme reset) still carries the old on/off keys. If such a row has e.g.
centerlogo="off" while its old centerlogofile still holds a path, the logo
must stay hidden. After a theme reset the old keys are gone from the row
and |default('on') lets the logo show again. #}
{% set showBrandLogo = (brandLogoFile not in ['off', '', 'inherit'] and aSurveyInfo.options.brandlogo|default('on') != 'off' and imageSrc(brandLogoFile)) %}
{% set showCenterLogo = (centerLogoFile not in ['off', '', 'inherit'] and aSurveyInfo.options.centerlogo|default('on') != 'off' and imageSrc(centerLogoFile)) %}
{% set showRightLogo = (rightLogoFile not in ['off', '', 'inherit'] and aSurveyInfo.options.rightlogo|default('on') != 'off' and imageSrc(rightLogoFile)) %}
{# THEME ADDITION: font for the header / top menu (config.xml option "headerfont",
type fontselect). "base" = same as the base font: no extra class, the navbar
inherits the body font (body gets font-<base font>). Applied on #survey-nav,