- Twig 61.5%
- JavaScript 24.6%
- PHP 8.9%
- Shell 5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
config.xml: Images background block reordered to backgroundimage, bodybackgroundcolor, then the three image-detail children (backgroundimagefixed/display/file, all parent="backgroundimage") — the color stays directly below the Yes/No choice, the details only matter when an image is shown. options.twig: the .option-visibility wrapper now gets a server-side d-none at render time when the parent buttons group's current value is not the show-value, so the initial state matches the stored value even before/without options.js; options.js updateVisibilityByParent() keeps toggling on change (idempotent, verified by jsdom test). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> |
||
| css | ||
| files | ||
| options | ||
| scripts | ||
| variants | ||
| views | ||
| .gitattributes | ||
| .gitignore | ||
| config.xml | ||
| LICENSE | ||
| README.md | ||
Respondage Vanilla — LimeSurvey theme (version 6/7 compatible), extension of the core Vanilla theme.
This is a very elaborate starter theme. You can use this as your own or your organisation's theme by adapting several theme settings. You can also make your own variant. See the instructions for this developer's work. Client-specific variants (e.g. respondage_<client>)
extend this theme via <extends>vanilla_respondage</extends> and contain only
a generated config.xml plus their own files/ (logos). LimeSurvey inherits
all files (views, css, js, images, options page) from the starter theme, so any
change to a file in this theme automatically applies to all variants — no
copying of files needed.
Features
- Neatly formatted options list: the theme ships its own custom options
page (
<optionspage>custom</optionspage>+options/options.twig). All options fromconfig.xmlare rendered generically, grouped per category in tabs, with consistent Bootstrap form markup, conditional visibility of child options (a field withparent="..."is hidden unless the parent ison), image previews (lightbox) and image upload — seeoptions/options.twigand the sections below. - Header with left / center / right logos: the left logo always sticks to the far left, the center logo is always exactly centered (absolutely positioned, independent of the other logos), the right logo always sticks to the far right; when a right logo is present, the right-side menu texts (language changer, save/clear all, question index) still appear at the right but BELOW the logo. Each logo can be hidden on small screens.
- House-style colors, fonts and logos per client variant, without code duplication (thin variants extending this starter theme).
Why use this theme
Arguments for choosing Respondage Vanilla:
- Local fonts — and you can add your own. Every selectable font is served
from your own LimeSurvey server: the bundled open source fonts in
files/fonts/(woff2 +@font-faceincss/fonts.css) and the browser/system fonts (the localfont-websafepackage, pure CSS stacks). Adding your own font is documented step by step infiles/fonts/README.md(license file + font file +@font-face+ dropdown entry inconfig.xml), and per client variant viafontOptionsinvariants/<client>.json+variants/build.php. On top of the base (default) font there are per-element font overrides — header, progress bar, question titles, answers/help, group titles/descriptions, buttons — see "Per-element font overrides (fontselect)" below. - No calls to Google — or any other external host — while surveys are being
taken (privacy by design). Enforced at three levels: (1) all fonts are
self-hosted or system fonts, no external
@font-face/css/js/twig anywhere in the theme; (2) a runtime whitelist inoptions/options.js(ALLOWED_FONT_PACKAGES = ['websafe']) that only ever lets the localfont-websafepackage intopackages_to_load— package-based external fonts (e.g. Google-hostedfont-roboto/font-noto) are skipped with a warning, so adding Google Fonts via the theme options is no longer possible; (3) a build-time check invariants/export_public.shthat aborts the public release when any text file references an external host. Caveat: if you deliberately hardcode an external URL yourself (e.g. a Google Fonts<link>in your own css file), no theme can stop a developer from doing that on purpose — but the theme as shipped never does, and such a release would fail the export check. - Big Tech free, as befits Open Source Software. The theme is licensed
GPL v2 or later (see
LICENSE), has no proprietary dependencies, no telemetry and no external services: everything a respondent's browser loads during a survey comes from your own server.
What's in here
config.xml— theme manifest incl. all theme options (colors, fonts, font sizes/weights/colors, header logos, ...).views/— twig overrides (header with left/center/right logos and navbar menu color, survey list, question, group description).css/plain.css— theme styles (listed in config.xml<files>and served as-is by LimeSurvey). The asset manager hashes the file mtime into the published URL, so a changed css is picked up automatically (no cache clear needed).css/custom.css,scripts/custom.js— loaded last, safe for project tweaks.options/— the CUSTOM options page: config.xml sets<optionspage>custom</optionspage>, so LimeSurvey rendersoptions/options.twig(and auto-registersoptions/options.js) instead of the coreoptions_core.php. The twig renders all options generically from the<options>in config.xml (viaaOptionAttributes), grouped by category, so adding an option to config.xml is enough — it appears in the UI automatically.options/options.jsis a copy of the core packageassets/packages/themeoptions-core/themeoptions-core.js(patched to also hide.action_hide_on_inheritrows on "Inherit everything"; re-apply that patch when updating the copy).variants/— build/export tooling only; not part of this public repo (the whole folder is gitignored, see.gitignore, and stays local / in the private variants repo). Client variant definitions (variants/*.json) hold confidential house-style values and live in the private variants repo, not here.
Multiple languages in the theme options (i18n)
All labels on the custom options page (options/options.twig) go through
gT(): option titles, category names, optionlabels, the Yes/No/Inherit
buttons, and the dropdown labels (via
TemplateManifest::translateDropdownOptions(); in our twig via gT() on the
options). The options page therefore automatically shows the logged-in
admin's UI language — for every string that exists in the translation catalog.
LimeSurvey merges two translation sources (LSMessageSource::loadMessages()):
- the gettext catalogs
locale/<lang>/<lang>.mo— these contain all core strings in ~60 languages (Yes, No, Inherit, ...); - the database tables
lime_source_message+lime_message(source_message(id, category, message),message(id, language, translation); merged at DBVersion >= 480).
Translating your own theme strings is done per installation via the
message tables (pure data in your own DB, no core change). The source string
must exactly match the title= in config.xml (English is the source language):
INSERT INTO lime_source_message (category, message)
VALUES ('', 'Display logo on the left of the header');
INSERT INTO lime_message (id, language, translation)
VALUES (LAST_INSERT_ID(), 'nl', 'Toon logo links in de header');
Repeat per language/label. The admin sees the translation as soon as their UI language matches. Note: the sandboxed twig has no accessor for the current language code, so an in-theme translation dictionary cannot reliably pick the language — the message tables are the right mechanism for that (a feature request to expose the current language to twig has been prepared for the LimeSurvey developers).
Header logos (left / center / right)
Three independent logo options in the Images category: brandlogo(+brandlogofile)
left, centerlogo(+centerlogofile) center, rightlogo(+rightlogofile)
right. The center logo is absolutely positioned at left: 50% of the
full-width navbar container (see css/plain.css), so it sits in the true
center of the header no matter how wide the left or right logo is. Logo files
are looked up in the theme's own files/ folder first, then in the starter
theme's files/ folder.
Each logo also has a "hide on small screens" option: brandlogohideonsmall,
centerlogohideonsmall, rightlogohideonsmall (Images category, on/off,
default on, parent = the logo's on/off option). on = the logo is hidden
below the Bootstrap md breakpoint (d-none d-md-block in nav_bar.twig);
off = the logo is always shown. All logo options (on/off, file, hide-on-small)
appear automatically in the custom options page (see options/options.twig).
Menu item color in the top bar
Option navbarfontcolor (Colors category) sets the text color of the menu
items in the navbar; it is applied in views/subviews/header/custom_header.twig
and should contrast with headerbackgroundcolor.
Distance from the logo to the top of the screen
Option logotopmargin (Images category, e.g. 15px or 0px) sets the top
padding of the header logos, applied in custom_header.twig. Use 0px to
align a logo exactly with the top of the screen.
Sticky header per screen size (computer / tablet / mobile)
In the Top of the page tab: headersticky ("Make header sticky", Yes/No,
default Yes) with three child checkboxes — headerstickycomputer
("Computer screen"), headerstickytablet ("Tablet"), headerstickymobile
("Mobile phone") — visible/enabled only when the master switch is on.
Defaults: sticky on computer and tablet, not on mobile.
The breakpoints are Bootstrap's default ones: phone < md (768px), tablet
md–lg (768–991px), computer ≥ lg (992px). custom_header.twig emits the
.fixed-top rules inside the selected range(s) as media queries on
#survey-nav; nav_bar.twig no longer hardcodes fixed-top (before a theme
reset, when the options don't exist in the DB yet, the old always-sticky
fixed-top behaviour is kept as fallback). scripts/custom.js corrects the
body padding-top per viewport: when the header is not fixed at the current
width, the extra padding is removed.
Bundled open source fonts (self-hosted custom fonts)
To show that self-hosted fonts work just as well as browser fonts, the starter theme
bundles seven OFL-licensed fonts (woff2, subsetted to latin + latin-ext)
in files/fonts/:
- EB Garamond (serif, variable 400–800) — https://open-foundry.com/fonts/eb-garamond
- Inter (sans-serif, variable)
- Noto Sans (sans-serif, variable 100–900) — default of the
fontoption - Liberation Sans (sans-serif, static 400 + 700) — https://open-foundry.com/fonts/liberation-sans
- Noto Serif (serif, variable 100–900)
- Open Sans (sans-serif, variable 300–800)
- Source Serif 4 (serif, variable)
They are wired up like any custom font: @font-face + generic .font-<value>
rules in css/fonts.css (registered in config.xml <files><css>), and
dropdown entries in the optgroup "Bundled open source fonts" of the font
option (data-font-package stays websafe; the real font is loaded by the
theme's own css, not by a core package). The selected base font is applied as
class font-<value> on <body>.
Font dropdown order and defaults
The optgroups of every font dropdown (base font + all per-element fontselect
overrides) are ordered as:
- Custom (this theme) — only shown when the theme/variant ships its own font(s); an empty category is removed from the dropdown
- Bundled open source fonts — the self-hosted fonts above
- User browser — websafe system fonts
- Local server - Core / User — the font packages installed on the LimeSurvey server itself, always last because they differ per installation
Core prepends the "Local server" groups server-side (TemplateManifest:: getOptionAttributes() inserts them before the config.xml optgroups), so this
order can only be applied client-side. It is done by an inline script in
options/options.twig (registerScript(..., 'POS_END') — an explicit position
is required, the default resolves to a position Yii never renders), rendered into
the page HTML itself so it always runs on a fresh page load. The same logic is
in options/options.js (reorderFontDropdowns()) as a fallback; running twice is
idempotent. Server packages are detected structurally: their first option has
data-font-package === value. The inline script also removes empty optgroups
and sets the base font select's value from the stored options (and patches it
into the serialized JSON on submit), so the default font displays and saves
correctly even if options/options.js itself was served stale from the browser
cache.
Because core registers options/options.js without a cache-busting hash
(LSETwigViewRenderer::renderOptionPage()), browsers may heuristically cache it
(the file is served with only Last-Modified/ETag). options/options.twig
therefore re-registers it as options.js?v=<OPTIONS_JS_TOKEN> — bump
OPTIONS_JS_TOKEN in options/options.twig whenever options/options.js
changes, so every browser fetches the new file once.
Default of the font option in this mother theme is Noto Sans (a bundled
font, so the showcase looks identical on every installation — never a core
package font, which varies per server). variants/build.php automatically
sets the default of a variant to its first fontOptions entry (the client's
own font) when the variant json does not set options.font explicitly.
Per-element font overrides (fontselect)
Next to the base font (the default, used everywhere), the Fonts tab offers
one dropdown per page element: header/top menu (headerfont), progress bar
(progressbarfont), question titles (questiontitlefont), answers + help texts
(answersfont), group titles (grouptitlefont), group descriptions
(groupdescriptionfont) and the navigator buttons (buttonsfont). Each dropdown
offers the same choices as the base font dropdown (bundled + variant-custom +
browser fonts) plus "Same as base font" (value base, the default: no extra
class is emitted, the element inherits the body font). A chosen value is applied
as class font-<value> on that element in the views — which is why the class
rules in css/fonts.css (and in a variant's own css) must be generic
(.font-x, not body.font-x). options/options.js makes sure the packages of
all selected fonts are loaded (packages_to_load).
Adding your own font? See files/fonts/README.md (English walkthrough:
license file + font file in files/fonts/, @font-face rule in
css/fonts.css, <option> in the optgroup, then upload + reset the theme).
Custom fonts per variant
LimeSurvey only knows its core font packages (application/config/fonts.php),
so a theme cannot register a font-* package itself. Instead a variant ships
its own font files and css:
- Put the font files in the client folder of the PRIVATE variants repo:
respondage_<client>/files/fonts/(e.g.my-custom-font.woff2). This folder is standard per client and is copied into the generated theme automatically bybuild.php(together with e.g.files/*.pnglogos andcss/variant.css). - Create
css/variant.cssin that same client folder with the@font-faceand the GENERIC class rule.font-<value>(notbody.font-<value>): the class is applied on<body>for the base font, and on individual elements for the per-element font overrides (fontselect options):
(@font-face { font-family: 'My Custom Font'; src: url('../files/fonts/my-custom-font.woff2') format('woff2'); font-weight: 400; font-style: normal; } .font-my_custom_font { font-family: 'My Custom Font', Arial, sans-serif; }../files/...works because the asset manager copies the whole theme dir.) - In
variants/<client>.jsondeclare the css file and the dropdown entry:{ "files_add": { "css": ["css/variant.css"], "js": [] }, "fontOptions": [ { "value": "my_custom_font", "label": "My Custom Font" } ] }build.phpappends the css to the<files>list and the font to the "Custom (this theme)" optgroup of the font dropdown (data-font-packagestayswebsafe, so no nonexistent package is requested — the real font is loaded by the variant's own css). - Run
php variants/build.php <client> <definitions-dir>(or set RESPONDAGE_VARIANTS_DIR) and upload/reset as usual. The<client>/assets folder from the definitions dir is copied into../<client>/automatically.
Client variants (house styles) without code duplication
House-style-specific values are ONLY: colors, fonts, and font sizes/colors/weights (plus logo files). Everything else lives once, here.
Theme preview image per variant (files/preview.png)
The theme list shows files/preview.png of each theme (hard-coded in core,
TemplateConfiguration::getPreview() — preview.svg is NOT picked up; a feature
request for SVG support and starter-theme fallback has been prepared for the
LimeSurvey developers). The preview is read
from the theme's OWN files folder — there is no starter-theme fallback — so every
variant should ship its own files/preview.png: put it in
<client>/files/preview.png in the private variants repo; build.php copies
the whole <client>/ asset folder into the generated variant automatically.
A variant without its own preview shows "No preview available" in the theme
list.
Workflow:
- In
config.xml, the house-style options are marked withHOUSE-STYLEcomments (colors, fonts, font sizes/weights, logo files, logo top margin, background image/color). Only those values belong in a variant json — never hardcode house-style values in shared files (views/,css/,scripts/), because those are inherited by all variants. - Create
variants/<client>.jsonwith the variant name/title/description and only the house-style option keys with the client values:{ "name": "respondage_client", "title": "Client Vanilla", "options": { "primarycolor": "#123456", "fontsize": "18px" } } - Run
php variants/build.php <client>. This generates../<client>/config.xml: a copy of this theme's config.xml with only those option values replaced,<extends>set to this theme, and the<engine>section emptied except<optionspage>(same as LimeSurvey's own "extend theme" action), so engine settings are inherited. The<files>list is kept: LimeSurvey resolves each listed file in the variant first and then in the starter theme, so the starter theme's css/js keep loading until a variant ships its own file with the same name. Unknown option keys make the build fail loudly, so drift is caught at build time. - The
<client>/assets (logos,files/fonts/,css/variant.css,files/preview.png) from the definitions dir are copied into../<client>/automatically — every build OVERWRITES existing files there, so never edit the generated folder by hand. Upload the folder toupload/themes/survey/and install/reset the theme in LimeSurvey, then FLUSH the LimeSurvey asset cache and hard-refresh the browser (Ctrl+F5) — after a rebuild the asset hash changes, and a stale cached css is exactly how an old placeholder font keeps showing. REBUILD RULE: after every change to<client>.jsonor<client>/in the private definitions repo, re-runphp variants/build.php <client>and reset the variant theme in LimeSurvey — a variant folder that is not rebuilt after a definitions change is stale (fonts/logo/css then don't match, e.g. an old placeholdercss/variant.csskeeps loading instead of the client font). IMPORTANT: a variant only works when the starter themevanilla_respondageis also present inupload/themes/survey/on the server — the variant extends it and inherits all views/css/js/options from it. The core themevanilla(which this starter theme extends) ships with LimeSurvey itself, so that one is always there. So deploy:vanilla_respondage+ eachrespondage_<client>you use.
Because of the native <extends> mechanism:
- changes to any file (twig/css/js) in this starter theme apply to all variants immediately — edit them only here;
- changes to non-house-style option defaults in
config.xmlapply to a variant after re-running the build script and resetting that variant theme; - house-style values live only in
variants/<client>.jsonand the variant'sfiles/, so they are never overwritten by changes in this starter theme.
Security
Security measures of this theme are documented in this section — for transparency and to support review and acceptance of the theme. The theme never modifies the LimeSurvey core; core-side improvement wishes are filed as well-substantiated English feature requests.
Measures currently in place:
- Public-release leak check —
variants/export_public.shscans the staged release for client-identifying strings (client names, terms, house-style hex colors; patterns derived from sibling variant folders +variants/leak-patterns.txt) and ABORTS when any are found. Client variant definitions, internal notes, prompt logs and feature-request drafts are excluded from the export, so nothing client-specific can be published by accident. - Theme-relative asset resolution — images referenced by options are resolved
through LimeSurvey's
imageSrc()/image()(theme-relative paths only, with the starter theme as fallback), never from arbitrary URLs.imageSrc()also validates the file withLSYii_ImageValidatoragainstallowedthemeimageformats(defaultgif,ico,jpg,jpeg,png): SVG logo files are rejected, so ship logos referenced by options as PNG (keep the SVG as source in the private variants repo and export a PNG next to it). - Sandboxed rendering — all theme templates render through LimeSurvey's sandboxed twig environment; the theme adds no template engine of its own.
- No secrets in the repo — house-style values (colors, fonts, logos) live only
in the private variants repo / gitignored
variants/*.json. - No external calls during survey-taking (privacy) — while a survey is being
taken, this theme never requests anything from Google or any other external
host. Guaranteed at three levels:
- Self-hosted fonts — all selectable fonts are either bundled in
files/fonts/(served from the LimeSurvey server's own assets viacss/fonts.css) or browser/system fonts (the localfont-websafepackage, pure CSS stacks). No@font-face/css/js/twig in the theme references an external font host. - Runtime package whitelist —
options/options.jsonly ever addsfont-websafetopackages_to_load; any other font package is skipped with a console warning. The engine<packages>inconfig.xmllists only local packages (pjax,moment). The Google-hosted core packages (font-roboto, font-noto, …) are deliberately not registered inoptions/options.twig. - Build-time check —
variants/export_public.shscans the staged release forhttp(s)://hostreferences in all text files and ABORTS on any host outside a small allowlist of comment/doc links (so googleapis.com, gstatic.com, fonts.google.com, cdnfonts.com, jsdelivr.net, … can never ship).
- Self-hosted fonts — all selectable fonts are either bundled in
The theme is under continuous security audit (twig output/XSS, path handling, upload handling, build/export scripts). Every approved security measure — together with its usability impact — is added to this list as it lands.
Report a vulnerability privately to tammo.terhark@respondage.nl — please do not open a public issue with exploit details.
License
This theme is free software: you can use, copy, modify and distribute it under the
terms of the GNU General Public License version 2 or later (GPL-2.0-or-later) —
the same license family as LimeSurvey core itself. The full license text ships with
the theme in the LICENSE file.
The GPL is copyleft: copies and derivatives of this theme cannot become proprietary when distributed — they must stay under the GPL.
Client variants you build yourself with variants/build.php may be kept private: GPL
obligations apply only when you distribute a variant, not to internal use. Client
logos and other client assets inside a variant are separate copyrighted material and
are not covered by this theme's license.
Public release
The public version of this theme is ONLY the starter theme, and this public
repository (Forgejo) already IS that version: it contains only the files
needed to run the theme (config.xml, views/, options/, css/,
scripts/, files/, README.md, LICENSE). All helper files stay local and
are gitignored (see .gitignore), so they are never pushed:
variants/— build/export tooling (build.php,export_public.sh) and the confidential client definitions (*.json,leak-patterns.txt,README.internal.md);sass/— developer-only sources ofcss/plain.css;css/*.map— source maps from the local sass compile;AGENTS.md,prompts.md,FEATURE_REQUEST*.md,BUG_REPORT*.md— internal notes and drafts;/dist/— old export zips.
Optionally, a checked zip of the public release can still be built LOCALLY with:
bash variants/export_public.sh [output-dir]
(the script and its leak check live in the local-only variants/ folder;
default output: <limesurvey-root>/dist/). Publish only the public repo /
its main branch or that checked artifact.
NEVER publish: variants/*.json, generated client theme folders, or any git
branch containing a client theme (client names, colors and logos are
confidential). Client variant definitions stay in a PRIVATE repository (or
locally); build.php reads the definitions from that private folder via its
second argument or RESPONDAGE_VARIANTS_DIR.