2026-06-17 10:06:07 +02:00
|
|
|
{#
|
|
|
|
|
LimeSurvey
|
|
|
|
|
Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac
|
|
|
|
|
All rights reserved.
|
|
|
|
|
License: GNU/GPL License v2 or later, see LICENSE.php
|
|
|
|
|
LimeSurvey is free software. This version may have been modified pursuant
|
|
|
|
|
to the GNU General Public License, and as distributed it includes or
|
|
|
|
|
is derivative of works licensed under the GNU General Public License or
|
|
|
|
|
other free or open source software licenses.
|
|
|
|
|
See COPYRIGHT.php for copyright notices and details.
|
|
|
|
|
|
|
|
|
|
(¯`·._.·(¯`·._.· Bootstrap Navigation Bar ·._.·´¯)·._.·´¯)
|
|
|
|
|
|
|
|
|
|
This file renders a typical bootstrap navigation bar.
|
|
|
|
|
See: https://getbootstrap.com/components/#navbar
|
|
|
|
|
|
|
|
|
|
For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
|
|
|
|
#}
|
feat(options): logo section as 3 columns (file/margin/per-device) in Top-of-page tab
Prompt M: per logo position (left=brand, center, right) the options page now
shows one column with vertical separators and an <hr> below: file dropdown
with 'No logo' (off) first, top margin as plain number 0-100, and 'Show logo
on' with computer/tablet/mobile checkboxes. New option keys per position:
<pos>logofile, <pos>logotopmargin, <pos>showon{computer,tablet,mobile};
old keys (brandlogo/centerlogo/rightlogo, *logohideonsmall, shared
logotopmargin) removed from config.xml. Views map the checkboxes to
Bootstrap display classes per breakpoint and emit per-logo padding-top;
variants/build.php migrates the old json keys to the new ones.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-24 23:14:10 +01:00
|
|
|
{# Prompt M: per-device visibility of a logo as Bootstrap display classes.
|
|
|
|
|
Options per position: <pos>showoncomputer (default on), <pos>showontablet
|
|
|
|
|
(default on), <pos>showonmobile (default off). Breakpoints are Bootstrap's:
|
|
|
|
|
mobile < 768px (< md), tablet 768-991px (md..lg), computer >= 992px (>= lg).
|
|
|
|
|
A plain div is block at every size, so each range needs its explicit class. #}
|
|
|
|
|
{% macro logoVisibilityClasses(options, pos) -%}
|
|
|
|
|
{%- set c = (options[pos ~ 'showoncomputer']|default('on')) == 'on' -%}
|
|
|
|
|
{%- set t = (options[pos ~ 'showontablet']|default('on')) == 'on' -%}
|
|
|
|
|
{%- set m = (options[pos ~ 'showonmobile']|default('off')) == 'on' -%}
|
|
|
|
|
{%- if c and t and m -%}
|
|
|
|
|
{%- elseif m and t -%}d-lg-none
|
|
|
|
|
{%- elseif m and c -%}d-md-none d-lg-block
|
|
|
|
|
{%- elseif m -%}d-md-none
|
|
|
|
|
{%- elseif t and c -%}d-none d-md-block
|
|
|
|
|
{%- elseif c -%}d-none d-lg-block
|
|
|
|
|
{%- elseif t -%}d-none d-md-block d-lg-none
|
|
|
|
|
{%- else -%}d-none
|
|
|
|
|
{%- endif -%}
|
|
|
|
|
{%- endmacro %}
|
|
|
|
|
{% import _self as navmacros %}
|
fix(security): sanitize theme option values at emission (S1) and escape imagefile option HTML (S2)
S1 (HIGH, SECURITY_REVIEW_20261129.md): LimeSurvey renders theme twig with
autoescape OFF, so stored option values are untrusted on the public survey
pages. New views/subviews/security_macros.twig provides validators (color,
length, keyword, fontslug, pxnum, iconcode) applied at every emission point:
the <style> block in custom_header.twig (incl. the resolved values of the
cm()/cmbg() chooser macros), the inline style="color:..." and font-<slug>
class attributes in all survey subviews, and the <body> font class +
data-thememode in the newly overridden layout_global.twig and
layout_survey_list.twig. Crafted values fall back to the configured
defaults; legitimate picker/enum/slug values pass unchanged.
S2 (MEDIUM): options/options.twig escapes group/preview/filepath/filename
with |e('html_attr')/|e('html') when building the imagefile <option> HTML.
Verified: twig compile of all changed templates, malicious-value renders
neutralized + legit renders unchanged, live surveys 216664/282267 render
correct colors with no twig errors, jsdom custom_js tests pass (options_*
tests still need /tmp fixtures, pre-existing), export_public.sh exit 0.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-30 11:27:38 +01:00
|
|
|
{# S1: sanitize option values at emission (autoescape is OFF) — see security_macros.twig #}
|
|
|
|
|
{% import './subviews/security_macros.twig' as sec %}
|
2026-06-17 10:06:07 +02:00
|
|
|
{% if not aSurveyInfo.popupPreview %}
|
|
|
|
|
{% set navClass = "navbar-light bg-light" %}
|
|
|
|
|
{% if( aSurveyInfo.template == "bootswatch") %}
|
|
|
|
|
{% set navClass = "navbar-default bg-primary" %}
|
|
|
|
|
{% endif %}
|
|
|
|
|
<!-- Bootstrap Navigation Bar -->
|
|
|
|
|
{# ShowMenu used for navbar-toggler and navbar-collapse #}
|
|
|
|
|
{% set ShowMenu = (aSurveyInfo.aNavigator.load.show == "Y" or aSurveyInfo.aNavigator.save.show == "Y")
|
|
|
|
|
or ((aSurveyInfo.bShowClearAll == true or aSurveyInfo.bShowClearAll == null) and aSurveyInfo.options.showclearall == 'on')
|
|
|
|
|
or (aSurveyInfo.aQuestionIndex.bShow == true and aSurveyInfo.format != 'A')
|
|
|
|
|
or (aSurveyInfo.alanguageChanger.show)
|
|
|
|
|
%}
|
feat(options): logo section as 3 columns (file/margin/per-device) in Top-of-page tab
Prompt M: per logo position (left=brand, center, right) the options page now
shows one column with vertical separators and an <hr> below: file dropdown
with 'No logo' (off) first, top margin as plain number 0-100, and 'Show logo
on' with computer/tablet/mobile checkboxes. New option keys per position:
<pos>logofile, <pos>logotopmargin, <pos>showon{computer,tablet,mobile};
old keys (brandlogo/centerlogo/rightlogo, *logohideonsmall, shared
logotopmargin) removed from config.xml. Views map the checkboxes to
Bootstrap display classes per breakpoint and emit per-logo padding-top;
variants/build.php migrates the old json keys to the new ones.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-24 23:14:10 +01:00
|
|
|
{# THEME ADDITION (Prompt M): per-logo file option (<pos>logofile; "off" or
|
|
|
|
|
empty = no logo). The old on/off keys (brandlogo/centerlogo/rightlogo)
|
|
|
|
|
are gone — the file option alone decides whether a logo shows. #}
|
|
|
|
|
{% set brandLogoFile = aSurveyInfo.options.brandlogofile|default('off') %}
|
|
|
|
|
{% set centerLogoFile = aSurveyInfo.options.centerlogofile|default('off') %}
|
|
|
|
|
{% set rightLogoFile = aSurveyInfo.options.rightlogofile|default('off') %}
|
2026-11-24 23:23:59 +01:00
|
|
|
{# 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)) %}
|
2026-11-24 22:04:11 +01:00
|
|
|
{# 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,
|
|
|
|
|
so it covers the menu items and the survey name as well. #}
|
|
|
|
|
{% set sHeaderFont = aSurveyInfo.options.headerfont|default('base') %}
|
feat(options): Fonts tab becomes 'Fonts and colors' with per-element font+color combos (Prompt U)
Tab 'Fonts' is renamed to 'Fonts and colors' and gets a dedicated layout:
top row (col 1: font, fontcolor, fontsize; col 2: primarycolor +
new secondarycolor; col 3 empty), an hr, then one combo row per element
(header, progressbar, questiontitle, answers, grouptitle,
groupdescription, buttons) with col 1 = existing <el>font fontselect,
col 2 = new <el>textcolor dropdown (default|primary|secondary|other),
col 3 = new <el>textcolorcustom colorpicker, visible only when mode is
'other' (parent show-value via aShowIfValues, server-side initial d-none,
options.js updateVisibilityByParent/updateChild now handle select parents,
multi-value aware; font's self-parent removed from config.xml).
config.xml: fontcolor/primarycolor moved from Colors to Fonts (retitled
'Default font color (body text)' / 'Primary color'), secondarycolor added
(default #888888), 14 per-element color keys added with dropdownoptions.
Views emit the per-element color as inline style (default->fontcolor,
primary->primarycolor, secondary->secondarycolor, other->custom picker).
Colors tab now only holds sliderhandlecolor + privacybackgroundcolor
(final Colors layout = Prompt T, still open).
Variants rebuilt (defensie, erasmus, example respondage_respondage) —
no unknown-key failures; theme reset in LS-admin still owner action.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-25 11:51:57 +01:00
|
|
|
{# Prompt U: per-element text color — mode default -> fontcolor, primary ->
|
|
|
|
|
primarycolor, secondary -> secondarycolor, other -> headertextcolorcustom.
|
|
|
|
|
Emitted as an inline style on #survey-nav below. #}
|
|
|
|
|
{% set sHeaderTextColorMode = aSurveyInfo.options.headertextcolor|default('default') %}
|
|
|
|
|
{% set sHeaderTextColor = sHeaderTextColorMode == 'primary' ? aSurveyInfo.options.primarycolor|default('') : (sHeaderTextColorMode == 'secondary' ? aSurveyInfo.options.secondarycolor|default('') : (sHeaderTextColorMode == 'other' ? aSurveyInfo.options.headertextcolorcustom|default('') : aSurveyInfo.options.fontcolor|default(''))) %}
|
fix(security): sanitize theme option values at emission (S1) and escape imagefile option HTML (S2)
S1 (HIGH, SECURITY_REVIEW_20261129.md): LimeSurvey renders theme twig with
autoescape OFF, so stored option values are untrusted on the public survey
pages. New views/subviews/security_macros.twig provides validators (color,
length, keyword, fontslug, pxnum, iconcode) applied at every emission point:
the <style> block in custom_header.twig (incl. the resolved values of the
cm()/cmbg() chooser macros), the inline style="color:..." and font-<slug>
class attributes in all survey subviews, and the <body> font class +
data-thememode in the newly overridden layout_global.twig and
layout_survey_list.twig. Crafted values fall back to the configured
defaults; legitimate picker/enum/slug values pass unchanged.
S2 (MEDIUM): options/options.twig escapes group/preview/filepath/filename
with |e('html_attr')/|e('html') when building the imagefile <option> HTML.
Verified: twig compile of all changed templates, malicious-value renders
neutralized + legit renders unchanged, live surveys 216664/282267 render
correct colors with no twig errors, jsdom custom_js tests pass (options_*
tests still need /tmp fixtures, pre-existing), export_public.sh exit 0.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-30 11:27:38 +01:00
|
|
|
{% set sHeaderTextColor = sec.color(sHeaderTextColor, '') %}
|
2026-11-24 23:03:57 +01:00
|
|
|
{# THEME ADDITION: sticky header per screen size (options
|
|
|
|
|
headersticky{computer,tablet,mobile}; Prompt L — the master key no longer
|
|
|
|
|
counts). When the checkbox options exist (theme was reset after adding
|
|
|
|
|
them), fixed-top is NOT hardcoded here anymore — custom_header.twig emits
|
|
|
|
|
the media queries instead. Before a reset the old behaviour (always
|
|
|
|
|
fixed-top) is kept as fallback. #}
|
|
|
|
|
{% set bStickyConfigured = aSurveyInfo.options.headerstickycomputer is defined %}
|
fix(security): sanitize theme option values at emission (S1) and escape imagefile option HTML (S2)
S1 (HIGH, SECURITY_REVIEW_20261129.md): LimeSurvey renders theme twig with
autoescape OFF, so stored option values are untrusted on the public survey
pages. New views/subviews/security_macros.twig provides validators (color,
length, keyword, fontslug, pxnum, iconcode) applied at every emission point:
the <style> block in custom_header.twig (incl. the resolved values of the
cm()/cmbg() chooser macros), the inline style="color:..." and font-<slug>
class attributes in all survey subviews, and the <body> font class +
data-thememode in the newly overridden layout_global.twig and
layout_survey_list.twig. Crafted values fall back to the configured
defaults; legitimate picker/enum/slug values pass unchanged.
S2 (MEDIUM): options/options.twig escapes group/preview/filepath/filename
with |e('html_attr')/|e('html') when building the imagefile <option> HTML.
Verified: twig compile of all changed templates, malicious-value renders
neutralized + legit renders unchanged, live surveys 216664/282267 render
correct colors with no twig errors, jsdom custom_js tests pass (options_*
tests still need /tmp fixtures, pre-existing), export_public.sh exit 0.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-30 11:27:38 +01:00
|
|
|
<div id="survey-nav" class="navbar {{ navClass }} navbar-expand-md {% if not bStickyConfigured %}fixed-top{% endif %} border-bottom pt-0 pb-0 {% if sHeaderFont != 'base' %}font-{{ sec.fontslug(sHeaderFont) }}{% endif %}"{% if sHeaderTextColor != '' %} style="color: {{ sHeaderTextColor }};"{% endif %}>
|
fix(header): exact logo-top margin (0px touches top); menu texts on their own header row
- nav_bar.twig: header split into two rows — row 1 .survey-nav-logo-row holds
all logos (left far left, center absolutely centered in the row, right
ms-auto far right) so they align; row 2 #navbar holds the menu texts
(language changer, save/clear all, question index) full-width, right-aligned
- sass/plain.sass (leading): #survey-nav align-items:flex-start, container
stretch, .survey-nav-logo-row relative/w-100, .logo-container and its img
padding-top:0, .logo-center top:0 translateX(-50%); dropped .logo-right
margin-left:0 (ms-auto now on the element)
- css/plain.css: compiled from sass with dart-sass (export guard green)
- custom_header.twig: <pos>logotopmargin now emitted as margin-top on the
.logo-*.logo-container, so the value is the EXACT distance from the top of
the header to the logo (0px = logo touches the top of the page)
- README.md: header layout + logo-top-distance sections updated
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-27 19:56:11 +01:00
|
|
|
<div class="container-fluid d-flex flex-column">
|
|
|
|
|
{# ROW 1 — the logos (layout rules in sass/plain.sass): left logo always
|
|
|
|
|
far left, center logo always exactly centered (absolute, independent
|
|
|
|
|
of the other logos), right logo always far right (ms-auto). All logos
|
|
|
|
|
share this single top-aligned row, so they align nicely. The per-logo
|
|
|
|
|
top margin (<pos>logotopmargin) is applied as margin-top on
|
|
|
|
|
.logo-container in custom_header.twig and is the EXACT distance from
|
|
|
|
|
the top of the header to the top of the logo (0 px = touches top). #}
|
|
|
|
|
<div class="survey-nav-logo-row d-flex align-items-start w-100">
|
|
|
|
|
{% if ShowMenu %}
|
|
|
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar"
|
|
|
|
|
aria-controls="small-screens-menus" aria-expanded="false">
|
|
|
|
|
<span class="visually-hidden-focusable">{{ gT("Tools") }}</span>
|
|
|
|
|
<span class="navbar-toggler-icon" aria-hidden="true"></span>
|
|
|
|
|
</button>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{# Left logo #}
|
|
|
|
|
{% if showBrandLogo %}
|
|
|
|
|
<div class="navbar-brand logo-container logo-left {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'brand') }}">
|
|
|
|
|
{{ image(brandLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
|
|
|
|
</div>
|
|
|
|
|
{% else %}
|
|
|
|
|
<div class="navbar-brand logo-left">
|
|
|
|
|
{{ aSurveyInfo.name }}
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{# Center logo (absolutely centered within the logo row via CSS, see sass/plain.sass) #}
|
|
|
|
|
{% if showCenterLogo %}
|
|
|
|
|
<div class="navbar-brand logo-container logo-center {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'center') }}">
|
|
|
|
|
{{ image(centerLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{# Right logo — far right of the logo row (ms-auto) #}
|
2026-11-24 22:04:11 +01:00
|
|
|
{% if showRightLogo %}
|
fix(header): exact logo-top margin (0px touches top); menu texts on their own header row
- nav_bar.twig: header split into two rows — row 1 .survey-nav-logo-row holds
all logos (left far left, center absolutely centered in the row, right
ms-auto far right) so they align; row 2 #navbar holds the menu texts
(language changer, save/clear all, question index) full-width, right-aligned
- sass/plain.sass (leading): #survey-nav align-items:flex-start, container
stretch, .survey-nav-logo-row relative/w-100, .logo-container and its img
padding-top:0, .logo-center top:0 translateX(-50%); dropped .logo-right
margin-left:0 (ms-auto now on the element)
- css/plain.css: compiled from sass with dart-sass (export guard green)
- custom_header.twig: <pos>logotopmargin now emitted as margin-top on the
.logo-*.logo-container, so the value is the EXACT distance from the top of
the header to the logo (0px = logo touches the top of the page)
- README.md: header layout + logo-top-distance sections updated
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-27 19:56:11 +01:00
|
|
|
<div class="navbar-brand logo-container logo-right ms-auto {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'right') }}">
|
feat(options): logo section as 3 columns (file/margin/per-device) in Top-of-page tab
Prompt M: per logo position (left=brand, center, right) the options page now
shows one column with vertical separators and an <hr> below: file dropdown
with 'No logo' (off) first, top margin as plain number 0-100, and 'Show logo
on' with computer/tablet/mobile checkboxes. New option keys per position:
<pos>logofile, <pos>logotopmargin, <pos>showon{computer,tablet,mobile};
old keys (brandlogo/centerlogo/rightlogo, *logohideonsmall, shared
logotopmargin) removed from config.xml. Views map the checkboxes to
Bootstrap display classes per breakpoint and emit per-logo padding-top;
variants/build.php migrates the old json keys to the new ones.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-24 23:14:10 +01:00
|
|
|
{{ image(rightLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
2026-11-24 22:04:11 +01:00
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</div>
|
fix(header): exact logo-top margin (0px touches top); menu texts on their own header row
- nav_bar.twig: header split into two rows — row 1 .survey-nav-logo-row holds
all logos (left far left, center absolutely centered in the row, right
ms-auto far right) so they align; row 2 #navbar holds the menu texts
(language changer, save/clear all, question index) full-width, right-aligned
- sass/plain.sass (leading): #survey-nav align-items:flex-start, container
stretch, .survey-nav-logo-row relative/w-100, .logo-container and its img
padding-top:0, .logo-center top:0 translateX(-50%); dropped .logo-right
margin-left:0 (ms-auto now on the element)
- css/plain.css: compiled from sass with dart-sass (export guard green)
- custom_header.twig: <pos>logotopmargin now emitted as margin-top on the
.logo-*.logo-container, so the value is the EXACT distance from the top of
the header to the logo (0px = logo touches the top of the page)
- README.md: header layout + logo-top-distance sections updated
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-27 19:56:11 +01:00
|
|
|
{# ROW 2 — the menu texts (language changer, save/clear all, question
|
|
|
|
|
index) on their own full-width row in the header, BELOW the logo row,
|
|
|
|
|
right-aligned (ms-auto on the ul). #}
|
|
|
|
|
{% if ShowMenu %}
|
|
|
|
|
<div id="navbar" class="collapse navbar-collapse navbar-nav-scroll pt-2 w-100">
|
|
|
|
|
<ul class="nav navbar-nav navbar-action-link navbar-right ms-auto">
|
|
|
|
|
{{ include('./subviews/navigation/save_links.twig') }}
|
|
|
|
|
{{ include('./subviews/navigation/clearall_links.twig') }}
|
|
|
|
|
{{ include('./subviews/navigation/question_index_menu.twig') }}
|
|
|
|
|
{{ include('./subviews/navigation/language_changer_top_menu.twig') }}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
2026-06-17 10:06:07 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|